예제 #1
0
        /// <summary>
        /// Try to singout
        /// </summary>
        /// <returns></returns>
        public OperationState tryToSingout()
        {
            OperationState state = OperationState.CONTINUE;

            if (ActivePage != null && ActivePage.IsModify)
            {
                state = ActivePage.TryToSaveBeforeClose();
                if (state == OperationState.STOP)
                {
                    return(OperationState.STOP);
                }
                state = closeApplication();
                applicationIsClosed = state == OperationState.CONTINUE ? true : false;
                return(state);
            }
            ApplicationManager.Instance.MainWindow.MenuBar.GetFileMenu().EnableSaveMenu(false);

            ApplicationManager.Instance.User = null;
            ApplicationManager.Instance.MainWindow.ConnectedUserPanel.Visibility = Visibility.Collapsed;
            ApplicationManagerBuilder builder = new ApplicationManagerBuilder();

            builder.loadPlugins();
            tryToLogin();
            ApplicationManager.Instance.MainWindow.displayMenuBar(null);

            return(state);
        }
예제 #2
0
        /// <summary>
        /// Try to close
        /// </summary>
        /// <returns></returns>
        public OperationState tryToCloseApplication()
        {
            if (applicationIsClosed)
            {
                return(OperationState.CONTINUE);
            }
            OperationState state = OperationState.CONTINUE;

            if (ActivePage != null && ActivePage.IsModify)
            {
                state = ActivePage.TryToSaveBeforeClose();
                if (state == OperationState.STOP)
                {
                    return(OperationState.STOP);
                }
                state = closeApplication();
                applicationIsClosed = state == OperationState.CONTINUE ? true : false;
                return(state);
            }

            var response = MessageDisplayer.DisplayYesNoQuestion("Exiting...", "Do you really want to exit B-Cephal ?");

            if (response == MessageBoxResult.No)
            {
                state = OperationState.STOP;
            }
            else
            {
                state = closeApplication();
                applicationIsClosed = state == OperationState.CONTINUE ? true : false;
            }
            if (ApplicationManager.Instance.MainWindow.MenuBar != null)
            {
                ApplicationManager.Instance.MainWindow.MenuBar.GetFileMenu().EnableSaveMenu(false);
            }
            return(state);
        }