/// <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(); } }