コード例 #1
0
        public void EntryPoint(IDevice device, ILeafUI ui, IStorageManager storageManager,
                               IAppManager app, ICommandExecutor executor)
        {
            using (ui)
            {
                //初始化LeafUI并展示
                ui.Title = this.GetName();
                ui.Icon  = this.GetIconBytes();
                executor.OutputReceived += (s, e) =>
                {
                    ui.WriteOutput(e.Text);
                    SLogger <EScreenShoter> .Info(e.Text);
                };
                ui.Closing += (s, e) =>
                {
                    executor.Dispose();
                    return(true);
                };

                ui.Show();

                var screencap = new ScreenCap(device, executor, storageManager.CacheDirectory.FullName);
                var file      = screencap.Cap();

                ui.WriteLine(file.FullName);
                ShowOnUI(app, file.FullName);
                //显示出来了,进度窗也没啥用了,直接关闭
                //ui.Finish();
                ui.Shutdown();
            }
        }
コード例 #2
0
        public void Run(ILeafUI ui, ICommandExecutor executor, IDevice device)
        {
            using (ui)
            {
                ui.Show();
                ui.Closing += (s, e) =>
                {
                    executor.Dispose();
                    return(true);
                };
                executor.OutputReceived += (s, e) => ui.WriteLineToDetails(e.Text);

                //Checking if device support A/B slot.
                CommandResult result = executor.Fastboot(device, "getvar current-slot 2");

                bool?crtSlot = GetCurrentSlot(result.Output.ToString());

                if (crtSlot != null || AskIfContinueWithMayNotSupport(ui))
                {
                    //Ask if continue
                    var targetSlot = (bool)crtSlot ? "b" : "a";
                    if (AskIfContinueToSwitch(ui))
                    {
                        executor.Fastboot(device, "--set-active=" + targetSlot);
                    }
                }
                else
                {
                    ui.Shutdown();
                }
            }
        }
コード例 #3
0
        public void EntryPoint(IDevice device, ILeafUI ui, IStorage storage,
                               IAppManager app, ICommandExecutor executor)
        {
            using (ui)
            {
                //初始化LeafUI并展示
                executor.OutputReceived += (s, e) =>
                {
                    ui.WriteLineToDetails(e.Text);
                };
                ui.Closing += (s, e) =>
                {
                    executor.Dispose();
                    return(true);
                };

                ui.Show();

                var screencap = new ScreenCap(device, executor, storage.CacheDirectory.FullName);
                var file      = screencap.Cap();

                ui.WriteLineToDetails(file.FullName);
                ShowOnUI(app, file.FullName);
                //显示出来了,进度窗也没啥用了,直接关闭
                //ui.Finish();
                ui.Shutdown();
            }
        }
コード例 #4
0
 public void Main(ILeafUI ui, IDevice device, ICommandExecutor executor)
 {
     using (ui)
     {
         ui.Title = this.GetName();
         ui.Icon  = this.GetIconBytes();
         ui.Show();
         executor.OutputReceived += (s, e) => ui.WriteOutput(e.Text);
         ui.Closing += (s, e) =>
         {
             executor.Dispose();
             return(true);
         };
         executor.AdbShell(device, "settings put secure user_setup_complete 1");
         executor.AdbShell(device, "settings put global device_provisioned 1");
         ui.Finish();
     }
 }
コード例 #5
0
ファイル: ESwitchABSlot.cs プロジェクト: ruo-an/AutumnBox
        public void Run(ILeafUI ui, ICommandExecutor executor, IDevice device)
        {
            using (ui)
            {
                ui.Icon = this.GetIcon();
                ui.Show();
                ui.Closing += (s, e) =>
                {
                    executor.Dispose();
                    return(true);
                };
                executor.OutputReceived += (s, e) => ui.WriteLineToDetails(e.Text);

                //Checking if device support A/B slot.
                try
                {
                    ui.StatusInfo = text.RxGetClassText("status_getting_crt_slot");
                    string slot       = device.GetVar("current-slot");
                    var    targetSlot = slot == "a" ? "b" : "a";
                    if (AskIfContinueToSwitch(ui))
                    {
                        ui.StatusInfo = text.RxGetClassText("status_switching");
                        var result = executor.Fastboot(device, "--set-active=" + targetSlot);
                        if (result.ExitCode == 0)
                        {
                            ui.Finish(StatusMessages.Success);
                        }
                        else
                        {
                            ui.Finish(StatusMessages.Failed);
                        }
                    }
                }
                catch (Exception e)
                {
                    DisplayNotSupportMessage(ui);
                    SLogger <ESwitchABSlot> .Warn(e);

                    ui.Shutdown();
                }
            }
        }
コード例 #6
0
        public void Main(ILeafUI ui, ICommandExecutor executor, IDevice device)
        {
            using (ui)
            {
                ui.Title = "TEST";
                ui.Show();
                ui.Closing += (s, e) =>
                {
                    executor.Dispose();
                    return(true);
                };
                executor.OutputReceived += (s, e) =>
                {
                    ui.WriteLine(e.Text);
                };
                var getter = new BatteryManager(device, executor);
                ui.WriteLine(getter.GetBatteryInfo().MaxCharingVoltage);

                ui.Finish();
            }
        }
コード例 #7
0
        public void EntryPoint(IDevice device, ILeafUI ui, IStorage storage,
                               IAppManager app, ICommandExecutor executor)
        {
            using (ui)
            {
                //初始化LeafUI并展示
                executor.OutputReceived += (s, e) =>
                {
                    ui.Println(e.Text);
                };
                ui.Closing += (s, e) =>
                {
                    try { executor.Dispose(); } catch { }
                    return(true);
                };

                ui.Show();

                try
                {
                    var screencap = new ScreenCap(device, executor, storage.CacheDirectory.FullName);
                    var file      = screencap.Cap();
                    ui.Println(file.FullName);
                    ShowOnUI(app, file.FullName);
                    ui.Shutdown();
                }
                catch (CommandCancelledException)
                {
                    ui.Println("Cancelled");
                }
                catch (CommandErrorException e)
                {
                    ui.ShowMessage(this.RxGetClassText("error"));
                    ui.Println(e.ToString());
                    ui.Finish(StatusMessages.Failed);
                }
            }
        }