private void ShowMessageFragment(int actionBarTitle, int title, int message, int positiveButton, int negativeButton, string dynamicValues) { string btnNegative = ""; if (negativeButton > 0) { btnNegative = GetText(negativeButton).ToTitleCase(); } string msg = GetText(message); if (dynamicValues.IsBlank() == false) { object[] vals = JsonConvert.DeserializeObject <object[]>(dynamicValues); msg = msg.GetFormated(vals); } CustomInfoFragment.Info info = new CustomInfoFragment.Info() { ActionBarTitle = GetText(actionBarTitle), Title = GetText(title), Content = msg, PositiveButtonCaption = GetText(positiveButton).ToTitleCase(), NegativeButtonCaption = btnNegative }; CustomInfoFragment customInfoFragment = new CustomInfoFragment(); customInfoFragment.SetArgument(CustomInfoFragment.InfoKey, info); GetFragmentManager() .BeginTransaction() .Replace ( Resource.Id.modalContent , customInfoFragment ) .Commit(); customInfoFragment.PositiveAction += customInfoFragment_PositiveAction; customInfoFragment.NegativeAction += customInfoFragment_NegativeAction; }
protected override void OnCreate(Bundle bundle) { base.OnCreate(bundle); SetContentView(Resource.Layout.layout_resetpin); var trans = GetFragmentManager().BeginTransaction(); // TODO check why this exists alertinfo = new CustomDialogFragment( string.Empty, this.GetString(Resource.String.pin_reset_no_internet), this.GetString(Resource.String.go_back), null, null); string dealerSupportLine = Settings.Instance.DealerSupportLine; CustomInfoFragment.Info info = new CustomInfoFragment.Info { ActionBarTitle = Resources.GetString(Resource.String.pin_reset_fail_title), Title = Resources.GetString(Resource.String.pin_reset_fail_title), Content = string.Format(Resources.GetString(Resource.String.pin_reset_fail_msg), dealerSupportLine), PositiveButtonCaption = Resources.GetString(Resource.String.try_again), NegativeButtonCaption = Resources.GetString(Resource.String.cancel_reset) }; resetPinFailedFragment = new CustomInfoFragment(); resetPinFailedFragment.SetArgument(CustomInfoFragment.InfoKey, info); // set event handlers for failed pin resetPinFailedFragment.PositiveAction += new CustomInfoFragment.BtnClick(go); resetPinFailedFragment.NegativeAction += new CustomInfoFragment.BtnClick(GoBackToLogin); // register fragment trans.Add(Resource.Id.reset_pin_placeholder, resetPinFailedFragment, RESETPINFAILED_FRAGMENT_TAG); trans.AddToBackStack(null); trans.Hide(resetPinFailedFragment); CustomInfoFragment.Info infoSuccess = new CustomInfoFragment.Info() { ActionBarTitle = Resources.GetString(Resource.String.pin_reset_done), Title = Resources.GetString(Resource.String.pin_reset_done), Content = Resources.GetString(Resource.String.pin_reset_success_msg), PositiveButtonCaption = Resources.GetString(Resource.String.back_to_login) }; resetPinResultInfoFragment = new CustomInfoFragment(); resetPinResultInfoFragment.SetArgument(CustomInfoFragment.InfoKey, infoSuccess); resetPinResultInfoFragment.PositiveAction += new CustomInfoFragment.BtnClick(GoBackToLogin); trans.Add(Resource.Id.reset_pin_placeholder, resetPinResultInfoFragment, RESETPINRESULT_FRAGMENT_TAG); trans.AddToBackStack(null); trans.Hide(resetPinResultInfoFragment); fragmentResetPin = new ResetPinFragment(); fragmentResetPin.ButtonNextClicked += fragmentResetPin_ButtonNextClicked; trans.Add(Resource.Id.reset_pin_placeholder, fragmentResetPin, RESETPIN_FRAGMENT_TAG); trans.AddToBackStack(null); trans.Hide(fragmentResetPin); progressFragment = new ProgressFragment(); Bundle arguments = new Bundle(); arguments.PutString(ProgressFragment.TitleKey, GetString(Resource.String.reset_pin_title)); arguments.PutString(ProgressFragment.MessageKey, GetString(Resource.String.resetting_pin)); progressFragment.Arguments = arguments; trans.Add(Resource.Id.reset_pin_placeholder, progressFragment, RESETPINPROGRESS_FRAGMENT_TAG); trans.AddToBackStack(null); trans.Commit(); go(); // TODO check why we are adding all the fragments to start with and not only when needed }