コード例 #1
0
        private void ActivitiesWeek_ItemLongClick(object sender, AdapterView.ItemLongClickEventArgs e)
        {
            try
            {
                long packedPosition = _activitiesWeek.GetExpandableListPosition(e.Position);

                if (ExpandableListView.GetPackedPositionType(packedPosition) == PackedPositionType.Child)
                {
                    // get item ID's
                    int groupPosition = ExpandableListView.GetPackedPositionGroup(packedPosition);
                    int childPosition = ExpandableListView.GetPackedPositionChild(packedPosition);

                    Activities   activity     = GlobalData.ActivitiesForWeek[groupPosition];
                    ActivityTime activityTime = activity.ActivityTimes[childPosition];

                    string startTime, endTime;

                    StringHelper.ActivityTimeBeginEndForConstant(activityTime.ActivityTime, out startTime, out endTime);

                    _timeFragment = new ActivityTimeDialogFragment(this, activity.ActivityDate, activityTime.ActivityTime, startTime, endTime, groupPosition, childPosition, "Add Activity");

                    var fragmentTransaction = FragmentManager.BeginTransaction();
                    _timeFragment.Show(fragmentTransaction, _timeFragment.Tag);

                    Log.Info(TAG, "ActivitiesWeek_ItemLongClick: groupPosition - " + groupPosition.ToString() + ", childPosition - " + childPosition.ToString());

                    e.Handled = true;
                }
            }
            catch (Exception ex)
            {
                Log.Error(TAG, "ActivitiesWeek_ItemLongClick: Exception - " + ex.Message);
                if (GlobalData.ShowErrorDialog)
                {
                    ErrorDisplay.ShowErrorAlert(this, ex, GetString(Resource.String.ErrorActivitySelectChildItem), "ActivitiesActivity.ActivitiesWeek_ItemLongClick");
                }
            }
        }