public ReportViewerControl(AsyncAnnotationReportBuilder.AnnotationReport annotation_report)
        {
            InitializeComponent();

            WizardDPs.SetPointOfInterest(this, "LibraryAnnotationReportViewer");

            ButtonPrint.Icon    = Icons.GetAppIcon(Icons.Printer);
            ButtonPrint.ToolTip = "Print this report";
            ButtonPrint.Click  += ButtonPrint_Click;

            ButtonToWord.Icon    = Icons.GetAppIcon(Icons.AnnotationReportExportToWord);
            ButtonToWord.ToolTip = "Export to Word";
            ButtonToWord.Click  += ButtonToWord_Click;

            ButtonToPDF.Icon    = Icons.GetAppIcon(Icons.AnnotationReportExportToPDF);
            ButtonToPDF.ToolTip = "Export to PDF";
            ButtonToPDF.Click  += ButtonToPDF_Click;

#if INCLUDE_UNUSED
            ButtonCollapseClickOptions.Caption = "Collapse";
            ButtonCollapseClickOptions.Click  += ButtonCollapseClickOptions_Click;
            ButtonExpandClickOptions.Caption   = "Expand";
            ButtonExpandClickOptions.Click    += ButtonExpandClickOptions_Click;
#endif

            this.annotation_report     = annotation_report;
            ObjDocumentViewer.Document = annotation_report.flow_document;
        }
        public AnnotationReportOptionsWindow()
        {
            //Theme.Initialize(); -- already done in StandardWindow base class

            InitializeComponent();

            WizardDPs.SetPointOfInterest(this, "LibraryAnnotationReportOptionsWindow");
            WizardDPs.SetPointOfInterest(CmdGenerate, "LibraryAnnotationReportOptionsWindowGenerateButton");

            Title = "Qiqqa Annotation Report Options";
            //Width = 800;
            //Height = 600;

            CmdSelectNone.Click += CmdSelectNone_Click;
            CmdSelectAll.Click  += CmdSelectAll_Click;

            CmdGenerate.Caption = "Generate";
            CmdGenerate.Icon    = Icons.GetAppIcon(Icons.LibraryAnnotationsReport);
            CmdCancel.Caption   = "Cancel";
            CmdCancel.Icon      = Icons.GetAppIcon(Icons.Cancel);

            CmdGenerate.Click += CmdGenerate_Click;
            CmdCancel.Click   += CmdCancel_Click;

            ObjFilterByCreatorMeButton.Click += ObjFilterByCreatorMeButton_Click;
        }
示例#3
0
        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("PDFAnnotationLayer::Dispose({0}) @{1}", disposing, dispose_count);

            try
            {
                if (null != drag_area_tracker)
                {
                    WPFDoEvents.InvokeInUIThread(() =>
                    {
                        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);
                        }

                        WizardDPs.ClearPointOfInterest(this);

                        drag_area_tracker.OnDragComplete -= drag_area_tracker_OnDragComplete;
                    }, Dispatcher);
                }

                // Clear the references for sanity's sake
                pdf_renderer_control_stats = null;
                drag_area_tracker          = null;

                DataContext = 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)
        }
        protected virtual void Dispose(bool disposing)
        {
            Logging.Debug("PDFAnnotationLayer::Dispose({0}) @{1}", disposing, dispose_count);

            WPFDoEvents.InvokeInUIThread(() =>
            {
                WPFDoEvents.SafeExec(() =>
                {
                    foreach (var el in Children)
                    {
                        IDisposable node = el as IDisposable;
                        if (null != node)
                        {
                            node.Dispose();
                        }
                    }
                });

                WPFDoEvents.SafeExec(() =>
                {
                    Children.Clear();
                });

                WPFDoEvents.SafeExec(() =>
                {
                    WizardDPs.ClearPointOfInterest(this);
                });

                WPFDoEvents.SafeExec(() =>
                {
                    if (drag_area_tracker != null)
                    {
                        drag_area_tracker.OnDragComplete -= drag_area_tracker_OnDragComplete;
                    }

                    Dispatcher.ShutdownStarted -= Dispatcher_ShutdownStarted;
                });

                WPFDoEvents.SafeExec(() =>
                {
                    // Clear the references for sanity's sake
                    pdf_document      = null;
                    drag_area_tracker = null;
                });

                WPFDoEvents.SafeExec(() =>
                {
                    DataContext = null;
                });

                ++dispose_count;

                //base.Dispose(disposing);     // parent only throws an exception (intentionally), so depart from best practices and don't call base.Dispose(bool)
            });
        }
        public LibraryFilterControl_Search()
        {
            InitializeComponent();

            WizardDPs.SetPointOfInterest(SearchQuick, "LibrarySearchQuickTextBox");
            WizardDPs.SetPointOfInterest(SearchQuickHelpButton, "LibrarySearchQuickHelpButton");

            SearchQuick.SearchHistoryItemSource = ConfigurationManager.Instance.SearchHistory;
            SearchQuick.OnHardSearch           += SearchQuick_OnHardSearch;

            SearchQuick.GotKeyboardFocus += SearchQuick_GotKeyboardFocus;
        }
