private void ApplyRelevantImageResource(ConstantsAndTypes.NotificationCategories category) { try { if (_notificationImage != null) { switch (category) { case ConstantsAndTypes.NotificationCategories.Achievement: _notificationImage.SetImageResource(Resource.Drawable.chuffed); break; case ConstantsAndTypes.NotificationCategories.Activity: _notificationImage.SetImageResource(Resource.Drawable.activity); break; case ConstantsAndTypes.NotificationCategories.Affirmation: _notificationImage.SetImageResource(Resource.Drawable.affirmation); break; case ConstantsAndTypes.NotificationCategories.Attitudes: _notificationImage.SetImageResource(Resource.Drawable.attitudes); break; case ConstantsAndTypes.NotificationCategories.Fantasy: _notificationImage.SetImageResource(Resource.Drawable.fantasies); break; case ConstantsAndTypes.NotificationCategories.Feelings: _notificationImage.SetImageResource(Resource.Drawable.feelings); break; case ConstantsAndTypes.NotificationCategories.Health: _notificationImage.SetImageResource(Resource.Drawable.health); break; case ConstantsAndTypes.NotificationCategories.Medication: _notificationImage.SetImageResource(Resource.Drawable.tablets); break; case ConstantsAndTypes.NotificationCategories.Reactions: _notificationImage.SetImageResource(Resource.Drawable.reactions); break; case ConstantsAndTypes.NotificationCategories.Relationships: _notificationImage.SetImageResource(Resource.Drawable.relationships); break; default: _notificationImage.SetImageResource(Resource.Drawable.SymbolInformation); break; } } else { Log.Error(TAG, "ApplyRelevantImageResource: _notificationImage is NULL!"); } } catch (Exception e) { Log.Error(TAG, "ApplyRelevantImageResource: Exception - " + e.Message); if (GlobalData.ShowErrorDialog) { ErrorDisplay.ShowErrorAlert(_activity, e, _activity.GetString(Resource.String.ErrorMainNotHelpApplyImgResource), "MainNotificationHelper.ApplyRelevantImageResource"); } } }
private void PerformRandomSelection() { List <ConstantsAndTypes.NotificationCategories> categoryList = new List <ConstantsAndTypes.NotificationCategories>(); bool didGet = false; const int MAX_CATEGORIES = 10; try { Random randomNotify = new Random(); do { ConstantsAndTypes.NotificationCategories category = (ConstantsAndTypes.NotificationCategories)randomNotify.Next((int)ConstantsAndTypes.NotificationCategories.Affirmation + 1); if (!categoryList.Contains(category)) { switch (category) { case ConstantsAndTypes.NotificationCategories.Achievement: didGet = GetRandomAchievement(); break; case ConstantsAndTypes.NotificationCategories.Activity: didGet = GetUpComingActivity(); break; case ConstantsAndTypes.NotificationCategories.Affirmation: didGet = GetRandomAffirmation(); break; case ConstantsAndTypes.NotificationCategories.Attitudes: didGet = GetRandomAttitude(); break; case ConstantsAndTypes.NotificationCategories.Fantasy: didGet = GetRandomFantasy(); break; case ConstantsAndTypes.NotificationCategories.Feelings: didGet = GetRandomFeelings(); break; case ConstantsAndTypes.NotificationCategories.Health: didGet = GetRandomHealth(); break; case ConstantsAndTypes.NotificationCategories.Medication: didGet = GetNextMedicationTime(); break; case ConstantsAndTypes.NotificationCategories.Reactions: didGet = GetRandomReaction(); break; case ConstantsAndTypes.NotificationCategories.Relationships: didGet = GetRandomRelationship(); break; } if (!didGet) { categoryList.Add(category); } } }while (categoryList.Count < MAX_CATEGORIES && !didGet); if (!didGet) { //provide a default GetDefaultNotification(); } } catch (Exception e) { Log.Error(TAG, "PerformRandomSelection: Execption - " + e.Message); if (GlobalData.ShowErrorDialog) { ErrorDisplay.ShowErrorAlert(_activity, e, _activity.GetString(Resource.String.ErrorMainNotHelpPerformRandom), "MainNotificationHelper.PerformRandomSelection"); } } }