Пример #1
0
 private static void OnInitialDocumentUrlPropertyChanged(Object sender, DependencyPropertyChangedEventArgs e)
 {
     if (e.NewValue != null)
     {
         ReaderControl source = (ReaderControl)sender;
         string        url    = e.NewValue as string;
         //source.LoadDocument(url);
     }
 }
Пример #2
0
        private int CountNumberOfTools(ReaderControl s)
        {
            int i = 0;


            if (s.EnableOpenLocalFileControl)
            {
                i++;
            }
            if (s.EnablePageNumberControl)
            {
                i++;
            }
            if (s.EnablePageNavigationControl)
            {
                i++;
            }

            if (s.EnableRotateControl)
            {
                i++;
            }
            if (s.EnableLayoutControl)
            {
                i++;
            }

            if (s.EnableZoomSliderControl)
            {
                i++;
            }
            if (s.EnableZoomTextBoxControl)
            {
                i++;
            }

            if (s.EnableFitModeControl)
            {
                i++;
            }
            if (s.EnableToolModeControl)
            {
                i++;
            }
            if (s.EnablePrintControl)
            {
                i++;
            }
            if (s.EnableFullScreenControl)
            {
                i++;
            }

            return(i);
        }
Пример #3
0
        private static void OnShowToolbarPropertyChanged(Object sender, DependencyPropertyChangedEventArgs e)
        {
            ReaderControl source = (ReaderControl)sender;

            if ((bool)e.NewValue)
            {
                source.DocumentToolbar.Visibility = Visibility.Visible;
            }
            else
            {
                source.DocumentToolbar.Visibility = Visibility.Collapsed;
            }
        }
