89 lines
3.1 KiB
C#
89 lines
3.1 KiB
C#
|
using COP_1;
|
|||
|
using System;
|
|||
|
|
|||
|
namespace COP_1Test
|
|||
|
{
|
|||
|
public partial class Form1 : Form
|
|||
|
{
|
|||
|
List<string> list = new List<string>();
|
|||
|
public Form1()
|
|||
|
{
|
|||
|
InitializeComponent();
|
|||
|
this.BackColor = GetRandomPastelColor();
|
|||
|
list = new List<string>();
|
|||
|
list.AddRange(new string[] { "<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> 1", "<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> 2", "<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> 3", "<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> 4", "<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> 5", "<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> 6" });
|
|||
|
|
|||
|
Album album1 = new Album("Meds", "Placebo", "Alternative", "2006");
|
|||
|
Album album2 = new Album("Iowa", "Slipknot", "Nu-Metal", "2001");
|
|||
|
Album album3 = new Album("Showbiz", "Muse", "Alternative", "1999");
|
|||
|
Album album4 = new Album("Chocolate Starfish and the Hot Dog Flavored Water", "Limp Bizkit", "Nu-metal", "2011");
|
|||
|
|
|||
|
valuesList.SetLayoutInfo("<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>: {Title} <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>: {Performer} <20><><EFBFBD><EFBFBD>: {Genre} <20><><EFBFBD>: {Year}", "{", "}");
|
|||
|
valuesList.AddInListBox(album1, 0);
|
|||
|
valuesList.AddInListBox(album2, 1);
|
|||
|
valuesList.AddInListBox(album3, 2);
|
|||
|
valuesList.AddInListBox(album4, 3);
|
|||
|
|
|||
|
emailBox.Pattern = @"^[^@\s]+@[^@\s]+\.[^@\s]+$";
|
|||
|
|
|||
|
dropDownList.AddingToList(new List<string>() { "Placebo", "Slipknot", "Blue October", "The Used", "Muse", "The Cure" });
|
|||
|
dropDownList.ExplicitEvent += Event_Handler;
|
|||
|
|
|||
|
emailBox.ExplicitEvent += Event_Handler;
|
|||
|
emailBox.SetExample("eeee@mail.ru");
|
|||
|
}
|
|||
|
private Color GetRandomPastelColor()
|
|||
|
{
|
|||
|
Random random = new Random();
|
|||
|
int red = random.Next(128, 256);
|
|||
|
int green = random.Next(128, 256);
|
|||
|
int blue = random.Next(128, 256);
|
|||
|
|
|||
|
return Color.FromArgb(red, green, blue);
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
private void Event_Handler(object sender, EventArgs e)
|
|||
|
{
|
|||
|
this.BackColor = GetRandomPastelColor();
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
private void buttonGet_Click(object sender, EventArgs e)
|
|||
|
{
|
|||
|
string str = valuesList.GetObjectFromStr<Album>().Title + " " + valuesList.GetObjectFromStr<Album>().Performer + " " + valuesList.GetObjectFromStr<Album>().Genre + " " + valuesList.GetObjectFromStr<Album>().Year;
|
|||
|
textBoxShowItem.Text = str;
|
|||
|
}
|
|||
|
private void buttonCheck_Click(object sender, EventArgs e)
|
|||
|
{
|
|||
|
try
|
|||
|
{
|
|||
|
if (emailBox.TextBoxValue != null)
|
|||
|
{
|
|||
|
label1.Visible = true;
|
|||
|
label1.Text = "true";
|
|||
|
label1.ForeColor = Color.Green;
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
label1.Visible = true;
|
|||
|
label1.Text = "false";
|
|||
|
label1.ForeColor = Color.Red;
|
|||
|
}
|
|||
|
}
|
|||
|
catch (Exception ex)
|
|||
|
{
|
|||
|
MessageBox.Show(ex.Message);
|
|||
|
}
|
|||
|
}
|
|||
|
private void buttonClear_Click(object sender, EventArgs e)
|
|||
|
{
|
|||
|
dropDownList.Clear();
|
|||
|
}
|
|||
|
private void buttonGetDown_Click(object sender, EventArgs e)
|
|||
|
{
|
|||
|
textBoxResult.Text = dropDownList.Selected;
|
|||
|
}
|
|||
|
}
|
|||
|
}
|