public void Initialize(DataSet traceDataInfo, DateTime lastEventStartTime) { InitializeDictionary(); filter1ContentUserControl1.Initialize(traceDataInfo, lastEventStartTime); filter1ContentUserControl1.EnterKeyEvent += Filter1ContentUserControl1_EnterKeyEvent; _defaultSavedSearch = RegistryHandler.ReadFromRegistry(string.Format("DefaultSavedSearch_{0}", _registryName)); InitializeSavedSearch(_defaultSavedSearch); }
private void RemoveAllApplications() { listViewApplications.Items.Clear(); _config.Applications.Clear(); _config.RecentUsages.Clear(); RegistryHandler.SaveConfiguration(_config); UpdateSetList(); UpdateSelectedApplicationInfo(); EnableControls(true); }
private void DeleteToolStripButton_Click(object sender, EventArgs e) { if (!ConfigHandler.RegistryModifyAccess) { if (ConfigHandler.UseTranslation) { MessageBox.Show(Translator.GetText("DeleteSearchNoAccess")); } else { MessageBox.Show("Logged in user does not have necessary rights to delete the saved search.\r\n\r\nUser needs modify access to HKLM in RegEdit.", GenericHelper.ApplicationName, MessageBoxButtons.OK, MessageBoxIcon.Information); } return; } string savedSearchName = toolStripDropDownButton1.Text; if (SavedSearchesHandler.IsSystemObject(savedSearchName, _registryName)) { string text1 = "The selected search is a system object and can not be deleted."; if (ConfigHandler.UseTranslation) { text1 = Translator.GetText("CanNotDeleteSystemObject"); } OutputHandler.Show(text1, GenericHelper.ApplicationName, MessageBoxButtons.OK, MessageBoxIcon.Information); return; } string text = "Delete search \"{0}\"?"; if (ConfigHandler.UseTranslation) { text = Translator.GetText("DeleteSearch"); } DialogResult result = OutputHandler.Show(string.Format(text, savedSearchName), GenericHelper.ApplicationName, MessageBoxButtons.YesNo, MessageBoxIcon.Information); if (result == DialogResult.Yes) { SavedSearchesHandler.Delete(savedSearchName, _registryName); deleteToolStripButton.Enabled = false; PopulateSavedSearchesToolStrip(); if (savedSearchName == _defaultSavedSearch) { RegistryHandler.Delete(string.Format("DefaultSavedSearch_{0}", _registryName)); defaultToolStripButton.Image = Resources.star1; _defaultSavedSearch = ""; } } }
private static RegistryKey GetLocalMachineKey(RegistryView?view) { if (view == null) { return(Registry.LocalMachine); } else { return(RegistryHandler.GetRegistryKeyWithRegView(RegistryHive.LocalMachine, view)); } }
private async static Task SetSystemTheme(Mode mode, Theme newTheme, int taskdelay, RuntimeConfig rtc, AdmConfig config) { // Set system theme if (mode == Mode.DarkOnly) { RegistryHandler.SetSystemTheme((int)Theme.Dark); rtc.CurrentSystemTheme = Theme.Dark; await Task.Delay(taskdelay); if (config.AccentColorTaskbarEnabled) { RegistryHandler.SetColorPrevalence(1); rtc.CurrentColorPrevalence = true; } else { RegistryHandler.SetColorPrevalence(0); rtc.CurrentColorPrevalence = false; } } else if (config.SystemTheme == Mode.LightOnly) { RegistryHandler.SetColorPrevalence(0); rtc.CurrentColorPrevalence = false; await Task.Delay(taskdelay); RegistryHandler.SetSystemTheme((int)Theme.Light); rtc.CurrentSystemTheme = Theme.Light; } else { if (config.AccentColorTaskbarEnabled) { if (newTheme == Theme.Light) { RegistryHandler.SetColorPrevalence(0); rtc.CurrentColorPrevalence = false; await Task.Delay(taskdelay); } } RegistryHandler.SetSystemTheme((int)newTheme); if (config.AccentColorTaskbarEnabled) { if (newTheme == Theme.Dark) { await Task.Delay(taskdelay); RegistryHandler.SetColorPrevalence(1); rtc.CurrentColorPrevalence = true; } } rtc.CurrentSystemTheme = newTheme; } }
private void AddApplication() { AddApplicationForm addApplicationForm = new AddApplicationForm(_config.Groups, _config.Sets); if (addApplicationForm.ShowDialog(this) == DialogResult.OK && addApplicationForm.Application != null) { _config.Applications.Add(addApplicationForm.Application); RegistryHandler.SaveConfiguration(_config); AddApplicationToList(addApplicationForm.Application); } }
public AppsSwitch() : base() { try { currentComponentTheme = RegistryHandler.AppsUseLightTheme() ? Theme.Light : Theme.Dark; } catch (Exception ex) { Logger.Error(ex, "couldn't initialize apps theme state"); } }
protected override DetectedLocations getPaths(LocationRegistry get_me) { DetectedLocations return_me = new DetectedLocations(); RegistryHandler reg; // This handles if the root is a registry key if (get_me.Key != null) { reg = new RegistryHandler(get_me.Root, get_me.Key, false); if (reg.key_found) { try { string path; if (get_me.Value == null) { path = reg.getValue(""); } else { path = reg.getValue(get_me.Value); } if (path != null) { if (path.Contains("/")) { path = path.Split('/')[0].Trim(); } if (path.Contains("\"")) { path = path.Trim('\"').Trim(); } if (Path.HasExtension(path)) { path = Path.GetDirectoryName(path); } path = get_me.modifyPath(path); if (Directory.Exists(path)) { return_me.AddRange(Core.locations.interpretPath(new DirectoryInfo(path).FullName)); } } } catch (Exception e) { throw new TranslateableException("RegistryKeyLoadError", e); } } } return(return_me); }
public SystemSwitch() : base() { try { currentComponentTheme = RegistryHandler.SystemUsesLightTheme() ? Theme.Light : Theme.Dark; currentTaskbarColorActive = RegistryHandler.IsColorPrevalence(); } catch (Exception ex) { Logger.Error(ex, "couldn't initialize system apps theme state"); } }
private async Task SwitchLightOnly(int taskdelay) { if (Settings.Component.TaskbarColorOnAdaptive) { RegistryHandler.SetColorPrevalence(0); await Task.Delay(taskdelay); } currentTaskbarColorActive = false; RegistryHandler.SetSystemTheme((int)Theme.Light); currentComponentTheme = Theme.Light; }
private void SwitchLightOnly() { if (Settings.Component.TaskbarColorOnAdaptive) { RegistryHandler.SetColorPrevalence(0); } currentTaskbarColorActive = false; ThemeFile themeFile = GlobalState.ManagedThemeFile; themeFile.VisualStyles.SystemMode = (nameof(Theme.Light), themeFile.VisualStyles.SystemMode.Item2); currentComponentTheme = Theme.Light; }
public void UpdateRootPath() { try { RegistryHandler.SaveEngineSettings(EngineSettingsType.RootPaths); RaiseRootPathListUpdatedEvent(EngineSettings.RootPaths); } catch (Exception ex) { CommonWorker.ShowError(ex); } }
public static void SaveConfig() { RegistryHandler.SaveToRegistry("WorkloadManagerTaskCollectionPath", WorkloadManagerTaskCollectionPath); RegistryHandler.SaveToRegistry("WorkloadManagerStylesheetCollectionPath", WorkloadManagerStylesheetCollectionPath); RegistryHandler.SaveToRegistry("WorkloadManagerHiddenMode", WorkloadManagerHiddenMode); RegistryHandler.SaveToRegistry("WorkloadManagerCustomTaskCollection", WorkloadManagerCustomTaskCollection); RegistryHandler.SaveToRegistry("WorkloadManagerCustomStylesheetCollection", WorkloadManagerCustomStylesheetCollection); RegistryHandler.SaveToRegistry("WorkloadManagerRuns", WorkloadManagerRuns); RegistryHandler.SaveToRegistry("WorkloadManagerTimeBetweenRuns", WorkloadManagerTimeBetweenRuns); RegistryHandler.SaveToRegistry("WorkloadManagerIncludeResultXml", WorkloadManagerIncludeResultXml); RegistryHandler.SaveToRegistry("WorkloadManagerIncludeTransformedStylesheets", WorkloadManagerIncludeTransformedStylesheets); RegistryHandler.SaveToRegistry("WorkloadManagerLogDirectory", WorkloadManagerLogDirectory); }
private static void SaveValuesToRegistry(string registryKeyName, ToolStripMenuItem toolStripMenuItem) { string fileNames = ""; foreach (ToolStripMenuItem fileName in toolStripMenuItem.DropDownItems) { fileNames = string.Format("{0}{1};", fileNames, fileName); } fileNames = fileNames.Substring(0, fileNames.Length - 1); RegistryHandler.SaveToRegistry(registryKeyName, fileNames); }
public void RemoveSource(GallerySource source) { try { ObjectPool.RemoveSource(source); RegistryHandler.SaveSettings(SettingsType.GallerySource); RaiseSourceListUpdatedEvent(ObjectPool.Sources); } catch (Exception ex) { CommonWorker.ShowError(ex); } }
public void ToggleUseSpecificOutputFolder() { try { EngineSettings.UseSpecificOutputFolder = !EngineSettings.UseSpecificOutputFolder; RegistryHandler.SaveEngineSettings(EngineSettingsType.UseSpecificOutputFolder); RaiseUseSpecificOutputFolderUpdatedEvent(EngineSettings.UseSpecificOutputFolder); } catch (Exception ex) { CommonWorker.ShowError(ex); } }
private static void SaveValuesToRegistry(string registryKeyName, ComboBox comboBox) { string items = ""; foreach (string item in comboBox.Items) { items = string.Format("{0}{1}\r", items, item); } items = items.Substring(0, items.Length - 1); RegistryHandler.SaveToRegistry(registryKeyName, items); }
private void SwitchThemeNow(object sender, EventArgs e) { AdmConfig config = AdmConfigBuilder.Instance().Config; Logger.Info("ui signal received: switching theme"); if (RegistryHandler.AppsUseLightTheme()) { ThemeManager.SwitchTheme(config, Theme.Dark); } else { ThemeManager.SwitchTheme(config, Theme.Light); } }
/// <summary> /// Load the server information from the registry and apply it /// <returns>True if settings were updated</returns> /// </summary> public static bool GetAndSetServerAddress() { if (RegistryHandler.GetSystemSetting("HTTPS") == null || RegistryHandler.GetSystemSetting("WebRoot") == null || string.IsNullOrEmpty(RegistryHandler.GetSystemSetting("Server"))) { Log.Error(LogName, "Invalid parameters"); return(false); } ServerAddress = (RegistryHandler.GetSystemSetting("HTTPS").Equals("1") ? "https://" : "http://"); ServerAddress += RegistryHandler.GetSystemSetting("Server") + RegistryHandler.GetSystemSetting("WebRoot"); return(true); }
/// <summary> /// Loop through all the modules until an update or shutdown is pending /// </summary> protected virtual void ModuleLooper() { // Only run the service if there isn't a shutdown or update pending while (!Power.ShuttingDown && !Power.Updating) { // Stop looping as soon as a shutdown or update pending foreach (var module in _modules.TakeWhile(module => !Power.ShuttingDown && !Power.Updating)) { // Entry file formatting Log.NewLine(); Log.PaddedHeader(module.Name); Log.Entry("Client-Info", string.Format("Version: {0}", RegistryHandler.GetSystemSetting("Version"))); try { module.Start(); } catch (Exception ex) { Log.Error(Name, ex); } // Entry file formatting Log.Divider(); Log.NewLine(); if (Power.Requested) { break; } } while (Power.Requested) { Log.Entry(Name, "Power operation being requested, checking back in 30 seconds"); Thread.Sleep(30 * 1000); } // Skip checking for sleep time if there is a shutdown or update pending if (Power.ShuttingDown || Power.Updating) { break; } // Once all modules have been run, sleep for the set time var sleepTime = GetSleepTime() ?? DefaultSleepTime; Log.Entry(Name, string.Format("Sleeping for {0} seconds", sleepTime)); Thread.Sleep(sleepTime * 1000); } }
private void EditApplication() { if (listViewApplications.SelectedItems.Count == 1) { Application application = (Application)listViewApplications.SelectedItems[0].Tag; AddApplicationForm addApplicationForm = new AddApplicationForm(_config.Groups, _config.Sets, application); if (addApplicationForm.ShowDialog(this) == DialogResult.OK && addApplicationForm.Application != null) { RegistryHandler.SaveConfiguration(_config); AddApplicationToList(addApplicationForm.Application); UpdateSelectedApplicationInfo(); } } }
private void Application_Startup(object sender, StartupEventArgs e) { RegistryHandler.WatchAppTheme(theme => { if (theme == WindowsTheme.Light) { Resources.MergedDictionaries[0].Source = new Uri("Theme/Metro/Metro.MSControls.Core.Implicit.xaml", UriKind.Relative); } else { Resources.MergedDictionaries[0].Source = new Uri("Theme/MetroDark/MetroDark.MSControls.Core.Implicit.xaml", UriKind.Relative); } }); }
public void OkButtonClick() { if (ModifierKeys == Keys.Shift) { ShiftPressed = true; } if (saveValuesCheckBox.Checked) { ConfigHandler.SaveConnection(); } if (saveValuesCheckBox.Checked) { ConfigHandler.SaveConnectionString = "True"; } else { ConfigHandler.SaveConnectionString = "False"; } if (ConfigHandler.RegistryModifyAccess) { RegistryHandler.SaveToRegistry("SaveConnectionString", ConfigHandler.SaveConnectionString); } if (!VerifyFields()) { return; } BeginConnect(); RunWorkerArgument arg = new RunWorkerArgument(); arg.ConnectionString = GetConnectionString(); _runWorkerActive = true; if (GenericHelper.IsUserInteractive()) { _worker.RunWorkerAsync(arg); } else { DoWork(arg); RunWorkerCompleted(); } }
/** * Handles the start migration button's functionality. */ public static void StartMigrationHandler() { string isStarted = SettingsHandler.GetSetting("started"); if (isStarted.Equals("1")) { if (HistoryHandler.RevertChanges()) { SettingsHandler.SetSetting("started", "0"); startMigrateButton.Text = START_MIGRATION_TEXT; EnableMigrationCombos(); StopSpecialAddonListeners(); } else { MessageBox.Show("An error has occured, please try again or contact the developer for support."); } } else { DisableMigrationCombos(); if (!FileListeners.InitStaticListeners()) { HistoryHandler.RevertChanges(); MessageBox.Show("An error has occured, please try again or contact the developer for support."); EnableMigrationCombos(); return; } if (!RegistryHandler.SetSourceAsTarget()) { FileListeners.RemoveListeners(); HistoryHandler.RevertChanges(); MessageBox.Show("An error has occured, please try again or contact the developer for support."); EnableMigrationCombos(); return; } StartSpecialAddonListeners(); FilesHandler.CreateFakeFsxExecutable(GetSelectedTargetSimulator().GetSimPath()); startMigrateButton.Text = STOP_MIGRATION_TEXT; SettingsHandler.SetSetting("started", "1"); } }
public static void SwitchToDarkTheme() { if (Settings.Default.ChangeAppTheme) { RegistryHandler.AppsUseLightTheme(false); } if (Settings.Default.ChangeSystemTheme) { RegistryHandler.SystemUsesLightTheme(false); } if (Settings.Default.ChangeWallpaper) { WallpaperHandler.ChangeWallpaper(Settings.Default.DarkWallpaperPath); } }
private void SetupRegistrySettings() { try { if (RegistryHandler.RegistryConfigDataExists() == false) { new OptionsForm().ShowDialog(); } } catch (Exception ex) { RegistryHandler.DeleteRegistrySettings(); throw new RegistryAccessException("Could not access the registry.", ex); } }
public void Initialize(DatabaseOperation databaseOperation) { InitializeDictionary(); _databaseOperation = databaseOperation; Reset(); InitializeComboBoxGroups(); AddComboBoxEventHandlers(); InitializeColumnsComboBox(); InitializeOperatorsComboBox(); _defaultSavedSearch = RegistryHandler.ReadFromRegistry(string.Format("DefaultSavedSearch_{0}", _registryName)); InitializeSavedSearch(_defaultSavedSearch); }
public static void LoadLastSession() { if (EnableLoadLastSessionTaskCollection) { TaskHelper.TaskCollectionFileName = RegistryHandler.ReadFromRegistry("TaskCollectionFileName"); if (TaskHelper.TaskCollectionFileName == "") { TaskHelper.TaskCollectionFileName = null; } else { TaskCollection temporaryTaskCollection = TaskHelper.XmlToTaskCollection(XmlHelper.ReadXmlFromFile(TaskHelper.TaskCollectionFileName)); if (temporaryTaskCollection == null) { TaskHelper.TaskCollectionFileName = null; } else { TaskHelper.TaskCollection = temporaryTaskCollection; } } } if (EnableLoadLastSessionStylesheetCollection) { StylesheetHelper.StylesheetCollectionFileName = RegistryHandler.ReadFromRegistry("StylesheetCollectionFileName"); if (StylesheetHelper.StylesheetCollectionFileName == "") { StylesheetHelper.StylesheetCollectionFileName = null; } else { StylesheetCollection temporaryStylesheetCollection = StylesheetHelper.XmlToStylesheetCollection(XmlHelper.ReadXmlFromFile(StylesheetHelper.StylesheetCollectionFileName)); if (StylesheetHelper.StylesheetCollection == null) { StylesheetHelper.StylesheetCollectionFileName = null; } else { StylesheetHelper.StylesheetCollection = temporaryStylesheetCollection; } } } }
public void RemoveRootPath(params RootPath[] rootPaths) { try { foreach (RootPath rootPath in rootPaths) { EngineSettings.RemoveRootPath(rootPath); } RegistryHandler.SaveEngineSettings(EngineSettingsType.RootPaths); RaiseRootPathListUpdatedEvent(EngineSettings.RootPaths); } catch (Exception ex) { CommonWorker.ShowError(ex); } }
public static void SetRecordTraceFileDirectory(DatabaseOperation databaseOperation) { RecordTraceFileDir = RegistryHandler.ReadFromRegistry("RecordTraceFileDir"); if (RecordTraceFileDir == "") { string traceFileDir = databaseOperation.GetSqlServerDataDir(); if (traceFileDir == null || !Directory.Exists(traceFileDir)) { traceFileDir = GenericHelper.TempPath; } RecordTraceFileDir = traceFileDir; } }
public ArrayList GetUPSSupportedFeatures() { PowerChuteData.regHandler = RegistryHandler.GetRegistryHandlerInstance(); ArrayList arrayList = new ArrayList(); this.UIControlObj.MGDGetSupportedFeatures(arrayList); if (PowerChuteData.IsNormalVoltUPS()) { arrayList.Add("NormalVoltUPS"); } if (PowerChuteData.IsAdvancedUPS()) { arrayList.Add("AdvancedUPS"); } if (PowerChuteData.IsSelfTestSupported()) { arrayList.Add("SelfTest"); } if (PowerChuteData.LongRunUPS()) { arrayList.Add("Long Run UPS"); } return arrayList; }
public StartupHelper(string name, string program) { this.name = name; this.program = program; reg = new RegistryHandler("current_user", @"SOFTWARE\Microsoft\Windows\CurrentVersion\Run", true); }