public static void LoadTheme() { try { ThemePath.Output(); if (!File.Exists(ThemePath)) { "LoadTheme(theme file is not exist)".Output(); var swatch = new SwatchesProvider().Swatches.FirstOrDefault(sw => sw.Name == "pink"); Helper.Theme = new RmtTheme { PrimarySwatch = swatch, IsAlternate = true, //IsDarkMode = true }; return; } var json = File.ReadAllText(ThemePath); Helper.Theme = JsonConvert.DeserializeObject <RmtTheme>(json); } catch { } finally { if (Helper.Theme == null) { Helper.Theme = new RmtTheme(); } } }
public SettingViewModel() { HotKeyCollect = new ObservableCollection <HotKeyModel>(); foreach (var it in ConfigMgr.Instance.HardwareCfgMgr.AxisSettings) { var MotionCard = MotionMgr.Instance.FindMotionCardByAxisIndex(it.AxisNo); if (MotionCard != null) { HotKeyCollect.Add(new HotKeyModel() { AxisName = MotionCard.AxisArgsList[it.AxisNo - MotionCard.MIN_AXIS].AxisName, AxisNo = MotionCard.AxisArgsList[it.AxisNo - MotionCard.MIN_AXIS].AxisNo, }); } else { HotKeyCollect.Add(new HotKeyModel()); } } //初始化Google控件皮肤 Swatches = new SwatchesProvider().Swatches; PaletteHelper paletteHelper = new PaletteHelper(); paletteHelper.ReplacePrimaryColor(Swatches.Where(a => a.Name == "blue").First()); }
public SettingOptionsViewModel(UserControl headerControl) { _swatches = new SwatchesProvider().Swatches; _headerControl = headerControl; ApplyPrimaryCommand = new DelegateCommand(o => ApplyPrimary((Swatch)o)); ApplyAccentCommand = new DelegateCommand(o => ApplyAccent((Swatch)o)); }
public PaletteSelectorViewModel() { Swatches = new SwatchesProvider().Swatches; context = new BacLab_DBEntities(); IsAlternative = Convert.ToBoolean(context.StyleApps.Where(c => c.id == 1).FirstOrDefault().style); IsDark = Convert.ToBoolean(context.StyleApps.Where(c => c.id == 1).FirstOrDefault().isDark); }
public PaletteSelectorViewModel(AppSetting appSetting) { Swatches = new SwatchesProvider().Swatches; //appSetting = AppSetting.Create(FileName); this.appSetting = appSetting; ApplyBase(appSetting.IsDark); }
public SettingsViewModel() { DarkLightCommand = new DelegateCommand <bool?>(DoDarkLightCommand); ApplyPrimaryCommand = new DelegateCommand <Swatch>(ApplyPrimary); ApplyAccentCommand = new DelegateCommand <Swatch>(ApplyAccent); Swatches = new SwatchesProvider().Swatches; }
/// <summary> /// Saves the Color data in selected path. /// </summary> public void Save() { if (!Directory.Exists(SAPPRemote.SAPPTcpClient.AppDataPath)) { Directory.CreateDirectory(SAPPRemote.SAPPTcpClient.AppDataPath); } var s = new JsonSerializerSettings(); s.ObjectCreationHandling = ObjectCreationHandling.Replace; // without this, you end up with duplicates. SwatchesProvider swatchesProvider = new SwatchesProvider(); List <string> ColorsList = swatchesProvider.Swatches.Select(a => a.Name).ToList(); ColorData cd = new ColorData(); cd.ColorDataList.Add(new SAPPRemote.ColorDataList("------------Recommended------------", "SEP", false)); foreach (string st in ColorsList) { cd.ColorDataList.Add(new SAPPRemote.ColorDataList(st, "REC", true)); } cd.ColorDataList.Add(new SAPPRemote.ColorDataList("------------Recommended------------", "SEP", false)); cd.ColorDataList.Add(new SAPPRemote.ColorDataList("------------Others------------", "SEP", false)); foreach (PropertyInfo c in typeof(Colors).GetProperties()) { Color cx = ((Color)c.GetValue(null)); cd.ColorDataList.Add(new SAPPRemote.ColorDataList(c.Name, cx.ToString(), true)); } cd.ColorDataList.Add(new SAPPRemote.ColorDataList("------------Others------------", "SEP", false)); File.WriteAllText(SAPPRemote.SAPPRemoteUI.ColorDataPath, JsonConvert.SerializeObject(cd, Formatting.Indented, s)); }
private static void SetColors(string primaryColor, string accentColor, bool?darkMode) { var swatches = new SwatchesProvider().Swatches; var paletteHelper = new PaletteHelper(); if (primaryColor != null) { var primary = swatches.FirstOrDefault(s => s.Name == primaryColor); if (primary != null) { paletteHelper.ReplacePrimaryColor(primary); } } if (accentColor != null) { var accent = swatches.FirstOrDefault(s => s.Name == accentColor); if (accent != null) { paletteHelper.ReplaceAccentColor(accent); } } if (darkMode.HasValue) { paletteHelper.SetLightDark(darkMode.Value); } }
public SettingsPageViewModel() { _paletteHelper = new PaletteHelper(); _swatchesProvider = new SwatchesProvider(); PrimarySwatchesColors = new ObservableCollection <Swatch>(_swatchesProvider.Swatches); foreach (var sw in _swatchesProvider.Swatches) { if (!string.IsNullOrEmpty(sw.Name)) { PrimarySwatchesColors.Add(sw); } } AccentSwatchesColors = new ObservableCollection <Swatch>(); foreach (var sw in _swatchesProvider.Swatches) { if (sw.IsAccented) { if (!string.IsNullOrEmpty(sw.Name)) { AccentSwatchesColors.Add(sw); } } } _currentPrimary = _swatchesProvider.Swatches.First(x => x.Name == Globals.Settings.ThemeColor.Value); _currentAccent = _swatchesProvider.Swatches.First(x => x.Name == Globals.Settings.ThemeAccent.Value && x.IsAccented); SetColorMode(Globals.Settings.ThemeIsDark.Value); SetColorDarkModeCommand = new DelegateCommand(() => SetColorMode(true)); SetColorLightModeCommand = new DelegateCommand(() => SetColorMode(false)); SaveSettingsCommand = new DelegateCommand(() => Globals.SettingsManager.Save(Globals.Settings)); }
public PaletteSelectorViewModel() { Swatches = new SwatchesProvider().Swatches; IsDarkThem = ThemSettingsHandler.LoadSavedInstance().IsDarkThem; _paletteHelper = new PaletteHelper(); }
private void SaveConfig() { _config.Fields.Login_AutoLogin = (bool)chkAutoLogin.IsChecked; _config.Fields.Pandora_AudioFormat = (string)cmbAudioFormat.SelectedValue; _config.Fields.Pandora_StationSortOrder = (string)cmbStationSort.SelectedValue; if (!_config.Fields.Pandora_AutoPlay && (bool)chkAutoPlay.IsChecked && _player.CurrentStation != null) { _config.Fields.Pandora_LastStationID = _player.CurrentStation.ID; } _config.Fields.Pandora_AutoPlay = (bool)chkAutoPlay.IsChecked; _config.Fields.Elpis_CheckUpdates = (bool)chkCheckUpdates.IsChecked; _config.Fields.Elpis_CheckBetaUpdates = (bool)chkCheckBetaUpdates.IsChecked; _config.Fields.Elpis_RemoteControlEnabled = (bool)chkRemoteControlEnabled.IsChecked; _config.Fields.Elpis_MinimizeToTray = (bool)chkTrayMinimize.IsChecked; _config.Fields.Elpis_ShowTrayNotifications = (bool)chkShowNotify.IsChecked; _player.PauseOnLock = _config.Fields.Elpis_PauseOnLock = (bool)chkPauseOnLock.IsChecked; _player.AudioFormat = _config.Fields.Pandora_AudioFormat; //In case MP3-HiFi was rejected _config.Fields.Pandora_AudioFormat = _player.AudioFormat; _player.SetStationSortOrder(_config.Fields.Pandora_StationSortOrder); _config.Fields.Pandora_StationSortOrder = _player.StationSortOrder.ToString(); _config.Fields.Proxy_Address = txtProxyAddress.Text; int port = _config.Fields.Proxy_Port; Int32.TryParse(txtProxyPort.Text, out port); _config.Fields.Proxy_Port = port; _config.Fields.Proxy_User = txtProxyUser.Text; _config.Fields.Proxy_Password = txtProxyPassword.Password; _config.Fields.LastFM_Scrobble = (bool)chkEnableScrobbler.IsChecked; Dictionary <int, HotkeyConfig> keys = new Dictionary <int, HotkeyConfig>(); foreach (KeyValuePair <int, HotKey> pair in _keyHost.HotKeys) { keys.Add(pair.Key, new HotkeyConfig(pair.Value)); } _config.Fields.Elpis_HotKeys = keys; if (!_config.Fields.System_OutputDevice.Equals((string)cmbOutputDevice.SelectedValue)) { _config.Fields.System_OutputDevice = (string)cmbOutputDevice.SelectedValue; _player.OutputDevice = (string)cmbOutputDevice.SelectedValue; } if (!_config.Fields.Current_Color.Equals(this.primaryPaletteComboBox.SelectedValue.ToString())) { _config.Fields.Current_Color = this.primaryPaletteComboBox.SelectedValue.ToString(); SwatchesProvider swatchesProvider = new SwatchesProvider(); Swatch color = swatchesProvider.Swatches.First(a => a.Name == this.primaryPaletteComboBox.SelectedValue.ToString()); new PaletteHelper().ReplacePrimaryColor(color); } _config.SaveConfig(); }
private void setPalette() { Swatch Primary = new SwatchesProvider().Swatches.Single(o => o.Name == PrimaryHue); helper.ReplacePrimaryColor(Primary); User.PrimaryHue = PrimaryHue; }
public MainWindow() { InitializeComponent(); //Setting temp dir Directory.CreateDirectory(TempDirectory); //Color Settings for this app var appSwatch = new SwatchesProvider().Swatches.First( swatch => string.Compare(swatch.Name, "blue", StringComparison.InvariantCultureIgnoreCase) == 0); new PaletteHelper().ReplacePrimaryColor(appSwatch); Task.Factory.StartNew(() => { Thread.Sleep(2500); }).ContinueWith(t => { //note you can use the message queue from any thread, but just for the demo here we //need to get the message queue from the snackbar, so need to be on the dispatcher MainSnackbar.MessageQueue.Enqueue("Welcome to Solr Administration Toolkit MO'FACKA!"); }, TaskScheduler.FromCurrentSynchronizationContext()); DataContext = new MainWindowViewModel(MainSnackbar.MessageQueue); Snackbar = this.MainSnackbar; }
// Work-around: Manually load resources due to WPF being hosted out-of-process and lack of App.xaml. private void LoadResources() { if (Application.Current == null) { // Application will be null, so create one var application = new Application { Resources = new ResourceDictionary() }; // mahapps // controls application.Resources.MergedDictionaries.Add((ResourceDictionary)Application.LoadComponent(new Uri("/MahApps.Metro;component/Styles/Controls.xaml", UriKind.Relative))); // fonts and colors application.Resources.MergedDictionaries.Add((ResourceDictionary)Application.LoadComponent(new Uri("/MahApps.Metro;component/Styles/Fonts.xaml", UriKind.Relative))); application.Resources.MergedDictionaries.Add((ResourceDictionary)Application.LoadComponent(new Uri("/MahApps.Metro;component/Styles/Colors.xaml", UriKind.Relative))); // themes application.Resources.MergedDictionaries.Add((ResourceDictionary)Application.LoadComponent(new Uri("/MahApps.Metro;component/Styles/Accents/Blue.xaml", UriKind.Relative))); application.Resources.MergedDictionaries.Add((ResourceDictionary)Application.LoadComponent(new Uri("/MahApps.Metro;component/Styles/Accents/BaseLight.xaml", UriKind.Relative))); // material design // Work-around: This forces the Material Design .dlls to be compiled and copied. // Otherwise, they won't and loading the assemblies below will throw FileNotFound. // https://github.com/ButchersBoy/MaterialDesignInXamlToolkit/issues/427 ShadowAssist.SetShadowDepth(this, ShadowDepth.Depth0); var provider = new SwatchesProvider(); FlyoutAssist.GetHeaderShadowDepth(this); application.Resources.MergedDictionaries.Add((ResourceDictionary)Application.LoadComponent(new Uri("/MaterialDesignThemes.Wpf;component/Themes/MaterialDesignTheme.Dark.xaml", UriKind.Relative))); application.Resources.MergedDictionaries.Add((ResourceDictionary)Application.LoadComponent(new Uri("/MaterialDesignThemes.Wpf;component/Themes/MaterialDesignTheme.Defaults.xaml", UriKind.Relative))); application.Resources.MergedDictionaries.Add((ResourceDictionary)Application.LoadComponent(new Uri("/MaterialDesignColors;component/Themes/Recommended/Primary/MaterialDesignColor.Blue.xaml", UriKind.Relative))); application.Resources.MergedDictionaries.Add((ResourceDictionary)Application.LoadComponent(new Uri("/MaterialDesignColors;component/Themes/Recommended/Accent/MaterialDesignColor.Orange.xaml", UriKind.Relative))); application.Resources.MergedDictionaries.Add((ResourceDictionary)Application.LoadComponent(new Uri("/MaterialDesignThemes.MahApps;component/Themes/MaterialDesignTheme.MahApps.Fonts.xaml", UriKind.Relative))); } }
private void ChangeColorScheme(ColorScheme scheme) { PaletteHelper paletteHelper = new PaletteHelper(); ITheme theme = paletteHelper.GetTheme(); theme.SetBaseTheme(scheme.Theme == Config.Theme.Dark ? MaterialDesignThemes.Wpf.Theme.Dark : MaterialDesignThemes.Wpf.Theme.Light); var swatches = new SwatchesProvider().Swatches; if (swatches.Where(x => x.ExemplarHue != null).Select(x => x.Name).Contains(scheme.PrimaryHue)) { theme.SetPrimaryColor(swatches.First(x => x.Name == scheme.PrimaryHue).ExemplarHue.Color); } if (swatches.Where(x => x.AccentExemplarHue != null).Select(x => x.Name).Contains(scheme.AccentHue)) { theme.SetSecondaryColor(swatches.First(x => x.Name == scheme.AccentHue).AccentExemplarHue.Color); } paletteHelper.SetTheme(theme); ResourceDictionary oldThemeResourceDictionary = Application.Current.Resources.MergedDictionaries .Where(resourceDictionary => resourceDictionary != null && resourceDictionary.Source != null) .SingleOrDefault(resourceDictionary => Regex.IsMatch(resourceDictionary.Source.OriginalString, @"(\/MaterialDesignExtensions;component\/Themes\/MaterialDesign)((Light)|(Dark))Theme\.")); string newThemeSource = $"pack://application:,,,/MaterialDesignExtensions;component/Themes/MaterialDesign{(scheme.Theme == Config.Theme.Dark ? "Dark" : "Light")}Theme.xaml"; ResourceDictionary newThemeResourceDictionary = new ResourceDictionary() { Source = new Uri(newThemeSource) }; Application.Current.Resources.MergedDictionaries.Remove(oldThemeResourceDictionary); Application.Current.Resources.MergedDictionaries.Add(newThemeResourceDictionary); }
private async void Application_Startup(object sender, StartupEventArgs e) { await _host.StartAsync(); // if the app lost this data for some reason // or the app runs for the first time // it will load the default theme in App.xaml file if (!string.IsNullOrEmpty(WPF.Properties.Settings.Default.PrimaryColor) && !string.IsNullOrEmpty(WPF.Properties.Settings.Default.AccentColor)) { try { IEnumerable <Swatch> Swatches = new SwatchesProvider().Swatches; PaletteSelectorViewModel.ApplyPrimary(Swatches.FirstOrDefault(x => x.Name == WPF.Properties.Settings.Default.PrimaryColor)); PaletteSelectorViewModel.ApplyAccent(Swatches.FirstOrDefault(x => x.Name == WPF.Properties.Settings.Default.AccentColor)); PaletteSelectorViewModel.ApplyBase(WPF.Properties.Settings.Default.IsDarkTheme); } catch (Exception ex) { Console.WriteLine(ex); } } _host.Services .GetRequiredService <IWindowManager>() .ShowWindow <LoginViewModel>(); }
private void MainWindow_Loaded(object sender, RoutedEventArgs e) { try { var machineInfo = MachineLogic.localMachine(); var netmachineInfo = UserLogic.AutoLogin(machineInfo.token); if (netmachineInfo == null) { NavigationHelper.NavigatedToView("用户登录"); } if (netmachineInfo.machineId != machineInfo.machineId) { NavigationHelper.NavigatedToView("用户登录"); } machineInfo.machineName = netmachineInfo.machineName; machineInfo.machinepwd = netmachineInfo.machinePwd; MachineLogic.RecordMachineInfo(machineInfo); NavigationHelper.NavigatedToView("主界面"); } catch (Exception) { NavigationHelper.NavigatedToView("用户登录"); } var Swatches = new SwatchesProvider().Swatches; var swatch = Swatches.FirstOrDefault(o => o.Name == "blue"); ModifyTheme(theme => { theme.SetBaseTheme(Theme.Light); }); ModifyTheme(theme => theme.SetPrimaryColor(swatch.ExemplarHue.Color)); ModifyTheme(theme => theme.SetSecondaryColor(swatch.AccentExemplarHue.Color)); }
public VMMain() { Model = new MMain(); AppWindowVisibility = Visibility.Hidden; MainWindowWidth = SDSystem.WindowWidth; HotkeyManager.GetInstance().RegisterHotKey("ShowWindow", LKey.None, RKey.F2, ShowWindow); Swatches = new SwatchesProvider().Swatches; Window win = Application.Current.MainWindow; PresentationSource source = PresentationSource.FromVisual(win); Matrix matrix = source.CompositionTarget.TransformFromDevice; double widthRatio = matrix.M11; double heightRatio = matrix.M22; double screenWidth = SystemParameters.PrimaryScreenWidth * widthRatio; double screenHeight = SystemParameters.PrimaryScreenHeight * heightRatio; MainWindowHeight = SystemParameters.WorkArea.Size.Height * heightRatio; MainWindowLeft = screenWidth - MainWindowWidth; MessageBoxMessage = "Are you sure delete this desktop page?"; DesktopWindowManager.GetInstance().ThemeDark = DesktopWindowManager.GetInstance().ThemeDark; DesktopWindowManager.GetInstance().ThemeColor = DesktopWindowManager.GetInstance().ThemeColor; IsThemeDark = DesktopWindowManager.GetInstance().ThemeDark; }
private void setSecondaryPalette() { Swatch Accent = new SwatchesProvider().Swatches.Single(o => o.Name == AccentColor); helper.ReplaceAccentColor(Accent); User.AccentColor = AccentColor; }
protected override void OnActivated(EventArgs e) { base.OnActivated(e); Globals.IsAppRunning = true; Globals.Settings = Globals.SettingsManager.Load(); var paletteHelper = new PaletteHelper(); var swatchesProvider = new SwatchesProvider(); Task.Run(() => { var primary = swatchesProvider.Swatches.First(x => x.Name == Globals.Settings.ThemeColor.Value); var accent = swatchesProvider.Swatches.First(x => x.Name == Globals.Settings.ThemeAccent.Value && x.IsAccented); Classes.Utils.InvokeDispatcherIfRequired(() => { if (primary != null) { paletteHelper.ReplacePrimaryColor(primary); } if (accent != null) { paletteHelper.ReplaceAccentColor(accent); } paletteHelper.SetLightDark(Globals.Settings.ThemeIsDark.Value); }); }); }
public void SetPalette() { Swatch primary = null; Swatch accent = null; IEnumerable <Swatch> swatches = new SwatchesProvider().Swatches; foreach (var item in swatches) { if (item.Name == AppPalettePrimaryName) { primary = item; } if (item.Name == AppPaletteAccentName) { accent = item; } } if (primary != null) { new PaletteHelper().ReplacePrimaryColor(primary); } if (accent != null) { new PaletteHelper().ReplaceAccentColor(accent); } }
public void SetTheme(string cname) { var paletteHelper = new MaterialDesignThemes.Wpf.PaletteHelper(); SwatchesProvider swatchesProvider = new SwatchesProvider(); Swatch color = swatchesProvider.Swatches.FirstOrDefault(a => a.Name == cname); paletteHelper.ReplacePrimaryColor(color); }
public void Initialize() { ModuleLoader = new ModuleLoader(); ModuleLoader.LoadModules(); ResourceProvider = new ResourceProvider(new Properties.Resources()); PageCollection = ModulePageCollection.Create(ModuleLoader.Modules); AdjustSizeAndLocation(); SystemEvents.DisplaySettingsChanged += (s, e) => { AdjustSizeAndLocation(); }; #region View PaletteHelper = new PaletteHelper(); SwatchesProvider = new SwatchesProvider(); PaletteHelper.SetLightDark(Properties.Settings.Default.DarkView); #endregion #region Modules List <ModuleInformation> modules = new List <ModuleInformation>(); foreach (IModule module in ModuleLoader.Modules) { modules.Add(new ModuleInformation(module)); } Modules = CollectionViewSource.GetDefaultView(modules); #endregion #region Languages List <CultureInfo> languages = new List <CultureInfo> { new CultureInfo("en"), new CultureInfo("tr") }; Languages = CollectionViewSource.GetDefaultView(languages); Languages.CurrentChanged += (s, e) => { CultureInfo culture = Languages.CurrentItem as CultureInfo; Properties.Settings.Default.Language = culture.Name; Modules.Refresh(); Mediator.Send(new CultureChangeMessage(culture)); }; Languages.MoveCurrentTo(languages.Find(x => x.Name == Properties.Settings.Default.Language)); #endregion }
public void IncludesGrey() { var swatchesProvider = new SwatchesProvider(); var containsBlack = swatchesProvider.Swatches.Any( swatch => string.Compare(swatch.Name, "Grey", StringComparison.InvariantCultureIgnoreCase) == 0); containsBlack.ShouldBe(true); }
public PaletteSelectorViewModel() { Swatches = new SwatchesProvider().Swatches; PaletteHelper paletteHelper = new PaletteHelper(); ITheme theme = paletteHelper.GetTheme(); IsDarkTheme = theme.GetBaseTheme() == BaseTheme.Dark; }
private void ChangePalete(string color) { helper = new PaletteHelper(); var swatches = new SwatchesProvider().Swatches; helper.ReplacePrimaryColor(swatches.FirstOrDefault(s => s.Name == color.ToLower())); Settings.Default.PaletteColor = color; Settings.Default.Save(); }
private void LoadConfig() { chkAutoLogin.IsChecked = _config.Fields.Login_AutoLogin; cmbAudioFormat.SelectedValue = _config.Fields.Pandora_AudioFormat; cmbStationSort.SelectedValue = _config.Fields.Pandora_StationSortOrder; chkAutoPlay.IsChecked = _config.Fields.Pandora_AutoPlay; chkCheckUpdates.IsChecked = _config.Fields.Elpis_CheckUpdates; chkTrayMinimize.IsChecked = _config.Fields.Elpis_MinimizeToTray; chkShowNotify.IsChecked = _config.Fields.Elpis_ShowTrayNotifications; chkPauseOnLock.IsChecked = _config.Fields.Elpis_PauseOnLock; chkCheckBetaUpdates.IsChecked = _config.Fields.Elpis_CheckBetaUpdates; chkRemoteControlEnabled.IsChecked = _config.Fields.Elpis_RemoteControlEnabled; _config.Fields.Pandora_AudioFormat = _player.AudioFormat; _config.Fields.Pandora_StationSortOrder = _config.Fields.Pandora_StationSortOrder; txtProxyAddress.Text = _config.Fields.Proxy_Address; txtProxyPort.Text = _config.Fields.Proxy_Port.ToString(); txtProxyUser.Text = _config.Fields.Proxy_User; txtProxyPassword.Password = _config.Fields.Proxy_Password; chkEnableScrobbler.IsChecked = _config.Fields.LastFM_Scrobble; txtIPAddress.ItemsSource = getLocalIPAddresses(); // Build list of all output devices cmbOutputDevice.Items.Clear(); foreach (string device in _player.GetOutputDevices()) { cmbOutputDevice.Items.Add(device); } // Get current output device cmbOutputDevice.SelectedValue = _player.OutputDevice; SwatchesProvider swatchesProvider = new SwatchesProvider(); List <string> PrimaryColorsList = swatchesProvider.Swatches.Select(a => a.Name).ToList(); primaryPaletteComboBox.Items.Clear(); foreach (string str in PrimaryColorsList) { primaryPaletteComboBox.Items.Add(str); } primaryPaletteComboBox.SelectedValue = _config.Fields.Current_Color; Swatch color = swatchesProvider.Swatches.First(a => a.Name == _config.Fields.Current_Color); new PaletteHelper().ReplacePrimaryColor(color); _config.SaveConfig(); UpdateLastFMControlState(); }
public SettingViewModel( IRegionManager rm, SettingHolder sm) : base(rm) { _sm = sm; Swatches = new SwatchesProvider().Swatches; ApplyPrimaryCommand = new DelegateCommand <Swatch>(ApplyPrimary); ApplyAccentCommand = new DelegateCommand <Swatch>(ApplyAccent); }
public TFactoryPaletteSelectorModel() { Swatches = new SwatchesProvider().Swatches; ProcessItemsSource = new ObservableCollection <TProcessInfo> (); ToggleBaseCommand = new TObservableCommand(new DelegateCommand <bool> (ApplyBaseCommandHandler)); ApplyPrimaryCommand = new TObservableCommand(new DelegateCommand <Swatch> (ApplyPrimaryCommandHandler)); ApplyAccentCommand = new TObservableCommand(new DelegateCommand <Swatch> (ApplyAccentCommandHandler)); }
static SearchCriterionViewModel() { var swatches = new SwatchesProvider().Swatches.ToList(); AvailableColors = swatches.Select(sw => { var hues = sw.PrimaryHues.ToArray(); return(new[] { hues[1], hues[2], hues[3], hues[5] }); }).SelectMany(h => h).ToArray(); }
public void BrownHasPrimaries() { var swatchesProvider = new SwatchesProvider(); var brownSwatch = swatchesProvider.Swatches.Single( swatch => swatch.Name == "brown"); brownSwatch.IsAccented.ShouldBe(false); brownSwatch.PrimaryHues.ShouldNotBe(null); brownSwatch.PrimaryHues.Count().ShouldBe(10); }
public void IndigoHasAccents() { var swatchesProvider = new SwatchesProvider(); var brownSwatch = swatchesProvider.Swatches.Single( swatch => swatch.Name == "indigo"); brownSwatch.IsAccented.ShouldBe(true); brownSwatch.AccentHues.ShouldNotBe(null); brownSwatch.AccentHues.Count().ShouldBe(4); }
public virtual void ReplacePrimaryColor(string name) { if (name == null) throw new ArgumentNullException("name"); var swatch = new SwatchesProvider().Swatches.FirstOrDefault( s => string.Compare(s.Name, name, StringComparison.InvariantCultureIgnoreCase) == 0); if (swatch == null) throw new ArgumentException("No such swatch '" + name + "'", "name"); ReplacePrimaryColor(swatch); }
public SearchOptionsViewModel(ISearchMetadataCollection metadataCollection, ISchedulerProvider schedulerProvider, SearchHints searchHints) { SearchHints = searchHints; //TODO: options for colour var swatches = new SwatchesProvider().Swatches; ReadOnlyObservableCollection<SearchOptionsProxy> data; var userOptions = metadataCollection.Metadata.Connect() .WhereReasonsAre(ChangeReason.Add, ChangeReason.Remove) //ignore updates because we update from here .Transform(meta => new SearchOptionsProxy(meta, swatches,m => metadataCollection.Remove(m.SearchText))) .SubscribeMany(so => { //when a value changes, write the original value back to the cache return so.WhenAnyPropertyChanged() .Subscribe(_ => metadataCollection.Add(new SearchMetadata(so.Text, so.Filter, so.Highlight,so.UseRegex,so.IgnoreCase))); }) .Sort(SortExpressionComparer<SearchOptionsProxy>.Ascending(proxy=>proxy.Text)) .ObserveOn(schedulerProvider.MainThread) .Bind(out data) .Subscribe(); Data = data; //command to add the current search to the tail collection var searchInvoker = SearchHints.SearchRequested.Subscribe(request => { metadataCollection.Add(new SearchMetadata(request.Text, false, true, request.UseRegEx, true)); }); _cleanUp = new CompositeDisposable(searchInvoker, userOptions, searchInvoker); }
public PaletteSelectorViewModel() { Swatches = new SwatchesProvider().Swatches; }
public virtual void ReplaceAccentColor(string name) { if (name == null) throw new ArgumentNullException(nameof(name)); var swatch = new SwatchesProvider().Swatches.FirstOrDefault( s => string.Compare(s.Name, name, StringComparison.InvariantCultureIgnoreCase) == 0 && s.IsAccented); if (swatch == null) throw new ArgumentException($"No such accented swatch '{name}'", nameof(name)); ReplaceAccentColor(swatch); }