Compare commits

...

4 Commits
v0.3 ... main

Author SHA1 Message Date
6fdb00527c
Merge pull request #39 from PI20v/dev
добавляет импорт файла
2022-05-25 09:19:28 +03:00
6442b02b27
добавляет импорт файла 2022-05-25 09:13:02 +03:00
9d0c1ccf59
Merge pull request #38 from PI20v/dev
хотфикс
2022-05-25 08:27:39 +03:00
46cc1d3463
хотфикс 2022-05-25 08:23:03 +03:00
3 changed files with 44 additions and 7 deletions

View File

@ -45,14 +45,22 @@ namespace AwesomeEmailExtractor
User editedUser = new User(User.ID, loginTextBox.Text, (UserRoles)roleComboBox.SelectedIndex);
if (passwordTextBox.Text != "")
{
adminUtils.editUser(editedUser, passwordTextBox.Text);
}
else
try
{
adminUtils.editUser(editedUser);
if (passwordTextBox.Text != "")
{
adminUtils.editUser(editedUser, passwordTextBox.Text);
}
else
{
adminUtils.editUser(editedUser);
}
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
return;
}
this.Close();

12
MainForm.Designer.cs generated
View File

@ -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;
}
}

View File

@ -111,5 +111,24 @@ namespace AwesomeEmailExtractor
HelpForm helpForm = FormManager.Current.CreateForm<HelpForm>();
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;
}
}
}
}