tbf/Workplace/LocalSettingsFormForPolozka.cs

57 lines
1.7 KiB
C#

using System;
using System.Windows.Forms;
namespace Workplace
{
public partial class LocalSettingsFormForPolozka : Form
{
public string BlackListFileName;
public LocalSettingsFormForPolozka()
{
InitializeComponent();
ControlBox = false;
}
private void browseButton_Click(object sender, EventArgs e)
{
OpenFileDialog dlg = new OpenFileDialog();
if (!string.IsNullOrEmpty(BlackListFileName)) { dlg.FileName = BlackListFileName; }
BlackList bl;
DialogResult dr = dlg.ShowDialog();
if (dr == DialogResult.OK)
{
if (dlg.FileName == string.Empty)
{
BlackListFileName = string.Empty;
blackListFileTextBox.Text = BlackListFileName;
blackListCodesCountLabel.Text = "Black list deleted";
}
else if (((bl = BlackList.FromFile(dlg.FileName)) != null) && (bl.Codes.Count > 0))
{
BlackListFileName = dlg.FileName;
blackListFileTextBox.Text = BlackListFileName;
blackListCodesCountLabel.Text = bl.Codes.Count.ToString();
}
else
{
BlackListFileName = string.Empty;
blackListFileTextBox.Text = BlackListFileName;
blackListCodesCountLabel.Text = "An invalid or empty black list";
}
}
}
private void saveButton_Click(object sender, EventArgs e)
{
}
private void cancelButton_Click(object sender, EventArgs e)
{
}
}
}