public static AuthControl getInstance() { if(null==mAuthcontrol){ mAuthcontrol = new AuthControl(); } return mAuthcontrol; }
public static AuthControl getInstance() { if (null == mAuthcontrol) { mAuthcontrol = new AuthControl(); } return(mAuthcontrol); }
private void Login_Click(object sender, RoutedEventArgs e) { if (Box_Username.Text == null || Box_Username.Text == "") { MessageBox.Show("请输入用户名", "消息"); return; } if (Box_Passwd.Password == null || Box_Passwd.Password == "") { MessageBox.Show("请输入密码!", "消息"); return; } String usr = Box_Username.Text; String pwd = Box_Passwd.Password; UserRev uRev = new UserRev(); uRev.UserName = usr; scmd.SetReceiver(uRev); scmd.Execute(); if (uRev.ListUser.Count > 0 && uRev.ListUser[0].PassWord == pwd) { AuthControl.getInstance().setAuth(uRev.ListUser[0].UserType); AuthControl.getInstance().UserName = uRev.ListUser[0].UserName; App currentApp = (App)Application.Current; RoutedEventArgs newEventArgs = new RoutedEventArgs(Button.ClickEvent); newEventArgs.Source = this; currentApp.MainWindow.RaiseEvent(newEventArgs); } else { MessageBox.Show("登陆失败", "消息"); } }