public static AppSettings LoadSettings() { #if JSON MainSettings = AppSettings.Load(); Properties.Settings.Default["DefaulAppTheme"] = MainSettings.ThemeColor; Properties.Settings.Default.Save(); return(MainSettings); #endif #if REGEDIT var colorTheme = (ColorThemes)Regedit.GetInt32("HKEY_CURRENT_USER\\Software\\Elektrum\\Master\\Continent", "ThemeColor", 2); var updateChannel = (UpdateChannel)Regedit.GetInt32("HKEY_CURRENT_USER\\Software\\Elektrum\\Master\\Continent", "UpdateChannel", 1); var doNotShow = Regedit.GetInt32("HKEY_CURRENT_USER\\Software\\Elektrum\\Master\\Continent", "DoNotShow", 0); var version = Regedit.GetString("HKEY_CURRENT_USER\\Software\\Elektrum\\Master\\Continent", "LastVersion", Constants.AppVersion); MainSettings.ThemeColor = colorTheme != 0 ? colorTheme : ColorThemes.Light; MainSettings.UpdateChannel = updateChannel != 0 ? updateChannel : UpdateChannel.Stable; MainSettings.DoNotShow = doNotShow != 0; MainSettings.LastVersion = version; Properties.Settings.Default["DefaulAppTheme"] = MainSettings.ThemeColor; Properties.Settings.Default.Save(); return(MainSettings); #endif }
public void StartMaster(Handler handler, AreaType areaType, int code, string path, PVMCell cell = null) { ProgBarViewModel progBarViewModel = new ProgBarViewModel(); var thread = new Thread(delegate() { var masterPath = Regedit.GetString("HKEY_CURRENT_USER\\Software\\Elektrum\\Master\\" + code, "StartupPath", ""); if (!File.Exists(path)) { Wrapper.ShowNotify("Не удалось найти файл конфигурации изделия по адресу " + path, Constants.AppName); return; } if (!File.Exists(masterPath)) { Wrapper.ShowNotify("Не удалось найти конфигуратор для изделия с кодом " + code, Constants.AppName); return; } Application.Current.Dispatcher.Invoke((Action)(() => { progBarViewModel.ActionName = "Выполняется конфигурация изделия..."; progBarViewModel.ShowBar(); })); var lastWriteTime = File.GetLastWriteTime(path); var process = Process.Start(masterPath, $" -type {code} -from \"{path}\""); process.WaitForExit(); Application.Current.Dispatcher.Invoke((Action)(() => { progBarViewModel.CloseBar(); })); if (lastWriteTime != File.GetLastWriteTime(path)) { _iToastNotifications.ShowSuccess("Файл конфигурации был обновлен"); Application.Current.Dispatcher.Invoke((Action)(() => { FileLoad(handler, path); if (cell != null) { ClearCellArea(cell); } MainDataParsing(handler == Handler.RUVN ? _iCommonData.RUVN_GetCommonData() : _iCommonData.RUNN_GetCommonData(), areaType); })); } }) { IsBackground = true }; thread.Start(); }