示例#1
0
        ////////////////////////////////////////////////////////////////// BUTTONS

        private void BTN_Start_Monitoring_Click(object sender, EventArgs e)
        {
            if (BTN_TCP_Select.Checked)
            {
                if (BW_Monitoring_Engine_Running == "Stopped")
                {
                    if (!BW_TCP_Monitoring_Engine.IsBusy)
                    {
                        BW_TCP_Monitoring_Engine.RunWorkerAsync();
                        BW_Monitoring_Engine_Running    = "Started";
                        IND_Monitoring_Engine.BackColor = Color.Green;
                        DGV_Incoming_Messages.Rows.Insert(0, Incoming_Message_Index, System.DateTime.Now.ToString(), "Monitoring Started");
                        Incoming_Message_Index++;
                    }
                    else
                    {
                        BW_Monitoring_Engine_Running    = "Hung";
                        IND_Monitoring_Engine.BackColor = Color.Orange;
                        DGV_Incoming_Messages.Rows.Insert(0, Incoming_Message_Index, System.DateTime.Now.ToString(), "Monitoring Hung");
                        Incoming_Message_Index++;
                    }
                }
                else
                {
                    BW_TCP_Monitoring_Engine.CancelAsync();
                    BW_Monitoring_Engine_Running    = "Stopped";
                    IND_Monitoring_Engine.BackColor = Color.Red;
                    DGV_Incoming_Messages.Rows.Insert(0, Incoming_Message_Index, System.DateTime.Now.ToString(), "Monitoring Stopped");
                    Incoming_Message_Index++;
                }
            }


            if (BTN_UDP_Select.Checked)
            {
                if (BW_Monitoring_Engine_Running == "Stopped")
                {
                    if (!BW_UDP_Monitoring_Engine.IsBusy)
                    {
                        BW_UDP_Monitoring_Engine.RunWorkerAsync();
                        BW_Monitoring_Engine_Running    = "Started";
                        IND_Monitoring_Engine.BackColor = Color.Green;
                        DGV_Incoming_Messages.Rows.Insert(0, Incoming_Message_Index, System.DateTime.Now.ToString(), "Monitoring Started");
                        Incoming_Message_Index++;
                    }
                    else
                    {
                        BW_Monitoring_Engine_Running    = "Hung";
                        IND_Monitoring_Engine.BackColor = Color.Orange;
                        DGV_Incoming_Messages.Rows.Insert(0, Incoming_Message_Index, System.DateTime.Now.ToString(), "Monitoring Hung");
                        Incoming_Message_Index++;
                    }
                }
                else
                {
                    BW_UDP_Monitoring_Engine.CancelAsync();
                    BW_Monitoring_Engine_Running    = "Stopped";
                    IND_Monitoring_Engine.BackColor = Color.Red;
                    DGV_Incoming_Messages.Rows.Insert(0, Incoming_Message_Index, System.DateTime.Now.ToString(), "Monitoring Stopped");
                    Incoming_Message_Index++;
                }
            }
        }
示例#2
0
 private void FRM_Receive_FormClosing(object sender, FormClosingEventArgs e)
 {
     BW_TCP_Monitoring_Engine.Dispose();
 }