示例#1
0
        private void ToMainMenu(object sender, RoutedEventArgs e)
        {
            MainMenuViewModel viewmodel;
            MainMenuWindow    window = new MainMenuWindow(this, out viewmodel);

            window.WindowStartupLocation = WindowStartupLocation.CenterScreen;
            window.ShowDialog();
        }
示例#2
0
 public void Login()
 {
     using (RetailContext context = new RetailContext())
     {
         var list = context.Persons.Where(p => p.Name == thiswindow.UserName.Text && p.password == thiswindow.Password.Password).ToList();
         if (list.Count() > 0)
         {
             Person p = list[0];
             //new MessageWindow(thiswindow, "登陆成功").ShowDialog();
             XmlHelper.WriteNowPerson(p);
             thiswindow.ShowInTaskbar = false;
             thiswindow.Hide();
             MainMenuViewModel viewmodel;
             MainMenuWindow    window = new MainMenuWindow(this.thiswindow, out viewmodel);
             window.WindowStartupLocation = WindowStartupLocation.CenterScreen;
             window.ShowDialog();
             thiswindow.Close();
         }
         else
         {
             new MessageWindow(thiswindow, "用户名或者密码错误").ShowDialog();
         }
     }
 }