Catrobat.IDE.WindowsPhone.Controls.SoundControls.SoundPlayButtonGroup.SetSound C# (CSharp) Method

SetSound() public method

public SetSound ( Sound sound ) : System.Threading.Tasks.Task
sound Sound
return System.Threading.Tasks.Task
        public async Task SetSound(Sound sound)
        {
            _sound = sound;
            //TODO refactor this --> use Storage-service
            var localFolder = ApplicationData.Current.LocalFolder;
            var projectsFolder = await localFolder.GetFolderAsync(
                StorageConstants.ProgramsPath);
            var projectFolder = await projectsFolder.GetFolderAsync(
                Program.Name);

            try
            {
                StorageFolder soundsFolder = await projectFolder.GetFolderAsync(
                    StorageConstants.ProgramSoundsPath);
                StorageFile soundFile = await soundsFolder.GetFileAsync(_sound.FileName);
                _mediaElement.SetSource(await soundFile.OpenReadAsync(), soundFile.ContentType);
            }
            catch(Exception)
            {
                ServiceLocator.NotifictionService.ShowToastNotification(
                        AppResourcesHelper.Get("Import_FileNotFound"),
                        AppResourcesHelper.Get("Import_FileNotFoundText"),
                        ToastDisplayDuration.Long);
            }
        }