我正在asp.net上编写聊天客户端,并希望使用不存在的System.windows.forms命名空间。
我知道您无法在asp.net中使用system.windows.forms命名空间,但我如何使用此代码在asp.net中编写聊天客户端。
private void GChat_DataReceived(object sender, SimpleTCP.Message e)
{
tbxStatus.Invoke((MethodInvoker)delegate ()
{
if ((e.MessageString) == tbxName.Text + " said: " + tbxMessage.Text + "")
{
tbxStatus.Text += "You said: " + tbxMessage.Text + "\r\n";
tbxMessage.Clear();
tbxStatus.SelectionStart = tbxStatus.Text.Length;
tbxStatus.ScrollToCaret();
if (this.WindowState == FormWindowState.Minimized)
{
this.Hide();
notifyIcon1.ShowBalloonTip(1000, "Bat Signal Activated", "You Have New Messages", ToolTipIcon.Info);
}
}
else
{
tbxStatus.Text += e.MessageString.Remove(e.MessageString.Length -1) + "\r\n";
if (this.WindowState == FormWindowState.Minimized)
{
this.Hide();
notifyIcon1.ShowBalloonTip(1000, "Bat Signal Activated", "You Have New Messages", ToolTipIcon.Info);
}
}
});
}
}