protected EditorViewModel(IViewModelServiceProvider serviceProvider, MostRecentlyUsedFileCollection mru, string editorName) : base(serviceProvider) { AssetsPlugin.RegisterPlugin(typeof(AssetsEditorPlugin)); serviceProvider.Get <IEditorDialogService>(); ClearMRUCommand = new AnonymousCommand(serviceProvider, () => MRU.Clear()); OpenSettingsWindowCommand = new AnonymousCommand(serviceProvider, OpenSettingsWindow); OpenWebPageCommand = new AnonymousTaskCommand <string>(serviceProvider, OpenWebPage); #if DEBUG DebugCommand = new AnonymousCommand(serviceProvider, DebugFunction); #endif MRU = mru; MRU.MostRecentlyUsedFiles.CollectionChanged += MostRecentlyUsedFiles_CollectionChanged; UpdateRecentFiles(); serviceProvider.Get <IEditorDialogService>().RegisterDefaultTemplateProviders(); EditorName = editorName; if (Instance != null) { throw new InvalidOperationException("The EditorViewModel class can be instanced only once."); } Status = new StatusViewModel(ServiceProvider); Status.PushStatus("Ready"); Instance = this; }
private void ClearRecentFiles() { //Clear considering old projects that have been deleted or upgraded from older versions var xenkoVersions = RecentFiles?.Select(x => x.Version).ToList(); if (xenkoVersions != null) { foreach (var item in xenkoVersions) { MRU.Clear(item); } } }