Пример #4
0
 public LayoutControl(ReaderControl readerControl)
 {
     InitializeComponent();
     this._readerControl             = readerControl;
     ImagePathArray                  = new string[6];
     ImagePathArray[0]               = "/ReaderControl;component/Resources/page_cont.png";
     ImagePathArray[1]               = "/ReaderControl;component/Resources/page_facing_cont.png";
     ImagePathArray[2]               = "/ReaderControl;component/Resources/page_cover_facing_cont.png";
     ImagePathArray[3]               = "/ReaderControl;component/Resources/page_single.png";
     ImagePathArray[4]               = "/ReaderControl;component/Resources/page_facing.png";
     ImagePathArray[5]               = "/ReaderControl;component/Resources/page_cover_facing.png";
     _readerControl.PropertyChanged += new System.ComponentModel.PropertyChangedEventHandler(_readerControl_PropertyChanged);
     UpdateButtonIcon();
 }
 public LayoutControl(ReaderControl readerControl)
 {
     InitializeComponent();
     this._readerControl = readerControl;
     ImagePathArray = new string[6];
     ImagePathArray[0] = "/ReaderControl;component/Resources/page_cont.png";
     ImagePathArray[1] = "/ReaderControl;component/Resources/page_facing_cont.png";
     ImagePathArray[2] = "/ReaderControl;component/Resources/page_cover_facing_cont.png";
     ImagePathArray[3] = "/ReaderControl;component/Resources/page_single.png";
     ImagePathArray[4] = "/ReaderControl;component/Resources/page_facing.png";
     ImagePathArray[5] = "/ReaderControl;component/Resources/page_cover_facing.png";
     _readerControl.PropertyChanged += new System.ComponentModel.PropertyChangedEventHandler(_readerControl_PropertyChanged);
     UpdateButtonIcon();
 }
        /// <summary>
        /// Creates a side window based on customization options from ReaderControl
        /// </summary>
        /// <param name="readerControl">a ReaderControl that holds customization options </param>
        public void CreateSideWindow(ReaderControl readerControl)
        {
            if (readerControl.EnableOutlineTreeControl)
            {
                OutlineTreeControl outlineTree = new OutlineTreeControl();
                this.OutlineTabItem.Content    = outlineTree;
                this.OutlineTabItem.Visibility = Visibility.Visible;
            }

            if (readerControl.EnableThumbnailListControl)
            {
                ThumbnailsControl thumbnailViewer = new ThumbnailsControl()
                {
                    Background  = new SolidColorBrush(Colors.White),
                    Foreground  = new SolidColorBrush(Colors.Black),
                    ScaleFactor = 1,
                };

                this.ThumbnailTabItem.Content    = thumbnailViewer;
                this.ThumbnailTabItem.Visibility = Visibility.Visible;

                if (!readerControl.EnableOutlineTreeControl)
                {
                    this.ThumbnailTabItem.IsSelected = true;
                }
            }

            if (readerControl.EnableFullTextSearchControl)
            {
                SearchPanelControl searchPanel = new SearchPanelControl();
                this.SearchTabItem.Visibility = Visibility.Visible;
                this.SearchTabItem.Content    = searchPanel;
                //FullTextSearchControl wholeDocumentViewerControl = new FullTextSearchControl();
                //this.SearchTabItem.Visibility = Visibility.Visible;
                //this.SearchTabItem.Content = wholeDocumentViewerControl;
            }

            if (readerControl.EnableAnnotationWindowControl)
            {
                var annotationControl = new AnnotationWindowControl();

                this.AnnotationTabItem.Visibility = Visibility.Visible;
                this.AnnotationTabItem.Content    = annotationControl;
            }
        }
        /// <summary>
        /// Creates a side window based on customization options from ReaderControl
        /// </summary>
        /// <param name="readerControl">a ReaderControl that holds customization options </param>
        public void CreateSideWindow(ReaderControl readerControl)
        {
            if (readerControl.EnableOutlineTreeControl)
            {
                OutlineTreeControl outlineTree = new OutlineTreeControl();
                this.OutlineTabItem.Content = outlineTree;
                this.OutlineTabItem.Visibility = Visibility.Visible;
            }

            if (readerControl.EnableThumbnailListControl)
            {
                ThumbnailsControl thumbnailViewer = new ThumbnailsControl()
                {
                    Background = new SolidColorBrush(Colors.White),
                    Foreground = new SolidColorBrush(Colors.Black),
                    ScaleFactor = 1,
                };

                this.ThumbnailTabItem.Content = thumbnailViewer;
                this.ThumbnailTabItem.Visibility = Visibility.Visible;

                if (!readerControl.EnableOutlineTreeControl)
                    this.ThumbnailTabItem.IsSelected = true;
            }

            if (readerControl.EnableFullTextSearchControl)
            {
                SearchPanelControl searchPanel = new SearchPanelControl();
                this.SearchTabItem.Visibility = Visibility.Visible;
                this.SearchTabItem.Content = searchPanel;
                //FullTextSearchControl wholeDocumentViewerControl = new FullTextSearchControl();
                //this.SearchTabItem.Visibility = Visibility.Visible;
                //this.SearchTabItem.Content = wholeDocumentViewerControl;
            }

            if (readerControl.EnableAnnotationWindowControl)
            {
                var annotationControl = new AnnotationWindowControl();

                this.AnnotationTabItem.Visibility = Visibility.Visible;
                this.AnnotationTabItem.Content = annotationControl;
            }
        }
        /// <summary>
        /// Creates a new instance of the OutlineToggleButtonControl
        /// </summary>
        /// <param name="reader">The ReaderControl that is the target of the outline toggling</param>
        public OutlineToggleButtonControl(ReaderControl reader)
        {
            InitializeComponent();

            this.DataContext = reader;
            expandedImage = new BitmapImage(new Uri("/ReaderControl;component/Resources/section_expanded.png", UriKind.Relative));
            collapsedImage = new BitmapImage(new Uri("/ReaderControl;component/Resources/section_collapsed.png", UriKind.Relative));

            if (reader.ShowSideWindow)
            {
                this.NavigationToggleImage.Source = expandedImage;
                this.ToolTipTextBlock.Text = "Hide outline navigation";
            }
            else
            {
                this.NavigationToggleImage.Source = collapsedImage;
                this.ToolTipTextBlock.Text = "Show outline navigation";
            }
        }