示例#7
0
        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)
            {
                //...
            }
        }
        protected override void OnClosed(EventArgs e)
        {
            base.OnClosed(e);

            // base.OnClosed() invokes this class' Closed() code, so we flipped the order of exec to reduce the number of surprises for yours truly.
            // This NULLing stuff is really the last rites of Dispose()-like so we stick it at the end here.

            WizardDPs.ClearPointOfInterest(this);
            WizardDPs.ClearPointOfInterest(CmdGenerate);

            library = null;
            pdf_documents.Clear();
            pdf_documents = null;

            ListTags.Items.Clear();
            ListTags.ItemsSource = null;
        }
        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 PDFAnnotationLayer(PDFRendererControlStats pdf_renderer_control_stats, int page)
        {
            this.pdf_renderer_control_stats = pdf_renderer_control_stats;
            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_renderer_control_stats.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_renderer_control_stats);
                        pdf_annotation_item.ResizeToPage(ActualWidth, ActualHeight);
                        Children.Add(pdf_annotation_item);
                    }
                    else
                    {
                        Logging.Info("Not loading deleted annotation on page {0}", page);
                    }
                }
            }
        }
        public PDFReadingControl(PDFDocument pdf_document)
        {
            InitializeComponent();

            pdf_renderer_control = new PDFRendererControl(pdf_document, true);
            pdf_renderer_control.OperationModeChanged += pdf_renderer_control_OperationModeChanged;
            pdf_renderer_control.ZoomTypeChanged      += pdf_renderer_control_ZoomTypeChanged;
            pdf_renderer_control.SelectedPageChanged  += pdf_renderer_control_SelectedPageChanged;

            pdf_renderer_control_stats = new PDFRendererControlStats(pdf_renderer_control, pdf_document);

            Utilities.GUI.Animation.Animations.EnableHoverFade(ObjToolbarGrid);

            // Add the renderer control to our grid
            PDFRendererControlArea.Children.Add(pdf_renderer_control);

            HighlightCanvasToolbar.PDFRendererControl = pdf_renderer_control;
            InkCanvasToolbar.PDFRendererControl       = pdf_renderer_control;
            TextCanvasToolbar.PDFRendererControl      = pdf_renderer_control;

            KeyUp += PDFReadingControl_KeyUp;

            ButtonHand.Icon    = Icons.GetAppIcon(Icons.Hand);
            ButtonHand.ToolTip = LocalisationManager.Get("PDF/TIP/MOVE_PAGE");
            ButtonHand.Click  += ButtonHand_Click;

            ButtonTextSentenceSelect.Icon    = Icons.GetAppIcon(Icons.TextSentenceSelect);
            ButtonTextSentenceSelect.ToolTip = LocalisationManager.Get("PDF/TIP/SELECT_TEXT");
            ButtonTextSentenceSelect.Click  += ButtonTextSentenceSelect_Click;

            ButtonAnnotation.Icon    = Icons.GetAppIcon(Icons.Annotation);
            ButtonAnnotation.ToolTip = LocalisationManager.Get("PDF/TIP/ADD_ANNOTATION");
            ButtonAnnotation.Click  += ButtonAnnotation_Click;

            ButtonHighlighter.Icon    = Icons.GetAppIcon(Icons.Highlighter);
            ButtonHighlighter.ToolTip = LocalisationManager.Get("PDF/TIP/ADD_HIGHLIGHT");
            ButtonHighlighter.Click  += ButtonHighlighter_Click;

            ButtonCamera.Icon    = Icons.GetAppIcon(Icons.Camera);
            ButtonCamera.ToolTip = LocalisationManager.Get("PDF/TIP/SNAPSHOT");
            ButtonCamera.Click  += ButtonCamera_Click;

            ButtonInk.Icon    = Icons.GetAppIcon(Icons.Ink);
            ButtonInk.ToolTip = LocalisationManager.Get("PDF/TIP/ADD_INK");
            ButtonInk.Click  += ButtonInk_Click;

            ButtonExplore.Visibility = ConfigurationManager.Instance.NoviceVisibility;
            ButtonExplore.AttachPopup(ButtonExplorePopup);
            ButtonExplore.Icon    = Icons.GetAppIcon(Icons.Explore);
            ButtonExplore.ToolTip = LocalisationManager.Get("PDF/TIP/EXPLORE");

            ButtonExpedition.Icon    = Icons.GetAppIcon(Icons.ModuleExpedition);
            ButtonExpedition.Caption = LocalisationManager.Get("PDF/TIP/EXPEDITION");
            ButtonExpedition.Click  += ButtonExpedition_Click;

            ButtonExploreInBrainstorm.Icon    = Icons.GetAppIcon(Icons.ModuleBrainstorm);
            ButtonExploreInBrainstorm.Caption = LocalisationManager.Get("PDF/TIP/BRAINSTORM");
            ButtonExploreInBrainstorm.Click  += ButtonExploreInBrainstorm_Click;

            ButtonInCite.AttachPopup(ButtonInCitePopup);
            ButtonInCite.Icon    = Icons.GetAppIcon(Icons.ModuleInCite);
            ButtonInCite.ToolTip = LocalisationManager.Get("PDF/TIP/INCITE");

            ButtonInCite_Word.Icon    = Icons.GetAppIcon(Icons.InCiteNewCitation);
            ButtonInCite_Word.Caption = LocalisationManager.Get("PDF/CAP/CITE_WORD");
            ButtonInCite_Word.Click  += ButtonInCite_Word_Click;

            ButtonInCite_WordSeparate.Icon    = Icons.GetAppIcon(Icons.InCiteNewCitation);
            ButtonInCite_WordSeparate.Caption = LocalisationManager.Get("PDF/CAP/CITE_WORD_SEPARATE");
            ButtonInCite_WordSeparate.Click  += ButtonInCite_WordSeparate_Click;

            ButtonInCite_Snippet.Icon    = Icons.GetAppIcon(Icons.InCiteCitationSnippet);
            ButtonInCite_Snippet.Caption = LocalisationManager.Get("PDF/CAP/CITE_SNIPPET");
            ButtonInCite_Snippet.Click  += ButtonInCite_Snippet_Click;

            ButtonInCite_BibTeXKey.Icon    = Icons.GetAppIcon(Icons.ExportBibTex);
            ButtonInCite_BibTeXKey.Caption = LocalisationManager.Get("PDF/CAP/CITE_BIBTEX");
            ButtonInCite_BibTeXKey.Click  += ButtonInCite_BibTeXKey_Click;

            ButtonFullScreen.Icon    = Icons.GetAppIcon(Icons.DocumentFullScreen);
            ButtonFullScreen.ToolTip = LocalisationManager.Get("PDF/TIP/FULL_SCREEN");
            ButtonFullScreen.Click  += ButtonFullScreen_Click;

            ButtonZoom.AttachPopup(ButtonZoomPopup);
            ButtonZoom.Icon    = Icons.GetAppIcon(Icons.ZoomIn);
            ButtonZoom.ToolTip = LocalisationManager.Get("PDF/TIP/ZOOM");

            Button1Up.Icon    = Icons.GetAppIcon(Icons.Page1Up);
            Button1Up.Caption = LocalisationManager.Get("PDF/TIP/ZOOM_1");
            Button1Up.Click  += Button1Up_Click;

            Button2Up.Icon    = Icons.GetAppIcon(Icons.Page2Up);
            Button2Up.Caption = LocalisationManager.Get("PDF/TIP/ZOOM_2");
            Button2Up.Click  += Button2Up_Click;

            ButtonNUp.Icon    = Icons.GetAppIcon(Icons.PageNUp);
            ButtonNUp.Caption = LocalisationManager.Get("PDF/TIP/ZOOM_N");
            ButtonNUp.Click  += ButtonNUp_Click;

            ButtonWholeUp.Icon    = Icons.GetAppIcon(Icons.PageWholeUp);
            ButtonWholeUp.Caption = LocalisationManager.Get("PDF/TIP/ZOOM_WHOLE");
            ButtonWholeUp.Click  += ButtonWholeUp_Click;

            ButtonRotate.Icon    = Icons.GetAppIcon(Icons.PageRotate);
            ButtonRotate.Caption = LocalisationManager.Get("PDF/TIP/ROTATE");
            ButtonRotate.Click  += ButtonRotate_Click;

            ButtonRotateAll.Icon    = Icons.GetAppIcon(Icons.PageRotate);
            ButtonRotateAll.Caption = LocalisationManager.Get("PDF/TIP/ROTATE_ALL");
            ButtonRotateAll.Click  += ButtonRotateAll_Click;

            ButtonZoomIn.Icon    = Icons.GetAppIcon(Icons.ZoomIn);
            ButtonZoomIn.Caption = LocalisationManager.Get("PDF/TIP/ZOOM_IN");
            ButtonZoomIn.Click  += ButtonZoomIn_Click;

            ButtonZoomOut.Icon    = Icons.GetAppIcon(Icons.ZoomOut);
            ButtonZoomOut.Caption = LocalisationManager.Get("PDF/TIP/ZOOM_OUT");
            ButtonZoomOut.Click  += ButtonZoomOut_Click;

            ButtonMisc.Visibility = ConfigurationManager.Instance.NoviceVisibility;
            ButtonMisc.AttachPopup(ButtonMiscPopup);
            ButtonMisc.Icon    = Icons.GetAppIcon(Icons.DocumentMisc);
            ButtonMisc.ToolTip = LocalisationManager.Get("PDF/TIP/MISC");

            ButtonDocumentSave.Icon    = Icons.GetAppIcon(Icons.DocumentSave);
            ButtonDocumentSave.Caption = LocalisationManager.Get("PDF/TIP/SAVE_COPY");
            ButtonDocumentSave.Click  += ButtonDocumentSave_Click;

            ButtonPrint.Icon    = Icons.GetAppIcon(Icons.Printer);
            ButtonPrint.Caption = LocalisationManager.Get("PDF/TIP/PRINT");
            ButtonPrint.Click  += ButtonPrint_Click;

            ButtonOpenLibrary.Icon    = Icons.GetAppIcon(Icons.ModuleDocumentLibrary);
            ButtonOpenLibrary.Caption = LocalisationManager.Get("PDF/TIP/OPEN_PARENT_LIBRARY");
            ButtonOpenLibrary.Click  += ButtonOpenLibrary_Click;

            ButtonExportToText.Icon    = Icons.GetAppIcon(Icons.ExportToText);
            ButtonExportToText.Caption = LocalisationManager.Get("PDF/TIP/CONVERT_TO_TEXT");
            ButtonExportToText.Click  += ButtonExportToText_Click;

            ButtonReadOutLoud.Icon    = Icons.GetAppIcon(Icons.ReadOutLoud);
            ButtonReadOutLoud.Caption = LocalisationManager.Get("PDF/TIP/READ_ALOUD");
            ButtonReadOutLoud.Click  += ButtonReadOutLoud_Click;

            ButtonSpeedRead.Icon    = Icons.GetAppIcon(Icons.SpeedRead);
            ButtonSpeedRead.Caption = LocalisationManager.Get("PDF/TIP/SPEED_READ");
            ButtonSpeedRead.Click  += ButtonSpeedRead_Click;

            ButtonInvertColours.Icon      = Icons.GetAppIcon(Icons.DocumentsInvertColours);
            ButtonInvertColours.Caption   = LocalisationManager.Get("PDF/TIP/NEGATIVE");
            ButtonInvertColours.IsChecked = false;
            ButtonInvertColours.Click    += ButtonInvertColours_Click;

            ButtonMoreMenus.Icon    = Icons.GetAppIcon(Icons.DocumentMisc);
            ButtonMoreMenus.Caption = LocalisationManager.Get("PDF/TIP/MORE_MENUS");
            ButtonMoreMenus.Click  += ButtonMoreMenus_Click;

            ButtonJumpToSection.Icon    = Icons.GetAppIcon(Icons.JumpToSection);
            ButtonJumpToSection.ToolTip = LocalisationManager.Get("PDF/TIP/BOOKMARKS");
            ButtonJumpToSection.Click  += ButtonJumpToSection_Click;

            ButtonPreviousPage.Icon    = Icons.GetAppIcon(Icons.Previous);
            ButtonPreviousPage.ToolTip = LocalisationManager.Get("PDF/TIP/PAGE_PREV");
            ButtonPreviousPage.Click  += ButtonPreviousPage_Click;

            ButtonNextPage.Icon    = Icons.GetAppIcon(Icons.Next);
            ButtonNextPage.ToolTip = LocalisationManager.Get("PDF/TIP/PAGE_NEXT");
            ButtonNextPage.Click  += ButtonNextPage_Click;

            TextBoxFind.ToolTip       = LocalisationManager.Get("PDF/TIP/SEARCH");
            TextBoxFind.OnHardSearch += TextBoxFind_OnHardSearch;

            Webcasts.FormatWebcastButton(ButtonWebcast, Webcasts.PDF_VIEWER);

            // Make some space
            ToolBar.SetOverflowMode(ButtonPrint, OverflowMode.Always);
            ToolBar.SetOverflowMode(ButtonInvertColours, OverflowMode.Always);
            ToolBar.SetOverflowMode(ButtonCamera, OverflowMode.Always);
            ToolBar.SetOverflowMode(ButtonDocumentSave, OverflowMode.Always);
            ToolBar.SetOverflowMode(ButtonExportToText, OverflowMode.Always);
            ToolBar.SetOverflowMode(ButtonReadOutLoud, OverflowMode.Always);
            ToolBar.SetOverflowMode(ButtonMoreMenus, OverflowMode.Always);

            // Wizard
            WizardDPs.SetPointOfInterest(ButtonAnnotation, "PDFReadingAnnotationButton");

            ListSearchDetails.SearchSelectionChanged += ListSearchDetails_SearchSelectionChanged;
            ListSearchDetails.SearchClicked          += ListSearchDetails_SearchSelectionChanged;

            TagCloud.TagClick += TagCloud_TagClick;

            JumpToPageNumber.Text      = "" + 1;
            JumpToPageNumberMax.Text   = " of " + pdf_renderer_control_stats.pdf_document.PDFRenderer.PageCount;
            JumpToPageNumber.KeyDown  += JumpToPageNumber_KeyDown;
            JumpToPageNumber.KeyUp    += JumpToPageNumber_KeyUp;
            JumpToPageNumber.GotFocus += JumpToPageNumber_GotFocus;
            string tooltip = LocalisationManager.Get("PDF/TIP/PAGE_JUMP");

            JumpToPageNumberLabel.ToolTip = tooltip;
            JumpToPageNumber.ToolTip      = tooltip;

            // The search results are initially hidden
            GridBOTTOM.Visibility = Visibility.Collapsed;

            // Start in hand mode
            pdf_renderer_control.ReconsiderOperationMode(PDFRendererControl.OperationMode.Hand);

            ObjHyperlinkGuestPreviewMoveOther.Click     += ObjHyperlinkGuestPreviewMoveOther_Click;
            ObjHyperlinkGuestPreviewMoveDefault.Click   += ObjHyperlinkGuestPreviewMoveDefault_Click;
            ObjHyperlinkGuestPreviewVanillaAttach.Click += ObjHyperlinkGuestPreviewVanillaAttach_Click;

            ObjReadOnlyInfoBar.Visibility = pdf_document.Library.WebLibraryDetail.IsReadOnly ? Visibility.Visible : Visibility.Collapsed;

            DataContext = pdf_document.Bindable;

            ObjDocumentMetadataControlsPanel.SelectedPageChanged += ObjDocumentMetadataControlsPanel_ObjDocumentMetadataControlsPanel_SelectedPageChanged;

            // Kick off a thread that populates the interesting analysis
            SafeThreadPool.QueueUserWorkItem(o => PDFRendererControlInterestingAnalysis.DoInterestingAnalysis(this, pdf_renderer_control, pdf_renderer_control_stats));

            Loaded += PDFReadingControl_Loaded;
        }
