Esempio n. 1
0
        private void GoalTree_MouseClick(object sender, MouseEventArgs e)
        {
            if (e.Button != MouseButtons.Right)
            {
                return;
            }

            GoalNode node = GoalTree.GetNodeAt(e.Location) as GoalNode;

            if (node == null)
            {
                return;
            }


            ContextMenuStripEx menu = new ContextMenuStripEx();


            bool owned = IsOwned(node);

            bool     root   = false;
            GoalNode parent = node.ParentNode() as GoalNode;

            if (parent == null && node.Goal.Person == Core.UserID && Head.Person == Core.UserID)
            {
                root = true;
            }

            if (owned)
            {
                menu.Items.Add(new GoalMenuItem("Edit", node.Goal, null, Goal_Edit));
                menu.Items.Add(new GoalMenuItem("View Schedule", node.Goal, PlanRes.Schedule.ToBitmap(), Goal_Schedule));
                menu.Items.Add("-");
            }

            if (root)
            {
                menu.Items.Add(new GoalMenuItem("Archive", node.Goal, PlanRes.archive, Goal_Archive));
            }

            if (owned)
            {
                menu.Items.Add(new GoalMenuItem("Delete", node.Goal, PlanRes.delete, Goal_Delete));
            }

            if (!owned)
            {
                menu.Items.Add(new GoalMenuItem("Details", node.Goal, PlanRes.details, Goal_View));
            }


            menu.Show(GoalTree, e.Location);
        }
Esempio n. 2
0
        private void GoalTree_MouseDoubleClick(object sender, MouseEventArgs e)
        {
            GoalNode node = GoalTree.GetNodeAt(e.Location) as GoalNode;

            if (node == null)
            {
                return;
            }

            bool         owned    = IsOwned(node);
            EditGoalMode editMode = owned ? EditGoalMode.Edit : EditGoalMode.View;

            EditGoal form = new EditGoal(editMode, View, node.Goal);

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