SetUpdatedData() public méthode

public SetUpdatedData ( ClipboardData updatedData ) : void
updatedData ClipboardData
Résultat void
Exemple #1
0
 private SharedDataObjectUpdate CreateSharedDataObjectUpdate(WritableSharedDataItem[] addedItems, WritableSharedDataItem[] modifiedItems, WritableSharedDataItem[] removedItems)
 {
     SharedDataObjectUpdate update = new SharedDataObjectUpdate();
     ArrayList dataUpdate = new ArrayList();
     ArrayList formats = new ArrayList();
     ArrayList list3 = new ArrayList();
     this.ParseSharedDataItems(addedItems, formats, dataUpdate);
     update.SetAddedFormats((DataFormatConfiguration[]) formats.ToArray(typeof(DataFormatConfiguration)));
     this.ParseSharedDataItems(modifiedItems, list3, dataUpdate);
     update.SetChangedFormats((DataFormatConfiguration[]) list3.ToArray(typeof(DataFormatConfiguration)));
     update.SetUpdatedData((ClipboardData[]) dataUpdate.ToArray(typeof(ClipboardData)));
     ArrayList list4 = new ArrayList();
     foreach (WritableSharedDataItem item in removedItems)
     {
         list4.Add(item.ClipboardFormatId);
     }
     update.SetRemovedClipboardFormatIds((string[]) list4.ToArray(typeof(string)));
     return update;
 }
Exemple #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);
     }
 }
 private void ReadNextInitialSharedData(SharedDataObjectUpdate obj)
 {
     int num = this._source.Get_InitialSharedData_AddedFormats_Count()[this._currentIndex];
     DataFormatConfiguration[] addedFormats = null;
     if (num >= 0)
     {
         addedFormats = new DataFormatConfiguration[num];
     }
     int index = 0;
     for (index = 0; index < num; index++)
     {
         addedFormats[index] = this.ReadNextAddedFormats();
         this._InitialSharedData_AddedFormats_Offset++;
     }
     obj.SetAddedFormats(addedFormats);
     int num3 = this._source.Get_InitialSharedData_ChangedFormats_Count()[this._currentIndex];
     DataFormatConfiguration[] changedFormats = null;
     if (num3 >= 0)
     {
         changedFormats = new DataFormatConfiguration[num3];
     }
     int num4 = 0;
     for (num4 = 0; num4 < num3; num4++)
     {
         changedFormats[num4] = this.ReadNextChangedFormats();
         this._InitialSharedData_ChangedFormats_Offset++;
     }
     obj.SetChangedFormats(changedFormats);
     int num5 = this._source.Get_InitialSharedData_UpdatedData_Count()[this._currentIndex];
     ClipboardData[] updatedData = null;
     if (num5 >= 0)
     {
         updatedData = new ClipboardData[num5];
     }
     int num6 = 0;
     for (num6 = 0; num6 < num5; num6++)
     {
         updatedData[num6] = this.ReadNextUpdatedData();
         this._InitialSharedData_UpdatedData_Offset++;
     }
     obj.SetUpdatedData(updatedData);
     int num7 = this._source.Get_InitialSharedData_RemovedClipboardFormatIds_Count()[this._currentIndex];
     string[] removedClipboardFormatIds = null;
     if (num7 >= 0)
     {
         removedClipboardFormatIds = new string[num7];
     }
     int num8 = 0;
     for (num8 = 0; num8 < num7; num8++)
     {
         removedClipboardFormatIds[num8] = this._strings.ReadString();
         this._InitialSharedData_RemovedClipboardFormatIds_Offset++;
     }
     obj.SetRemovedClipboardFormatIds(removedClipboardFormatIds);
 }