private void GenericList_ItemLongClick(object sender, AdapterView.ItemLongClickEventArgs e) { try { var adapter = _moodList.Adapter; _selectedItemIndex = e.Position; var moodItem = GlobalData.MoodListItems[_selectedItemIndex]; if (moodItem != null) { if (moodItem.IsDefault == "true") { Toast.MakeText(this, Resource.String.MoodsAdjustDefaultEntryToast, ToastLength.Short).Show(); return; } MoodsAdjustDialogFragment genFragment = new MoodsAdjustDialogFragment(this, "Edit item", GetString(Resource.String.MoodsAdjustGenericTextDialogTitle), moodItem.MoodName, _selectedItemIndex); FragmentTransaction transaction = FragmentManager.BeginTransaction(); genFragment.Show(transaction, genFragment.Tag); } } catch (Exception ex) { Log.Error(TAG, "GenericList_ItemLongClick: Exception - " + ex.Message); if (GlobalData.ShowErrorDialog) { ErrorDisplay.ShowErrorAlert(this, ex, GetString(Resource.String.ErrorMoodsAdjustEditEntry), "MoodsAdjustActivity.GenericList_ItemLongClick"); } } }
private void Add() { try { MoodsAdjustDialogFragment moodsAdjustFragment = new MoodsAdjustDialogFragment(this, GetString(Resource.String.MoodsAdjustDialogTitleAdd), GetString(Resource.String.MoodsAdjustGenericTextDialogTitle), "", -1); Log.Info(TAG, "Add_Click: New Mood, passing ID -1 to dialog fragment"); var fragmentTransaction = FragmentManager.BeginTransaction(); if (fragmentTransaction != null) { Log.Info(TAG, "Add_Click: Showing dialog Fragment"); moodsAdjustFragment.Show(fragmentTransaction, moodsAdjustFragment.Tag); } } catch (Exception ex) { Log.Error(TAG, "Add: Exception - " + ex.Message); if (GlobalData.ShowErrorDialog) { ErrorDisplay.ShowErrorAlert(this, ex, GetString(Resource.String.ErrorMoodsAdjustActivityAdd), "MoodsAdjustActivity.Add"); } } }