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();
        }
Пример #2
0
        public static void ExecuteSideload(object parameter)
        {
            TwoCommandParameters parameters = (TwoCommandParameters)parameter;

            Context = parameters.Context;
            BackgroundWorker worker = new BackgroundWorker();

            worker.DoWork += async(sender, args) =>
            {
                await Context.Dispatcher.InvokeAsync(() => { _adb = new AdbTools(Context); });

                await
                Task.Run(
                    async() =>
                    await _adb.Sideload(parameters.Text, parameters.Bool, parameters.Target));
            };
            worker.RunWorkerCompleted += (sender, args) => worker.Dispose();
            worker.RunWorkerAsync();
        }
Пример #3
0
 public AdbViewModel()
 {
     ThreeTextCommandParameters    = new ThreeTextCommandParameters();
     FiveTextCommandParameters     = new FiveTextCommandParameters();
     InstallTwoCommandParameters   = new TwoCommandParameters();
     UninstallTwoCommandParameters = new TwoCommandParameters();
     UiParameters = new UIParameters();
     ExecuteSingleCommandParameters = new TwoCommandParameters();
     CopyCommandParameters          = new ThreeTextCommandParameters();
     MoveCommandParameters          = new ThreeTextCommandParameters();
     DeleteCommandParameters        = new TwoCommandParameters();
     SideloadParameters             = new TwoCommandParameters();
     ExecuteCommandsParameters      = new ExecuteCommandParameters();
     BackupParameters           = new BackupParameters();
     RestoreParameters          = new TwoCommandParameters();
     RemoteConnectParameters    = new ThreeTextCommandParameters();
     RemoteDisconnectParameters = new SingleCommandParameters();
     RemoteSaveParameters       = new ThreeTextCommandParameters();
     _remoteInfoRepository      = ((ViewModelLocator)Application.Current.Resources["Locator"]).RemoteInfoRepository;
 }
        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();
            }
        }
Пример #5
0
        public static void ExecuteSingleCommand(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() =>
                    {
                        _adb     = new AdbTools(Context);
                        var cmds = new string[1];
                        cmds[0]  = parameters.Text;
                        await _adb.Execute(cmds, parameters.Bool, parameters.Target);
                    });
                };
                worker.RunWorkerCompleted += (sender, args) => worker.Dispose();
                worker.RunWorkerAsync();
            }
        }