Esempio n. 1
0
        private void RemoveMoodImageButton()
        {
            try
            {
                if (_selectedItemIndex > -1)
                {
                    AlertHelper alertHelper = new AlertHelper(this);
                    alertHelper.AlertIconResourceID  = Resource.Drawable.SymbolStop;
                    alertHelper.AlertMessage         = GetString(Resource.String.ThoughtRecordWizardMoodDeleteConfirm);
                    alertHelper.AlertNegativeCaption = GetString(Resource.String.ButtonCancelCaption);
                    alertHelper.AlertPositiveCaption = GetString(Resource.String.ButtonOKCaption);
                    alertHelper.AlertTitle           = GetString(Resource.String.ThoughtRecordWizardMoodDeleteTitle);
                    alertHelper.InstanceId           = "moodRemove";

                    alertHelper.ShowAlert();
                }
            }
            catch (Exception e)
            {
                Log.Error(TAG, "RemoveMoodImageButton_Click: Exception - " + e.Message);
                if (GlobalData.ShowErrorDialog)
                {
                    ErrorDisplay.ShowErrorAlert(this, e, GetString(Resource.String.ErrorRemovingMood), "ThoughtRecordWizardMoodStep.RemoveMoodImageButton_Click");
                }
            }
        }
Esempio n. 2
0
        private void Remove()
        {
            if (GlobalData.ContactsUserItems.Count == 0)
            {
                Toast.MakeText(this, Resource.String.ContactItemListEmptyToast, ToastLength.Short).Show();
                return;
            }

            if (_selectedItemIndex == -1)
            {
                Toast.MakeText(this, Resource.String.ContactItemListNoSelectionToast, ToastLength.Short).Show();
                return;
            }

            try
            {
                AlertHelper alertHelper = new AlertHelper(this);
                alertHelper.AlertTitle           = GetString(Resource.String.removeEmergencyContactTitle);
                alertHelper.AlertMessage         = GetString(Resource.String.removeEmergencyContactQuestion);
                alertHelper.AlertIconResourceID  = Resource.Drawable.SymbolStop;
                alertHelper.AlertPositiveCaption = GetString(Resource.String.removeEmergencyContactConfirm);
                alertHelper.AlertNegativeCaption = GetString(Resource.String.removeEmergencyContactCancel);
                alertHelper.InstanceId           = "remove";
                alertHelper.ShowAlert();
            }
            catch (System.Exception e)
            {
                Log.Error(TAG, "Remove: Exception - " + e.Message);
                if (GlobalData.ShowErrorDialog)
                {
                    ErrorDisplay.ShowErrorAlert(this, e, "Removing Contact", "ContactActivity.Remove");
                }
            }
        }
Esempio n. 3
0
        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), "SolutionReviewActivity.ShowPermissionRationale");
            }
        }
