From 39c07206834fbfaacb6c3b37d937efc6f0d5bc20 Mon Sep 17 00:00:00 2001 From: H4CK3R-01 Date: Thu, 7 Apr 2022 08:31:06 +0200 Subject: [PATCH] Implemented Advanced mode to show/hide some fields in data grids --- SOURCE/Plugin/DeviceDescription.Designer.cs | 20 +++++ SOURCE/Plugin/DeviceDescription.cs | 40 +++++++++ SOURCE/Plugin/DeviceDescription.resx | 98 ++++++++++++++++++++- 3 files changed, 154 insertions(+), 4 deletions(-) diff --git a/SOURCE/Plugin/DeviceDescription.Designer.cs b/SOURCE/Plugin/DeviceDescription.Designer.cs index 5cc9e93..d72204f 100644 --- a/SOURCE/Plugin/DeviceDescription.Designer.cs +++ b/SOURCE/Plugin/DeviceDescription.Designer.cs @@ -226,6 +226,8 @@ namespace Aml.Editor.Plugin this.toolStripButton13 = new System.Windows.Forms.ToolStripButton(); this.toolStripButton14 = new System.Windows.Forms.ToolStripButton(); this.toolStripButton15 = new System.Windows.Forms.ToolStripButton(); + this.viewToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.advancedModeToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.toolStrip1.SuspendLayout(); this.Page0_FullWindow.SuspendLayout(); this.Page0_FullWindowPanel2.SuspendLayout(); @@ -291,6 +293,7 @@ namespace Aml.Editor.Plugin this.toolStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { this.fileButton, this.librariesSplitButton, + this.viewToolStripMenuItem, this.helpButton, this.vendorNameTextBox, this.filePathLabel, @@ -2373,6 +2376,21 @@ namespace Aml.Editor.Plugin this.toolStripButton15.Size = new System.Drawing.Size(44, 24); this.toolStripButton15.Text = "Save"; // + // viewToolStripMenuItem + // + this.viewToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { + this.advancedModeToolStripMenuItem}); + this.viewToolStripMenuItem.Name = "viewToolStripMenuItem"; + this.viewToolStripMenuItem.Size = new System.Drawing.Size(44, 23); + this.viewToolStripMenuItem.Text = "View"; + // + // advancedModeToolStripMenuItem + // + this.advancedModeToolStripMenuItem.Name = "advancedModeToolStripMenuItem"; + this.advancedModeToolStripMenuItem.Size = new System.Drawing.Size(180, 22); + this.advancedModeToolStripMenuItem.Text = "Advanced Mode"; + this.advancedModeToolStripMenuItem.Click += new System.EventHandler(this.advancedModeToolStripMenuItem_Click); + // // DeviceDescription // this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F); @@ -2662,5 +2680,7 @@ namespace Aml.Editor.Plugin private System.Windows.Forms.TextBox genericDataDescriptionTxtBx; private System.Windows.Forms.ToolStrip toolStrip5; private System.Windows.Forms.ToolStripLabel genericDataHeaderLabel; + private System.Windows.Forms.ToolStripMenuItem viewToolStripMenuItem; + private System.Windows.Forms.ToolStripMenuItem advancedModeToolStripMenuItem; } } diff --git a/SOURCE/Plugin/DeviceDescription.cs b/SOURCE/Plugin/DeviceDescription.cs index 253ea48..c479756 100644 --- a/SOURCE/Plugin/DeviceDescription.cs +++ b/SOURCE/Plugin/DeviceDescription.cs @@ -29,6 +29,7 @@ namespace Aml.Editor.Plugin private MWData.MWFileType filetype; private object _row; private bool isEditing = false; + private bool expertMode = false; private OpenFileDialog openFileDialog = new OpenFileDialog(); private List AllInterfaces = new List(); @@ -90,6 +91,8 @@ namespace Aml.Editor.Plugin public DeviceDescription() { InitializeComponent(); + + ShowHideElements(); } /// @@ -109,6 +112,8 @@ namespace Aml.Editor.Plugin this.mWController = mWController; InitializeComponent(); + ShowHideElements(); + // After intialization of this GUI, plugin all this function to load Standard Libraries. loadStandardLibrary(); @@ -4691,5 +4696,40 @@ namespace Aml.Editor.Plugin { } + + private void advancedModeToolStripMenuItem_Click(object sender, EventArgs e) + { + // Switch mode + expertMode = !expertMode; + + // Change text + if (expertMode) + { + this.advancedModeToolStripMenuItem.Text = "Easy mode"; + } + else + { + this.advancedModeToolStripMenuItem.Text = "Expert mode"; + } + + // Show/hide elements + this.ShowHideElements(); + } + + + private void ShowHideElements() + { + genericparametersAttrDataGridView.Columns[2].Visible = expertMode; + genericparametersAttrDataGridView.Columns[3].Visible = expertMode; + genericparametersAttrDataGridView.Columns[4].Visible = expertMode; + genericparametersAttrDataGridView.Columns[5].Visible = expertMode; + + + elecInterAttDataGridView.Columns[2].Visible = expertMode; + elecInterAttDataGridView.Columns[3].Visible = expertMode; + elecInterAttDataGridView.Columns[4].Visible = expertMode; + elecInterAttDataGridView.Columns[5].Visible = expertMode; + + } } } \ No newline at end of file diff --git a/SOURCE/Plugin/DeviceDescription.resx b/SOURCE/Plugin/DeviceDescription.resx index 0baacce..c94be85 100644 --- a/SOURCE/Plugin/DeviceDescription.resx +++ b/SOURCE/Plugin/DeviceDescription.resx @@ -123,6 +123,12 @@ 265, 17 + + 1330, 103 + + + 1066, 103 + 278, 103 @@ -207,6 +213,24 @@ 853, 146 + + 1038, 146 + + + True + + + True + + + True + + + True + + + True + @@ -241,8 +265,23 @@ True - - 1038, 146 + + True + + + True + + + True + + + True + + + True + + + True True @@ -262,8 +301,38 @@ True - - 1330, 103 + + True + + + True + + + True + + + True + + + True + + + True + + + True + + + True + + + True + + + True + + + True True @@ -298,6 +367,18 @@ TgDQASA1MVpwzwAAAABJRU5ErkJggg== + + 1179, 60 + + + True + + + True + + + True + True @@ -328,6 +409,9 @@ 729, 60 + + 729, 60 + iVBORw0KGgoAAAANSUhEUgAAAB4AAAAeCAYAAAA7MK6iAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8 @@ -336,6 +420,12 @@ RgtnViTyCJEC4UCoEdfIj94AAAAASUVORK5CYII= + + 1311, 60 + + + 1435, 60 + 149, 103