Пример #1
0
 private SelectionData()
 {
     this._id = -1;
     this._uniqueNodeTypes = new Guid[0];
     this._sharedData = new WritableSharedData();
     this._description = string.Empty;
     this._actionsPaneItems = new ActionsPaneItemCollection();
     this._actionsPaneHelpItems = new ActionsPaneItemCollection();
     this._pasteTargetInfo = new PasteTargetInfo();
 }
Пример #2
0
 public AuxiliarySelectionData(SelectionData selectionData)
 {
     if (selectionData == null)
     {
         throw new ArgumentNullException("selectionData");
     }
     this._sharedData = selectionData.SharedData;
     this._selectionObject = selectionData.SelectionObject;
     this._id = selectionData.Id;
 }
Пример #3
0
 internal SelectionData(View view)
 {
     this._id = -1;
     this._uniqueNodeTypes = new Guid[0];
     this._sharedData = new WritableSharedData();
     this._description = string.Empty;
     this._actionsPaneItems = new ActionsPaneItemCollection();
     this._actionsPaneHelpItems = new ActionsPaneItemCollection();
     this._pasteTargetInfo = new PasteTargetInfo();
     if (view == null)
     {
         throw new ArgumentNullException("view");
     }
     this._view = view;
     this._sharedData.Changed += new WritableSharedDataItem.SharedDataChangedEventHandler(this.OnSharedDataChanged);
     this._actionsPaneItems.Changed += new ActionsPaneItemCollection.ActionsPaneItemCollectionEventHandler(this.OnActionsPaneItemsChanged);
     this._actionsPaneHelpItems.Changed += new ActionsPaneItemCollection.ActionsPaneItemCollectionEventHandler(this.OnActionsPaneHelpItemsChanged);
 }
Пример #4
0
        private void ChangeSelection(object selectionObject, Microsoft.ManagementConsole.Internal.SelectionCardinality type, Guid[] uniqueNodeTypes, WritableSharedData sharedData)
        {
            switch (type)
            {
                case Microsoft.ManagementConsole.Internal.SelectionCardinality.None:
                    if (uniqueNodeTypes.Length > 0)
                    {
                        throw Microsoft.ManagementConsole.Internal.Utility.CreateArgumentOutOfRangeException("uniqueNodeTypes.Length", uniqueNodeTypes.Length, 0, 0);
                    }
                    break;

                case Microsoft.ManagementConsole.Internal.SelectionCardinality.Single:
                    if (uniqueNodeTypes.Length > 1)
                    {
                        throw Microsoft.ManagementConsole.Internal.Utility.CreateArgumentOutOfRangeException("uniqueNodeTypes.Length", uniqueNodeTypes.Length, 0, 1);
                    }
                    break;
            }
            this._id = this.GetSelectionId(type, selectionObject);
            if (sharedData == null)
            {
                sharedData = new WritableSharedData();
            }
            this._type = type;
            this._uniqueNodeTypes = uniqueNodeTypes;
            this.ReplaceSharedData(sharedData);
            this._selectionObject = selectionObject;
            this.ValidateVerbs();
            if (this._view.Initialized)
            {
                this._view.OnSelectionContextChanged(this._id, this._type, this._uniqueNodeTypes, this._sharedData.GetItems());
            }
            ScopeNode scopeNode = this._view.ScopeNode;
            if (scopeNode != null)
            {
                scopeNode.CurrentSelectionDatas[this._view] = new AuxiliarySelectionData(this);
            }
        }
Пример #5
0
 public void Update(object selectionObject, bool multiSelection, Guid[] uniqueNodeTypes, WritableSharedData sharedData)
 {
     this.ThrowIfViewShutdown("Update");
     MmcListView view = this._view as MmcListView;
     if (view != null)
     {
         if (!view.SnapInProcessingSelectionChange)
         {
             throw new InvalidOperationException(Microsoft.ManagementConsole.Internal.Utility.LoadResourceString(Microsoft.ManagementConsole.Internal.Strings.SelectionDataUpdateInvalidFromList));
         }
         if ((multiSelection && (view.SelectedNodes.Count < 2)) || (!multiSelection && (view.SelectedNodes.Count != 1)))
         {
             throw new ArgumentException(Microsoft.ManagementConsole.Internal.Utility.LoadResourceString(Microsoft.ManagementConsole.Internal.Strings.SelectionDataUpdateInvalidUpdate), "multiSelection");
         }
     }
     if ((uniqueNodeTypes == null) || (uniqueNodeTypes.Length == 0))
     {
         uniqueNodeTypes = new Guid[] { Guid.Empty };
     }
     this.ChangeSelection(selectionObject, multiSelection ? Microsoft.ManagementConsole.Internal.SelectionCardinality.Multiple : Microsoft.ManagementConsole.Internal.SelectionCardinality.Single, uniqueNodeTypes, sharedData);
 }
Пример #6
0
 private WritableSharedData ReplaceSharedData(WritableSharedData newSharedData)
 {
     WritableSharedData data = this._sharedData;
     data.Changed -= new WritableSharedDataItem.SharedDataChangedEventHandler(this.OnSharedDataChanged);
     this._sharedData = newSharedData;
     this._sharedData.Changed += new WritableSharedDataItem.SharedDataChangedEventHandler(this.OnSharedDataChanged);
     return data;
 }