Exemple #1
0
 public static void OnStart()
 {
     ShowNewMessage("Notify");
     Connentdelegate outdelegate = new Connentdelegate(Connect);
     AsyncCallback   acb         = new AsyncCallback(CallBackConnent);
     IAsyncResult    iar         = outdelegate.BeginInvoke(acb, outdelegate);
 }
Exemple #2
0
        private static void CallBackConnent(IAsyncResult ar)
        {
            //从C#异步调用状态ar.AsyncState中,获取委托对象
            Connentdelegate dn = (Connentdelegate)ar.AsyncState;

            //一定要EndInvoke,否则你的下场很惨
            dn.EndInvoke(ar);
        }