示例#12
0
        public LibraryControl(WebLibraryDetail web_library_detail)
        {
            Theme.Initialize();

            Logging.Debug("+LibraryControl()");

            this.web_library_detail          = web_library_detail;
            dual_tab_drag_to_library_manager = new DragToLibraryManager(web_library_detail);

            InitializeComponent();

            ImageLibraryEmptyAddFiles.Source = Icons.GetAppIcon(Icons.LibraryEmptyAddFiles);
            RenderOptions.SetBitmapScalingMode(ImageLibraryEmptyAddFiles, BitmapScalingMode.HighQuality);
            ImageLibraryMissingBibTeX.Source = Icons.GetAppIcon(Icons.BibTexSniffer);
            RenderOptions.SetBitmapScalingMode(ImageLibraryMissingBibTeX, BitmapScalingMode.HighQuality);

            bool ADVANCED_MENUS = ConfigurationManager.Instance.ConfigurationRecord.GUI_AdvancedMenus;

            // Connect the dropdowns
            ButtonAddPDF.AttachPopup(ButtonAddPDFPopup);
            ButtonAddPDF.Icon = Icons.GetAppIcon(Icons.DocumentsAddToLibrary);
            if (!ADVANCED_MENUS)
            {
                ButtonAddPDF.Caption = LocalisationManager.Get("LIBRARY/CAP/POPUP_ADD_DOCUMENTS");
            }
            ButtonAddPDF.ToolTip = LocalisationManager.Get("LIBRARY/TIP/POPUP_ADD_DOCUMENTS");

            ButtonSync.AttachPopup(ButtonSyncPopup);
            ButtonSync.Icon = Icons.GetAppIcon(Icons.SyncWithCloud);
            if (!ADVANCED_MENUS)
            {
                ButtonSync.Caption = LocalisationManager.Get("LIBRARY/CAP/POPUP_SYNC");
            }
            ButtonSync.ToolTip = LocalisationManager.Get("LIBRARY/TIP/POPUP_SYNC");

            // Then the menus
            ButtonAddVanillaReference.Icon    = Icons.GetAppIcon(Icons.New);
            ButtonAddVanillaReference.Caption = LocalisationManager.Get("LIBRARY/CAP/ADD_REFERENCE");
            ButtonAddVanillaReference.ToolTip = LocalisationManager.Get("LIBRARY/TIP/ADD_REFERENCE");
            ButtonAddVanillaReference.Click  += ButtonAddVanillaReference_Click;

            ButtonSyncMetadaWithCloud.Icon    = Icons.GetAppIcon(Icons.SyncWithCloud);
            ButtonSyncMetadaWithCloud.Caption = LocalisationManager.Get("LIBRARY/CAP/PARTIAL_SYNC");
            ButtonSyncMetadaWithCloud.ToolTip = LocalisationManager.Get("LIBRARY/TIP/PARTIAL_SYNC");
            ButtonSyncMetadaWithCloud.Click  += ButtonSyncMetadaWithCloud_Click;

            ButtonSyncAllPDFsWithCloud.Icon    = Icons.GetAppIcon(Icons.SyncPDFsWithCloud);
            ButtonSyncAllPDFsWithCloud.Caption = LocalisationManager.Get("LIBRARY/CAP/FULL_SYNC");
            ButtonSyncAllPDFsWithCloud.ToolTip = LocalisationManager.Get("LIBRARY/TIP/FULL_SYNC");
            ButtonSyncAllPDFsWithCloud.Click  += ButtonSyncPDFsWithCloud_Click;

            ButtonSyncDetails.Icon    = Icons.GetAppIcon(Icons.SyncDetails);
            ButtonSyncDetails.Caption = LocalisationManager.Get("LIBRARY/CAP/SYNC_DETAILS");
            ButtonSyncDetails.ToolTip = LocalisationManager.Get("LIBRARY/TIP/SYNC_DETAILS");
            ButtonSyncDetails.Click  += ButtonSyncDetails_Click;

            ButtonEdit.Icon    = Icons.GetAppIcon(Icons.Open);
            ButtonEdit.Caption = LocalisationManager.Get("LIBRARY/CAP/EDIT");
            ButtonEdit.ToolTip = LocalisationManager.Get("LIBRARY/TIP/EDIT");
            ButtonEdit.Click  += ButtonEdit_Click;

            ButtonDelete.Icon    = Icons.GetAppIcon(Icons.Open);
            ButtonDelete.Caption = LocalisationManager.Get("LIBRARY/CAP/DELETE");
            ButtonDelete.ToolTip = LocalisationManager.Get("LIBRARY/TIP/DELETE");
            ButtonDelete.Click  += ButtonDelete_Click;

            ButtonAnnotationsReport.Icon = Icons.GetAppIcon(Icons.LibraryAnnotationsReport);
            if (!ADVANCED_MENUS)
            {
                ButtonAnnotationsReport.Caption = LocalisationManager.Get("LIBRARY/CAP/ANNOTATION_REPORT");
            }
            ButtonAnnotationsReport.ToolTip = LocalisationManager.Get("LIBRARY/TIP/ANNOTATION_REPORT");
            ButtonAnnotationsReport.Click  += ButtonAnnotationsReport_Click;
            WizardDPs.SetPointOfInterest(ButtonAnnotationsReport, "LibraryAnnotationReportButton");

            ButtonGenerateReferences.Visibility = ConfigurationManager.Instance.NoviceVisibility;
            ButtonGenerateReferences.Icon       = Icons.GetAppIcon(Icons.LibraryGenerateReferences);
            if (!ADVANCED_MENUS)
            {
                ButtonGenerateReferences.Caption = LocalisationManager.Get("LIBRARY/CAP/FIND_REFERENCES");
            }
            ButtonGenerateReferences.ToolTip = LocalisationManager.Get("LIBRARY/TIP/FIND_REFERENCES");
            ButtonGenerateReferences.Click  += ButtonGenerateReferences_Click;

            ButtonFindDuplicates.Visibility = ConfigurationManager.Instance.NoviceVisibility;
            ButtonFindDuplicates.Icon       = Icons.GetAppIcon(Icons.LibraryFindDuplicates);
            if (!ADVANCED_MENUS)
            {
                ButtonFindDuplicates.Caption = LocalisationManager.Get("LIBRARY/CAP/FIND_DUPLICATES");
            }
            ButtonFindDuplicates.ToolTip = LocalisationManager.Get("LIBRARY/TIP/FIND_DUPLICATES");
            ButtonFindDuplicates.Click  += ButtonFindDuplicates_Click;

            ButtonBibTexSniffer.Icon = Icons.GetAppIcon(Icons.BibTexSniffer);
            if (!ADVANCED_MENUS)
            {
                ButtonBibTexSniffer.Caption = LocalisationManager.Get("LIBRARY/CAP/BIBTEX_SNIFFER");
            }
            ButtonBibTexSniffer.ToolTip = LocalisationManager.Get("LIBRARY/TIP/BIBTEX_SNIFFER");
            ButtonBibTexSniffer.Click  += ButtonBibTexSniffer_Click;

            ButtonExplore.AttachPopup(ButtonExplorePopup);
            ButtonExplore.Icon = Icons.GetAppIcon(Icons.Explore);
            if (!ADVANCED_MENUS)
            {
                ButtonExplore.Caption = LocalisationManager.Get("LIBRARY/CAP/EXPLORE");
            }
            ButtonExplore.ToolTip    = LocalisationManager.Get("LIBRARY/TIP/EXPLORE");
            ButtonExplore.Visibility = ConfigurationManager.Instance.NoviceVisibility;

            ButtonExpedition.Icon    = Icons.GetAppIcon(Icons.ModuleExpedition);
            ButtonExpedition.Caption = LocalisationManager.Get("LIBRARY/TIP/EXPEDITION");
            ButtonExpedition.Click  += ButtonExpedition_Click;

            ButtonExploreInBrainstorm.Icon    = Icons.GetAppIcon(Icons.ModuleBrainstorm);
            ButtonExploreInBrainstorm.Caption = LocalisationManager.Get("LIBRARY/TIP/BRAINSTORM");
            ButtonExploreInBrainstorm.Click  += ButtonExploreInBrainstorm_Click;

            ButtonExploreInPivot.Icon    = Icons.GetAppIcon(Icons.LibraryPivot);
            ButtonExploreInPivot.Caption = LocalisationManager.Get("LIBRARY/TIP/PIVOT");
            ButtonExploreInPivot.Click  += ButtonExploreInPivot_Click;

            ButtonExport.AttachPopup(ButtonExportPopup);
            ButtonExport.Icon = Icons.GetAppIcon(Icons.LibraryExport);
            if (!ADVANCED_MENUS)
            {
                ButtonExport.Caption = LocalisationManager.Get("LIBRARY/CAP/POPUP_EXPORT");
            }
            ButtonExport.ToolTip    = LocalisationManager.Get("LIBRARY/TIP/POPUP_EXPORT");
            ButtonExport.Visibility = ConfigurationManager.Instance.NoviceVisibility;

            ButtonExportLibrary.Icon    = Icons.GetAppIcon(Icons.LibraryExport);
            ButtonExportLibrary.Caption = LocalisationManager.Get("LIBRARY/CAP/EXPORT_LIBRARY");
            ButtonExportLibrary.ToolTip = LocalisationManager.Get("LIBRARY/TIP/EXPORT_LIBRARY");
            ButtonExportLibrary.Click  += ButtonExportLibrary_Click;

            ButtonExportBibTex.Icon    = Icons.GetAppIcon(Icons.ExportBibTex);
            ButtonExportBibTex.Caption = LocalisationManager.Get("LIBRARY/CAP/EXPORT_BIBTEX");
            ButtonExportBibTex.ToolTip = LocalisationManager.Get("LIBRARY/TIP/EXPORT_BIBTEX");
            ButtonExportBibTex.Click  += ButtonExportBibTex_Click;

            ButtonExportWord2007.Icon    = Icons.GetAppIcon(Icons.ExportWord2007);
            ButtonExportWord2007.Caption = LocalisationManager.Get("LIBRARY/CAP/EXPORT_WORD");
            ButtonExportWord2007.ToolTip = LocalisationManager.Get("LIBRARY/TIP/EXPORT_WORD");
            ButtonExportWord2007.Click  += ButtonExportWord2007_Click;

            ButtonExportCitationMatrix.Icon    = Icons.GetAppIcon(Icons.ExportCitationMatrix);
            ButtonExportCitationMatrix.Caption = LocalisationManager.Get("LIBRARY/CAP/EXPORT_CITATION_MATRIX");
            ButtonExportCitationMatrix.ToolTip = LocalisationManager.Get("LIBRARY/TIP/EXPORT_CITATION_MATRIX");
            ButtonExportCitationMatrix.Click  += ButtonExportCitationMatrix_Click;

            ButtonExportLinkedDocs.Icon    = Icons.GetAppIcon(Icons.ExportCitationMatrix);
            ButtonExportLinkedDocs.Caption = LocalisationManager.Get("LIBRARY/CAP/EXPORT_LINKED_DOCS");
            ButtonExportLinkedDocs.ToolTip = LocalisationManager.Get("LIBRARY/TIP/EXPORT_LINKED_DOCS");
            ButtonExportLinkedDocs.Click  += ButtonExportLinkedDocs_Click;

            ButtonBuildBundleLibrary.Icon    = Icons.GetAppIcon(Icons.BuildBundleLibrary);
            ButtonBuildBundleLibrary.Caption = LocalisationManager.Get("LIBRARY/CAP/BUILD_BUNDLE_LIBRARY");
            ButtonBuildBundleLibrary.ToolTip = LocalisationManager.Get("LIBRARY/TIP/BUILD_BUNDLE_LIBRARY");
            ButtonBuildBundleLibrary.Click  += ButtonBuildBundleLibrary_Click;

            ButtonExportAnnotationsCode.Icon    = Icons.GetAppIcon(Icons.ExportBibTex);
            ButtonExportAnnotationsCode.Caption = LocalisationManager.Get("LIBRARY/CAP/EXPORT_ANNOTATIONS_CODE");
            ButtonExportAnnotationsCode.ToolTip = LocalisationManager.Get("LIBRARY/TIP/EXPORT_ANNOTATIONS_CODE");
            ButtonExportAnnotationsCode.Click  += ButtonExportAnnotationsCode_Click;

            ButtonAddDocuments.Icon    = Icons.GetAppIcon(Icons.DocumentsAddToLibrary);
            ButtonAddDocuments.Caption = LocalisationManager.Get("LIBRARY/CAP/ADD_DOCUMENTS");
            ButtonAddDocuments.ToolTip = LocalisationManager.Get("LIBRARY/TIP/ADD_DOCUMENTS");
            ButtonAddDocuments.Click  += ButtonAddDocuments_Click;

            ButtonAddDocumentsFromFolder.Icon    = Icons.GetAppIcon(Icons.DocumentsAddToLibraryFromFolder);
            ButtonAddDocumentsFromFolder.Caption = LocalisationManager.Get("LIBRARY/CAP/ADD_FOLDER");
            ButtonAddDocumentsFromFolder.ToolTip = LocalisationManager.Get("LIBRARY/TIP/ADD_FOLDER");
            ButtonAddDocumentsFromFolder.Click  += ButtonAddDocumentsFromFolder_Click;

            ButtonAddDocumentsFromLibrary.Icon    = Icons.GetAppIcon(Icons.DocumentsAddToLibraryFromLibrary);
            ButtonAddDocumentsFromLibrary.Caption = LocalisationManager.Get("LIBRARY/CAP/ADD_LIBRARY");
            ButtonAddDocumentsFromLibrary.ToolTip = LocalisationManager.Get("LIBRARY/TIP/ADD_LIBRARY");
            ButtonAddDocumentsFromLibrary.Click  += ButtonAddDocumentsFromLibrary_Click;

            ButtonWatchFolder.Icon    = Icons.GetAppIcon(Icons.DocumentsWatchFolder);
            ButtonWatchFolder.Caption = LocalisationManager.Get("LIBRARY/CAP/WATCH_FOLDER");
            ButtonWatchFolder.ToolTip = LocalisationManager.Get("LIBRARY/TIP/WATCH_FOLDER");
            ButtonWatchFolder.Click  += ButtonWatchFolder_Click;

            ButtonImportFromThirdParty.Icon    = Icons.GetAppIcon(Icons.DocumentsImportFromThirdParty);
            ButtonImportFromThirdParty.Caption = LocalisationManager.Get("LIBRARY/CAP/ADD_IMPORT");
            ButtonImportFromThirdParty.ToolTip = LocalisationManager.Get("LIBRARY/TIP/ADD_IMPORT");
            ButtonImportFromThirdParty.Click  += ButtonImportFromThirdParty_Click;

            ButtonAddMissingDocumentsFromSelf.Icon    = Icons.GetAppIcon(Icons.DocumentsAddMissingFromSelf);
            ButtonAddMissingDocumentsFromSelf.Caption = "Recover unregistered PDFs in this library";
            ButtonAddMissingDocumentsFromSelf.ToolTip = "This is a live library recovery/restoration operation: inspect the current library's storage and re-register all PDFs in there, which have not been registered in the library already.";
            ButtonAddMissingDocumentsFromSelf.Click  += ButtonAddMissingDocumentsFromSelf_Click;

            ObjLibraryEmptyDescriptionText.Background = ThemeColours.Background_Brush_Blue_LightToDark;

            // Tie all our GUI objects together
            ObjLibraryFilterControl.library_filter_control_search = ObjLibraryFilterControl_Search;
            ObjLibraryFilterControl_Search.library_filter_control = ObjLibraryFilterControl;

            ObjLibraryFilterControl.OnFilterChanged += ObjLibraryFilterControl_OnFilterChanged;
            ObjLibraryFilterControl.OnFilterChanged += ObjLibraryFilterOverviewControl.OnFilterChanged;
            ObjLibraryFilterControl.OnFilterChanged += ObjLibraryCatalogControl.OnFilterChanged;

            ObjLibraryFilterControl.LibraryRef = web_library_detail;
            ObjLibraryFilterControl.ResetFilters(true);

            ObjLibraryCatalogControl.LibraryRef = web_library_detail;

            // Catch some keyboard commands
            KeyDown += LibraryControl_KeyDown;

            if (!ADVANCED_MENUS)
            {
                ButtonWebcast.Caption = "Tutorial\n";
            }
            Webcasts.FormatWebcastButton(ButtonWebcast, Webcasts.LIBRARY);

            // IF the library is read-only?
            ReflectReadOnlyStatus();

            Logging.Debug("-LibraryControl()");
        }