Esempio n. 4
0
 private void Remove()
 {
     try
     {
         if (_selectedListItemIndex != -1)
         {
             AlertHelper alertHelper = new AlertHelper(this);
             alertHelper.AlertTitle           = GetString(Resource.String.ProblemSolvingActivityRemoveAlertTitle);
             alertHelper.AlertMessage         = GetString(Resource.String.ProblemSolvingActivityRemoveAlertMessage);
             alertHelper.AlertIconResourceID  = Resource.Drawable.SymbolStop;
             alertHelper.AlertPositiveCaption = GetString(Resource.String.ButtonYesCaption);
             alertHelper.AlertNegativeCaption = GetString(Resource.String.ButtonNoCaption);
             alertHelper.InstanceId           = "remove";
             alertHelper.ShowAlert();
         }
         else
         {
             Toast.MakeText(this, Resource.String.ProblemSolvingActivityRemoveToast, ToastLength.Short).Show();
         }
     }
     catch (Exception ex)
     {
         Log.Error(TAG, "Remove_Click: Exception - " + ex.Message);
         if (GlobalData.ShowErrorDialog)
         {
             ErrorDisplay.ShowErrorAlert(this, ex, GetString(Resource.String.ErrorProblemSolvingActivityRemove), "ProblemSolvingActivity.Remove_Click");
         }
     }
 }
 private void Remove()
 {
     try
     {
         if (_selectedItemIndex != -1)
         {
             AlertHelper alertHelper = new AlertHelper(this);
             alertHelper.AlertTitle           = GetString(Resource.String.MedicationRemoveTitle);
             alertHelper.AlertMessage         = GetString(Resource.String.MedicationRemoveText);
             alertHelper.AlertIconResourceID  = Resource.Drawable.SymbolStop;
             alertHelper.AlertPositiveCaption = GetString(Resource.String.ButtonOKCaption);
             alertHelper.AlertNegativeCaption = GetString(Resource.String.ButtonNoCaption);
             alertHelper.InstanceId           = "remove";
             alertHelper.ShowAlert();
         }
         else
         {
             Toast.MakeText(this, Resource.String.MedicationDeleteSelectItem, ToastLength.Short).Show();
         }
     }
     catch (Exception e)
     {
         Log.Error(TAG, "Remove: Exception - " + e.Message);
         if (GlobalData.ShowErrorDialog)
         {
             ErrorDisplay.ShowErrorAlert(this, e, "Removing Medication", "MedicationActivity.Remove");
         }
     }
 }
 private void Remove()
 {
     if (_selectedItemIndex != -1)
     {
         AlertHelper alertHelper = new AlertHelper(this);
         alertHelper.AlertTitle           = GetString(Resource.String.safePlacesRemoveTitle);
         alertHelper.AlertMessage         = GetString(Resource.String.safePlacesRemoveQuestion);
         alertHelper.AlertIconResourceID  = Resource.Drawable.SymbolStop;
         alertHelper.AlertPositiveCaption = GetString(Resource.String.safePlacesRemoveConfirm);
         alertHelper.AlertNegativeCaption = GetString(Resource.String.safePlacesRemoveCancel);
         alertHelper.InstanceId           = "remove";
         alertHelper.ShowAlert();
     }
     else
     {
         if (GlobalData.GenericTextItemsList != null && GlobalData.GenericTextItemsList.Count > 0)
         {
             var itemList = GlobalData.GenericTextItemsList.FindAll(item => item.TextType == ConstantsAndTypes.GENERIC_TEXT_TYPE.SafePlaces);
             if (itemList != null && itemList.Count > 0)
             {
                 Toast.MakeText(this, Resource.String.SafePlaceToastSelectItem, ToastLength.Short).Show();
             }
             else
             {
                 Toast.MakeText(this, Resource.String.SafePlaceToastNoItems, ToastLength.Short).Show();
             }
         }
         else
         {
             Toast.MakeText(this, Resource.String.SafePlaceToastNoItems, ToastLength.Short).Show();
         }
     }
 }
        private void ShowPermissionRationale()
        {
            try
            {
                if (GlobalData.Settings.Find(setting => setting.SettingKey == "NagReadExternalStorage").SettingValue == "True")
                {
                    return;
                }

                AlertHelper alertHelper = new AlertHelper(this);

                alertHelper.AlertIconResourceID  = Resource.Drawable.SymbolInformation;
                alertHelper.AlertMessage         = GetString(Resource.String.RequestPermissionReadExternalStorageAlertMessage);
                alertHelper.AlertNegativeCaption = GetString(Resource.String.ButtonNoCaption);
                alertHelper.AlertPositiveCaption = GetString(Resource.String.ButtonYesCaption);
                alertHelper.AlertTitle           = GetString(Resource.String.RequestPermissionReadExternalStorageAlertTitle);
                alertHelper.InstanceId           = "readExternalStorage";
                alertHelper.ShowAlert();
            }
            catch (System.Exception e)
            {
                Log.Error(TAG, "ShowPermissionRationale: Exception - " + e.Message);
                ErrorDisplay.ShowErrorAlert(this, e, GetString(Resource.String.ErrorReadExternalStoragePermissionShowRationaleAlert), "MusicPlayListTracksActivity.ShowPermissionRationale");
            }
        }
        private void Remove()
        {
            if (GlobalData.SafetyPlanCardsItems != null)
            {
                if (GlobalData.SafetyPlanCardsItems.Count == 0)
                {
                    return;
                }
            }
            else
            {
                GlobalData.SafetyPlanCardsItems = new List <SafetyPlanCard>();
                return;
            }

            try
            {
                AlertHelper alertHelper = new AlertHelper(this);
                alertHelper.AlertTitle           = GetString(Resource.String.safetyPlanCardRemoveTitle);
                alertHelper.AlertMessage         = GetString(Resource.String.safetyPlanCardRemoveQuestion);
                alertHelper.AlertIconResourceID  = Resource.Drawable.SymbolStop;
                alertHelper.AlertPositiveCaption = GetString(Resource.String.safetyPlanCardRemoveConfirm);
                alertHelper.AlertNegativeCaption = GetString(Resource.String.safetyPlanCardRemoveCancel);
                alertHelper.InstanceId           = "remove";
                alertHelper.ShowAlert();
            }
            catch (Exception e)
            {
                Log.Error(TAG, "Remove: Exception - " + e.Message);
                if (GlobalData.ShowErrorDialog)
                {
                    ErrorDisplay.ShowErrorAlert(this, e, "Removing Safety Plan card", "SafetyPlanCardsActivity.Remove");
                }
            }
        }
 private void RemoveThoughtButton()
 {
     try
     {
         if (_selectedItemIndex > -1)
         {
             AlertHelper alertHelper = new AlertHelper(this);
             alertHelper.AlertTitle           = GetString(Resource.String.ThoughtRecordWizardAlternativeDeleteTitle);
             alertHelper.AlertMessage         = GetString(Resource.String.ThoughtRecordWizardAlternativeThoughtDeleteConfirm);
             alertHelper.AlertIconResourceID  = Resource.Drawable.SymbolStop;
             alertHelper.AlertPositiveCaption = GetString(Resource.String.ButtonYesCaption);
             alertHelper.AlertNegativeCaption = GetString(Resource.String.ButtonNoCaption);
             alertHelper.InstanceId           = "remove";
             alertHelper.ShowAlert();
         }
     }
     catch (Exception ex)
     {
         Log.Error(TAG, "RemoveThoughtButton: Exception - " + ex.Message);
         if (GlobalData.ShowErrorDialog)
         {
             ErrorDisplay.ShowErrorAlert(this, ex, GetString(Resource.String.ErrorRemovingAltThoughtItem), "ThoughtRecordWizardAlternativeThoughtStep.RemoveThoughtButton");
         }
     }
 }
