Example #1
0
 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);
 }
Example #2
0
 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);
     }
 }
Example #3
0
 public CommandResult ProcessCommand(UpdateScopeNodeCommand command)
 {
     ScopeTreeNode scopeTreeNode = this.nodeTable[command.NodeData.Id];
     ScopeTreeNode.UpdateScopeTreeNode(command.NodeData, scopeTreeNode);
     return null;
 }