void Init(string pdfPathName, int attachmentId, int?topicId, bool localRequest)
        {
            _inst = this;

            DataContext = this;

            Width  = 1024;
            Height = 768;

            this.WindowState = WindowState.Normal;

            btnLaserPointer.DataContext    = ExplanationModeMediator.Inst;
            btnExplanationMode.DataContext = ExplanationModeMediator.Inst;

            _mediator         = ExplanationModeMediator.Inst;
            _mediator.PdfOpen = true;

            if (ExplanationModeMediator.Inst.ExplanationModeEnabled)
            {
                DiscWindows.Get().HidePublic();
            }

            ExplanationModeMediator.Inst.OnWndOpened(this, attachmentId, localRequest);

            if (_moonPdfLoaded)
            {
                _inst.moonPdfPanel.OpenFile(pdfPathName);
            }
            else
            {
                Utils.DelayAsync(100).GetAwaiter().OnCompleted(
                    () => _inst.moonPdfPanel.OpenFile(pdfPathName));
            }

            moonPdfPanel.ZoomType = ZoomType.FitToWidth;

            //wait the doc to load before starting sync.
            _viewStateTimer          = new DispatcherTimer();
            _viewStateTimer.Interval = TimeSpan.FromMilliseconds(100);
            _viewStateTimer.Tick    += _viewStateTimer_Tick;
            if (_mediator.ExplanationModeEnabled)
            {
                Utils.DelayAsync(100).GetAwaiter().OnCompleted(RequestScrollPosition);
                Utils.DelayAsync(150).GetAwaiter().OnCompleted(() => _viewStateTimer.Start());
            }

            if (topicId != null)
            {
                _mediator.CurrentTopicId = topicId;
            }

            SetListeners(true);
        }
示例#2
0
        void Init(string pdfPathName, int attachmentId, int? topicId, bool localRequest)
        {
            _inst = this;

            DataContext = this;

            Width = 1024;
            Height = 768;

            this.WindowState = WindowState.Normal;

            btnLaserPointer.DataContext = ExplanationModeMediator.Inst;
            btnExplanationMode.DataContext = ExplanationModeMediator.Inst;

            _mediator = ExplanationModeMediator.Inst;
            _mediator.PdfOpen = true;

            if (ExplanationModeMediator.Inst.ExplanationModeEnabled)
                DiscWindows.Get().HidePublic();

            ExplanationModeMediator.Inst.OnWndOpened(this, attachmentId, localRequest);

            if (_moonPdfLoaded)
                _inst.moonPdfPanel.OpenFile(pdfPathName);
            else
                Utils.DelayAsync(100).GetAwaiter().OnCompleted(
                    () => _inst.moonPdfPanel.OpenFile(pdfPathName));

            moonPdfPanel.ZoomType = ZoomType.FitToWidth;

            //wait the doc to load before starting sync.
            _viewStateTimer = new DispatcherTimer();
            _viewStateTimer.Interval = TimeSpan.FromMilliseconds(100);
            _viewStateTimer.Tick += _viewStateTimer_Tick;
            if (_mediator.ExplanationModeEnabled)
            {
                Utils.DelayAsync(100).GetAwaiter().OnCompleted(RequestScrollPosition);
                Utils.DelayAsync(150).GetAwaiter().OnCompleted(() => _viewStateTimer.Start());
            }

            if (topicId != null)
                _mediator.CurrentTopicId = topicId;

            SetListeners(true);
        }
示例#3
0
        void Init(string pdfPathName, int attachmentId, int?topicId, bool localRequest)
        {
            _inst = this;

            DataContext = this;

            //Width  = 0.8  * SystemParameters.PrimaryScreenWidth;
            //Height = 0.8 * SystemParameters.PrimaryScreenHeight;
            Width  = 1024;
            Height = 768;

            this.WindowState = WindowState.Normal;

            btnLaserPointer.DataContext    = ExplanationModeMediator.Inst;
            btnExplanationMode.DataContext = ExplanationModeMediator.Inst;

            pdfViewerUC.PdfPathName = pdfPathName;

            _mediator         = ExplanationModeMediator.Inst;
            _mediator.PdfOpen = true;

            ExplanationModeMediator.Inst.OnWndOpened(this, attachmentId, localRequest);

            if (topicId != null)
            {
                _mediator.CurrentTopicId = topicId;
            }

            if (_mediator.ExplanationModeEnabled)
            {
                RequestScrollPosition();
            }

            SetListeners(true);

            //if (_overlayWnd==null)
            //    _overlayWnd = new ReaderOverlayWindow { Window = this };
            //_overlayWnd.Show();
        }
