private void _OpenDocument(String fPath) { if (_CheckKeepCurrentDocument()) { return; } var filePath = new PathString(fPath); // if there's plugins already loaded, we need to load the new document with an application's restart var plugins = Client.PluginLoader.Instance.GetPlugins(); if (plugins != null && plugins.Count() > 0) { (System.Windows.Application.Current as App).RestartAndLoad(filePath); return; } // load normally; var doc = ProjectVIEW.OpenFile(this, filePath); if (doc == null) { RecentFilesManager.RemoveFile(filePath); return; } RecentFilesManager.InsertFile(doc.DocumentPath); DocumentView = doc; }
private void _CreateNewDocument() { if (_CheckKeepCurrentDocument()) { return; } var plugins = Client.PluginLoader.Instance.GetPlugins(); if (plugins != null && plugins.Count() > 0) { (System.Windows.Application.Current as App).Restart(); return; } var doc = ProjectVIEW.CreateNew(this); if (doc == null) { return; } RecentFilesManager.InsertFile(doc.DocumentPath); _Document = doc; RaiseChanged(nameof(DocumentView)); }
public AppView() { NewDocumentCmd = new RelayCommand(_CreateNewDocument); OpenDocumentCmd = new RelayCommand(_OpenDocument); OpenKnownDocumentCmd = new RelayCommand <String>(_OpenDocument); CloseDocumentCmd = new RelayCommand(() => CloseDocument()); ShowAboutDialogCmd = new RelayCommand(() => _Dialogs.ShowAboutDialog(null)); ExitApplicationCmd = new RelayCommand(ExitApplication); DocumentView = ProjectVIEW.TryCreateFromCommandLine(this); if (_Document == null) { _Document = new HomeView(this); } }