zoukankan      html  css  js  c++  java
  • 调用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);
    

      

  • 相关阅读:
    JVM系列三:JVM参数设置、分析
    JVM系列二:GC策略&内存申请、对象衰老
    HotSpot VM GC 的种类
    2.静态库和动态库
    1.GCC编译过程
    6.树
    5.队列
    4.栈
    3.线性表
    2.算法
  • 原文地址:https://www.cnblogs.com/ningkyolei/p/4548286.html
Copyright © 2011-2022 走看看