others - 如何在窗口窗体应用程序中传递消息时得到通知?


private void buttonSend_Click(object sender, EventArgs e)
{
 InsertChatDetails();
//textBoxChat.Text += System.DateTime.Now.ToLongTimeString() +"" + System.Environment.GetEnvironmentVariable("Computername") + Environment.NewLine;
 textBoxChat.Text += textBoxMessage.Text + Environment.NewLine;
 textBoxMessage.Text ="";
}

public void InsertChatDetails()//Inserting Values
{
 try
 {
 CommonCS CommonSample1 = new CommonCS();
 BusinessCS BFSample1 = new BusinessCS();

 CommonSample1.Id ="1";
 CommonSample1.FromUser = textBoxChat.Text += System.DateTime.Now.ToLongTimeString() +"-->" + Program.UserName + Environment.NewLine;
//CommonSample1.FromUser = textBoxChat.Text += System.DateTime.Now.ToLongTimeString() +"" + System.Environment.GetEnvironmentVariable("Computername") + Environment.NewLine;
 CommonSample1.ToUser ="";
 CommonSample1.MessageText = textBoxMessage.Text;
 CommonSample1.SentOn = DateTime.Now;
 CommonSample1.StatusReport = 0;
 BFSample1.InsertChatDetails(CommonSample1);
 }
 catch (Exception)
 {
 }
}

时间:

如果你的 SendMessageToWinMachine()可以同步跟踪,则可以使用 CallBack 方法调用 asynchronus 。

...