我面臨着多日的問題。我有一個線程正在偵聽來自其他系統的通知。每當我收到套接字通知時,我都想使用Infragistics的UltraDesktopAlert控件將其顯示在警報窗口中。這個類庫中沒有winform。如何從線程顯示Infragistics的UltraDesktopAlert
請告訴我如何使用線程顯示它。示例在這裏
void tcpServerListenter_OnCommReceive(object sender, CommEventArgs e)
{
string xmlString = Encoding.UTF8.GetString((byte[])e.data);
try
{
XDocument xmlDoc = XDocument.Parse(xmlString);
var res = (from msg in xmlDoc.Descendants("consoleNotification")
select msg.Element("value").Value).FirstOrDefault();
this.notificationMsg = res;
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
return;
}
// here Alert window is not displaying.
ultraDesktopAlert1.Show("Notification", this.notificationMsg);
}
但此代碼不顯示警報窗口。
我檢查下面的鏈接也 How to update the GUI from another thread in C#?
,但問題是,我在我的類庫沒有Winform的。當我在套接字上收到通知時,我想要顯示警報窗口。