public void Handle(FileOpenEvent message) { var doc = documentCreator(); doc.Open(message.Path); MDI.Open(doc); }
public void Handle(FileOpenEvent message) { if (!fileSystem.File.Exists(message.Path)) { return; } var openedDocs = MDI.Items.Cast <DocumentViewModel>(); var fileSystemSiteItem = new FileSystemSiteItem(eventAggregator, fileSystem, message.Path); var openedDoc = openedDocs.SingleOrDefault(d => d.MarkpadDocument.IsSameItem(fileSystemSiteItem)); if (openedDoc != null) { MDI.ActivateItem(openedDoc); } else { var finishedLoading = DoingWork(string.Format("Opening {0}", message.Path)); documentFactory .OpenDocument(message.Path) .ContinueWith(t => { OpenDocumentResult(t); finishedLoading.Dispose(); }, TaskScheduler.FromCurrentSynchronizationContext()); } }
public async void Handle(FileOpenEvent message) { if (!fileSystem.File.Exists(message.Path)) { return; } var fileSystemSiteItem = new FileSystemSiteItem(eventAggregator, fileSystem, message.Path); await OpenDocument(fileSystemSiteItem, message.Path, () => documentFactory.OpenDocument(message.Path)); }
public void Handle(FileOpenEvent message) { DocumentViewModel openedDoc = GetOpenedDocument(message.Path); if (openedDoc != null) { MDI.ActivateItem(openedDoc); } else { if (File.Exists(message.Path)) { var doc = documentCreator(); doc.Open(message.Path); MDI.Open(doc); } } }
public void Handle(FileOpenEvent message) { OpenDocument(message.Path); }