Merge pull request #8 from PI20v/7-link-algorithm-and-gui
Интегрирует алгоритм в GUI
This commit is contained in:
commit
3d8060d3fd
166
MainForm.Designer.cs
generated
166
MainForm.Designer.cs
generated
@ -28,126 +28,126 @@
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
this.listBox1 = new System.Windows.Forms.ListBox();
|
||||
this.richTextBox1 = new System.Windows.Forms.RichTextBox();
|
||||
this.button1 = new System.Windows.Forms.Button();
|
||||
this.label1 = new System.Windows.Forms.Label();
|
||||
this.statusStrip1 = new System.Windows.Forms.StatusStrip();
|
||||
this.toolStripStatusLabel1 = new System.Windows.Forms.ToolStripStatusLabel();
|
||||
this.uniqueListBox = new System.Windows.Forms.ListBox();
|
||||
this.sourceRichTextBox = new System.Windows.Forms.RichTextBox();
|
||||
this.executeButton = new System.Windows.Forms.Button();
|
||||
this.resultCountLabel = new System.Windows.Forms.Label();
|
||||
this.resultStatusStrip = new System.Windows.Forms.StatusStrip();
|
||||
this.toolStripStatusLabel = new System.Windows.Forms.ToolStripStatusLabel();
|
||||
this.menuStrip1 = new System.Windows.Forms.MenuStrip();
|
||||
this.файлToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.справкаToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.statusStrip1.SuspendLayout();
|
||||
this.fileToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.helpToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.resultStatusStrip.SuspendLayout();
|
||||
this.menuStrip1.SuspendLayout();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// listBox1
|
||||
// uniqueListBox
|
||||
//
|
||||
this.listBox1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
|
||||
this.uniqueListBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
|
||||
| System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.listBox1.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(204)));
|
||||
this.listBox1.FormattingEnabled = true;
|
||||
this.listBox1.ItemHeight = 20;
|
||||
this.listBox1.Items.AddRange(new object[] {
|
||||
this.uniqueListBox.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(204)));
|
||||
this.uniqueListBox.FormattingEnabled = true;
|
||||
this.uniqueListBox.ItemHeight = 20;
|
||||
this.uniqueListBox.Items.AddRange(new object[] {
|
||||
"alice@example.com",
|
||||
"bob@example.com"});
|
||||
this.listBox1.Location = new System.Drawing.Point(411, 32);
|
||||
this.listBox1.Name = "listBox1";
|
||||
this.listBox1.Size = new System.Drawing.Size(225, 384);
|
||||
this.listBox1.TabIndex = 0;
|
||||
this.uniqueListBox.Location = new System.Drawing.Point(424, 32);
|
||||
this.uniqueListBox.Name = "uniqueListBox";
|
||||
this.uniqueListBox.Size = new System.Drawing.Size(225, 304);
|
||||
this.uniqueListBox.TabIndex = 0;
|
||||
//
|
||||
// richTextBox1
|
||||
// sourceRichTextBox
|
||||
//
|
||||
this.richTextBox1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
|
||||
this.sourceRichTextBox.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
|
||||
| System.Windows.Forms.AnchorStyles.Left)
|
||||
| System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.richTextBox1.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(204)));
|
||||
this.richTextBox1.Location = new System.Drawing.Point(12, 32);
|
||||
this.richTextBox1.Name = "richTextBox1";
|
||||
this.richTextBox1.Size = new System.Drawing.Size(393, 350);
|
||||
this.richTextBox1.TabIndex = 1;
|
||||
this.richTextBox1.Text = "Алиса (alice@example.com) послылает Бобу (bob@example.com) сообщение.\nАдрес bob@e" +
|
||||
this.sourceRichTextBox.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(204)));
|
||||
this.sourceRichTextBox.Location = new System.Drawing.Point(12, 32);
|
||||
this.sourceRichTextBox.Name = "sourceRichTextBox";
|
||||
this.sourceRichTextBox.Size = new System.Drawing.Size(406, 288);
|
||||
this.sourceRichTextBox.TabIndex = 1;
|
||||
this.sourceRichTextBox.Text = "Алиса (alice@example.com) послылает Бобу (bob@example.com) сообщение.\nАдрес bob@e" +
|
||||
"xample.com Алиса нашла на сайте example.com";
|
||||
//
|
||||
// button1
|
||||
// executeButton
|
||||
//
|
||||
this.button1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)
|
||||
this.executeButton.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)
|
||||
| System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.button1.Location = new System.Drawing.Point(12, 412);
|
||||
this.button1.Name = "button1";
|
||||
this.button1.Size = new System.Drawing.Size(393, 24);
|
||||
this.button1.TabIndex = 2;
|
||||
this.button1.Text = "Выполнить";
|
||||
this.button1.UseVisualStyleBackColor = true;
|
||||
this.executeButton.Location = new System.Drawing.Point(12, 350);
|
||||
this.executeButton.Name = "executeButton";
|
||||
this.executeButton.Size = new System.Drawing.Size(406, 24);
|
||||
this.executeButton.TabIndex = 2;
|
||||
this.executeButton.Text = "Выполнить";
|
||||
this.executeButton.UseVisualStyleBackColor = true;
|
||||
this.executeButton.Click += new System.EventHandler(this.executeButton_Click);
|
||||
//
|
||||
// label1
|
||||
// resultCountLabel
|
||||
//
|
||||
this.label1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)
|
||||
this.resultCountLabel.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)
|
||||
| System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.label1.AutoSize = true;
|
||||
this.label1.Font = new System.Drawing.Font("Microsoft Sans Serif", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(204)));
|
||||
this.label1.Location = new System.Drawing.Point(12, 385);
|
||||
this.label1.Name = "label1";
|
||||
this.label1.Size = new System.Drawing.Size(303, 24);
|
||||
this.label1.TabIndex = 3;
|
||||
this.label1.Text = "Количество e-mail-ов в тексте: 3";
|
||||
this.resultCountLabel.AutoSize = true;
|
||||
this.resultCountLabel.Font = new System.Drawing.Font("Microsoft Sans Serif", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(204)));
|
||||
this.resultCountLabel.Location = new System.Drawing.Point(12, 323);
|
||||
this.resultCountLabel.Name = "resultCountLabel";
|
||||
this.resultCountLabel.Size = new System.Drawing.Size(303, 24);
|
||||
this.resultCountLabel.TabIndex = 3;
|
||||
this.resultCountLabel.Text = "Количество e-mail-ов в тексте: 3";
|
||||
//
|
||||
// statusStrip1
|
||||
// resultStatusStrip
|
||||
//
|
||||
this.statusStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
||||
this.toolStripStatusLabel1});
|
||||
this.statusStrip1.Location = new System.Drawing.Point(0, 439);
|
||||
this.statusStrip1.Name = "statusStrip1";
|
||||
this.statusStrip1.Size = new System.Drawing.Size(648, 22);
|
||||
this.statusStrip1.TabIndex = 4;
|
||||
this.statusStrip1.Text = "statusStrip1";
|
||||
this.resultStatusStrip.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
||||
this.toolStripStatusLabel});
|
||||
this.resultStatusStrip.Location = new System.Drawing.Point(0, 377);
|
||||
this.resultStatusStrip.Name = "resultStatusStrip";
|
||||
this.resultStatusStrip.Size = new System.Drawing.Size(661, 22);
|
||||
this.resultStatusStrip.TabIndex = 4;
|
||||
//
|
||||
// toolStripStatusLabel1
|
||||
// toolStripStatusLabel
|
||||
//
|
||||
this.toolStripStatusLabel1.Name = "toolStripStatusLabel1";
|
||||
this.toolStripStatusLabel1.Size = new System.Drawing.Size(42, 17);
|
||||
this.toolStripStatusLabel1.Text = "Успех!";
|
||||
this.toolStripStatusLabel.Name = "toolStripStatusLabel";
|
||||
this.toolStripStatusLabel.Size = new System.Drawing.Size(42, 17);
|
||||
this.toolStripStatusLabel.Text = "Успех!";
|
||||
//
|
||||
// menuStrip1
|
||||
//
|
||||
this.menuStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
||||
this.файлToolStripMenuItem,
|
||||
this.справкаToolStripMenuItem});
|
||||
this.fileToolStripMenuItem,
|
||||
this.helpToolStripMenuItem});
|
||||
this.menuStrip1.Location = new System.Drawing.Point(0, 0);
|
||||
this.menuStrip1.Name = "menuStrip1";
|
||||
this.menuStrip1.Size = new System.Drawing.Size(648, 24);
|
||||
this.menuStrip1.Size = new System.Drawing.Size(661, 24);
|
||||
this.menuStrip1.TabIndex = 5;
|
||||
this.menuStrip1.Text = "menuStrip1";
|
||||
//
|
||||
// файлToolStripMenuItem
|
||||
// fileToolStripMenuItem
|
||||
//
|
||||
this.файлToolStripMenuItem.Name = "файлToolStripMenuItem";
|
||||
this.файлToolStripMenuItem.Size = new System.Drawing.Size(48, 20);
|
||||
this.файлToolStripMenuItem.Text = "Файл";
|
||||
this.fileToolStripMenuItem.Name = "fileToolStripMenuItem";
|
||||
this.fileToolStripMenuItem.Size = new System.Drawing.Size(48, 20);
|
||||
this.fileToolStripMenuItem.Text = "Файл";
|
||||
//
|
||||
// справкаToolStripMenuItem
|
||||
// helpToolStripMenuItem
|
||||
//
|
||||
this.справкаToolStripMenuItem.Name = "справкаToolStripMenuItem";
|
||||
this.справкаToolStripMenuItem.Size = new System.Drawing.Size(65, 20);
|
||||
this.справкаToolStripMenuItem.Text = "Справка";
|
||||
this.helpToolStripMenuItem.Name = "helpToolStripMenuItem";
|
||||
this.helpToolStripMenuItem.Size = new System.Drawing.Size(65, 20);
|
||||
this.helpToolStripMenuItem.Text = "Справка";
|
||||
//
|
||||
// MainForm
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.ClientSize = new System.Drawing.Size(648, 461);
|
||||
this.Controls.Add(this.listBox1);
|
||||
this.Controls.Add(this.button1);
|
||||
this.Controls.Add(this.statusStrip1);
|
||||
this.ClientSize = new System.Drawing.Size(661, 399);
|
||||
this.Controls.Add(this.uniqueListBox);
|
||||
this.Controls.Add(this.executeButton);
|
||||
this.Controls.Add(this.resultStatusStrip);
|
||||
this.Controls.Add(this.menuStrip1);
|
||||
this.Controls.Add(this.label1);
|
||||
this.Controls.Add(this.richTextBox1);
|
||||
this.Controls.Add(this.resultCountLabel);
|
||||
this.Controls.Add(this.sourceRichTextBox);
|
||||
this.MainMenuStrip = this.menuStrip1;
|
||||
this.MinimumSize = new System.Drawing.Size(642, 438);
|
||||
this.Name = "MainForm";
|
||||
this.Text = "Main Form";
|
||||
this.statusStrip1.ResumeLayout(false);
|
||||
this.statusStrip1.PerformLayout();
|
||||
this.resultStatusStrip.ResumeLayout(false);
|
||||
this.resultStatusStrip.PerformLayout();
|
||||
this.menuStrip1.ResumeLayout(false);
|
||||
this.menuStrip1.PerformLayout();
|
||||
this.ResumeLayout(false);
|
||||
@ -157,15 +157,15 @@
|
||||
|
||||
#endregion
|
||||
|
||||
private System.Windows.Forms.ListBox listBox1;
|
||||
private System.Windows.Forms.RichTextBox richTextBox1;
|
||||
private System.Windows.Forms.Button button1;
|
||||
private System.Windows.Forms.Label label1;
|
||||
private System.Windows.Forms.StatusStrip statusStrip1;
|
||||
private System.Windows.Forms.ListBox uniqueListBox;
|
||||
private System.Windows.Forms.RichTextBox sourceRichTextBox;
|
||||
private System.Windows.Forms.Button executeButton;
|
||||
private System.Windows.Forms.Label resultCountLabel;
|
||||
private System.Windows.Forms.StatusStrip resultStatusStrip;
|
||||
private System.Windows.Forms.MenuStrip menuStrip1;
|
||||
private System.Windows.Forms.ToolStripMenuItem файлToolStripMenuItem;
|
||||
private System.Windows.Forms.ToolStripMenuItem справкаToolStripMenuItem;
|
||||
private System.Windows.Forms.ToolStripStatusLabel toolStripStatusLabel1;
|
||||
private System.Windows.Forms.ToolStripMenuItem fileToolStripMenuItem;
|
||||
private System.Windows.Forms.ToolStripMenuItem helpToolStripMenuItem;
|
||||
private System.Windows.Forms.ToolStripStatusLabel toolStripStatusLabel;
|
||||
}
|
||||
}
|
||||
|
||||
|
22
MainForm.cs
22
MainForm.cs
@ -16,5 +16,27 @@ namespace AwesomeEmailExtractor
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
private void executeButton_Click(object sender, EventArgs e)
|
||||
{
|
||||
// Чистим предыдущий результат
|
||||
toolStripStatusLabel.Text = "";
|
||||
resultCountLabel.Text = "";
|
||||
uniqueListBox.DataSource = null;
|
||||
|
||||
// Объявляем список уникальных e-mail-ов
|
||||
List<string> uniqueEmails = new List<string>();
|
||||
|
||||
// Получаем исходный текст из sourceRichTextBox
|
||||
string sourceText = sourceRichTextBox.Text;
|
||||
|
||||
// Вызываем метод для извлечения e-mail-ов
|
||||
int count = ExtactEmailsAlgorithm.Extract(sourceText, out uniqueEmails);
|
||||
|
||||
// Выводим результат
|
||||
toolStripStatusLabel.Text = "Успех!";
|
||||
resultCountLabel.Text = $"Количество e-mail-ов в тексте: {count}";
|
||||
uniqueListBox.DataSource = uniqueEmails;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -117,7 +117,7 @@
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<metadata name="statusStrip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<metadata name="resultStatusStrip.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>17, 17</value>
|
||||
</metadata>
|
||||
<metadata name="menuStrip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
|
Reference in New Issue
Block a user