protected override void OnStart(string[] args) { // Start thread - so we can do everything in the background TextWriterTraceListener tlog = new TimeDateTraceListener(Application.CommonAppDataPath + "\\Install.log", "Install"); Trace.Listeners.Add(tlog); Trace.AutoFlush = true; Trace.WriteLine("OnStart"); InstallState = new InstallerState(); installthread = new Thread(InstallThreadHandler); installthread.Start(); }
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); }