Beispiel #1
0
            public override object ConvertTo(ITypeDescriptorContext context, CultureInfo culture, object value,
                                             Type destinationType)
            {
                if (destinationType == null)
                {
                    throw new ArgumentNullException("destinationType");
                }
                if ((destinationType != _instanceDescriptorType) || !(value is HostToolbox))
                {
                    goto Label_ReturnBase;
                }
                HostToolbox     toolbox = (HostToolbox)value;
                ConstructorInfo ci      = toolbox.GetType().GetConstructor(new Type[] { typeof(bool) });

                if (ci != null)
                {
                    bool createGeneral = false;
                    if (toolbox.Site != null && toolbox.Site.DesignMode)
                    {
                        createGeneral = toolbox.CreateGeneralCategory;
                    }
                    return(new InstanceDescriptor(ci, new object[] { createGeneral }, false));
                }
                else
                {
                    ci = toolbox.GetType().GetConstructor(new Type[0]);
                    return(new InstanceDescriptor(ci, new object[0]));
                }
Label_ReturnBase:
                return(base.ConvertTo(context, culture, value, destinationType));
            }
        private ToolBoxWindow()
        {
            this.InitializeComponent();
            this.toolbox1 = new HostToolbox(false) {Dock = DockStyle.Fill, AllowToolboxItems = true};
            Assembly ass = Assembly.GetAssembly(typeof (Primitive));

            foreach (Type type in ass.GetExportedTypes().OrderBy(t => t.Name)) {
                if (!type.IsAbstract) {
                    if (type.IsSubclassOf(typeof (Primitive))) {
                        if (type.GetInterface(typeof (IConstrutive).FullName) == null) {
                            this.toolbox1.AddToolboxItem(type, "Primitives");
                        }
                    }
                    if (type.IsSubclassOf(typeof (Material))) {
                        this.toolbox1.AddToolboxItem(type, "Materials");
                    }
                    if (type.IsSubclassOf(typeof (Light))) {
                        this.toolbox1.AddToolboxItem(type, "Lights");
                    }
                    if (type.IsSubclassOf(typeof (Camera))) {
                        this.toolbox1.AddToolboxItem(type, "Cameras");
                    }
                }
            }
            this.toolbox1.AddToolboxItem(typeof (Scene), "Scene");
            this.Controls.Add(this.toolbox1);
        }
 /// <summary>
 /// Initializes a new instance of the <see cref="TBService"/> with the specified <paramref name="toolbox"/> reference.
 /// </summary>
 /// <param name="toolbox">A <see cref="HostToolbox"/> component to associate.</param>
 public TBService(HostToolbox toolbox)
 {
     this._toolbox = toolbox;
 }
Beispiel #4
0
 public ToolboxItemList(HostToolbox toolbox)
 {
     this._toolbox = toolbox;
 }
Beispiel #5
0
 public ToolboxItemList(Tab tab)
 {
     this._tab     = tab;
     this._toolbox = this._tab.Toolbox as HostToolbox;
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="TBService"/> with the specified <paramref name="toolbox"/> reference.
 /// </summary>
 /// <param name="toolbox">A <see cref="HostToolbox"/> component to associate.</param>
 public TBService(HostToolbox toolbox)
 {
     this._toolbox = toolbox;
 }
 public ToolboxItemList(HostToolbox toolbox)
 {
     this._toolbox = toolbox;
 }
 public ToolboxItemList(Tab tab)
 {
     this._tab = tab;
     this._toolbox = this._tab.Toolbox as HostToolbox;
 }