/// <summary> /// Start the installation. /// </summary> public void Install() { var t = new System.Threading.Thread(() => { ProgressReported?.Invoke(0); StatusReported?.Invoke(""); Run(); ProgressReported?.Invoke(100); StatusReported?.Invoke("Installation completed."); InstallCompleted?.Invoke(); }); t.IsBackground = true; t.Start(); }
private void Proc_Exited(object sender, EventArgs e) { // Delete downloaded installer try { if (File.Exists(filePath)) { File.Delete(filePath); } } catch (Exception ex) { Debug.WriteLine($"Delete file failed. Error: {ex.Message}, filePath: {filePath}"); } var proc = (Process)sender; exitCode = proc.ExitCode; InstallCompleted?.Invoke(this, e); }
public void InitiateInstall(Installation install) { pnlselectfile.Hide(); pginstall.Show(); lbprogress.Show(); lbtitle.Text = install.Name; install.ProgressReported += (p) => { Desktop.InvokeOnWorkerThread(new Action(() => { pginstall.Value = p; })); }; install.StatusReported += (s) => { Desktop.InvokeOnWorkerThread(new Action(() => { lbprogress.Text = s; })); }; install.InstallCompleted += () => { Desktop.InvokeOnWorkerThread(new Action(() => { lbtitle.Text = "Select file"; pnlselectfile.Show(); })); isInstalling = false; InstallCompleted?.Invoke(); }; while (!this.Visible) { } isInstalling = true; install.Install(); }