void SetNext(string message, CitrixXenServerInstallEvent action) { if (this.InvokeRequired) { this.Invoke((MethodInvoker) delegate { setNext(message, action); }); } else { setNext(message, action); } }
void setNext(string message, CitrixXenServerInstallEvent action) { this.progressBar1.Show(); this.AcceptButton = this.Next; this.CancelButton = this.Default; Title.Text = ""; Extra.Text = ""; Title.Text = message; this.Next.Enabled = true; this.Next.Text = "&Next"; this.Back.Enabled = false; this.Default.Enabled = true; this.Default.Text = "Cancel"; onNext = action; }
void setReboot() { Title.Text = ""; Extra.Text = ""; Title.Text = "Windows must restart to continue the installation"; Extra.Text = "Installation will automatically continue after this restart\n\n" + "Windows may automatically restart several times before installation is complete\n\n" + "Click \'Restart Now\' to restart your VM.\n\n"; this.progressBar1.Hide(); this.Next.Text = "&Restart Now"; this.Back.Enabled = false; this.Default.Text = "Cancel"; onNext = new CitrixXenServerInstallEvent("UserReboot"); this.Activate(); this.AcceptButton = this.Next; this.CancelButton = this.Default; if (!passive) { this.Next.Enabled = true; this.Default.Enabled = true; } }
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); }