示例#13
0
        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);
                });
            });
        }
示例#14
0
        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);
            }
        }
        private void UpdateLibraryStatistics_Headers()
        {
            TextLibraryCount.Text = "";

            PanelForHyperlinks.Visibility   = Visibility.Collapsed;
            PanelForget.Visibility          = Visibility.Collapsed;
            PanelLocateSyncPoint.Visibility = Visibility.Collapsed;
            PanelViewOnline.Visibility      = Visibility.Collapsed;
            PanelInviteAndShare.Visibility  = Visibility.Collapsed;
            PanelEditDelete.Visibility      = Visibility.Collapsed;
            PanelTopUp.Visibility           = Visibility.Collapsed;
            PanelPurge.Visibility           = Visibility.Collapsed;

            ButtonAutoSync.Visibility = Visibility.Collapsed;
            ButtonReadOnly.Visibility = Visibility.Collapsed;

            if (null != web_library_detail)
            {
                TextLibraryCount.Text = String.Format("{0} document(s) in this library", web_library_detail.library.PDFDocuments_IncludingDeleted_Count);

                //TextLibraryCount.Text =
                //    String.Format(
                //    " ({0} documents, last synced on {1})",
                //    web_library_detail.library.PDFDocuments.Count,
                //    web_library_detail.LastSynced.HasValue ? web_library_detail.LastSynced.Value.ToString() : "Never"
                //    );

                // The wizard stuff
                if (web_library_detail.IsLocalGuestLibrary)
                {
                    WizardDPs.SetPointOfInterest(ButtonIcon, "GuestLibraryOpenButton");
                    WizardDPs.SetPointOfInterest(TxtTitle, "GuestLibraryTitle");
                }

                // The icon stuff
                {
                    RenderOptions.SetBitmapScalingMode(ButtonIcon, BitmapScalingMode.HighQuality);
                    ButtonIcon.Width  = 64;
                    ButtonIcon.Height = 64;

                    if (web_library_detail.IsWebLibrary)
                    {
                        ButtonIcon.Source  = Icons.GetAppIcon(Icons.LibraryTypeWeb);
                        ButtonIcon.ToolTip = "This is a Web Library.\nYou can sync it via the cloud to access it online or on your other devices.";
                    }
                    else if (web_library_detail.IsIntranetLibrary)
                    {
                        ButtonIcon.Source  = Icons.GetAppIcon(Icons.LibraryTypeIntranet);
                        ButtonIcon.ToolTip = "This is an Intranet Library.\nYou can sync it via your Intranet to share with colleagues and across your company computers.";
                    }
                    else if (web_library_detail.IsLocalGuestLibrary)
                    {
                        ButtonIcon.Source  = Icons.GetAppIcon(Icons.LibraryTypeGuest);
                        ButtonIcon.ToolTip = "This is a Guest Library.\nIts contents remain local to this computer and can not be synced.";
                    }
                    else if (web_library_detail.IsBundleLibrary)
                    {
                        ButtonIcon.Source  = Icons.GetAppIcon(Icons.LibraryTypeBundle);
                        ButtonIcon.ToolTip = "This is a Bundle Library.\nIt's contents will be updated automatically when the Bundle is updates by it's administrator.";
                    }
                    else
                    {
                        ButtonIcon.Source  = null;
                        ButtonIcon.ToolTip = null;
                    }
                }

                // The customization images stuff
                {
                    string image_filename = CustomBackgroundFilename;
                    if (File.Exists(image_filename))
                    {
                        try
                        {
                            ObjTitleImage.Source = BitmapImageTools.FromImage(ImageLoader.Load(image_filename));
                        }
                        catch (Exception ex)
                        {
                            Logging.Warn(ex, "Problem with custom library background.");
                        }
                    }
                    else
                    {
                        ObjTitleImage.Source = null;
                    }
                }

                {
                    string image_filename = CustomIconFilename;
                    if (File.Exists(image_filename))
                    {
                        try
                        {
                            ButtonIcon.Source = BitmapImageTools.FromImage(ImageLoader.Load(image_filename));
                        }
                        catch (Exception ex)
                        {
                            Logging.Warn(ex, "Problem with custom library icon.");
                        }
                    }
                }


                // The autosync stuff
                if (web_library_detail.IsWebLibrary || web_library_detail.IsIntranetLibrary)
                {
                    ButtonAutoSync.Visibility = Visibility.Visible;
                    ButtonAutoSync.IsChecked  = web_library_detail.AutoSync;
                }

                // The readonly stuff
                if (web_library_detail.IsReadOnly)
                {
                    ButtonReadOnly.Visibility = Visibility.Visible;
                }

                // The hyperlinks panel
                if (web_library_detail.IsWebLibrary)
                {
                    PanelForHyperlinks.Visibility = Visibility.Visible;

                    PanelViewOnline.Visibility = Visibility.Visible;
                    PanelTopUp.Visibility      = Visibility.Visible;

                    if (web_library_detail.IsAdministrator)
                    {
                        PanelInviteAndShare.Visibility = Visibility.Visible;
                        PanelEditDelete.Visibility     = Visibility.Visible;
                    }

                    if (web_library_detail.Deleted)
                    {
                        PanelPurge.Visibility = Visibility.Visible;
                    }
                }

                if (web_library_detail.IsIntranetLibrary)
                {
                    PanelForHyperlinks.Visibility   = Visibility.Visible;
                    PanelForget.Visibility          = Visibility.Visible;
                    PanelLocateSyncPoint.Visibility = Visibility.Visible;
                }

                if (web_library_detail.IsBundleLibrary)
                {
                    PanelForHyperlinks.Visibility = Visibility.Visible;
                    PanelForget.Visibility        = Visibility.Visible;
                }
            }
        }
