示例#1
0
        private void AppName2_SelectedIndexChanged(object sender, EventArgs e)
        {
            pagename2.Items.Clear();
            string FileName  = "./tools/aapt.exe";
            string Arguments = "dump badging " + "./testCase/" + TestCases.Text + "/apps/" + AppName2.Text;
            string output    = CmdUtils.runCommand(FileName, Arguments);
            string RegexStr1 = @"package: name='(.*?)' ";
            Match  mat1      = Regex.Match(output, RegexStr1);

            for (int i = 0; i < mat1.Groups.Count; i++)
            {
                if (!mat1.Groups[i].Value.Contains("='"))
                {
                    this.pagename2.Items.AddRange(new object[] { mat1.Groups[i].Value });
                }
            }
            this.pagename2.Text = mat1.Groups[1].Value;
            activity2.Items.Clear();
            string RegexStr2 = @"launchable-activity: name='(.*?)'  ";
            Match  mat2      = Regex.Match(output, RegexStr2);

            for (int i = 0; i < mat2.Groups.Count; i++)
            {
                if (!mat2.Groups[i].Value.Contains("='"))
                {
                    this.activity2.Items.AddRange(new object[] { mat2.Groups[i].Value });
                }
            }
            this.activity2.Text = mat2.Groups[1].Value;
        }
示例#2
0
        private void CancelTest_Click(object sender, EventArgs e)
        {
            string message = CmdUtils.RunCmd("tasklist /fi \"imagename eq StartAwTest.exe\"");

            if (!message.Contains("没有运行的任务匹配"))
            {
                DialogResult dr = MessageBoxEx.Show(this, "确定终止脚本执行?", "停止确认", MessageBoxButtons.OKCancel, MessageBoxIcon.Question);
                if (dr == DialogResult.OK)
                {
                    CmdUtils.RunCmd("taskkill /f /t /im StartAwTest.exe");
                    this.RunCaseResult.SelectionColor = Color.Black;
                    this.RunCaseResult.AppendText("已终止脚本执行\r\n");
                }
            }
            this.StartTest.Enabled  = true;
            this.CancelTest.Enabled = false;
        }