Пример #1
0
        private void btnName(object sender, RoutedEventArgs e)
        {
            bool             logout = false;
            MessageBoxResult result = MessageBox.Show("Vil du logge af\nklik \"OK\" for at logge af", "Logger af", MessageBoxButton.OKCancel);

            switch (result)
            {
            case MessageBoxResult.OK:
                logout = true;
                break;

            case MessageBoxResult.Cancel:
                break;
            }
            if (logout)
            {
                Settings.Default.Username = "";
                Settings.Default.Password = "";
                Settings.Default.Save();
                Settings.Default.Reload();
                logic.SaveUser("", "");
                LoginPage lp = new LoginPage(true);
                lp.Show();
                Close();
            }
        }
Пример #2
0
 private void Application_Startup(object sender, StartupEventArgs e)
 {
     Logic.Logic logic = new Logic.Logic();
     if (Settings.Default.Username.ToString() != "" && Settings.Default.Password.ToString() != "")
     {
         logic.SaveUser(Settings.Default.Username, Settings.Default.Password);
     }
     if (!logic.IsUserLogin())
     {
         LoginPage lp = new LoginPage();
         lp.Show();
     }
     else
     {
         MainWindow window = new MainWindow();
         window.Show();
     }
 }