• 调用WCF的异步方法


                AsyncCallback aLoginCallback = delegate(IAsyncResult result)
                                               {
                                                   var aSystemUser = WcfClient.Instance.EndSystemUser_Login(result);
                                                   result.AsyncWaitHandle.Close();
    
                                                   if (string.IsNullOrWhiteSpace(aSystemUser.UserId))
                                                   {
                                                       ShowMessageBoxInNonMainThread("登录失败:用户名称或者用户密码错误!");
                                                       return;
                                                   }
    
                                                   CommonCache.CurrentUser = aSystemUser;
    
                                                   //SynchronizationContext和SendOrPostCallback的引入是为了解决不能在非主线程中访问主线程中创建的控件的问题
                                                   SendOrPostCallback aSendOrPostCallback = delegate
                                                                                            {
                                                                                                Hide();
                                                                                                MainForm.Instance.ShowDialog();
                                                                                            };
                                                   SynchronizationContext.Current.Send(aSendOrPostCallback, null);
                                               };
    
                var aParam = GetForm<SystemUserParameter>();
                WcfClient.Instance.BeginSystemUser_Login(aParam, aLoginCallback, null);
    

      

  • 相关阅读:
    Beta冲刺 5
    Beta冲刺 4
    Beta冲刺 3
    Beta冲刺 2
    Beta冲刺 1
    项目评测博客
    Beta冲刺前准备
    Alpha 冲刺11——总结
    Alpha冲刺10
    Alpha冲刺9
  • 原文地址:https://www.cnblogs.com/ningkyolei/p/4548286.html
Copyright © 2020-2023  润新知