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 = ""; } } }
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 = ""; } } }