Esempio n. 10
0
        private void ShowPermissionRationale()
        {
            try
            {
                if (GlobalData.Settings.Find(setting => setting.SettingKey == "NagMic").SettingValue == "True")
                {
                    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), "TellMyselfActivity.ShowPermissionRationale");
            }
        }
        private void Remove()
        {
            try
            {
                //remove selected track from the playlist
                if (_mediaPlayer != null)
                {
                    if (_mediaPlayer.IsPlaying || _isPaused)
                    {
                        if (_timerHandler != null)
                        {
                            _timerHandler.RemoveCallbacks(_timerRunnable);
                        }
                        _mediaPlayer.Stop();
                        _mediaPlayer.Reset();
                        _isPaused  = false;
                        _isPlaying = false;
                    }

                    var playList = GlobalData.PlayListItems.Find(list => list.PlayListID == _playListID);
                    if (playList != null)
                    {
                        if (_selectedListItemIndex == -1)
                        {
                            if (playList.PlayListTracks.Count == 0)
                            {
                                Toast.MakeText(this, Resource.String.MusicPlayListTracksActivityRemoveWarning1, ToastLength.Short).Show();
                            }
                            else
                            {
                                Toast.MakeText(this, Resource.String.MusicPlayListTracksActivityRemoveWarning2, ToastLength.Short).Show();
                            }
                            return;
                        }

                        AlertHelper alertHelper = new AlertHelper(this);
                        alertHelper.AlertIconResourceID  = Resource.Drawable.notes;
                        alertHelper.AlertTitle           = GetString(Resource.String.MusicPlayListTrackRemoveAlertTitle);
                        alertHelper.AlertMessage         = GetString(Resource.String.MusicPlayListTrackRemoveAlertMessage);
                        alertHelper.AlertPositiveCaption = GetString(Resource.String.ButtonYesCaption);
                        alertHelper.AlertNegativeCaption = GetString(Resource.String.ButtonNoCaption);
                        alertHelper.InstanceId           = "999";
                        alertHelper.ShowAlert();
                    }
                }
            }
            catch (System.Exception ex)
            {
                Log.Error(TAG, "Remove_Click: Exception - " + ex.Message);
                if (GlobalData.ShowErrorDialog)
                {
                    ErrorDisplay.ShowErrorAlert(this, ex, GetString(Resource.String.ErrorMusicPlayListTracksActivityRemove), "MusicPlayListTracksActivity.Remove_Click");
                }
            }
        }
Esempio n. 12
0
        private void AlertUserToPermissionRationale()
        {
            AlertHelper alertHelper = new AlertHelper(this);

            alertHelper.AlertIconResourceID  = Resource.Drawable.SymbolInformation;
            alertHelper.AlertMessage         = GetString(Resource.String.RequestPermissionReadContactsAlertMessage);
            alertHelper.AlertNegativeCaption = GetString(Resource.String.ButtonNoCaption);
            alertHelper.AlertPositiveCaption = GetString(Resource.String.ButtonYesCaption);
            alertHelper.AlertTitle           = GetString(Resource.String.RequestPermissionReadContactsAlertTitle);
            alertHelper.InstanceId           = "showRationale";
            alertHelper.ShowAlert();
        }
