public void EntryPoint(ILeafUI _ui, IDevice device, ICommandExecutor _executor, IStorage storage, IEmbeddedFileManager emb) { using var ui = _ui; using var executor = _executor; var text = ClassTextReaderCache.Acquire <EClearAccounts>(); ui.Show(); ui.EAgree(text["warn"]); ui.EAgree(text["warn"]); ui.EAgree(text["warn"]); executor.OutputReceived += (s, e) => ui.WriteLineToDetails(e.Text); var dpm = new DpmPro(executor, emb, storage, device); ui.WriteLineToDetails(text["extracting"]); dpm.Extract(); ui.WriteLineToDetails(text["pushing"]); dpm.PushToDevice(); ui.WriteLineToDetails(text["removing"]); int exitCode = dpm.RemoveAccounts(); if (exitCode == 0 && ui.DoYN(text["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, DeviceSelectedOnCreating); Progress = 20; dpm.Extract(); Progress = 50; dpm.PushToDevice(); Progress = 80; int exitCode = 0; try { dpm.RemoveAccounts(); WriteExitCode(0); return(0); } catch (CommandErrorException ex) { WriteExitCode(ex.ExitCode ?? 1); exitCode = ex.ExitCode ?? 1; return(ex.ExitCode ?? 1); } finally { Progress = 100; } } }
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.RemoveAccounts(); if (exitCode == 0 && ui.DoYN(text["reboot"])) { device.Reboot2System(); } ui.Finish(exitCode); } } }