Пример #9
0
        private static void OnShowSideWindowPropertyChanged(Object sender, DependencyPropertyChangedEventArgs e)
        {
            ReaderControl source = (ReaderControl)sender;

            source.SetSideWindowVisible((bool)e.NewValue);
        }
        /// <summary>
        /// Creates a toolbar based on customization options from ReaderControl
        /// </summary>
        /// <param name="reader">a ReaderControl that holds customization options </param>
        public void CreateToolbar(ReaderControl reader)
        {
            // first group of tools: outline toggle
            if (reader.EnableOutlineToggleControl)
            {
                this.LeftToolStackPanel.Children.Add(new OutlineToggleButtonControl(reader));
            }

            int toolsLeft = CountNumberOfTools(reader);
            int i = 0;

            if (reader.EnableOpenLocalFileControl)
            {
                this.ToolStackPanel.Children.Add(new OpenLocalFileButtonControl(reader));
                i++;
            }

            // add divider if necessary
            toolsLeft = toolsLeft - i;
            if (i > 0 && toolsLeft > 0)
            {
                this.ToolStackPanel.Children.Add(new DividerControl());
                i = 0;
            }

            // next group of tools: Page
            if (reader.EnablePageNumberControl)
            {
                this.ToolStackPanel.Children.Add(new PageNumberControl());
                i++;
            }

            // add divider if necessary
            toolsLeft = toolsLeft - i;
            if (i > 0 && toolsLeft > 0)
            {
                this.ToolStackPanel.Children.Add(new DividerControl());
                i = 0;
            }

            if (reader.EnableLayoutControl)
            {
                this.ToolStackPanel.Children.Add(new LayoutControl(reader));
                i++;
            }

            // add divider if necessary
            toolsLeft = toolsLeft - i;
            if (i > 0 && toolsLeft > 0)
            {
                this.ToolStackPanel.Children.Add(new DividerControl());
                i = 0;
            }

            if (reader.EnableRotateControl)
            {
                this.ToolStackPanel.Children.Add(new RotatePagesControl());
                i++;
            }

            // add divider if necessary
            toolsLeft = toolsLeft - i;
            if (i > 0 && toolsLeft > 0)
            {
                this.ToolStackPanel.Children.Add(new DividerControl());
                i = 0;
            }

            if (reader.EnablePageNavigationControl)
            {
                this.ToolStackPanel.Children.Add(new PageNavigationControl(false, true, true, false));
                i++;
            }

            // add divider if necessary
            toolsLeft = toolsLeft - i;
            if (i > 0 && toolsLeft > 0)
            {
                this.ToolStackPanel.Children.Add(new DividerControl());
                i = 0;
            }

            // next group of tools: Zoom
            if (reader.EnableZoomSliderControl)
            {
                this.ToolStackPanel.Children.Add(new ZoomSliderControl());
                i++;
            }

            if (reader.EnableZoomTextBoxControl)
            {
                this.ToolStackPanel.Children.Add(new ZoomTextBoxControl());
                i++;
            }

            // add divider if necessary
            toolsLeft = toolsLeft - i;
            if (i > 0 && toolsLeft > 0)
            {
                this.ToolStackPanel.Children.Add(new DividerControl());
                i = 0;
            }

            // next group of tools: Fit Mode
            if (reader.EnableFitModeControl)
            {
                this.ToolStackPanel.Children.Add(new FitModeControl(reader));
                i++;
            }

            // add divider if necessary
            toolsLeft = toolsLeft - i;
            if (i > 0 && toolsLeft > 0)
            {
                this.ToolStackPanel.Children.Add(new DividerControl());
                i = 0;
            }

            // next group of tools: ToolMode
            if (reader.EnableToolModeControl)
            {
                this.ToolStackPanel.Children.Add(new ToolModeControl());
                i++;
            }

            // add divider if necessary
            toolsLeft = toolsLeft - i;
            if (i > 0 && toolsLeft > 0)
            {
                this.ToolStackPanel.Children.Add(new DividerControl());
                i = 0;
            }

            // next group of tools: Search
            if (reader.EnableSearchControl)
            {
                this.ToolStackPanel.Children.Add(new SearchControl() { Name = "seachControl" });
                i++;
            }

            // add divider if necessary
            toolsLeft = toolsLeft - i;
            if (i > 0 && toolsLeft > 0)
            {
                this.ToolStackPanel.Children.Add(new DividerControl());
                i = 0;
            }

            // last group of tools: Auxilary
            if (reader.EnablePrintControl)
            {
                this.ToolStackPanel.Children.Add(new PrintButtonControl());
            }
            if (reader.EnableFullScreenControl)
            {
                this.ToolStackPanel.Children.Add(new FullScreenButtonControl());
            }

            this.IsPinned = true;
            PinnedVisualState(true);
        }
        private int CountNumberOfTools(ReaderControl s)
        {
            int i = 0;

            if (s.EnableOpenLocalFileControl) i++;
            if (s.EnablePageNumberControl) i++;
            if (s.EnablePageNavigationControl) i++;

            if (s.EnableRotateControl) i++;
            if (s.EnableLayoutControl) i++;

            if (s.EnableZoomSliderControl) i++;
            if (s.EnableZoomTextBoxControl) i++;

            if (s.EnableFitModeControl) i++;
            if (s.EnableToolModeControl) i++;
            if (s.EnablePrintControl) i++;
            if (s.EnableFullScreenControl) i++;

            return i;
        }
