private void ExpandThemes() { FeatureTrackingManager.Instance.UseFeature(Features.Brainstorm_ExploreLibrary_Document_Themes); bool added_at_least_one_theme = false; if (null != pdf_document_node_content.PDFDocument.Library.ExpeditionManager) { ExpeditionDataSource eds = pdf_document_node_content.PDFDocument.Library.ExpeditionManager.ExpeditionDataSource; if (null != eds) { if (eds.docs_index.ContainsKey(pdf_document_node_content.PDFDocument.Fingerprint)) { int doc_id = eds.docs_index[pdf_document_node_content.PDFDocument.Fingerprint]; TopicProbability[] topics = eds.LDAAnalysis.DensityOfTopicsInDocsSorted[doc_id]; for (int t = 0; t < topics.Length && t < 5; ++t) { string topic_name = eds.GetDescriptionForTopic(topics[t].topic, false, "\n"); ThemeNodeContent tnc = new ThemeNodeContent(topic_name, pdf_document_node_content.PDFDocument.Library.WebLibraryDetail.Id); NodeControlAddingByKeyboard.AddChildToNodeControl(node_control, tnc, false); added_at_least_one_theme = true; } } } } if (!added_at_least_one_theme) { MessageBoxes.Warn("There were no themes available for this document. Please run Expedition against your library."); } }
public ThemeNodeContentEditor(NodeControl node_control, ThemeNodeContent theme_node_content) { this.node_control = node_control; this.theme_node_content = theme_node_content; DataContext = theme_node_content; InitializeComponent(); }
public ThemeNodeContentControl(NodeControl node_control_, ThemeNodeContent theme_node_content) { InitializeComponent(); node_control = node_control_; this.theme_node_content = new AugmentedBindable <ThemeNodeContent>(theme_node_content); DataContextChanged += ThemeNodeContentControl_DataContextChanged; DataContext = this.theme_node_content; Focusable = true; ImageIcon.Source = Icons.GetAppIcon(Icons.BrainstormAttractorTheme); RenderOptions.SetBitmapScalingMode(ImageIcon, BitmapScalingMode.HighQuality); TextBorder.CornerRadius = NodeThemes.corner_radius; }
private static void ExpandThemes(PDFDocument doc, NodeControl node_control) { WPFDoEvents.AssertThisCodeIs_NOT_RunningInTheUIThread(); ASSERT.Test(doc != null); FeatureTrackingManager.Instance.UseFeature(Features.Brainstorm_ExploreLibrary_Document_Themes); if (doc != null) { ASSERT.Test(doc.LibraryRef.Xlibrary != null); bool added_at_least_one_theme = false; ExpeditionDataSource eds = doc.LibraryRef.Xlibrary?.ExpeditionManager?.ExpeditionDataSource; if (null != eds) { if (eds.docs_index.ContainsKey(doc.Fingerprint)) { int doc_id = eds.docs_index[doc.Fingerprint]; TopicProbability[] topics = eds.LDAAnalysis.DensityOfTopicsInDocsSorted[doc_id]; WPFDoEvents.InvokeInUIThread(() => { for (int t = 0; t < Math.Min(topics.Length, 5); ++t) { string topic_name = eds.GetDescriptionForTopic(topics[t].topic, include_topic_number: false, "\n"); ThemeNodeContent tnc = new ThemeNodeContent(topic_name, doc.LibraryRef.Id); NodeControlAddingByKeyboard.AddChildToNodeControl(node_control, tnc, false); added_at_least_one_theme = true; } }); } else { Logging.Warn("Expedition has not been run for library '{0}'.", doc.LibraryRef.Title); } } if (!added_at_least_one_theme) { MessageBoxes.Warn("There were no themes available for this document. Please run Expedition against your library."); } } }
public override bool Equals(object obj) { ThemeNodeContent other = obj as ThemeNodeContent; if (null == other) { return(false); } if (this.tags != other.tags) { return(false); } if (this.library_fingerprint != other.library_fingerprint) { return(false); } return(true); }