メソッドのいくつかに問題があり、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 = "....";
}
}
Callback に WaitHandle を実装するにはどうすればよいですか? この場合、WaitHandle は正しいオプションですか?