From 8dc45484b0ebda5be81c2744dd7ddb45ded2e677 Mon Sep 17 00:00:00 2001 From: Milan Hanajik Date: Mon, 1 Mar 2021 21:33:54 +0100 Subject: [PATCH] Cleanup and comment --- .../Bench/Components/ComponentParametersDlg.cs | 18 +++++++++--------- .../Bench/Components/ComponentsManagerDlg.cs | 10 ++++++++-- 2 files changed, 17 insertions(+), 11 deletions(-) diff --git a/TBF/UI/Bench/Components/ComponentParametersDlg.cs b/TBF/UI/Bench/Components/ComponentParametersDlg.cs index 1cb598da0..450e799d1 100644 --- a/TBF/UI/Bench/Components/ComponentParametersDlg.cs +++ b/TBF/UI/Bench/Components/ComponentParametersDlg.cs @@ -65,17 +65,17 @@ namespace TBF.UI.Bench.Components if (ComponentCfgCtrl != null) { splitContainer.Panel1.Controls.Add((UserControl)ComponentCfgCtrl); - } - if ((ComponentCfgCtrl != null) && ComponentCfgCtrl.ShowMore) - { - sharedButtons.OptionalButtons = SharedButtons.Buttons.More; - } + if (ComponentCfgCtrl.ShowMore) + { + sharedButtons.OptionalButtons = SharedButtons.Buttons.More; + } - if (UnlockAfterStart) - { - sharedButtons.UnlockButtons(); - ComponentCfgCtrl.Unlock(); + if (UnlockAfterStart) + { + sharedButtons.UnlockButtons(); + ComponentCfgCtrl.Unlock(); + } } } diff --git a/TBF/UI/Bench/Components/ComponentsManagerDlg.cs b/TBF/UI/Bench/Components/ComponentsManagerDlg.cs index 1c5d2cb2f..f9e731cf5 100644 --- a/TBF/UI/Bench/Components/ComponentsManagerDlg.cs +++ b/TBF/UI/Bench/Components/ComponentsManagerDlg.cs @@ -414,7 +414,10 @@ namespace TBF.UI.Bench.Components IComponentCfg cfg = factory.DefaultConfig(); if (selectComponentTypeDlg.SelectedScriptName == null) { - IComponentCfgCtrl cfgControl = cfg.GetControl(); + /// + /// Create a single component of the selected type + /// + IComponentCfgCtrl cfgControl = cfg.GetControl(); cfgControl.Config = cfg; cfgControl.Config.ItemNr = (cmpntEntities.Count > 0) ? (cmpntEntities[cmpntEntities.Count - 1].ItemNr + 1) : 1; @@ -430,7 +433,10 @@ namespace TBF.UI.Bench.Components } else { - using (TextReader reader = new StreamReader(selectComponentTypeDlg.SelectedScriptName)) + /// + /// Create more components, read their names and other properties from a file + /// + using (TextReader reader = new StreamReader(selectComponentTypeDlg.SelectedScriptName)) { int zeroBasedIdx = 0; string line = reader.ReadLine();