示例#1
0
        internal async Task <ExternalProcess> LaunchApplication(string options, CancellationToken cancellationToken)
        {
            ExternalProcess logcatProcess = null;

            if (Options.SaveLogCat != null)
            {
                await ClearLogCat(cancellationToken).ConfigureAwait(false);

                var output = new StreamWriter(Options.SaveLogCat);
                logcatProcess = await StartLogCat(output, cancellationToken);
            }

            var args = new StringBuilder();

            args.Append(AdbCommandLine("shell am start -W -S"));
            args.Append($" -e XAMARIN_ASYNCTESTS_OPTIONS \"'{options}'\" ");

            var activity = Program.Options.AndroidActivity ?? "com.xamarin.webtests.android/com.xamarin.webtests.android.MainActivity";

            args.Append(activity);

            Program.Debug("Launching apk: {0}", args);

            var process = await ProcessHelper.StartCommand(Adb, args.ToString(), cancellationToken).ConfigureAwait(false);

            if (logcatProcess != null)
            {
                process.ExitedEvent += (sender, e) => logcatProcess.Dispose();
            }

            return(process);
        }
示例#2
0
        internal async Task <ExternalProcess> LaunchApplication(string options, CancellationToken cancellationToken)
        {
            ExternalProcess logcatProcess = null;

            if (Options.SaveLogCat != null)
            {
                await ClearLogCat(cancellationToken).ConfigureAwait(false);

                var output = new StreamWriter(Options.SaveLogCat);
                logcatProcess = await StartLogCat(output, cancellationToken);
            }

            var args = new StringBuilder();

            args.Append("shell am start ");
            args.Append("-W -S ");
            args.AppendFormat(" -e XAMARIN_ASYNCTESTS_OPTIONS \\'{0}\\' ", options);
            args.Append(Program.Options.Application);

            Program.Debug("Launching apk: {0}", args);

            var process = await ProcessHelper.StartCommand(Adb, args.ToString(), cancellationToken).ConfigureAwait(false);

            if (logcatProcess != null)
            {
                process.ExitedEvent += (sender, e) => logcatProcess.Dispose();
            }

            return(process);
        }
示例#3
0
        /// ------------------------------------------------------------------------------------
        public void Cancel()
        {
            if (_process == null || _process.HasExited)
            {
                return;
            }

            ConversionState = ConvertMediaUIState.ConversionCancelled;
            _process.KillProcess();
            _process.Dispose();

            DeleteOutputFile();
        }
示例#4
0
        /// ------------------------------------------------------------------------------------
        public void ShutdownMPlayerProcess()
        {
            try
            {
                if (_mplayerProcess != null && !_mplayerProcess.HasExited)
                {
                    _mplayerProcess.KillProcess();
                    _mplayerProcess.Dispose();
                    _mplayerProcess = null;
                    _stdIn          = null;
                }

                if (_loopDelayTimer != null)
                {
                    _loopDelayTimer.Dispose();
                    _loopDelayTimer = null;
                }
            }
            catch { }
        }