📄 optionsdialog.cs
字号:
// visualStudioSupportCheckBox
//
this.helpProvider1.SetHelpString(this.visualStudioSupportCheckBox, "If checked, Visual Studio projects and solutions may be opened or added to existi" +
"ng test projects.");
this.visualStudioSupportCheckBox.Location = new System.Drawing.Point(27, 288);
this.visualStudioSupportCheckBox.Name = "visualStudioSupportCheckBox";
this.helpProvider1.SetShowHelp(this.visualStudioSupportCheckBox, true);
this.visualStudioSupportCheckBox.Size = new System.Drawing.Size(220, 21);
this.visualStudioSupportCheckBox.TabIndex = 14;
this.visualStudioSupportCheckBox.Text = "Enable Visual Studio Support";
//
// label2
//
this.label2.Location = new System.Drawing.Point(27, 28);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(46, 14);
this.label2.TabIndex = 1;
this.label2.Text = "Display";
//
// label3
//
this.label3.Location = new System.Drawing.Point(127, 28);
this.label3.Name = "label3";
this.label3.Size = new System.Drawing.Size(93, 21);
this.label3.TabIndex = 3;
this.label3.Text = "files in list";
//
// recentFilesCountTextBox
//
this.recentFilesCountTextBox.Location = new System.Drawing.Point(80, 28);
this.recentFilesCountTextBox.Name = "recentFilesCountTextBox";
this.recentFilesCountTextBox.Size = new System.Drawing.Size(33, 20);
this.recentFilesCountTextBox.TabIndex = 2;
this.recentFilesCountTextBox.Text = "";
this.recentFilesCountTextBox.Validating += new System.ComponentModel.CancelEventHandler(this.recentFilesCountTextBox_Validating);
this.recentFilesCountTextBox.Validated += new System.EventHandler(this.recentFilesCountTextBox_Validated);
//
// groupBox1
//
this.groupBox1.Location = new System.Drawing.Point(13, 7);
this.groupBox1.Name = "groupBox1";
this.groupBox1.Size = new System.Drawing.Size(240, 111);
this.groupBox1.TabIndex = 0;
this.groupBox1.TabStop = false;
this.groupBox1.Text = "Recent Files";
//
// groupBox2
//
this.groupBox2.Location = new System.Drawing.Point(13, 125);
this.groupBox2.Name = "groupBox2";
this.groupBox2.Size = new System.Drawing.Size(240, 90);
this.groupBox2.TabIndex = 7;
this.groupBox2.TabStop = false;
this.groupBox2.Text = "Assembly Reload";
//
// groupBox3
//
this.groupBox3.Location = new System.Drawing.Point(13, 272);
this.groupBox3.Name = "groupBox3";
this.groupBox3.Size = new System.Drawing.Size(240, 40);
this.groupBox3.TabIndex = 13;
this.groupBox3.TabStop = false;
this.groupBox3.Text = "Visual Studio";
//
// groupBox4
//
this.groupBox4.Controls.Add(this.labelTestOutputCheckBox);
this.groupBox4.Location = new System.Drawing.Point(13, 224);
this.groupBox4.Name = "groupBox4";
this.groupBox4.Size = new System.Drawing.Size(240, 40);
this.groupBox4.TabIndex = 11;
this.groupBox4.TabStop = false;
this.groupBox4.Text = "Test Output";
//
// labelTestOutputCheckBox
//
this.labelTestOutputCheckBox.Location = new System.Drawing.Point(16, 16);
this.labelTestOutputCheckBox.Name = "labelTestOutputCheckBox";
this.labelTestOutputCheckBox.Size = new System.Drawing.Size(220, 16);
this.labelTestOutputCheckBox.TabIndex = 12;
this.labelTestOutputCheckBox.Text = "Label Test Cases in Console output";
//
// OptionsDialog
//
this.AcceptButton = this.okButton;
this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
this.CancelButton = this.cancelButton;
this.ClientSize = new System.Drawing.Size(268, 336);
this.Controls.Add(this.groupBox4);
this.Controls.Add(this.recentFilesCountTextBox);
this.Controls.Add(this.label3);
this.Controls.Add(this.label2);
this.Controls.Add(this.visualStudioSupportCheckBox);
this.Controls.Add(this.reloadOnRunCheckBox);
this.Controls.Add(this.initialDisplayComboBox);
this.Controls.Add(this.label1);
this.Controls.Add(this.loadLastProjectCheckBox);
this.Controls.Add(this.clearResultsCheckBox);
this.Controls.Add(this.reloadOnChangeCheckBox);
this.Controls.Add(this.cancelButton);
this.Controls.Add(this.okButton);
this.Controls.Add(this.groupBox1);
this.Controls.Add(this.groupBox2);
this.Controls.Add(this.groupBox3);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
this.HelpButton = true;
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
this.MaximizeBox = false;
this.MinimizeBox = false;
this.Name = "OptionsDialog";
this.ShowInTaskbar = false;
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
this.Text = "NUnit Options";
this.Closing += new System.ComponentModel.CancelEventHandler(this.OptionsDialog_Closing);
this.Load += new System.EventHandler(this.OptionsDialog_Load);
this.groupBox4.ResumeLayout(false);
this.ResumeLayout(false);
}
#endregion
private void OptionsDialog_Load(object sender, System.EventArgs e)
{
recentFilesCountTextBox.Text = UserSettings.RecentProjects.MaxFiles.ToString();
loadLastProjectCheckBox.Checked = options.LoadLastProject;
initialDisplayComboBox.SelectedIndex = options.InitialTreeDisplay;
reloadOnChangeCheckBox.Enabled = Environment.OSVersion.Platform == System.PlatformID.Win32NT;
reloadOnChangeCheckBox.Checked = options.ReloadOnChange;
reloadOnRunCheckBox.Checked = options.ReloadOnRun;
clearResultsCheckBox.Checked = options.ClearResults;
labelTestOutputCheckBox.Checked = options.TestLabels;
visualStudioSupportCheckBox.Checked = options.VisualStudioSupport;
}
private void okButton_Click(object sender, System.EventArgs e)
{
if ( options.ReloadOnChange != reloadOnChangeCheckBox.Checked )
{
string msg = String.Format(
"Watching for file changes will be {0} the next time you load an assembly.",
reloadOnChangeCheckBox.Checked ? "enabled" : "disabled" );
UserMessage.DisplayInfo( msg, "NUnit Options" );
}
options.LoadLastProject = loadLastProjectCheckBox.Checked;
TestLoader loader = AppUI.TestLoader;
loader.ReloadOnChange = options.ReloadOnChange = reloadOnChangeCheckBox.Checked;
loader.ReloadOnRun = options.ReloadOnRun = reloadOnRunCheckBox.Checked;
options.ClearResults = clearResultsCheckBox.Checked;
options.TestLabels = labelTestOutputCheckBox.Checked;
options.VisualStudioSupport = visualStudioSupportCheckBox.Checked;
options.InitialTreeDisplay = initialDisplayComboBox.SelectedIndex;
DialogResult = DialogResult.OK;
Close();
}
private void recentFilesCountTextBox_Validating(object sender, System.ComponentModel.CancelEventArgs e)
{
if ( recentFilesCountTextBox.Text.Length == 0 )
{
recentFilesCountTextBox.Text = UserSettings.RecentProjects.MaxFiles.ToString();
recentFilesCountTextBox.SelectAll();
e.Cancel = true;
}
else
{
string errmsg = null;
try
{
int count = int.Parse( recentFilesCountTextBox.Text );
if ( count < RecentProjectSettings.MinSize ||
count > RecentProjectSettings.MaxSize )
{
errmsg = string.Format( "Number of files must be from {0} to {1}", RecentProjectSettings.MinSize, RecentProjectSettings.MaxSize );
}
}
catch
{
errmsg = "Number of files must be numeric";
}
if ( errmsg != null )
{
recentFilesCountTextBox.SelectAll();
UserMessage.DisplayFailure( errmsg );
e.Cancel = true;
}
}
}
private void recentFilesCountTextBox_Validated(object sender, System.EventArgs e)
{
int count = int.Parse( recentFilesCountTextBox.Text );
UserSettings.RecentProjects.MaxFiles = count;
}
private void OptionsDialog_Closing(object sender, System.ComponentModel.CancelEventArgs e)
{
e.Cancel = false;
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -