private void SetButtonHandlers() { WvlLogger.Log(LogType.TraceAll, "SetButtonHandlers()"); ((Button)FindViewById(Resource.Id.btnStart)).Click += delegate { WvlLogger.Log(LogType.TraceAll, "Start Recording clicked"); EnableButtons(true); StartRecording(); }; ((Button)FindViewById(Resource.Id.btnStop)).Click += delegate { WvlLogger.Log(LogType.TraceAll, "Start Recording clicked"); EnableButtons(false); StopRecording(); }; ((Button)FindViewById(Resource.Id.btnSendWav)).Click += async delegate { WvlLogger.Log(LogType.TraceAll, "Send Wav clicked"); EnableButtons(false); var wvlService = new WvlService(); if (wavFileName != "") { await wvlService.PostAudioFile(wavFileName); //var res = await wvlService.PostTest(); } }; }
private void SetButtonHandlers() { WvlLogger.Log(LogType.TraceAll, "SetButtonHandlers()"); ((Button)FindViewById(Resource.Id.btnStart)).Click += async delegate { WvlLogger.Log(LogType.TraceAll, "Start Recording clicked"); isRecording = true; EnableButtons(true); // StartRecording(); wavAudioService = new WavAudioService(); wavAudioService.samplesUpdated += AudioService_samplesUpdated; wavAudioService.StartRecording(); }; // Stop record or play ((Button)FindViewById(Resource.Id.btnStop)).Click += delegate { WvlLogger.Log(LogType.TraceAll, "Stop clicked"); if (isRecording) { WvlLogger.Log(LogType.TraceAll, "isRecording : " + isRecording.ToString()); isRecording = false; // StopRecording(); wavAudioService.StopRecording(); wavAudioService.samplesUpdated -= AudioService_samplesUpdated; hasRecord = true; } if (isPlaying) { WvlLogger.Log(LogType.TraceAll, "isPlaying : " + isPlaying.ToString()); isPlaying = false; wavAudioService.StopPlaying(); } EnableButtons(false); }; // Play record ((Button)FindViewById(Resource.Id.btnPlay)).Click += async delegate { WvlLogger.Log(LogType.TraceAll, "Start Playing clicked"); isPlaying = true; EnableButtons(true); // StopRecording(); await wavAudioService.StartPlaying(); //wavAudioService.samplesUpdated -= AudioService_samplesUpdated; isPlaying = false; EnableButtons(false); }; // Send wav to API ((Button)FindViewById(Resource.Id.btnSendWav)).Click += async delegate { WvlLogger.Log(LogType.TraceAll, "Send Wav clicked"); EnableButtons(false); var wvlService = new WvlService(); if (wavFileName != "") { //await wvlService.PostAudioFile(wavFileName); await wvlService.PostAudioFile(); //var res = await wvlService.PostTest(); } }; }