예제 #1
0
 public void RequestDataUpdate(byte[] value)
 {
     if (this._snapInPlatform == null)
     {
         throw new InvalidOperationException(Microsoft.ManagementConsole.Internal.Utility.LoadResourceString(Microsoft.ManagementConsole.Internal.Strings.AdvancedSharedDataItemNotInitialized));
     }
     ClipboardData data = new ClipboardData();
     data.ClipboardFormatId = base.ClipboardFormatId;
     data.SetValue(value);
     RequestWriteDataCommand command = new RequestWriteDataCommand();
     command.DataObjectId = this._dataObjectId;
     command.RequestedValue = data;
     try
     {
         this._snapInPlatform.ProcessCommand(command);
     }
     catch (Microsoft.ManagementConsole.Internal.PrimarySnapInDataException exception)
     {
         throw new Microsoft.ManagementConsole.Advanced.PrimarySnapInDataException(exception.Message, exception);
     }
 }
예제 #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);
     }
 }
예제 #3
0
 private ClipboardData[] GenerateClipboardData(ScopeNode node)
 {
     WritableSharedDataItem[] items = node.SharedData.GetItems();
     List<ClipboardData> list = new List<ClipboardData>();
     foreach (WritableSharedDataItem item in items)
     {
         if (!item.RequiresCallback)
         {
             ClipboardData data = new ClipboardData();
             data.ClipboardFormatId = item.ClipboardFormatId;
             data.SetValue(item.GetData());
             list.Add(data);
         }
     }
     if (list.Count > 0)
     {
         return list.ToArray();
     }
     return null;
 }
예제 #4
0
 public void SetUpdatedData(ClipboardData[] updatedData)
 {
     this._updatedData = updatedData;
 }
예제 #5
0
 internal void GetSharedData(ReadSharedDataNodeRequestInfo requestInfo, IRequestStatus requestStatus)
 {
     WritableSharedDataItem item = this.SharedData.GetItem(requestInfo.RequestedClipboardFormatId);
     if (item != null)
     {
         SyncStatus status = new SyncStatus(requestStatus);
         byte[] buffer = this.OnGetSharedData(item, status);
         ClipboardData data = new ClipboardData();
         data.ClipboardFormatId = item.ClipboardFormatId;
         data.SetValue(buffer);
         ReadSharedDataResponse response = new ReadSharedDataResponse();
         response.RequestedClipboardData = data;
         requestStatus.ProcessResponse(response);
     }
 }
 private ClipboardData ReadNextUpdatedData()
 {
     ClipboardData data = new ClipboardData();
     data.ClipboardFormatId = this._strings.ReadString();
     int length = this._source.Get_InitialSharedData_UpdatedData_Value_Count()[this._InitialSharedData_UpdatedData_Offset];
     byte[] destinationArray = null;
     if (length >= 0)
     {
         destinationArray = new byte[length];
         Array.Copy(this._source.Get_InitialSharedData_UpdatedData_Value(), this._InitialSharedData_UpdatedData_Value_Offset, destinationArray, 0, length);
         this._InitialSharedData_UpdatedData_Value_Offset += length;
     }
     data.SetValue(destinationArray);
     return data;
 }
 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);
 }
