예제 #1
0
        private void AddRecurringPayment_button_Click(object sender, EventArgs e)
        {
            Log.Debug(TAG, nameof(AddRecurringPayment_button_Click));

            FragmentTransaction ft   = FragmentManager.BeginTransaction();
            Fragment            prev = FragmentManager.FindFragmentByTag("dialog");

            if (prev != null)
            {
                ft.Remove(prev);
            }
            ft.AddToBackStack(null);

            Log.Debug(TAG, $"{nameof(AddRecurringPayment_button_Click)} - try to show RecurringPaymentFragment like dialog - START");
            // Create and show the dialog.
            DialogFragment newFragment = RecurringPaymentFragment.NewInstance(null, delegate()
            {
                var r = LoadData();
            });

            Log.Debug(TAG, $"{nameof(AddRecurringPayment_button_Click)} - 1");

            newFragment.Show(ft, "dialog");
            Log.Debug(TAG, $"{nameof(AddRecurringPayment_button_Click)} - try to show ReportFragment like dialog - END");
        }
예제 #2
0
        public static RecurringPaymentFragment NewInstance(RecurringPayment selectedItem, Action onContinueWith)
        {
            Log.Debug(TAG, $"{nameof(NewInstance)} - {nameof(selectedItem)}:{selectedItem?.ToString() ?? "is null"}");

            var frag = new RecurringPaymentFragment();

            frag.SelectedItem          = selectedItem;
            frag.onContinueWithHandler = onContinueWith;
            return(frag);
        }
예제 #3
0
        private void OnListItemLongClick(object sender, AdapterView.ItemLongClickEventArgs e)
        {
            Log.Debug(TAG, nameof(OnListItemLongClick));

            var item = listData.ElementAt(e.Position);

            Android.App.AlertDialog.Builder builder = new Android.App.AlertDialog.Builder(this.Activity);
            builder.SetMessage(item.ToString())
            .SetPositiveButton(this.Activity.Resources.GetString(Resource.String.Edit), (s, args) =>
            {
                // DialogFragment.show() will take care of adding the fragment
                // in a transaction.  We also want to remove any currently showing
                // dialog, so make our own transaction and take care of that here.
                FragmentTransaction ft = FragmentManager.BeginTransaction();
                Fragment prev          = FragmentManager.FindFragmentByTag("dialog");
                if (prev != null)
                {
                    ft.Remove(prev);
                }
                ft.AddToBackStack(null);

                Log.Debug(TAG, $"{nameof(OnListItemLongClick)} - try to show ReportFragment like dialog - START");
                // Create and show the dialog.
                DialogFragment newFragment = RecurringPaymentFragment.NewInstance(item.IncludeObjects(db), delegate()
                {
                    var r = LoadData();
                });


                newFragment.Show(ft, "dialog");
                Log.Debug(TAG, $"{nameof(OnListItemLongClick)} - try to show ReportFragment like dialog - END");
            })
            .SetNegativeButton(this.Activity.Resources.GetString(Resource.String.Delete), (s, args) =>
            {
                if (db.Delete(item).Result)
                {
                    Toast.MakeText(this.Activity, Resources.GetString(Resource.String.Deleted), ToastLength.Short).Show();

                    var r = LoadData();
                }
                else
                {
                    Toast.MakeText(this.Activity, Resources.GetString(Resource.String.WasntDeleted), ToastLength.Short).Show();
                }
            })
            .Show();
        }