【发布时间】:2013-02-28 12:33:02
【问题描述】:
我的一些方法有问题,我认为 WaitHandle 是解决方案。
我通过 API 为 Ticketsystem 创建一个事件。
private void create_Incident(string computer_idn, string swidn_choice,
string swName_choice, string CI_Number, String windows_user)
{
string msg_id = "" + computer_idn + "_" + swidn_choice + "";
string username = "BISS";
hajas211ilt3.ILTISAPI api = new hajas211ilt3.ILTISAPI();
api.BeginInsertIncident(username, "", msg_id, "", "", "2857",
"BISS - Software Deployment", "", "", "NOT DETERMINED",
"", "", "", "", "", "", "5 - BAU", "3 - BAU", "",
"Interface", "", "", "", "", "", "",
delegate(IAsyncResult r)
{ InsertIncidentCallback(api, r, username, msg_id); }, null);
}
此方法在 create_Incident 方法中作为回调调用。
private void InsertIncidentCallback(server3.ILTISAPI api, IAsyncResult result,
string username, string msg_id)
{
api.EndInsertIncident(result, out message);
}
我需要 if 中的消息,但我需要安全性,即有消息。所以我必须等待 InsertIncidentCallback 和消息。
在我问的另一种方法中,消息是否正常:
private void checkIncident(string omputer_idn, string swidn_choice,
string swName_choice, string CI_Number,
string windows_user)
{
if (message == null)
{
string responseXML;
api.REMEDY_ReadResponseXML(username, out responseXML, out msg_id);
XDocument doc = XDocument.Parse(responseXML);
inquiryId = (string)doc.Root.Element("inquiry_id");
if (inquiryId == null || inquiryId == "")
{
information_text.Text = ".....";
}
else
{
information_remedyID.Visible = true;
information_remedyID.Text = inquiryId;
create_LanDesk(computer_idn, swidn_choice,
swName_choice, inquiryId);
}
}
else
{
information_text.Visible = true;
information_text.Text = "....";
}
}
如何为回调实现 WaitHandle?在这种情况下,WaitHandle 是正确的选择吗?
【问题讨论】:
-
你实际上并没有说问题是什么,只是你的一些方法有问题。
-
如何实现回调的 WaitHandle?在这种情况下,WaitHandle 是正确的选择吗?
-
在什么情况下?你说有一个问题让你想到了等待句柄,但那个问题是什么?即
I have a Problem with some of my Methods and I think, a WaitHandle is the solution. -
对不起。回调是一个后台进程,我想显示客户知道他的票号的inquiryId。问题:当消息不为空或“”时,我必须等待回调原因,票证有问题,票证系统从未创建响应xml。我的想法是等待回调安全,票证已完成,我可以获得 responseXML。
标签: c# asp.net methods callback waithandle