Example #1
0
        private void PlanList_MouseClick(object sender, MouseEventArgs e)
        {
            if (e.Button != MouseButtons.Right)
            {
                return;
            }

            PlanListItem clicked = PlanList.GetItemAt(e.Location) as PlanListItem;

            if (clicked == null)
            {
                return;
            }

            ContextMenuStripEx menu = new ContextMenuStripEx();

            if (Selected.Person == Core.UserID)
            {
                menu.Items.Add(new PlanMenuItem("Edit", clicked.Item, null, Plan_Edit));
                menu.Items.Add("-");
                menu.Items.Add(new PlanMenuItem("Delete", clicked.Item, PlanRes.delete, Plan_Delete));
            }
            else
            {
                menu.Items.Add(new PlanMenuItem("Details", clicked.Item, PlanRes.details, Plan_View));
            }


            menu.Show(PlanList, e.Location);
        }
Example #2
0
        private void PlanList_MouseDoubleClick(object sender, MouseEventArgs e)
        {
            PlanListItem item = PlanList.GetItemAt(e.Location) as PlanListItem;

            if (item == null)
            {
                return;
            }

            if (Selected == null)
            {
                return;
            }

            bool local = (Selected.Person == Core.UserID);

            EditItemMode mode = local ? EditItemMode.Edit : EditItemMode.View;
            EditPlanItem form = new EditPlanItem(mode, Selected, item.Item);

            if (form.ShowDialog(this) == DialogResult.OK)
            {
                if (local)
                {
                    View.ChangesMade();
                }
            }
        }