public static ReaderWindow2 Instance(string pdfPathName, int attachmentId, int? topicId, bool localRequest) { if (_inst == null) _inst = new ReaderWindow2(); _inst.Init(pdfPathName, attachmentId, topicId, localRequest); return _inst; }
public static ReaderWindow2 Instance(string pdfPathName, int attachmentId, int?topicId, bool localRequest) { if (_inst == null) { _inst = new ReaderWindow2(); } _inst.Init(pdfPathName, attachmentId, topicId, localRequest); return(_inst); }
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); }
public static void EnsureInstanceClosed() { if (_inst == null) { return; //already closed } try { _inst.Close(); } catch { } _inst = null; }
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); }
public static void EnsureInstanceClosed() { if (_inst == null) return; //already closed try { _inst.Close(); } catch { } _inst = null; }