Ejemplo n.º 1
0
 /// <summary>
 /// When the main form is being closed, we must be sure that any currently
 /// open tests are terminated properly. So we first stop the test, and then
 /// we can close safely without losing our log data.
 /// </summary>
 /// <param name="sender">The sender of this event.</param>
 /// <param name="e">The arguments for this event.</param>
 private void MainForm_Closing(object sender, System.ComponentModel.CancelEventArgs e)
 {
     if (_sender != null && _sender.IsConnected)
     {
         _sender.Disconnect();
     }
     if (_listener != null && _listener.IsListening)
     {
         _listener.Stop();
     }
     if (_sd != null)
     {
         mniStopTest_Click(this, EventArgs.Empty);
     }
 }
Ejemplo n.º 2
0
 private void button_listen_Click(object sender, EventArgs e)
 {
     if (button_listen.Text == "Listen")
     {
         NetListener.Start(int.Parse(textBox_port.Text));
         button_listen.Text = "Unlisten";
     }
     else
     {
         NetListener.Stop();
         button_listen.Text = "Listen";
     }
 }
Ejemplo n.º 3
0
        private void OContextMenuStartStop_Click(object sender, EventArgs e)
        {
            if (sender is ToolStripItem o)
            {
                o.Enabled = false;

                switch (o.Text)
                {
                case "Start":
                    NetListener.Start();
                    oContextMenuStop.Enabled = true;
                    break;

                default:
                    NetListener.Stop();
                    oContextMenuStart.Enabled = true;
                    break;
                }
            }
        }
Ejemplo n.º 4
0
        public static void ReloadNetwork_Click(object sender, EventArgs e)
        {
            if (sender is ToolStripItem oItem)
            {
                ToolStripMenuItem[] oMenus = (oItem.Tag as ToolStripMenuItem[]);

                if (oMenus != null)
                {
                    NetListener.Stop();

                    NetListener.AdapterList.UpdateList();

                    foreach (ToolStripMenuItem oMenu in oMenus)
                    {
                        SetMenuInterfaces(oMenu);
                    }

                    NetListener.AdapterList.GetFirstUpInterface();

                    NetListener.Start();
                }
            }
        }