示例#1
0
文件: App.xaml.cs 项目: rymbln/WPFDB
 /// <summary>
 /// Lauches the entry form on startup
 /// </summary>
 /// <param name="e">Arguments of the startup event</param>
 protected override void OnStartup(StartupEventArgs e)
 {
     base.OnStartup(e);
     var currentUser = Authentification.GetCurrentUser();
     if (Authentification.Instance.Authentificated())
     {
         MainViewModel main = new MainViewModel();
         MainView window = new View.MainView {DataContext = main};
         window.Show();
     }
     else
     {
         LoginViewModel authVm = new LoginViewModel();
         LoginView authV = new LoginView();
         authV.Show();
     }
 }
示例#2
0
        private void Button_Click(object sender, RoutedEventArgs e)
        {
            //if ((txtName.Text != "") & (txtPassword.Text != ""))
            //{
            //    var user = new User();
            //    user.Name = txtName.Text;
            //    user.Password = txtPassword.Text;
            //    if (auth.AuthentificateUser(user))

            //    {
                    MainViewModel main = new MainViewModel();
                    MainView window = new View.MainView { DataContext = main };
                    window.Show();
                    this.Close();
            //    }

            //}
        }