private void GetValueChange(int i) { try { SetControlValue sc = new SetControlValue(SetConrolsValue); this.Dispatcher.BeginInvoke(sc, i); } catch { } }
private void GsmConfig_Load(object sender, EventArgs e) { try { setValue = SetValue; portNameBox.Items.AddRange(System.IO.Ports.SerialPort.GetPortNames()); portNameBox.SelectedIndex = 0; currentADCReceivedHandler = new DeviceDataReceivedEventHandler(listener_GetCurrentADCReceived); //deviceIdLbl.Text = "00000"; toolTip1.SetToolTip(readAllBtn, "Считать все"); toolTip1.SetToolTip(readActivationTimeBtn, "Считать"); toolTip1.SetToolTip(readCallParamsBtn, "Считать"); toolTip1.SetToolTip(readDeactivationTimeBtn, "Считать"); toolTip1.SetToolTip(readDeviceIdBtn, "Считать"); toolTip1.SetToolTip(readUser1NumBtn, "Считать"); toolTip1.SetToolTip(readUser2NumBtn, "Считать"); toolTip1.SetToolTip(readUser3NumBtn, "Считать"); toolTip1.SetToolTip(readUser4NumBtn, "Считать"); toolTip1.SetToolTip(readUser5NumBtn, "Считать"); toolTip1.SetToolTip(writeActivationTimeBtn, "Записать"); toolTip1.SetToolTip(writeAllBtn, "Записать все"); toolTip1.SetToolTip(writeCallParamsBtn, "Записать"); toolTip1.SetToolTip(writeDeactivationTimeBtn, "Записать"); toolTip1.SetToolTip(writeUser1NumBtn, "Записать"); toolTip1.SetToolTip(writeUser2NumBtn, "Записать"); toolTip1.SetToolTip(writeUser3NumBtn, "Записать"); toolTip1.SetToolTip(writeUser4NumBtn, "Записать"); toolTip1.SetToolTip(writeUser5NumBtn, "Записать"); toolTip1.SetToolTip(readActiveZonesBtn, "Считать"); toolTip1.SetToolTip(writeActiveZonesBtn, "Записать"); SetActiveZonesOKReceivedHandler = new DeviceDataReceivedEventHandler(listener_SetActiveZonesOKReceived); SetCallParamsOKReceivedHandler = new DeviceDataReceivedEventHandler(listener_SetCallParamsOKReceived); SetTimeActivationOKReceivedHandler = new DeviceDataReceivedEventHandler(listener_SetTimeActivationOKReceived); SetTimeDeactivationOKReceivedHandler = new DeviceDataReceivedEventHandler(listener_SetTimeDeactivationOKReceived); SetUserNumberOKReceivedHandler = new DeviceDataReceivedEventHandler(listener_SetUserNumberOKReceived); } #pragma warning disable 168 catch (ArgumentOutOfRangeException except) { MessageBox.Show("Не доступен не один последовательный порт.\r\nПриложение будет закрыто.", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error); Application.Exit(); } #pragma warning restore 168 }
private void CalibrateForm_Load(object sender, EventArgs e) { listener = (this.Owner as GsmConfig).Listener; try { ErrorReceivedHandler = new DeviceDataReceivedEventHandler(listener_ErrorReceived); listener.ErrorReceived += ErrorReceivedHandler; ADCParamsReceivedHandler = new DeviceDataReceivedEventHandler(listener_GetADCParamsReceived); listener.GetADCParamsReceived += ADCParamsReceivedHandler; CurrentADCReceivedHandler = new DeviceDataReceivedEventHandler(listener_GetCurrentADCReceived); listener.GetCurrentADCReceived += CurrentADCReceivedHandler; SetADCParamsOKReceivedHandler = new DeviceDataReceivedEventHandler(listener_SetADCParamsOKReceived); listener.SetADCParamsOKReceived += SetADCParamsOKReceivedHandler; setValue = SetValue; MessageBox.Show("Внимание! Перед калибровкой убедитесь, что все контролируемые точки находятся в закрытом состоянии", "Внимание", MessageBoxButtons.OK, MessageBoxIcon.Warning); } #pragma warning disable 168 catch (NullReferenceException except) { MessageBox.Show("Сначала выберите порт", "Порт не выбран", MessageBoxButtons.OK, MessageBoxIcon.Error); this.Close(); } #pragma warning restore 168 toolTip1.SetToolTip(readCurrADCBtn, "Считать текущие значения зон"); toolTip1.SetToolTip(readZone1Params, "Считать"); toolTip1.SetToolTip(readZone2Params, "Считать"); toolTip1.SetToolTip(readZone3Params, "Считать"); toolTip1.SetToolTip(readZone4Params, "Считать"); toolTip1.SetToolTip(writeZone1Params, "Записать"); toolTip1.SetToolTip(writeZone2Params, "Записать"); toolTip1.SetToolTip(writeZone3Params, "Записать"); toolTip1.SetToolTip(writeZone4Params, "Записать"); }