Ejemplo n.º 1
0
        public PullingWindow(IFcuntionFlowBase _flow)
        {
            InitializeComponent();

            flow = _flow;
            flow.OutputReceived += (s, e) =>
            {
                this.Dispatcher.Invoke(() =>
                {
                    TBOutput.AppendText(e.Text);
                    TBOutput.ScrollToEnd();
                });
            };
            flow.NoArgFinished += (s, e) =>
            {
                this.Dispatcher.Invoke(() =>
                {
                    Close();
                });
            };
            if (flow.IsClosed)
            {
                throw new Exception("do not run flow!");
            }
            flow.MustTiggerAnyFinishedEvent = true;
        }
Ejemplo n.º 2
0
        private void StartFlash()
        {
            var args = new MiFlasherArgs()
            {
                DevBasicInfo = new DeviceBasicInfo()
                {
                    State  = DeviceState.Fastboot,
                    Serial = ShowInfo.Serial,
                },
                BatFileName = ((BatInfo)CBFlashType.SelectedItem).FullPath
            };

            _currentMiFlasher = new MiFlasher();
            _currentMiFlasher.Init(args);
            _currentMiFlasher.OutputReceived += (s, _e) =>
            {
                this.Dispatcher.Invoke(() =>
                {
                    TBOutput.AppendText(_e.Text + "\n");
                    TBOutput.ScrollToEnd();
                });
            };
            _currentMiFlasher.Finished += (s, _e) =>
            {
                this.Dispatcher.Invoke(() =>
                {
                    ChangeState(_e.Result.ResultType == Basic.FlowFramework.ResultType.Successful ? State.Successful : State.Fail);
                });
            };
            _currentMiFlasher.RunAsync();
            ChangeState(State.Flashing);
        }
Ejemplo n.º 3
0
 public void loge <T>(T str)
 {
     TBOutput.AppendText(str + "\r\n");
     TBOutput.Visible = true;
     TBOutput.Select(TBOutput.Text.Length, 0);
     TBOutput.ScrollToCaret();
 }
 public ApkInstallingWindow(ApkInstaller installer, List <FileInfo> files)
 {
     InitializeComponent();
     this.installer           = installer;
     _apkFilesCount           = files.Count;
     Owner                    = App.Current.MainWindow;
     TBCountOfInstalled.Text  = $"{_alreadyInstalledCount}/{_apkFilesCount}";
     this.installer.Finished += (s, e) =>
     {
         this.Dispatcher.Invoke(() =>
         {
             Close();
             new FlowResultWindow(e.Result).ShowDialog();
         });
     };
     this.installer.OutputReceived += (s, e) =>
     {
         this.Dispatcher.Invoke(() =>
         {
             var bytes = Encoding.Default.GetBytes(e.Text);
             TBOutput.AppendText(Encoding.UTF8.GetString(bytes) + "\n");
             TBOutput.ScrollToEnd();
         });
     };
     this.installer.AApkIstanlltionCompleted += (s, e) =>
     {
         this.Dispatcher.Invoke(() =>
         {
             ProgressAdd();
             if (!e.IsSuccess) //如果这次安装是失败的
             {                 //询问用户是否在安装失败的情况下继续
              //TODO
             }
         });
         return(true);
     };
 }