Ejemplo n.º 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);
        }
Ejemplo n.º 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();
                }
            }
        }
Ejemplo n.º 3
0
        private void PlanList_SelectedIndexChanged(object sender, EventArgs e)
        {
            PlanListItem selected = null;

            if (PlanList.SelectedItems.Count > 0)
            {
                selected = PlanList.SelectedItems[0] as PlanListItem;
            }

            if (selected == null)
            {
                return;
            }


            View.SetDetails(null, selected.Item);
        }
Ejemplo n.º 4
0
 private void FormatTime(PlanListItem row)
 {
     /*row.SubItems[0].Text =
      *  GetTimeText(row.Item.Start.ToLocalTime() - Core.TimeNow, row.Item.Start.ToLocalTime(), true) + " to " +
      *  GetTimeText(row.Item.End.ToLocalTime() - Core.TimeNow, row.Item.End.ToLocalTime(), false);*/
 }
Ejemplo n.º 5
0
        private void UpdatePlanItems(GoalNode node)
        {
            PlanListItem ReselectPlanItem = null;

            if (PlanList.SelectedItems.Count > 0)
            {
                ReselectPlanItem = PlanList.SelectedItems[0] as PlanListItem;
            }

            PlanList.Items.Clear();


            if (node == null)
            {
                Selected = null;
                DelegateLink.Hide();
                PlanList.Columns[0].Text = "Plan";
                //splitContainer2.Panel1Collapsed = true;
                return;
            }

            Selected = node.Goal;


            // set delegate task vis
            if (Selected.Person == Core.UserID && Trust.HasSubs(Selected.Person, View.ProjectID))
            {
                DelegateLink.Show();
            }
            else
            {
                DelegateLink.Hide();
            }

            if (Selected.Person == Core.UserID)
            {
                AddItemLink.Show();
            }
            else
            {
                AddItemLink.Hide();
            }

            // name's Plan for <goal>

            PlanList.Columns[0].Text = Core.GetName(node.Goal.Person) + "'s Plan for " + node.Goal.Title;

            // set plan items
            OpPlan plan = Plans.GetPlan(Selected.Person, true);

            if (plan == null) // re-searched at during selection
            {
                return;
            }


            if (plan.ItemMap.ContainsKey(Head.Ident))
            {
                foreach (PlanItem item in plan.ItemMap[Head.Ident])
                {
                    if (item.BranchUp == Selected.BranchDown)
                    {
                        PlanListItem row = new PlanListItem(item);

                        if (ReselectPlanItem != null && item == ReselectPlanItem.Item)
                        {
                            row.Selected = true;
                        }

                        PlanList.Items.Add(row);
                        FormatTime(row);
                    }
                }
            }

            PlanList.Invalidate();
        }
Ejemplo n.º 6
0
        private void UpdatePlanItems(GoalNode node)
        {
            PlanListItem ReselectPlanItem = null;
            if (PlanList.SelectedItems.Count > 0)
                ReselectPlanItem = PlanList.SelectedItems[0] as PlanListItem;

            PlanList.Items.Clear();

            if (node == null)
            {
                Selected = null;
                DelegateLink.Hide();
                PlanList.Columns[0].Text = "Plan";
                //splitContainer2.Panel1Collapsed = true;
                return;
            }

            Selected = node.Goal;

            // set delegate task vis
            if (Selected.Person == Core.UserID && Trust.HasSubs(Selected.Person, View.ProjectID ))
                DelegateLink.Show();
            else
                DelegateLink.Hide();

            if (Selected.Person == Core.UserID)
                AddItemLink.Show();
            else
                AddItemLink.Hide();

            // name's Plan for <goal>

            PlanList.Columns[0].Text = Core.GetName(node.Goal.Person) + "'s Plan for " + node.Goal.Title;

            // set plan items
            OpPlan plan = Plans.GetPlan(Selected.Person, true);

            if (plan == null) // re-searched at during selection
                return;

            if (plan.ItemMap.ContainsKey(Head.Ident))
                foreach (PlanItem item in plan.ItemMap[Head.Ident])
                    if (item.BranchUp == Selected.BranchDown)
                    {
                        PlanListItem row = new PlanListItem(item);

                        if (ReselectPlanItem != null && item == ReselectPlanItem.Item)
                            row.Selected = true;

                        PlanList.Items.Add(row);
                        FormatTime(row);
                    }

            PlanList.Invalidate();
        }
Ejemplo n.º 7
0
 private void FormatTime(PlanListItem row)
 {
     /*row.SubItems[0].Text =
         GetTimeText(row.Item.Start.ToLocalTime() - Core.TimeNow, row.Item.Start.ToLocalTime(), true) + " to " +
         GetTimeText(row.Item.End.ToLocalTime() - Core.TimeNow, row.Item.End.ToLocalTime(), false);*/
 }