Ejemplo n.º 1
0
        /// <summary>
        /// Creates a new instance of <c>App</c>
        /// </summary>
        public App()
        {
            Application.Current.ShutdownMode = ShutdownMode.OnExplicitShutdown;
            LogOnScreen logon = new LogOnScreen();

#if DEBUG
            logon.HintVisible = true;
#endif
            bool?res = logon.ShowDialog();
            if (!res ?? true)
            {
                Shutdown(1);
            }
            else if (Authenticate(logon.UserName, logon.Password))
            {
                StartupContainer();
            }
            else
            {
                MessageBox.Show(
                    "Application is exiting due to invalid credentials",
                    "Application Exit",
                    MessageBoxButton.OK,
                    MessageBoxImage.Error);
                Shutdown(1);
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Creates a new instance of <c>App</c>
        /// </summary>
        public App() {
            Application.Current.ShutdownMode = ShutdownMode.OnExplicitShutdown;
            LogOnScreen logon = new LogOnScreen();
#if DEBUG
            logon.HintVisible = true;
#endif
            bool? res = logon.ShowDialog();
            if (!res ?? true) {
                Shutdown(1);
            } else if (Authenticate(logon.UserName, logon.Password)) {
                StartupContainer();
            } else {
                MessageBox.Show(
                    "Application is exiting due to invalid credentials",
                    "Application Exit",
                    MessageBoxButton.OK,
                    MessageBoxImage.Error);
                Shutdown(1);
            }
        }