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)
{
}
}
答案 0 :(得分:0)
从您的代码中不确定您要执行的操作,但如果它是同步的,您可以在SendMessageToWinMachine()
之后跟踪它,否则您可以使用CallBack
方法进行异步调用。