private void crystalButton_BrightTest_Click(object sender, EventArgs e) { if (_isTestStart) { crystalButton_BrightTest.Text = CommonUI.GetCustomMessage(_languageTable, "crystalButton_BrightTestStart", "光探头测试"); if (SensorTestEvent != null) { SensorTestEvent(false, null); } _isTestStart = false; } else { if (SensorTestEvent != null) { if (_useablePeripheral == null || _useablePeripheral.Count == 0) { CustomMessageBox.ShowCustomMessageBox(this.ParentForm, CommonUI.GetCustomMessage(_languageTable, "nolightsensorconfig", "不存在光探头信息,无法测试!")); return; } crystalButton_BrightTest.Text = CommonUI.GetCustomMessage(_languageTable, "crystalButton_BrightTestStop", "停止测试"); List <PeripheralsLocation> pers = new List <PeripheralsLocation>(); foreach (UseablePeripheral useable in _useablePeripheral) { pers.Add(useable); } SensorTestEvent(true, pers); } _isTestStart = true; } }
protected DialogResult ShowCustomMessageBox(string msg, string title, MessageBoxButtons buttons, Nova.Windows.Forms.MessageBoxIconType icon) { if (!this.InvokeRequired) { return(CustomMessageBox.ShowCustomMessageBox(this.ParentForm, msg, title, buttons, icon)); } else { ShowCustomMessageBoxDele cs = new ShowCustomMessageBoxDele(ShowCustomMessageBox); return((DialogResult)this.Invoke(cs, new object[] { msg, title, buttons, icon })); } }
private void MonitorMain_FormClosing(object sender, FormClosingEventArgs e) { if (e.CloseReason != CloseReason.WindowsShutDown && e.CloseReason != CloseReason.None) { if (CustomMessageBox.ShowCustomMessageBox(this, GetLangControlText("toolStripMenuItem_ClosedTitle", "关闭监控将会影响智能亮度调节,是否关闭监控?"), "", MessageBoxButtons.OKCancel, MessageBoxIconType.Question) == DialogResult.OK) { MonitorAllConfig.Instance().Dispose(); AutoDisposed(); } } e.Cancel = true; this.Hide(); }
private void crystalButton_OK_Click(object sender, EventArgs e) { //if (!_brightnessVM.IsOK()) //{ // if (_brightnessVM.AutoBrightData == null || _brightnessVM.AutoBrightData.AutoBrightMappingList == null || _brightnessVM.AutoBrightData.AutoBrightMappingList.Count == 0) // ShowCustomMessageBox(CommonUI.GetCustomMessage(_langTable, "msg_configlightprobe", "请为该显示屏配置光探头(自动亮度根据光探头调节列表调节显示屏亮度)!"), "", MessageBoxButtons.OK, Windows.Forms.MessageBoxIconType.Error); // else ShowCustomMessageBox(CommonUI.GetCustomMessage(_langTable, "msg_configlightprobe_lightlist", "请配置光探头调节列表(自动亮度根据光探头调节列表调节显示屏亮度)!"), "", MessageBoxButtons.OK, Windows.Forms.MessageBoxIconType.Error); // return; //} if (!SetBrightConfig()) { return; } //_screenConfigInfo.DispaySoftWareConfig = (DisplaySmartBrightEasyConfig)_brightnessSoftwareConfig; //_screenConfigInfo.DisplayHardcareConfig = _brightnessHardwareConfig; if (SubmitEvent != null) { SubmitEvent(sender, e); } if (!MonitorAllConfig.Instance().SaveBrightnessConfig(_screenConfigInfo)) { CustomMessageBox.ShowCustomMessageBox(this.ParentForm, CommonUI.GetCustomMessage(_langTable, "savefailed", "保存失败")); } //ShowCustomMessageBox(CommonUI.GetCustomMessage(_langTable, "savefailed", "保存失败"), "", MessageBoxButtons.OK, Windows.Forms.MessageBoxIconType.Alert); else { if (CloseFormHandler != null) { CloseFormHandler(true); } else { _screenConfigInfobak = (SmartLightConfigInfo)_screenConfigInfo.Clone(); _screenConfigInfobak.DisplayHardcareConfig = null; //MessageBox.Show(CommonUI.GetCustomMessage(_langTable, "savesuccess", "保存成功")); CustomMessageBox.ShowCustomMessageBox(this.ParentForm, CommonUI.GetCustomMessage(_langTable, "savesuccess", "保存成功")); } } }
private void crystalButton_OK_Click(object sender, EventArgs e) { SaveConfig((result) => { switch (result) { case 0: CustomMessageBox.ShowCustomMessageBox(this.ParentForm, CommonUI.GetCustomMessage(_langTable, "savesuccess", "保存成功")); break; case 1: CustomMessageBox.ShowCustomMessageBox(this.ParentForm, CommonUI.GetCustomMessage(_langTable, "savesuccessNoConfig", "未配置亮度信息")); break; default: CustomMessageBox.ShowCustomMessageBox(this.ParentForm, CommonUI.GetCustomMessage(_langTable, "savefailed", "保存失败")); break; } CloseProcessForm(); }); ShowSending("SaveBrightConfig", "正在保存亮度配置,请稍候...", true); return; }
private void crystalButton_apply_Click(object sender, EventArgs e) { foreach (System.Windows.Forms.Control ctrl in this.Controls) { ctrl.Focus(); } string msg = ""; if ((msg = errorProvider_showError.GetError(textBox_emailAddr)) != string.Empty) { textBox_emailAddr.Focus(); textBox_emailAddr.SelectAll(); } else if ((msg = errorProvider_showError.GetError(textBox_passWord)) != string.Empty) { textBox_passWord.Focus(); textBox_passWord.SelectAll(); } else if ((msg = errorProvider_showError.GetError(textBox_smtpServer)) != string.Empty) { textBox_smtpServer.Focus(); textBox_smtpServer.SelectAll(); } else if ((msg = errorProvider_showError.GetError(numberTextBox_port)) != string.Empty) { numberTextBox_port.Focus(); numberTextBox_port.SelectAll(); } if (msg != "") { CustomMessageBox.ShowCustomMessageBox(this, msg, "", MessageBoxButtons.OK, MessageBoxIconType.Error); DialogResult = DialogResult.None; return; } crystalButton_apply.Focus(); }
private void confirmButton_Click(object sender, EventArgs e) { if (_brightnessCfg.DayList.Count == 0) { CustomMessageBox.ShowCustomMessageBox(this.ParentForm, CommonUI.GetCustomMessage(_langTable, "msg_timesempty", "请选择调节时段")); return; } if (_brightnessConfigList != null) { int index = _brightnessConfigList.FindIndex(a => a.Time.Equals(_brightnessCfg.Time)); if (index >= 0 && index != _currentIndex) { CustomMessageBox.ShowCustomMessageBox(this.ParentForm, CommonUI.GetCustomMessage(_langTable, "msg_brightnessconfig_repeat", "亮度配置列表时间重复,请重新编辑!")); return; } } List <DayOfWeek> weekDayTmpList = new List <DayOfWeek>() { DayOfWeek.Monday, DayOfWeek.Tuesday, DayOfWeek.Wednesday, DayOfWeek.Thursday, DayOfWeek.Friday, DayOfWeek.Saturday, DayOfWeek.Sunday }; List <DayOfWeek> weekDayList = new List <DayOfWeek>() { DayOfWeek.Monday, DayOfWeek.Tuesday, DayOfWeek.Wednesday, DayOfWeek.Thursday, DayOfWeek.Friday, DayOfWeek.Saturday, DayOfWeek.Sunday }; foreach (var item in weekDayList) { if (weekDayList.Contains(item) && !_brightnessCfg.DayList.Contains(item)) { weekDayTmpList.Remove(item); } } _brightnessCfg.DayList = weekDayTmpList; if (_brightnessCfg.DayList.Count == 7) { _brightnessCfg.ExecutionCycle = CycleType.everyday; } else if (_brightnessCfg.DayList.FindAll(a => (a == DayOfWeek.Saturday) || a == DayOfWeek.Sunday).Count > 0) { _brightnessCfg.ExecutionCycle = CycleType.userDefined; } else { if (_brightnessCfg.DayList.FindAll(a => (a == DayOfWeek.Monday) || (a == DayOfWeek.Tuesday) || (a == DayOfWeek.Wednesday) || (a == DayOfWeek.Thursday) || (a == DayOfWeek.Friday) ).Count == 5) { _brightnessCfg.ExecutionCycle = CycleType.workday; } else { _brightnessCfg.ExecutionCycle = CycleType.userDefined; } } _brightnessCfg.IsConfigEnable = true; _brightnessCfg.Time = new DateTime(2014, 1, 1, _brightnessCfg.Time.Hour, _brightnessCfg.Time.Minute, _brightnessCfg.Time.Second); this.DialogResult = System.Windows.Forms.DialogResult.OK; }
private void button_OK_Click(object sender, EventArgs e) { if (comboBox_ControlType.SelectedIndex < 0) { return; } StrategyType type = _vm.SelectedCtrlType.Value; UC_WHControlConfig_VM_Base baseVM = null; #region 页面输入合理性检测 if (type == StrategyType.TemperatureStrategy) { ValueRes tempRes = _UC_TemCfg.IsOK(); switch (tempRes) { case ValueRes.ok: break; case ValueRes.MinBiggerThanMax: CustomMessageBox.ShowCustomMessageBox(this.ParentForm, CommonUI.GetCustomMessage(_langTable, "msg_tem_minvaluebiggerthanmax", "最小温度不能大于最大温度")); return; case ValueRes.MinToMaxToSimilar: CustomMessageBox.ShowCustomMessageBox(this.ParentForm, CommonUI.GetCustomMessage(_langTable, "msg_tem_valuetoosimilar", "最大温度与最小温度值相差不能小于5℃")); return; case ValueRes.invalidValue: CustomMessageBox.ShowCustomMessageBox(this.ParentForm, CommonUI.GetCustomMessage(_langTable, "msg_action_illegal", "请设置有效的执行动作")); return; } } else if (type == StrategyType.SmokeStrategy) { if (!_UC_SmokeCfg.IsOk()) { CustomMessageBox.ShowCustomMessageBox(this.ParentForm, CommonUI.GetCustomMessage(_langTable, "msg_power_notchoose", "请选择需要关闭的电源")); return; } baseVM = _UC_SmokeCfg.SmokeVM; } #endregion if (comboBox_ControlType.Enabled) { ControlConfigSaveRes res; if (type == StrategyType.SmokeStrategy) { res = _vm.IsSmokeOk(_UC_SmokeCfg.SmokeVM); switch (res) { case ControlConfigSaveRes.ok: _vm.Strategy = _UC_SmokeCfg.SmokeVM; this.DialogResult = System.Windows.Forms.DialogResult.OK; return; case ControlConfigSaveRes.smoke_CtrlCfgIsExist: CustomMessageBox.ShowCustomMessageBox(this.ParentForm, CommonUI.GetCustomMessage(_langTable, "msg_controlconfig_repeat", "策略重复,添加失败")); return; case ControlConfigSaveRes.smoke_CtrlCfgIsInvalid: CustomMessageBox.ShowCustomMessageBox(this.ParentForm, CommonUI.GetCustomMessage(_langTable, "msg_action_illegal", "请设置有效的执行动作")); return; case ControlConfigSaveRes.smoke_objIsNull: CustomMessageBox.ShowCustomMessageBox(this.ParentForm, CommonUI.GetCustomMessage(_langTable, "msg_controlconfig_null", "策略对象为空")); return; default: break; } } else if (type == StrategyType.TemperatureStrategy) { res = _vm.IsTemOk(_UC_TemCfg.TemVM); switch (res) { case ControlConfigSaveRes.ok: _vm.Strategy = _UC_TemCfg.TemVM; this.DialogResult = System.Windows.Forms.DialogResult.OK; return; case ControlConfigSaveRes.tem_CtrlCfgIsExist: CustomMessageBox.ShowCustomMessageBox(this.ParentForm, CommonUI.GetCustomMessage(_langTable, "msg_controlconfig_repeat", "策略重复,添加失败")); return; case ControlConfigSaveRes.tem_CtrlCfgIsInvalid: CustomMessageBox.ShowCustomMessageBox(this.ParentForm, CommonUI.GetCustomMessage(_langTable, "msg_action_illegal", "请设置有效的执行动作")); return; case ControlConfigSaveRes.tem_objIsNull: CustomMessageBox.ShowCustomMessageBox(this.ParentForm, CommonUI.GetCustomMessage(_langTable, "msg_controlconfig_null", "策略对象为空")); return; case ControlConfigSaveRes.tem_ConditionError: CustomMessageBox.ShowCustomMessageBox(this.ParentForm, CommonUI.GetCustomMessage(_langTable, "msg_tem_valuetoosimilar", "最大温度与最小温度值相差不能小于5℃")); return; default: break; } } } else { if (type == StrategyType.SmokeStrategy) { _vm.Strategy = _UC_SmokeCfg.SmokeVM; this.DialogResult = System.Windows.Forms.DialogResult.OK; } else if (type == StrategyType.TemperatureStrategy) { _vm.Strategy = _UC_TemCfg.TemVM; this.DialogResult = System.Windows.Forms.DialogResult.OK; } } }