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 = "Сохраненный пароль не был расшифрован.";
            }                        
        }
Пример #2
0
        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;
            }
        }
Пример #3
0
        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;
        }
        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;
            }

            switch (settings.ConnectionType)
            {
            case NetConnectionType.NoProxy: rbDirectConnect.Checked = true; break;

            case NetConnectionType.SystemProxy: rbSystemSettings.Checked = true; break;

            case NetConnectionType.ManualProxy: rbManual.Checked = true; break;
            }
            txtAddress.Text = settings.ProxyAddress;
            txtPort.Text    = settings.ProxyPort.ToString();
            txtUser.Text    = settings.ProxyUser;
            txtTimeout.Text = settings.ConnectionTimeout.ToString();
            if (cstat != NetConfigStatus.ProxyPassNotDecrypted)
            {
                txtPassword.Text = settings.ProxyPassword;
            }
            else
            {
                txtPassword.Text    = "";
                lblProxyStatus.Text = "Сохраненный пароль не был расшифрован.";
            }
            chkShowPassword.Checked = settings.ShowChars;
            chkSavePassword.Checked = settings.SavePassword;
        }