private void LoadRegistryMonitor() { _currentLoadedEnvironment = _loadedSettings.Environments.Find(env => env.SubkeyValue == (string)Registry.GetValue(_loadedSettings.MonitoredRegistryKey.Root, _loadedSettings.MonitoredRegistryKey.Subkey, "")); SetIcon(); _registryMonitor = new RegistryUtils.RegistryMonitor(_loadedSettings.MonitoredRegistryKey.Root) { RegChangeNotifyFilter = RegChangeNotifyFilter.Value }; _registryMonitor.RegChanged += OnRegChanged; _registryMonitor.Error += OnError; _registryMonitor.Start(); _currentMonitoredRegistryKey = _loadedSettings.MonitoredRegistryKey; }
private void SetNewRegistrykeyIfChanged() { if (_currentMonitoredRegistryKey == _loadedSettings.MonitoredRegistryKey) { return; } _registryMonitor.Stop(); _registryMonitor.Dispose(); _registryMonitor = new RegistryUtils.RegistryMonitor(_loadedSettings.MonitoredRegistryKey.Root) { RegChangeNotifyFilter = RegChangeNotifyFilter.Value }; _registryMonitor.RegChanged += OnRegChanged; _registryMonitor.Error += OnError; _registryMonitor.Start(); _currentMonitoredRegistryKey = _loadedSettings.MonitoredRegistryKey; }
private void Form1_Load(object sender, EventArgs e) { regMon = new RegistryMonitor(RegistryHive.CurrentUser, accentColor); regMon.RegChangeNotifyFilter = RegChangeNotifyFilter.Value; regMon.RegChanged += new EventHandler<OnRegChangedEventArgs>(onRegistryChange); initLEDSDK(); }
private void SetNewRegistrykeyIfChanged() { if (_currentMonitoredRegistryKey == _loadedSettings.MonitoredRegistryKey) return; _registryMonitor.Stop(); _registryMonitor.Dispose(); _registryMonitor = new RegistryUtils.RegistryMonitor(_loadedSettings.MonitoredRegistryKey.Root) { RegChangeNotifyFilter = RegChangeNotifyFilter.Value }; _registryMonitor.RegChanged += OnRegChanged; _registryMonitor.Error += OnError; _registryMonitor.Start(); _currentMonitoredRegistryKey = _loadedSettings.MonitoredRegistryKey; }
private void StopRegistryMonitor() { if (registryMonitor != null) { registryMonitor.Stop(); registryMonitor.RegChanged -= new EventHandler(OnRegChanged); registryMonitor.Error -= new System.IO.ErrorEventHandler(OnError); registryMonitor = null; buttonStart.Enabled = true; buttonStop.Enabled = false; listBox1.Items.Add("Monitoring stopped"); } }
private void OnButtonStartClick(object sender, EventArgs e) { string keyName = string.Format("{0}\\{1}", comboBoxRegistryHives.SelectedValue.ToString(), textRegistryKey.Text); listBox1.Items.Add("Monitoring \"" + keyName + "\" started"); registryMonitor = new RegistryMonitor(keyName); registryMonitor.RegChanged += new EventHandler(OnRegChanged); registryMonitor.Error += new System.IO.ErrorEventHandler(OnError); registryMonitor.Start(); buttonStart.Enabled = false; buttonStop.Enabled = true; }