示例#1
0
        protected bool IsItemContainerSupported(ToolboxItemContainer container, IDesignerHost host)
        {
            if (container == null)
            {
                throw new ArgumentNullException("container");
            }
            if (host == null)
            {
                throw new ArgumentNullException("host");
            }
            ICollection creatorCollection = this.GetCreatorCollection(host);

            this._lastState = host.GetService(typeof(DesignerToolboxInfo)) as DesignerToolboxInfo;
            if (this._lastState == null)
            {
                this._lastState = new DesignerToolboxInfo(this, host);
                host.AddService(typeof(DesignerToolboxInfo), this._lastState);
            }
            switch (GetFilterSupport(container.GetFilter(creatorCollection), this._lastState.Filter))
            {
            case FilterSupport.NotSupported:
                return(false);

            case FilterSupport.Supported:
                return(true);

            case FilterSupport.Custom:
                if (this._lastState.ToolboxUser == null)
                {
                    break;
                }
                return(this._lastState.ToolboxUser.GetToolSupported(container.GetToolboxItem(creatorCollection)));
            }
            return(false);
        }
示例#2
0
        public override bool Equals(object obj)
        {
            ToolboxItemContainer container = obj as ToolboxItemContainer;

            if (container == this)
            {
                return(true);
            }
            if (container == null)
            {
                return(false);
            }
            if (((this._toolboxItem != null) && (container._toolboxItem != null)) && this._toolboxItem.Equals(container._toolboxItem))
            {
                return(true);
            }
            if (((this._dataObject != null) && (container._dataObject != null)) && this._dataObject.Equals(container._dataObject))
            {
                return(true);
            }
            ToolboxItem toolboxItem = this.GetToolboxItem(null);
            ToolboxItem item2       = container.GetToolboxItem(null);

            return(((toolboxItem != null) && (item2 != null)) && toolboxItem.Equals(item2));
        }
示例#3
0
        ToolboxItem IToolboxService.GetSelectedToolboxItem()
        {
            ToolboxItemContainer selectedItemContainer = this.SelectedItemContainer;

            if (selectedItemContainer != null)
            {
                return(selectedItemContainer.GetToolboxItem(this.GetCreatorCollection(null)));
            }
            return(null);
        }
示例#4
0
        ToolboxItem IToolboxService.GetSelectedToolboxItem(IDesignerHost host)
        {
            if (host == null)
            {
                throw new ArgumentNullException("host");
            }
            ToolboxItemContainer selectedItemContainer = this.SelectedItemContainer;

            if (selectedItemContainer != null)
            {
                return(selectedItemContainer.GetToolboxItem(this.GetCreatorCollection(host)));
            }
            return(null);
        }
示例#5
0
        ToolboxItem IToolboxService.DeserializeToolboxItem(object serializedObject)
        {
            if (serializedObject == null)
            {
                throw new ArgumentNullException("serializedObject");
            }
            IDataObject dataObject = serializedObject as IDataObject;

            if (dataObject == null)
            {
                dataObject = new DataObject(serializedObject);
            }
            ToolboxItemContainer container = this.CreateItemContainer(dataObject);

            if (container != null)
            {
                return(container.GetToolboxItem(this.GetCreatorCollection(null)));
            }
            return(null);
        }