Пример #1
0
 /// <summary>
 /// Copies from other settings.
 /// </summary>
 /// <param name="settings">The settings</param>
 internal void CopyFrom(PdfExportSettings settings)
 {
     if (settings != null)
     {
         this.author          = settings.author;
         this.title           = settings.title;
         this.subject         = settings.subject;
         this.keywords        = settings.keywords;
         this.creator         = settings.creator;
         this.centerWindow    = settings.centerWindow;
         this.displayDocTitle = settings.displayDocTitle;
         this.hideMenubar     = settings.hideMenubar;
         this.hideToolbar     = settings.hideToolbar;
         this.hideWindowUI    = settings.hideWindowUI;
         this.fitWindow       = settings.fitWindow;
         this.pageLayout      = settings.pageLayout;
         this.openType        = settings.openType;
         this.pageDuration    = settings.pageDuration;
         this.pageTransition  = settings.pageTransition;
         this.destinationType = settings.destinationType;
         this.openPageNumber  = settings.openPageNumber;
         this.printPreset.CopyFrom(settings.printPreset);
         this.documentAttachments.AddRange((IEnumerable <DocumentAttachment>)settings.documentAttachments);
     }
 }
        /// <summary>
        /// Show the previous page.
        /// </summary>
        /// <param name="transitionType">
        /// Defaults to sliding to the right.
        /// </param>
        public void ShowPreviousPage(PageTransitionType transitionType = PageTransitionType.SlideBackAndFade)
        {
            if (m_ViewModel is null)
            {
                return;
            }

            m_ViewModel.ShowPreviousPage(transitionType);
        }
Пример #3
0
        public void ShowPage(UserControl page, PageTransitionType type = PageTransitionType.Auto)
        {
            if (page == CurrentPage)
            {
                return;
            }

            Task.Factory.StartNew(() => Dispatcher.Invoke(new Action(() => loadPage(page, type))));
        }
        /// <summary>
        /// Show a given page.
        /// </summary>
        /// <param name="pageControl">
        /// The enumerated value for the new page.
        /// </param>
        /// <param name="additionalData">
        /// Any additional data that the new page might need.
        /// </param>
        /// <param name="transitionType">
        /// Defaults to sliding to the left.
        /// </param>
        public void ShowNextPage(PageControl pageControl,
                                 object additionalData             = null,
                                 PageTransitionType transitionType = PageTransitionType.SlideAndFade)
        {
            if (m_ViewModel is null)
            {
                return;
            }

            m_ViewModel.ShowNextPage(pageControl, additionalData, transitionType);
        }
        internal void ShowNextPage(PageControl pageControl,
                                   object additionalData             = null,
                                   PageTransitionType transitionType = PageTransitionType.SlideAndFade)
        {
            Log($"{nameof(MainWindowViewModel)}.{nameof(ShowNextPage)}: Start");

            if (pageControl.Equals(Enumerations.PageControl.None))
            {
                Log($"  The page control type \"{pageControl}\" is unhandled.");
            }

            UserControl newPageControl = GetPageUserControl(pageControl, additionalData);

            if (newPageControl is null)
            {
                Log($"  The user control came back null for page type: {pageControl}");

                return;
            }

            Log($"  The page type is \"{pageControl}\".");

            if (CurrentPage.Equals(pageControl) == true)
            {
                return;
            }

            CurrentPage = pageControl;

            // The stack is only really used for going back to a previous page.
            m_PageList.Push(newPageControl);

            m_PageTransition.TransitionType = transitionType;
            m_PageTransition.ShowPage(newPageControl);

            ShowStatusMessage(string.Empty, false);

            Log($"{nameof(MainWindowViewModel)}.{nameof(ShowNextPage)}: End");
        }
        /// <summary>
        /// Shows the previous page with the given transition.
        /// </summary>
        /// <param name="transitionType">
        /// </param>
        internal void ShowPreviousPage(
            PageTransitionType transitionType = PageTransitionType.SlideBackAndFade,
            object additionalData             = null)
        {
            Log($"{nameof(MainWindowViewModel)}.{nameof(ShowPreviousPage)}: Start");

            UserControl newPageControl = null;

            if (m_PageList.Count > 0)
            {
                newPageControl = m_PageList.Pop();

                Log($"  Removed {newPageControl} from stack.");

                if (m_PageList.Count == 1)
                {
                    Log("  There is now 1 item in the stack.");
                }
                else
                {
                    Log($"  There are now {m_PageList.Count} items in the stack.");
                }
            }
            else
            {
                Log($"  The page list stack is empty.");
            }

            if (m_PageList.Count > 0)
            {
                newPageControl = m_PageList.Peek();

                Log($"  New page is {newPageControl}.");
            }

            if (additionalData != null)
            {
                if (newPageControl is DirectoryView)
                {
                    IHashAlgorithim hashAlgorithim = ((ChecksumAlgorithim)additionalData).GetAlgorithimInterface();

                    ((DirectoryView)newPageControl).SetHashAlgorithim(hashAlgorithim);
                }
            }

            // Set back button text.

            if (newPageControl is null)
            {
                newPageControl = new DirectoryView(this);
            }

            CurrentPage = GetPageEnumerationType(newPageControl);

            m_PageTransition.TransitionType = transitionType;
            m_PageTransition.ShowPage(newPageControl);

            ShowStatusMessage(string.Empty, false);

            Log($"{nameof(MainWindowViewModel)}.{nameof(ShowPreviousPage)}: End");
        }
