public static void Execute2(object parameter) { ExecuteCommandParameters parameters = parameter as ExecuteCommandParameters; if (parameters != null) { Context = parameters.Context; BackgroundWorker worker = new BackgroundWorker(); worker.DoWork += async(sender, args) => { await Context.Dispatcher.InvokeAsync(async() => { Fastboot = new FastbootTools(Context); var cmds = new List <string> { parameters.Text, parameters.Text2, parameters.Text3, parameters.Text4, parameters.Text5, parameters.Text6, parameters.Text7, parameters.Text8, parameters.Text9, parameters.Text10 }; await Fastboot.Execute(cmds, parameters.Bool); }); }; worker.RunWorkerCompleted += (sender, args) => worker.Dispose(); worker.RunWorkerAsync(); } }
public static void ExecuteRebootBootloader(object parameter) { SingleCommandParameters parameters = (SingleCommandParameters)parameter; Context = parameters.Context; BackgroundWorker worker = new BackgroundWorker(); worker.DoWork += async(sender, args) => { await Context.Dispatcher.InvokeAsync(() => { Fastboot = new FastbootTools(Context); }); await Task.Run(async() => await Fastboot.RebootBootloader(parameters.Bool)); }; worker.RunWorkerCompleted += (sender, args) => worker.Dispose(); worker.RunWorkerAsync(); }
public static void FlashZip(object parameter) { TwoCommandParameters parameters = (TwoCommandParameters)parameter; Context = parameters.Context; BackgroundWorker worker = new BackgroundWorker(); worker.DoWork += async(sender, args) => { await Context.Dispatcher.InvokeAsync(async() => { Fastboot = new FastbootTools(Context); await Fastboot.FlashZip(parameters.Text, parameters.Bool); }); }; worker.RunWorkerCompleted += (sender, args) => worker.Dispose(); worker.RunWorkerAsync(); }
public MainWindow() { InitializeComponent(); _viewModel = ((ViewModelLocator)Application.Current.Resources["Locator"]).Main; this.DataContext = _viewModel; this.Logo.HeaderSubtitle.Text = "HOME"; this.Loaded += delegate { RefreshAdb.Command.Execute(this.AdbDevices); RefreshFastboot.Command.Execute(this.FastbootDevices); }; this.Closing += delegate { _viewModel.Cleanup(); FastbootTools.Kill(); AdbTools.KillAdb(); }; this.Closed += delegate { Application.Current.Shutdown(0); }; }
public static void Kill(object parameter) { BackgroundWorker worker = new BackgroundWorker(); worker.DoWork += async(sender, args) => { var textBlock = parameter as TextBlock; if (textBlock != null) { await textBlock.Dispatcher.InvokeAsync(async() => { FastbootTools.Kill(); await textBlock.Dispatcher.InvokeAsync(() => textBlock.Text = "FASTBOOT KILLED"); }); } }; worker.RunWorkerCompleted += (sender, args) => worker.Dispose(); worker.RunWorkerAsync(); }
public static void ExecuteToken(object parameter) { UIParameters parameters = (UIParameters)parameter; Context = parameters.Context; BackgroundWorker worker = new BackgroundWorker(); worker.DoWork += async(sender, args) => { await Context.Dispatcher.InvokeAsync(() => { Fastboot = new FastbootTools(Context); }); await Task.Run( async() => await Fastboot.GetIdentiferToken(parameters.Context2, parameters.Bool)); }; worker.RunWorkerCompleted += (sender, args) => worker.Dispose(); worker.RunWorkerAsync(); }
public static void Prepare(object parameter) { BackgroundWorker worker = new BackgroundWorker(); worker.DoWork += async(sender, args) => { var textBlock = parameter as TextBlock; if (textBlock != null) { await textBlock.Dispatcher.InvokeAsync(async() => { Fastboot = new FastbootTools(textBlock); await Fastboot.Prepare(); }); } }; worker.RunWorkerCompleted += (sender, args) => worker.Dispose(); worker.RunWorkerAsync(); }
public static void ExecuteListDevices(object parameter) { UIParameters parameters = (UIParameters)parameter; if (parameters != null) { Context = parameters.Context; BackgroundWorker worker = new BackgroundWorker(); worker.DoWork += async(sender, args) => { await Context.Dispatcher.InvokeAsync(async() => { Fastboot = new FastbootTools(Context); await Fastboot.ListDevices(parameters.Context2, parameters.Bool); }); }; worker.RunWorkerCompleted += (sender, args) => worker.Dispose(); worker.RunWorkerAsync(); } }
public static void Execute(object parameter) { TwoCommandParameters parameters = parameter as TwoCommandParameters; if (parameters != null) { Context = parameters.Context; BackgroundWorker worker = new BackgroundWorker(); worker.DoWork += async(sender, args) => { await Context.Dispatcher.InvokeAsync(async() => { Fastboot = new FastbootTools(Context); await Fastboot.Execute(parameters.Text, parameters.Bool); }); }; worker.RunWorkerCompleted += (sender, args) => worker.Dispose(); worker.RunWorkerAsync(); } }