private void frmNetworkSettings_Load(object sender, EventArgs e) { NetConfigStatus cstat = settings.LoadConfig(); if (cstat == NetConfigStatus.Error) { MessageBox.Show("Файл конфигурации поврежден!\n" + settings.ConfigError, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } formWorker = new FormWorker(settings, this); formWorker.FillForm(); if (cstat == NetConfigStatus.ProxyPassNotDecrypted) { txtProxyPassword.Text = ""; lblErrorMessage.Text = "Сохраненный пароль не был расшифрован."; } }
private void btnOptions_Click(object sender, EventArgs e) { frmOptions fOptions = new frmOptions(); fOptions.ShowDialog(); if (!settings.LoadConfig()) { lblMessage.ForeColor = Color.Red; lblMessage.Text = settings.ConfigError; return; } NetConfigStatus status = netSettings.LoadConfig(); if (status != NetConfigStatus.OK) { lblMessage.ForeColor = Color.Red; lblMessage.Text = netSettings.ConfigError; return; } }
private void frmMain_Load(object sender, EventArgs e) { try { if (!Directory.Exists(CommonFunctions.SettingsPath)) { Directory.CreateDirectory(CommonFunctions.SettingsPath); } } catch (Exception ex) { lblMessage.ForeColor = Color.Red; lblMessage.Text = ex.Message; } settings = new AppSettingsManager(CommonFunctions.SettingsPath + CommonFunctions.AppConfigFile); netSettings = new NetSettings(CommonFunctions.SettingsPath + CommonFunctions.NetSettingsFile); if (!settings.LoadConfig()) { lblMessage.ForeColor = Color.Red; lblMessage.Text = settings.ConfigError; return; } NetConfigStatus status = netSettings.LoadConfig(); if (status != NetConfigStatus.OK) { lblMessage.ForeColor = Color.Red; lblMessage.Text = netSettings.ConfigError; return; } TorPath = CommonFunctions.SettingsPath + CommonFunctions.TorDir + CommonFunctions.IPDatabaseFile; }