2025-04-15 12:10:19 +02:00

49 lines
1.8 KiB
C#

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace EstrazioneAnagrafica
{
public class FormsProgramLogic : ProgramLogic
{
//we need to have reference to the controls we use for displaying notifications
//label
public Label LabelNotificator { get; set; }
//button (to disable/enable)
public Button ButtonNotificator { get; set; }
//and parent form
public Form ParentForm { get; set; }
public override void PushStatus(string message)
{
ThreadHelper.SetText(ParentForm, LabelNotificator, message);
ThreadHelper.SetVisibility(ParentForm, LabelNotificator, true);
//LabelNotificator.Visible = true;
//LabelNotificator.Text = message;
}
public override void PushErrorStatus(string message)
{
ThreadHelper.SetText(ParentForm, LabelNotificator, message);
// LabelNotificator.ForeColor = System.Drawing.Color.DarkRed;
// LabelNotificator.Text = message;
//LabelNotificator.ForeColor = System.Drawing.Color.Black;
}
public override void PushSuccessStatus(string message)
{
System.Threading.Thread.Sleep(5000);//this codes make your application waiting for 5 seconds
//sistemo i pulsanti e la label
ThreadHelper.SetText(ParentForm, LabelNotificator, message);
ThreadHelper.SetVisibility(ParentForm, LabelNotificator, false);
ThreadHelper.SetVisibility(ParentForm, ButtonNotificator, true);
//LabelNotificator.Visible = false;
//ButtonNotificator.Enabled = true;
//LabelNotificator.Text = message;
}
}
}