From 3ed395fab81c99bb84a1391731910796fa70353c Mon Sep 17 00:00:00 2001 From: Maxim Slipenko Date: Mon, 16 May 2022 15:54:54 +0300 Subject: [PATCH] =?UTF-8?q?=D0=B4=D0=B5=D0=BB=D0=B0=D0=B5=D1=82=20=D0=BC?= =?UTF-8?q?=D0=B5=D0=BB=D0=BA=D0=B8=D0=B5=20=D0=BF=D1=80=D0=B0=D0=B2=D0=BA?= =?UTF-8?q?=D0=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - переименовывает label1 в resultCountLabel - добавляет очистку предыдущего результата перед вызовом алгоритма --- MainForm.Designer.cs | 24 ++++++++++++------------ MainForm.cs | 7 ++++++- 2 files changed, 18 insertions(+), 13 deletions(-) diff --git a/MainForm.Designer.cs b/MainForm.Designer.cs index 866012e..8ce0ef9 100644 --- a/MainForm.Designer.cs +++ b/MainForm.Designer.cs @@ -31,7 +31,7 @@ this.uniqueListBox = new System.Windows.Forms.ListBox(); this.sourceRichTextBox = new System.Windows.Forms.RichTextBox(); this.executeButton = new System.Windows.Forms.Button(); - this.label1 = new System.Windows.Forms.Label(); + 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(); @@ -81,17 +81,17 @@ 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, 323); - 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"; // // resultStatusStrip // @@ -140,7 +140,7 @@ this.Controls.Add(this.executeButton); this.Controls.Add(this.resultStatusStrip); this.Controls.Add(this.menuStrip1); - this.Controls.Add(this.label1); + this.Controls.Add(this.resultCountLabel); this.Controls.Add(this.sourceRichTextBox); this.MainMenuStrip = this.menuStrip1; this.MinimumSize = new System.Drawing.Size(642, 438); @@ -160,7 +160,7 @@ private System.Windows.Forms.ListBox uniqueListBox; private System.Windows.Forms.RichTextBox sourceRichTextBox; private System.Windows.Forms.Button executeButton; - private System.Windows.Forms.Label label1; + private System.Windows.Forms.Label resultCountLabel; private System.Windows.Forms.StatusStrip resultStatusStrip; private System.Windows.Forms.MenuStrip menuStrip1; private System.Windows.Forms.ToolStripMenuItem fileToolStripMenuItem; diff --git a/MainForm.cs b/MainForm.cs index 0397f71..c66334d 100644 --- a/MainForm.cs +++ b/MainForm.cs @@ -19,6 +19,11 @@ namespace AwesomeEmailExtractor private void executeButton_Click(object sender, EventArgs e) { + // Чистим предыдущий результат + toolStripStatusLabel.Text = ""; + resultCountLabel.Text = ""; + uniqueListBox.DataSource = null; + // Объявляем список уникальных e-mail-ов List uniqueEmails = new List(); @@ -30,7 +35,7 @@ namespace AwesomeEmailExtractor // Выводим результат toolStripStatusLabel.Text = "Успех!"; - label1.Text = $"Количество e-mail-ов в тексте: {count}"; + resultCountLabel.Text = $"Количество e-mail-ов в тексте: {count}"; uniqueListBox.DataSource = uniqueEmails; } }