Exemplo n.º 1
0
        public void Handle(OpenFromWebEvent message)
        {
            var finishedWork = DoingWork(string.Format("Opening {0}", message.Name));

            var openedDocs     = MDI.Items.Cast <DocumentViewModel>();
            var metaWebLogItem = new WebDocumentItem(null, eventAggregator, message.Id, message.Name, message.Blog);
            var openedDoc      = openedDocs.SingleOrDefault(d => d.MarkpadDocument.IsSameItem(metaWebLogItem));

            if (openedDoc != null)
            {
                MDI.ActivateItem(openedDoc);
            }
            else
            {
                documentFactory.OpenBlogPost(message.Blog, message.Id, message.Name)
                .ContinueWith(t =>
                {
                    OpenDocumentResult(t);
                    finishedWork.Dispose();
                }, TaskScheduler.FromCurrentSynchronizationContext());
            }
        }
Exemplo n.º 2
0
        public async void Handle(OpenFromWebEvent message)
        {
            var metaWebLogItem = new WebDocumentItem(null, eventAggregator, message.Id, message.Name, message.Blog);

            await OpenDocument(metaWebLogItem, message.Name, () => documentFactory.OpenBlogPost(message.Blog, message.Id, message.Name));
        }