protected override void OnActivityResult(int requestCode, [GeneratedEnum] Result resultCode, Intent data) { int healthID = -1; string aspect = ""; int importance = -1; ConstantsAndTypes.REACTION_TYPE reaction = ConstantsAndTypes.REACTION_TYPE.Positive; ConstantsAndTypes.ACTION_TYPE intention = ConstantsAndTypes.ACTION_TYPE.Maintain; string actionOf = ""; base.OnActivityResult(requestCode, resultCode, data); if (resultCode == Result.Ok) { try { if (data.HasExtra("healthID")) { healthID = data.GetIntExtra("healthID", -1); } if (data.HasExtra("aspect")) { aspect = data.GetStringExtra("aspect"); } if (data.HasExtra("importance")) { importance = data.GetIntExtra("importance", -1); } if (data.HasExtra("reaction")) { reaction = (ConstantsAndTypes.REACTION_TYPE)data.GetIntExtra("reaction", -1); } if (data.HasExtra("intention")) { intention = (ConstantsAndTypes.ACTION_TYPE)data.GetIntExtra("intention", -1); } if (data.HasExtra("actionOf")) { actionOf = data.GetStringExtra("actionOf"); } Health healthItem = null; if (healthID == -1) { //new item healthItem = new Health(); healthItem.IsNew = true; healthItem.IsDirty = false; } else { healthItem = GlobalData.StructuredPlanHealth.Find(healthy => healthy.HealthID == healthID); healthItem.IsNew = false; healthItem.IsDirty = true; } healthItem.Aspect = aspect; healthItem.Action = intention; healthItem.ActionOf = actionOf; healthItem.Importance = importance; healthItem.Type = reaction; healthItem.Save(); if (healthID == -1) { GlobalData.StructuredPlanHealth.Add(healthItem); } UpdateAdapter(); } catch (Exception e) { Log.Error(TAG, "OnActivityResult: Exception - " + e.Message); if (GlobalData.ShowErrorDialog) { ErrorDisplay.ShowErrorAlert(this, e, GetString(Resource.String.ErrorStructuredPlanHealthConfirm), "StructuredPlanHealth.OnActivityResult"); } } } if (resultCode == Result.Canceled) { Toast.MakeText(this, Resource.String.StructuredplanNoChangesToast, ToastLength.Short).Show(); } }
protected override void OnActivityResult(int requestCode, [GeneratedEnum] Result resultCode, Intent data) { int reactionsID = -1; string to = ""; int strength = -1; ConstantsAndTypes.REACTION_TYPE reaction = ConstantsAndTypes.REACTION_TYPE.Positive; ConstantsAndTypes.ACTION_TYPE intention = ConstantsAndTypes.ACTION_TYPE.Maintain; string actionOf = ""; base.OnActivityResult(requestCode, resultCode, data); if (resultCode == Result.Ok) { try { if (data.HasExtra("reactionsID")) { reactionsID = data.GetIntExtra("reactionsID", -1); } if (data.HasExtra("to")) { to = data.GetStringExtra("to"); } if (data.HasExtra("strength")) { strength = data.GetIntExtra("strength", -1); } if (data.HasExtra("reaction")) { reaction = (ConstantsAndTypes.REACTION_TYPE)data.GetIntExtra("reaction", -1); } if (data.HasExtra("intention")) { intention = (ConstantsAndTypes.ACTION_TYPE)data.GetIntExtra("intention", -1); } if (data.HasExtra("actionOf")) { actionOf = data.GetStringExtra("actionOf"); } Reactions reactionItem = null; if (reactionsID == -1) { //new item reactionItem = new Reactions(); reactionItem.IsNew = true; reactionItem.IsDirty = false; } else { reactionItem = GlobalData.StructuredPlanReactions.Find(react => react.ReactionsID == reactionsID); reactionItem.IsNew = false; reactionItem.IsDirty = true; } reactionItem.ToWhat = to; reactionItem.Action = intention; reactionItem.ActionOf = actionOf; reactionItem.Strength = strength; reactionItem.Type = reaction; reactionItem.Save(); if (reactionsID == -1) { GlobalData.StructuredPlanReactions.Add(reactionItem); } UpdateAdapter(); } catch (Exception e) { Log.Error(TAG, "ConfirmPlanItemAddition: Exception - " + e.Message); if (GlobalData.ShowErrorDialog) { ErrorDisplay.ShowErrorAlert(this, e, GetString(Resource.String.ErrorStructuredPlanReactionsConfirm), "StructuredPlanReactions.ConfirmPlanItemAddition"); } } } if (resultCode == Result.Canceled) { Toast.MakeText(this, Resource.String.StructuredplanNoChangesToast, ToastLength.Short).Show(); } }
protected override void OnActivityResult(int requestCode, [GeneratedEnum] Result resultCode, Intent data) { int fantasiesID = -1; string ofWhat = ""; int strength = -1; ConstantsAndTypes.REACTION_TYPE reaction = ConstantsAndTypes.REACTION_TYPE.Ambivalent; ConstantsAndTypes.ACTION_TYPE intention = ConstantsAndTypes.ACTION_TYPE.Maintain; string actionOf = ""; base.OnActivityResult(requestCode, resultCode, data); if (resultCode == Result.Ok) { try { if (data.HasExtra("fantasiesID")) { fantasiesID = data.GetIntExtra("fantasiesID", -1); } if (data.HasExtra("ofWhat")) { ofWhat = data.GetStringExtra("ofWhat"); } if (data.HasExtra("strength")) { strength = data.GetIntExtra("strength", -1); } if (data.HasExtra("reaction")) { reaction = (ConstantsAndTypes.REACTION_TYPE)data.GetIntExtra("reaction", -1); } if (data.HasExtra("intention")) { intention = (ConstantsAndTypes.ACTION_TYPE)data.GetIntExtra("intention", -1); } if (data.HasExtra("actionOf")) { actionOf = data.GetStringExtra("actionOf"); } Fantasies fantasiesItem = null; if (fantasiesID == -1) { //new item fantasiesItem = new Fantasies(); fantasiesItem.IsNew = true; fantasiesItem.IsDirty = false; } else { fantasiesItem = GlobalData.StructuredPlanFantasies.Find(fantasiesy => fantasiesy.FantasiesID == fantasiesID); fantasiesItem.IsNew = false; fantasiesItem.IsDirty = true; } fantasiesItem.OfWhat = ofWhat; fantasiesItem.Action = intention; fantasiesItem.ActionOf = actionOf; fantasiesItem.Strength = strength; fantasiesItem.Type = reaction; fantasiesItem.Save(); if (fantasiesID == -1) { GlobalData.StructuredPlanFantasies.Add(fantasiesItem); } UpdateAdapter(); } catch (Exception e) { Log.Error(TAG, "OnActivityResult: Exception - " + e.Message); if (GlobalData.ShowErrorDialog) { ErrorDisplay.ShowErrorAlert(this, e, GetString(Resource.String.ErrorStructuredPlanFantasiesConfirm), "StructuredPlanFantasies.OnActivityResult"); } } } if (resultCode == Result.Canceled) { Toast.MakeText(this, Resource.String.StructuredplanNoChangesToast, ToastLength.Short).Show(); } }