diff --git a/Library15Gerimovich/DefaultList.Designer.cs b/Library15Gerimovich/DefaultList.Designer.cs
index 73bbccd..fd93b01 100644
--- a/Library15Gerimovich/DefaultList.Designer.cs
+++ b/Library15Gerimovich/DefaultList.Designer.cs
@@ -28,30 +28,34 @@
///
private void InitializeComponent()
{
- this.listBox = new System.Windows.Forms.ListBox();
+ this.MainListBox = new System.Windows.Forms.ListBox();
this.SuspendLayout();
//
- // listBox
+ // MainListBox
//
- this.listBox.FormattingEnabled = true;
- this.listBox.ItemHeight = 15;
- this.listBox.Location = new System.Drawing.Point(3, 3);
- this.listBox.Name = "listBox";
- this.listBox.Size = new System.Drawing.Size(144, 109);
- this.listBox.TabIndex = 0;
+ this.MainListBox.FormattingEnabled = true;
+ this.MainListBox.ItemHeight = 15;
+ this.MainListBox.Items.AddRange(new object[] {
+ "RITG",
+ "SimbirSoft",
+ "MediaSoft"});
+ this.MainListBox.Location = new System.Drawing.Point(3, 3);
+ this.MainListBox.Name = "MainListBox";
+ this.MainListBox.Size = new System.Drawing.Size(144, 109);
+ this.MainListBox.TabIndex = 0;
//
- // DefoltList
+ // DefaultList
//
this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
- this.Controls.Add(this.listBox);
- this.Name = "DefoltList";
+ this.Controls.Add(this.MainListBox);
+ this.Name = "DefaultList";
this.ResumeLayout(false);
}
#endregion
- private ListBox listBox;
+ private ListBox MainListBox;
}
}
diff --git a/Library15Gerimovich/DefaultList.cs b/Library15Gerimovich/DefaultList.cs
index 977830d..d25df51 100644
--- a/Library15Gerimovich/DefaultList.cs
+++ b/Library15Gerimovich/DefaultList.cs
@@ -12,47 +12,91 @@ namespace Library15Gerimovich
{
public partial class DefaultList : UserControl
{
- public event EventHandler? SelectedValueChanged;
+ private event EventHandler? _itemSelected;
- public string SelectedValue
+ public DefaultList()
+ {
+ InitializeComponent();
+ }
+
+
+ // метод, передающий строку
+ public void SetItems(string Items)
{
- get
+ string[] itemArray = Items.Split(','); // разбиваем по запятым
+
+ MainListBox.Items.Clear();
+
+ foreach (var item in itemArray)
{
- return checkedListBox1.SelectedItem?.ToString() ?? string.Empty;
- }
- set
- {
- int index = checkedListBox1.Items.IndexOf(value);
- if (index >= 0)
- {
- checkedListBox1.SelectedIndex = index;
- }
- else
- {
- checkedListBox1.ClearSelected();
- }
+ MainListBox.Items.Add(item.Trim()); // Trim для удаления пробелов
}
}
+ public void ClearList()
+ {
+ MainListBox.Items.Clear();
+ }
- public DefaultList()
- {
- InitializeComponent();
- }
+ // установка, получение выбранного элемента
+ public string SelectedItem
+ {
+ get { return (string?)MainListBox.SelectedItem ?? string.Empty; }
+ set { MainListBox.SelectedItem = value; }
+ }
- public void AddItemToList(string item)
- {
- ListBox.Items.Add(item);
- }
+ public event EventHandler? ItemSelected
+ {
+ add { _itemSelected += value; }
+ remove { _itemSelected -= value; }
+ }
- private void SelectedIndexChanged(object sender, EventArgs e)
- {
- SelectedValueChanged?.Invoke(this, e);
- }
+ // контролируем смену значений
+ private void MainListBox_SelectedIndexChanged(object sender, EventArgs e)
+ {
+ _itemSelected?.Invoke(this, e);
+ }
- public void ClearComboBox()
- {
- checkedListBox1.Items.Clear();
- }
+ //public event EventHandler? SelectedValueChanged;
+
+ //public string SelectedValue
+ //{
+ // get
+ // {
+ // return checkedListBox1.SelectedItem?.ToString() ?? string.Empty;
+ // }
+ // set
+ // {
+ // int index = checkedListBox1.Items.IndexOf(value);
+ // if (index >= 0)
+ // {
+ // checkedListBox1.SelectedIndex = index;
+ // }
+ // else
+ // {
+ // checkedListBox1.ClearSelected();
+ // }
+ // }
+ //}
+
+ //public DefaultList()
+ //{
+ // InitializeComponent();
+ //}
+
+ //public void AddItemToList(string item)
+ //{
+ // ListBox.Items.Add(item);
+ //}
+
+ //private void SelectedIndexChanged(object sender, EventArgs e)
+ //{
+ // SelectedValueChanged?.Invoke(this, e);
+ //}
+
+ //public void ClearComboBox()
+ //{
+ // checkedListBox1.Items.Clear();
+ //}
}
}
diff --git a/Library15Gerimovich/InputRealNumber.Designer.cs b/Library15Gerimovich/InputRealNumber.Designer.cs
index 0ba355a..e3363c5 100644
--- a/Library15Gerimovich/InputRealNumber.Designer.cs
+++ b/Library15Gerimovich/InputRealNumber.Designer.cs
@@ -41,6 +41,7 @@
this.IsNullCheckBox.TabIndex = 0;
this.IsNullCheckBox.Text = "Нулевое значение";
this.IsNullCheckBox.UseVisualStyleBackColor = true;
+ this.IsNullCheckBox.CheckedChanged += new System.EventHandler(this.IsNullCheckBox_CheckedChanged);
//
// MainTextBox
//
@@ -48,6 +49,7 @@
this.MainTextBox.Name = "MainTextBox";
this.MainTextBox.Size = new System.Drawing.Size(127, 23);
this.MainTextBox.TabIndex = 1;
+ this.MainTextBox.TextChanged += new System.EventHandler(this.MainTextBox_TextChanged);
//
// InputRealNumber
//
diff --git a/Library15Gerimovich/InputRealNumber.cs b/Library15Gerimovich/InputRealNumber.cs
index e38d82b..7d9e13d 100644
--- a/Library15Gerimovich/InputRealNumber.cs
+++ b/Library15Gerimovich/InputRealNumber.cs
@@ -20,10 +20,7 @@ namespace Library15Gerimovich
InitializeComponent();
}
- ///
- /// Установка и получение введенного значения
- ///
- public int? IntValue
+ public double? DoubleValue
{
get
{
@@ -37,10 +34,10 @@ namespace Library15Gerimovich
throw new EmptyValueException();
}
- int ParsedInt;
- if (Int32.TryParse(MainTextBox.Text, out ParsedInt))
+ double ParsedDouble;
+ if (double.TryParse(MainTextBox.Text, out ParsedDouble))
{
- return ParsedInt;
+ return ParsedDouble;
}
else
{
@@ -57,9 +54,6 @@ namespace Library15Gerimovich
}
}
- ///
- /// Событие, вызываемое при смене значения (либо при смене CheckBox)
- ///
public event EventHandler? ValueChanged
{
add { _valueChanged += value; }
diff --git a/Library15Gerimovich/OutputTableResults.cs b/Library15Gerimovich/OutputTableResults.cs
index 45291c1..dc7eaed 100644
--- a/Library15Gerimovich/OutputTableResults.cs
+++ b/Library15Gerimovich/OutputTableResults.cs
@@ -68,30 +68,30 @@ namespace Library15Gerimovich
}
}
- public TType? GetRow(int rowIndex)
- {
- Type type = typeof(TType);
- var element = type.GetConstructor([])?.Invoke([]);
+ //public TType? GetRow(int rowIndex)
+ //{
+ // Type type = typeof(TType);
+ // var element = type.GetConstructor([])?.Invoke([]);
- if (element is null)
- {
- return default;
- }
+ // if (element is null)
+ // {
+ // return default;
+ // }
- var row = dataGridViewOut.Rows[rowIndex].Cells;
+ // var row = dataGridViewOut.Rows[rowIndex].Cells;
- for (int i = 0; i < dataGridViewOut.ColumnCount; i++)
- {
- if (string.IsNullOrEmpty(_columnsFildsNames[i]))
- {
- continue;
- }
- var field = type.GetProperty(_columnsFildsNames[i]);
- field?.SetValue(element, row[i].Value);
- }
+ // for (int i = 0; i < dataGridViewOut.ColumnCount; i++)
+ // {
+ // if (string.IsNullOrEmpty(_columnsFildsNames[i]))
+ // {
+ // continue;
+ // }
+ // var field = type.GetProperty(_columnsFildsNames[i]);
+ // field?.SetValue(element, row[i].Value);
+ // }
- return (TType)element;
- }
+ // return (TType)element;
+ //}
public void Fill(IList insertValues)
{
diff --git a/WinFormsAppTest/Form1.Designer.cs b/WinFormsAppTest/Form1.Designer.cs
index cc10594..852a02d 100644
--- a/WinFormsAppTest/Form1.Designer.cs
+++ b/WinFormsAppTest/Form1.Designer.cs
@@ -29,20 +29,48 @@
private void InitializeComponent()
{
this.userControl11 = new Library15Gerimovich.UserControl1();
+ this.defaultList1 = new Library15Gerimovich.DefaultList();
+ this.inputRealNumber1 = new Library15Gerimovich.InputRealNumber();
+ this.outputTableResults1 = new Library15Gerimovich.OutputTableResults();
this.SuspendLayout();
//
// userControl11
//
- this.userControl11.Location = new System.Drawing.Point(54, 19);
+ this.userControl11.Avatar = null;
+ this.userControl11.Location = new System.Drawing.Point(12, 242);
this.userControl11.Name = "userControl11";
this.userControl11.Size = new System.Drawing.Size(150, 144);
this.userControl11.TabIndex = 0;
//
+ // defaultList1
+ //
+ this.defaultList1.Location = new System.Drawing.Point(12, 12);
+ this.defaultList1.Name = "defaultList1";
+ this.defaultList1.Size = new System.Drawing.Size(150, 150);
+ this.defaultList1.TabIndex = 1;
+ //
+ // inputRealNumber1
+ //
+ this.inputRealNumber1.Location = new System.Drawing.Point(202, 34);
+ this.inputRealNumber1.Name = "inputRealNumber1";
+ this.inputRealNumber1.Size = new System.Drawing.Size(135, 101);
+ this.inputRealNumber1.TabIndex = 2;
+ //
+ // outputTableResults1
+ //
+ this.outputTableResults1.Location = new System.Drawing.Point(422, 34);
+ this.outputTableResults1.Name = "outputTableResults1";
+ this.outputTableResults1.Size = new System.Drawing.Size(259, 245);
+ this.outputTableResults1.TabIndex = 3;
+ //
// Form1
//
this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(800, 450);
+ this.Controls.Add(this.outputTableResults1);
+ this.Controls.Add(this.inputRealNumber1);
+ this.Controls.Add(this.defaultList1);
this.Controls.Add(this.userControl11);
this.Name = "Form1";
this.Text = "Form1";
@@ -53,5 +81,8 @@
#endregion
private Library15Gerimovich.UserControl1 userControl11;
+ private Library15Gerimovich.DefaultList defaultList1;
+ private Library15Gerimovich.InputRealNumber inputRealNumber1;
+ private Library15Gerimovich.OutputTableResults outputTableResults1;
}
}
\ No newline at end of file