I am trying to monitor the connection status via Status
which automatically change the label's text on my form.
This is in my main class
private int _status;
public int Status
{
get { return _status; }
set
{
_status = value;
if (_status == (int)ServerStatus.Disconnected)
{
statusLabel.Text = "Disconnected";
statusLabel.ForeColor = Color.Red;
}
else
{
statusLabel.Text = "Connected";
statusLabel.ForeColor = Color.Green;
}
}
}
My problem now is how can I change the Status
from another class without instantiating the main class.
Or is there a better approach to what I am doing?