// 登录界面将登录结果返回,保存登录状态 public void LoginResult(user u) { Account.Instance.Login(u); GetWindow getWindow = new GetWindow(); getWindow.WindowStartupLocation = WindowStartupLocation.CenterOwner; getWindow.Show(); }
// 点击领料。检查登录状态。 private void GetMaterials(object sender, RoutedEventArgs e) { using (MmsContext context = new MmsContext()) { if (!Account.Instance.IsLogin()) { LoginCallback callback = new LoginCallback(); callback.LoginEvent += LoginResult; LoginWindow loginWindow = new LoginWindow(callback); loginWindow.Show(); } else { GetWindow getWindow = new GetWindow(); getWindow.WindowStartupLocation = WindowStartupLocation.CenterOwner; getWindow.Show(); } } }