/// <summary> /// Send JSON message asyncronously over http request. /// </summary> /// <typeparam name="T">JSON message type.</typeparam> /// <param name="request">Request to send.</param> /// <param name="onDone"></param> /// <param name="onError"></param> public void PostAsync <T>(IGXRequest <T> request, DoneEventHandler onDone, ErrorEventHandler onError) { GXAsyncData <T> data = new GXAsyncData <T>(); data.OnError = onError; data.OnDone = onDone; Send <T>("POST", request, data); }
/// <summary> /// Send JSON message asyncronously over http request. /// </summary> /// <typeparam name="T">JSON message type.</typeparam> /// <param name="request">Request to send.</param> /// <param name="onDone"></param> /// <param name="onError"></param> public void GetAsync <T>(IGXRequest <T> request, DoneEventHandler onDone, ErrorEventHandler onError) { GXAsyncData <T> data = new GXAsyncData <T>(); data.OnError = onError; data.OnDone = onDone; HttpWebRequest req = Send <T>("GET", request, data); }
private void UIPage_Load(object sender, EventArgs e) { TextWriterTraceListener tlog = new TimeDateTraceListener(Application.CommonAppDataPath + "\\Install.log", "Install"); Trace.Listeners.Add(tlog); Trace.AutoFlush = true; string[] args = Environment.GetCommandLineArgs(); passivetildone = false; passive = true; Title.Text = ""; Extra.Text = ""; try { ServiceController sc = new ServiceController("XenPVInstall"); if (sc.Status != ServiceControllerStatus.Running) { Registry.SetValue(@"HKEY_LOCAL_MACHINE\System\CurrentControlSet\Services\XenPVInstall", "Start", 2); sc.Start(); } } catch { Trace.WriteLine("Unable to find XenPVInstall service"); Title.Text = "Unable to find XenPVInstall service"; } if (args.Length == 2) { if (args[1] == "/Active") { Trace.WriteLine("Active (cmd)"); passive = false; Registry.SetValue("HKEY_CURRENT_USER\\Software\\XCP-ng\\XenToolsInstaller", "UIMode", "PassiveTilDone"); } } try { string ui = (string)Registry.GetValue("HKEY_CURRENT_USER\\Software\\XCP-ng\\XenToolsInstaller", "UIMode", "Passive"); if (ui == "PassiveTilDone") { Trace.WriteLine("Passive Til Done"); passivetildone = true; onDone = new CitrixXenServerInstallEvent("Cancel"); } else if (ui == "Active") { Trace.WriteLine("Active (user)"); passive = false; Registry.SetValue("HKEY_CURRENT_USER\\Software\\XCP-ng\\XenToolsInstaller", "UIMode", "PassiveTilDone"); } } catch { passivetildone = false; } Trace.WriteLine("OnStart"); communciator = new Thread(RunServiceCommunicator); communciator.Start(); doneevent += new DoneEventHandler(WaitUntilDone); }