private void dataGridView_BrightnessConfig_CellContentClick(object sender, DataGridViewCellEventArgs e) { if (e.ColumnIndex == 0) { Frm_BrightnessAdjustmentSetting frm_Config = new Frm_BrightnessAdjustmentSetting((BrightnessConfigInfo)_brightnessVM.BrightnessConfigList[e.RowIndex].Clone(), _brightnessVM.AutoBrightData, _brightnessVM.BrightnessConfigList); if (frm_Config.ShowDialog() == DialogResult.OK) { if (frm_Config.BrightnessCfg != null) { if (frm_Config.BrightnessCfg.Type == SmartBrightAdjustType.FixBright) { frm_Config.BrightnessCfg.Brightness = (float)Math.Round(frm_Config.BrightnessCfg.Brightness, 1); } } _brightnessVM.BrightnessConfigList[e.RowIndex] = frm_Config.BrightnessCfg; _brightnessVM.BrightnessConfigList.Sort(CompareBrightnessByTime); BrightnessConfig_BindingSource.ResetBindings(false); AdjustBrightnessConfig(ConfigState); } } else if (e.ColumnIndex == 1) { if (ShowCustomMessageBox(CommonUI.GetCustomMessage(_langTable, "msg_deletebrightnessconfig", "确定删除选择项吗?"), "", MessageBoxButtons.YesNo, Windows.Forms.MessageBoxIconType.Question) != DialogResult.Yes) { return; } _brightnessVM.BrightnessConfigList.Remove(_brightnessVM.BrightnessConfigList[e.RowIndex]); BrightnessConfig_BindingSource.ResetBindings(false); AdjustBrightnessConfig(ConfigState); } }
public UC_WHControlConfig() { InitializeComponent(); UpdateLang(CommonUI.ControlConfigLangPath); _whCfg_VM = new UC_WHControlConfig_VM(); uCWHControlConfigVMBindingSource.DataSource = _whCfg_VM; vMBaseListBindingSource.DataSource = _whCfg_VM.VM_BaseList; dataGridView_ControlConfig.DataSource = vMBaseListBindingSource; foreach (DataGridViewColumn item in dataGridView_ControlConfig.Columns) { if (item.Name.Equals("StrategyTypeStr")) { item.HeaderText = CommonUI.GetCustomMessage(_langTable, "strategytypestr", "控制类型"); item.AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill; } //else if (item.Name.Equals("SN")) //{ // item.HeaderText = "显示屏"; // item.AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill; //} else if (item.Name.Equals("Condition")) { item.HeaderText = CommonUI.GetCustomMessage(_langTable, "condition", "条件"); item.AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill; } else { item.Visible = false; } } }
private void crystalButton_PowerCountSetting_Click(object sender, EventArgs e) { SettingCommInfo commInfo = new SettingCommInfo(); commInfo.SameCount = (byte)numericUpDown_MCSamePowerCount.Value; commInfo.TypeStr = CommonUI.GetCustomMessage(HsLangTable, "HwPowerName", "电源"); commInfo.IconImage = Nova.Monitoring.UI.MonitorFromDisplay.Properties.Resources.Power_Setting; commInfo.MaxCount = (byte)(MaxPowerCount); if (_vm.MCPower.AllPowerCountDif == null || _vm.MCPower.AllPowerCountDif.Count == 0) { SerializableDictionary <string, byte> moinfos = new SerializableDictionary <string, byte>(); SetCount(MonitorAllConfig.Instance().AllCommPortLedDisplayDic[_vm.SN], _vm.SN.Replace("-", ""), commInfo.SameCount, out moinfos); _vm.MCPower.AllPowerCountDif = moinfos; } Frm_FanPowerAdvanceSetting setPowerCntFrm = new Frm_FanPowerAdvanceSetting( MonitorAllConfig.Instance().AllCommPortLedDisplayDic[_vm.SN], string.IsNullOrEmpty(MonitorAllConfig.Instance().CurrentScreenName) ? _sn10 : MonitorAllConfig.Instance().CurrentScreenName, _vm.SN.Replace("-", ""), _vm.MCPower.AllPowerCountDif, commInfo); setPowerCntFrm.StartPosition = FormStartPosition.CenterParent; //setFanCntFrm.UpdateFont(Frm_MonitorStatusDisplay.CurrentFont); setPowerCntFrm.UpdateLanguage(CommonUI.LanguageName); if (setPowerCntFrm.ShowDialog() == DialogResult.OK) { _vm.MCPower.AllPowerCountDif = setPowerCntFrm.CurAllSettingDic; } }
private void button_deleteAll_Click(object sender, EventArgs e) { if (_whCfg_VM.VM_BaseList == null || _whCfg_VM.VM_BaseList.Count == 0) { return; } if (ShowCustomMessageBox(CommonUI.GetCustomMessage(_langTable, "msg_deleteall", "确定清理所有配置?"), "", MessageBoxButtons.OKCancel, Windows.Forms.MessageBoxIconType.Question) == DialogResult.OK) { if (_whCfg_VM.VM_BaseList != null) { UC_WHControlConfig_Tem_VM tem_VM; UC_WHControlConfig_Smoke_VM smoke_VM; List <UC_WHControlConfig_VM_Base> straList = new List <UC_WHControlConfig_VM_Base>(); foreach (var item in _whCfg_VM.VM_BaseList) { if (item.StratlType == StrategyType.TemperatureStrategy) { tem_VM = (UC_WHControlConfig_Tem_VM)item; straList.Add(new UC_WHControlConfig_Tem_VM(tem_VM.SN, tem_VM.ID, tem_VM.ConditionAlgor, tem_VM.LessThan, tem_VM.GreaterThan, tem_VM.IsControlBrightness, tem_VM.Brightness, tem_VM.PowerCtrlDic)); } else if (item.StratlType == StrategyType.SmokeStrategy) { smoke_VM = (UC_WHControlConfig_Smoke_VM)item; straList.Add(new UC_WHControlConfig_Smoke_VM(smoke_VM.SN, smoke_VM.ID, smoke_VM.GreaterThan, item.PowerCtrlDic)); } } foreach (var item in straList) { _whCfg_VM.DeleteStartegy(item); } vMBaseListBindingSource.ResetBindings(false); } } }
private void AdjustBrightnessConfig(LightSensorConfigState configState) { if (_brightnessVM == null || _brightnessVM.BrightnessConfigList == null) { return; } switch (configState) { case LightSensorConfigState.OK_State: this.alertInfoLabel.Text = string.Empty; break; case LightSensorConfigState.NoSensor_State: var resultItemNoSensor = _brightnessVM.BrightnessConfigList.FirstOrDefault(c => c.Type == SmartBrightAdjustType.AutoBright && c.IsConfigEnable); if (resultItemNoSensor == null) { this.alertInfoLabel.Text = string.Empty; return; } else { this.alertInfoLabel.Text = CommonUI.GetCustomMessage(_langTable, "nolightsensorconfig", "没有选择所需的光探头,所有自动调节配置将失效!"); } break; case LightSensorConfigState.NoMapping_State: var resultItemNoMapping = _brightnessVM.BrightnessConfigList.FirstOrDefault(c => c.Type == SmartBrightAdjustType.AutoBright && c.IsConfigEnable); if (resultItemNoMapping == null) { this.alertInfoLabel.Text = string.Empty; return; } else { this.alertInfoLabel.Text = CommonUI.GetCustomMessage(_langTable, "nolightsensormappingconfig", "没有配置光探头的亮度映射表,所有自动调节配置将失效!"); } break; case LightSensorConfigState.InvalidSensor_State: this.alertInfoLabel.Text = CommonUI.GetCustomMessage(_langTable, "partlightsensorfail", "配置了自动亮度,选择的部分光探头在无软件时不可用!"); break; default: break; } //if (configState == LightSensorConfigState.NoSensor_State || configState == LightSensorConfigState.NoMapping_State) //{ // _screenConfigInfo.DispaySoftWareConfig.OneDayConfigList.ForEach((c) => // { // if (c.ScheduleType == SmartBrightAdjustType.AutoBright) // { // c.IsConfigEnable = false; // } // }); //} }
private void InitialLangTable() { ControlConfigLangTable.StrategyTypeTable = new Dictionary <StrategyType, string>(); ControlConfigLangTable.StrategyTypeTable.Add(StrategyType.TemperatureStrategy, CommonUI.GetCustomMessage(_langTable, "temperaturestrategy", "温度")); ControlConfigLangTable.StrategyTypeTable.Add(StrategyType.SmokeStrategy, CommonUI.GetCustomMessage(_langTable, "smokestrategy", "烟雾")); ControlConfigLangTable.ConditionAlgorithmTypeTable = new Dictionary <ConditionAlgorithm, string>(); ControlConfigLangTable.ConditionAlgorithmTypeTable.Add(ConditionAlgorithm.AverageAlgorithm, CommonUI.GetCustomMessage(_langTable, "averagealgorithm", "平均值")); ControlConfigLangTable.ConditionAlgorithmTypeTable.Add(ConditionAlgorithm.MaxValueAlgorithm, CommonUI.GetCustomMessage(_langTable, "maxvaluealgorithm", "最高值")); }
private void button_deleteAll_Click(object sender, EventArgs e) { if (ShowCustomMessageBox(CommonUI.GetCustomMessage(_langTable, "msg_brightnessconfig_empty", "是否要清空亮度配置列表?"), "", MessageBoxButtons.YesNo, Windows.Forms.MessageBoxIconType.Error) != DialogResult.Yes) { return; } _brightnessVM.BrightnessConfigList.Clear(); BrightnessConfig_BindingSource.ResetBindings(false); AdjustBrightnessConfig(ConfigState); }
private void button_delete_Click(object sender, EventArgs e) { if (ShowCustomMessageBox(CommonUI.GetCustomMessage(_langTable, "msg_deletebrightnessconfig", "确定删除选择项吗?"), "", MessageBoxButtons.YesNo, Windows.Forms.MessageBoxIconType.Question) != DialogResult.Yes) { return; } _brightnessVM.BrightnessConfigList.Remove(_brightnessVM.BrightnessConfigList[dataGridView_BrightnessConfig.SelectedCells[0].RowIndex]); BrightnessConfig_BindingSource.ResetBindings(false); AdjustBrightnessConfig(ConfigState); }
private void crystalButton_OK_Click(object sender, EventArgs e) { if (_whCfg_VM.Save()) { ShowCustomMessageBox(CommonUI.GetCustomMessage(_langTable, "savesuccess", "保存成功"), "", MessageBoxButtons.OK, Windows.Forms.MessageBoxIconType.Alert); } else { ShowCustomMessageBox(CommonUI.GetCustomMessage(_langTable, "savefailed", "保存失败"), "", MessageBoxButtons.OK, Windows.Forms.MessageBoxIconType.Alert); } }
private void label_TempUnit_TextChanged(object sender, EventArgs e) { if (label_TempUnit.Text == "℃") { linkLabel_TempType.Text = CommonUI.GetCustomMessage(HsLangTable, "FahrenheitTemp", "华氏温度"); } else { linkLabel_TempType.Text = CommonUI.GetCustomMessage(HsLangTable, "CelsiusTemp", "摄氏温度"); } }
private bool SetBrightConfig() { if (ConfigState == LightSensorConfigState.NoSensor_State && !string.IsNullOrEmpty(this.alertInfoLabel.Text)) { ShowCustomMessageBox(CommonUI.GetCustomMessage(_langTable, "msg_configlightprobe", "请为该显示屏配置光探头(自动亮度根据光探头调节列表调节显示屏亮度)!"), "", MessageBoxButtons.OK, Windows.Forms.MessageBoxIconType.Error); return(false); } if (ConfigState == LightSensorConfigState.NoMapping_State && !string.IsNullOrEmpty(this.alertInfoLabel.Text)) { ShowCustomMessageBox(CommonUI.GetCustomMessage(_langTable, "msg_configlightprobe_lightlist", "请配置光探头调节列表(自动亮度根据光探头调节列表调节显示屏亮度)!"), "", MessageBoxButtons.OK, Windows.Forms.MessageBoxIconType.Error); return(false); } if (_screenConfigInfo.DispaySoftWareConfig == null) { _screenConfigInfo.DispaySoftWareConfig = new DisplaySmartBrightEasyConfig(); } _screenConfigInfo.DispaySoftWareConfig.OneDayConfigList = new List <OneSmartBrightEasyConfig>(); OneSmartBrightEasyConfig oneConfig; foreach (var item in _brightnessVM.BrightnessConfigList) { oneConfig = new OneSmartBrightEasyConfig(); oneConfig.BrightPercent = item.Brightness; oneConfig.CustomDayCollection = item.DayList; oneConfig.IsConfigEnable = item.IsConfigEnable; oneConfig.ScheduleType = item.Type; oneConfig.StartTime = item.Time; _screenConfigInfo.DispaySoftWareConfig.OneDayConfigList.Add(oneConfig); } ((DisplaySmartBrightEasyConfig)_screenConfigInfo.DispaySoftWareConfig).DisplayUDID = _brightnessVM.SN; //_brightnessHardwareConfig = new DisplaySmartBrightEasyConfigBase(); // _screenConfigInfo.DisplayHardcareConfig.AutoBrightSetting = _brightnessVM.AutoBrightData; if (_screenConfigInfo.DisplayHardcareConfig == null) { _screenConfigInfo.DisplayHardcareConfig = new DisplaySmartBrightEasyConfigBase(); } _screenConfigInfo.DisplayHardcareConfig.OneDayConfigList = new List <OneSmartBrightEasyConfig>(); foreach (var item in _brightnessVM.BrightnessConfigList) { oneConfig = new OneSmartBrightEasyConfig(); oneConfig.BrightPercent = item.Brightness; oneConfig.CustomDayCollection = item.DayList; oneConfig.IsConfigEnable = item.IsConfigEnable; oneConfig.ScheduleType = item.Type; oneConfig.StartTime = item.Time; _screenConfigInfo.DisplayHardcareConfig.OneDayConfigList.Add(oneConfig); } return(true); }
private bool CheckEmailPW(string passWord, out string errorText) { if (passWord == string.Empty) { errorText = CommonUI.GetCustomMessage(_hashtable, "EmailAddrNotNull", "邮箱密码不能为空!"); return(false); } else { errorText = ""; return(true); } }
private bool CheckEmailValid(string email, out string errMsg) { errMsg = ""; if (!CustomTransform.CheckEmailValid(email)) { errMsg = CommonUI.GetCustomMessage(_hashtable, "EmailAddrError", "邮箱地址格式不正确!"); return(false); } else { return(true); } }
private bool CheckNameValid(string name, out string errMsg) { errMsg = ""; if (name == string.Empty) { errMsg = CommonUI.GetCustomMessage(_hashtable, "ReceiverNameNotNull", "收件人姓名不能为空!"); return(false); } else { return(true); } }
private bool CheckSMTP(string smtp, out string errorText) { if (smtp == "") { errorText = CommonUI.GetCustomMessage(_hashtable, "SMTPServerNotNull", "SMTP服务器不能为空!"); return(false); } else { errorText = ""; return(true); } }
private void UpdateLanguage() { MultiLanguageUtils.UpdateLanguage(CommonUI.LanguageName, this); Hashtable _hashTable = null; MultiLanguageUtils.ReadLanguageResource(CommonUI.LanguageName, "UC_EMailNotify_String", out _hashTable); HsLangTable = _hashTable; dataGridView_receiver.Columns["Name"].HeaderText = CommonUI.GetCustomMessage(HsLangTable, "ReceiverName", "姓名"); dataGridView_receiver.Columns["EmailAddr"].HeaderText = CommonUI.GetCustomMessage(HsLangTable, "EmailAddr", "邮箱地址"); }
private void dataGridViewBaseEx_Care_CellFormatting(object sender, DataGridViewCellFormattingEventArgs e) { if (e.RowIndex == -1 || e.ColumnIndex == -1) { return; } if (e.ColumnIndex == 8 && e.Value != null && !string.IsNullOrEmpty(e.Value.ToString())) { string str = e.Value.ToString(); str = str.Replace("SendCard", CommonUI.GetCustomMessage(HsLangTable, "SendCard", "SendCard")) .Replace("ReceiverCard", CommonUI.GetCustomMessage(HsLangTable, "ReceiverCard", "ReceiverCard")) .Replace("MonitoringCard", CommonUI.GetCustomMessage(HsLangTable, "MonitoringCard", "MonitoringCard")); e.Value = str; } }
private bool CheckPort(string port, out string errorText) { ushort temp = 0; bool res = ushort.TryParse(port, out temp); if (!res || temp == 0) { errorText = CommonUI.GetCustomMessage(_hashtable, "EmailPortError", "端口格式不正确!"); return(false); } else { errorText = ""; return(true); } }
private void crystalButton_Ok_Click(object sender, EventArgs e) { string msg = ""; if (checkBox_EveryDay.Checked) { _sendTime = dateTimePicker_hour.Value; _sendModel = EMailSendModel.Everyday; _sendMailWeek = DayOfWeek.Monday; } else if (checkBox_Weekly.Checked) { DayOfWeek weekType = SelectedWeek(); //if (weekType == WeekType.None) //{ // msg = CommonUI.GetCustomMessage(_hashtable, "NotificationModel", "请选择星期几!"); // CustomMessageBox.ShowCustomMessageBox(this, msg, "", MessageBoxButtons.OK, MessageBoxIconType.Error); // return; //} _sendTime = dateTimePicker_hour.Value; _sendModel = EMailSendModel.Weekly; _sendMailWeek = weekType; } else if (checkBox_Monthly.Checked) { int hour = DateTime.Now.Hour; DateTime time = dateTimePicker_Day.Value.Date; DateTime dateTime = time.AddHours(dateTimePicker_hour.Value.Hour).AddMinutes(dateTimePicker_hour.Value.Minute); _sendTime = dateTime; _sendModel = EMailSendModel.Mouthly; _sendMailWeek = DayOfWeek.Monday; } else { //if (!CustomTransform.GetLanguageString("NotificationModel", Frm_MonitorStatusDisplay.LangHashTable, out msg)) //{ // msg = "请选择发件模式!"; //} ShowCustomMessageBox(CommonUI.GetCustomMessage(_hashtable, "NotificationModel", "请选择发件模式!"), "", MessageBoxButtons.OK, MessageBoxIconType.Error); return; } DialogResult = DialogResult.OK; this.Close(); }
private void UpdateLanguage() { MultiLanguageUtils.UpdateLanguage(CommonUI.LanguageName, this); Hashtable _hashTable = null; MultiLanguageUtils.ReadLanguageResource(CommonUI.LanguageName, "UC_CareServerConfig_String", out _hashTable); HsLangTable = _hashTable; dataGridViewBaseEx_Care.Columns[0].HeaderText = CommonUI.GetCustomMessage(_hashTable, "ScreenSN", "屏ID"); dataGridViewBaseEx_Care.Columns[1].HeaderText = CommonUI.GetCustomMessage(_hashTable, "SnAlia", "屏别名"); dataGridViewBaseEx_Care.Columns[2].HeaderText = CommonUI.GetCustomMessage(_hashTable, "Longitude", "经度"); dataGridViewBaseEx_Care.Columns[3].HeaderText = CommonUI.GetCustomMessage(_hashTable, "Latitude", "纬度"); dataGridViewBaseEx_Care.Columns[4].HeaderText = CommonUI.GetCustomMessage(_hashTable, "MapName", "地图"); dataGridViewBaseEx_Care.Columns[5].HeaderText = CommonUI.GetCustomMessage(_hashTable, "Width", "宽度"); dataGridViewBaseEx_Care.Columns[6].HeaderText = CommonUI.GetCustomMessage(_hashTable, "Height", "高度"); dataGridViewBaseEx_Care.Columns[7].HeaderText = CommonUI.GetCustomMessage(_hashTable, "CareStatus", "注册状态"); dataGridViewBaseEx_Care.Columns[8].HeaderText = CommonUI.GetCustomMessage(_hashTable, "ScreenMsg", "屏信息"); }
private void OnCareServerSaveFinish(string result) { string tmpType = string.Empty; switch (result) { case "ScreenAlreadyExists": tmpType = CommonUI.GetCustomMessage(HsLangTable, "ScreenAlreadyExists", "屏体已注册!"); break; case "AccountNotExist": tmpType = CommonUI.GetCustomMessage(HsLangTable, "AccountNotExist", "账户不存在!"); break; case "ScreenRegisteredSuccessfully": tmpType = CommonUI.GetCustomMessage(HsLangTable, "ScreenRegisteredSuccessfully", "注册成功!"); break; case "SnEmpty": tmpType = CommonUI.GetCustomMessage(HsLangTable, "SnEmpty", "不允许存在屏体别名为空!"); break; case "ScreenReregister": if (ShowCustomMessageBox(CommonUI.GetCustomMessage(HsLangTable, "ScreenReregister", "免则声明:注册用户变更,是否继续?"), "", MessageBoxButtons.OKCancel, MessageBoxIconType.Question) == DialogResult.OK) { Action action = new Action(() => { _vm.CmdSaveTo.Execute(true); }); this.BeginInvoke(action, null); } else { CloseProcessForm(); } return; default: tmpType = CommonUI.GetCustomMessage(HsLangTable, "CareRegFailed", "注册失败!"); break; } bindingSource1.ResetBindings(false); ShowCustomMessageBox(tmpType, "", MessageBoxButtons.OK, MessageBoxIconType.Alert); CloseProcessForm(); }
public void SetSNInitialize(string sn) { string[] str = sn.Split('~'); if (str.Length == 3) { _snName = str[0] + "-" + MonitorAllConfig.Instance().ScreenName + (int.Parse(str[1]) + 1); _sn = str[2]; } if (string.IsNullOrEmpty(_sn)) { ShowCustomMessageBox(CommonUI.GetCustomMessage(_hashtable, "GetSNFailed", "获取屏体的SN信息失败:监控中不存在此屏信息"), "", MessageBoxButtons.OK, Windows.Forms.MessageBoxIconType.Alert); } else { SendSNMessage(_sn); } }
private void button_delete_Click(object sender, EventArgs e) { if (_whCfg_VM.SelectedStrategy != null) { if (ShowCustomMessageBox(CommonUI.GetCustomMessage(_langTable, "msg_delete", "确定删除所选配置?"), "", MessageBoxButtons.OKCancel, Windows.Forms.MessageBoxIconType.Question) == DialogResult.OK) { if (_whCfg_VM.DeleteStartegy(_whCfg_VM.VM_BaseList[dataGridView_ControlConfig.SelectedRows[0].Index])) { ShowCustomMessageBox(CommonUI.GetCustomMessage(_langTable, "msg_deletesuccess", "删除成功"), "", MessageBoxButtons.OK, Windows.Forms.MessageBoxIconType.Alert); vMBaseListBindingSource.ResetBindings(false); } else { ShowCustomMessageBox(CommonUI.GetCustomMessage(_langTable, "msg_deletefailed", "删除失败"), "", MessageBoxButtons.OK, Windows.Forms.MessageBoxIconType.Alert); } } } }