private void OnMSG_DataAltarmConfig(string obj) { _vm = new UC_DataAlarmConfig_VM(); uCDataAlarmConfigVMBindingSource.DataSource = _vm; _vm.TempType = MonitorAllConfig.Instance().UserConfigInfo.TemperatureUnit; _vm.CmdInitialize.Execute(obj); }
/// <summary> /// xml文件保存 /// </summary> public static bool SaveAsConfigurationFile(SystemRunRecordData systemRunRecordData, string savePath) { XmlSerializer xmlSerializer = null; StreamWriter streamWriter = null; try { xmlSerializer = new XmlSerializer(typeof(SystemRunRecordData)); streamWriter = new StreamWriter(savePath); XmlWriter xmlWriter = XmlWriter.Create(streamWriter); xmlSerializer.Serialize(streamWriter, systemRunRecordData); streamWriter.Close(); } catch (System.Exception ex) { MonitorAllConfig.Instance().WriteLogToFile("ExistCatch:写入Xml文件出现异常" + ex.ToString(), true); return(false); } finally { if (streamWriter != null) { streamWriter.Close(); } } return(true); }
/// <summary> /// Xml文件读取 /// </summary> public static bool ReadConfigurationFile(string readPath, out SystemRunRecordData systemRunRecordData) { FileStream fileStream = null; XmlSerializer xmlSerializer = null; systemRunRecordData = null; try { fileStream = new FileStream(readPath, FileMode.Open); xmlSerializer = new XmlSerializer(typeof(SystemRunRecordData)); systemRunRecordData = (SystemRunRecordData)xmlSerializer.Deserialize(fileStream); } catch (Exception ex) { MonitorAllConfig.Instance().WriteLogToFile("ExistCatch:读取Xml文件出现异常" + ex.ToString(), true); return(false); } finally { if (fileStream != null) { fileStream.Close(); } } return(true); }
private void frm_OpticalProbeConfig_Load(object sender, EventArgs e) { ApplyUILanguageTable(); MonitorAllConfig.Instance().RefreshAllOpticalProbeInfos(); string strText = CommonUI.GetCustomMessage(_languageTable, "Getting_Opticalprobe_information", "正在获取光探头信息,请稍候..."); ShowProcessForm(strText, true); }
private void Frm_MonitorConfigManager_FormClosing(object sender, FormClosingEventArgs e) { MonitorAllConfig.Instance().LedScreenChangedEvent -= Frm_MonitorConfigManager_LedScreenChangedEvent; MonitorAllConfig.Instance().LedRegistationInfoEvent -= Frm_MonitorConfigManager_LedRegistationInfoEvent; foreach (UC_ConfigBase uc in _dicConfigControls.Values) { uc.Dispose(); } }
public UC_DataAlarmConfig() { InitializeComponent(); _vm = new UC_DataAlarmConfig_VM(); uCDataAlarmConfigVMBindingSource.DataSource = _vm; _vm.TempType = MonitorAllConfig.Instance().UserConfigInfo.TemperatureUnit; UpdateLanguage(); this.Invalidate(); }
private void FrmClosed() { if (SensorTestEvent != null && _isTestStart == true) { SensorTestEvent(false, null); } this.Load -= frm_OpticalProbeConfig_Load; MonitorAllConfig.Instance().GetLightProbeEvent -= frm_OpticalProbeConfig_GetLightProbeEvent; }
public Frm_RegistrationManager() { InitializeComponent(); this.Load += Frm_RegistrationManager_Load; MonitorAllConfig.Instance().LedRegistationInfoEvent += LedRegistationInfoCompletedEvent; MonitorAllConfig.Instance().CareServiceConnectionStatusChangedEvent += Frm_MonitorConfigManager_CareServiceStatusChanged; InitializeRegistationData(); _topmostTimer = new System.Threading.Timer(ThreadSetTopMostCallback); }
private void InitialAlarmConfg(LedAlarmConfig ledAlarm) { if (ledAlarm.ParameterAlarmConfigList == null || ledAlarm.ParameterAlarmConfigList.Count == 0) { return; } foreach (ParameterAlarmConfig param in ledAlarm.ParameterAlarmConfigList) { if (param != null) { switch (param.ParameterType) { case StateQuantityType.Temperature: IsEnableTempAlarm = !param.Disable; TemperatureThreshold = (int)param.HighThreshold; break; case StateQuantityType.Humidity: IsEnableHumidityAlarm = !param.Disable; HumidityThreshold = (int)param.HighThreshold; break; case StateQuantityType.Voltage: if (param.Level == AlarmLevel.Warning) { IsEnableVoltageAlarm = !param.Disable; VoltageThreshold = (float)param.LowThreshold; VoltageThresholdMax = (float)param.HighThreshold; } else if (param.Level == AlarmLevel.Malfunction) { IsEnableVoltageErrorAlarm = !param.Disable; VoltageErrorThreshold = (float)param.HighThreshold; } break; case StateQuantityType.FanSpeed: IsEnableFanSpeedAlarm = !param.Disable; FanSpeedThreshold = (int)param.LowThreshold; break; } } } if (MonitorAllConfig.Instance().UserConfigInfo != null) { if (_tempType == TemperatureType.Celsius) { StrTempFlag = "℃"; } else { StrTempFlag = "℉"; } } }
public bool OnCmdSaveConfig() { SerializableDictionary <FunctionCardRoadInfo, string> funcCardPower = new SerializableDictionary <FunctionCardRoadInfo, string>(); foreach (PowerControlData power in _powerConfig) { funcCardPower.Add(power.Key, power.Value); } return(MonitorAllConfig.Instance().SaveFunctionCardPowerConfig(funcCardPower)); }
public bool OnCmdSaveTo() { LedAcquisitionConfig acquisitionConfig = new LedAcquisitionConfig(); acquisitionConfig.IsAutoRefresh = IsCycleMonitor; acquisitionConfig.RetryCount = RetryReadTimes; acquisitionConfig.DataPeriod = MonitorPeriod * 1000; return(MonitorAllConfig.Instance().UpdateLedAcquisitionConfig(acquisitionConfig)); }
private void OnCmdInitialize() { if (MonitorAllConfig.Instance().AcquisitionConfig == null) { MonitorAllConfig.Instance().AcquisitionConfig = new LedAcquisitionConfig(); } IsCycleMonitor = MonitorAllConfig.Instance().AcquisitionConfig.IsAutoRefresh; RetryReadTimes = MonitorAllConfig.Instance().AcquisitionConfig.RetryCount; MonitorPeriod = MonitorAllConfig.Instance().AcquisitionConfig.DataPeriod / 1000; }
private void radioButton_DifferentPowerCount_Click(object sender, EventArgs e) { radioButton_DifferentPowerCount.Checked = true; 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("-", ""), (byte)numericUpDown_MCSamePowerCount.Value, out moinfos); _vm.MCPower.AllPowerCountDif = moinfos; } }
public bool OnCmdSaveAlarmConfig() { LedAlarmConfig ledAlarmCfg = GetAlarmConfg(); //TODO:将系统配置入库 MonitorAllConfig.Instance().u(_sn, ledAlarmCfg); MonitorAllConfig.Instance().UserConfigInfo.TemperatureUnit = _tempType; if (!MonitorAllConfig.Instance().SaveUserConfig()) { return(false); } return(MonitorAllConfig.Instance().UpdateLedAlarmConfig(_sn, ledAlarmCfg)); }
public MonitorMain(bool isOpenMain) { MonitorAllConfig.Instance().WriteLogToFile("开始初始化主界面..."); Initialize(); MonitorAllConfig.Instance().WriteLogToFile("初始化主界面完成..."); if (isOpenMain) { OpenMainUI(string.Empty); MonitorAllConfig.Instance().WriteLogToFile("打开了主界面..."); } MonitorAllConfig.Instance().WriteLogToFile("初始化主界面构造完成..."); }
private void OnCmdRefresh() { NotifyContentList.Clear(); if (MonitorAllConfig.Instance().GetSendEMailLog(SelectedTimes)) { List <NotifyContent> temp = MonitorAllConfig.Instance().NotifyContentList; for (int i = 0; i < temp.Count; i++) { NotifyContentList.Add(temp[i]); } } }
private void Frm_RegistrationManager_FormClosing(object sender, FormClosingEventArgs e) { MonitorAllConfig.Instance().LedRegistationInfoEvent -= LedRegistationInfoCompletedEvent; MonitorAllConfig.Instance().CareServiceConnectionStatusChangedEvent -= Frm_MonitorConfigManager_CareServiceStatusChanged; _topmostTimer.Change(System.Threading.Timeout.Infinite, System.Threading.Timeout.Infinite); _topmostTimer.Dispose(); if (_instance != null && !_instance.IsDisposed) { _instance.Dispose(); _instance = null; } }
private void registerButton_Click(object sender, EventArgs e) { VerifyRegisterationInformation(); foreach (var screenItem in MonitorAllConfig.Instance().LedInfoList) { var resultItem = _screenInfoList.FirstOrDefault(s => s.sn_num == screenItem.Sn); if (resultItem == null) { _requestScreenList.Add(new LedRegistationInfo() { card_num = GetCardNum(screenItem.PartInfos), mac = AppDataConfig.CurrentMAC, sn_num = screenItem.Sn, led_height = screenItem.Height, led_width = screenItem.Width, IsReregistering = false, ControlSystem = ControlSystemType.LED_Nova_M3, Latitude = 0d, Longitude = 0d, UserID = string.Empty, led_name = string.Empty }); } else { _requestScreenList.Add(new LedRegistationInfo() { card_num = GetCardNum(screenItem.PartInfos), mac = AppDataConfig.CurrentMAC, sn_num = screenItem.Sn, led_height = screenItem.Height, led_width = screenItem.Width, IsReregistering = false, ControlSystem = ControlSystemType.LED_Nova_M3, Latitude = resultItem.Latitude, Longitude = resultItem.Longitude, UserID = resultItem.UserID, led_name = resultItem.led_name }); } } Action action = new Action(() => { RegisterScreens(_account, _requestScreenList, false); }); action.BeginInvoke(null, null); string strText = CommonUI.GetCustomMessage(_languageTable, "Waiting_information", "注册中,请等待..."); ShowProcessForm(strText, true); }
/// <summary> /// 创建Excel文件 /// </summary> /// <param name="dateTable"></param> /// <param name="fileName"></param> /// <returns></returns> public static bool CreateStatisticsExcel(DataTable dateTable, string fileName) { System.Threading.Thread thisThread = System.Threading.Thread.CurrentThread; System.Globalization.CultureInfo originalCulture = thisThread.CurrentCulture; object missing = System.Reflection.Missing.Value; Excel.Application app = null; Excel.Workbook book = null; Excel.Worksheet sheet = null; try { thisThread.CurrentCulture = new System.Globalization.CultureInfo("en-US"); app = new Excel.ApplicationClass(); app.DisplayAlerts = false; //设置不显示弹出框 app.AlertBeforeOverwriting = false; //设置默认为覆盖原有文件 app.Application.Workbooks.Add(true); book = (Excel.Workbook)app.ActiveWorkbook; sheet = (Excel.Worksheet)book.ActiveSheet; for (int i = 0; i < dateTable.Columns.Count; i++) { sheet.Cells[1, i + 1] = dateTable.Columns[i].ToString(); } for (int i = 0; i < dateTable.Rows.Count; i++) { for (int j = 0; j < dateTable.Columns.Count; j++) { sheet.Cells[i + 2, j + 1] = dateTable.Rows[i][j]; } } book.SaveCopyAs(fileName);//保存文件 //book.SaveAs(fileName, Excel.XlFileFormat.xlExcel8, Missing.Value, Missing.Value, Missing.Value, // Missing.Value, Excel.XlSaveAsAccessMode.xlShared, Missing.Value, Missing.Value, Missing.Value, // Missing.Value, Missing.Value);//保存文件 } catch (System.Exception ex) { MonitorAllConfig.Instance().WriteLogToFile("ExistCatch:写入Excel报告文件出现异常" + ex.ToString(), true); return(false); } finally { book.Close(false, missing, missing); app.Quit(); thisThread.CurrentCulture = originalCulture; } return(true); }
public UC_WHControlConfig_VM_Base(string sn, StrategyType stratType) { _sn = sn; List <LedBasicInfo> ledInfoList = MonitorAllConfig.Instance().LedInfoList.FindAll(a => a.Sn == _sn); if (ledInfoList.Count != 0) { _aliaName = ledInfoList[0].AliaName; } _id = Guid.NewGuid(); _stratType = stratType; InitialPowerList(new Dictionary <string, PowerCtrl_Type>()); }
private void crystalButton_RecommendTime_Click(object sender, EventArgs e) { if (MonitorAllConfig.Instance().AcquisitionConfig.IsAutoRefresh) { ShowCustomMessageBox( CommonUI.GetCustomMessage(HsLangTable, "CycleRefreshTimeTitle", "为了获取时间准确性,请停止自动执行,并保存后,再试..."), "", MessageBoxButtons.OK, MessageBoxIconType.Alert); return; } _stopWatch.Restart(); _vm.CmdRefreshTime.Execute(null); _isRefresh = true; ShowSending("CycleRefreshTime", "正在获取推荐周期配置,请稍候...", true); }
private void SaveConfig(Action <int> callBackAction) { Func <int> func = () => { return(MonitorAllConfig.Instance().SaveBrigthnessAutoConfig((int)numericUpDown_AutoBrightPeriod.Value, (int)numericUpDown_ReadLuxCnt.Value, checkBox_IsSmartEnable.Checked, checkBox_IsGradualEnable.Checked)); }; func.BeginInvoke((ar) => { var result = func.EndInvoke(ar); this.BeginInvoke(callBackAction, new object[] { result }); }, null); }
private void Initialize() { _dicConfigControls = new Dictionary <string, UC_ConfigBase>(); _vm = new Frm_MonitorConfigManager_VM(); UpdateLanguage(); tableLayoutPanel_Config.GetType().GetProperty("DoubleBuffered", System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.NonPublic) .SetValue(tableLayoutPanel_Config, true, null); Frm_MonitorConfigManager_LedScreenChangedEvent(null, null); buttonConfig_Click(crystalButton_RefreshConfig, null); MonitorAllConfig.Instance().LedScreenChangedEvent += Frm_MonitorConfigManager_LedScreenChangedEvent; MonitorAllConfig.Instance().LedRegistationInfoEvent += Frm_MonitorConfigManager_LedRegistationInfoEvent; comboBox_Screen_DataSourceChanged(null, null); }
private LedAlarmConfig GetAlarmConfg() { LedAlarmConfig ledAlarm = new LedAlarmConfig(); ledAlarm.SN = SN; ledAlarm.ParameterAlarmConfigList = new List <ParameterAlarmConfig>(); ParameterAlarmConfig param = new ParameterAlarmConfig(); param.Disable = !IsEnableTempAlarm; param.ParameterType = StateQuantityType.Temperature; if (_tempType == TemperatureType.Fahrenheit) { param.HighThreshold = (int)MonitorAllConfig.Instance().GetTempValueChanged(TemperatureType.Celsius, TemperatureThreshold); } else { param.HighThreshold = TemperatureThreshold; } ledAlarm.ParameterAlarmConfigList.Add((ParameterAlarmConfig)param.Clone()); param.Disable = !IsEnableHumidityAlarm; param.ParameterType = StateQuantityType.Humidity; param.HighThreshold = HumidityThreshold; ledAlarm.ParameterAlarmConfigList.Add((ParameterAlarmConfig)param.Clone()); param.Disable = !IsEnableVoltageAlarm; param.ParameterType = StateQuantityType.Voltage; param.LowThreshold = VoltageThreshold; if (param.LowThreshold >= param.HighThreshold) { param.HighThreshold = VoltageThreshold + 0.1; } if (param.HighThreshold > 12) { param.HighThreshold = 12; } param.Level = AlarmLevel.Warning; ledAlarm.ParameterAlarmConfigList.Add((ParameterAlarmConfig)param.Clone()); param.Disable = !IsEnableVoltageErrorAlarm; param.ParameterType = StateQuantityType.Voltage; param.HighThreshold = VoltageErrorThreshold; param.LowThreshold = 0; param.Level = AlarmLevel.Malfunction; ledAlarm.ParameterAlarmConfigList.Add((ParameterAlarmConfig)param.Clone()); param.Disable = !IsEnableFanSpeedAlarm; param.ParameterType = StateQuantityType.FanSpeed; param.LowThreshold = FanSpeedThreshold; param.HighThreshold = 0; ledAlarm.ParameterAlarmConfigList.Add((ParameterAlarmConfig)param.Clone()); return(ledAlarm); }
private void OnCareServerSaveFinish(string result) { string tmpType = string.Empty; switch (result) { case "ScreenAlreadyExists": tmpType = CommonUI.GetCustomMessage(_languageTable, "ScreenAlreadyExists", "屏体已注册!"); break; case "AccountNotExist": tmpType = CommonUI.GetCustomMessage(_languageTable, "AccountNotExist", "账户不存在!"); break; case "ScreenRegisteredSuccessfully": tmpType = CommonUI.GetCustomMessage(_languageTable, "ScreenRegisteredSuccessfully", "注册成功!"); MonitorAllConfig.Instance().LedBasicToUIScreen(); break; case "SnEmpty": tmpType = CommonUI.GetCustomMessage(_languageTable, "SnEmpty", "不允许存在屏体别名为空!"); break; case "ScreenReregister": if (ShowCustomMessageBox(CommonUI.GetCustomMessage(_languageTable, "ScreenReregister", "免则声明:注册用户变更,是否继续?"), "", MessageBoxButtons.OKCancel, MessageBoxIconType.Question) == DialogResult.OK) { Action action = new Action(() => { //_requestScreenList.ForEach(s => s.IsReregistering = true); RegisterScreens(_account, _requestScreenList, true); }); this.BeginInvoke(action, null); return; } else { CloseProcessForm(); } return; default: tmpType = CommonUI.GetCustomMessage(_languageTable, "CareRegFailed", "注册失败!"); break; } ShowCustomMessageBox(tmpType, "", MessageBoxButtons.OK, MessageBoxIconType.Alert); CloseProcessForm(); }
private void Initialize() { lock (_ledRegistationMetux) { Uc_CareRegisters.Clear(); foreach (LedRegistationInfoResponse ledRegistation in MonitorAllConfig.Instance().LedRegistationUiList) { if (!string.IsNullOrEmpty(ledRegistation.User)) { UserId = ledRegistation.User; } SetCareRegisterInfo(ledRegistation.SN); } } }
public bool OnCmdSaveConfig() { OpticalProbeConfig optical = new OpticalProbeConfig(); optical.SN = _sn; optical.ConfigInfo = new List <UseablePeripheral>(); foreach (CheckUseablePeripheral checkusea in _checkUseable) { if (checkusea.IsChecked) { optical.ConfigInfo.Add(checkusea.UseablePer); } } return(MonitorAllConfig.Instance().SaveOpticalProbeInfoCofig(_sn, optical)); }
private void frmConfig_SensorTestEvent(bool isTest, List <PeripheralsLocation> sensorList) { if (isTest) { SmartLightConfigInfo smartTest = new SmartLightConfigInfo(); smartTest.ScreenSN = _currentSn; smartTest.DispaySoftWareConfig = new DisplaySmartBrightEasyConfig(); smartTest.DispaySoftWareConfig.AutoAdjustPeriod = 5; smartTest.DispaySoftWareConfig.AutoBrightReadLuxCnt = 1; smartTest.DispaySoftWareConfig.DisplayUDID = _currentSn; smartTest.DispaySoftWareConfig.IsSmartEnable = true; smartTest.DispaySoftWareConfig.IsBrightGradualEnable = true; smartTest.DispaySoftWareConfig.OneDayConfigList = new List <OneSmartBrightEasyConfig>(); smartTest.DispaySoftWareConfig.OneDayConfigList.Add(new OneSmartBrightEasyConfig() { IsConfigEnable = true, BrightPercent = 0, CustomDayCollection = new List <DayOfWeek>() { (DayOfWeek)0, (DayOfWeek)1, (DayOfWeek)2, (DayOfWeek)3, (DayOfWeek)4, (DayOfWeek)5, (DayOfWeek)6 }, ScheduleType = SmartBrightAdjustType.AutoBright, StartTime = new DateTime(2014, 1, 1, 0, 0, 0) }); smartTest.DispaySoftWareConfig.AutoBrightSetting.AutoBrightMappingList = new List <DisplayAutoBrightMapping>() { new DisplayAutoBrightMapping() { EnvironmentBright = 200, DisplayBright = 90 }, new DisplayAutoBrightMapping() { EnvironmentBright = 100, DisplayBright = 50 }, new DisplayAutoBrightMapping() { EnvironmentBright = 0, DisplayBright = 0 } }; smartTest.DispaySoftWareConfig.AutoBrightSetting.UseLightSensorList = sensorList; MonitorAllConfig.Instance().SaveBrightnessConfig(smartTest, false); } else { MonitorAllConfig.Instance().SaveBrightnessConfig(_screenConfigInfobak, false); } }
private void OnMsgHWConfig(string sn) { if (MonitorAllConfig.Instance().IsAllScreen(sn)) { radioButton_DifferentFanCount.Enabled = false; radioButton_DifferentPowerCount.Enabled = false; } else { string[] str = sn.Split('-'); _sn10 = str[0] + "-" + (Convert.ToInt32(str[1], 16) + 1).ToString("00"); radioButton_DifferentFanCount.Enabled = true; radioButton_DifferentPowerCount.Enabled = true; } _vm.ReceiveMsgHWConfig(sn); }
private void OnCmdInitialize() { _powerConfig.Clear(); if (MonitorAllConfig.Instance().PeripheralCfgDICDic == null) { return; } foreach (KeyValuePair <string, string> keyvalue in MonitorAllConfig.Instance().PeripheralCfgDICDic) { _powerConfig.Add(new PowerControlData() { Key = CommandTextParser.GetDeJsonSerialization <FunctionCardRoadInfo>(keyvalue.Key), Value = keyvalue.Value }); } }