public void SetSettingTones() { AllAlarmTones.Clear(); var AlarmTones = App.AlarmToneRepo.Tones; foreach (var alarmTone in AlarmTones) { bool isSelected = false; if (alarmTone.Name == Alarm.Tone) { isSelected = true; } AllAlarmTones.Add(new SettingTone(alarmTone.Name, isSelected)); } }
/// <summary> /// Action to be done when a newly added tone has its name set /// </summary> /// <param name="toneName">The name to be given to the alarm tone</param> void OnNewToneNameSet(string toneName) { var newTone = new AlarmTone { Name = toneName, Path = _newToneUri.LocalPath, IsCustomTone = true }; AllAlarmTones.Add(newTone); _alarmStorage.AddTone(newTone); _namingPopupPage.ToneNameSet -= OnNewToneNameSet; _fileLocator.FileChosen -= ToneFileChosen; SetSelectedTone(newTone); FileNeedsNamed = false; }
void ToneFileChosen(string path) { var filename = Path.GetFileNameWithoutExtension(path); var newTone = new AlarmTone { Name = filename, Path = path, IsCustomTone = true }; App.AlarmToneRepo.SaveTone(newTone); AllAlarmTones.Add(new SettingTone(newTone.Name, false)); _fileLocator.FileChosen -= ToneFileChosen; }