internal void ProcessRequestMessage(PropertyPageMessageRequestInfo requestInfo, IRequestStatus requestStatus) { PropertySheet propertySheet = this.GetPropertySheet(requestInfo.SheetId); SyncStatus status = new SyncStatus(requestStatus); try { requestStatus.ProcessResponse(propertySheet.ProcessRequestMessage(requestInfo)); } finally { status.Close(); } }
private void ComparePropertySheetSelectionObjects(int currentSelectionId, int selectionIdToCompare, IRequestStatus requestStatus) { CompareSelectionObjectsResponse response = new CompareSelectionObjectsResponse(); response.Result = false; if (requestStatus == null) { throw new ArgumentNullException("requestStatus"); } SyncStatus status = new SyncStatus(requestStatus); try { if (((this.SelectionData.SelectionCardinality != SelectionCardinality.None) && (currentSelectionId == this.SelectionData.Id)) && (this.SelectionData.SelectionObject != null)) { response.Result = SnapInBase.SnapInInstance.SheetManager.ComparePropertySheetSelectionObjects(this.SelectionData.SelectionObject, selectionIdToCompare); } requestStatus.ProcessResponse(response); } finally { status.Close(); } }
internal void ProcessRequest(NodeRequestInfo info, IRequestStatus requestStatus) { if (!this._initialized) { throw new Exception(Microsoft.ManagementConsole.Internal.Utility.LoadResourceString(Microsoft.ManagementConsole.Internal.Strings.NodeSyncManagerNotInitialized)); } ScopeNode node = this.GetNode(info.ScopeNodeId); if (node != null) { if (info is ExpandScopeNodeRequestInfo) { node.Expand(requestStatus); } else if (info is ActionNodeRequestInfo) { node.DoAction(((ActionNodeRequestInfo) info).ActionId, requestStatus); } else if (info is ReadSharedDataNodeRequestInfo) { node.GetSharedData((ReadSharedDataNodeRequestInfo) info, requestStatus); } else if (info is UpdateDataChangeNodeRequestInfo) { node.RequestSharedDataUpdate((UpdateDataChangeNodeRequestInfo) info, requestStatus); } else if (info is PagesForNodeRequestInfo) { node.GetPropertyPages(((PagesForNodeRequestInfo) info).SheetId, requestStatus); } else if ((((info is DeleteNodeRequestInfo) || (info is RefreshNodeRequestInfo)) || ((info is PrintNodeRequestInfo) || (info is RenameNodeRequestInfo))) || ((info is PasteNodeRequestInfo) || (info is CutOrMoveNodeRequestInfo))) { node.DoVerb(info, requestStatus); } else if (info is ExpandFromLoadScopeNodeRequestInfo) { ExpandFromLoadScopeNodeRequestResponse response = new ExpandFromLoadScopeNodeRequestResponse(); response.Handled = node.ExpandFromLoad(requestStatus); requestStatus.ProcessResponse(response); } else if (info is ActivateNodeRequestInfo) { node.Activate(requestStatus); } } }
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); } }
internal void GetPropertyPages(int sheetId, IRequestStatus requestStatus) { if (requestStatus == null) { throw new ArgumentNullException("requestStatus", Microsoft.ManagementConsole.Internal.Utility.LoadResourceString(Microsoft.ManagementConsole.Internal.Strings.ScopeNodeRequestInterfaceNull)); } PropertyPageCollection propertyPageCollection = new PropertyPageCollection(); SyncStatus status = new SyncStatus(requestStatus); try { this.OnAddPropertyPages(propertyPageCollection); PropertyPagesResponse response = new PropertyPagesResponse(); response.SetPropertyPages(propertyPageCollection.ToPropertyPageInfoArray()); requestStatus.ProcessResponse(response); } finally { status.Close(); } SnapInBase.SnapInInstance.SheetManager.CreatePropertySheet(sheetId, propertyPageCollection, null); }
internal void DoVerb(NodeRequestInfo info, IRequestStatus requestStatus) { if (info is DeleteNodeRequestInfo) { this.OnDelete(new SyncStatus(requestStatus)); } else if (info is RefreshNodeRequestInfo) { this.OnRefresh(new AsyncStatus(requestStatus)); } else if (info is PrintNodeRequestInfo) { this.OnPrint(new SyncStatus(requestStatus)); } else if (info is RenameNodeRequestInfo) { this.OnRename(((RenameNodeRequestInfo) info).NewDisplayName, new SyncStatus(requestStatus)); } else if (info is PasteNodeRequestInfo) { PasteNodeRequestInfo info2 = (PasteNodeRequestInfo) info; Microsoft.ManagementConsole.SharedData sharedData = new Microsoft.ManagementConsole.SharedData(info2.DataObjectId); base.SnapIn.AddSharedData(sharedData); sharedData.SetSnapInPlatform(base.SnapIn.SnapInClient.SnapInPlatform); PasteResponse response = new PasteResponse(); try { response.AcceptPaste = this.OnPaste(sharedData, (Microsoft.ManagementConsole.DragAndDropVerb) info2.PasteType, new SyncStatus(requestStatus)); requestStatus.ProcessResponse(response); } finally { base.SnapIn.RemoveSharedData(sharedData); } } else if (info is CutOrMoveNodeRequestInfo) { this.OnCut(new AsyncStatus(requestStatus)); } }
private void HandleSortRequest(int columnIndex, bool descending, IRequestStatus requestStatus) { SyncStatus status = new SyncStatus(requestStatus); try { int[] ids = this.DoSort(columnIndex, descending); SortListViewResponse response = new SortListViewResponse(); response.SetIds(ids); requestStatus.ProcessResponse(response); } finally { status.Close(); } this.OnSortCompleted(columnIndex, descending); }
internal void HandleSaveViewDataRequest(IRequestStatus requestStatus, bool clearModified) { byte[] data = null; if (this.IsModified) { data = this.OnSaveCustomData(new SyncStatus(requestStatus)); if (data == null) { TraceSources.ExecutiveSource.TraceEvent(TraceEventType.Information, 12, "Snap-in view failed to return a non-null byte[] of serialized data."); throw new InvalidOperationException(Microsoft.ManagementConsole.Internal.Utility.LoadResourceString(Microsoft.ManagementConsole.Internal.Strings.ExceptionCommonPersistenceNotSerializable)); } } SaveViewDataResponse response = new SaveViewDataResponse(); response.SetDataBlob(data); requestStatus.ProcessResponse(response); if (clearModified) { this.IsModified = false; } }
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); } }
internal void GetPropertyPages(int sheetId, long selectionId, IRequestStatus requestStatus) { if (requestStatus == null) { throw new ArgumentNullException("requestStatus"); } PropertyPageCollection propertyPageCollection = new PropertyPageCollection(); SyncStatus status = new SyncStatus(requestStatus); try { if ((this.SelectionData.SelectionCardinality == SelectionCardinality.None) || (selectionId != this.SelectionData.Id)) { TraceSources.ExecutiveSource.TraceEvent(TraceEventType.Warning, 12, "Request for pages for sheet {0} in view {1} selection id {2} ignored since selection has changed.", new object[] { sheetId, this._viewInstanceId, selectionId }); requestStatus.ProcessResponse(new PropertyPagesResponse()); return; } this.OnAddPropertyPages(propertyPageCollection); PropertyPagesResponse response = new PropertyPagesResponse(); response.SetPropertyPages(propertyPageCollection.ToPropertyPageInfoArray()); requestStatus.ProcessResponse(response); } finally { status.Close(); } SnapInBase.SnapInInstance.SheetManager.CreatePropertySheet(sheetId, propertyPageCollection, new AuxiliarySelectionData(this.SelectionData)); }
private void DoVerb(RequestInfo requestInfo, IRequestStatus requestStatus) { if (requestInfo is CutOrMoveViewSelectionRequestInfo) { CutOrMoveViewSelectionRequestInfo info = (CutOrMoveViewSelectionRequestInfo) requestInfo; AuxiliarySelectionData data = this.ClipboardSelectionDatas[info.SelectionId]; if (data != null) { this.OnCut(data.SelectionObject, new AsyncStatus(requestStatus)); } else { TraceSources.ExecutiveSource.TraceEvent(TraceEventType.Warning, 12, "Request CutOrMove in view {0} ignore since selection id {1} could not be found.", new object[] { this._viewInstanceId, info.SelectionId }); } } else { int selectionId = ((ViewSelectionRequestInfo) requestInfo).SelectionId; if ((this.SelectionData.SelectionCardinality == SelectionCardinality.None) || (selectionId != this.SelectionData.Id)) { TraceSources.ExecutiveSource.TraceEvent(TraceEventType.Warning, 12, "Request {0} in view {1} selection id {2} ignored since selection has changed.", new object[] { requestInfo.GetType().FullName, this._viewInstanceId, selectionId }); } else if (requestInfo is DeleteViewSelectionRequestInfo) { this.OnDelete(new SyncStatus(requestStatus)); } else if (requestInfo is RefreshViewSelectionRequestInfo) { this.OnRefresh(new AsyncStatus(requestStatus)); } else if (requestInfo is PrintViewSelectionRequestInfo) { this.OnPrint(new SyncStatus(requestStatus)); } else if (requestInfo is RenameViewSelectionRequestInfo) { this.OnRename(((RenameViewSelectionRequestInfo) requestInfo).NewDisplayName, new SyncStatus(requestStatus)); } else if (requestInfo is PasteViewSelectionRequestInfo) { PasteViewSelectionRequestInfo info2 = (PasteViewSelectionRequestInfo) requestInfo; SharedData sharedData = new SharedData(info2.DataObjectId); this.ScopeNode.SnapIn.AddSharedData(sharedData); sharedData.SetSnapInPlatform(this.ScopeNode.SnapIn.SnapInClient.SnapInPlatform); PasteResponse response = new PasteResponse(); try { response.AcceptPaste = this.OnPaste(sharedData, (Microsoft.ManagementConsole.DragAndDropVerb) info2.PasteType, new SyncStatus(requestStatus)); requestStatus.ProcessResponse(response); } finally { this.ScopeNode.SnapIn.RemoveSharedData(sharedData); } } } }
internal void SaveCustomData(IRequestStatus requestStatus, bool clearModified) { if (requestStatus == null) { throw new ArgumentNullException("requestStatus", Microsoft.ManagementConsole.Internal.Utility.LoadResourceString(Microsoft.ManagementConsole.Internal.Strings.ScopeNodeRequestInterfaceNull)); } byte[] data = null; if (this.IsModified) { data = this.OnSaveCustomData(new SyncStatus(requestStatus)); if (data == null) { throw new InvalidOperationException(Microsoft.ManagementConsole.Internal.Utility.LoadResourceString(Microsoft.ManagementConsole.Internal.Strings.ExceptionCommonPersistenceNotSerializable)); } } PersistenceCompletedResponse response = new PersistenceCompletedResponse(); response.SetDataBlob(data); requestStatus.ProcessResponse(response); if (clearModified) { this.IsModified = false; } }