Beispiel #1
0
 public void ForceReLoadingSettings()
 {
     StreamReader reader = StreamReader.Null;
     try
     {
         reader = new StreamReader(m_settingsPath);
         this.m_settings = (Settings)m_xmlSerializer.Deserialize(reader);
         LOG.Info("Konfiguracja została pomyślnie wczytana z pliku " + m_settingsPath);
     }
     catch (FileNotFoundException ex)
     {
         LOG.Warn("Brak pliku " + m_settingsPath + "!");
         LOG.Warn("Konfiguracja główna aplikacji została zainicjowana i jest pusta");
         LOG.Debug(ex.StackTrace);
     }
     finally
     {
         reader.Close();
     }
 }
Beispiel #2
0
        private void bSave_Click(object sender, EventArgs e)
        {
            Settings.Settings config = new Settings.Settings();

            config.UseProxy = cbProxyYesOrNo.SelectedItem.Equals("Tak") ? true : false;
            config.ProxyHost = tbProxyHost.Text;
            if (!String.IsNullOrEmpty(tbProxyPort.Text))
                config.ProxyPort = int.Parse(tbProxyPort.Text);
            config.ProxyUser = tbProxyUser.Text;
            config.ProxyDomain = tbProxyDomain.Text;
            config.ProxyPassword = tbProxyPassword.Text;

            config.SentMail = cbSentMail.SelectedItem.Equals("Tak") ? true : false;
            config.SmtpHost = tbSmtpHost.Text;
            if (!String.IsNullOrEmpty(tbSmtpPort.Text))
                config.SmtpPort = int.Parse(tbSmtpPort.Text);
            config.SmtpAccount = tbSmtpAccount.Text;
            config.SmtpAccountPasswd = tbSmtpAccountPasswd.Text;
            config.SmtpTo = tbMailTo.Text;
            config.SmtpSubject = tbMailSubject.Text;
            config.SmtpEnableSSL = cbEnableSSL.Checked;

            this.Close();
        }
Beispiel #3
0
 public void AfterPropertiesSet()
 {
     this.m_settings = new Settings();
     this.m_xmlSerializer = new XmlSerializer(m_settings.GetType());
     ForceReLoadingSettings();
 }