public override void LoadSettingsFromStorage() { try { base.LoadSettingsFromStorage(); } catch (FormatException) { // If the enum changes, the settings will display an error unless we fix the enum values. SelectedErrorFart = _errorFart; } _hasLoaded = true; }
public static void PlayFart(Farts fart) { if (fart == Farts.RandomFart) { Random rn = new Random(); int index = rn.Next(0, _files.Length); PlayFart(_files[index]); } else { string fileName = _files.FirstOrDefault(f => f.EndsWith("\\" + fart + ".mp3", StringComparison.OrdinalIgnoreCase)); if (!string.IsNullOrEmpty(fileName)) PlayFart(fileName); } }
public static void PlayFart(Farts fart) { if (fart == Farts.RandomFart) { Random rn = new Random(); int index = rn.Next(0, _files.Length); PlayFart(_files[index]); } else { string fileName = _files.FirstOrDefault(f => f.EndsWith("\\" + fart + ".mp3", StringComparison.OrdinalIgnoreCase)); if (!string.IsNullOrEmpty(fileName)) { PlayFart(fileName); } } }