internal void RemoveNodes(ScopeNode[] items)
{
if (!this._initialized)
{
throw new Exception(Microsoft.ManagementConsole.Internal.Utility.LoadResourceString(Microsoft.ManagementConsole.Internal.Strings.NodeSyncManagerNotInitialized));
}
if (items.Length != 0)
{
List<ScopeNode> nodeList = new List<ScopeNode>();
try
{
int[] ids = new int[items.Length];
for (int i = 0; i < items.Length; i++)
{
ids[i] = items[i].Id;
}
this.AddTreeToDeletionList(nodeList, items);
DeleteScopeNodesCommand command = new DeleteScopeNodesCommand();
command.SetIds(ids);
this._snapInPlatform.ProcessCommand(command);
}
catch
{
TraceSources.ExecutiveSource.TraceEvent(TraceEventType.Warning, 12, "NodeSyncManager.RemoveNodes() failed");
throw;
}
foreach (ScopeNode node in nodeList)
{
node.Children.ItemsChanged -= new ScopeNodeCollection.ScopeNodeCollectionEventHandler(this.OnNodesChanged);
node.Changed -= new Node.NodeChangedEventHandler(this.OnNodeChanged);
node.SharedDataChanged -= new ScopeNode.SharedDataChangedEventHandler(this.OnNodeSharedDataChanged);
this._nodes.Remove(node.Id);
node.OnNodeSyncManagerRemove();
}
}
}
}