private void refreshOpticalProbeCrystalButton_Click(object sender, EventArgs e) { MonitorAllConfig.Instance().RefreshAllOpticalProbeInfos(); string strText = CommonUI.GetCustomMessage(_languageTable, "Getting_Opticalprobe_information", "正在获取光探头信息,请稍候..."); ShowProcessForm(strText, true); }
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; } }
private void confirmButton_Click(object sender, EventArgs e) { _fastSegmentParam.SegmentNum = int.Parse(this.sectionHScrollBar.Value.ToString()); _fastSegmentParam.MaxDisplayBright = int.Parse(this.maxLedNumericUpDown.Value.ToString()); _fastSegmentParam.MaxEnvironmentBright = int.Parse(this.maxEnvironmentNumericUpDown.Value.ToString()); _fastSegmentParam.MinDisplayBright = int.Parse(this.minLedNumericUpDown.Value.ToString()); _fastSegmentParam.MinEnvironmentBright = int.Parse(this.minEnvironmentNumericUpDown.Value.ToString()); if (_fastSegmentParam.MaxDisplayBright <= _fastSegmentParam.MinDisplayBright) { string errorTitleText = CommonUI.GetCustomMessage(_languageTable, "errorTitle", "错误"); string errorText = CommonUI.GetCustomMessage(_languageTable, "ledBrightness_error01", "屏体亮度最大值不能小于屏体亮度的最小值"); ShowCustomMessageBox(errorText, errorTitleText, MessageBoxButtons.OK, Windows.Forms.MessageBoxIconType.Error); //MessageBox.Show(this, "屏体亮度最大值不能小于屏体亮度的最小值", "错误", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } if (_fastSegmentParam.MaxEnvironmentBright <= _fastSegmentParam.MinEnvironmentBright) { string errorTitleText = CommonUI.GetCustomMessage(_languageTable, "errorTitle", "错误"); string errorText = CommonUI.GetCustomMessage(_languageTable, "environmentBrightness_error01", "环境亮度最大值不能小于环境亮度的最小值"); ShowCustomMessageBox(errorText, errorTitleText, MessageBoxButtons.OK, Windows.Forms.MessageBoxIconType.Error); //MessageBox.Show(this, "环境亮度最大值不能小于环境亮度的最小值", "错误", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } this.DialogResult = System.Windows.Forms.DialogResult.OK; }
private void ConfirmButton_Click(object sender, EventArgs e) { this.EnvironmentItem = (int)this.EnvironmentNumericUpDown.Value; this.LedItem = (int)this.LedNumericUpDown.Value; if (!IsBrightness()) { string errorTitleText = CommonUI.GetCustomMessage(_languageTable, "errorTitle", "错误"); string errorText = CommonUI.GetCustomMessage(_languageTable, "error01", "存在相同的环境亮度配置,请重新修改"); ShowCustomMessageBox(errorText, errorTitleText, MessageBoxButtons.OK, Windows.Forms.MessageBoxIconType.Error); return; } this.DialogResult = System.Windows.Forms.DialogResult.OK; }
private void ApplyUILanguageTable() { MultiLanguageUtils.UpdateLanguage(CommonUI.OpticalProbeConfigLangPath, this); MultiLanguageUtils.ReadLanguageResource(CommonUI.OpticalProbeConfigLangPath, "frm_OpticalProbeConfig", out _languageTable); if (_languageTable == null || _languageTable.Count == 0) { return; } foreach (DataGridViewColumn columnItem in brightnessDataGridView.Columns) { if (columnItem.CellType == typeof(DataGridViewButtonCell)) { string strText = CommonUI.GetCustomMessage(_languageTable, (columnItem.Name + "_Text").ToLower(), string.Empty); (columnItem as DataGridViewButtonColumn).Text = strText; } string str = CommonUI.GetCustomMessage(_languageTable, columnItem.Name.ToLower(), string.Empty); if (string.IsNullOrEmpty(str)) { continue; } columnItem.HeaderText = str; } foreach (DataGridViewColumn columnItem in opticalProbeDataGridView.Columns) { if (columnItem.CellType == typeof(DataGridViewButtonCell)) { string strText = CommonUI.GetCustomMessage(_languageTable, (columnItem.Name + "_Text").ToLower(), string.Empty); (columnItem as DataGridViewButtonColumn).Text = strText; } string str = CommonUI.GetCustomMessage(_languageTable, columnItem.Name.ToLower(), string.Empty); if (string.IsNullOrEmpty(str)) { continue; } columnItem.HeaderText = str; } if (_isTestStart) { crystalButton_BrightTest.Text = CommonUI.GetCustomMessage(_languageTable, "crystalButton_BrightTestStop", "停止测试"); } else { crystalButton_BrightTest.Text = CommonUI.GetCustomMessage(_languageTable, "crystalButton_BrightTestStart", "光探头测试"); } }
private void opticalProbeDataGridView_CellValueChanged(object sender, DataGridViewCellEventArgs e) { if (e.ColumnIndex == 0 && opticalProbeDataGridView.Rows.Count > 0) { var currentRow = opticalProbeDataGridView.Rows[e.RowIndex]; var item = (DataGridViewCheckBoxCell)currentRow.Cells[e.ColumnIndex]; if (item == null) { return; } bool isChecked = (bool)item.EditedFormattedValue; var currentPositionInfoCell = currentRow.Cells[1] as DataGridViewTextBoxCell; var currentRemarkInfoCell = currentRow.Cells[3] as DataGridViewTextBoxCell; if (currentPositionInfoCell == null) { return; } if (isChecked) { string positionInfo = currentPositionInfoCell.Value as string; string[] splitStr = positionInfo.Split(new char[] { '-' }); if (splitStr.Length > 1 && Convert.ToInt32(splitStr[1]) > 1) { currentRow.DefaultCellStyle.ForeColor = Color.Red; currentRemarkInfoCell.Value = CommonUI.GetCustomMessage(_languageTable, "NoSoftWareFail", "无软件失效"); } if (!_useablePeripheral.Contains(_internTable[e.RowIndex])) { _useablePeripheral.Add(_internTable[e.RowIndex]); } } else { currentRow.DefaultCellStyle.ForeColor = Color.Black; currentRemarkInfoCell.Value = string.Empty; _useablePeripheral.Remove(_internTable[e.RowIndex]); } } }
private bool IsBrightness(DataGridViewCell cell) { Int32 cellValueAsInt; if (cell.EditedFormattedValue.ToString().Length == 0) { brightnessDataGridView.Rows[cell.RowIndex].ErrorText = CommonUI.GetCustomMessage(_languageTable, "inputbrightvalue", "请输入亮度值"); return(false); } else if (!Int32.TryParse(cell.EditedFormattedValue.ToString(), out cellValueAsInt)) { brightnessDataGridView.Rows[cell.RowIndex].ErrorText = CommonUI.GetCustomMessage(_languageTable, "brightvalueDigital", "亮度值必须为数字"); return(false); } else { foreach (DataGridViewRow row in brightnessDataGridView.Rows) { if (row == null || row.Cells[cell.ColumnIndex] == null || row.Cells[cell.ColumnIndex].Value == null) { break; } if (row.Cells[cell.ColumnIndex].RowIndex == cell.RowIndex) { continue; } if (row.Cells[cell.ColumnIndex].Value.ToString().Equals(cell.EditedFormattedValue.ToString())) { brightnessDataGridView.Rows[cell.RowIndex].ErrorText = CommonUI.GetCustomMessage(_languageTable, "exitssamelightconfig", "存在相同亮度配置"); return(false); } } } brightnessDataGridView.Rows[cell.RowIndex].ErrorText = string.Empty; return(true); }
private void InitialLangTable() { BrightnessLangTable.CycleTypeTable = new Dictionary <CycleType, string>(); BrightnessLangTable.CycleTypeTable.Add(CycleType.everyday, CommonUI.GetCustomMessage(_langTable, "everyday", "每天")); BrightnessLangTable.CycleTypeTable.Add(CycleType.userDefined, CommonUI.GetCustomMessage(_langTable, "userdefined", "自定义")); BrightnessLangTable.CycleTypeTable.Add(CycleType.workday, CommonUI.GetCustomMessage(_langTable, "workday", "周一到周五")); BrightnessLangTable.DayTable = new Dictionary <DayOfWeek, string>(); BrightnessLangTable.DayTable.Add(DayOfWeek.Monday, CommonUI.GetCustomMessage(_langTable, "monday", "周一")); BrightnessLangTable.DayTable.Add(DayOfWeek.Tuesday, CommonUI.GetCustomMessage(_langTable, "tuesday", "周二")); BrightnessLangTable.DayTable.Add(DayOfWeek.Wednesday, CommonUI.GetCustomMessage(_langTable, "wednesday", "周三")); BrightnessLangTable.DayTable.Add(DayOfWeek.Thursday, CommonUI.GetCustomMessage(_langTable, "thursday", "周四")); BrightnessLangTable.DayTable.Add(DayOfWeek.Friday, CommonUI.GetCustomMessage(_langTable, "friday", "周五")); BrightnessLangTable.DayTable.Add(DayOfWeek.Saturday, CommonUI.GetCustomMessage(_langTable, "saturday", "周六")); BrightnessLangTable.DayTable.Add(DayOfWeek.Sunday, CommonUI.GetCustomMessage(_langTable, "sunday", "周日")); //label_tip.Text = string.Format( // CommonUI.GetCustomMessage(_langTable, "label_tip", "提示:存在多屏时:环境亮度配置请选择'{0}'进行配置!"), // MonitorAllConfig.Instance().ALLScreenName); BrightnessLangTable.SmartBrightTypeTable = new Dictionary <SmartBrightAdjustType, string>(); BrightnessLangTable.SmartBrightTypeTable.Add(SmartBrightAdjustType.AutoBright, CommonUI.GetCustomMessage(_langTable, "autobright", "自动亮度")); BrightnessLangTable.SmartBrightTypeTable.Add(SmartBrightAdjustType.FixBright, CommonUI.GetCustomMessage(_langTable, "fixbright", "固定亮度")); }
private void RefreshOpticalProbeConfigView() { _internTable.Clear(); opticalProbeDataGridView.Rows.Clear(); _useablePeripheral = MonitorAllConfig.Instance().AllOpticalProbeInfo.UseablePeripheralList; List <PeripheralsLocation> opticalList = null; if (_isSoftwareConfig) { if (_lightConfigInfo == null || _lightConfigInfo.DispaySoftWareConfig == null || _lightConfigInfo.DispaySoftWareConfig.AutoBrightSetting == null || _lightConfigInfo.DispaySoftWareConfig.AutoBrightSetting.UseLightSensorList == null || _lightConfigInfo.DispaySoftWareConfig.AutoBrightSetting.UseLightSensorList.Count == 0) { foreach (var itemConfig in MonitorAllConfig.Instance().AllOpticalProbeInfo.UseablePeripheralList) { string positionViewData = GetPositionViewData(itemConfig); object[] row = { false, positionViewData, itemConfig.SensorValue.ToString() }; opticalProbeDataGridView.Rows.Add(row); _internTable.Add(opticalProbeDataGridView.Rows.Count - 1, itemConfig); } return; } opticalList = _lightConfigInfo.DispaySoftWareConfig.AutoBrightSetting.UseLightSensorList; } else { if (_lightConfigInfo == null || _lightConfigInfo.DisplayHardcareConfig == null || _lightConfigInfo.DisplayHardcareConfig.AutoBrightSetting == null || _lightConfigInfo.DisplayHardcareConfig.AutoBrightSetting.UseLightSensorList == null || _lightConfigInfo.DisplayHardcareConfig.AutoBrightSetting.UseLightSensorList.Count == 0) { foreach (var itemConfig in MonitorAllConfig.Instance().AllOpticalProbeInfo.UseablePeripheralList) { string positionViewData = GetPositionViewData(itemConfig); object[] row = { false, positionViewData, itemConfig.SensorValue.ToString() }; opticalProbeDataGridView.Rows.Add(row); _internTable.Add(opticalProbeDataGridView.Rows.Count - 1, itemConfig); } return; } opticalList = _lightConfigInfo.DisplayHardcareConfig.AutoBrightSetting.UseLightSensorList; } foreach (var itemConfig in MonitorAllConfig.Instance().AllOpticalProbeInfo.UseablePeripheralList) { var resultItem = opticalList.FirstOrDefault(o => o.IsEquals(itemConfig)); if (resultItem == null) { string positionViewData = GetPositionViewData(itemConfig); object[] row = { false, positionViewData, itemConfig.SensorValue.ToString() }; opticalProbeDataGridView.Rows.Add(row); } else { string positionViewData = GetPositionViewData(resultItem); if (resultItem.SenderIndex != 0) { object[] row = { true, positionViewData, itemConfig.SensorValue.ToString(), CommonUI.GetCustomMessage(_languageTable, "NoSoftWareFail", "无软件失效") }; opticalProbeDataGridView.Rows.Add(row); opticalProbeDataGridView.CurrentRow.DefaultCellStyle.ForeColor = Color.Red; } else { object[] row = { true, positionViewData, itemConfig.SensorValue.ToString(), string.Empty }; opticalProbeDataGridView.Rows.Add(row); } } _internTable.Add(opticalProbeDataGridView.Rows.Count - 1, itemConfig); } }
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; }