private static void ExpandAuthors(PDFDocument doc, NodeControl node_control) { WPFDoEvents.AssertThisCodeIs_NOT_RunningInTheUIThread(); ASSERT.Test(doc != null); FeatureTrackingManager.Instance.UseFeature(Features.Brainstorm_ExploreLibrary_Document_Authors); if (doc != null) { string authors = doc.AuthorsCombined; if (String.IsNullOrEmpty(authors) || Constants.UNKNOWN_AUTHORS == authors) { return; } WPFDoEvents.InvokeInUIThread(() => { WPFDoEvents.AssertThisCodeIsRunningInTheUIThread(); List <NameTools.Name> names = new List <NameTools.Name>(); string[] authors_split = NameTools.SplitAuthors_LEGACY(authors); foreach (string author_split in authors_split) { string first_names, last_name; NameTools.SplitName_LEGACY(author_split, out first_names, out last_name); string initial = String.IsNullOrEmpty(first_names) ? null : first_names.Substring(0, 1); PDFAuthorNodeContent pdf_author = new PDFAuthorNodeContent(doc.LibraryRef.Id, last_name, initial); NodeControlAddingByKeyboard.AddChildToNodeControl(node_control, pdf_author, false); } }); } }
private void StartMainApplication() { WPFDoEvents.AssertThisCodeIsRunningInTheUIThread(); WPFDoEvents.SetHourglassCursor(); // Initialise the web browser try { StatusManager.Instance.UpdateStatus("AppStart", "Installing browser components"); GeckoInstaller.CheckForInstall(); StatusManager.Instance.UpdateStatus("AppStart", "Initialising browser components"); GeckoManager.Initialise(); GeckoManager.RegisterPDFInterceptor(); } catch (Exception ex) { Logging.Error(ex, "Problem initialising GeckoFX."); } // Fire up Qiqqa! StatusManager.Instance.UpdateStatus("AppStart", "Starting background processes"); SafeThreadPool.QueueUserWorkItem(o => { StartDaemonSingletons(); }); StatusManager.Instance.UpdateStatus("AppStart", "Launching Qiqqa!"); FireStartUseFeature(); MainWindow window = new MainWindow(); window.Show(); Hide(); }
public CSLProcessorOutputConsumer(string script_directory, string citations_javascript, BibliographyReadyDelegate brd, object user_argument) { WPFDoEvents.AssertThisCodeIsRunningInTheUIThread(); this.citations_javascript = citations_javascript; this.brd = brd; this.user_argument = user_argument; // Create the browser Logging.Info("Creating web browser for InCite CSL processing"); web_browser = new GeckoWebBrowser(); web_browser.CreateControl(); // Add the name of the script to run script_directory = Path.GetFullPath(Path.Combine(script_directory, @"runengine.html")); script_directory = script_directory.Replace(@"\\", @"\"); script_directory = script_directory.Replace(@"//", @"/"); Uri uri = new Uri(script_directory); Logging.Info("CSLProcessorOutputConsumer is about to browse to {0}", uri); // This is the only way we can communicate from JavaScript to .NET!! web_browser.EnableConsoleMessageNotfication(); web_browser.ConsoleMessage += web_browser_ConsoleMessage; // Kick off citeproc computation web_browser.Navigate(uri.ToString()); }
private static void ExpandAnnotations(PDFDocument doc, NodeControl node_control) { WPFDoEvents.AssertThisCodeIs_NOT_RunningInTheUIThread(); ASSERT.Test(doc != null); FeatureTrackingManager.Instance.UseFeature(Features.Brainstorm_ExploreLibrary_Document_Annotations); if (doc != null) { var annotations = doc.GetAnnotations(); WPFDoEvents.InvokeInUIThread(() => { WPFDoEvents.AssertThisCodeIsRunningInTheUIThread(); foreach (var annotation in annotations) { if (!annotation.Deleted) { PDFAnnotationNodeContent content = new PDFAnnotationNodeContent(doc.LibraryRef.Id, doc.Fingerprint, annotation.Guid.Value); NodeControlAddingByKeyboard.AddChildToNodeControl(node_control, content, false); } } }); } }
internal void RefreshSyncControl(SyncControlGridItemSet scgis_previous, SyncControl sync_control) { WPFDoEvents.AssertThisCodeIsRunningInTheUIThread(); WPFDoEvents.SetHourglassCursor(); SafeThreadPool.QueueUserWorkItem(o => { // // Explicitly instruct the sync info collector to perform a swift scan, which DOES NOT include // collecting the precise size of every document in every Qiqqa library (which itself is a *significant* // file system load when you have any reasonably large libraries like I do. [GHo] // // TODO: fetch and cache document filesizes in the background, so we can improve on the accuracy of // our numbers in a future call to this method. // GlobalSyncDetail global_sync_detail = GenerateGlobalSyncDetail(tally_library_storage_size: false); WPFDoEvents.InvokeInUIThread(() => { WPFDoEvents.ResetHourglassCursor(); SyncControlGridItemSet scgis = new SyncControlGridItemSet(scgis_previous.sync_request, global_sync_detail); scgis.AutoTick(); sync_control.SetSyncParameters(scgis); }); }); }
private void UpdateLibraryStatistics() { WPFDoEvents.AssertThisCodeIsRunningInTheUIThread(); UpdateLibraryStatistics_Headers(); UpdateLibraryStatistics_Stats(); }
private void ObjCarousel_MouseDoubleClick(object sender, MouseButtonEventArgs e) { WPFDoEvents.AssertThisCodeIsRunningInTheUIThread(); if (0 < ObjCarousel.Items.Count && 0 <= ObjCarousel.SelectedIndex) { FrameworkElement fe = null; // First try the selected value if (null == fe) { fe = (FrameworkElement)ObjCarousel.SelectedValue; } // If that doesn't work, then try any item in the carousel if (null == fe) { if (0 < ObjCarousel.Items.Count) { fe = (FrameworkElement)ObjCarousel.Items[0]; } } if (null != fe) { DocumentDisplayWork ddw = (DocumentDisplayWork)fe.Tag; MainWindowServiceDispatcher.Instance.OpenDocument(ddw.pdf_document); } } e.Handled = true; }
public PDFInkLayer(PDFDocument pdf_document, int page) { WPFDoEvents.AssertThisCodeIsRunningInTheUIThread(); this.pdf_document = pdf_document; this.page = page; InitializeComponent(); KeyboardNavigation.SetDirectionalNavigation(this, KeyboardNavigationMode.Contained); SizeChanged += PDFInkLayer_SizeChanged; ObjInkCanvas.StrokeCollected += ObjInkCanvas_StrokeCollected; ObjInkCanvas.StrokeErased += ObjInkCanvas_StrokeErased; ObjInkCanvas.SelectionMoved += ObjInkCanvas_SelectionMoved; ObjInkCanvas.SelectionResized += ObjInkCanvas_SelectionResized; ObjInkCanvas.RequestBringIntoView += ObjInkCanvas_RequestBringIntoView; RebuildInks(page, pdf_document.Inks); RaiseInkChange(InkCanvasEditingMode.Ink); //Unloaded += PDFInkLayer_Unloaded; Dispatcher.ShutdownStarted += Dispatcher_ShutdownStarted; }
private void UpdateLibraryStatistics_Stats_Background_GUI_AddAllPlaceHolders(List <DocumentDisplayWork> ddws) { WPFDoEvents.AssertThisCodeIsRunningInTheUIThread(); ObjCarousel.Items.Clear(); foreach (DocumentDisplayWork ddw in ddws) { Image image = new Image(); image.Tag = ddw; image.Stretch = Stretch.Uniform; image.Width = 600; AugmentedBorder border = new AugmentedBorder(); border.Tag = ddw; border.Child = image; border.Visibility = Visibility.Collapsed; ddw.image = image; ddw.border = border; ObjCarousel.Items.Add(border); } if (0 < ObjCarousel.Items.Count) { ObjCarousel.SelectedIndex = 0; } }
public void GetResizedPageImage(PDFRendererPageControl page_control, int page, int height, int width, ResizedPageImageItemCallbackDelegate callback) { WPFDoEvents.AssertThisCodeIsRunningInTheUIThread(); // Utilities.LockPerfTimer l1_clk = Utilities.LockPerfChecker.Start(); lock (resized_page_image_item_requests) { // l1_clk.LockPerfTimerStop(); Logging.Debug("Queueing page redraw for {0}", page); resized_page_image_item_requests[page] = new ResizedPageImageItemRequest { page = page, page_control = page_control, height = height, width = width, callback = callback }; resized_page_image_item_request_orders.Add(page); if (num_resized_page_image_item_thread_running < 1) { Interlocked.Increment(ref num_resized_page_image_item_thread_running); ResizedPageImageItemThreadEntry(); } } }
public PDFTextSentenceLayer(PDFRendererControl pdf_renderer_control, int page) { WPFDoEvents.AssertThisCodeIsRunningInTheUIThread(); this.pdf_renderer_control = new WeakReference <PDFRendererControl>(pdf_renderer_control); this.page = page; InitializeComponent(); Focusable = true; KeyboardNavigation.SetDirectionalNavigation(this, KeyboardNavigationMode.Once); Background = Brushes.Transparent; Cursor = Cursors.IBeam; SizeChanged += PDFTextSentenceLayer_SizeChanged; drag_area_tracker = new DragAreaTracker(this, false); drag_area_tracker.OnDragStarted += drag_area_tracker_OnDragStarted; drag_area_tracker.OnDragInProgress += drag_area_tracker_OnDragInProgress; drag_area_tracker.OnDragComplete += drag_area_tracker_OnDragComplete; text_selection_manager = new TextSelectionManager(); PreviewMouseDown += PDFTextSentenceLayer_PreviewMouseDown; PreviewKeyDown += PDFTextLayer_PreviewKeyDown; RequestBringIntoView += PDFTextSentenceLayer_RequestBringIntoView; text_layer_selection_mode = TextLayerSelectionMode.Sentence; //Unloaded += PDFTextSentenceLayer_Unloaded; Dispatcher.ShutdownStarted += Dispatcher_ShutdownStarted; }
internal static void AddDocumentsSimilarToDistribution(NodeControl node_control_, WebLibraryDetail web_library_detail, ExpeditionDataSource eds, float[] tags_distribution) { WPFDoEvents.AssertThisCodeIs_NOT_RunningInTheUIThread(); ASSERT.Test(eds != null); // Get the most similar PDFDocuments int[] doc_ids = LDAAnalysisTools.GetDocumentsSimilarToDistribution(eds.LDAAnalysis, tags_distribution); WPFDoEvents.InvokeInUIThread(() => { WPFDoEvents.AssertThisCodeIsRunningInTheUIThread(); for (int i = 0; i < 10 && i < doc_ids.Length; ++i) { int doc_id = doc_ids[i]; string fingerprint = eds.docs[doc_id]; PDFDocument pdf_document = web_library_detail.Xlibrary.GetDocumentByFingerprint(fingerprint); if (null == pdf_document) { Logging.Warn("Couldn't find similar document with fingerprint {0}", fingerprint); } else { PDFDocumentNodeContent content = new PDFDocumentNodeContent(pdf_document.Fingerprint, pdf_document.LibraryRef.Id); NodeControlAddingByKeyboard.AddChildToNodeControl(node_control_, content, false); } } }); }
// ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ internal void ExpandSpecificDocuments() { WPFDoEvents.AssertThisCodeIsRunningInTheUIThread(); FeatureTrackingManager.Instance.UseFeature(Features.Brainstorm_ExploreLibrary_Theme_Documents); ApplyTagsDistribution(AddDocumentsSimilarToDistribution); }
private void Rebuild() { WPFDoEvents.AssertThisCodeIsRunningInTheUIThread(); ObjDocumentViewer.Document = null; ObjTooManyAnnotationsButton.Visibility = Visibility.Collapsed; AugmentedBindable <PDFDocument> pdf_document_bindable = DataContext as AugmentedBindable <PDFDocument>; if (null != pdf_document_bindable) { PDFDocument pdf_document = pdf_document_bindable.Underlying; SafeThreadPool.QueueUserWorkItem(o => { // TODO: [GHo] what are these 'heuristic' conditions good for?!?! if (pdf_document.GetAnnotations().Count > 50 || pdf_document.Highlights.Count > 1000) { WPFDoEvents.InvokeAsyncInUIThread(() => { ObjTooManyAnnotationsButton.Visibility = Visibility.Visible; ObjTooManyAnnotationsButton.Tag = pdf_document; }); } else { PopulateWithAnnotationReport(pdf_document); } }); } }
public PDFHighlightLayer(PDFDocument pdf_document, int page) { WPFDoEvents.AssertThisCodeIsRunningInTheUIThread(); this.pdf_document = pdf_document; this.page = page; InitializeComponent(); Background = Brushes.Transparent; Cursor = Cursors.Pen; drag_area_tracker = new DragAreaTracker(this, false); drag_area_tracker.OnDragStarted += drag_area_tracker_OnDragStarted; drag_area_tracker.OnDragInProgress += drag_area_tracker_OnDragInProgress; drag_area_tracker.OnDragComplete += drag_area_tracker_OnDragComplete; text_selection_manager = new TextSelectionManager(); SizeChanged += PDFHighlightLayer_SizeChanged; SetLeft(ObjHighlightRenderer, 0); SetTop(ObjHighlightRenderer, 0); text_layer_selection_mode = TextLayerSelectionMode.Sentence; CurrentColourNumber = 0; Loaded += PDFHighlightLayer_Loaded; //Unloaded += PDFHighlightLayer_Unloaded; Dispatcher.ShutdownStarted += Dispatcher_ShutdownStarted; }
public PDFHandLayer(PDFRendererControl pdf_renderer_control, int page) { WPFDoEvents.AssertThisCodeIsRunningInTheUIThread(); this.page = page; this.pdf_renderer_control = new WeakReference <PDFRendererControl>(pdf_renderer_control); InitializeComponent(); Background = Brushes.Transparent; Cursor = Cursors.Hand; PDFRendererControlStats pdf_renderer_control_stats = pdf_renderer_control.GetPDFRendererControlStats(); int start_page_offset = pdf_renderer_control_stats.StartPageOffset; if (0 != start_page_offset) { ObjPageNumberControl.SetPageNumber(String.Format("{2} ({0}/{1})", page, pdf_renderer_control_stats.pdf_document.PageCountAsString, (page + start_page_offset - 1))); } else { ObjPageNumberControl.SetPageNumber(String.Format("{0}/{1}", page, pdf_renderer_control_stats.pdf_document.PageCountAsString)); } MouseDown += PDFHandLayer_MouseDown; MouseUp += PDFHandLayer_MouseUp; MouseMove += PDFHandLayer_MouseMove; //Unloaded += PDFHandLayer_Unloaded; Dispatcher.ShutdownStarted += Dispatcher_ShutdownStarted; }
private static void ExpandCitationsOutbound(PDFDocument doc, NodeControl node_control) { FeatureTrackingManager.Instance.UseFeature(Features.Brainstorm_ExploreLibrary_Document_CitationsOutbound); ASSERT.Test(doc != null); if (doc != null) { List <Citation> citations = doc.PDFDocumentCitationManager.GetOutboundCitations(); WPFDoEvents.InvokeInUIThread(() => { WPFDoEvents.AssertThisCodeIsRunningInTheUIThread(); foreach (var citation in citations) { // NB: We assume the citations are from the same library!! PDFDocumentNodeContent content = new PDFDocumentNodeContent(citation.fingerprint_inbound, doc.LibraryRef.Id); if (!content.PDFDocument.Deleted) { NodeControlAddingByKeyboard.AddChildToNodeControl(node_control, content, false); } } }); } }
protected virtual void Dispose(bool disposing) { Logging.Debug("LibraryCatalogOverviewControl::Dispose({0}) @{1}", disposing, dispose_count); WPFDoEvents.InvokeInUIThread(() => { WPFDoEvents.SafeExec(() => { if (dispose_count == 0) { // Get rid of managed resources / get rid of cyclic references: library_index_hover_popup?.Dispose(); } }); WPFDoEvents.SafeExec(() => { WPFDoEvents.AssertThisCodeIsRunningInTheUIThread(); if (dispose_count == 0) { WizardDPs.ClearPointOfInterest(PanelSearchScore); } }); WPFDoEvents.SafeExec(() => { if (dispose_count == 0) { WizardDPs.ClearPointOfInterest(ObjLookInsidePanel); } }); WPFDoEvents.SafeExec(() => { TextTitle.MouseLeftButtonUp -= TextTitle_MouseLeftButtonUp; ButtonOpen.ToolTipOpening -= HyperlinkPreview_ToolTipOpening; ButtonOpen.ToolTipClosing -= HyperlinkPreview_ToolTipClosing; ListSearchDetails.SearchClicked -= ListSearchDetails_SearchSelectionChanged; DataContextChanged -= LibraryCatalogOverviewControl_DataContextChanged; }); WPFDoEvents.SafeExec(() => { DataContext = null; }); WPFDoEvents.SafeExec(() => { // Clear the references for sanity's sake library_index_hover_popup = null; drag_drop_helper = null; }); ++dispose_count; }); }
protected virtual void Dispose(bool disposing) { Logging.Debug("PDFHandLayer::Dispose({0}) @{1}", disposing, dispose_count); try { if (0 == dispose_count) { WPFDoEvents.InvokeInUIThread(() => { WPFDoEvents.AssertThisCodeIsRunningInTheUIThread(); try { foreach (var el in Children) { IDisposable node = el as IDisposable; if (null != node) { node.Dispose(); } } } catch (Exception ex) { Logging.Error(ex); } try { Children.Clear(); } catch (Exception ex) { Logging.Error(ex); } MouseDown -= PDFHandLayer_MouseDown; MouseUp -= PDFHandLayer_MouseUp; MouseMove -= PDFHandLayer_MouseMove; DataContext = null; }, Dispatcher); } // Clear the references for sanity's sake pdf_renderer_control_stats = null; pdf_renderer_control = null; } catch (Exception ex) { Logging.Error(ex); } ++dispose_count; //base.Dispose(disposing); // parent only throws an exception (intentionally), so depart from best practices and don't call base.Dispose(bool) }
private void UpdateLibraryStatistics_Stats_Background_GUI_FillPlaceHolder(DocumentDisplayWork ddw) { WPFDoEvents.AssertThisCodeIsRunningInTheUIThread(); if (ddw.image != null) { ddw.image.Source = ddw.page_bitmap_source ?? Backgrounds.GetBackground(Backgrounds.PageRenderingFailed_Relax); ddw.image.Stretch = Stretch.Uniform; } ddw.border.Visibility = Visibility.Visible; }
public PDFSearchLayer(PDFRendererControlStats pdf_renderer_control_stats, int page) { WPFDoEvents.AssertThisCodeIsRunningInTheUIThread(); this.pdf_renderer_control_stats = pdf_renderer_control_stats; this.page = page; InitializeComponent(); Background = Brushes.Transparent; SizeChanged += PDFSearchLayer_SizeChanged; }
protected virtual void Dispose(bool disposing) { Logging.Debug("PDFHandLayer::Dispose({0}) @{1}", disposing, dispose_count); WPFDoEvents.SafeExec(() => { if (0 == dispose_count) { WPFDoEvents.AssertThisCodeIsRunningInTheUIThread(); foreach (var el in Children) { IDisposable node = el as IDisposable; if (null != node) { node.Dispose(); } } } }, must_exec_in_UI_thread: true); WPFDoEvents.SafeExec(() => { Children.Clear(); }, must_exec_in_UI_thread: true); WPFDoEvents.SafeExec(() => { MouseDown -= PDFHandLayer_MouseDown; MouseUp -= PDFHandLayer_MouseUp; MouseMove -= PDFHandLayer_MouseMove; }, must_exec_in_UI_thread: true); WPFDoEvents.SafeExec(() => { DataContext = null; }, must_exec_in_UI_thread: true); WPFDoEvents.SafeExec(() => { // Clear the references for sanity's sake pdf_renderer_control_stats = null; pdf_renderer_control = null; }); ++dispose_count; //base.Dispose(disposing); // parent only throws an exception (intentionally), so depart from best practices and don't call base.Dispose(bool) }
private void Refresh() { WPFDoEvents.AssertThisCodeIsRunningInTheUIThread(); ObjWebLibraryListControl.Refresh(); if (WebLibraryManager.Instance.HaveOnlyOneWebLibrary()) { RegionMoreWebLibraries.Visibility = Visibility.Visible; } else { RegionMoreWebLibraries.Visibility = Visibility.Collapsed; } }
private void RepopulatePanels() { WPFDoEvents.AssertThisCodeIs_NOT_RunningInTheUIThread(); var outbound = pdf_document.PDFDocumentCitationManager.GetOutboundCitations(); var inbound = pdf_document.PDFDocumentCitationManager.GetInboundCitations(); WPFDoEvents.InvokeAsyncInUIThread(() => { WPFDoEvents.AssertThisCodeIsRunningInTheUIThread(); PopulatePanelWithCitations(DocsPanel_Outbound, pdf_document, outbound, Features.Citations_OpenDoc); PopulatePanelWithCitations(DocsPanel_Inbound, pdf_document, inbound, Features.Citations_OpenDoc); }); }
public PDFSearchLayer(PDFRendererControl pdf_renderer_control, int page) { WPFDoEvents.AssertThisCodeIsRunningInTheUIThread(); this.pdf_renderer_control = new WeakReference <PDFRendererControl>(pdf_renderer_control); this.page = page; InitializeComponent(); Background = Brushes.Transparent; SizeChanged += PDFSearchLayer_SizeChanged; //Unloaded += PDFSearchLayer_Unloaded; Dispatcher.ShutdownStarted += Dispatcher_ShutdownStarted; }
public LibraryCatalogOverviewControl() { WPFDoEvents.AssertThisCodeIsRunningInTheUIThread(); Theme.Initialize(); InitializeComponent(); WizardDPs.SetPointOfInterest(PanelSearchScore, "LibrarySearchScoreButton"); WizardDPs.SetPointOfInterest(ObjLookInsidePanel, "LibrarySearchDetails"); ObjFavouriteImage.Source = Icons.GetAppIcon(Icons.Favourite); ObjFavouriteImage.ToolTip = "You love it! This is one of your favourite references."; RenderOptions.SetBitmapScalingMode(ObjFavouriteImage, BitmapScalingMode.HighQuality); TextTitle.Cursor = Cursors.Hand; TextTitle.MouseLeftButtonUp += TextTitle_MouseLeftButtonUp; ButtonOpen.ToolTipOpening += HyperlinkPreview_ToolTipOpening; ButtonOpen.ToolTipClosing += HyperlinkPreview_ToolTipClosing; ButtonOpen.ToolTip = ""; ButtonOpen.Cursor = Cursors.Hand; ButtonSearchInside.IconVisibility = Visibility.Collapsed; ButtonSearchInside.Click += ButtonSearchInside_Click; ObjLookInsidePanel.Visibility = Visibility.Collapsed; ButtonThemeSwatch.ToolTip = "This swatch shows the themes in this document. If the swatch is grey, there is no Expedition information for this document - please run Expedition again!\n\nClick here to open the document in Expedition."; ButtonThemeSwatch.Click += ButtonThemeSwatch_Click; ButtonOpen.Click += ButtonOpen_Click; ListSearchDetails.SearchClicked += ListSearchDetails_SearchSelectionChanged; drag_drop_helper = new DragDropHelper(ButtonOpen, GetDocumentDragData); MouseRightButtonUp += LibraryCatalogOverviewControl_MouseRightButtonUp; MouseEnter += LibraryCatalogOverviewControl_MouseEnter; MouseLeave += LibraryCatalogOverviewControl_MouseLeave; DataContextChanged += LibraryCatalogOverviewControl_DataContextChanged; if (Runtime.IsRunningInVisualStudioDesigner) { //... } }
private void UpdateLibraryStatistics_Stats_Background_GUI(List <ChartItem> chart_items_read, List <ChartItem> chart_items_added) { WPFDoEvents.AssertThisCodeIsRunningInTheUIThread(); { ObjSeriesRead.Name = "Read"; ObjSeriesRead.BindingPathX = "Timestamp"; ObjSeriesRead.BindingPathsY = new string[] { "Count" }; ObjSeriesRead.DataSource = chart_items_read; } { ObjSeriesAdded.Name = "Added"; ObjSeriesAdded.BindingPathX = "Timestamp"; ObjSeriesAdded.BindingPathsY = new string[] { "Count" }; ObjSeriesAdded.DataSource = chart_items_added; } }
public PDFAnnotationLayer(PDFDocument pdf_document, int page) { WPFDoEvents.AssertThisCodeIsRunningInTheUIThread(); this.pdf_document = pdf_document; this.page = page; InitializeComponent(); // Wizard if (1 == page) { WizardDPs.SetPointOfInterest(this, "PDFReadingAnnotationLayer"); } Background = Brushes.Transparent; Cursor = Cursors.Cross; SizeChanged += PDFAnnotationLayer_SizeChanged; drag_area_tracker = new DragAreaTracker(this); drag_area_tracker.OnDragComplete += drag_area_tracker_OnDragComplete; // Add all the already existing annotations foreach (PDFAnnotation pdf_annotation in pdf_document.GetAnnotations()) { if (pdf_annotation.Page == this.page) { if (!pdf_annotation.Deleted) { Logging.Info("Loading annotation on page {0}", page); PDFAnnotationItem pdf_annotation_item = new PDFAnnotationItem(this, pdf_annotation); pdf_annotation_item.ResizeToPage(ActualWidth, ActualHeight); Children.Add(pdf_annotation_item); } else { Logging.Info("Not loading deleted annotation on page {0}", page); } } } //Unloaded += PDFAnnotationLayer_Unloaded; Dispatcher.ShutdownStarted += Dispatcher_ShutdownStarted; }
public PDFCameraLayer(PDFDocument pdf_document, int page) { WPFDoEvents.AssertThisCodeIsRunningInTheUIThread(); this.pdf_document = pdf_document; this.page = page; InitializeComponent(); Background = Brushes.Transparent; Cursor = Cursors.Cross; drag_area_tracker = new DragAreaTracker(this); drag_area_tracker.OnDragComplete += drag_area_tracker_OnDragComplete; //Unloaded += PDFCameraLayer_Unloaded; Dispatcher.ShutdownStarted += Dispatcher_ShutdownStarted; }
public void RequestSync(SyncRequest sync_request) { WPFDoEvents.AssertThisCodeIsRunningInTheUIThread(); bool user_wants_intervention = KeyboardTools.IsCTRLDown() || !ConfigurationManager.Instance.ConfigurationRecord.SyncTermsAccepted; WPFDoEvents.SetHourglassCursor(); SafeThreadPool.QueueUserWorkItem(o => { // // Explicitly instruct the sync info collector to perform a swift scan, which DOES NOT include // collecting the precise size of every document in every Qiqqa library (which itself is a *significant* // file system load when you have any reasonably large libraries like I do. [GHo] // // TODO: fetch and cache document filesizes in the background, so we can improve on the accuracy // of our numbers in a future call to this method. // GlobalSyncDetail global_sync_detail = GenerateGlobalSyncDetail(tally_library_storage_size: false); WPFDoEvents.InvokeInUIThread(() => { WPFDoEvents.ResetHourglassCursor(); SyncControlGridItemSet scgis = new SyncControlGridItemSet(sync_request, global_sync_detail); scgis.AutoTick(); if (scgis.CanRunWithoutIntervention() && !user_wants_intervention) { Sync(scgis); } else { SyncControl sync_control = new SyncControl(); sync_control.SetSyncParameters(scgis); sync_control.Show(); } }); }); }