示例#16
0
        private void UpdateLibraryStatistics_Headers()
        {
            WPFDoEvents.AssertThisCodeIsRunningInTheUIThread();

            TextLibraryCount.Text = "";

            PanelForHyperlinks.Visibility   = Visibility.Visible;
            PanelForget.Visibility          = Visibility.Collapsed;
            PanelSetSyncPoint.Visibility    = Visibility.Collapsed;
            PanelLocateSyncPoint.Visibility = Visibility.Collapsed;
            PanelEdit.Visibility            = Visibility.Collapsed;
            PanelDelete.Visibility          = Visibility.Collapsed;
            PanelPurge.Visibility           = Visibility.Collapsed;

            ButtonAutoSync.Visibility = Visibility.Collapsed;
            ButtonReadOnly.Visibility = Visibility.Collapsed;

            ObjTitleImage.Source = null;

            // Store the web library details
            WebLibraryDetail web_library_detail = DataContext as WebLibraryDetail;

            // No need to wait until the library has been completely loaded!
            drag_to_library_manager.DefaultLibrary = web_library_detail;

            if (null != web_library_detail)
            {
                if (!web_library_detail.IsIntranetLibrary)
                {
                    TextLibraryCount.Text = String.Format("{0} document(s) in this library", web_library_detail.Xlibrary?.PDFDocuments_IncludingDeleted_Count ?? 0);
                }
                else
                {
                    TextLibraryCount.Text = String.Format("{0} document(s) in this library, {1}",
                                                          web_library_detail.Xlibrary?.PDFDocuments_IncludingDeleted_Count ?? 0,
                                                          web_library_detail.LastSynced.HasValue ? $"which was last synced on {web_library_detail.LastSynced.Value}" : @"which has never been synced yet");
                }

                // The wizard stuff
                if (ConfigurationManager.Instance.ConfigurationRecord.GUI_IsNovice)
                {
                    WizardDPs.SetPointOfInterest(ButtonIcon, "GuestLibraryOpenButton");
                    WizardDPs.SetPointOfInterest(TxtTitle, "GuestLibraryTitle");
                }

                // The icon stuff
                {
                    RenderOptions.SetBitmapScalingMode(ButtonIcon, BitmapScalingMode.HighQuality);
                    ButtonIcon.Width  = 64;
                    ButtonIcon.Height = 64;

                    if (web_library_detail.IsIntranetLibrary)
                    {
                        ButtonIcon.Source = Icons.GetAppIcon(Icons.LibraryTypeWeb);
                        //ButtonIcon.Source = Icons.GetAppIcon(Icons.LibraryTypeIntranet);
                        ButtonIcon.ToolTip = "This is an Intranet Library.\nYou can sync it via your Intranet to share with colleagues and across your company computers. Alternatively you can sync to a folder in Cloud Storage such as DropBox, Google Drive or Microsoft OneDrive and anyone with access to that shared folder can sync with your library.";
                    }
                    else if (web_library_detail.IsBundleLibrary)
                    {
                        ButtonIcon.Source  = Icons.GetAppIcon(Icons.LibraryTypeBundle);
                        ButtonIcon.ToolTip = "This is a Bundle Library.\nIt's contents will be updated automatically when the Bundle is updated by it's administrator.";
                    }
                    else
                    {
                        ButtonIcon.Source  = Icons.GetAppIcon(Icons.LibraryTypeGuest);
                        ButtonIcon.ToolTip = "This is a local Library.\nIts contents are local to this computer. When you assign this library a Sync Point, it can be synchronized with that backup location and possibly shared with other people and machines.";
                    }
                }

                // The customization images stuff
                {
                    string image_filename = CustomBackgroundFilename();
                    if (File.Exists(image_filename))
                    {
                        try
                        {
                            ObjTitleImage.Source = BitmapImageTools.FromImage(ImageLoader.Load(image_filename));
                        }
                        catch (Exception ex)
                        {
                            Logging.Warn(ex, "Problem with custom library background.");
                        }
                    }
                }

                {
                    string image_filename = CustomIconFilename();
                    if (File.Exists(image_filename))
                    {
                        try
                        {
                            ButtonIcon.Source = BitmapImageTools.FromImage(ImageLoader.Load(image_filename));
                        }
                        catch (Exception ex)
                        {
                            Logging.Warn(ex, "Problem with custom library icon.");
                        }
                    }
                }

                // The autosync stuff
                if (web_library_detail.IsIntranetLibrary)
                {
                    ButtonAutoSync.Visibility = Visibility.Visible;
                    ButtonAutoSync.IsChecked  = web_library_detail.AutoSync;
                }

                // The readonly stuff
                if (web_library_detail.IsReadOnlyLibrary)
                {
                    ButtonReadOnly.Visibility = Visibility.Visible;
                }

                // The hyperlinks panel
                PanelEdit.Visibility   = Visibility.Visible;
                PanelDelete.Visibility = Visibility.Visible;
                PanelForget.Visibility = Visibility.Visible;
                //PanelSetSyncPoint.Visibility = Visibility.Visible;
                //PanelLocateSyncPoint.Visibility = Visibility.Visible;
                PanelEdit.Visibility   = Visibility.Visible;
                PanelDelete.Visibility = Visibility.Visible;
                //PanelPurge.Visibility = Visibility.Visible;

                if (web_library_detail.Deleted)
                {
                    PanelPurge.Visibility = Visibility.Visible;
                }

                if (web_library_detail.IsIntranetLibrary)
                {
                    PanelLocateSyncPoint.Visibility = Visibility.Visible;
                }

                if (!web_library_detail.IsReadOnlyLibrary)
                {
                    PanelSetSyncPoint.Visibility = Visibility.Visible;
                }
            }
        }