Ejemplo n.º 1
0
        public WebkitBrowserWindow Launch()
        {
            if (ExplanationModeMediator.Inst.WebkitOpen)
            {
                return(null);
            }

            try
            {
                var src = DataContext as Source;
                if (src != null)
                {
                    //var browser = new BrowserWindow(src.Text);
                    //browser.ShowDialog();

                    //System.Diagnostics.Process.Start(src.Text);

                    Utils.ReportMediaOpened(StEvent.SourceOpened, src.RichText.ArgPoint);

                    RaiseEvent(new RoutedEventArgs(SourceViewEvent));

                    var browser = WebkitBrowserWindow.Instance(src.Text, src.RichText.ArgPoint.Topic.Id);
                    browser.Show();
                    browser.Activate();
                    return(browser);
                }
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
            }
            return(null);
        }
Ejemplo n.º 2
0
        private void btnGoogle_Click_1(object sender, RoutedEventArgs e)
        {
            var ap      = DataContext as ArgPoint;
            var browser = WebkitBrowserWindow.Instance("http://google.com", ap.Topic.Id);

            browser.Show();
            browser.Activate();
        }
Ejemplo n.º 3
0
        private void onWebViewerRequest(string Uri)
        {
            var ap = DataContext as ArgPoint;

            if (ap == null)
            {
                return;
            }

            var browser = WebkitBrowserWindow.Instance(Uri, ap.Topic.Id);

            browser.Show();
            browser.Activate();
        }
Ejemplo n.º 4
0
        private void btnInternalBrowser_Click_1(object sender, RoutedEventArgs e)
        {
            var d = DataContext as Discussion;

            if (d != null)
            {
                if (d.HtmlBackground != null)
                {
                    var browser = WebkitBrowserWindow.Instance(getDiscussionBackgroundUrl(d), 0);//0 TopicId for background
                    browser.Show();
                    browser.Activate();
                }
            }
        }
Ejemplo n.º 5
0
        void hyperLink_Click(object sender, RoutedEventArgs e)
        {
            if (ExplanationModeMediator.Inst.WebkitOpen)
            {
                return;
            }

            var link    = (Hyperlink)sender;
            var c       = DataContext as Comment;
            var browser = WebkitBrowserWindow.Instance(link.NavigateUri.ToString(), c != null ? c.ArgPoint.Topic.Id : (int?)null);

            browser.Show();
            browser.Activate();
            e.Handled = true;
        }
Ejemplo n.º 6
0
        //message from remote client
        private void __sourceView(ExplanationModeSyncMsg sm)
        {
            if (!ExplanationModeMediator.Inst.ExplanationModeEnabled)
            {
                return;
            }

            if (sm.doExpand)
            {
                switch (sm.syncMsgType)
                {
                case SyncMsgType.SourceView:
                    var src     = PublicBoardCtx.Get().Source.FirstOrDefault(s0 => s0.Id == sm.viewObjectId);
                    var browser = WebkitBrowserWindow.Instance(src.Text, CurrentTopic != null ? CurrentTopic.Id : (int?)null);
                    browser.Show();
                    browser.Activate();
                    break;

                case SyncMsgType.YoutubeView:
                    var attach   = PublicBoardCtx.Get().Attachment.FirstOrDefault(a0 => a0.Id == sm.viewObjectId);
                    var embedUrl = AttachmentToVideoConvertor.AttachToYtInfo(attach).EmbedUrl;
                    browser = WebkitBrowserWindow.Instance(embedUrl, CurrentTopic != null ? CurrentTopic.Id : (int?)null);
                    browser.Show();
                    browser.Activate();
                    break;

                case SyncMsgType.ImageView:
                    attach = PublicBoardCtx.Get().Attachment.FirstOrDefault(a0 => a0.Id == sm.viewObjectId);
                    if (attach != null && !ExplanationModeMediator.Inst.IsViewerOpened(attach.Id))
                    {
                        AttachmentManager.RunViewer(attach, false);
                    }
                    break;

                case SyncMsgType.PdfView:
                    attach = PublicBoardCtx.Get().Attachment.FirstOrDefault(a0 => a0.Id == sm.viewObjectId);
                    if (attach != null && !ExplanationModeMediator.Inst.IsViewerOpened(attach.Id))
                    {
                        AttachmentManager.RunViewer(attach, false);
                    }
                    break;

                default:
                    throw new NotImplementedException();
                }
            }
            else
            {
                switch (sm.syncMsgType)
                {
                case SyncMsgType.SourceView:
                    WebkitBrowserWindow.EnsureInstanceDeinited();
                    break;

                case SyncMsgType.ImageView:
                    ExplanationModeMediator.Inst.EnsureInstanceClosed(sm.viewObjectId);
                    break;

                case SyncMsgType.YoutubeView:
                    WebkitBrowserWindow.EnsureInstanceDeinited();
                    break;

                case SyncMsgType.PdfView:
                    ReaderWindow2.EnsureInstanceClosed();
                    break;

                default:
                    throw new NotImplementedException();
                }
            }
        }