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 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(); } }