public override void Init() { if (UserID != Core.UserID) { NewButton.Visible = false; } PlanStructure.Columns[1].WidthResized += new EventHandler(PlanStructure_Resized); ScheduleSlider.Init(this); DateRange.Value = 40; UpdateRange(); GotoTime(Core.TimeNow); // guilty of a hack, this sets the last column to the correct length, // firing the event to set the slider to the same size as the column PlanStructure.GenerateColumnRects(); PlanStructure.Invalidate(); // load links RefreshUplinks(); RefreshStructure(); // events Trust.GuiUpdate += new LinkGuiUpdateHandler(Trust_Update); Plans.PlanUpdate += new PlanUpdateHandler(Plans_Update); }
public void RefreshRows() { TreeListNode node = (TreeListNode)PlanStructure.virtualParent.FirstChild(); bool done = false; while (node != null && !done) { ((PlanNode)node).UpdateBlock(); done = PlanStructure.GetNextNode(ref node); } SetDetails(LastBlock); }
void Plans_Update(OpPlan plan) { // if node not tracked if (!NodeMap.ContainsKey(plan.UserID)) { return; } // update this node, and all subs (visible below) TreeListNode node = (TreeListNode)NodeMap[plan.UserID]; bool done = false; while (node != null && !done) { ((PlanNode)node).UpdateBlock(); done = PlanStructure.GetNextNode(ref node); } RefreshGoalCombo(); }
private void RefreshStructure() { PlanStructure.BeginUpdate(); // save selected PlanNode selected = GetSelected(); // save visible while unloading List <ulong> visible = new List <ulong>(); foreach (TreeListNode node in PlanStructure.Nodes) { if (node.GetType() == typeof(PlanNode)) { UnloadNode((PlanNode)node, visible); } } NodeMap.Clear(); PlanStructure.Nodes.Clear(); // nodes ThreadedList <OpLink> roots = null; if (Trust.ProjectRoots.SafeTryGetValue(ProjectID, out roots)) { roots.LockReading(delegate() { foreach (OpLink root in roots) { if (Uplinks.Contains(root.UserID)) { PlanNode node = CreateNode(root); Plans.Research(root.UserID); LoadNode(node); GuiUtils.InsertSubNode(PlanStructure.virtualParent, node); ExpandPath(node, Uplinks); } if (root.IsLoopRoot && root.Downlinks.Count > 0 && Uplinks.Contains(root.Downlinks[0].UserID)) { foreach (OpLink downlink in root.Downlinks) { if (!root.IsLoopedTo(downlink)) { PlanNode node = CreateNode(downlink); Plans.Research(downlink.UserID); LoadNode(node); GuiUtils.InsertSubNode(PlanStructure.virtualParent, node); ExpandPath(node, Uplinks); } } } } }); } // restore visible foreach (ulong id in visible) { foreach (TreeListNode node in PlanStructure.Nodes) { if (node.GetType() == typeof(PlanNode)) { List <ulong> uplinks = Trust.GetUnconfirmedUplinkIDs(id, ProjectID); uplinks.Add(id); VisiblePath((PlanNode)node, uplinks); } } } // restore selected if (selected != null) { if (NodeMap.ContainsKey(selected.Link.UserID)) { PlanStructure.Select(NodeMap[selected.Link.UserID]); } } PlanStructure.EndUpdate(); }