public async Task <object> ExecuteLongTask(LongTask task, bool allowCancellation = false)
        {
            p_Progress progress = new p_Progress();

            progress.Cancellable = allowCancellation;

            p_Document document = MainFrame.Content as p_Document;

            if (document != null)
            {
                document.Header.IsMenuEnabled = false;
            }
            try
            {
                AnimatedNavigate(MiddleLayerFrame, progress, NavigationAnimation.FadeToLeft, true);
                var result = await task(progress, progress.CancellationToken);

                return(result);
            } finally
            {
                if (document != null)
                {
                    document.Header.IsMenuEnabled = true;
                }
            }
        }
        internal void NavigateDocumentPage(NavigationAnimation navigationAnimation, Page newPage)
        {
            p_Document pageDocument = DocumentFrame.Content as p_Document;

            if (pageDocument == null)
            {
                throw new Exception("Main page needs to be p_Document object");
            }

            p_DocumentMenu documentMenu = pageDocument.DocumentFrame.Content as p_DocumentMenu;

            if (documentMenu == null)
            {
                throw new Exception("Document page cannot be found");
            }

            AnimatedNavigate(documentMenu.DocumentPageFrame, newPage, navigationAnimation);
        }
        public void LoadDocumentPage()
        {
            if (__Document == null)
            {
                AnimatedNavigate(MainFrame, p_StartPage.Instance, NavigationAnimation.FadeToRight);
            }
            else
            {
                p_Document documentPage = new p_Document();

                if (String.IsNullOrWhiteSpace(__Document.PathToBinaries))
                {
                    p_EmptyProject emptyProject = new p_EmptyProject();
                    documentPage.DocumentFrame.Navigate(emptyProject);
                }

                AnimatedNavigate(MainFrame, documentPage);
            }
        }