public void Init(GoalsView view) { View = view; Core = View.Core; Plans = view.Plans; Trust = Core.Trust; GoalTree.NodeExpanding += new EventHandler(GoalTree_NodeExpanding); GoalTree.NodeCollapsed += new EventHandler(GoalTree_NodeCollapsed); GoalTree.ControlPadding = 3; GoalTree.SmallImageList = new List <Image>(); GoalTree.SmallImageList.Add(new Bitmap(16, 16)); GoalTree.SmallImageList.Add(PlanRes.star); GoalTree.SmallImageList.Add(PlanRes.high_goal); GoalTree.SmallImageList.Add(PlanRes.low_goal); DelegateLink.Hide(); AddItemLink.Hide(); }
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(); }