public SettingViewModel( IRegionManager rm, SettingHolder sm) : base(rm) { _sm = sm; Swatches = new SwatchesProvider().Swatches; ApplyPrimaryCommand = new DelegateCommand <Swatch>(ApplyPrimary); ApplyAccentCommand = new DelegateCommand <Swatch>(ApplyAccent); }
/// <summary> /// Initializes the primary structure and sub-components. /// </summary> public void Initialize() { Time = new TimeHolder(); Graphics = new GraphicsHolder(); Settings = new SettingHolder(); Input = new InputHolder(); Input.Initialize(this); Time.Initialize(); Graphics.Initialize(this); }
public MainWindowViewModel( IEventAggregator ea, IRegionManager rm, CurrentService currentService, ArchiveService archiveService, SettingHolder settingHolder, CurrentHolder currentHolder, ArchiveHolder archiveHolder) : base(rm) { _rm = rm; _currentService = currentService; _archiveService = archiveService; _settingHolder = settingHolder; _archiveHolder = archiveHolder; _currentHolder = currentHolder; _keyboardHook = new KeyboardHook(); _rm.RegisterViewWithRegion(RegionNames.ContentRegion, typeof(Initialize)); _rm.RegisterViewWithRegion(RegionNames.ArchiveRegion, typeof(ArchiveList)); Current = _currentHolder.Current; IsNightMode = _settingHolder.Setting.IsNightMode; _currentHolder.PropertyChanged += (s, e) => Current = _currentHolder.Current; _keyboardHook.KeyboardHooked += new KeyboardHookedEventHandler(OnKeyboardHooked); NavigateOnDrawerCommand = new DelegateCommand <string>(NavigateOnDrawer); ApplyNightModeCommand = new DelegateCommand(ApplyNightMode); ResetCommand = new DelegateCommand(async() => await ResetAsync(), () => !IsLoading).ObservesProperty(() => IsLoading); // 保存テーマの適用 ThemeManager.ModifyTheme(theme => theme.SetPrimaryColor(_settingHolder.Setting.ColorPrimary.ExemplarHue.Color)); ThemeManager.ModifyTheme(theme => theme.SetSecondaryColor(_settingHolder.Setting.ColorAccent.ExemplarHue.Color)); ThemeManager.ModifyTheme(theme => theme.SetBaseTheme(_settingHolder.Setting.IsNightMode ? Theme.Dark : Theme.Light)); ea.GetEvent <UnhandledExceptionEvent>().Subscribe(UnhandledExceptionAction, ThreadOption.UIThread); }