📄 formexecute.cs
字号:
using System;
using System.IO;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data;
using System.Xml;
using v6SmokeTest;
using v6SmokeTest.PasswordTest.PlugIn;
using v6SmokeTest.PasswordTest.PlugIn.Global;
namespace v6SmokeTest.PasswordTest
{
/// <summary>
/// 测试执行窗口类。
/// </summary>
public class FormExecute : System.Windows.Forms.Form
{
#region 本地变量定义
private System.ComponentModel.IContainer components;
private System.Windows.Forms.Button btnSave;
private System.Windows.Forms.Button btnExit;
private System.Windows.Forms.ToolTip tTMain;
private System.Windows.Forms.OpenFileDialog OFDlgFiles;
private System.Windows.Forms.FolderBrowserDialog FBDlgTestApp;
private System.Windows.Forms.FolderBrowserDialog FBDlgOfficeApp;
private System.Windows.Forms.FolderBrowserDialog FBDlgInPath;
private System.Windows.Forms.FolderBrowserDialog FBDlgOutPath;
private System.Windows.Forms.GroupBox gbOption;
private System.Windows.Forms.Button btnOutPath;
private System.Windows.Forms.TextBox txtOutPath;
private System.Windows.Forms.Label lbOutPath;
private System.Windows.Forms.Button btnInPath;
private System.Windows.Forms.TextBox txtInPath;
private System.Windows.Forms.Label lbInPath;
private System.Windows.Forms.Button btnCancle;
private System.Windows.Forms.ComboBox cbFiles;
private System.Windows.Forms.TextBox txtPassword;
private System.Windows.Forms.Label lbPassword;
private System.Windows.Forms.Button btnFileLocation;
private System.Windows.Forms.Label lbFileLocation;
private System.Windows.Forms.Button btnDelete;
private System.Windows.Forms.Button btnAdd;
private System.Windows.Forms.ListView lvFileList;
private System.Windows.Forms.ColumnHeader cHID;
private System.Windows.Forms.ColumnHeader cHFileName;
private System.Windows.Forms.ColumnHeader cHPassWord;
private System.Windows.Forms.GroupBox gbFileList;
private System.Windows.Forms.ComboBox cbTestProject;
private System.Windows.Forms.Label lbTestProject;
private System.Windows.Forms.CheckBox chbShowWin;
private System.Windows.Forms.Button btnExecute;
/// <summary>
/// 记录标题
/// </summary>
private string m_strCaption = "密码测试";
/// <summary>
/// 包含文件列表的配置文件
/// </summary>
private string m_strCfgFileName = String.Empty;
/// <summary>
/// 特征密码表文件
/// </summary>
private string m_strCharPassFileName = String.Empty;
/// <summary>
/// 测试项目
/// </summary>
private int m_nTestProject = -1;
/// <summary>
/// 是否自动开始
/// </summary>
private bool m_blAutoStart = false;
/// <summary>
/// 是否自动退出
/// </summary>
private bool m_blAutoExit = false;
/// <summary>
/// 文件列表中上次选中的索引
/// </summary>
private int m_nSeletedIndex = -1;
/// <summary>
/// 写配置文件的对象
/// </summary>
private LoggerMain m_pLoggerMain = new LoggerMain();
/// <summary>
/// 所有文档位置和对应密码的列表信息
/// </summary>
private LoggerInf m_pLogInfs = new LoggerInf("Files", String.Empty);
/// <summary>
/// 设置输入文件路径
/// </summary>
private string m_strInFile = String.Empty;
/// <summary>
/// 设置输入路径
/// </summary>
private string m_strInPath = String.Empty;
/// <summary>
/// 设置输出文件路径
/// </summary>
private string m_strOutPath = String.Empty;
/// <summary>
/// 测试过程中是否显示程序主窗口
/// </summary>
private bool m_blShowWin = false;
/// <summary>
/// 关闭异常类对象
/// </summary>
private CaptureException m_pCapEx = null;
#endregion
#region 设置运行参数
/// <summary>
/// 是否自动运行
/// </summary>
public bool AutoStart
{
set{m_blAutoStart = value;}
}
/// <summary>
/// 执行完后是否自动退出
/// </summary>
public bool AutoExit
{
set{m_blAutoExit = value;}
}
#endregion
#region 构造函数
/// <summary>
/// 构造函数
/// </summary>
public FormExecute(FormMain parent)
{
this.MdiParent = parent;
m_strCfgFileName = Path.GetDirectoryName(Application.ExecutablePath) + @"\Config.xml";
m_strCharPassFileName = Path.GetDirectoryName(Application.ExecutablePath) + @"\CharPass.xml";
m_pLoggerMain.SetXmlLogFileName = m_strCfgFileName;
InitializeComponent();
}
#endregion
#region 清理所有正在使用的资源
/// <summary>
/// 清理所有正在使用的资源。
/// </summary>
protected override void Dispose( bool disposing )
{
if( disposing )
{
if (components != null)
{
components.Dispose();
}
}
base.Dispose( disposing );
}
#endregion
#region Windows 窗体设计器生成的代码
/// <summary>
/// 设计器支持所需的方法 - 不要使用代码编辑器修改
/// 此方法的内容。
/// </summary>
private void InitializeComponent()
{
this.components = new System.ComponentModel.Container();
this.btnExecute = new System.Windows.Forms.Button();
this.btnSave = new System.Windows.Forms.Button();
this.btnExit = new System.Windows.Forms.Button();
this.OFDlgFiles = new System.Windows.Forms.OpenFileDialog();
this.tTMain = new System.Windows.Forms.ToolTip(this.components);
this.txtOutPath = new System.Windows.Forms.TextBox();
this.txtInPath = new System.Windows.Forms.TextBox();
this.btnCancle = new System.Windows.Forms.Button();
this.chbShowWin = new System.Windows.Forms.CheckBox();
this.FBDlgTestApp = new System.Windows.Forms.FolderBrowserDialog();
this.FBDlgOfficeApp = new System.Windows.Forms.FolderBrowserDialog();
this.FBDlgInPath = new System.Windows.Forms.FolderBrowserDialog();
this.FBDlgOutPath = new System.Windows.Forms.FolderBrowserDialog();
this.gbOption = new System.Windows.Forms.GroupBox();
this.btnOutPath = new System.Windows.Forms.Button();
this.lbOutPath = new System.Windows.Forms.Label();
this.btnInPath = new System.Windows.Forms.Button();
this.lbInPath = new System.Windows.Forms.Label();
this.cbTestProject = new System.Windows.Forms.ComboBox();
this.lbTestProject = new System.Windows.Forms.Label();
this.cbFiles = new System.Windows.Forms.ComboBox();
this.txtPassword = new System.Windows.Forms.TextBox();
this.lbPassword = new System.Windows.Forms.Label();
this.btnFileLocation = new System.Windows.Forms.Button();
this.lbFileLocation = new System.Windows.Forms.Label();
this.btnDelete = new System.Windows.Forms.Button();
this.btnAdd = new System.Windows.Forms.Button();
this.lvFileList = new System.Windows.Forms.ListView();
this.cHID = new System.Windows.Forms.ColumnHeader();
this.cHFileName = new System.Windows.Forms.ColumnHeader();
this.cHPassWord = new System.Windows.Forms.ColumnHeader();
this.gbFileList = new System.Windows.Forms.GroupBox();
this.gbOption.SuspendLayout();
this.gbFileList.SuspendLayout();
this.SuspendLayout();
//
// btnExecute
//
this.btnExecute.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.btnExecute.FlatStyle = System.Windows.Forms.FlatStyle.System;
this.btnExecute.Location = new System.Drawing.Point(287, 399);
this.btnExecute.Name = "btnExecute";
this.btnExecute.Size = new System.Drawing.Size(58, 24);
this.btnExecute.TabIndex = 97;
this.btnExecute.Text = "执行";
this.btnExecute.Click += new System.EventHandler(this.btnExecute_Click);
//
// btnSave
//
this.btnSave.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.btnSave.FlatStyle = System.Windows.Forms.FlatStyle.System;
this.btnSave.Location = new System.Drawing.Point(348, 399);
this.btnSave.Name = "btnSave";
this.btnSave.Size = new System.Drawing.Size(59, 24);
this.btnSave.TabIndex = 98;
this.btnSave.Text = "保存";
this.btnSave.Click += new System.EventHandler(this.btnSave_Click);
//
// btnExit
//
this.btnExit.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.btnExit.DialogResult = System.Windows.Forms.DialogResult.Cancel;
this.btnExit.FlatStyle = System.Windows.Forms.FlatStyle.System;
this.btnExit.Location = new System.Drawing.Point(412, 399);
this.btnExit.Name = "btnExit";
this.btnExit.Size = new System.Drawing.Size(58, 24);
this.btnExit.TabIndex = 99;
this.btnExit.Text = "退出";
this.btnExit.Click += new System.EventHandler(this.btnExit_Click);
//
// OFDlgFiles
//
this.OFDlgFiles.CheckFileExists = false;
this.OFDlgFiles.Filter = "所有文件|*.*";
this.OFDlgFiles.InitialDirectory = "C:\\";
this.OFDlgFiles.Multiselect = true;
this.OFDlgFiles.Title = "请选择要测试的文件";
//
// tTMain
//
this.tTMain.AutoPopDelay = 5000;
this.tTMain.InitialDelay = 100;
this.tTMain.ReshowDelay = 100;
this.tTMain.ShowAlways = true;
//
// txtOutPath
//
this.txtOutPath.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.txtOutPath.Location = new System.Drawing.Point(60, 58);
this.txtOutPath.Name = "txtOutPath";
this.txtOutPath.Size = new System.Drawing.Size(380, 21);
this.txtOutPath.TabIndex = 10;
this.txtOutPath.Text = "";
this.tTMain.SetToolTip(this.txtOutPath, "测试文件的输出路径");
this.txtOutPath.TextChanged += new System.EventHandler(this.txtOutPath_TextChanged);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -