// -------------------------------------------------------------------------------------------- /// <summary> /// Removes a node from the hierarchy. /// </summary> /// <param name="node">The node to remove.</param> // -------------------------------------------------------------------------------------------- public virtual void RemoveChild(HierarchyNode node) { if (node == null) { throw new ArgumentNullException("node"); } ManagerNode.RemoveNode(node); HierarchyNode last = null; foreach (var n in Children) { if (n == node) { if (last != null) { last._NextSibling = n._NextSibling; } if (n == _LastChild) { _LastChild = last == _LastChild ? null : last; } if (n == _FirstChild) { _FirstChild = n._NextSibling; } return; } last = n; } throw new InvalidOperationException("Node not found"); }
static void Main(string[] args) { ISQLiteServices sqliteServices = new SQLiteServices(); // Uses the location of the currently running assembly as the base path, // to resolve the appsettings.json location. var builder = new ConfigurationBuilder() .SetBasePath(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location)) .AddJsonFile("appsettings.json"); IConfigurationRoot configuration = builder.Build(); // Get the log file path from the appsettings.json string logFile = configuration.GetValue <string>("logFilePath"); var pexipParamaters = configuration.GetSection("pexipManager"); int historyHours = configuration.GetValue <int>("historyHours") * -1; IManagerNode managerNode = new ManagerNode( pexipParamaters.GetValue <string>("username"), pexipParamaters.GetValue <string>("password"), pexipParamaters.GetValue <string>("address")); PexipOps pexipOps = new PexipOps(managerNode, sqliteServices); pexipOps.GetConferenceHistory(historyHours); pexipOps.GetParticipantHistory(historyHours); }
public void DialogueManager(Event e) { if (ManagerNode == null) { ManagerNode = new ManagerNode(Settings); } GeneralMenu(e); DrawUI(e); ManagerMouseClick(e); }
public TwoNodeClusterTests() { TestUtils.ResetDirectory("c:\\brightstar\\coreA"); TestUtils.ResetDirectory("c:\\brightstar\\coreB"); Thread.Sleep(2000); _coreA = new NodeCore("c:\\brightstar\\coreA"); _coreB = new NodeCore("c:\\brightstar\\coreB"); _testConfiguration = new ClusterConfiguration { ClusterNodes = new List <NodeConfiguration> { new NodeConfiguration("127.0.0.1", 10001, 8090, 8095), new NodeConfiguration("127.0.0.1", 10002, 8091, 8096) }, MasterConfiguration = new MasterConfiguration { WriteQuorum = 1 } }; _clusterManager = new ManagerNode(_testConfiguration); }
// -------------------------------------------------------------------------------------------- /// <summary> /// This method is executed when a new item is added to the hierarchy node. /// </summary> /// <param name="parent">Parent of the node.</param> /// <param name="child">Child node added.</param> // -------------------------------------------------------------------------------------------- protected void OnItemAdded(HierarchyNode parent, HierarchyNode child) { if (null != parent._OnChildAdded) { var args = new HierarchyNodeEventArgs(child); parent._OnChildAdded(parent, args); } if (parent == null) { throw new ArgumentNullException("parent"); } if (child == null) { throw new ArgumentNullException("child"); } // --- Check if the manager node wants to trigger this event var prev = child.PreviousSibling; uint prevId = (prev != null) ? (uint)prev.HierarchyId : VSConstants.VSITEMID_NIL; ManagerNode.RaiseHierarchyEvent( sink => sink.OnItemAdded((uint)parent.HierarchyId, prevId, (uint)child.HierarchyId)); }
// -------------------------------------------------------------------------------------------- /// <summary> /// Add a child node to this node, sorted in the right location. /// </summary> /// <param name="node">The child node to add to this node.</param> // -------------------------------------------------------------------------------------------- public virtual void AddChild(HierarchyNode node) { if (node == null) { throw new ArgumentNullException("node"); } // --- Make sure the node is in the map. var nodeWithSameID = ManagerNode[node.HierarchyId]; if (!ReferenceEquals(node, nodeWithSameID)) { if (nodeWithSameID == null && (int)node.HierarchyId <= ManagerNode.ItemCount) { ManagerNode.SetNodeAtId(node.HierarchyId, this); } else { throw new InvalidOperationException(); } } HierarchyNode previous = null; if (SortPriority >= 0) { foreach (var n in Children) { if (ManagerNode.CompareNodes(node, n) > 0) { break; } previous = n; } } else { previous = _LastChild; } // --- Insert "node" after "previous". if (previous != null) { node._NextSibling = previous._NextSibling; previous._NextSibling = node; if (previous == _LastChild) { _LastChild = node; } } else { if (_LastChild == null) { _LastChild = node; } node._NextSibling = _FirstChild; _FirstChild = node; } node._ParentNode = this; OnItemAdded(this, node); }
public void InvalidateItem() { ManagerNode.RaiseHierarchyEvent(sink => sink.OnInvalidateItems((uint)HierarchyId)); }