c# 代理异步 回调_.NET_编程开发_程序员俱乐部

中国优秀的程序员网站程序员频道CXYCLUB技术地图
热搜:
更多>>
 
您所在的位置: 程序员俱乐部 > 编程开发 > .NET > c# 代理异步 回调

c# 代理异步 回调

 2011/1/11 8:57:32  october731  http://october731.javaeye.com  我要评论(0)
  • 摘要:Class1.StuDele_dele=null;publicForm1(){InitializeComponent();}privatevoidbutton1_Click(objectsender,EventArgse){Class1c1=newClass1();AsyncCallbackcallBack=newAsyncCallback(UploadComplete);_dele+=newClass1.StuDele(Do1);IAsyncResultiResult=_dele
  • 标签:C# 代理
        Class1.StuDele _dele = null;

        public Form1()
        {
            InitializeComponent();
        }

        private void button1_Click(object sender, EventArgs e)
        {
            Class1 c1 = new Class1();

            AsyncCallback callBack = new AsyncCallback(UploadComplete);

            _dele += new Class1.StuDele(Do1);

            IAsyncResult iResult = _dele.BeginInvoke("hha", callBack, null);
        }

        private void UploadComplete(IAsyncResult results)
        {
            System.Diagnostics.Debug.WriteLine("12345");
            if (this.InvokeRequired)
            {
                AsyncCallback callback = new AsyncCallback(UploadComplete);
                this.BeginInvoke(callback, results);
                return;
            }
        }

        string Do1(string str)
        {
            MessageBox.Show(str + "_1");

            return "Haha Excuted Do1!";
        }
发表评论
用户名: 匿名