Example #1
0
        /// <summary>
        /// Display the page and call
        /// </summary>
        /// <param name="page"></param>
        protected OperationState openPage(Controllable page)
        {
            FunctionalityType functionalityType = page.NavigationToken != null ? page.NavigationToken.FunctionalityType : FunctionalityType.MAIN_FONCTIONALITY;
            bool isSubFonctionality             = functionalityType == FunctionalityType.SUB_FONCTIONALITY;

            if (page == null)
            {
                return(OperationState.CONTINUE);
            }

            if (ActivePage != null && ActivePage is FileController)
            {
                page.ParentController = ActivePage;
            }

            if (ActivePage == null || (!page.Equals(ActivePage) || !page.FunctionalityCode.Equals(ActivePage.FunctionalityCode)))
            {
                if (isSubFonctionality)
                {
                    page.ParentController = ActivePage;
                }

                ActivePage = page;
                ApplicationManager.MainWindow.displayPage(page);
                if (!OpenedPages.Contains(page))
                {
                    OpenedPages.Add(page);
                }
            }
            return(OperationState.CONTINUE);
        }
Example #2
0
        /// <summary>
        /// Procède à la fermeture de la page.
        /// </summary>
        /// <param name="page"></param>
        /// <returns></returns>
        public void OnClosePage(object param)
        {
            Controllable page = (Controllable)param;

            if (page == null)
            {
                return;
            }
            try
            {
                if (OpenedPages.Contains(page))
                {
                    OpenedPages.Remove(page);
                }
                if (ActivePage != null && ActivePage.Equals(page))
                {
                    ActivePage = null;
                    FunctionalityType functionalityType = page.NavigationToken != null ? page.NavigationToken.FunctionalityType : FunctionalityType.MAIN_FONCTIONALITY;
                    bool isSubFonctionality             = functionalityType == FunctionalityType.SUB_FONCTIONALITY;
                    if (isSubFonctionality && page.ParentController != null)
                    {
                        openPage(page.ParentController);
                    }
                    else if (OpenedPages.Count > 0)
                    {
                        openPage(OpenedPages[OpenedPages.Count - 1]);
                        return;
                    }
                    else
                    {
                        openHomePage();
                    }
                }
            }
            catch (Exception e)
            {
                MessageDisplayer.DisplayError("Error", e.Message);
                return;
            }
            return;
        }