Пример #1
0
        public void Handle(FileOpenEvent message)
        {
            var doc = documentCreator();

            doc.Open(message.Path);
            MDI.Open(doc);
        }
Пример #2
0
        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());
            }
        }
Пример #3
0
        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));
        }
Пример #4
0
        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);
                }
            }
        }
Пример #5
0
 public void Handle(FileOpenEvent message)
 {
     OpenDocument(message.Path);
 }