Пример #7
0
 public BookListTransition(PageTransitionType type = PageTransitionType.SpinAndFade)
 {
     InitializeComponent();
     pageTransitionControl.TransitionType = PageTransitionType.Slide;
     activeListener();
 }
Пример #8
0
        private void loadPage(UserControl page, PageTransitionType type)
        {
            if (page == null)
                return;

            //If already in a trasition, save it for next time
            //Overwrite to skip if it's already filled
            if (InTransition)
            {
                _nextPage = page;
                _nextTrasitionType = type;
                return;
            }

            int i = pages.IndexOf(page);
            if (i < 0)
                return;

            if (type == PageTransitionType.Auto)
            {
                if (CurrentPage == null)
                    type = PageTransitionType.Next;
                else
                {
                    int c = pages.IndexOf(CurrentPage);
                    if (c == (pages.Count - 1) && i == 0)
                        type = PageTransitionType.Next;
                    else if (c == 0 && i == (pages.Count - 1))
                        type = PageTransitionType.Previous;
                    else
                        type = (c < i) ? PageTransitionType.Next : PageTransitionType.Previous;
                }
            }

            _nextPage = null;
            _nextTrasitionType = PageTransitionType.Auto;

            InTransition = true;

            _loadingPage = page;
            TransitionType = type;

            _loadingPage.Loaded += newPage_Loaded;

            //switch active content control
            if (_currentContent == contentA)
                _currentContent = contentB;
            else
                _currentContent = contentA;

            _currentContent.Content = _loadingPage;
        }
Пример #9
0
        public void ShowPage(UserControl page, PageTransitionType type = PageTransitionType.Auto)
        {
            if (page == CurrentPage)
                return;

            Task.Factory.StartNew(() => Dispatcher.Invoke(new Action(() => loadPage(page, type))));
        }
Пример #10
0
        private void loadPage(UserControl page, PageTransitionType type)
        {
            if (page == null)
            {
                return;
            }

            //If already in a trasition, save it for next time
            //Overwrite to skip if it's already filled
            if (InTransition)
            {
                _nextPage          = page;
                _nextTrasitionType = type;
                return;
            }

            int i = pages.IndexOf(page);

            if (i < 0)
            {
                return;
            }

            if (type == PageTransitionType.Auto)
            {
                if (CurrentPage == null)
                {
                    type = PageTransitionType.Next;
                }
                else
                {
                    int c = pages.IndexOf(CurrentPage);
                    if (c == (pages.Count - 1) && i == 0)
                    {
                        type = PageTransitionType.Next;
                    }
                    else if (c == 0 && i == (pages.Count - 1))
                    {
                        type = PageTransitionType.Previous;
                    }
                    else
                    {
                        type = (c < i) ? PageTransitionType.Next : PageTransitionType.Previous;
                    }
                }
            }

            _nextPage          = null;
            _nextTrasitionType = PageTransitionType.Auto;

            InTransition = true;

            _loadingPage   = page;
            TransitionType = type;

            _loadingPage.Loaded += newPage_Loaded;

            //switch active content control
            if (_currentContent == contentA)
            {
                _currentContent = contentB;
            }
            else
            {
                _currentContent = contentA;
            }

            _currentContent.Content = _loadingPage;
        }