public bool SaveSettings() { foreach (Bridge br in ListViewSource) { if (WinHueSettings.settings.BridgeInfo.ContainsKey(br.Mac)) { WinHueSettings.settings.BridgeInfo[br.Mac] = new BridgeSaveSettings() { ip = br.IpAddress.ToString(), apikey = br.ApiKey, apiversion = br.ApiVersion, swversion = br.SwVersion, name = br.Name } } ; else { WinHueSettings.settings.BridgeInfo.Add(br.Mac, new BridgeSaveSettings() { ip = br.IpAddress.ToString(), apikey = br.ApiKey, apiversion = br.ApiVersion, swversion = br.SwVersion, name = br.Name }); } if (br.IsDefault) { WinHueSettings.settings.DefaultBridge = br.Mac; } } return(WinHueSettings.Save()); }
private void btnApply_Click(object sender, RoutedEventArgs e) { WinHueSettings.settings.DetectProxy = (bool)chbDetectProxy.IsChecked; WinHueSettings.settings.EnableDebug = (bool)chbDebug.IsChecked; WinHueSettings.settings.LiveSliders = (bool)chbLiveSliders.IsChecked; WinHueSettings.settings.DelayLiveSliders = (int)nudSlidersDelay.Value; WinHueSettings.settings.ShowHiddenScenes = (bool)chbHiddenScenes.IsChecked; WinHueSettings.settings.UpnpTimeout = (int)nudUpnpTimeout.Value; WinHueSettings.settings.AllOffTT = (uint)nudAllOffTT.Value; WinHueSettings.settings.AllOnTT = (uint)nudAllOnTT.Value; if (rbStartNormal.IsChecked == true) { WinHueSettings.settings.StartMode = 0; } else if (rbStartInTray.IsChecked == true) { WinHueSettings.settings.StartMode = 1; } else { WinHueSettings.settings.StartMode = 2; } WinHueSettings.settings.StartWithWindows = (bool)chbStartWindows.IsChecked; RegistryKey registryKey = Registry.CurrentUser.OpenSubKey("SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Run", true); if (chbStartWindows.IsChecked == true) { registryKey.SetValue("WinHue3", System.Reflection.Assembly.GetEntryAssembly().Location); } else { if (registryKey.GetValue("WinHue3") != null) { registryKey.DeleteValue("WinHue3"); } } registryKey.Close(); if (WinHueSettings.settings.Language != (string)((ComboBoxItem)cbLanguage.SelectedItem).Tag) { MessageBox.Show(GlobalStrings.Language_Change_Warning, GlobalStrings.Warning, MessageBoxButton.OK, MessageBoxImage.Information); } WinHueSettings.settings.Language = (string)((ComboBoxItem)cbLanguage.SelectedItem).Tag; WinHueSettings.Save(); this.DialogResult = true; this.Close(); }
private void ApplyGeneralSettings() { BridgeSettings brs = new BridgeSettings() { name = _brs.name, timezone = _brs.timezone }; WinHueSettings.settings.BridgeInfo[_brs.mac].name = _brs.name; WinHueSettings.Save(); if (_br.SetBridgeSettings(brs).FailureCount <= 0) { return; } MessageBoxError.ShowLastErrorMessages(_br); }
private void ApplyGeneralSettings() { BridgeSettings brs = new BridgeSettings() { name = _brs.name, timezone = _brs.timezone }; WinHueSettings.settings.BridgeInfo[_brs.mac].name = _brs.name; WinHueSettings.Save(); CommandResult comres = BridgeStore.SelectedBridge.SetBridgeSettings(brs); if (!comres.Success) { MessageBoxError.ShowLastErrorMessages(BridgeStore.SelectedBridge); } }
public void SaveHotKeys() { WinHueSettings.settings.listHotKeys = _listHotKeys.ToList(); WinHueSettings.Save(); }