private void ShowPermissionRationale()
        {
            try
            {
                if (GlobalData.Settings.Find(setting => setting.SettingKey == "NagMic").SettingValue == "True")
                {
                    if (!(PermissionsHelper.HasPermission(this, ConstantsAndTypes.AppPermission.UseMicrophone) && PermissionsHelper.PermissionGranted(this, ConstantsAndTypes.AppPermission.UseMicrophone) == true))
                    {
                        PermissionResultUpdate(Permission.Denied);
                        Toast.MakeText(this, Resource.String.MicrophonePermissionDenialToast, ToastLength.Short).Show();
                    }
                    return;
                }

                AlertHelper alertHelper = new AlertHelper(this);

                alertHelper.AlertIconResourceID  = Resource.Drawable.SymbolInformation;
                alertHelper.AlertMessage         = GetString(Resource.String.RequestPermissionUseMicrophoneAlertMessage);
                alertHelper.AlertNegativeCaption = GetString(Resource.String.ButtonNoCaption);
                alertHelper.AlertPositiveCaption = GetString(Resource.String.ButtonYesCaption);
                alertHelper.AlertTitle           = GetString(Resource.String.RequestPermissionUseMicrophoneAlertTitle);
                alertHelper.InstanceId           = "useMic";
                alertHelper.ShowAlert();
            }
            catch (Exception e)
            {
                Log.Error(TAG, "ShowPermissionRationale: Exception - " + e.Message);
                ErrorDisplay.ShowErrorAlert(this, e, GetString(Resource.String.ErrorMicPermissionShowRationalAlert), "StructuredPlanRelationshipsDialogActivity.ShowPermissionRationale");
            }
        }
コード例 #2
0
 private void AddButton_Click(object sender, EventArgs e)
 {
     try
     {
         if (!_isRecording)
         {
             if (Activity != null)
             {
                 if (_hasRecorded)
                 {
                     if (_title != null)
                     {
                         if (string.IsNullOrEmpty(_titleText.Text.Trim()))
                         {
                             AlertHelper alertHelper = new AlertHelper(Activity);
                             alertHelper.AlertTitle           = GetString(Resource.String.recordAudioSaveMissingTitle);
                             alertHelper.AlertMessage         = GetString(Resource.String.recordAudioSaveTitleQuestion);
                             alertHelper.AlertIconResourceID  = Resource.Drawable.SymbolStop;
                             alertHelper.AlertPositiveCaption = GetString(Resource.String.recordAudioSaveMissingTitleAbort);
                             alertHelper.AlertNegativeCaption = GetString(Resource.String.recordAudioSaveMissingTitleEnter);
                             alertHelper.InstanceId           = "cancelRecord";
                             alertHelper.ShowAlert();
                         }
                         else
                         {
                             if (_titleText != null)
                             {
                                 _title = _titleText.Text.Trim();
                             }
                             if (Activity != null)
                             {
                                 IVoiceRecordCallback parentCallBack = (IVoiceRecordCallback)Activity;
                                 if (parentCallBack != null)
                                 {
                                     Log.Info(TAG, "AddButton_Click: Recording completed, calling parent...");
                                     parentCallBack.RecordingCompleted(_filePath.Trim(), _title.Trim());
                                     Dismiss();
                                 }
                             }
                         }
                     }
                 }
             }
         }
     }
     catch (Exception ex)
     {
         Log.Error(TAG, "AddButton_Click: Exception - " + ex.Message);
         if (Activity != null)
         {
             if (GlobalData.ShowErrorDialog)
             {
                 ErrorDisplay.ShowErrorAlert(Activity, ex, Activity.GetString(Resource.String.ErrorAddingVoiceRecording), "VoiceRecordingDialogFragment.AddButton_Click");
             }
         }
     }
 }
コード例 #3
0
 private void BackButton_Click(object sender, EventArgs e)
 {
     try
     {
         if (!_isRecording)
         {
             if (_hasRecorded)
             {
                 AlertHelper alertHelper = new AlertHelper(Activity);
                 alertHelper.AlertTitle           = GetString(Resource.String.recordAudioCancelTitle);
                 alertHelper.AlertMessage         = GetString(Resource.String.recordAudioCancelQuestion);
                 alertHelper.AlertIconResourceID  = Resource.Drawable.SymbolStop;
                 alertHelper.AlertPositiveCaption = GetString(Resource.String.ButtonYesCaption);
                 alertHelper.AlertNegativeCaption = GetString(Resource.String.ButtonNoCaption);
                 alertHelper.InstanceId           = "cancelRecord";
                 alertHelper.ShowAlert();
             }
             else
             {
                 ((IVoiceRecordCallback)Activity).RecordingCancelled(_filePath.Trim());
                 Dismiss();
             }
         }
     }
     catch (Exception ex)
     {
         Log.Error(TAG, "BackButton_Click: Exception - " + ex.Message);
         if (Activity != null)
         {
             if (GlobalData.ShowErrorDialog)
             {
                 ErrorDisplay.ShowErrorAlert(Activity, ex, Activity.GetString(Resource.String.ErrorReturningFromVoiceRecordingDialog), "VoiceRecordingDialogFragment.BackButton_Click");
             }
         }
     }
 }