diff --git a/DeviceTest/DeviceTestDlg.Designer.cs b/DeviceTest/DeviceTestDlg.Designer.cs index 8f88a9d82..d042c9d20 100644 --- a/DeviceTest/DeviceTestDlg.Designer.cs +++ b/DeviceTest/DeviceTestDlg.Designer.cs @@ -28,107 +28,207 @@ /// private void InitializeComponent() { - this.classNameComboBox = new System.Windows.Forms.ComboBox(); - this.classLabel = new System.Windows.Forms.Label(); - this.nameLabel = new System.Windows.Forms.Label(); - this.nameTextBox = new System.Windows.Forms.TextBox(); - this.configureButton = new System.Windows.Forms.Button(); - this.startButton = new System.Windows.Forms.Button(); - this.stopButton = new System.Windows.Forms.Button(); - this.SuspendLayout(); - // - // classNameComboBox - // - this.classNameComboBox.FormattingEnabled = true; - this.classNameComboBox.Location = new System.Drawing.Point(100, 29); - this.classNameComboBox.Name = "classNameComboBox"; - this.classNameComboBox.Size = new System.Drawing.Size(299, 21); - this.classNameComboBox.TabIndex = 0; - // - // classLabel - // - this.classLabel.AutoSize = true; - this.classLabel.Location = new System.Drawing.Point(34, 32); - this.classLabel.Name = "classLabel"; - this.classLabel.Size = new System.Drawing.Size(32, 13); - this.classLabel.TabIndex = 1; - this.classLabel.Text = "Class"; - // - // nameLabel - // - this.nameLabel.AutoSize = true; - this.nameLabel.Location = new System.Drawing.Point(34, 69); - this.nameLabel.Name = "nameLabel"; - this.nameLabel.Size = new System.Drawing.Size(35, 13); - this.nameLabel.TabIndex = 2; - this.nameLabel.Text = "Name"; - // - // nameTextBox - // - this.nameTextBox.Location = new System.Drawing.Point(100, 66); - this.nameTextBox.Name = "nameTextBox"; - this.nameTextBox.Size = new System.Drawing.Size(299, 20); - this.nameTextBox.TabIndex = 3; - // - // configureButton - // - this.configureButton.Location = new System.Drawing.Point(100, 104); - this.configureButton.Name = "configureButton"; - this.configureButton.Size = new System.Drawing.Size(129, 28); - this.configureButton.TabIndex = 4; - this.configureButton.Text = "Configure"; - this.configureButton.UseVisualStyleBackColor = true; - this.configureButton.Click += new System.EventHandler(this.configureButton_Click); - // - // startButton - // - this.startButton.Location = new System.Drawing.Point(100, 138); - this.startButton.Name = "startButton"; - this.startButton.Size = new System.Drawing.Size(129, 28); - this.startButton.TabIndex = 5; - this.startButton.Text = "Start device"; - this.startButton.UseVisualStyleBackColor = true; - this.startButton.Click += new System.EventHandler(this.startButton_Click); - // - // stopButton - // - this.stopButton.Location = new System.Drawing.Point(100, 172); - this.stopButton.Name = "stopButton"; - this.stopButton.Size = new System.Drawing.Size(129, 28); - this.stopButton.TabIndex = 6; - this.stopButton.Text = "Stop device"; - this.stopButton.UseVisualStyleBackColor = true; - this.stopButton.Click += new System.EventHandler(this.stopButton_Click); - // - // DeviceTestDlg - // - this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); - this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.ClientSize = new System.Drawing.Size(450, 262); - this.Controls.Add(this.stopButton); - this.Controls.Add(this.startButton); - this.Controls.Add(this.configureButton); - this.Controls.Add(this.nameTextBox); - this.Controls.Add(this.nameLabel); - this.Controls.Add(this.classLabel); - this.Controls.Add(this.classNameComboBox); - this.Name = "DeviceTestDlg"; - this.Text = "Device test"; - this.Load += new System.EventHandler(this.DeviceTestDlg_Load); - this.ResumeLayout(false); - this.PerformLayout(); + this.parentClassNameComboBox = new System.Windows.Forms.ComboBox(); + this.classLabel = new System.Windows.Forms.Label(); + this.nameLabel = new System.Windows.Forms.Label(); + this.parentNameTextBox = new System.Windows.Forms.TextBox(); + this.configureParentButton = new System.Windows.Forms.Button(); + this.startButton = new System.Windows.Forms.Button(); + this.stopButton = new System.Windows.Forms.Button(); + this.button1 = new System.Windows.Forms.Button(); + this.groupBox1 = new System.Windows.Forms.GroupBox(); + this.groupBox2 = new System.Windows.Forms.GroupBox(); + this.configureButton = new System.Windows.Forms.Button(); + this.nameTextBox = new System.Windows.Forms.TextBox(); + this.label1 = new System.Windows.Forms.Label(); + this.label2 = new System.Windows.Forms.Label(); + this.classNameComboBox = new System.Windows.Forms.ComboBox(); + this.groupBox1.SuspendLayout(); + this.groupBox2.SuspendLayout(); + this.SuspendLayout(); + // + // parentClassNameComboBox + // + this.parentClassNameComboBox.FormattingEnabled = true; + this.parentClassNameComboBox.Location = new System.Drawing.Point(77, 19); + this.parentClassNameComboBox.Name = "parentClassNameComboBox"; + this.parentClassNameComboBox.Size = new System.Drawing.Size(299, 21); + this.parentClassNameComboBox.TabIndex = 0; + // + // classLabel + // + this.classLabel.AutoSize = true; + this.classLabel.Location = new System.Drawing.Point(11, 22); + this.classLabel.Name = "classLabel"; + this.classLabel.Size = new System.Drawing.Size(32, 13); + this.classLabel.TabIndex = 1; + this.classLabel.Text = "Class"; + // + // nameLabel + // + this.nameLabel.AutoSize = true; + this.nameLabel.Location = new System.Drawing.Point(11, 47); + this.nameLabel.Name = "nameLabel"; + this.nameLabel.Size = new System.Drawing.Size(35, 13); + this.nameLabel.TabIndex = 2; + this.nameLabel.Text = "Name"; + // + // parentNameTextBox + // + this.parentNameTextBox.Location = new System.Drawing.Point(77, 44); + this.parentNameTextBox.Name = "parentNameTextBox"; + this.parentNameTextBox.Size = new System.Drawing.Size(299, 20); + this.parentNameTextBox.TabIndex = 3; + // + // configureParentButton + // + this.configureParentButton.Location = new System.Drawing.Point(77, 68); + this.configureParentButton.Name = "configureParentButton"; + this.configureParentButton.Size = new System.Drawing.Size(129, 28); + this.configureParentButton.TabIndex = 4; + this.configureParentButton.Text = "Configure"; + this.configureParentButton.UseVisualStyleBackColor = true; + this.configureParentButton.Click += new System.EventHandler(this.configureParentButton_Click); + // + // startButton + // + this.startButton.Location = new System.Drawing.Point(89, 273); + this.startButton.Name = "startButton"; + this.startButton.Size = new System.Drawing.Size(129, 28); + this.startButton.TabIndex = 5; + this.startButton.Text = "Start device"; + this.startButton.UseVisualStyleBackColor = true; + this.startButton.Click += new System.EventHandler(this.startButton_Click); + // + // stopButton + // + this.stopButton.Location = new System.Drawing.Point(89, 307); + this.stopButton.Name = "stopButton"; + this.stopButton.Size = new System.Drawing.Size(129, 28); + this.stopButton.TabIndex = 6; + this.stopButton.Text = "Stop device"; + this.stopButton.UseVisualStyleBackColor = true; + this.stopButton.Click += new System.EventHandler(this.stopButton_Click); + // + // button1 + // + this.button1.Location = new System.Drawing.Point(89, 239); + this.button1.Name = "button1"; + this.button1.Size = new System.Drawing.Size(129, 28); + this.button1.TabIndex = 7; + this.button1.Text = "Initialize"; + this.button1.UseVisualStyleBackColor = true; + this.button1.Click += new System.EventHandler(this.button1_Click); + // + // groupBox1 + // + this.groupBox1.Controls.Add(this.configureParentButton); + this.groupBox1.Controls.Add(this.parentNameTextBox); + this.groupBox1.Controls.Add(this.nameLabel); + this.groupBox1.Controls.Add(this.classLabel); + this.groupBox1.Controls.Add(this.parentClassNameComboBox); + this.groupBox1.Location = new System.Drawing.Point(12, 12); + this.groupBox1.Name = "groupBox1"; + this.groupBox1.Size = new System.Drawing.Size(405, 106); + this.groupBox1.TabIndex = 8; + this.groupBox1.TabStop = false; + this.groupBox1.Text = "Parent component"; + // + // groupBox2 + // + this.groupBox2.Controls.Add(this.configureButton); + this.groupBox2.Controls.Add(this.nameTextBox); + this.groupBox2.Controls.Add(this.label1); + this.groupBox2.Controls.Add(this.label2); + this.groupBox2.Controls.Add(this.classNameComboBox); + this.groupBox2.Location = new System.Drawing.Point(12, 127); + this.groupBox2.Name = "groupBox2"; + this.groupBox2.Size = new System.Drawing.Size(405, 106); + this.groupBox2.TabIndex = 9; + this.groupBox2.TabStop = false; + this.groupBox2.Text = "Component"; + // + // configureButton + // + this.configureButton.Location = new System.Drawing.Point(77, 68); + this.configureButton.Name = "configureButton"; + this.configureButton.Size = new System.Drawing.Size(129, 28); + this.configureButton.TabIndex = 4; + this.configureButton.Text = "Configure"; + this.configureButton.UseVisualStyleBackColor = true; + this.configureButton.Click += new System.EventHandler(this.configureButton_Click); + // + // nameTextBox + // + this.nameTextBox.Location = new System.Drawing.Point(77, 44); + this.nameTextBox.Name = "nameTextBox"; + this.nameTextBox.Size = new System.Drawing.Size(299, 20); + this.nameTextBox.TabIndex = 3; + // + // label1 + // + this.label1.AutoSize = true; + this.label1.Location = new System.Drawing.Point(11, 47); + this.label1.Name = "label1"; + this.label1.Size = new System.Drawing.Size(35, 13); + this.label1.TabIndex = 2; + this.label1.Text = "Name"; + // + // label2 + // + this.label2.AutoSize = true; + this.label2.Location = new System.Drawing.Point(11, 22); + this.label2.Name = "label2"; + this.label2.Size = new System.Drawing.Size(32, 13); + this.label2.TabIndex = 1; + this.label2.Text = "Class"; + // + // classNameComboBox + // + this.classNameComboBox.FormattingEnabled = true; + this.classNameComboBox.Location = new System.Drawing.Point(77, 19); + this.classNameComboBox.Name = "classNameComboBox"; + this.classNameComboBox.Size = new System.Drawing.Size(299, 21); + this.classNameComboBox.TabIndex = 0; + // + // DeviceTestDlg + // + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.ClientSize = new System.Drawing.Size(496, 377); + this.Controls.Add(this.groupBox2); + this.Controls.Add(this.button1); + this.Controls.Add(this.groupBox1); + this.Controls.Add(this.stopButton); + this.Controls.Add(this.startButton); + this.Name = "DeviceTestDlg"; + this.Text = "Device test"; + this.Load += new System.EventHandler(this.DeviceTestDlg_Load); + this.groupBox1.ResumeLayout(false); + this.groupBox1.PerformLayout(); + this.groupBox2.ResumeLayout(false); + this.groupBox2.PerformLayout(); + this.ResumeLayout(false); } #endregion - private System.Windows.Forms.ComboBox classNameComboBox; + private System.Windows.Forms.ComboBox parentClassNameComboBox; private System.Windows.Forms.Label classLabel; private System.Windows.Forms.Label nameLabel; - private System.Windows.Forms.TextBox nameTextBox; - private System.Windows.Forms.Button configureButton; + private System.Windows.Forms.TextBox parentNameTextBox; + private System.Windows.Forms.Button configureParentButton; private System.Windows.Forms.Button startButton; private System.Windows.Forms.Button stopButton; + private System.Windows.Forms.Button button1; + private System.Windows.Forms.GroupBox groupBox1; + private System.Windows.Forms.GroupBox groupBox2; + private System.Windows.Forms.Button configureButton; + private System.Windows.Forms.TextBox nameTextBox; + private System.Windows.Forms.Label label1; + private System.Windows.Forms.Label label2; + private System.Windows.Forms.ComboBox classNameComboBox; } } diff --git a/DeviceTest/DeviceTestDlg.cs b/DeviceTest/DeviceTestDlg.cs index ec82015ad..9ce60e97c 100644 --- a/DeviceTest/DeviceTestDlg.cs +++ b/DeviceTest/DeviceTestDlg.cs @@ -8,6 +8,8 @@ using System.Text; using System.Windows.Forms; using Config.Entities; using TBF.BenchControl; +using TBF.BenchControl.Generic; + namespace DeviceTest { @@ -15,6 +17,13 @@ namespace DeviceTest { IList compClasses; + IComponentFactory parentFactory; + IComponentFactory componentFactory; + + IComponentCfg parentCfg; + IComponentCfg componentCfg; + + public DeviceTestDlg() { InitializeComponent(); @@ -27,14 +36,48 @@ namespace DeviceTest private void DeviceTestDlg_Load(object sender, EventArgs e) { - foreach (var clName in compClasses) classNameComboBox.Items.Add(clName); + foreach (var clName in compClasses) parentClassNameComboBox.Items.Add(clName); } - private void configureButton_Click(object sender, EventArgs e) + private void configureParentButton_Click(object sender, EventArgs e) { + foreach (var factory in TbfComponents.Factories) + { + if (parentNameTextBox.Text == factory.ClassName) + { + parentFactory = factory; + break; + } + return; + } + + IComponentCfg cfg = parentFactory.DefaultConfig(); + IComponentCfgCtrl cfgControl = cfg.GetControl(); + cfgControl.Config = cfg; + cfgControl.Config.ItemNr = 0; + + TBF.ComponentParametersDlg cfgForm = new TBF.ComponentParametersDlg(); + cfgForm.TbfComponents = new List(); + cfgForm.ComponentCfgCtrl = cfgControl; + cfgForm.UnlockAfterStart = true; + DialogResult dr = cfgForm.ShowDialog(); + if (dr != DialogResult.OK) return; + + //flags |= CfgUpdateFlags.RestartRqrd; + //AddOne(cfgForm.Config.CreateDbEntity()); } + private void configureButton_Click(object sender, EventArgs e) + { + + } + + private void button1_Click(object sender, EventArgs e) + { + + } + private void startButton_Click(object sender, EventArgs e) {