public void EntryPoint(ILeafUI ui, IDevice device, IClassTextManager text, ITemporaryFloder tmp, IEmbeddedFileManager emb) { using (ui) { ui.Icon = this.GetIconBytes(); ui.Title = this.GetName(); ui.Show(); ui.EAgree(text["warn"]); ui.EAgree(text["warn"]); ui.EAgree(text["warn"]); using (var executor = new CommandExecutor()) { executor.To(e => ui.WriteOutput(e.Text)); var dpm = new DpmPro(executor, emb, tmp, device); ui.WriteLine(text["extracting"]); dpm.Extract(); ui.WriteLine(text["pushing"]); dpm.PushToDevice(); ui.WriteLine(text["removing"]); int exitCode = dpm.RemoveUsers(); if (exitCode == 0 && ui.DoYN(text["reboot"])) { device.Reboot2System(); } ui.Finish(exitCode); } } }
public void EntryPoint(ILeafUI _ui, IDevice device, ICommandExecutor _executor, IStorage storage, IEmbeddedFileManager emb) { using var ui = _ui; using var executor = _executor; executor.OutputReceived += (s, e) => ui.WriteLineToDetails(e.Text); ui.Show(); ui.EAgree(this.RxGetClassText("warn")); ui.EAgree(this.RxGetClassText("warn")); ui.EAgree(this.RxGetClassText("warn")); var dpm = new DpmPro(executor, emb, storage, device); ui.WriteLineToDetails(this.RxGetClassText("extracting")); dpm.Extract(); ui.WriteLineToDetails(this.RxGetClassText("pushing")); dpm.PushToDevice(); ui.WriteLineToDetails(this.RxGetClassText("removing")); int exitCode = dpm.RemoveUsers(); if (exitCode == 0 && ui.DoYN(this.RxGetClassText("reboot"))) { device.Reboot2System(); } ui.Finish(exitCode == 0 ? StatusMessages.Success : StatusMessages.Failed); }
protected override int VisualMain() { using (var executor = new CommandExecutor()) { var dpm = new DpmPro(executor, this, TargetDevice); Progress = 20; dpm.Extract(); Progress = 50; dpm.PushToDevice(); Progress = 80; try { dpm.RemoveUsers(); WriteExitCode(0); return(0); } catch (CommandErrorException ex) { WriteExitCode(ex.ExitCode ?? 1); return(ex.ExitCode ?? 1); } finally { Progress = 100; } } }