private void SaveSettings() { Settings.Default.LocalFolderToday = tbLocalToday.Text; Settings.Default.LocalFolderTomorrow = tbLocalTomorrow.Text; Settings.Default.FtpPath = tbFtpFolder.Text; Settings.Default.FtpUsername = tbFtpUser.Text; Settings.Default.FtpPassword = tbFtpPassword.Password; Settings.Default.GcmApiKey = tbGcmApiKey.Text; Settings.Default.Save(); if (tbLocalToday.Text.Equals("") || tbLocalTomorrow.Text.Equals("") || tbFtpFolder.Text.Equals("") || tbFtpPassword.Password.Equals("") || tbFtpUser.Text.Equals("")) { AppendMessageToLog(Vertretungsplan_Uploader.Properties.Resources.ERROR_SAVE_SETTINGS_MISSING_SETTINGS); return; } Settings.Default.SettingsConfigured = true; Settings.Default.Save(); AppendMessageToLog(Vertretungsplan_Uploader.Properties.Resources.SAVED_SETTINGS); if (_manager != null) _manager.ChangeSettings(); else _manager = new VertretungsplanManager(this); AppendMessageToLog(Vertretungsplan_Uploader.Properties.Resources.SETTINGS_DELIVERED_TO_MANAGER); flyoutSettings.IsOpen = false; }
private void ApplySettings() { Dispatcher.BeginInvoke(new Action(() => tbLocalToday.Text = Settings.Default.LocalFolderToday)); Dispatcher.BeginInvoke(new Action(() => tbLocalTomorrow.Text = Settings.Default.LocalFolderTomorrow)); Dispatcher.BeginInvoke(new Action(() => tbFtpFolder.Text = Settings.Default.FtpPath)); Dispatcher.BeginInvoke(new Action(() => tbFtpUser.Text = Settings.Default.FtpUsername)); Dispatcher.BeginInvoke(new Action(() => tbFtpPassword.Password = Settings.Default.FtpPassword)); Dispatcher.BeginInvoke(new Action(() => tbGcmApiKey.Text = Settings.Default.GcmApiKey)); if (!Settings.Default.SettingsConfigured) AppendMessageToLog(Vertretungsplan_Uploader.Properties.Resources.LOAD_SETTINGS_NO_SETTINGS_CONFIGURED); else { _manager = new VertretungsplanManager(this); AppendMessageToLog(Vertretungsplan_Uploader.Properties.Resources.SUCCESSFULLY_LOADED_SETTINGS); } }