private void InitUI() { var onlineClients = SharedResources.ConnectionManager.OnlineClientCount; if (onlineClients == 0) { comboBoxComPort.Enabled = true; ConnectionErrorProvider.SetError(comboBoxComPort, string.Empty); } else { comboBoxComPort.Enabled = false; ConnectionErrorProvider.SetError(comboBoxComPort, "Connection settings cannot be changed while there are connected clients"); } //chkTrace.Checked = tl.Enabled; // set the list of com ports to those that are currently available comboBoxComPort.Items.Clear(); comboBoxComPort.Items.AddRange(System.IO.Ports.SerialPort.GetPortNames()); // use System.IO because it's static // select the current port if possible //if (comboBoxComPort.Items.Contains(Telescope.comPort)) //{ // comboBoxComPort.SelectedItem = Telescope.comPort; //} if (comboBoxComPort.Items.Contains(iOptronZEQ25.Properties.Settings.Default.COMPort)) { comboBoxComPort.SelectedItem = iOptronZEQ25.Properties.Settings.Default.COMPort; } }
private void SetupDialogForm_Load(object sender, EventArgs e) { var observableClientStatus = Observable.FromEventPattern <EventArgs>( handler => SharedResources.ConnectionManager.ClientStatusChanged += handler, handler => SharedResources.ConnectionManager.ClientStatusChanged -= handler); updateClickCommand = FirmwareUpdateCommand.AttachCommand(ExecuteFirmwareUpdate, CanUpdateFirmware); observableClientStatus.ObserveOn(SynchronizationContext.Current) .Subscribe(item => updateClickCommand.CanExecuteChanged()); int onlineClients = SharedResources.ConnectionManager.OnlineClientCount; bool enableDisconnectedControls = onlineClients == 0; if (onlineClients == 0) { communicationSettingsControl1.Enabled = true; ConnectionErrorProvider.SetError(communicationSettingsControl1, string.Empty); } else { communicationSettingsControl1.Enabled = false; ConnectionErrorProvider.SetError( communicationSettingsControl1, "Connection settings cannot be changed while there are connected clients"); } RotatorParametersGroup.Enabled = enableDisconnectedControls; ShutterParametersGroup.Enabled = enableDisconnectedControls; RotatorRampTimeCurrentValue.Text = RotatorRampTimeTrackBar.Value.ToString(); RotatorSpeedCurrentValue.Text = RotatorMaximumSpeedTrackBar.Value.ToString(); ShutterMaximumSpeedCurrentValue.Text = ShutterMaximumSpeedTrackBar.Value.ToString(); ShutterRampTimeCurrentValue.Text = ShutterAccelerationRampTimeTrackBar.Value.ToString(); SetControlAppearance(); }
private void ServerSetupDialogForm_Load(object sender, EventArgs e) { var onlineClients = SharedResources.ConnectionManager.OnlineClientCount; if (onlineClients == 0) { communicationSettingsControl1.Enabled = true; ConnectionErrorProvider.SetError(communicationSettingsControl1, string.Empty); } else { communicationSettingsControl1.Enabled = false; ConnectionErrorProvider.SetError(communicationSettingsControl1, "Connection settings cannot be changed while there are connected clients"); } }