public Write ( |
||
data | ||
Результат | void |
internal void OnNodeSharedDataChanged(object sender, WritableSharedDataChangedEventArgs e) { if (!this._initialized) { throw new Exception(Microsoft.ManagementConsole.Internal.Utility.LoadResourceString(Microsoft.ManagementConsole.Internal.Strings.NodeSyncManagerNotInitialized)); } ScopeNode node = sender as ScopeNode; if (node == null) { throw new ArgumentException(Microsoft.ManagementConsole.Internal.Utility.LoadResourceString(Microsoft.ManagementConsole.Internal.Strings.NodeSyncManagerOnNodeSharedDataChangedScopeNodeExpected), "sender"); } WritableSharedDataItem sharedDataItem = e.SharedDataItem; if (sharedDataItem == null) { throw new Exception(Microsoft.ManagementConsole.Internal.Utility.LoadResourceString(Microsoft.ManagementConsole.Internal.Strings.NodeSyncManagerOnNodeSharedDataChangedWritableSharedDataItemExpected)); } bool flag = false; UpdateScopeNodeCommand command = new UpdateScopeNodeCommand(); command.NodeData = (ScopeNodeData) node.Data; ActionsPaneRootData data = new ActionsPaneRootData(); data.Write(node.ActionsPaneItems.Data); command.Actions = data; data = new ActionsPaneRootData(); data.Write(node.ActionsPaneHelpItems.Data); command.HelpActions = data; switch (e.ChangeType) { case WritableSharedDataChangeType.Add: case WritableSharedDataChangeType.Modify: { DataFormatConfiguration configuration = new DataFormatConfiguration(); configuration.ClipboardFormatId = sharedDataItem.ClipboardFormatId; configuration.RequiresQuery = sharedDataItem.RequiresCallback; SharedDataObjectUpdate update = new SharedDataObjectUpdate(); if (!sharedDataItem.RequiresCallback) { ClipboardData data2 = new ClipboardData(); data2.ClipboardFormatId = sharedDataItem.ClipboardFormatId; data2.SetValue(sharedDataItem.GetData()); ClipboardData[] updatedData = new ClipboardData[] { data2 }; update.SetUpdatedData(updatedData); } command.UpdatedSharedData = update; if (e.ChangeType == WritableSharedDataChangeType.Add) { DataFormatConfiguration[] addedFormats = new DataFormatConfiguration[] { configuration }; command.UpdatedSharedData.SetAddedFormats(addedFormats); } else { DataFormatConfiguration[] changedFormats = new DataFormatConfiguration[] { configuration }; command.UpdatedSharedData.SetChangedFormats(changedFormats); } flag = true; break; } case WritableSharedDataChangeType.Remove: command.UpdatedSharedData.SetRemovedClipboardFormatIds(new string[] { sharedDataItem.ClipboardFormatId }); flag = true; break; } if (flag) { this._snapInPlatform.ProcessCommand(command); } }
private void AddTreeToInsertionList(InsertScopeNodesCommandWriter writer, ScopeNode[] nodeList, ref int currentNodesIndex, int index, ScopeNode[] nodes) { foreach (ScopeNode node in nodes) { if (this._nodes.ContainsKey(node.Id)) { throw new Exception(Microsoft.ManagementConsole.Internal.Utility.LoadResourceString(Microsoft.ManagementConsole.Internal.Strings.NodeSyncManagerAddTreeToInsertionListNodeExistInOneLocation)); } if (node == null) { throw new Exception(Microsoft.ManagementConsole.Internal.Utility.LoadResourceString(Microsoft.ManagementConsole.Internal.Strings.NodeSyncManagerInvalidNodeType)); } ScopeNodeInsert insert = new ScopeNodeInsert(); insert.NodeData = (ScopeNodeData) node.Data; ActionsPaneRootData data = new ActionsPaneRootData(); data.Write(node.ActionsPaneItems.Data); insert.Actions = data; data = new ActionsPaneRootData(); data.Write(node.ActionsPaneHelpItems.Data); insert.HelpActions = data; insert.InitialSharedData.SetAddedFormats(this.GenerateSharedDataFormatConfiguration(node)); insert.InitialSharedData.SetUpdatedData(this.GenerateClipboardData(node)); if (node.Parent != null) { insert.ParentScopeNodeId = node.Parent.Id; } insert.InsertionIndex = index; writer.WriteScopeNodeInsert(insert); nodeList[currentNodesIndex++] = node; index++; if (node.Children.Count > 0) { this.AddTreeToInsertionList(writer, nodeList, ref currentNodesIndex, 0, node.Children.ToArray()); } } }
internal void OnNodeChanged(object sender, NodeChangedEventArgs e) { if (!this._initialized) { throw new Exception(Microsoft.ManagementConsole.Internal.Utility.LoadResourceString(Microsoft.ManagementConsole.Internal.Strings.NodeSyncManagerNotInitialized)); } if (!(e.Source is ScopeNode)) { throw new Exception(Microsoft.ManagementConsole.Internal.Utility.LoadResourceString(Microsoft.ManagementConsole.Internal.Strings.NodeSyncManagerInvalidNodeType)); } UpdateScopeNodeCommand command = new UpdateScopeNodeCommand(); command.NodeData = (ScopeNodeData) e.Source.Data; ActionsPaneRootData data = new ActionsPaneRootData(); data.Write(((ScopeNode) e.Source).ActionsPaneItems.Data); command.Actions = data; data = new ActionsPaneRootData(); data.Write(((ScopeNode) e.Source).ActionsPaneHelpItems.Data); command.HelpActions = data; this._snapInPlatform.ProcessCommand(command); }