示例#4
0
        void Init(string pdfPathName, int attachmentId, int? topicId, bool localRequest)
        {
            _inst = this;

            DataContext = this;

            //Width  = 0.8  * SystemParameters.PrimaryScreenWidth;
            //Height = 0.8 * SystemParameters.PrimaryScreenHeight;
            Width = 1024;
            Height = 768;

            this.WindowState = WindowState.Normal;

            btnLaserPointer.DataContext = ExplanationModeMediator.Inst;
            btnExplanationMode.DataContext = ExplanationModeMediator.Inst;

            pdfViewerUC.PdfPathName = pdfPathName;

            _mediator = ExplanationModeMediator.Inst;
            _mediator.PdfOpen = true;

            ExplanationModeMediator.Inst.OnWndOpened(this, attachmentId, localRequest);

            if (topicId != null)
                _mediator.CurrentTopicId = topicId;

            if (_mediator.ExplanationModeEnabled)
                RequestScrollPosition();

            SetListeners(true);

            //if (_overlayWnd==null)
            //    _overlayWnd = new ReaderOverlayWindow { Window = this };
            //_overlayWnd.Show();
        }
        void Init(string url, int? topicId)
        {
            _url = url;

            ExplanationModeMediator.Inst.WebkitOpen = true;

            //if (ExplanationModeMediator.Inst.ExplanationModeEnabled)
            //{
            //    WindowState = WindowState.Maximized;
            //}
            //else
            {
                WindowState = WindowState.Normal;
                Width = 1280;
                Height = 768;
            }

            // 
            // _webKitBrowser1
            // 
            if (_webKitBrowser1 == null)
            {
                _webKitBrowser1 = new WebKit.WebKitBrowser
                {
                    BackColor = System.Drawing.Color.White,
                    Location = new System.Drawing.Point(0, 0),
                    Margin = new System.Windows.Forms.Padding(0),
                    Name = "_webKitBrowser1",
                    TabIndex = 0
                };
                _webKitBrowser1.Navigated += _webKitBrowser1_Navigated;
                webkitHost.Child = _webKitBrowser1;
                _webKitBrowser1.ResumeLayout();
            }

            browserBar.Browser = _webKitBrowser1;
            browserBar.Window = this;

            browserBar.addressBar.Text = _url;
            _webKitBrowser1.Navigate(_url);
            // _webKitBrowser1.Navigate(@"file:///C:\Users\User\Documents\Visual Studio 2013\Projects\tds3\discussions\bin\x86\Debug\qwe.html");
            //string str = Reencoder.GetUrlContent("http://www.shinmai.co.jp/olympic/jouhou/shochi.htm");
            //var reencoded = Reencoder.ShiftJisToUtf8(str);
            //_webKitBrowser1.Document.CreateTextNode(reencoded);// aTextContent = reencoded;

            if (ExplanationModeMediator.Inst.ExplanationModeEnabled)
                DiscWindows.Get().HidePublic();

            ResizeMode = ResizeMode.NoResize;

            //if (_inst != null)
            //    EnsureInstanceDeinited(); //close previous instance
            _inst = this;

            _mediator = ExplanationModeMediator.Inst;

            if (topicId != null)
                _mediator.CurrentTopicId = topicId;

            if (_mediator.ExplanationModeEnabled)
                RequestScrollPosition();

            if (_scrollStateChecker==null)
            {
                _scrollStateChecker = new DispatcherTimer(DispatcherPriority.Background)
                {
                    Interval = new TimeSpan(200)
                };
            }
            _scrollStateChecker.Tick += _scrollStateChecker_Tick;
            _scrollStateChecker.Start();

            if (_overlayWnd==null)
                _overlayWnd = new BrowserOverlayWindow { Window = this };
            _overlayWnd.Show();

            SetListeners(true);
        }
        void Init(string url, int?topicId)
        {
            _url = url;

            ExplanationModeMediator.Inst.WebkitOpen = true;

            //if (ExplanationModeMediator.Inst.ExplanationModeEnabled)
            //{
            //    WindowState = WindowState.Maximized;
            //}
            //else
            {
                WindowState = WindowState.Normal;
                Width       = 1280;
                Height      = 768;
            }

            //
            // _webKitBrowser1
            //
            if (_webKitBrowser1 == null)
            {
                _webKitBrowser1 = new WebKit.WebKitBrowser
                {
                    BackColor = System.Drawing.Color.White,
                    Location  = new System.Drawing.Point(0, 0),
                    Margin    = new System.Windows.Forms.Padding(0),
                    Name      = "_webKitBrowser1",
                    TabIndex  = 0
                };
                _webKitBrowser1.Navigated += _webKitBrowser1_Navigated;
                webkitHost.Child           = _webKitBrowser1;
                _webKitBrowser1.ResumeLayout();
            }

            browserBar.Browser = _webKitBrowser1;
            browserBar.Window  = this;

            browserBar.addressBar.Text = _url;
            _webKitBrowser1.Navigate(_url);
            // _webKitBrowser1.Navigate(@"file:///C:\Users\User\Documents\Visual Studio 2013\Projects\tds3\discussions\bin\x86\Debug\qwe.html");
            //string str = Reencoder.GetUrlContent("http://www.shinmai.co.jp/olympic/jouhou/shochi.htm");
            //var reencoded = Reencoder.ShiftJisToUtf8(str);
            //_webKitBrowser1.Document.CreateTextNode(reencoded);// aTextContent = reencoded;

            if (ExplanationModeMediator.Inst.ExplanationModeEnabled)
            {
                DiscWindows.Get().HidePublic();
            }

            ResizeMode = ResizeMode.NoResize;

            //if (_inst != null)
            //    EnsureInstanceDeinited(); //close previous instance
            _inst = this;

            _mediator = ExplanationModeMediator.Inst;

            if (topicId != null)
            {
                _mediator.CurrentTopicId = topicId;
            }

            if (_mediator.ExplanationModeEnabled)
            {
                RequestScrollPosition();
            }

            if (_scrollStateChecker == null)
            {
                _scrollStateChecker = new DispatcherTimer(DispatcherPriority.Background)
                {
                    Interval = new TimeSpan(200)
                };
            }
            _scrollStateChecker.Tick += _scrollStateChecker_Tick;
            _scrollStateChecker.Start();

            if (_overlayWnd == null)
            {
                _overlayWnd = new BrowserOverlayWindow {
                    Window = this
                }
            }
            ;
            _overlayWnd.Show();

            SetListeners(true);
        }

        void _webKitBrowser1_Navigated(object sender, WebBrowserNavigatedEventArgs e)
        {
            _webKitBrowser1.Visible = true;
        }