private void PubSubClient_NodePurged(object Sender, NodeNotificationEventArgs e) { if (this.TryGetChild(e.NodeName, out TreeNode N) && N is PubSubNode Node) { Node.Purged(e); } }
internal void Purged(NodeNotificationEventArgs _) { if (this.children is null) { return; } TreeNode[] ToRemove; lock (this.children) { ToRemove = new TreeNode[this.children.Count]; this.children.Values.CopyTo(ToRemove, 0); this.children = null; } MainWindow.UpdateGui(() => { foreach (TreeNode Node in ToRemove) { Service?.Account?.View?.NodeRemoved(this, Node); } this.OnUpdated(); }); }
internal void Purged(NodeNotificationEventArgs e) { if (this.children is null) { return; } TreeNode[] ToRemove; lock (this.children) { ToRemove = new TreeNode[this.children.Count]; this.children.Values.CopyTo(ToRemove, 0); this.children = null; } MainWindow.currentInstance.Dispatcher.BeginInvoke(new ThreadStart(() => { foreach (TreeNode Node in ToRemove) { Service?.Account?.View?.NodeRemoved(this, Node); } this.OnUpdated(); })); }
private Task PubSubClient_NodePurged(object Sender, NodeNotificationEventArgs e) { if (this.TryGetChild(e.NodeName, out TreeNode N) && N is PubSubNode Node) { Node.Purged(e); } return(Task.CompletedTask); }