我有一些我的方法的问题,我认为,一个WaitHandle是解决方案。C#等待句柄回调
我通过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在这种情况下是正确的选择吗?
你没有真正说出问题所在,只是说你的某些方法有问题。 – webnoob 2013-02-28 12:44:29
我怎样才能实现一个WaitHandle的回调? WaitHandle在这种情况下是正确的选择吗? – mnlfischer 2013-02-28 12:46:48
在什么情况下?你说有一个问题让你想到等待处理,但是那个问题是什么?即''我的一些方法有问题,我认为,WaitHandle是解决方案。' – webnoob 2013-02-28 12:47:29