Пример #12
0
        /// <summary>
        /// Creates a toolbar based on customization options from ReaderControl
        /// </summary>
        /// <param name="reader">a ReaderControl that holds customization options </param>
        public void CreateToolbar(ReaderControl reader)
        {
            // first group of tools: outline toggle
            if (reader.EnableOutlineToggleControl)
            {
                this.LeftToolStackPanel.Children.Add(new OutlineToggleButtonControl(reader));
            }

            int toolsLeft = CountNumberOfTools(reader);
            int i         = 0;

            if (reader.EnableOpenLocalFileControl)
            {
                this.ToolStackPanel.Children.Add(new OpenLocalFileButtonControl(reader));
                i++;
            }

            // add divider if necessary
            toolsLeft = toolsLeft - i;
            if (i > 0 && toolsLeft > 0)
            {
                this.ToolStackPanel.Children.Add(new DividerControl());
                i = 0;
            }

            // next group of tools: Page
            if (reader.EnablePageNumberControl)
            {
                this.ToolStackPanel.Children.Add(new PageNumberControl());
                i++;
            }

            // add divider if necessary
            toolsLeft = toolsLeft - i;
            if (i > 0 && toolsLeft > 0)
            {
                this.ToolStackPanel.Children.Add(new DividerControl());
                i = 0;
            }

            if (reader.EnableLayoutControl)
            {
                this.ToolStackPanel.Children.Add(new LayoutControl(reader));
                i++;
            }

            // add divider if necessary
            toolsLeft = toolsLeft - i;
            if (i > 0 && toolsLeft > 0)
            {
                this.ToolStackPanel.Children.Add(new DividerControl());
                i = 0;
            }

            if (reader.EnableRotateControl)
            {
                this.ToolStackPanel.Children.Add(new RotatePagesControl());
                i++;
            }

            // add divider if necessary
            toolsLeft = toolsLeft - i;
            if (i > 0 && toolsLeft > 0)
            {
                this.ToolStackPanel.Children.Add(new DividerControl());
                i = 0;
            }

            if (reader.EnablePageNavigationControl)
            {
                this.ToolStackPanel.Children.Add(new PageNavigationControl(false, true, true, false));
                i++;
            }

            // add divider if necessary
            toolsLeft = toolsLeft - i;
            if (i > 0 && toolsLeft > 0)
            {
                this.ToolStackPanel.Children.Add(new DividerControl());
                i = 0;
            }

            // next group of tools: Zoom
            if (reader.EnableZoomSliderControl)
            {
                this.ToolStackPanel.Children.Add(new ZoomSliderControl());
                i++;
            }

            if (reader.EnableZoomTextBoxControl)
            {
                this.ToolStackPanel.Children.Add(new ZoomTextBoxControl());
                i++;
            }

            // add divider if necessary
            toolsLeft = toolsLeft - i;
            if (i > 0 && toolsLeft > 0)
            {
                this.ToolStackPanel.Children.Add(new DividerControl());
                i = 0;
            }

            // next group of tools: Fit Mode
            if (reader.EnableFitModeControl)
            {
                this.ToolStackPanel.Children.Add(new FitModeControl(reader));
                i++;
            }

            // add divider if necessary
            toolsLeft = toolsLeft - i;
            if (i > 0 && toolsLeft > 0)
            {
                this.ToolStackPanel.Children.Add(new DividerControl());
                i = 0;
            }

            // next group of tools: ToolMode
            if (reader.EnableToolModeControl)
            {
                this.ToolStackPanel.Children.Add(new ToolModeControl());
                i++;
            }

            // add divider if necessary
            toolsLeft = toolsLeft - i;
            if (i > 0 && toolsLeft > 0)
            {
                this.ToolStackPanel.Children.Add(new DividerControl());
                i = 0;
            }

            // next group of tools: Search
            if (reader.EnableSearchControl)
            {
                this.ToolStackPanel.Children.Add(new SearchControl()
                {
                    Name = "seachControl"
                });
                i++;
            }

            // add divider if necessary
            toolsLeft = toolsLeft - i;
            if (i > 0 && toolsLeft > 0)
            {
                this.ToolStackPanel.Children.Add(new DividerControl());
                i = 0;
            }

            // last group of tools: Auxilary
            if (reader.EnablePrintControl)
            {
                this.ToolStackPanel.Children.Add(new PrintButtonControl());
            }
            if (reader.EnableFullScreenControl)
            {
                this.ToolStackPanel.Children.Add(new FullScreenButtonControl());
            }



            this.IsPinned = true;
            PinnedVisualState(true);
        }
 /// <summary>
 /// Creates a new instance of OpenLocalFileButtonControl
 /// </summary>
 /// <param name="documentViewer"></param>
 public OpenLocalFileButtonControl(ReaderControl documentViewer)
 {
     InitializeComponent();
     this._documentViewer = documentViewer;
 }