public bool Save(MySettings settings) { StreamWriter sw = null; try { //now global: XmlSerializer xs = new XmlSerializer(typeof(MySettings)); //omit xmlns:xsi from xml output //Create our own namespaces for the output XmlSerializerNamespaces ns = new XmlSerializerNamespaces(); //Add an empty namespace and empty value ns.Add("", ""); sw = new StreamWriter(settingsFile); xs.Serialize(sw, settings, ns); return true; } catch (Exception ex) { utils.helpers.addExceptionLog(ex.Message); return false; } finally { if (sw != null) sw.Close(); } }
void loadSettings() { _mysettings = _mysettings.load(); txtUser.Text = _mysettings.Username; txtProfile.Text = _mysettings.OutlookProfile; chkNewSession.Checked = _mysettings.NewSession; chkEnableDialog.Checked = _mysettings.ShowDialog; txtDatabaseFile.Text = _mysettings.SQLiteDataBaseFilename; }
void loadSettings() { _mysettings = _mysettings.load(); txtUser.Text = _mysettings.Username; txtProfile.Text = _mysettings.OutlookProfile; chkNewSession.Checked = _mysettings.NewSession; chkEnableDialog.Checked = _mysettings.ShowDialog; txtDatabaseFile.Text = _mysettings.SQLiteDataBaseFilename; }
private void mnuConnect_Click(object sender, EventArgs e) { _mysettings = _mysettings.load(); _userData = new utils.UserData(_mysettings.ShowDialog, _mysettings.OutlookProfile, _mysettings.Username, ""); Helpers.GetLogonDataOutlook dlg = new Helpers.GetLogonDataOutlook(ref _userData); if (dlg.ShowDialog() == DialogResult.OK) { _olk = new OutlookMail.OutlookMail(ref _licenseMail); _olk.StateChanged += new StateChangedEventHandler(_olk_stateChanged); //_olk.StateChanged += new StateChangedEventHandler(_olk_StateChanged); _olk.start(); if (_olk.logon(_userData.sOutlookProfile, _userData.sUser, _userData.sPassword, _userData.bShowOutlookDialog)) {// "Global", "E841719", "")) Cursor.Current = Cursors.WaitCursor; Application.DoEvents(); _olk.getMailsAsync(); } } mnuConnect.Enabled = false; mnuDisconnect.Enabled = true; }
public MySettings load() { MySettings settings = new MySettings(); StreamReader sr = null; try { XmlSerializer xs = new XmlSerializer(typeof(MySettings)); sr = new StreamReader(settingsFile); settings = (MySettings)xs.Deserialize(sr); sr.Close(); } catch (Exception ex) { utils.helpers.addExceptionLog("MySettings load Exception: "); } finally { if (sr != null) sr.Close(); } return settings; }
private void mnuConnect_Click(object sender, EventArgs e) { _mysettings = _mysettings.load(); _userData = new utils.UserData(_mysettings.ShowDialog,_mysettings.OutlookProfile, _mysettings.Username, ""); Helpers.GetLogonDataOutlook dlg = new Helpers.GetLogonDataOutlook(ref _userData); if (dlg.ShowDialog() == DialogResult.OK) { _olk = new OutlookMail.OutlookMail(ref _licenseMail); _olk.StateChanged += new StateChangedEventHandler(_olk_stateChanged); //_olk.StateChanged += new StateChangedEventHandler(_olk_StateChanged); _olk.start(); if (_olk.logon(_userData.sOutlookProfile, _userData.sUser, _userData.sPassword, _userData.bShowOutlookDialog)) {// "Global", "E841719", "")) Cursor.Current = Cursors.WaitCursor; Application.DoEvents(); _olk.getMailsAsync(); } } mnuConnect.Enabled = false; mnuDisconnect.Enabled = true; }