Test name cannot contain characters \ / : * ? " < > | (like a file name), ver. 2.18.925
This commit is contained in:
parent
f82658cee2
commit
078dc08ed0
@ -787,6 +787,16 @@ namespace TBF
|
||||
|
||||
private void metrology1ListViewEx_SubItemEndEditing(object sender, Results.Forms.SubItemEndEditingEventArgs e)
|
||||
{
|
||||
if (e.SubItem == (int)MtrlgyClmn.Name)
|
||||
{
|
||||
if (!Utils.IsGoodFName(e.DisplayText))
|
||||
{
|
||||
e.DisplayText = e.Item.SubItems[e.SubItem].Text;
|
||||
e.Cancel = true;
|
||||
return; /// NOK
|
||||
}
|
||||
}
|
||||
|
||||
int dummy;
|
||||
if (e.SubItem == (int)MtrlgyClmn.Part)
|
||||
{
|
||||
@ -1060,6 +1070,16 @@ namespace TBF
|
||||
|
||||
private void metrology2ListViewEx_SubItemEndEditing(object sender, Results.Forms.SubItemEndEditingEventArgs e)
|
||||
{
|
||||
if (e.SubItem == (int)Mtrlgy2Clmn.Name)
|
||||
{
|
||||
if (!Utils.IsGoodFName(e.DisplayText))
|
||||
{
|
||||
e.DisplayText = e.Item.SubItems[e.SubItem].Text;
|
||||
e.Cancel = true;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if ((e.SubItem == (int)Mtrlgy2Clmn.TankDraining) && !(metrology2Editors[(int)Mtrlgy2Clmn.TankDraining] as ComboBox).Items.Contains(e.DisplayText))
|
||||
{
|
||||
e.DisplayText = e.Item.SubItems[e.SubItem].Text;
|
||||
@ -1303,6 +1323,16 @@ namespace TBF
|
||||
|
||||
private void processListViewEx_SubItemEndEditing(object sender, Results.Forms.SubItemEndEditingEventArgs e)
|
||||
{
|
||||
if (e.SubItem == (int)ProcessClmn.Name)
|
||||
{
|
||||
if (!Utils.IsGoodFName(e.DisplayText))
|
||||
{
|
||||
e.DisplayText = e.Item.SubItems[e.SubItem].Text;
|
||||
e.Cancel = true;
|
||||
return; /// NOK
|
||||
}
|
||||
}
|
||||
|
||||
int dummy;
|
||||
if (e.SubItem == (int)ProcessClmn.Part)
|
||||
{
|
||||
@ -1530,6 +1560,16 @@ namespace TBF
|
||||
|
||||
private void parametersListViewEx_SubItemEndEditing(object sender, Results.Forms.SubItemEndEditingEventArgs e)
|
||||
{
|
||||
if (e.SubItem == (int)ParametersClmn.Name)
|
||||
{
|
||||
if (!Utils.IsGoodFName(e.DisplayText))
|
||||
{
|
||||
e.DisplayText = e.Item.SubItems[e.SubItem].Text;
|
||||
e.Cancel = true;
|
||||
return; /// NOK
|
||||
}
|
||||
}
|
||||
|
||||
int dummy;
|
||||
if (e.SubItem == (int)ParametersClmn.Part)
|
||||
{
|
||||
|
||||
@ -29,5 +29,5 @@ using System.Runtime.InteropServices;
|
||||
// Build Number
|
||||
// Revision
|
||||
//
|
||||
[assembly: AssemblyVersion("2.18.923.0")]
|
||||
[assembly: AssemblyFileVersion("2.18.923.0")]
|
||||
[assembly: AssemblyVersion("2.18.925.0")]
|
||||
[assembly: AssemblyFileVersion("2.18.925.0")]
|
||||
|
||||
247
TBF/TestWizard/MethodSelection.Designer.cs
generated
247
TBF/TestWizard/MethodSelection.Designer.cs
generated
@ -31,129 +31,130 @@ namespace TBF.TestWizard
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
this.horizSplitContainer = new System.Windows.Forms.SplitContainer();
|
||||
this.testNameTextBox = new System.Windows.Forms.TextBox();
|
||||
this.testNameLabel = new System.Windows.Forms.Label();
|
||||
this.testMethodComboBox = new System.Windows.Forms.ComboBox();
|
||||
this.testMethodLabel = new System.Windows.Forms.Label();
|
||||
this.cancelButton = new System.Windows.Forms.Button();
|
||||
this.nextButton = new System.Windows.Forms.Button();
|
||||
this.backButton = new System.Windows.Forms.Button();
|
||||
((System.ComponentModel.ISupportInitialize)(this.horizSplitContainer)).BeginInit();
|
||||
this.horizSplitContainer.Panel1.SuspendLayout();
|
||||
this.horizSplitContainer.Panel2.SuspendLayout();
|
||||
this.horizSplitContainer.SuspendLayout();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// horizSplitContainer
|
||||
//
|
||||
this.horizSplitContainer.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.horizSplitContainer.FixedPanel = System.Windows.Forms.FixedPanel.Panel2;
|
||||
this.horizSplitContainer.Location = new System.Drawing.Point(0, 0);
|
||||
this.horizSplitContainer.Name = "horizSplitContainer";
|
||||
this.horizSplitContainer.Orientation = System.Windows.Forms.Orientation.Horizontal;
|
||||
//
|
||||
// horizSplitContainer.Panel1
|
||||
//
|
||||
this.horizSplitContainer.Panel1.Controls.Add(this.testNameTextBox);
|
||||
this.horizSplitContainer.Panel1.Controls.Add(this.testNameLabel);
|
||||
this.horizSplitContainer.Panel1.Controls.Add(this.testMethodComboBox);
|
||||
this.horizSplitContainer.Panel1.Controls.Add(this.testMethodLabel);
|
||||
//
|
||||
// horizSplitContainer.Panel2
|
||||
//
|
||||
this.horizSplitContainer.Panel2.Controls.Add(this.cancelButton);
|
||||
this.horizSplitContainer.Panel2.Controls.Add(this.nextButton);
|
||||
this.horizSplitContainer.Panel2.Controls.Add(this.backButton);
|
||||
this.horizSplitContainer.Size = new System.Drawing.Size(284, 262);
|
||||
this.horizSplitContainer.SplitterDistance = 182;
|
||||
this.horizSplitContainer.TabIndex = 0;
|
||||
//
|
||||
// testNameTextBox
|
||||
//
|
||||
this.testNameTextBox.Location = new System.Drawing.Point(99, 47);
|
||||
this.testNameTextBox.Name = "testNameTextBox";
|
||||
this.testNameTextBox.Size = new System.Drawing.Size(165, 20);
|
||||
this.testNameTextBox.TabIndex = 5;
|
||||
//
|
||||
// testNameLabel
|
||||
//
|
||||
this.testNameLabel.AutoSize = true;
|
||||
this.testNameLabel.Location = new System.Drawing.Point(15, 50);
|
||||
this.testNameLabel.Name = "testNameLabel";
|
||||
this.testNameLabel.Size = new System.Drawing.Size(57, 13);
|
||||
this.testNameLabel.TabIndex = 4;
|
||||
this.testNameLabel.Text = "Test name";
|
||||
//
|
||||
// testMethodComboBox
|
||||
//
|
||||
this.testMethodComboBox.FormattingEnabled = true;
|
||||
this.testMethodComboBox.Location = new System.Drawing.Point(99, 96);
|
||||
this.testMethodComboBox.Name = "testMethodComboBox";
|
||||
this.testMethodComboBox.Size = new System.Drawing.Size(165, 21);
|
||||
this.testMethodComboBox.TabIndex = 1;
|
||||
this.testMethodComboBox.TextChanged += new System.EventHandler(this.testMethodComboBox_TextChanged);
|
||||
//
|
||||
// testMethodLabel
|
||||
//
|
||||
this.testMethodLabel.AutoSize = true;
|
||||
this.testMethodLabel.Location = new System.Drawing.Point(15, 99);
|
||||
this.testMethodLabel.Name = "testMethodLabel";
|
||||
this.testMethodLabel.Size = new System.Drawing.Size(66, 13);
|
||||
this.testMethodLabel.TabIndex = 0;
|
||||
this.testMethodLabel.Text = "Test method";
|
||||
//
|
||||
// cancelButton
|
||||
//
|
||||
this.cancelButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.cancelButton.DialogResult = System.Windows.Forms.DialogResult.Cancel;
|
||||
this.cancelButton.Location = new System.Drawing.Point(186, 17);
|
||||
this.cancelButton.Name = "cancelButton";
|
||||
this.cancelButton.Size = new System.Drawing.Size(75, 42);
|
||||
this.cancelButton.TabIndex = 27;
|
||||
this.cancelButton.Text = "&Cancel";
|
||||
this.cancelButton.UseVisualStyleBackColor = true;
|
||||
this.cancelButton.Click += new System.EventHandler(this.cancelButton_Click);
|
||||
//
|
||||
// nextButton
|
||||
//
|
||||
this.nextButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.nextButton.Location = new System.Drawing.Point(105, 17);
|
||||
this.nextButton.Name = "nextButton";
|
||||
this.nextButton.Size = new System.Drawing.Size(75, 42);
|
||||
this.nextButton.TabIndex = 26;
|
||||
this.nextButton.Text = "&Next >";
|
||||
this.nextButton.UseVisualStyleBackColor = true;
|
||||
this.nextButton.Click += new System.EventHandler(this.nextButton_Click);
|
||||
//
|
||||
// backButton
|
||||
//
|
||||
this.backButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.backButton.DialogResult = System.Windows.Forms.DialogResult.Retry;
|
||||
this.backButton.Location = new System.Drawing.Point(24, 17);
|
||||
this.backButton.Name = "backButton";
|
||||
this.backButton.Size = new System.Drawing.Size(75, 42);
|
||||
this.backButton.TabIndex = 25;
|
||||
this.backButton.Text = "< &Back";
|
||||
this.backButton.UseVisualStyleBackColor = true;
|
||||
this.backButton.Click += new System.EventHandler(this.backButton_Click);
|
||||
//
|
||||
// MethodSelection
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.ClientSize = new System.Drawing.Size(284, 262);
|
||||
this.Controls.Add(this.horizSplitContainer);
|
||||
this.Name = "MethodSelection";
|
||||
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
|
||||
this.Text = "MethodSelection";
|
||||
this.Load += new System.EventHandler(this.MethodSelection_Load);
|
||||
this.horizSplitContainer.Panel1.ResumeLayout(false);
|
||||
this.horizSplitContainer.Panel1.PerformLayout();
|
||||
this.horizSplitContainer.Panel2.ResumeLayout(false);
|
||||
((System.ComponentModel.ISupportInitialize)(this.horizSplitContainer)).EndInit();
|
||||
this.horizSplitContainer.ResumeLayout(false);
|
||||
this.ResumeLayout(false);
|
||||
this.horizSplitContainer = new System.Windows.Forms.SplitContainer();
|
||||
this.testNameTextBox = new System.Windows.Forms.TextBox();
|
||||
this.testNameLabel = new System.Windows.Forms.Label();
|
||||
this.testMethodComboBox = new System.Windows.Forms.ComboBox();
|
||||
this.testMethodLabel = new System.Windows.Forms.Label();
|
||||
this.cancelButton = new System.Windows.Forms.Button();
|
||||
this.nextButton = new System.Windows.Forms.Button();
|
||||
this.backButton = new System.Windows.Forms.Button();
|
||||
((System.ComponentModel.ISupportInitialize)(this.horizSplitContainer)).BeginInit();
|
||||
this.horizSplitContainer.Panel1.SuspendLayout();
|
||||
this.horizSplitContainer.Panel2.SuspendLayout();
|
||||
this.horizSplitContainer.SuspendLayout();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// horizSplitContainer
|
||||
//
|
||||
this.horizSplitContainer.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.horizSplitContainer.FixedPanel = System.Windows.Forms.FixedPanel.Panel2;
|
||||
this.horizSplitContainer.Location = new System.Drawing.Point(0, 0);
|
||||
this.horizSplitContainer.Name = "horizSplitContainer";
|
||||
this.horizSplitContainer.Orientation = System.Windows.Forms.Orientation.Horizontal;
|
||||
//
|
||||
// horizSplitContainer.Panel1
|
||||
//
|
||||
this.horizSplitContainer.Panel1.Controls.Add(this.testNameTextBox);
|
||||
this.horizSplitContainer.Panel1.Controls.Add(this.testNameLabel);
|
||||
this.horizSplitContainer.Panel1.Controls.Add(this.testMethodComboBox);
|
||||
this.horizSplitContainer.Panel1.Controls.Add(this.testMethodLabel);
|
||||
//
|
||||
// horizSplitContainer.Panel2
|
||||
//
|
||||
this.horizSplitContainer.Panel2.Controls.Add(this.cancelButton);
|
||||
this.horizSplitContainer.Panel2.Controls.Add(this.nextButton);
|
||||
this.horizSplitContainer.Panel2.Controls.Add(this.backButton);
|
||||
this.horizSplitContainer.Size = new System.Drawing.Size(284, 262);
|
||||
this.horizSplitContainer.SplitterDistance = 182;
|
||||
this.horizSplitContainer.TabIndex = 0;
|
||||
//
|
||||
// testNameTextBox
|
||||
//
|
||||
this.testNameTextBox.Location = new System.Drawing.Point(99, 47);
|
||||
this.testNameTextBox.Name = "testNameTextBox";
|
||||
this.testNameTextBox.Size = new System.Drawing.Size(165, 20);
|
||||
this.testNameTextBox.TabIndex = 5;
|
||||
this.testNameTextBox.TextChanged += new System.EventHandler(this.testNameTextBox_TextChanged);
|
||||
//
|
||||
// testNameLabel
|
||||
//
|
||||
this.testNameLabel.AutoSize = true;
|
||||
this.testNameLabel.Location = new System.Drawing.Point(15, 50);
|
||||
this.testNameLabel.Name = "testNameLabel";
|
||||
this.testNameLabel.Size = new System.Drawing.Size(57, 13);
|
||||
this.testNameLabel.TabIndex = 4;
|
||||
this.testNameLabel.Text = "Test name";
|
||||
//
|
||||
// testMethodComboBox
|
||||
//
|
||||
this.testMethodComboBox.FormattingEnabled = true;
|
||||
this.testMethodComboBox.Location = new System.Drawing.Point(99, 96);
|
||||
this.testMethodComboBox.Name = "testMethodComboBox";
|
||||
this.testMethodComboBox.Size = new System.Drawing.Size(165, 21);
|
||||
this.testMethodComboBox.TabIndex = 1;
|
||||
this.testMethodComboBox.TextChanged += new System.EventHandler(this.testMethodComboBox_TextChanged);
|
||||
//
|
||||
// testMethodLabel
|
||||
//
|
||||
this.testMethodLabel.AutoSize = true;
|
||||
this.testMethodLabel.Location = new System.Drawing.Point(15, 99);
|
||||
this.testMethodLabel.Name = "testMethodLabel";
|
||||
this.testMethodLabel.Size = new System.Drawing.Size(66, 13);
|
||||
this.testMethodLabel.TabIndex = 0;
|
||||
this.testMethodLabel.Text = "Test method";
|
||||
//
|
||||
// cancelButton
|
||||
//
|
||||
this.cancelButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.cancelButton.DialogResult = System.Windows.Forms.DialogResult.Cancel;
|
||||
this.cancelButton.Location = new System.Drawing.Point(186, 17);
|
||||
this.cancelButton.Name = "cancelButton";
|
||||
this.cancelButton.Size = new System.Drawing.Size(75, 42);
|
||||
this.cancelButton.TabIndex = 27;
|
||||
this.cancelButton.Text = "&Cancel";
|
||||
this.cancelButton.UseVisualStyleBackColor = true;
|
||||
this.cancelButton.Click += new System.EventHandler(this.cancelButton_Click);
|
||||
//
|
||||
// nextButton
|
||||
//
|
||||
this.nextButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.nextButton.Location = new System.Drawing.Point(105, 17);
|
||||
this.nextButton.Name = "nextButton";
|
||||
this.nextButton.Size = new System.Drawing.Size(75, 42);
|
||||
this.nextButton.TabIndex = 26;
|
||||
this.nextButton.Text = "&Next >";
|
||||
this.nextButton.UseVisualStyleBackColor = true;
|
||||
this.nextButton.Click += new System.EventHandler(this.nextButton_Click);
|
||||
//
|
||||
// backButton
|
||||
//
|
||||
this.backButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.backButton.DialogResult = System.Windows.Forms.DialogResult.Retry;
|
||||
this.backButton.Location = new System.Drawing.Point(24, 17);
|
||||
this.backButton.Name = "backButton";
|
||||
this.backButton.Size = new System.Drawing.Size(75, 42);
|
||||
this.backButton.TabIndex = 25;
|
||||
this.backButton.Text = "< &Back";
|
||||
this.backButton.UseVisualStyleBackColor = true;
|
||||
this.backButton.Click += new System.EventHandler(this.backButton_Click);
|
||||
//
|
||||
// MethodSelection
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.ClientSize = new System.Drawing.Size(284, 262);
|
||||
this.Controls.Add(this.horizSplitContainer);
|
||||
this.Name = "MethodSelection";
|
||||
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
|
||||
this.Text = "MethodSelection";
|
||||
this.Load += new System.EventHandler(this.MethodSelection_Load);
|
||||
this.horizSplitContainer.Panel1.ResumeLayout(false);
|
||||
this.horizSplitContainer.Panel1.PerformLayout();
|
||||
this.horizSplitContainer.Panel2.ResumeLayout(false);
|
||||
((System.ComponentModel.ISupportInitialize)(this.horizSplitContainer)).EndInit();
|
||||
this.horizSplitContainer.ResumeLayout(false);
|
||||
this.ResumeLayout(false);
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ -70,7 +70,8 @@ namespace TBF.TestWizard
|
||||
|
||||
bool IsFormValid()
|
||||
{
|
||||
return testMethodComboBox.Items.Contains(testMethodComboBox.Text);
|
||||
bool methodOK = testMethodComboBox.Items.Contains(testMethodComboBox.Text);
|
||||
return Utils.IsGoodFName(testNameTextBox.Text) && methodOK;
|
||||
}
|
||||
|
||||
private void backButton_Click(object sender, EventArgs e)
|
||||
@ -100,12 +101,12 @@ namespace TBF.TestWizard
|
||||
Close();
|
||||
}
|
||||
|
||||
private void testMethodComboBox_TextChanged(object sender, EventArgs e)
|
||||
{
|
||||
nextButton.Enabled = IsFormValid();
|
||||
}
|
||||
private void testNameTextBox_TextChanged(object sender, EventArgs e)
|
||||
{
|
||||
nextButton.Enabled = IsFormValid();
|
||||
}
|
||||
|
||||
private void sensorsComboBox_TextChanged(object sender, EventArgs e)
|
||||
private void testMethodComboBox_TextChanged(object sender, EventArgs e)
|
||||
{
|
||||
nextButton.Enabled = IsFormValid();
|
||||
}
|
||||
|
||||
15
TBF/Utils.cs
15
TBF/Utils.cs
@ -4,6 +4,8 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using Config.Entities;
|
||||
using Dirichlet.Numerics;
|
||||
|
||||
@ -369,5 +371,18 @@ namespace TBF
|
||||
dateTime.Hour.ToString("D2"),
|
||||
dateTime.Minute.ToString("D2"));
|
||||
}
|
||||
|
||||
public static bool IsGoodFName(string fname)
|
||||
{
|
||||
return !fname.Contains('\\') &&
|
||||
!fname.Contains('/') &&
|
||||
!fname.Contains(':') &&
|
||||
!fname.Contains('*') &&
|
||||
!fname.Contains('?') &&
|
||||
!fname.Contains('"') &&
|
||||
!fname.Contains('<') &&
|
||||
!fname.Contains('>') &&
|
||||
!fname.Contains('|');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user