public void Login() { LungCare.SupportPlatform.Models.LoginRequest LoginRequest = new LungCare.SupportPlatform.Models.LoginRequest(); LoginRequest.UserName = "******"; LoginRequest.Password = "******"; LoginRequest.Sender = "PC Client"; ThreadPool.QueueUserWorkItem(delegate { LoginWorker.SendLoginRequest( LoginRequest.UserName, LoginRequest.Password, successCallback : delegate(LungCare.SupportPlatform.Models.LoginResponse response) { //Dispatcher.Invoke(new Action(delegate { LungCare.SupportPlatform.Security.TokenManager.Token = response.Token; LungCare.SupportPlatform.Security.SessionManager.UserName = LoginRequest.UserName; loadHandledData(); } //)); }, failureCallback : delegate(string failureReason) { //Dispatcher.Invoke(new Action(delegate { //MessageBox.Show("登录失败。" + failureReason, "", System.Windows.MessageBoxButton.OK, System.Windows.MessageBoxImage.Asterisk); } //)); }, errorCallback : delegate(Exception ex) { //Dispatcher.Invoke(new Action(delegate { Util.ShowExceptionMessage(ex, "登录出错。"); } //)); }); }); }
private void btnLogin_Click(object sender, RoutedEventArgs e) { LungCare.SupportPlatform.Models.LoginRequest LoginRequest = new LungCare.SupportPlatform.Models.LoginRequest(); LoginRequest.UserName = tbUserName.Text; LoginRequest.Password = tbPassword.Text; LoginRequest.Sender = "PC Client"; ThreadPool.QueueUserWorkItem(delegate { LoginWorker.SendLoginRequest( LoginRequest.UserName, LoginRequest.Password, successCallback : delegate(LungCare.SupportPlatform.Models.LoginResponse response) { Dispatcher.Invoke(new Action(delegate { LungCare.SupportPlatform.Security.TokenManager.Token = response.Token; LungCare.SupportPlatform.Security.SessionManager.UserName = LoginRequest.UserName; lbToken.Content = LungCare.SupportPlatform.Security.TokenManager.Token; btn获取用户列表_Click(sender, e); //NotificationsWorker.SendTest(); })); }, failureCallback : delegate(string failureReason) { Dispatcher.Invoke(new Action(delegate { MessageBox.Show("登录失败。" + failureReason, "", MessageBoxButton.OK, MessageBoxImage.Asterisk); })); }, errorCallback : delegate(Exception ex) { Dispatcher.Invoke(new Action(delegate { Util.ShowExceptionMessage(ex, "登录出错。"); })); }); }); }
public void Login() { LungCare.SupportPlatform.Models.LoginRequest LoginRequest = new LungCare.SupportPlatform.Models.LoginRequest(); LoginRequest.UserName = "******"; LoginRequest.Password = "******"; LoginRequest.Sender = "PC Client"; ThreadPool.QueueUserWorkItem(delegate { LoginWorker.SendLoginRequest( LoginRequest.UserName, LoginRequest.Password, successCallback : delegate(LungCare.SupportPlatform.Models.LoginResponse response) { //Dispatcher.Invoke(new Action(delegate { LungCare.SupportPlatform.Security.TokenManager.Token = response.Token; LungCare.SupportPlatform.Security.SessionManager.UserName = LoginRequest.UserName; LungCare.SupportPlatform.UI.UploadProgressWnd upw = new LungCare.SupportPlatform.UI.UploadProgressWnd(); //upw.Owner = LungCare_Airway_PlanNav.MainWindow.Instance; InstitutionName = "Zhongshan Hospital,Fudan Univ."; PatientName = "Gan^ Fuming"; PatientAge = "062Y"; PatientSex = "M"; SeriesInstanceUID = "1.2.840.113619.2.55.3.269126727.31.1438774442.877.3"; StudyInstanceUID = "1.2.840.113619.2.55.3.269126727.31.1438774442.873"; acquisitionDate = "20150807"; acquisitionTime = "130902"; upw.FileName = filename; upw.InstitutionName = InstitutionName; upw.PatientAge = PatientAge; upw.PatientName = PatientName; upw.PatientSex = PatientSex; upw.SeriesInstanceUID = SeriesInstanceUID; upw.StudyInstanceUID = StudyInstanceUID; upw.acquisitionDate = acquisitionDate; upw.acquisitionTime = acquisitionTime; upw.ShowDialog(); } //)); }, failureCallback : delegate(string failureReason) { //Dispatcher.Invoke(new Action(delegate { //MessageBox.Show("登录失败。" + failureReason, "", System.Windows.MessageBoxButton.OK, System.Windows.MessageBoxImage.Asterisk); } //)); }, errorCallback : delegate(Exception ex) { //Dispatcher.Invoke(new Action(delegate { Util.ShowExceptionMessage(ex, "登录出错。"); } //)); }); }); }