From 6442b02b27f80fa486124241cbf7944f57bf09f1 Mon Sep 17 00:00:00 2001 From: Maxim Slipenko Date: Wed, 25 May 2022 09:13:02 +0300 Subject: [PATCH] =?UTF-8?q?=D0=B4=D0=BE=D0=B1=D0=B0=D0=B2=D0=BB=D1=8F?= =?UTF-8?q?=D0=B5=D1=82=20=D0=B8=D0=BC=D0=BF=D0=BE=D1=80=D1=82=20=D1=84?= =?UTF-8?q?=D0=B0=D0=B9=D0=BB=D0=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- EditUserForm.cs | 1 - MainForm.Designer.cs | 12 +++++++++++- MainForm.cs | 19 +++++++++++++++++++ 3 files changed, 30 insertions(+), 2 deletions(-) diff --git a/EditUserForm.cs b/EditUserForm.cs index 1109d24..bb73b79 100644 --- a/EditUserForm.cs +++ b/EditUserForm.cs @@ -54,7 +54,6 @@ namespace AwesomeEmailExtractor } else { - adminUtils.editUser(editedUser); } } diff --git a/MainForm.Designer.cs b/MainForm.Designer.cs index 027b542..9137ccf 100644 --- a/MainForm.Designer.cs +++ b/MainForm.Designer.cs @@ -43,6 +43,7 @@ this.administrationToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.exitToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.helpToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.importToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.resultStatusStrip.SuspendLayout(); this.menuStrip1.SuspendLayout(); this.SuspendLayout(); @@ -124,7 +125,8 @@ // fileToolStripMenuItem // this.fileToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { - this.exportResultToolStripMenuItem}); + this.exportResultToolStripMenuItem, + this.importToolStripMenuItem}); this.fileToolStripMenuItem.Name = "fileToolStripMenuItem"; this.fileToolStripMenuItem.Size = new System.Drawing.Size(48, 20); this.fileToolStripMenuItem.Text = "Файл"; @@ -182,6 +184,13 @@ this.helpToolStripMenuItem.Text = "Справка"; this.helpToolStripMenuItem.Click += new System.EventHandler(this.helpToolStripMenuItem_Click); // + // importToolStripMenuItem + // + this.importToolStripMenuItem.Name = "importToolStripMenuItem"; + this.importToolStripMenuItem.Size = new System.Drawing.Size(219, 22); + this.importToolStripMenuItem.Text = "Импортировать файл"; + this.importToolStripMenuItem.Click += new System.EventHandler(this.importToolStripMenuItem_Click); + // // MainForm // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); @@ -223,6 +232,7 @@ private System.Windows.Forms.ToolStripMenuItem exitToolStripMenuItem; private System.Windows.Forms.ToolStripMenuItem journalToolStripMenuItem; private System.Windows.Forms.ToolStripMenuItem exportResultToolStripMenuItem; + private System.Windows.Forms.ToolStripMenuItem importToolStripMenuItem; } } diff --git a/MainForm.cs b/MainForm.cs index 4c66113..26ca37b 100644 --- a/MainForm.cs +++ b/MainForm.cs @@ -111,5 +111,24 @@ namespace AwesomeEmailExtractor HelpForm helpForm = FormManager.Current.CreateForm(); helpForm.ShowDialog(this); } + + private void importToolStripMenuItem_Click(object sender, EventArgs e) + { + // Показать окно с выбором файла + OpenFileDialog openFileDialog = new OpenFileDialog(); + openFileDialog.Filter = "Текстовый файл (*.txt)|*.txt"; + + var res = openFileDialog.ShowDialog(); + + // Загрузить текст из файла + if (res == DialogResult.OK) + { + string fileName = openFileDialog.FileName; + string sourceText = System.IO.File.ReadAllText(fileName); + + sourceRichTextBox.Text = sourceText; + } + + } } }