SetConnectionControls() private method

private SetConnectionControls ( bool Enabled ) : void
Enabled bool
return void
 private void DoConnect()
 {
     if (Form.NTRConnection.IsConnected || Form.ButtonConnectDisconnect.Text == "Disconnect")
     {
         Form.NTRConnection.SetCurrentOperationText = "Disconnecting";
         Form.NTRConnection.Disconnect();
         Form.SetConnectedControls(false);
         Form.SetProcessSelectedControls(false);
         Form.SetConnectText = "Connect";
         Form.ControlEnabledButtonConnectDisconnect = true;
         Form.NTRConnection.SetCurrentOperationText = "";
     }
     else
     {
         Form.SetConnectionControls(false);
         Form.NTRConnection.SetCurrentOperationText = "Connecting";
         Form.NTRConnection.IP   = Form.IP.Text;
         Form.NTRConnection.Port = short.Parse(Form.Port.Text);
         if (Form.NTRConnection.Connect())
         {
             Form.SetConnectText = "Disconnect";
             Form.NTRConnection.SetCurrentOperationText = "Fetching Processes";
             Form.NTRConnection.SendListProcessesPacket();
         }
         else
         {
             Form.SetConnectionControls(true);
             Form.NTRConnection.SetCurrentOperationText = "";
         }
     }
 }
示例#2
0
        private void DoConnect()
        {
            if (Form.NTRConnection.IsConnected || Form.ButtonConnectDisconnect.Text == "Disconnect")
            {
                Form.NTRConnection.SetCurrentOperationText = "Disconnecting";
                Form.NTRConnection.Disconnect();
                Form.SetConnectedControls(false);
                Form.SetProcessSelectedControls(false);
                Form.SetConnectText = "Connect";
                Form.ControlEnabledButtonConnectDisconnect = true;
                Form.NTRConnection.SetCurrentOperationText = "";
            }
            else
            {
                Form.SetConnectionControls(false);
                Form.NTRConnection.SetCurrentOperationText = "Connecting";
                Form.NTRConnection.IP   = Form.IP.Text;
                Form.NTRConnection.Port = short.Parse(Form.Port.Text);

                bool Connected = false;

                for (int i = 0; i < Config.ConnectTries && !Connected; ++i)
                {
                    Connected = Form.NTRConnection.Connect();
                }

                if (Connected)
                {
                    Form.SetConnectText = "Disconnect";
                    Form.NTRConnection.SetCurrentOperationText = "Fetching Processes";
                    Form.NTRConnection.SendListProcessesPacket();
                }
                else
                {
                    Form.SetConnectionControls(true);
                    Form.NTRConnection.SetCurrentOperationText = "";
                }
            }
        }