public static void Configure(Func <IThemeSettings> factory) { if (factory == null) { throw new InvalidOperationException("Must provide a valid factory method"); } themes = factory(); }
private void LoadTheme() { eventAggregator.GetEvent <SplashMessageUpdateEvent>() .Publish(new SplashMessageUpdateEvent { Message = "Themes.." }); IThemeManager manager = containerProvider.Resolve <IThemeManager>(); IThemeSettings themeSettings = containerProvider.Resolve <IThemeSettings>(); manager.SetCurrent(themeSettings.SelectedTheme); }
public void LoadDefaultTheme() { IThemeSettings settings = _container.Resolve <IThemeSettings>(); IThemeManager manager = _container.Resolve <IThemeManager>(); if (settings.SelectedTheme == "Default") { String newTheme = settings.GetSystemTheme(); if (newTheme == "Default") { manager.SetCurrent("Blue"); } else { manager.SetCurrent(newTheme); } } else { manager.SetCurrent(settings.SelectedTheme); } }
private void LoadMenus() { eventAggregator.GetEvent <SplashMessageUpdateEvent>() .Publish(new SplashMessageUpdateEvent { Message = "Menus.." }); ICommandManager manager = containerProvider.Resolve <ICommandManager>(); IMenuService menuService = containerProvider.Resolve <IMenuService>(); ISettingsManager settingsManager = containerProvider.Resolve <ISettingsManager>(); IThemeSettings themeSettings = containerProvider.Resolve <IThemeSettings>(); IRecentViewSettings recentFiles = containerProvider.Resolve <IRecentViewSettings>(); IWorkspace workspace = containerProvider.Resolve <IWorkspace>(); ToolViewModel logger = workspace.Tools.FirstOrDefault(f => f.ContentId == "Logger"); menuService.Add(new MenuItemViewModel("_File", 1)); menuService.Get("_File") .Add((new MenuItemViewModel("_New", 3, new BitmapImage(new Uri(@"pack://*****:*****@"pack://application:,,,/WiderMD.Core;component/Icons/OpenFileDialog_692.png")), manager.GetCommand("OPEN"), new KeyGesture(Key.O, ModifierKeys.Control, "Ctrl + O")))); menuService.Get("_File") .Add(new MenuItemViewModel("_Save", 5, new BitmapImage(new Uri(@"pack://*****:*****@"pack://application:,,,/WiderMD.Core;component/Icons/Save_6530.png")), manager.GetCommand("SAVEAS"))); menuService.Get("_File") .Add(new MenuItemViewModel("Close", 8, null, manager.GetCommand("CLOSE"), new KeyGesture(Key.F4, ModifierKeys.Control, "Ctrl + F4"))); menuService.Get("_File").Add(recentFiles.RecentMenu); menuService.Get("_File") .Add(new MenuItemViewModel("E_xit", 101, null, manager.GetCommand("EXIT"), new KeyGesture(Key.F4, ModifierKeys.Alt, "Alt + F4"))); menuService.Add(new MenuItemViewModel("_Edit", 2)); menuService.Get("_Edit") .Add(new MenuItemViewModel("_Undo", 1, new BitmapImage(new Uri(@"pack://*****:*****@"pack://application:,,,/WiderMD.Core;component/Icons/Redo_16x.png")), ApplicationCommands.Redo)); menuService.Get("_Edit").Add(MenuItemViewModel.Separator(15)); menuService.Get("_Edit") .Add(new MenuItemViewModel("Cut", 20, new BitmapImage(new Uri(@"pack://*****:*****@"pack://application:,,,/WiderMD.Core;component/Icons/Copy_6524.png")), ApplicationCommands.Copy)); menuService.Get("_Edit") .Add(new MenuItemViewModel("_Paste", 22, new BitmapImage(new Uri(@"pack://*****:*****@"pack://application:,,,/WiderMD.Core;component/Icons/Undo_16x.png")), manager.GetCommand("LOGSHOW")) { IsCheckable = true, IsChecked = logger.IsVisible }); } menuService.Get("_View").Add(new MenuItemViewModel("Themes", 1)); // Get the listed themses and add to menu IThemeManager themeManager = containerProvider.Resolve <IThemeManager>(); MenuItemViewModel themeMenu = menuService.Get("_View").Get("Themes") as MenuItemViewModel; // add items based on theme programmed foreach (ITheme theme in themeManager.Themes) { themeMenu .Add(new MenuItemViewModel(theme.Name, 1, null, manager.GetCommand("THEMECHANGE")) { IsCheckable = true, IsChecked = (themeSettings.SelectedTheme == theme.Name), CommandParameter = theme.Name }); } menuService.Add(new MenuItemViewModel("_Tools", 4)); menuService.Get("_Tools").Add(new MenuItemViewModel("Settings", 1, null, settingsManager.SettingsCommand)); menuService.Add(new MenuItemViewModel("_Help", 4)); }