Пример #1
0
        /// <Docs>The context menu item that was selected.</Docs>
        /// <returns>To be added.</returns>
        /// <para tool="javadoc-to-mdoc">This hook is called whenever an item in a context menu is selected. The
        ///  default implementation simply returns false to have the normal processing
        ///  happen (calling the item's Runnable or sending a message to its Handler
        ///  as appropriate). You can use this method for any items for which you
        ///  would like to do processing without those other facilities.</para>
        /// <summary>
        /// Raises the context item selected event.
        /// </summary>
        /// <param name="item">Item.</param>
        public override bool OnContextItemSelected(IMenuItem item)
        {
            var menuInfo = item.MenuInfo as AdapterView.AdapterContextMenuInfo;

            switch (item.ItemId)
            {
            case Resource.Id.action_modify_activity_memo:
            {
                var activityDate = mViewHolder.ListAdapter.GetItem(menuInfo.Position);
                var info         = new ModifyTextDialogFragment.Info {
                    Text           = String.IsNullOrEmpty(activityDate.Memo) ? "---" : activityDate.Memo,
                    TargetPosition = menuInfo.Position,
                    ViewId         = Resource.Layout.DialogAddActivityDate,
                    DialogTitleId  = Resource.String.dialog_title_modify_activity_memo,
                };
                var dialog = ModifyTextDialogFragment.NewInstance(info);
                dialog.Show(this);
            }
                return(true);

            case Resource.Id.action_delete_activity_date:
                DeleteActivityDate(mViewHolder.ListAdapter.GetItem(menuInfo.Position));
                return(true);
            }
            return(base.OnContextItemSelected(item));
        }
Пример #2
0
        /// <Docs>The context menu item that was selected.</Docs>
        /// <returns>To be added.</returns>
        /// <para tool="javadoc-to-mdoc">This hook is called whenever an item in a context menu is selected. The
        ///  default implementation simply returns false to have the normal processing
        ///  happen (calling the item's Runnable or sending a message to its Handler
        ///  as appropriate). You can use this method for any items for which you
        ///  would like to do processing without those other facilities.</para>
        /// <summary>
        /// Raises the context item selected event.
        /// </summary>
        /// <param name="item">Item.</param>
        public override bool OnContextItemSelected(IMenuItem item)
        {
            var menuInfo = item.MenuInfo as AdapterView.AdapterContextMenuInfo;

            switch (item.ItemId)
            {
            case Resource.Id.action_modify_activity:
            {
                var activity = mListAdapter.GetItem(menuInfo.Position);
                var info     = new ModifyTextDialogFragment.Info {
                    Text           = activity.Name,
                    TargetPosition = menuInfo.Position,
                    ViewId         = Resource.Layout.DialogAddActivity,
                    DialogTitleId  = Resource.String.dialog_title_modify_activity,
                };
                var dialog = ModifyTextDialogFragment.NewInstance(info);
                dialog.Show(this);
            }
                return(true);

            case Resource.Id.action_delete_activity:
                DeleteActivity(mListAdapter.GetItem(menuInfo.Position));
                return(true);
            }
            return(base.OnContextItemSelected(item));
        }