Пример #1
0
 public CCMS()
 {
     InitializeComponent();
     connection = new ConnectionManager();
     connection.LoginStatusChanged += new ConnectionManager.ConnectionHandler(connection_LoginStatusChanged);
     connection.TimeRemainingChanged += new ConnectionManager.TimeHandler(connection_TimeRemainingChanged);
     connection.ErrorOccured += new ConnectionManager.ErrorHandler(connection_ErrorOccured);
 }
Пример #2
0
 void connection_LoginStatusChanged(ConnectionManager conn, ConnectionEvents e)
 {
     if (e.Status == CCMSStatuses.LOGGED_IN)
     {
         btnLogin.Text = "Logout";
     }
     else if (e.Status == CCMSStatuses.LOGGED_OUT)
     {
         btnLogin.Text = "Login";
     }
 }
Пример #3
0
        void connection_TimeRemainingChanged(ConnectionManager conn, TimeEvents e)
        {
            if (InvokeRequired)
            {
                Invoke(new Action<ConnectionManager, TimeEvents>(connection_TimeRemainingChanged), conn, e);
                return;
            }

            if (e.TimeRemanining.TotalSeconds <= 1)
            {
                lblStatus.Text = "Logging you off...";
                lblStatus.ForeColor = Color.Red;
                lblStatus.Visible = true;
            }
            else
            {
                lblStatus.Text = "Time remaining: " + e.TimeRemanining.ToString("g");
                lblStatus.ForeColor = Color.Green;
                lblStatus.Visible = true;
            }
        }
Пример #4
0
 void connection_ErrorOccured(ConnectionManager conn, ErrorEvents e)
 {
     lblStatus.Text = e.ErrorMessage;
     lblStatus.ForeColor = Color.Red;
     lblStatus.Visible = true;
 }