A类:收到数据怎么把数据写到其他窗体中

 

A类:异步接收到数据 MainForm1:为主窗体 设置参数是从主窗体弹出的一个模式窗体 ,在A类中收到数据怎么给设置参数这个输入框赋值?
 1 public class CMM
 2     {
 3         public delegate void ReciveDataCompleteDelegate(string data);
 4         public static event ReciveDataCompleteDelegate ReciveDataComplete;
 5 
 6         public static void DoSth(string data)
 7         {
 8             if (ReciveDataComplete != null)
 9             {
10                 ReciveDataComplete(data);
11             }
12         }
13     }
14 
15     public class Form1
16     {
17         public Form1()
18         {
19             CMM.ReciveDataComplete += CMM_ReciveDataComplete;
20         }
21 
22         void CMM_ReciveDataComplete(string data)
23         {
24             //给窗体赋值什么的
25         }
26     }
27 
28     public class A
29     {
30         public static void Main()
31         {
32             while (true)
33             {
34                 //如果收到信息
35                 if (1 == 1)
36                 {
37                     CMM.DoSth("收到信息!");
38                 }
39             }
40         }
41     }

 

posted @ 2013-05-31 14:29  superstar  阅读(154)  评论(0)    收藏  举报