Esempio n. 13
0
        private void ShowPermissionRationale(ConstantsAndTypes.AppPermission permission)
        {
            try
            {
                if (permission == ConstantsAndTypes.AppPermission.SendSms)
                {
                    if (GlobalData.Settings.Find(setting => setting.SettingKey == "NagSendSms").SettingValue == "True")
                    {
                        return;
                    }
                }

                if (permission == ConstantsAndTypes.AppPermission.MakeCalls)
                {
                    if (GlobalData.Settings.Find(setting => setting.SettingKey == "NagMakeCalls").SettingValue == "True")
                    {
                        return;
                    }
                }

                AlertHelper alertHelper = new AlertHelper(this);

                string instanceId   = "";
                string alertTitle   = "";
                string alertMessage = "";

                if (permission == ConstantsAndTypes.AppPermission.SendSms)
                {
                    instanceId   = "sendSms";
                    alertTitle   = GetString(Resource.String.RequestPermissionSendSmsAlertTitle);
                    alertMessage = GetString(Resource.String.RequestPermissionSendSmsAlertMessage);
                }
                if (permission == ConstantsAndTypes.AppPermission.MakeCalls)
                {
                    instanceId   = "makeCalls";
                    alertTitle   = GetString(Resource.String.RequestPermissionMakeCallsAlertTitle);
                    alertMessage = GetString(Resource.String.RequestPermissionMakeCallsAlertMessage);
                }

                alertHelper.AlertIconResourceID  = Resource.Drawable.SymbolInformation;
                alertHelper.AlertMessage         = alertMessage;
                alertHelper.AlertNegativeCaption = GetString(Resource.String.ButtonNoCaption);
                alertHelper.AlertPositiveCaption = GetString(Resource.String.ButtonYesCaption);
                alertHelper.AlertTitle           = alertTitle;
                alertHelper.InstanceId           = instanceId;
                alertHelper.ShowAlert();
            }
            catch (Exception e)
            {
                Log.Error(TAG, "ShowPermissionRationale: Exception - " + e.Message);
                ErrorDisplay.ShowErrorAlert(this, e, GetString(Resource.String.ErrorMicPermissionShowRationalAlert), "HelpNowActivity.ShowPermissionRationale");
            }
        }
