示例#1
0
文件: GoalPanel.cs 项目: nandub/DeOps
        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);
        }
示例#2
0
文件: GoalPanel.cs 项目: nandub/DeOps
        private bool IsOwned(GoalNode node)
        {
            GoalNode parent = node.ParentNode() as GoalNode;

            if (parent != null && parent.Goal.Person == Core.UserID)
            {
                return(true);
            }

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

            return(false);
        }
示例#3
0
        private bool IsOwned(GoalNode node)
        {
            GoalNode parent = node.ParentNode() as GoalNode;

            if (parent != null && parent.Goal.Person == Core.UserID)
                return true;

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

            return false;
        }