private void RepopulatePanels(PDFDocument doc) { var links = doc.PDFDocumentCitationManager.GetLinkedDocuments(); WPFDoEvents.InvokeInUIThread(() => { CitationsUserControl.PopulatePanelWithCitations(DocsPanel_Linked, doc, links, Features.LinkedDocument_InfoBar_OpenDoc); }); }
private void RepopulatePanels() { CitationsUserControl.PopulatePanelWithCitations(DocsPanel_Linked, pdf_document, pdf_document.PDFDocumentCitationManager.GetLinkedDocuments(), Features.LinkedDocument_InfoBar_OpenDoc); }
private void LibraryCatalogOverviewControl_DataContextChanged(object sender, DependencyPropertyChangedEventArgs e) { // Make the button semi-transparent if our new document is not actually on the harddrive PanelSearchScore.Visibility = Visibility.Collapsed; ListSearchDetails.DataContext = null; ObjLookInsidePanel.Visibility = Visibility.Collapsed; ButtonThemeSwatch.Visibility = Visibility.Collapsed; ObjFavouriteImage.Visibility = Visibility.Collapsed; ButtonOpen.Background = Brushes.Transparent; TextTitle.Foreground = Brushes.Black; TextTitle.FontSize = TextAuthors.FontSize; // No more work if our context is null if (null == PDFDocumentBindable) { return; } // The wizard if ("The Qiqqa Manual" == PDFDocumentBindable.Underlying.TitleCombined) { WizardDPs.SetPointOfInterest(TextTitle, "GuestLibraryQiqqaManualTitle"); WizardDPs.SetPointOfInterest(ButtonOpen, "GuestLibraryQiqqaManualOpenButton"); } else { WizardDPs.ClearPointOfInterest(TextTitle); WizardDPs.ClearPointOfInterest(ButtonOpen); } // Choose the icon depending on the reference type if (PDFDocumentBindable.Underlying.IsVanillaReference) { ButtonOpen.Icon = Icons.GetAppIcon(Icons.LibraryCatalogOpenVanillaReference); ButtonOpen.Opacity = 1.0; } else { ButtonOpen.Icon = Icons.GetAppIcon(Icons.LibraryCatalogOpen); ButtonOpen.Opacity = PDFDocumentBindable.Underlying.DocumentExists ? 1.0 : 0.5; } // Favourite? if (PDFDocumentBindable.Underlying.IsFavourite ?? false) { ObjFavouriteImage.Visibility = Visibility.Visible; } // Colour if (Colors.Transparent != PDFDocumentBindable.Underlying.Color) { ButtonOpen.Background = new SolidColorBrush(ColorTools.MakeTransparentColor(PDFDocumentBindable.Underlying.Color, 64)); } // Rating if (!String.IsNullOrEmpty(PDFDocumentBindable.Underlying.Rating)) { double rating; if (Double.TryParse(PDFDocumentBindable.Underlying.Rating, out rating)) { TextTitle.FontSize = TextAuthors.FontSize + rating; } } // Reading stage switch (PDFDocumentBindable.Underlying.ReadingStage) { case Choices.ReadingStages_TOP_PRIORITY: TextTitle.Foreground = Brushes.DarkRed; break; case Choices.ReadingStages_READ_AGAIN: case Choices.ReadingStages_INTERRUPTED: case Choices.ReadingStages_STARTED_READING: TextTitle.Foreground = Brushes.DarkGreen; break; case Choices.ReadingStages_SKIM_READ: case Choices.ReadingStages_BROWSED: case Choices.ReadingStages_INTEREST_ONLY: TextTitle.Foreground = Brushes.DarkBlue; break; case Choices.ReadingStages_FINISHED_READING: case Choices.ReadingStages_DUPLICATE: TextTitle.Foreground = Brushes.DarkGray; break; case Choices.ReadingStages_UNREAD: TextTitle.Foreground = Brushes.Black; break; default: TextTitle.Foreground = Brushes.Black; break; } // Populate the score if we have them if (null != LibraryCatalogControl) { Dictionary <string, double> search_scores = LibraryCatalogControl.SearchScores; if (null != search_scores) { PanelSearchScore.Visibility = Visibility.Visible; double score; search_scores.TryGetValue(PDFDocumentBindable.Underlying.Fingerprint, out score); string score_string = String.Format("{0:0}%", score * 100); ButtonSearchInside.Caption = "" + score_string + ""; ButtonSearchInside.ToolTip = String.Format("Search score is {0}. Click here to see why...", score_string); ButtonSearchInside.Cursor = Cursors.Hand; ButtonSearchInside.MinWidth = 0; Color color = Color.FromRgb(255, (byte)(255 - 150 * score), 100); ButtonSearchInside.Background = new SolidColorBrush(color); } } // Populate the theme swatch ButtonThemeSwatch.Visibility = Visibility.Visible; ButtonThemeSwatch.Background = ThemeBrushes.GetBrushForDocument(PDFDocumentBindable.Underlying); // Populate the linked documents PDFDocument pdf_document = PDFDocumentBindable.Underlying; SafeThreadPool.QueueUserWorkItem(o => { WPFDoEvents.AssertThisCodeIs_NOT_RunningInTheUIThread(); var links = pdf_document.PDFDocumentCitationManager.GetLinkedDocuments(); WPFDoEvents.InvokeAsyncInUIThread(() => { WPFDoEvents.AssertThisCodeIsRunningInTheUIThread(); CitationsUserControl.PopulatePanelWithCitations(DocsPanel_Linked, pdf_document, links, Features.LinkedDocument_Library_OpenDoc, " » ", false); }); }); }
void LibraryCatalogOverviewControl_DataContextChanged(object sender, DependencyPropertyChangedEventArgs e) { // Make the button semi-transparent if our new document is not actually on the harddrive PanelSearchScore.Visibility = Visibility.Collapsed; ListSearchDetails.DataContext = null; ObjLookInsidePanel.Visibility = Visibility.Collapsed; ButtonThemeSwatch.Visibility = Visibility.Collapsed; ObjFavouriteImage.Visibility = Visibility.Collapsed; ButtonOpen.Background = Brushes.Transparent; TextTitle.Foreground = Brushes.Black; TextTitle.FontSize = TextAuthors.FontSize; // No more work if our context is null if (null == PDFDocumentBindable) { return; } // The wizard if ("The Qiqqa Manual" == PDFDocumentBindable.Underlying.TitleCombined) { WizardDPs.SetPointOfInterest(TextTitle, "GuestLibraryQiqqaManualTitle"); WizardDPs.SetPointOfInterest(ButtonOpen, "GuestLibraryQiqqaManualOpenButton"); } else { WizardDPs.ClearPointOfInterest(TextTitle); WizardDPs.ClearPointOfInterest(ButtonOpen); } // Choose the icon depending on the reference type if (false) { } else if (PDFDocumentBindable.Underlying.IsVanillaReference) { ButtonOpen.Icon = Icons.GetAppIcon(Icons.LibraryCatalogOpenVanillaReference); ButtonOpen.Opacity = 1.0; } else { ButtonOpen.Icon = Icons.GetAppIcon(Icons.LibraryCatalogOpen); ButtonOpen.Opacity = PDFDocumentBindable.Underlying.DocumentExists ? 1.0 : 0.5; } // Favourite? if (PDFDocumentBindable.Underlying.IsFavourite ?? false) { ObjFavouriteImage.Visibility = Visibility.Visible; } // Colour if (Colors.Transparent != PDFDocumentBindable.Underlying.Color) { ButtonOpen.Background = new SolidColorBrush(ColorTools.MakeTransparentColor(PDFDocumentBindable.Underlying.Color, 64)); } // Rating if (!String.IsNullOrEmpty(PDFDocumentBindable.Underlying.Rating)) { double rating; if (Double.TryParse(PDFDocumentBindable.Underlying.Rating, out rating)) { TextTitle.FontSize = TextAuthors.FontSize + rating; } } // Reading stage switch (PDFDocumentBindable.Underlying.ReadingStage) { case "Top priority": TextTitle.Foreground = Brushes.DarkRed; break; case "Read again": case "Interrupted": case "Started reading": TextTitle.Foreground = Brushes.DarkGreen; break; case "Skim read": case "Browsed": TextTitle.Foreground = Brushes.DarkBlue; break; case "Finished reading": case Choices.ReadingStages_DUPLICATE: TextTitle.Foreground = Brushes.DarkGray; break; case "Unread": TextTitle.Foreground = Brushes.Black; break; default: TextTitle.Foreground = Brushes.Black; break; } // Populate the score if we have them if (null != LibraryCatalogControl) { Dictionary <string, double> search_scores = LibraryCatalogControl.SearchScores; if (null != search_scores) { PanelSearchScore.Visibility = Visibility.Visible; double score; search_scores.TryGetValue(PDFDocumentBindable.Underlying.Fingerprint, out score); string score_string = String.Format("{0:0}%", score * 100); ButtonSearchInside.Caption = "" + score_string + ""; ButtonSearchInside.ToolTip = String.Format("Search score is {0}. Click here to see why...", score_string); ButtonSearchInside.Cursor = Cursors.Hand; ButtonSearchInside.MinWidth = 0; Color color = Color.FromRgb(255, (byte)(255 - 150 * score), 100); ButtonSearchInside.Background = new SolidColorBrush(color); } } // Populate the theme swatch { ButtonThemeSwatch.Visibility = Visibility.Visible; ButtonThemeSwatch.Background = ThemeBrushes.GetBrushForDocument(PDFDocumentBindable.Underlying); } // Populate the linked documents { CitationsUserControl.PopulatePanelWithCitations(DocsPanel_Linked, PDFDocumentBindable.Underlying.Library, PDFDocumentBindable.Underlying, PDFDocumentBindable.Underlying.PDFDocumentCitationManager.GetLinkedDocuments(), Features.LinkedDocument_Library_OpenDoc, " » ", false); } }