public ItemFilterPersistenceService(IFileSystemService fileSystemService, IItemFilterScriptTranslator itemFilterScriptTranslator) { _fileSystemService = fileSystemService; _itemFilterScriptTranslator = itemFilterScriptTranslator; ItemFilterScriptDirectory = Settings.Default.DefaultFilterDirectory; }
public MainWindowViewModel(IItemFilterScriptTranslator itemFilterScriptTranslator, IItemFilterProcessor itemFilterProcessor) { _itemFilterScriptTranslator = itemFilterScriptTranslator; _itemFilterProcessor = itemFilterProcessor; LoadScriptCommand = new RelayCommand(OnLoadScriptCommand); LoadAlternateScriptCommand = new RelayCommand(OnLoadAlternateScriptCommand); ProcessItemFilterCommand = new RelayCommand(OnProcessItemFilterCommand); }
public ItemFilterPersistenceService(IFileSystemService fileSystemService, IItemFilterScriptTranslator itemFilterScriptTranslator) { _fileSystemService = fileSystemService; _itemFilterScriptTranslator = itemFilterScriptTranslator; if (string.IsNullOrEmpty(Settings.Default.DefaultFilterDirectory)) { ItemFilterScriptDirectory = DefaultPathOfExileDirectory(); Settings.Default.DefaultFilterDirectory = ItemFilterScriptDirectory; } else { ItemFilterScriptDirectory = Settings.Default.DefaultFilterDirectory; } }
public MainWindowViewModel(IItemFilterScriptDirectoryService itemFilterScriptDirectoryService, IItemFilterScriptRepository itemFilterScriptRepository, IItemFilterScriptTranslator itemFilterScriptTranslator, IReplaceColorsViewModel replaceColorsViewModel, IAvalonDockWorkspaceViewModel avalonDockWorkspaceViewModel, IScriptLoadingService scriptLoadingService, ISettingsPageViewModel settingsPageViewModel, IThemeProvider themeProvider, IThemeService themeService, IMessageBoxService messageBoxService, IClipboardService clipboardService, IUpdateViewModel updateViewModel) { _itemFilterScriptDirectoryService = itemFilterScriptDirectoryService; _itemFilterScriptRepository = itemFilterScriptRepository; _itemFilterScriptTranslator = itemFilterScriptTranslator; _replaceColorsViewModel = replaceColorsViewModel; _avalonDockWorkspaceViewModel = avalonDockWorkspaceViewModel; _scriptLoadingService = scriptLoadingService; SettingsPageViewModel = settingsPageViewModel; _themeProvider = themeProvider; _themeService = themeService; _messageBoxService = messageBoxService; _clipboardService = clipboardService; UpdateViewModel = updateViewModel; _windowState = Settings.Default.WindowState; _windowWidth = Settings.Default.WindowWidth; _windowHeight = Settings.Default.WindowHeight; NewScriptCommand = new RelayCommand(OnNewScriptCommand); CopyScriptCommand = new RelayCommand(OnCopyScriptCommand, () => ActiveDocumentIsScript); OpenScriptCommand = new RelayCommand(async() => await OnOpenScriptCommand()); OpenThemeCommand = new RelayCommand(async() => await OnOpenThemeCommandAsync()); SaveCommand = new RelayCommand(async() => await OnSaveDocumentCommandAsync(), ActiveDocumentIsEditable); SaveAsCommand = new RelayCommand(async() => await OnSaveAsCommandAsync(), ActiveDocumentIsEditable); CloseCommand = new RelayCommand(OnCloseDocumentCommand, ActiveDocumentIsEditable); CopyBlockCommand = new RelayCommand(OnCopyBlockCommand, () => ActiveDocumentIsScript && ActiveScriptHasSelectedBlock); CopyBlockStyleCommand = new RelayCommand(OnCopyBlockStyleCommand, () => ActiveDocumentIsScript && ActiveScriptHasSelectedBlock); PasteCommand = new RelayCommand(OnPasteCommand, () => ActiveDocumentIsScript && ActiveScriptHasSelectedBlock); PasteBlockStyleCommand = new RelayCommand(OnPasteBlockStyleCommand, () => ActiveDocumentIsScript && ActiveScriptHasSelectedBlock); // TODO: Only enabled if undo/redo available UndoCommand = new RelayCommand(OnUndoCommand, () => ActiveDocumentIsScript); RedoCommand = new RelayCommand(OnRedoCommand, () => ActiveDocumentIsScript); MoveBlockUpCommand = new RelayCommand(OnMoveBlockUpCommand, () => ActiveDocumentIsScript && ActiveScriptHasSingleSelectedeBlock); MoveBlockDownCommand = new RelayCommand(OnMoveBlockDownCommand, () => ActiveDocumentIsScript && ActiveScriptHasSingleSelectedeBlock); MoveBlockToTopCommand = new RelayCommand(OnMoveBlockToTopCommand, () => ActiveDocumentIsScript && ActiveScriptHasSelectedBlock && ActiveScriptCanModifySelectedBlocks); MoveBlockToBottomCommand = new RelayCommand(OnMoveBlockToBottomCommand, () => ActiveDocumentIsScript && ActiveScriptHasSelectedBlock && ActiveScriptCanModifySelectedBlocks); AddBlockCommand = new RelayCommand(OnAddBlockCommand, () => ActiveDocumentIsScript); AddSectionCommand = new RelayCommand(OnAddSectionCommand, () => ActiveDocumentIsScript); DeleteBlockCommand = new RelayCommand(OnDeleteBlockCommand, () => ActiveDocumentIsScript && ActiveScriptCanModifySelectedBlocks); DisableBlockCommand = new RelayCommand(OnDisableBlockCommand, () => ActiveDocumentIsScript && ActiveScriptHasSelectedEnabledBlock && ActiveScriptCanModifySelectedBlocks); EnableBlockCommand = new RelayCommand(OnEnableBlockCommand, () => ActiveDocumentIsScript && ActiveScriptHasSelectedDisabledBlock && ActiveScriptCanModifySelectedBlocks); DisableSectionCommand = new RelayCommand(OnDisableSectionCommand, () => ActiveDocumentIsScript && ActiveScriptHasSelectedCommentBlock && ActiveScriptCanModifySelectedBlocks); EnableSectionCommand = new RelayCommand(OnEnableSectionCommand, () => ActiveDocumentIsScript && ActiveScriptHasSelectedCommentBlock && ActiveScriptCanModifySelectedBlocks); ExpandSectionCommand = new RelayCommand(OnExpandSectionCommand, () => ActiveDocumentIsScript && ActiveScriptHasSelectedCommentBlock); CollapseSectionCommand = new RelayCommand(OnCollapseSectionCommand, () => ActiveDocumentIsScript && ActiveScriptHasSelectedCommentBlock); OpenAboutWindowCommand = new RelayCommand(OnOpenAboutWindowCommand); ReplaceColorsCommand = new RelayCommand(OnReplaceColorsCommand, () => ActiveDocumentIsScript); CreateThemeCommand = new RelayCommand(OnCreateThemeCommand, () => ActiveDocumentIsScript); ApplyThemeToScriptCommand = new RelayCommand(async() => await OnApplyThemeToScriptCommandAsync(), () => ActiveDocumentIsScript); EditMasterThemeCommand = new RelayCommand(OnEditMasterThemeCommand, () => ActiveDocumentIsScript); EnableDropSoundsCommand = new RelayCommand(OnEnableDropSoundsCommand, () => ActiveDocumentIsScript && ActiveScriptHasSelectedBlock && ActiveScriptCanModifySelectedBlocks); DisableDropSoundsCommand = new RelayCommand(OnDisableDropSoundsCommand, () => ActiveDocumentIsScript && ActiveScriptHasSelectedBlock && ActiveScriptCanModifySelectedBlocks); AddTextColorThemeComponentCommand = new RelayCommand(OnAddTextColorThemeComponentCommand, () => ActiveDocumentIsTheme && ActiveThemeIsEditable); AddBackgroundColorThemeComponentCommand = new RelayCommand(OnAddBackgroundColorThemeComponentCommand, () => ActiveDocumentIsTheme && ActiveThemeIsEditable); AddBorderColorThemeComponentCommand = new RelayCommand(OnAddBorderColorThemeComponentCommand, () => ActiveDocumentIsTheme && ActiveThemeIsEditable); AddFontSizeThemeComponentCommand = new RelayCommand(OnAddFontSizeThemeComponentCommand, () => ActiveDocumentIsTheme && ActiveThemeIsEditable); AddAlertSoundThemeComponentCommand = new RelayCommand(OnAddAlertSoundThemeComponentCommand, () => ActiveDocumentIsTheme && ActiveThemeIsEditable); AddCustomSoundThemeComponentCommand = new RelayCommand(OnAddCustomSoundThemeComponentCommand, () => ActiveDocumentIsTheme && ActiveThemeIsEditable); AddIconThemeComponentCommand = new RelayCommand(OnAddIconThemeComponentCommand, () => ActiveDocumentIsTheme && ActiveThemeIsEditable); AddEffectColorThemeComponentCommand = new RelayCommand(OnAddEffectColorThemeComponentCommand, () => ActiveDocumentIsTheme && ActiveThemeIsEditable); DeleteThemeComponentCommand = new RelayCommand(OnDeleteThemeComponentCommand, () => ActiveDocumentIsTheme && ActiveThemeIsEditable && _avalonDockWorkspaceViewModel.ActiveThemeViewModel.SelectedThemeComponent != null); ExpandAllBlocksCommand = new RelayCommand(OnExpandAllBlocksCommand, () => ActiveDocumentIsScript); CollapseAllBlocksCommand = new RelayCommand(OnCollapseAllBlocksCommand, () => ActiveDocumentIsScript); ExpandAllSectionsCommand = new RelayCommand(OnExpandAllSectionsCommand, () => ActiveDocumentIsScript); CollapseAllSectionsCommand = new RelayCommand(OnCollapseAllSectionsCommand, () => ActiveDocumentIsScript); ToggleShowAdvancedCommand = new RelayCommand <bool>(OnToggleShowAdvancedCommand, s => ActiveDocumentIsScript); ClearFiltersCommand = new RelayCommand(OnClearFiltersCommand, () => ActiveDocumentIsScript); ClearStylesCommand = new RelayCommand(OnClearStylesCommand, () => ActiveDocumentIsScript); var icon = new BitmapImage(); icon.BeginInit(); icon.UriSource = new Uri("pack://application:,,,/Filtration;component/Resources/Icons/filtration_icon.png"); icon.EndInit(); Icon = icon; Messenger.Default.Register <ThemeClosedMessage>(this, message => { if (message.ClosedViewModel == null) { return; } AvalonDockWorkspaceViewModel.CloseDocument(message.ClosedViewModel); }); Messenger.Default.Register <NotificationMessage>(this, message => { switch (message.Notification) { case "ActiveDocumentChanged": { CopyScriptCommand.RaiseCanExecuteChanged(); SaveCommand.RaiseCanExecuteChanged(); SaveAsCommand.RaiseCanExecuteChanged(); CloseCommand.RaiseCanExecuteChanged(); CopyBlockCommand.RaiseCanExecuteChanged(); PasteCommand.RaiseCanExecuteChanged(); ReplaceColorsCommand.RaiseCanExecuteChanged(); ApplyThemeToScriptCommand.RaiseCanExecuteChanged(); EditMasterThemeCommand.RaiseCanExecuteChanged(); CreateThemeCommand.RaiseCanExecuteChanged(); RaisePropertyChanged("ActiveDocumentIsScript"); RaisePropertyChanged("ActiveDocumentIsTheme"); RaisePropertyChanged("ShowAdvancedStatus"); break; } case "NewScript": { OnNewScriptCommand(); break; } case "OpenScript": { #pragma warning disable 4014 OnOpenScriptCommand(); #pragma warning restore 4014 break; } case "ShowLoadingBanner": { ShowLoadingBanner = true; break; } case "HideLoadingBanner": { ShowLoadingBanner = false; break; } } }); }
public MainWindowViewModel(IItemFilterScriptRepository itemFilterScriptRepository, IItemFilterScriptTranslator itemFilterScriptTranslator, IReplaceColorsViewModel replaceColorsViewModel, IAvalonDockWorkspaceViewModel avalonDockWorkspaceViewModel, ISettingsPageViewModel settingsPageViewModel, IThemeProvider themeProvider, IThemeService themeService, IUpdateCheckService updateCheckService, IUpdateAvailableViewModel updateAvailableViewModel, IMessageBoxService messageBoxService) { _itemFilterScriptRepository = itemFilterScriptRepository; _itemFilterScriptTranslator = itemFilterScriptTranslator; _replaceColorsViewModel = replaceColorsViewModel; _avalonDockWorkspaceViewModel = avalonDockWorkspaceViewModel; _settingsPageViewModel = settingsPageViewModel; _themeProvider = themeProvider; _themeService = themeService; _updateCheckService = updateCheckService; _updateAvailableViewModel = updateAvailableViewModel; _messageBoxService = messageBoxService; NewScriptCommand = new RelayCommand(OnNewScriptCommand); CopyScriptCommand = new RelayCommand(OnCopyScriptCommand, () => ActiveDocumentIsScript); OpenScriptCommand = new RelayCommand(OnOpenScriptCommand); OpenThemeCommand = new RelayCommand(OnOpenThemeCommand); SaveCommand = new RelayCommand(OnSaveDocumentCommand, ActiveDocumentIsEditable); SaveAsCommand = new RelayCommand(OnSaveAsCommand, ActiveDocumentIsEditable); CloseCommand = new RelayCommand(OnCloseDocumentCommand, ActiveDocumentIsEditable); CopyBlockCommand = new RelayCommand(OnCopyBlockCommand, () => ActiveDocumentIsScript && ActiveScriptHasSelectedBlock); CopyBlockStyleCommand = new RelayCommand(OnCopyBlockStyleCommand, () => ActiveDocumentIsScript && ActiveScriptHasSelectedBlock); PasteCommand = new RelayCommand(OnPasteCommand, () => ActiveDocumentIsScript && ActiveScriptHasSelectedBlock); PasteBlockStyleCommand = new RelayCommand(OnPasteBlockStyleCommand, () => ActiveDocumentIsScript && ActiveScriptHasSelectedBlock); MoveBlockUpCommand = new RelayCommand(OnMoveBlockUpCommand, () => ActiveDocumentIsScript && ActiveScriptHasSelectedBlock); MoveBlockDownCommand = new RelayCommand(OnMoveBlockDownCommand, () => ActiveDocumentIsScript && ActiveScriptHasSelectedBlock); MoveBlockToTopCommand = new RelayCommand(OnMoveBlockToTopCommand, () => ActiveDocumentIsScript && ActiveScriptHasSelectedBlock); MoveBlockToBottomCommand = new RelayCommand(OnMoveBlockToBottomCommand, () => ActiveDocumentIsScript && ActiveScriptHasSelectedBlock); AddBlockCommand = new RelayCommand(OnAddBlockCommand, () => ActiveDocumentIsScript); AddSectionCommand = new RelayCommand(OnAddSectionCommand, () => ActiveDocumentIsScript); DeleteBlockCommand = new RelayCommand(OnDeleteBlockCommand, () => ActiveDocumentIsScript && ActiveScriptHasSelectedBlock); DisableBlockCommand = new RelayCommand(OnDisableBlockCommand, () => ActiveDocumentIsScript && ActiveScriptHasSelectedEnabledBlock); EnableBlockCommand = new RelayCommand(OnEnableBlockCommand, () => ActiveDocumentIsScript && ActiveScriptHasSelectedDisabledBlock); OpenAboutWindowCommand = new RelayCommand(OnOpenAboutWindowCommand); ReplaceColorsCommand = new RelayCommand(OnReplaceColorsCommand, () => ActiveDocumentIsScript); CreateThemeCommand = new RelayCommand(OnCreateThemeCommand, () => ActiveDocumentIsScript); ApplyThemeToScriptCommand = new RelayCommand(OnApplyThemeToScriptCommand, () => ActiveDocumentIsScript); EditMasterThemeCommand = new RelayCommand(OnEditMasterThemeCommand, () => ActiveDocumentIsScript); AddTextColorThemeComponentCommand = new RelayCommand(OnAddTextColorThemeComponentCommand, () => ActiveDocumentIsTheme && ActiveThemeIsEditable); AddBackgroundColorThemeComponentCommand = new RelayCommand(OnAddBackgroundColorThemeComponentCommand, () => ActiveDocumentIsTheme && ActiveThemeIsEditable); AddBorderColorThemeComponentCommand = new RelayCommand(OnAddBorderColorThemeComponentCommand, () => ActiveDocumentIsTheme && ActiveThemeIsEditable); DeleteThemeComponentCommand = new RelayCommand(OnDeleteThemeComponentCommand, () => ActiveDocumentIsTheme && ActiveThemeIsEditable && _avalonDockWorkspaceViewModel.ActiveThemeViewModel.SelectedThemeComponent != null); ExpandAllBlocksCommand = new RelayCommand(OnExpandAllBlocksCommand, () => ActiveDocumentIsScript); CollapseAllBlocksCommand = new RelayCommand(OnCollapseAllBlocksCommand, () => ActiveDocumentIsScript); ToggleShowAdvancedCommand = new RelayCommand <bool>(OnToggleShowAdvancedCommand, s => ActiveDocumentIsScript); ClearFiltersCommand = new RelayCommand(OnClearFiltersCommand, () => ActiveDocumentIsScript); if (string.IsNullOrEmpty(_itemFilterScriptRepository.GetItemFilterScriptDirectory())) { SetItemFilterScriptDirectory(); } var icon = new BitmapImage(); icon.BeginInit(); icon.UriSource = new Uri("pack://application:,,,/Filtration;component/Resources/Icons/filtration_icon.png"); icon.EndInit(); Icon = icon; Messenger.Default.Register <ThemeClosedMessage>(this, message => { if (message.ClosedViewModel == null) { return; } AvalonDockWorkspaceViewModel.CloseDocument(message.ClosedViewModel); }); Messenger.Default.Register <NotificationMessage>(this, message => { switch (message.Notification) { case "ActiveDocumentChanged": { CopyScriptCommand.RaiseCanExecuteChanged(); SaveCommand.RaiseCanExecuteChanged(); SaveAsCommand.RaiseCanExecuteChanged(); CloseCommand.RaiseCanExecuteChanged(); CopyBlockCommand.RaiseCanExecuteChanged(); PasteCommand.RaiseCanExecuteChanged(); ReplaceColorsCommand.RaiseCanExecuteChanged(); ApplyThemeToScriptCommand.RaiseCanExecuteChanged(); EditMasterThemeCommand.RaiseCanExecuteChanged(); CreateThemeCommand.RaiseCanExecuteChanged(); RaisePropertyChanged("ActiveDocumentIsScript"); RaisePropertyChanged("ActiveDocumentIsTheme"); RaisePropertyChanged("ShowAdvancedStatus"); break; } case "NewScript": { OnNewScriptCommand(); break; } case "OpenScript": { OnOpenScriptCommand(); break; } } }); CheckForUpdates(); }
public MainWindowViewModel(IItemFilterScriptRepository itemFilterScriptRepository, IItemFilterScriptTranslator itemFilterScriptTranslator, IReplaceColorsViewModel replaceColorsViewModel, IAvalonDockWorkspaceViewModel avalonDockWorkspaceViewModel, ISettingsPageViewModel settingsPageViewModel, IThemeProvider themeProvider, IThemeService themeService, IMessageBoxService messageBoxService, IClipboardService clipboardService) { _itemFilterScriptRepository = itemFilterScriptRepository; _itemFilterScriptTranslator = itemFilterScriptTranslator; _replaceColorsViewModel = replaceColorsViewModel; _avalonDockWorkspaceViewModel = avalonDockWorkspaceViewModel; SettingsPageViewModel = settingsPageViewModel; _themeProvider = themeProvider; _themeService = themeService; _messageBoxService = messageBoxService; _clipboardService = clipboardService; NewScriptCommand = new RelayCommand(OnNewScriptCommand); CopyScriptCommand = new RelayCommand(OnCopyScriptCommand, () => ActiveDocumentIsScript); OpenScriptCommand = new RelayCommand(async () => await OnOpenScriptCommand()); OpenThemeCommand = new RelayCommand(async () => await OnOpenThemeCommandAsync()); SaveCommand = new RelayCommand(async () => await OnSaveDocumentCommandAsync(), ActiveDocumentIsEditable); SaveAsCommand = new RelayCommand(async () => await OnSaveAsCommandAsync(), ActiveDocumentIsEditable); CloseCommand = new RelayCommand(OnCloseDocumentCommand, ActiveDocumentIsEditable); CopyBlockCommand = new RelayCommand(OnCopyBlockCommand, () => ActiveDocumentIsScript && ActiveScriptHasSelectedBlock); CopyBlockStyleCommand = new RelayCommand(OnCopyBlockStyleCommand, () => ActiveDocumentIsScript && ActiveScriptHasSelectedBlock); PasteCommand = new RelayCommand(OnPasteCommand, () => ActiveDocumentIsScript && ActiveScriptHasSelectedBlock); PasteBlockStyleCommand = new RelayCommand(OnPasteBlockStyleCommand, () => ActiveDocumentIsScript && ActiveScriptHasSelectedBlock); MoveBlockUpCommand = new RelayCommand(OnMoveBlockUpCommand, () => ActiveDocumentIsScript && ActiveScriptHasSelectedBlock); MoveBlockDownCommand = new RelayCommand(OnMoveBlockDownCommand, () => ActiveDocumentIsScript && ActiveScriptHasSelectedBlock); MoveBlockToTopCommand = new RelayCommand(OnMoveBlockToTopCommand, () => ActiveDocumentIsScript && ActiveScriptHasSelectedBlock); MoveBlockToBottomCommand = new RelayCommand(OnMoveBlockToBottomCommand, () => ActiveDocumentIsScript && ActiveScriptHasSelectedBlock); AddBlockCommand = new RelayCommand(OnAddBlockCommand, () => ActiveDocumentIsScript); AddSectionCommand = new RelayCommand(OnAddSectionCommand, () => ActiveDocumentIsScript); DeleteBlockCommand = new RelayCommand(OnDeleteBlockCommand, () => ActiveDocumentIsScript && ActiveScriptHasSelectedBlock); DisableBlockCommand = new RelayCommand(OnDisableBlockCommand, () => ActiveDocumentIsScript && ActiveScriptHasSelectedEnabledBlock); EnableBlockCommand = new RelayCommand(OnEnableBlockCommand, () => ActiveDocumentIsScript && ActiveScriptHasSelectedDisabledBlock); OpenAboutWindowCommand = new RelayCommand(OnOpenAboutWindowCommand); ReplaceColorsCommand = new RelayCommand(OnReplaceColorsCommand, () => ActiveDocumentIsScript); CreateThemeCommand = new RelayCommand(OnCreateThemeCommand, () => ActiveDocumentIsScript); ApplyThemeToScriptCommand = new RelayCommand(async () => await OnApplyThemeToScriptCommandAsync(), () => ActiveDocumentIsScript); EditMasterThemeCommand = new RelayCommand(OnEditMasterThemeCommand, () => ActiveDocumentIsScript); AddTextColorThemeComponentCommand = new RelayCommand(OnAddTextColorThemeComponentCommand, () => ActiveDocumentIsTheme && ActiveThemeIsEditable); AddBackgroundColorThemeComponentCommand = new RelayCommand(OnAddBackgroundColorThemeComponentCommand, () => ActiveDocumentIsTheme && ActiveThemeIsEditable); AddBorderColorThemeComponentCommand = new RelayCommand(OnAddBorderColorThemeComponentCommand, () => ActiveDocumentIsTheme && ActiveThemeIsEditable); DeleteThemeComponentCommand = new RelayCommand(OnDeleteThemeComponentCommand, () => ActiveDocumentIsTheme && ActiveThemeIsEditable && _avalonDockWorkspaceViewModel.ActiveThemeViewModel.SelectedThemeComponent != null); ExpandAllBlocksCommand = new RelayCommand(OnExpandAllBlocksCommand, () => ActiveDocumentIsScript); CollapseAllBlocksCommand = new RelayCommand(OnCollapseAllBlocksCommand, () => ActiveDocumentIsScript); ToggleShowAdvancedCommand = new RelayCommand<bool>(OnToggleShowAdvancedCommand, s => ActiveDocumentIsScript); ClearFiltersCommand = new RelayCommand(OnClearFiltersCommand, () => ActiveDocumentIsScript); if (string.IsNullOrEmpty(_itemFilterScriptRepository.GetItemFilterScriptDirectory())) { SetItemFilterScriptDirectory(); } var icon = new BitmapImage(); icon.BeginInit(); icon.UriSource = new Uri("pack://application:,,,/Filtration;component/Resources/Icons/filtration_icon.png"); icon.EndInit(); Icon = icon; Messenger.Default.Register<ThemeClosedMessage>(this, message => { if (message.ClosedViewModel == null) return; AvalonDockWorkspaceViewModel.CloseDocument(message.ClosedViewModel); }); Messenger.Default.Register<NotificationMessage>(this, message => { switch (message.Notification) { case "ActiveDocumentChanged": { CopyScriptCommand.RaiseCanExecuteChanged(); SaveCommand.RaiseCanExecuteChanged(); SaveAsCommand.RaiseCanExecuteChanged(); CloseCommand.RaiseCanExecuteChanged(); CopyBlockCommand.RaiseCanExecuteChanged(); PasteCommand.RaiseCanExecuteChanged(); ReplaceColorsCommand.RaiseCanExecuteChanged(); ApplyThemeToScriptCommand.RaiseCanExecuteChanged(); EditMasterThemeCommand.RaiseCanExecuteChanged(); CreateThemeCommand.RaiseCanExecuteChanged(); RaisePropertyChanged("ActiveDocumentIsScript"); RaisePropertyChanged("ActiveDocumentIsTheme"); RaisePropertyChanged("ShowAdvancedStatus"); break; } case "NewScript": { OnNewScriptCommand(); break; } case "OpenScript": { #pragma warning disable 4014 OnOpenScriptCommand(); #pragma warning restore 4014 break; } case "ShowLoadingBanner": { ShowLoadingBanner = true; break; } case "HideLoadingBanner": { ShowLoadingBanner = false; break; } } }); }