From 33fe1a4537756eb4c88adbcb6011148b0ec4f064 Mon Sep 17 00:00:00 2001 From: MatveyPetrov Date: Sat, 10 Feb 2024 15:51:53 +0400 Subject: [PATCH] =?UTF-8?q?=D0=9B=D0=B0=D0=B1=D0=BE=D1=80=D0=B0=D1=82?= =?UTF-8?q?=D0=BE=D1=80=D0=BD=D0=B0=D1=8F=20=D1=80=D0=B0=D0=B1=D0=BE=D1=82?= =?UTF-8?q?=D0=B0=20=E2=84=964?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../CollectionType.cs | 29 +++ .../ICollectionGenericObjects.cs | 4 +- .../ListgenericObjects.cs | 118 ++++++++++ .../StorageCollection.cs | 60 +++++ .../FormAircraftCollection.Designer.cs | 212 ++++++++++++++---- .../FormAircraftCollection.cs | 107 ++++++++- 6 files changed, 479 insertions(+), 51 deletions(-) create mode 100644 ProectMilitaryAircraft/ProectMilitaryAircraft/CollectionGenericObjects/CollectionType.cs create mode 100644 ProectMilitaryAircraft/ProectMilitaryAircraft/CollectionGenericObjects/ListgenericObjects.cs create mode 100644 ProectMilitaryAircraft/ProectMilitaryAircraft/CollectionGenericObjects/StorageCollection.cs diff --git a/ProectMilitaryAircraft/ProectMilitaryAircraft/CollectionGenericObjects/CollectionType.cs b/ProectMilitaryAircraft/ProectMilitaryAircraft/CollectionGenericObjects/CollectionType.cs new file mode 100644 index 0000000..0c0f47b --- /dev/null +++ b/ProectMilitaryAircraft/ProectMilitaryAircraft/CollectionGenericObjects/CollectionType.cs @@ -0,0 +1,29 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace ProectMilitaryAircraft.CollectionGenericObjects; + + +/// +/// Тип коллекции +/// +public enum CollectionType +{ + /// + /// Неопределено + /// + None = 0, + + /// + /// Массив + /// + Massive = 1, + + /// + /// Список + /// + List = 2 +} diff --git a/ProectMilitaryAircraft/ProectMilitaryAircraft/CollectionGenericObjects/ICollectionGenericObjects.cs b/ProectMilitaryAircraft/ProectMilitaryAircraft/CollectionGenericObjects/ICollectionGenericObjects.cs index 0166d00..1091f0a 100644 --- a/ProectMilitaryAircraft/ProectMilitaryAircraft/CollectionGenericObjects/ICollectionGenericObjects.cs +++ b/ProectMilitaryAircraft/ProectMilitaryAircraft/CollectionGenericObjects/ICollectionGenericObjects.cs @@ -1,4 +1,6 @@ -using System; +using ProectMilitaryAircraft.Draw; +using ProectMilitaryAircraft.MovementStrategy; +using System; using System.Collections.Generic; using System.Linq; using System.Text; diff --git a/ProectMilitaryAircraft/ProectMilitaryAircraft/CollectionGenericObjects/ListgenericObjects.cs b/ProectMilitaryAircraft/ProectMilitaryAircraft/CollectionGenericObjects/ListgenericObjects.cs new file mode 100644 index 0000000..58c3ef8 --- /dev/null +++ b/ProectMilitaryAircraft/ProectMilitaryAircraft/CollectionGenericObjects/ListgenericObjects.cs @@ -0,0 +1,118 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace ProectMilitaryAircraft.CollectionGenericObjects; + + +/// +/// Параметризованный набор объектов +/// +/// Параметр : ограничение - ссылочный тип +public class ListgenericObjects + where T : class +{ + /// + /// Список объектов, которые храниим + /// + private readonly List? _collection; + + /// + /// Максимально допустимое число объектов в списке + /// + private int _maxCount; + + public int Count => _collection.Count; + + public int SetMaxCount { set { if (value > 0) { _maxCount = value; } } } + + /// + /// Конструктор + /// + public ListgenericObjects(int count) + { + _maxCount = count; + _collection = new(); + } + + + /// + /// Получение объекта из набора позиции + /// + /// + /// + public T? this[int position] + { + get + { + if (position < 0 || position >= _maxCount) + { + return null; + } + + return _collection?[position]; + } + + set + { + if (!(position >= 0 && position < Count && _collection?.Count < _maxCount)) + { + return; + } + + _collection?.Insert(position, value); + return; + } + } + + public bool Insert(T obj) + { + if (_collection?.Count == _maxCount) + { + return false; + } + + Insert(obj, 0); + return true; + } + + public bool Insert(T obj, int position) + { + if (_collection?.Count == _maxCount) + { + return false; + } + + Insert(obj, 0); + return true; + } + + public bool Remove(int position) + { + if (position < 0 || position >= Count) + { + return false; + } + + _collection?.RemoveAt(position); + return true; + } + + /// + /// Проход по списку + /// + /// + public IEnumerable GetTheAirplanes(int? maxTheAirplanes = null) + { + for (int i = 0; i < _collection?.Count; ++i) + { + yield return _collection?[i]; + if (maxTheAirplanes.HasValue && i == maxTheAirplanes.Value) + { + yield break; + } + } + } +} diff --git a/ProectMilitaryAircraft/ProectMilitaryAircraft/CollectionGenericObjects/StorageCollection.cs b/ProectMilitaryAircraft/ProectMilitaryAircraft/CollectionGenericObjects/StorageCollection.cs new file mode 100644 index 0000000..0e2a472 --- /dev/null +++ b/ProectMilitaryAircraft/ProectMilitaryAircraft/CollectionGenericObjects/StorageCollection.cs @@ -0,0 +1,60 @@ +using ProectMilitaryAircraft.MovementStrategy; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace ProectMilitaryAircraft.CollectionGenericObjects; + +public class StorageCollection + where T : class +{ + readonly Dictionary> _storages; + + public List Keys => _storages.Keys.ToList(); + + public StorageCollection() + { + _storages = new Dictionary>(); + } + + public void AddCollection (string name, CollectionType collectionType) + { + if (name != null && !_storages.ContainsKey(name)) + { + + if (collectionType == CollectionType.Massive) + { + _storages.Add(name, new MassiveGenericObjects()); + } + if (collectionType == CollectionType.List) + { + _storages.Add(name, new MassiveGenericObjects()); + } + + } + } + + public void DelCollection (string name) + { + if (!_storages.ContainsKey(name)) + { + return; + } + + _storages.Remove(name); + } + + public ICollectionGenericObjects? this[string name] + { + get + { + if (_storages.ContainsKey(name)) + { + return _storages[name]; + } + return null; + } + } +} diff --git a/ProectMilitaryAircraft/ProectMilitaryAircraft/FormAircraftCollection.Designer.cs b/ProectMilitaryAircraft/ProectMilitaryAircraft/FormAircraftCollection.Designer.cs index f0f97c5..db14446 100644 --- a/ProectMilitaryAircraft/ProectMilitaryAircraft/FormAircraftCollection.Designer.cs +++ b/ProectMilitaryAircraft/ProectMilitaryAircraft/FormAircraftCollection.Designer.cs @@ -29,26 +29,35 @@ private void InitializeComponent() { groupBoxTools = new GroupBox(); + panelCompanyTools = new Panel(); + buttonAddAircraft = new Button(); + buttonAddMilitaryAircraft = new Button(); buttonRefresh = new Button(); + maskedTextBox = new MaskedTextBox(); buttonGoToCheck = new Button(); buttonRemoveAircraft = new Button(); - maskedTextBox = new MaskedTextBox(); - buttonAddMilitaryAircraft = new Button(); - buttonAddAircraft = new Button(); + buttonCreateCompany = new Button(); + panelStorage = new Panel(); + buttonCollectionDel = new Button(); + listBoxCollection = new ListBox(); + buttonCollectionAdd = new Button(); + radioButtonList = new RadioButton(); + radioButtonMassive = new RadioButton(); + textBoxCollectionName = new TextBox(); + labelCollectionName = new Label(); comboBoxSelectorCompany = new ComboBox(); pictureBox = new PictureBox(); groupBoxTools.SuspendLayout(); + panelCompanyTools.SuspendLayout(); + panelStorage.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)pictureBox).BeginInit(); SuspendLayout(); // // groupBoxTools // - groupBoxTools.Controls.Add(buttonRefresh); - groupBoxTools.Controls.Add(buttonGoToCheck); - groupBoxTools.Controls.Add(buttonRemoveAircraft); - groupBoxTools.Controls.Add(maskedTextBox); - groupBoxTools.Controls.Add(buttonAddMilitaryAircraft); - groupBoxTools.Controls.Add(buttonAddAircraft); + groupBoxTools.Controls.Add(panelCompanyTools); + groupBoxTools.Controls.Add(buttonCreateCompany); + groupBoxTools.Controls.Add(panelStorage); groupBoxTools.Controls.Add(comboBoxSelectorCompany); groupBoxTools.Dock = DockStyle.Right; groupBoxTools.Location = new Point(607, 0); @@ -58,23 +67,68 @@ groupBoxTools.TabStop = false; groupBoxTools.Text = " Инструменты"; // + // panelCompanyTools + // + panelCompanyTools.Controls.Add(buttonAddAircraft); + panelCompanyTools.Controls.Add(buttonAddMilitaryAircraft); + panelCompanyTools.Controls.Add(buttonRefresh); + panelCompanyTools.Controls.Add(maskedTextBox); + panelCompanyTools.Controls.Add(buttonGoToCheck); + panelCompanyTools.Controls.Add(buttonRemoveAircraft); + panelCompanyTools.Enabled = false; + panelCompanyTools.Location = new Point(6, 280); + panelCompanyTools.Name = "panelCompanyTools"; + panelCompanyTools.Size = new Size(182, 283); + panelCompanyTools.TabIndex = 8; + // + // buttonAddAircraft + // + buttonAddAircraft.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right; + buttonAddAircraft.Location = new Point(4, 3); + buttonAddAircraft.Name = "buttonAddAircraft"; + buttonAddAircraft.Size = new Size(178, 36); + buttonAddAircraft.TabIndex = 1; + buttonAddAircraft.Text = "Добавление самолета"; + buttonAddAircraft.UseVisualStyleBackColor = true; + buttonAddAircraft.Click += ButtonAddAircraft_Click; + // + // buttonAddMilitaryAircraft + // + buttonAddMilitaryAircraft.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right; + buttonAddMilitaryAircraft.Location = new Point(4, 45); + buttonAddMilitaryAircraft.Name = "buttonAddMilitaryAircraft"; + buttonAddMilitaryAircraft.Size = new Size(178, 45); + buttonAddMilitaryAircraft.TabIndex = 2; + buttonAddMilitaryAircraft.Text = "Добавление военного самолета"; + buttonAddMilitaryAircraft.UseVisualStyleBackColor = true; + buttonAddMilitaryAircraft.Click += ButtonAddMilitaryAircraft_Click; + // // buttonRefresh // buttonRefresh.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right; - buttonRefresh.Location = new Point(6, 450); + buttonRefresh.Location = new Point(4, 229); buttonRefresh.Name = "buttonRefresh"; - buttonRefresh.Size = new Size(182, 45); + buttonRefresh.Size = new Size(178, 45); buttonRefresh.TabIndex = 5; buttonRefresh.Text = "Обновить"; buttonRefresh.UseVisualStyleBackColor = true; buttonRefresh.Click += ButtonRefresh_Click; // + // maskedTextBox + // + maskedTextBox.Location = new Point(4, 98); + maskedTextBox.Mask = "00"; + maskedTextBox.Name = "maskedTextBox"; + maskedTextBox.Size = new Size(178, 23); + maskedTextBox.TabIndex = 3; + maskedTextBox.ValidatingType = typeof(int); + // // buttonGoToCheck // buttonGoToCheck.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right; - buttonGoToCheck.Location = new Point(6, 299); + buttonGoToCheck.Location = new Point(4, 178); buttonGoToCheck.Name = "buttonGoToCheck"; - buttonGoToCheck.Size = new Size(182, 45); + buttonGoToCheck.Size = new Size(178, 45); buttonGoToCheck.TabIndex = 4; buttonGoToCheck.Text = "Передать на тесты"; buttonGoToCheck.UseVisualStyleBackColor = true; @@ -83,44 +137,105 @@ // buttonRemoveAircraft // buttonRemoveAircraft.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right; - buttonRemoveAircraft.Location = new Point(6, 208); + buttonRemoveAircraft.Location = new Point(4, 127); buttonRemoveAircraft.Name = "buttonRemoveAircraft"; - buttonRemoveAircraft.Size = new Size(182, 45); + buttonRemoveAircraft.Size = new Size(178, 45); buttonRemoveAircraft.TabIndex = 3; buttonRemoveAircraft.Text = " Удалить самолет"; buttonRemoveAircraft.UseVisualStyleBackColor = true; buttonRemoveAircraft.Click += ButtonRemoveAircraft_Click; // - // maskedTextBox + // buttonCreateCompany // - maskedTextBox.Location = new Point(6, 179); - maskedTextBox.Mask = "00"; - maskedTextBox.Name = "maskedTextBox"; - maskedTextBox.Size = new Size(182, 23); - maskedTextBox.TabIndex = 3; - maskedTextBox.ValidatingType = typeof(int); + buttonCreateCompany.Location = new Point(6, 251); + buttonCreateCompany.Name = "buttonCreateCompany"; + buttonCreateCompany.Size = new Size(182, 23); + buttonCreateCompany.TabIndex = 7; + buttonCreateCompany.Text = "Создать компанию"; + buttonCreateCompany.UseVisualStyleBackColor = true; + buttonCreateCompany.Click += ButtonCreateCompany_Click; // - // buttonAddMilitaryAircraft + // panelStorage // - buttonAddMilitaryAircraft.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right; - buttonAddMilitaryAircraft.Location = new Point(6, 112); - buttonAddMilitaryAircraft.Name = "buttonAddMilitaryAircraft"; - buttonAddMilitaryAircraft.Size = new Size(182, 45); - buttonAddMilitaryAircraft.TabIndex = 2; - buttonAddMilitaryAircraft.Text = "Добавление военного самолета"; - buttonAddMilitaryAircraft.UseVisualStyleBackColor = true; - buttonAddMilitaryAircraft.Click += ButtonAddMilitaryAircraft_Click; + panelStorage.Controls.Add(buttonCollectionDel); + panelStorage.Controls.Add(listBoxCollection); + panelStorage.Controls.Add(buttonCollectionAdd); + panelStorage.Controls.Add(radioButtonList); + panelStorage.Controls.Add(radioButtonMassive); + panelStorage.Controls.Add(textBoxCollectionName); + panelStorage.Controls.Add(labelCollectionName); + panelStorage.Dock = DockStyle.Top; + panelStorage.Location = new Point(3, 19); + panelStorage.Name = "panelStorage"; + panelStorage.Size = new Size(188, 186); + panelStorage.TabIndex = 6; // - // buttonAddAircraft + // buttonCollectionDel // - buttonAddAircraft.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right; - buttonAddAircraft.Location = new Point(6, 70); - buttonAddAircraft.Name = "buttonAddAircraft"; - buttonAddAircraft.Size = new Size(182, 36); - buttonAddAircraft.TabIndex = 1; - buttonAddAircraft.Text = "Добавление самолета"; - buttonAddAircraft.UseVisualStyleBackColor = true; - buttonAddAircraft.Click += ButtonAddAircraft_Click; + buttonCollectionDel.Location = new Point(3, 156); + buttonCollectionDel.Name = "buttonCollectionDel"; + buttonCollectionDel.Size = new Size(182, 21); + buttonCollectionDel.TabIndex = 6; + buttonCollectionDel.Text = "Удалить коллекцию"; + buttonCollectionDel.UseVisualStyleBackColor = true; + buttonCollectionDel.Click += ButtonCollectionDel_Click; + // + // listBoxCollection + // + listBoxCollection.FormattingEnabled = true; + listBoxCollection.ItemHeight = 15; + listBoxCollection.Location = new Point(3, 101); + listBoxCollection.Name = "listBoxCollection"; + listBoxCollection.Size = new Size(182, 49); + listBoxCollection.TabIndex = 5; + // + // buttonCollectionAdd + // + buttonCollectionAdd.Location = new Point(3, 72); + buttonCollectionAdd.Name = "buttonCollectionAdd"; + buttonCollectionAdd.Size = new Size(182, 23); + buttonCollectionAdd.TabIndex = 4; + buttonCollectionAdd.Text = "Добавить коллекцию"; + buttonCollectionAdd.UseVisualStyleBackColor = true; + buttonCollectionAdd.Click += ButtonCollectionAdd_Click; + // + // radioButtonList + // + radioButtonList.AutoSize = true; + radioButtonList.Location = new Point(119, 47); + radioButtonList.Name = "radioButtonList"; + radioButtonList.Size = new Size(66, 19); + radioButtonList.TabIndex = 3; + radioButtonList.TabStop = true; + radioButtonList.Text = "Список"; + radioButtonList.UseVisualStyleBackColor = true; + // + // radioButtonMassive + // + radioButtonMassive.AutoSize = true; + radioButtonMassive.Location = new Point(3, 47); + radioButtonMassive.Name = "radioButtonMassive"; + radioButtonMassive.Size = new Size(67, 19); + radioButtonMassive.TabIndex = 2; + radioButtonMassive.TabStop = true; + radioButtonMassive.Text = "Массив"; + radioButtonMassive.UseVisualStyleBackColor = true; + // + // textBoxCollectionName + // + textBoxCollectionName.Location = new Point(3, 18); + textBoxCollectionName.Name = "textBoxCollectionName"; + textBoxCollectionName.Size = new Size(182, 23); + textBoxCollectionName.TabIndex = 1; + // + // labelCollectionName + // + labelCollectionName.AutoSize = true; + labelCollectionName.Location = new Point(29, 0); + labelCollectionName.Name = "labelCollectionName"; + labelCollectionName.Size = new Size(125, 15); + labelCollectionName.TabIndex = 0; + labelCollectionName.Text = "Название коллекции:"; // // comboBoxSelectorCompany // @@ -128,7 +243,7 @@ comboBoxSelectorCompany.DropDownStyle = ComboBoxStyle.DropDownList; comboBoxSelectorCompany.FormattingEnabled = true; comboBoxSelectorCompany.Items.AddRange(new object[] { "Хранилище" }); - comboBoxSelectorCompany.Location = new Point(6, 22); + comboBoxSelectorCompany.Location = new Point(6, 211); comboBoxSelectorCompany.Name = "comboBoxSelectorCompany"; comboBoxSelectorCompany.Size = new Size(182, 23); comboBoxSelectorCompany.TabIndex = 0; @@ -153,7 +268,10 @@ Name = "FormAircraftCollection"; Text = "Коллекция самолетов"; groupBoxTools.ResumeLayout(false); - groupBoxTools.PerformLayout(); + panelCompanyTools.ResumeLayout(false); + panelCompanyTools.PerformLayout(); + panelStorage.ResumeLayout(false); + panelStorage.PerformLayout(); ((System.ComponentModel.ISupportInitialize)pictureBox).EndInit(); ResumeLayout(false); } @@ -169,5 +287,15 @@ private Button buttonRemoveAircraft; private MaskedTextBox maskedTextBox; private PictureBox pictureBox; + private Panel panelStorage; + private TextBox textBoxCollectionName; + private Label labelCollectionName; + private RadioButton radioButtonMassive; + private RadioButton radioButtonList; + private Button buttonCollectionAdd; + private ListBox listBoxCollection; + private Button buttonCreateCompany; + private Button buttonCollectionDel; + private Panel panelCompanyTools; } } \ No newline at end of file diff --git a/ProectMilitaryAircraft/ProectMilitaryAircraft/FormAircraftCollection.cs b/ProectMilitaryAircraft/ProectMilitaryAircraft/FormAircraftCollection.cs index 4fbbc5b..eee499d 100644 --- a/ProectMilitaryAircraft/ProectMilitaryAircraft/FormAircraftCollection.cs +++ b/ProectMilitaryAircraft/ProectMilitaryAircraft/FormAircraftCollection.cs @@ -18,6 +18,11 @@ namespace ProectMilitaryAircraft; /// public partial class FormAircraftCollection : Form { + /// + /// Хранилище коллекций + /// + private readonly StorageCollection _storageCollection; + /// /// Компания /// @@ -30,6 +35,7 @@ public partial class FormAircraftCollection : Form public FormAircraftCollection() { InitializeComponent(); + _storageCollection = new(); } /// /// Выбор компании @@ -38,12 +44,7 @@ public partial class FormAircraftCollection : Form /// private void ComboBoxSelectorCompany_SelectedValueChanged(object sender, EventArgs e) { - switch (comboBoxSelectorCompany.Text) - { - case "Хранилище": - _company = new AircraftSharingService(pictureBox.Width, pictureBox.Height, new MassiveGenericObjects()); - break; - } + panelCompanyTools.Enabled = false; } /// @@ -77,7 +78,7 @@ public partial class FormAircraftCollection : Form if (_company + drawningAircraft) { MessageBox.Show("Не удалось добаить объект"); - + } else { @@ -153,7 +154,7 @@ public partial class FormAircraftCollection : Form } DrawningAircraft? aircraft = null; int counter = 100; - while(aircraft == null) + while (aircraft == null) { aircraft = _company.GetRandomObject(); counter--; @@ -186,4 +187,94 @@ public partial class FormAircraftCollection : Form } pictureBox.Image = _company.Show(); } + + /// + /// + /// + /// + /// + private void ButtonCollectionAdd_Click(object sender, EventArgs e) + { + if (string.IsNullOrEmpty(textBoxCollectionName.Text) || (!radioButtonList.Checked && !radioButtonMassive.Checked)) + { + MessageBox.Show("Не все данные заполнены", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error); + return; + } + + CollectionType collectionType = CollectionType.None; + if (radioButtonMassive.Checked) + { + collectionType = CollectionType.Massive; + } + else if (radioButtonList.Checked) + { + collectionType = CollectionType.List; + } + _storageCollection.AddCollection(textBoxCollectionName.Text, collectionType); + RefreshListBoxItems(); + } + + /// + /// / + /// + /// + /// + private void ButtonCollectionDel_Click(object sender, EventArgs e) + { + if (listBoxCollection.SelectedIndex == -1) + { + return; + } + if (MessageBox.Show($"Удалить объект{listBoxCollection.SelectedItem}?", "Удаление", MessageBoxButtons.YesNo, + MessageBoxIcon.Question) == DialogResult.Yes) + { + _storageCollection.DelCollection(listBoxCollection.SelectedItem?.ToString() + ?? string.Empty); + RefreshListBoxItems(); + } + + } + + private void RefreshListBoxItems() + { + listBoxCollection.Items.Clear(); + for (int i =0; i < _storageCollection.Keys?.Count; i++) + { + string? colName = _storageCollection.Keys?[i]; + if (!string.IsNullOrEmpty(colName)) + { + listBoxCollection.Items.Add(colName); + } + } + } + + /// + /// + /// + /// + /// + private void ButtonCreateCompany_Click(object sender, EventArgs e) + { + if (listBoxCollection.SelectedIndex < 0 || listBoxCollection.SelectedItems == null) + { + MessageBox.Show("Коллекция не выбрана"); + return; + } + + ICollectionGenericObjects? collection = _storageCollection[listBoxCollection.SelectedItem.ToString()?? string.Empty]; + if (collection == null) + { + MessageBox.Show("Коллкция не проиницилизирована"); + return; + } + + switch (comboBoxSelectorCompany.Text) + { + case "Хранилище": + _company = new AircraftSharingService(pictureBox.Width, pictureBox.Height, new MassiveGenericObjects()); + break; + } + + panelCompanyTools.Enabled = true; + } }