public AutomationOptionsInfo(AutomationOptionsInfo info) { _is_monitoring_enabled = info.IsMonitoringEnabled; _stop_auto_update_on_battery = info.StopAutoUpdateOnBattery; }
private void SettingsForm_Load(object sender, EventArgs e) { _modifiers = new Dictionary <string, HotKeyModifiers>(); _keys = new Dictionary <string, Keys>(); _akeys = new Dictionary <string, Keys>(); OptionsListBox.CheckOnClick = false; // // Blaze HotKey // _hotkey = SettingsManager.Instance.GetMainHotKey(); // modifiers _modifiers.Add("None", new HotKeyModifiers(false, false, false, false)); _modifiers.Add("Alt", new HotKeyModifiers(true, false, false, false)); _modifiers.Add("Ctrl", new HotKeyModifiers(false, true, false, false)); _modifiers.Add("Shift", new HotKeyModifiers(false, false, true, false)); _modifiers.Add("Win", new HotKeyModifiers(false, false, false, true)); _modifiers.Add("Alt+Ctrl", new HotKeyModifiers(true, true, false, false)); _modifiers.Add("Alt+Shift", new HotKeyModifiers(true, false, true, false)); _modifiers.Add("Alt+Win", new HotKeyModifiers(true, false, false, true)); _modifiers.Add("Ctrl+Shift", new HotKeyModifiers(false, true, true, false)); _modifiers.Add("Ctrl+Win", new HotKeyModifiers(false, true, false, true)); _modifiers.Add("Shift+Win", new HotKeyModifiers(false, false, true, true)); // keys _keys.Add("Space", Keys.Space); _keys.Add("Return", Keys.Return); _keys.Add("A", Keys.A); _keys.Add("B", Keys.B); _keys.Add("C", Keys.C); _keys.Add("D", Keys.D); _keys.Add("E", Keys.E); _keys.Add("F", Keys.F); _keys.Add("G", Keys.G); _keys.Add("H", Keys.H); _keys.Add("I", Keys.I); _keys.Add("J", Keys.J); _keys.Add("K", Keys.K); _keys.Add("L", Keys.L); _keys.Add("M", Keys.M); _keys.Add("N", Keys.N); _keys.Add("O", Keys.O); _keys.Add("P", Keys.P); _keys.Add("Q", Keys.Q); _keys.Add("R", Keys.R); _keys.Add("S", Keys.S); _keys.Add("T", Keys.T); _keys.Add("U", Keys.U); _keys.Add("V", Keys.V); _keys.Add("W", Keys.W); _keys.Add("X", Keys.X); _keys.Add("Y", Keys.Y); _keys.Add("Z", Keys.Z); _keys.Add("0", Keys.D0); _keys.Add("1", Keys.D1); _keys.Add("2", Keys.D2); _keys.Add("4", Keys.D4); _keys.Add("5", Keys.D5); _keys.Add("6", Keys.D6); _keys.Add("8", Keys.D8); _keys.Add("9", Keys.D9); _keys.Add("Pause", Keys.Pause); _keys.Add("Scroll Lock", Keys.Scroll); _keys.Add("Caps Lock", Keys.CapsLock); _keys.Add("Num Lock", Keys.NumLock); string[] modifiers = new string[_modifiers.Keys.Count]; string[] keys = new string[_keys.Keys.Count]; _modifiers.Keys.CopyTo(modifiers, 0); _keys.Keys.CopyTo(keys, 0); Keys[] keys_codes = new Keys[_keys.Values.Count]; _keys.Values.CopyTo(keys_codes, 0); ModifierComboBox.Items.AddRange(modifiers); ModifierComboBox.SelectedIndex = 0; MainKeyComboBox.Items.AddRange(keys); MainKeyComboBox.SelectedIndex = 0; // select user key ModifierComboBox.SelectedIndex = Array.FindIndex <string>(modifiers, delegate(string s) { return(s == _hotkey.ModifiersName); }); MainKeyComboBox.SelectedIndex = Array.FindIndex <Keys>(keys_codes, delegate(Keys s) { return(s == (Keys)_hotkey.Key); }); // // // Assistant HotKey // _ahotkey = SettingsManager.Instance.GetAssistantHotKey(); // keys _akeys.Add("None", Keys.None); _akeys.Add("Caps Lock", Keys.CapsLock); _akeys.Add("Pause", Keys.Pause); _akeys.Add("Scroll Lock", Keys.Scroll); _akeys.Add("Num Lock", Keys.NumLock); _akeys.Add("Left Alt", Keys.LMenu); _akeys.Add("Left Ctrl", Keys.LControlKey); _akeys.Add("Right Ctrl", Keys.RControlKey); _akeys.Add("Left Shift", Keys.LShiftKey); _akeys.Add("Right Shift", Keys.RShiftKey); _akeys.Add("Left Win", Keys.LWin); _akeys.Add("Right Win", Keys.RWin); string[] akeys_names = new string[_akeys.Keys.Count]; _akeys.Keys.CopyTo(akeys_names, 0); Keys[] akeys_codes = new Keys[_akeys.Values.Count]; _akeys.Values.CopyTo(akeys_codes, 0); AssistantKeyComboBox.Items.AddRange(akeys_names); AssistantKeyComboBox.SelectedIndex = 0; // select user key AssistantKeyComboBox.SelectedIndex = Array.FindIndex <Keys>(akeys_codes, delegate(Keys s) { return(s == (Keys)_ahotkey.Key); }); // // // Interface // _interface_info = new InterfaceInfo(SettingsManager.Instance.GetInterfaceInfo()); suggestionsNumericUpDown.Value = _interface_info.NumberOfSuggestions; // // // System Options // _system_options_info = new SystemOptionsInfo(SettingsManager.Instance.GetSystemOptionsInfo()); updateTimeNumericUpDown.Value = _system_options_info.UpdateTime; stopIndexingCheckBox.Checked = _system_options_info.StopAutoUpdateOnBattery; autoUpdatesCheckBox.Checked = _system_options_info.AutoUpdates; // // // Automation Options // _automation_options_info = new AutomationOptionsInfo(SettingsManager.Instance.GetAutomationOptionsInfo()); if (_automation_options_info.IsMonitoringEnabled) { yesAutomationRadioButton.Checked = true; } else { noAutomationRadioButton.Checked = true; } stopMonitoringCheckBox.Checked = _automation_options_info.StopAutoUpdateOnBattery; // // // Plugins // OptionsListBox.Items.Add("Include directories"); OptionsListBox.Items.Add("Search subdirectories"); _plugins_map_options = new Dictionary <string, int>(); _options_map_plugins = new Dictionary <int, string>(); _indexerPlugins = new List <IndexerPlugin>(); _interpreterPlugins = new List <InterpreterPlugin>(); _plugins = _parent.Plugins; _pluginInfo = new PluginInfo(SettingsManager.Instance.GetLoadablePlugins()); for (int i = 0; i < _plugins.Count; i++) { PluginsListBox.Items.Add(_plugins[i].Name, _pluginInfo.Enabled[_plugins[i].Name]); if (_plugins[i].Type == PluginType.Indexer) { IndexerPlugin p = (IndexerPlugin)_plugins[i]; _indexerPlugins.Add(p); OptionsListBox.Items.Add(p.QuickDescription); _plugins_map_options.Add(p.Name, OptionsListBox.Items.Count - 1); _options_map_plugins.Add(OptionsListBox.Items.Count - 1, p.Name); } else { InterpreterPlugin p = (InterpreterPlugin)_plugins[i]; _interpreterPlugins.Add(p); } } if (PluginsListBox.Items.Count > 0) { PluginsListBox.SelectedIndex = 0; } // // // Index // DirInfo info = SettingsManager.Instance.GetDirectories(); _directories = new List <string>(info.Directories.ToArray()); _extensions = new Dictionary <string, List <string> >(info.Extensions); _includeDirectories = new Dictionary <string, bool>(info.IncludeDirectories); _indexSubdirectories = new Dictionary <string, bool>(info.IndexSubdirectories); _dirPlugins = new Dictionary <string, List <string> >(info.Plugins); DirectoriesListBox.Items.AddRange(_directories.ToArray()); if (_directories.Count > 0) { DirectoriesListBox.SelectedIndex = 0; } // AutomatorLabel.Text = AssemblyTitle + (CommonInfo.IsPortable ? " Portable " : " ") + AssemblyVersion + " beta"; AutomatorDescriptionLabel.Text = "Blaze is an application that is being developed in the scope of a college project." + Environment.NewLine + "The main goal is to develop an application launcher that is able to automate the" + Environment.NewLine + "recurrent tasks that arise from everyday usage."; stopMonitoringCheckBox.Text = "Stop monitoring when my laptop is " + Environment.NewLine + "running on battery"; Process proc = Process.GetCurrentProcess(); MemoryEditableLabel.Text = (proc.PrivateMemorySize64 / 1024).ToString() + " kilobytes"; StartTimeEditableLabel.Text = proc.StartTime.ToString(); TimeSpan indexing_time = SettingsManager.Instance.GetIndexingTime(); IndexingTimeEditableLabel.Text = string.Format("{0:00}h {1:00}m {2:00}s {3:000}ms", indexing_time.TotalHours, indexing_time.Minutes, indexing_time.Seconds, indexing_time.Milliseconds); IndexedItemsEditableLabel.Text = SettingsManager.Instance.GetNumberOfIndexedItems().ToString() + " items"; LastIndexEditableLabel.Text = SettingsManager.Instance.GetLastIndexBuild().ToString(); proc.Dispose(); }