private void MainWindow_Closing(object sender, CancelEventArgs e)
        {
            if (!already_exiting && !suppress_exit_warning)
            {
                if (ConfigurationManager.Instance.ConfigurationRecord.GUI_AskOnExit)
                {
                    LogoutWindow logout_window = new LogoutWindow();
                    if (false == logout_window.ShowDialog())
                    {
                        e.Cancel = true;
                        Logging.Info("User has requested not to quit Qiqqa on window close");
                        return;
                    }
                }
            }

            if (ConfigurationManager.Instance.ConfigurationRecord.GUI_RestoreWindowsAtStartup)
            {
                RestoreDesktopManager.SaveDesktop();
            }

            // Close all windows
            DockingManager.CloseAllContent();

            MainEntry.SignalShutdown();

            // If we get this far, they want out
            already_exiting = true;
        }
Beispiel #2
0
        /// <summary>
        /// Function to check the Login Credentials.
        /// </summary>
        /// <param name="objLoginProp"></param>
        /// <returns>void</returns>
        /// <createdBy></createdBy>
        /// <createdOn>Apr-13,2016</createdOn>
        public void LoginoutUser()
        {
            GridMultiSelect multiSelect = new GridMultiSelect();

            CommonSettings.logger.LogInfo(typeof(string), string.Format(CultureInfo.InvariantCulture, Resources.loggerMsgStart, DateTime.Now.ToShortDateString(), DateTime.Now.ToShortTimeString(), MethodBase.GetCurrentMethod().Name));
            try
            {
                /// remove the role details for the logged-in user before the logout
                Application.Current.Properties["LoggedInUserRole"] = string.Empty;
                /// redirect to the dashboard page and close the login page.
                //MainWindow objMainWindow = new MainWindow();

                char[] objRolesSplit = new char[] { ',' };
                var    objRoles      = Application.Current.Properties["LoggedInUserRole"].ToString().Split(objRolesSplit);
                if (!objRoles.Contains(UserRoles.Security.GetUserRoleToCompare()))
                {
                    AutoLogOffHelper.MakeAutoLogOffEvent -= new AutoLogOffHelper.MakeAutoLogOff(LoginoutUser);
                }


                LogoutWindow objLogoutWindow = new LogoutWindow();
                foreach (System.Windows.Window window in System.Windows.Application.Current.Windows)
                {
                    if (window.DataContext == this)
                    {
                        window.Close();
                    }
                }
                objLogoutWindow.Show();
                AutoLogOffHelper.StopTimer();
            }
            catch (Exception ex)
            {
                LogHelper.LogErrorToDb(ex);
                bool displayErrorOnUI = false;
                CommonSettings.logger.LogError(this.GetType(), ex);
                if (displayErrorOnUI)
                {
                    throw;
                }
            }
            finally
            {
                CommonSettings.logger.LogInfo(typeof(string), string.Format(CultureInfo.InvariantCulture, Resources.loggerMsgEnd, DateTime.Now.ToShortDateString(), DateTime.Now.ToShortTimeString(), MethodBase.GetCurrentMethod().Name));
            }
        }