Ejemplo n.º 1
0
        private async void BackButton_OnClick(object sender, RoutedEventArgs e)
        {
            //make sure user wants to leave page in case of work in progress
            bool goToMainPage = await DisplayGoBackToMainPageDialog();

            if (goToMainPage)
            {
                _audioRecorder.StopPlaybackMedia();
                _audioRecorder.DisposeStream();
                _audioRecorder.DisposeMedia();
                _audioRecorder.DisposeMemoryBuffer();
                UIUtils.GoToMainPage(this);
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Stops playback of the passed <paramref name="audioRecorder"/>, deletes the passed <paramref name="VoiceMemoToDelete"/> from the database and the file system, and calls the passed <paramref name="Callback"/> if it's not null
        /// </summary>
        /// <param name="VoiceMemoToDelete"></param>
        /// <param name="audioRecorder"></param>
        /// <param name="Callback"></param>
        /// <returns></returns>
        private static async Task DeleteVoiceMemoAsync(VoiceMemo VoiceMemoToDelete, AudioRecorder audioRecorder, Action Callback = null)
        {
            if (await DisplayDeleteFileDialog())
            {
                //stop playing and dispose stream
                audioRecorder.StopPlaybackMedia();
                audioRecorder.DisposeStream();

                //delete file and from database and file system
                audioRecorder.DeleteFile(VoiceMemoToDelete.FileName);
                StoredProcedures.DeleteVoiceNote(VoiceMemoToDelete.VoiceMemoID);
                // call the callback function if it's not null
                Callback?.Invoke();
            }
        }