фиксы для первых двух компонентов и начало страданий с третьим
This commit is contained in:
parent
c23bc5c7c1
commit
c8777e4549
@ -28,12 +28,7 @@ namespace Components
|
|||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
if (comboBox.Items.Count == 0 || comboBox.SelectedItem == null)
|
return comboBox.SelectedItem?.ToString() ?? string.Empty; }
|
||||||
{
|
|
||||||
return string.Empty;
|
|
||||||
}
|
|
||||||
return comboBox.SelectedItem.ToString();
|
|
||||||
}
|
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
comboBox.SelectedItem = value;
|
comboBox.SelectedItem = value;
|
||||||
|
@ -55,6 +55,15 @@ namespace Components
|
|||||||
string row = listBox.SelectedItem.ToString();
|
string row = listBox.SelectedItem.ToString();
|
||||||
T curObject = new T();
|
T curObject = new T();
|
||||||
StringBuilder sb = new StringBuilder(row);
|
StringBuilder sb = new StringBuilder(row);
|
||||||
|
|
||||||
|
MessageBox.Show(sb.ToString());
|
||||||
|
|
||||||
|
//("Дорогой дневник, мне не подобрать слов чтобы описать всю {Mood}, что я испытал сегодня; {Date}", "{", "}");
|
||||||
|
// "Дорогой дневник, мне не подобрать слов чтобы описать всю радость пенис, что я испытал сегодня; блаблабла"
|
||||||
|
StringBuilder tp = new StringBuilder(template);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
foreach (var property in typeof(T).GetProperties())
|
foreach (var property in typeof(T).GetProperties())
|
||||||
{
|
{
|
||||||
if (!property.CanWrite)
|
if (!property.CanWrite)
|
||||||
@ -62,6 +71,8 @@ namespace Components
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//MessageBox.Show(property.Name);
|
||||||
|
|
||||||
int startBorder = sb.ToString().IndexOf(start);
|
int startBorder = sb.ToString().IndexOf(start);
|
||||||
if (startBorder == -1)
|
if (startBorder == -1)
|
||||||
{
|
{
|
||||||
@ -83,7 +94,6 @@ namespace Components
|
|||||||
|
|
||||||
public void FillProperty<T>(T dataObject, int rowIndex, string propertyName)
|
public void FillProperty<T>(T dataObject, int rowIndex, string propertyName)
|
||||||
{
|
{
|
||||||
|
|
||||||
while (listBox.Items.Count <= rowIndex)
|
while (listBox.Items.Count <= rowIndex)
|
||||||
{
|
{
|
||||||
listBox.Items.Add(template);
|
listBox.Items.Add(template);
|
||||||
|
@ -52,6 +52,10 @@ namespace Components
|
|||||||
}
|
}
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
|
if (string.IsNullOrEmpty(_numberPattern))
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
Regex regex = new(_numberPattern);
|
Regex regex = new(_numberPattern);
|
||||||
if (regex.IsMatch(value))
|
if (regex.IsMatch(value))
|
||||||
{
|
{
|
||||||
|
4
CustomComboBox/TestApp/Form1.Designer.cs
generated
4
CustomComboBox/TestApp/Form1.Designer.cs
generated
@ -96,7 +96,7 @@
|
|||||||
customListBox.Location = new Point(296, 0);
|
customListBox.Location = new Point(296, 0);
|
||||||
customListBox.Name = "customListBox";
|
customListBox.Name = "customListBox";
|
||||||
customListBox.SelectedRow = -1;
|
customListBox.SelectedRow = -1;
|
||||||
customListBox.Size = new Size(803, 400);
|
customListBox.Size = new Size(848, 400);
|
||||||
customListBox.TabIndex = 5;
|
customListBox.TabIndex = 5;
|
||||||
//
|
//
|
||||||
// buttonDay
|
// buttonDay
|
||||||
@ -139,7 +139,7 @@
|
|||||||
//
|
//
|
||||||
AutoScaleDimensions = new SizeF(8F, 20F);
|
AutoScaleDimensions = new SizeF(8F, 20F);
|
||||||
AutoScaleMode = AutoScaleMode.Font;
|
AutoScaleMode = AutoScaleMode.Font;
|
||||||
ClientSize = new Size(1111, 416);
|
ClientSize = new Size(1156, 416);
|
||||||
Controls.Add(label1);
|
Controls.Add(label1);
|
||||||
Controls.Add(textBoxMood);
|
Controls.Add(textBoxMood);
|
||||||
Controls.Add(buttonAddDay);
|
Controls.Add(buttonAddDay);
|
||||||
|
@ -65,10 +65,10 @@ namespace TestApp
|
|||||||
|
|
||||||
private void FillCustomListBox()
|
private void FillCustomListBox()
|
||||||
{
|
{
|
||||||
Day day1 = new Day() { Mood = "{áîëü}", Date = DateTime.Now };
|
Day day1 = new Day() { Mood = "áîëü", Date = DateTime.Now };
|
||||||
Day day2 = new Day() { Mood = "{ðàäîñòü}", Date = DateTime.Now.AddDays(1.0) };
|
Day day2 = new Day() { Mood = "ðàäîñòü", Date = DateTime.Now.AddDays(1.0) };
|
||||||
|
|
||||||
customListBox.setTemplate("Äîðîãîé äíåâíèê, ìíå íå ïîäîáðàòü ñëîâ ÷òîáû îïèñàòü âñþ {Mood}, ÷òî ÿ èñïûòàë ñåãîäíÿ; {{Date}}", "{", "}");
|
customListBox.setTemplate("Äîðîãîé äíåâíèê, ìíå íå ïîäîáðàòü ñëîâ ÷òîáû îïèñàòü âñþ {Mood}, ÷òî ÿ èñïûòàë ñåãîäíÿ; {Date}", "{", "}");
|
||||||
|
|
||||||
customListBox.FillProperty(day1, 0, "Mood");
|
customListBox.FillProperty(day1, 0, "Mood");
|
||||||
customListBox.FillProperty(day1, 0, "Date");
|
customListBox.FillProperty(day1, 0, "Date");
|
||||||
@ -89,7 +89,7 @@ namespace TestApp
|
|||||||
day.Date = DateTime.Now;
|
day.Date = DateTime.Now;
|
||||||
if (string.IsNullOrEmpty(textBoxMood.Text))
|
if (string.IsNullOrEmpty(textBoxMood.Text))
|
||||||
{
|
{
|
||||||
MessageBox.Show("Write something!!!");
|
MessageBox.Show("Write something!!!", "Error");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
day.Mood = "{" + textBoxMood.Text + "}";
|
day.Mood = "{" + textBoxMood.Text + "}";
|
||||||
|
Loading…
x
Reference in New Issue
Block a user