예제 #8
0
파일: View.cs 프로젝트: SiteView/ECC8.13
 internal void RequestSharedDataUpdate(ClipboardData requestedValue, int selectionId, IRequestStatus requestStatus)
 {
     object selectionObject = null;
     WritableSharedData sharedData = null;
     if ((this.SelectionData.SelectionCardinality == SelectionCardinality.None) || (selectionId != this.SelectionData.Id))
     {
         AuxiliarySelectionData data2 = this.ClipboardSelectionDatas[selectionId];
         if (data2 == null)
         {
             data2 = this.SnapIn.SheetManager.ActiveViewPropertySheetSelectionDatas[selectionId];
         }
         if (data2 == null)
         {
             TraceSources.ExecutiveSource.TraceEvent(TraceEventType.Warning, 12, "Request for updating data format {0} in view {1} selection id {2} could not be handled.", new object[] { requestedValue.ClipboardFormatId, this._viewInstanceId, selectionId });
             return;
         }
         sharedData = data2.SharedData;
         selectionObject = data2.SelectionObject;
     }
     else
     {
         sharedData = this.SelectionData.SharedData;
         selectionObject = this.SelectionData.SelectionObject;
     }
     WritableSharedDataItem item = sharedData.GetItem(requestedValue.ClipboardFormatId);
     if (item == null)
     {
         TraceSources.ExecutiveSource.TraceEvent(TraceEventType.Warning, 12, "The requested data format {0} is no longer available on the current selection in view {1}.", new object[] { requestedValue.ClipboardFormatId, this._viewInstanceId });
     }
     else
     {
         this.OnSharedDataChangeRequested(selectionObject, item, requestedValue.GetValue(), new AsyncStatus(requestStatus));
     }
 }
예제 #9
0
파일: View.cs 프로젝트: SiteView/ECC8.13
 private void ParseSharedDataItems(WritableSharedDataItem[] items, ArrayList formats, ArrayList dataUpdate)
 {
     foreach (WritableSharedDataItem item in items)
     {
         DataFormatConfiguration configuration = new DataFormatConfiguration();
         configuration.ClipboardFormatId = item.ClipboardFormatId;
         configuration.RequiresQuery = item.RequiresCallback;
         formats.Add(configuration);
         if (!item.RequiresCallback)
         {
             ClipboardData data = new ClipboardData();
             data.SetValue(item.GetData());
             data.ClipboardFormatId = item.ClipboardFormatId;
             dataUpdate.Add(data);
         }
     }
 }
예제 #10
0
파일: View.cs 프로젝트: SiteView/ECC8.13
 internal void GetSharedData(string clipboardFormatId, int selectionId, IRequestStatus requestStatus)
 {
     WritableSharedData sharedData = null;
     object selectionObject = null;
     if ((this.SelectionData.SelectionCardinality == SelectionCardinality.None) || (selectionId != this.SelectionData.Id))
     {
         AuxiliarySelectionData data2 = this.ClipboardSelectionDatas[selectionId];
         if (data2 == null)
         {
             data2 = this.SnapIn.SheetManager.ActiveViewPropertySheetSelectionDatas[selectionId];
         }
         if (data2 == null)
         {
             TraceSources.ExecutiveSource.TraceEvent(TraceEventType.Warning, 12, "Request for getting data format {0} in view {1} selection id {2} could not be handled.", new object[] { clipboardFormatId, this._viewInstanceId, selectionId });
             return;
         }
         sharedData = data2.SharedData;
         selectionObject = data2.SelectionObject;
     }
     else
     {
         sharedData = this.SelectionData.SharedData;
         selectionObject = this.SelectionData.SelectionObject;
     }
     WritableSharedDataItem item = sharedData.GetItem(clipboardFormatId);
     if (item == null)
     {
         TraceSources.ExecutiveSource.TraceEvent(TraceEventType.Warning, 12, "The requested data format {0} is no longer available on the current selection in view {1}.", new object[] { clipboardFormatId, this._viewInstanceId });
     }
     else
     {
         SyncStatus status = new SyncStatus(requestStatus);
         byte[] buffer = this.OnGetSharedData(selectionObject, item, status);
         ClipboardData data3 = new ClipboardData();
         data3.ClipboardFormatId = item.ClipboardFormatId;
         data3.SetValue(buffer);
         ReadSharedDataResponse response = new ReadSharedDataResponse();
         response.RequestedClipboardData = data3;
         requestStatus.ProcessResponse(response);
     }
 }
 private void WriteNextUpdatedData(ClipboardData obj)
 {
     this.WriteString(obj.ClipboardFormatId);
     byte[] items = obj.GetValue();
     int item = -1;
     if (items != null)
     {
         this._InitialSharedData_UpdatedData_Value.AddRange(items);
         item = items.Length;
     }
     this._InitialSharedData_UpdatedData_Value_Count.Add(item);
 }