private void Window_Loaded(object sender, RoutedEventArgs e) { try { _settings = ExtractorSettings.GetSettingsFromDrive() ?? new ExtractorSettings(); if (string.IsNullOrWhiteSpace(_settings.BaseFolder)) { _settings.BaseFolder = GetUniqueBaseFolder(); } txtBaseFolder.Text = _settings.BaseFolder; txtYoutubeDLLocation.Text = _settings.YoutubeDL ?? ""; txtVLCLocation.Text = _settings.VLC ?? ""; //NOTE: the text change event listeners may have fired above, but not if going from "" to "" RefreshFolderNames(); txtYoutubeDLLocation_TextChanged(this, null); txtVideoURL_TextChanged(this, null); txtVLCLocation_TextChanged(this, null); cboVideoToExtractFrom_SelectionChanged(this, null); txtExtractEveryXFrames_TextChanged(this, null); txtTimeWindows_TextChanged(this, null); } catch (Exception ex) { ShowErrorMessage(ex.ToString()); } }
public static void SaveSettingsToDrive(ExtractorSettings settings) { string filename = GetSettingsFilename(); Directory.CreateDirectory(Path.GetDirectoryName(filename)); XamlServices.Save(filename, settings); }
private void EnsureFoldersExist_SaveSettings() { ShowErrorMessage(); _sessionFolders.EnsureFoldersExist(); if (_sessionFolders.DoFoldersExist) { _settings.BaseFolder = _sessionFolders.BaseFolder; ExtractorSettings.SaveSettingsToDrive(_settings); } else { ShowErrorMessage(_sessionFolders.FolderExistenceErrorMessage); } }