Esempio n. 14
0
 private void Remove()
 {
     try
     {
         if (_selectedItemIndex != -1)
         {
             var         resourceString = "";
             AlertHelper alertHelper    = new AlertHelper(this);
             if (GlobalData.TellMyselfItemsList[_selectedItemIndex].TellType == ConstantsAndTypes.TELL_TYPE.Audio)
             {
                 resourceString         = GetString(Resource.String.tellMyselfRemoveTitleAudio);
                 alertHelper.AlertTitle = resourceString;
                 resourceString         = GetString(Resource.String.tellMyselfRemoveQuestionAudio);
             }
             else
             {
                 resourceString         = GetString(Resource.String.tellMyselfRemoveTitleText);
                 alertHelper.AlertTitle = resourceString;
                 resourceString         = GetString(Resource.String.tellMyselfRemoveQuestionText);
             }
             alertHelper.AlertMessage         = resourceString;
             alertHelper.AlertIconResourceID  = Resource.Drawable.SymbolStop;
             alertHelper.AlertPositiveCaption = GetString(Resource.String.ButtonYesCaption);
             alertHelper.AlertNegativeCaption = GetString(Resource.String.ButtonNoCaption);
             alertHelper.InstanceId           = "remove";
             alertHelper.ShowAlert();
         }
         else
         {
             if (GlobalData.TellMyselfItemsList != null && GlobalData.TellMyselfItemsList.Count > 0)
             {
                 Toast.MakeText(this, Resource.String.TellMyselfToastSelectItem, ToastLength.Short).Show();
             }
             else
             {
                 Toast.MakeText(this, Resource.String.TellMyselfToastNoItems, ToastLength.Short).Show();
             }
         }
     }
     catch (Exception ex)
     {
         Log.Error(TAG, "Remove: Exception - " + ex.Message);
         if (GlobalData.ShowErrorDialog)
         {
             ErrorDisplay.ShowErrorAlert(this, ex, GetString(Resource.String.ErrorRemovingTellMyselfItem), "TellMyselfActivity.Remove");
         }
     }
 }
        private void Remove()
        {
            try
            {
                var adapter         = _moodList.Adapter;
                var selectedIndexID = (int)adapter.GetItemId(_selectedItemIndex);
                var moodItem        = GlobalData.MoodListItems.Find(mood => mood.MoodId == selectedIndexID);
                if (moodItem != null)
                {
                    if (moodItem.IsDefault == "true")
                    {
                        Toast.MakeText(this, Resource.String.MoodsAdjustRemoveDefaultEntryToast, ToastLength.Short).Show();
                        return;
                    }

                    if (_selectedItemIndex != -1)
                    {
                        AlertHelper alertHelper = new AlertHelper(this);
                        alertHelper.AlertTitle           = GetString(Resource.String.MoodsAdjustActivityRemoveAlertTitle);
                        alertHelper.AlertMessage         = GetString(Resource.String.MoodsAdjustActivityRemoveAlertMessage);
                        alertHelper.AlertIconResourceID  = Resource.Drawable.SymbolStop;
                        alertHelper.AlertPositiveCaption = GetString(Resource.String.ButtonYesCaption);
                        alertHelper.AlertNegativeCaption = GetString(Resource.String.ButtonNoCaption);
                        alertHelper.InstanceId           = "remove";
                        alertHelper.ShowAlert();
                    }
                    else
                    {
                        if (GlobalData.MoodListItems != null && GlobalData.MoodListItems.Count > 0)
                        {
                            Toast.MakeText(this, Resource.String.MoodsAdjustActivityRemoveToast, ToastLength.Short).Show();
                        }
                        else
                        {
                            Toast.MakeText(this, Resource.String.MoodsAdjustActivityRemoveNoEntriesToast, ToastLength.Short).Show();
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                Log.Error(TAG, "Remove: Exception - " + ex.Message);
                if (GlobalData.ShowErrorDialog)
                {
                    ErrorDisplay.ShowErrorAlert(this, ex, GetString(Resource.String.ErrorMoodsAdjustActivityRemove), "MoodsAdjustActivity.Remove");
                }
            }
        }
Esempio n. 16
0
 private void ShowSaveAlert()
 {
     try
     {
         AlertHelper alertHelper = new AlertHelper(this);
         alertHelper.InstanceId           = "0";
         alertHelper.AlertIconResourceID  = Resource.Drawable.SymbolStop;
         alertHelper.AlertTitle           = GetString(Resource.String.SettingsAlertTitle);
         alertHelper.AlertMessage         = GetString(Resource.String.SettingsAlertQuestion);
         alertHelper.AlertNegativeCaption = GetString(Resource.String.ButtonNoCaption);
         alertHelper.AlertPositiveCaption = GetString(Resource.String.ButtonYesCaption);
         alertHelper.ShowAlert();
     }
     catch (Exception e)
     {
         Log.Error(TAG, "ShowSaveAlert: Exception - " + e.Message);
     }
 }
 private void Remove()
 {
     try
     {
         if (_selectedItemIndex != -1)
         {
             AlertHelper alertHelper = new AlertHelper(this);
             alertHelper.AlertTitle           = GetString(Resource.String.workedPastRemoveTitle);
             alertHelper.AlertMessage         = GetString(Resource.String.workedPastRemoveQuestion);
             alertHelper.AlertIconResourceID  = Resource.Drawable.SymbolStop;
             alertHelper.AlertPositiveCaption = GetString(Resource.String.workedPastRemoveConfirm);
             alertHelper.AlertNegativeCaption = GetString(Resource.String.workedPastRemoveCancel);
             alertHelper.InstanceId           = "remove";
             alertHelper.ShowAlert();
         }
         else
         {
             if (GlobalData.GenericTextItemsList != null && GlobalData.GenericTextItemsList.Count > 0)
             {
                 var itemList = GlobalData.GenericTextItemsList.FindAll(item => item.TextType == ConstantsAndTypes.GENERIC_TEXT_TYPE.MethodsOfCoping);
                 if (itemList != null && itemList.Count > 0)
                 {
                     Toast.MakeText(this, Resource.String.CopingMethodToastSelectItem, ToastLength.Short).Show();
                 }
                 else
                 {
                     Toast.MakeText(this, Resource.String.CopingMethodToastNoItems, ToastLength.Short).Show();
                 }
             }
             else
             {
                 Toast.MakeText(this, Resource.String.CopingMethodToastNoItems, ToastLength.Short).Show();
             }
         }
     }
     catch (Exception ex)
     {
         Log.Error(TAG, "Remove_Click: Exception - " + ex.Message);
         if (GlobalData.ShowErrorDialog)
         {
             ErrorDisplay.ShowErrorAlert(this, ex, GetString(Resource.String.ErrorRemovingWorkedPastItem), "WorkedPastActivity.Remove_Click");
         }
     }
 }
Esempio n. 18
0
 private void AskForComment()
 {
     try
     {
         AlertHelper alertHelper = new AlertHelper(this);
         alertHelper.AlertTitle           = GetString(Resource.String.ImageryActivityCommentAlertTitle);
         alertHelper.AlertMessage         = GetString(Resource.String.ImageryActivityCommentAlertQuestion);
         alertHelper.AlertIconResourceID  = Resource.Drawable.SymbolStop;
         alertHelper.AlertPositiveCaption = GetString(Resource.String.ButtonYesCaption);
         alertHelper.AlertNegativeCaption = GetString(Resource.String.ButtonNoCaption);
         alertHelper.InstanceId           = "comment";
         alertHelper.ShowAlert();
     }
     catch (Exception e)
     {
         Log.Error(TAG, "AskForComment: Exception - " + e.Message);
         if (GlobalData.ShowErrorDialog)
         {
             ErrorDisplay.ShowErrorAlert(this, e, GetString(Resource.String.ErrorCreatingCommentDialog), "ImageryActivity.AskForComment");
         }
     }
 }
 private void Remove()
 {
     if (_selectedItemPosition != -1)
     {
         try
         {
             AlertHelper alertHelper = new AlertHelper(this);
             alertHelper.AlertTitle           = GetString(Resource.String.StructuredPlanAttitudesRemoveAlertTitle);
             alertHelper.AlertMessage         = GetString(Resource.String.StructuredPlanAttitudesRemoveAlertQuestion);
             alertHelper.AlertIconResourceID  = Resource.Drawable.SymbolStop;
             alertHelper.AlertPositiveCaption = GetString(Resource.String.ButtonYesCaption);
             alertHelper.AlertNegativeCaption = GetString(Resource.String.ButtonNoCaption);
             alertHelper.InstanceId           = "remove";
             alertHelper.ShowAlert();
         }
         catch (Exception ex)
         {
             Log.Error(TAG, "Remove: Exception - " + ex.Message);
             if (GlobalData.ShowErrorDialog)
             {
                 ErrorDisplay.ShowErrorAlert(this, ex, GetString(Resource.String.ErrorStructuredPlanAttitudesRemove), "StructuredPlanAttitudes.Remove");
             }
         }
     }
     else
     {
         string warning = "";
         if (GlobalData.StructuredPlanAttitudes.Count == 0)
         {
             warning = GetString(Resource.String.StructuredPlanAttitudesWarning1);
         }
         else
         {
             warning = GetString(Resource.String.StructuredPlanAttitudesWarning2);
         }
         Toast.MakeText(this, warning, ToastLength.Short).Show();
     }
 }
Esempio n. 20
0
 private void Remove()
 {
     try
     {
         if (_selectedItemIndex != -1)
         {
             AlertHelper alertHelper = new AlertHelper(this);
             alertHelper.AlertTitle           = GetString(Resource.String.ImageryActivityRemoveAlertTitle);
             alertHelper.AlertMessage         = GetString(Resource.String.ImageryActivityRemoveAlertMessage);
             alertHelper.AlertIconResourceID  = Resource.Drawable.SymbolStop;
             alertHelper.AlertPositiveCaption = GetString(Resource.String.ButtonYesCaption);
             alertHelper.AlertNegativeCaption = GetString(Resource.String.ButtonNoCaption);
             alertHelper.InstanceId           = "remove";
             alertHelper.ShowAlert();
         }
         else
         {
             string toastText = "";
             if (GlobalData.ImageListItems != null && GlobalData.ImageListItems.Count == 0)
             {
                 toastText = GetString(Resource.String.ImageryActivityRemoveWarning1);
             }
             else
             {
                 toastText = GetString(Resource.String.ImageryActivityRemoveWarning2);
             }
             Toast.MakeText(this, toastText, ToastLength.Short).Show();
         }
     }
     catch (Exception ex)
     {
         Log.Error(TAG, "Remove: Exception - " + ex.Message);
         if (GlobalData.ShowErrorDialog)
         {
             ErrorDisplay.ShowErrorAlert(this, ex, GetString(Resource.String.ErrorImageryActivityRemove), "ImageryActivity.Remove");
         }
     }
 }
Esempio n. 21
0
        private void Remove()
        {
            try
            {
                if (GlobalData.AchievementChartItems.Count > 0)
                {
                    if (_selectedItemIndex != -1)
                    {
                        AlertHelper alertHelper = new AlertHelper(this);

                        alertHelper.AlertIconResourceID  = Resource.Drawable.SymbolStop;
                        alertHelper.AlertTitle           = GetString(Resource.String.AchievementChartActivityRemoveAlertTitle);
                        alertHelper.AlertMessage         = GetString(Resource.String.AchievementChartActivityRemoveAlertText);
                        alertHelper.AlertPositiveCaption = GetString(Resource.String.ButtonYesCaption);
                        alertHelper.AlertNegativeCaption = GetString(Resource.String.ButtonNoCaption);
                        alertHelper.InstanceId           = "remove";

                        alertHelper.ShowAlert();
                    }
                    else
                    {
                        Toast.MakeText(this, "Please select an item", ToastLength.Short).Show();
                    }
                }
                else
                {
                    Toast.MakeText(this, "There are no items currently in the list", ToastLength.Short).Show();
                }
            }
            catch (Exception e)
            {
                Log.Error(TAG, "Remove: Exception - " + e.Message);
                if (GlobalData.ShowErrorDialog)
                {
                    ErrorDisplay.ShowErrorAlert(this, e, GetString(Resource.String.ErrorRemovingAchievementItem), "AchievementChartActivity.Remove");
                }
            }
        }
Esempio n. 22
0
        private void Cancel()
        {
            try
            {
                AlertHelper alertHelper = new AlertHelper(this);
                alertHelper.AlertIconResourceID  = Resource.Drawable.SymbolStop;
                alertHelper.AlertMessage         = GetString(Resource.String.ThoughtRecordWizardAutomaticThoughtConfirm);
                alertHelper.AlertNegativeCaption = GetString(Resource.String.ButtonCancelCaption);
                alertHelper.AlertPositiveCaption = GetString(Resource.String.ButtonOKCaption);
                alertHelper.AlertTitle           = GetString(Resource.String.ThoughtRecordWizardAutomaticThoughtCancel);
                alertHelper.InstanceId           = "moodCancel";

                alertHelper.ShowAlert();
            }
            catch (Exception e)
            {
                Log.Error(TAG, "CancelButton_Click: Exception - " + e.Message);
                if (GlobalData.ShowErrorDialog)
                {
                    ErrorDisplay.ShowErrorAlert(this, e, GetString(Resource.String.ErrorCancelMoodAddition), "ThoughtRecordWizardMoodStep.CancelButton_Click");
                }
            }
        }
        private void ShowCancelDialog()
        {
            try
            {
                AlertHelper alertHelper = new AlertHelper(this);
                alertHelper.AlertIconResourceID  = Resource.Drawable.SymbolStop;
                alertHelper.AlertMessage         = GetString(Resource.String.ThoughtRecordWizardSituationConfirm);
                alertHelper.AlertNegativeCaption = GetString(Resource.String.ButtonCancelCaption);
                alertHelper.AlertPositiveCaption = GetString(Resource.String.ButtonOKCaption);
                alertHelper.AlertTitle           = GetString(Resource.String.ThoughtRecordWizardSituationCancel);
                alertHelper.InstanceId           = "situationCancel";

                alertHelper.ShowAlert();
            }
            catch (Exception e)
            {
                Log.Error(TAG, "ShowCancelDialog: Exception - " + e.Message);
                if (GlobalData.ShowErrorDialog)
                {
                    ErrorDisplay.ShowErrorAlert(this, e, GetString(Resource.String.ErrorCancelSituationAddition), "ThoughtRecordWizardSituationStep.ShowCancelDialog");
                }
            }
        }
 private void RemoveQuestion()
 {
     try
     {
         if (_selectedItemIndex != -1)
         {
             var alert = new AlertHelper(this);
             alert.AlertIconResourceID  = Resource.Drawable.SymbolDelete;
             alert.AlertMessage         = GetString(Resource.String.AppointmentQuestionRemoveQuestion);
             alert.AlertPositiveCaption = GetString(Resource.String.ButtonYesCaption);
             alert.AlertNegativeCaption = GetString(Resource.String.ButtonNoCaption);
             alert.AlertTitle           = GetString(Resource.String.AppointmentQuestionRemoveAlertTitle);
             alert.InstanceId           = "remove";
             alert.ShowAlert();
         }
         else
         {
             if (_appointment.Questions.Count > 0)
             {
                 Toast.MakeText(this, Resource.String.AppointmentQuestionRemoveSelectToast, ToastLength.Short).Show();
             }
             else
             {
                 Toast.MakeText(this, Resource.String.AppointmentQuestionRemoveNoQuestionsToast, ToastLength.Short).Show();
             }
         }
     }
     catch (Exception e)
     {
         Log.Error(TAG, "RemoveQuestion: Exception - " + e.Message);
         if (GlobalData.ShowErrorDialog)
         {
             ErrorDisplay.ShowErrorAlert(this, e, GetString(Resource.String.AppointmentQuestionRemoveAlertTitle), "ResourcesAppointmentItemActivity.RemoveQuestion");
         }
     }
 }
        public override bool OnOptionsItemSelected(IMenuItem item)
        {
            try
            {
                if (item != null)
                {
                    if (GlobalData.AppointmentPopupWindow != null)
                    {
                        GlobalData.AppointmentPopupWindow.RequiresParentUpdate = false;
                        GlobalData.AppointmentPopupWindow.Dismiss();
                        GlobalData.AppointmentPopupWindow = null;
                    }
                    if (item.ItemId == Android.Resource.Id.Home)
                    {
                        HideSoftKeyboard();
                        if (_isDirtyQuestions)
                        {
                            var alert = new AlertHelper(this);
                            alert.AlertIconResourceID  = Resource.Drawable.SymbolDelete;
                            alert.AlertMessage         = "You have added questions for this appointment. Save before going back?";
                            alert.AlertPositiveCaption = GetString(Resource.String.ButtonYesCaption);
                            alert.AlertNegativeCaption = GetString(Resource.String.ButtonNoCaption);
                            alert.AlertTitle           = "Save Appointment";
                            alert.InstanceId           = "dirtyquestions";
                            alert.ShowAlert();
                        }
                        else
                        {
                            SetResult(Result.Canceled);
                            Finish();
                        }
                        return(true);
                    }

                    switch (item.ItemId)
                    {
                    case Resource.Id.AppointmentItemActionSave:
                        SaveAppointment();
                        if (!_blockReturnOnEmpty)
                        {
                            SetResult(Result.Ok);
                            Finish();
                        }
                        return(true);

                    case Resource.Id.AppointmentItemActionAdd:
                        AddQuestion();
                        return(true);

                    case Resource.Id.AppointmentItemActionRemove:
                        RemoveQuestion();
                        return(true);

                    case Resource.Id.AppointmentItemActionHelp:
                        Intent intent = new Intent(this, typeof(ResourcesAppointmentHelpActivity));
                        StartActivity(intent);
                        return(true);
                    }
                }
            }
            catch (Exception e)
            {
                Log.Error(TAG, "OnOptionItemSelected: Exception - " + e.Message);
                if (GlobalData.ShowErrorDialog)
                {
                    ErrorDisplay.ShowErrorAlert(this, e, "Selecting option", "ResourcesAppointmentItemActivity.OnOptionItemSelected");
                }
            }
            return(base.OnOptionsItemSelected(item));
        }
Esempio n. 26
0
        private void ShowEmergencyDialogAlert(ConstantsAndTypes.HELP_NOW_TYPES emergencyType)
        {
            var resourceStringTitle    = "";
            var resourceStringQuestion = "";

            try
            {
                if (emergencyType == ConstantsAndTypes.HELP_NOW_TYPES.EmergencySms)
                {
                    if (!(PermissionsHelper.HasPermission(this, ConstantsAndTypes.AppPermission.SendSms) && PermissionsHelper.PermissionGranted(this, ConstantsAndTypes.AppPermission.SendSms)))
                    {
                        if (GlobalData.Settings.Find(setting => setting.SettingKey == "NagSendSms").SettingValue == "False")
                        {
                            CheckPermission(ConstantsAndTypes.AppPermission.SendSms);
                            return;
                        }
                        else
                        {
                            Toast.MakeText(this, Resource.String.SendSmsPermissionDenialToast, ToastLength.Short).Show();
                            return;
                        }
                    }
                }

                if (emergencyType == ConstantsAndTypes.HELP_NOW_TYPES.EmergencyTelephone)
                {
                    if (!(PermissionsHelper.HasPermission(this, ConstantsAndTypes.AppPermission.MakeCalls) && PermissionsHelper.PermissionGranted(this, ConstantsAndTypes.AppPermission.MakeCalls)))
                    {
                        if (GlobalData.Settings.Find(setting => setting.SettingKey == "NagMakeCalls").SettingValue == "False")
                        {
                            CheckPermission(ConstantsAndTypes.AppPermission.MakeCalls);
                            return;
                        }
                        else
                        {
                            Toast.MakeText(this, Resource.String.MakeCallsPermissionDenialToast, ToastLength.Short).Show();
                            return;
                        }
                    }
                }

                StopSpeaking();

                GetEmergencyTitleAndQuestionForNowType(emergencyType, out resourceStringTitle, out resourceStringQuestion);

                SayText(resourceStringQuestion);

                _emergencyType = emergencyType;

                AlertHelper alertHelper = new AlertHelper(this);
                if (alertHelper != null)
                {
                    alertHelper.AlertTitle           = resourceStringTitle;
                    alertHelper.AlertMessage         = resourceStringQuestion;
                    alertHelper.AlertIconResourceID  = Resource.Drawable.SymbolStop;
                    alertHelper.AlertPositiveCaption = GetString(Resource.String.emergencyConfirmationPositive);
                    alertHelper.AlertNegativeCaption = GetString(Resource.String.emergencyConfirmationNegative);
                    alertHelper.InstanceId           = "emergencyAlert";
                    alertHelper.ShowAlert();
                }
            }
            catch (Exception e)
            {
                Log.Error(TAG, "ShowEmergencyDialogAlert: Exception - " + e.Message);
                if (GlobalData.ShowErrorDialog)
                {
                    ErrorDisplay.ShowErrorAlert(this, e, "Showing Emergency Alert Dialog", "HelpNowActivity.ShowEmergencyDialogAlert");
                }
            }
        }