当前位置: 首页>>代码示例>>C#>>正文


C# IDesignerHost.DestroyComponent方法代码示例

本文整理汇总了C#中IDesignerHost.DestroyComponent方法的典型用法代码示例。如果您正苦于以下问题:C# IDesignerHost.DestroyComponent方法的具体用法?C# IDesignerHost.DestroyComponent怎么用?C# IDesignerHost.DestroyComponent使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在IDesignerHost的用法示例。


在下文中一共展示了IDesignerHost.DestroyComponent方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Transaction_RemovePage

 private object Transaction_RemovePage(IDesignerHost theHost, object theParam)
 {
     if (this.mySelectedPage != null)
     {
         MemberDescriptor member = TypeDescriptor.GetProperties(this.DesignedControl)["Controls"];
         base.RaiseComponentChanging(member);
         try
         {
             theHost.DestroyComponent(this.mySelectedPage);
         }
         catch
         {
         }
         base.RaiseComponentChanged(member, null, null);
     }
     return null;
 }
开发者ID:Nathan-M-Ross,项目名称:i360gm,代码行数:17,代码来源:MultiPaneControlDesigner.cs

示例2: DestroyInstance

 /// <summary>
 /// Destroy instance of an object using the provided designer host.
 /// </summary>
 /// <param name="instance">Reference to item for destroying.</param>
 /// <param name="host">Designer host used if provided.</param>
 public static void DestroyInstance(object instance, IDesignerHost host)
 {
     IComponent component = instance as IComponent;
     if (component != null)
     {
         // Use designer to remove component if possible
         if (host != null)
             host.DestroyComponent(component);
         else
             component.Dispose();
     }
     else
     {
         // Fallback to calling any exposed dispose method
         IDisposable disposable = instance as IDisposable;
         if (disposable != null)
             disposable.Dispose();
     }
 }
开发者ID:Cocotteseb,项目名称:Krypton,代码行数:24,代码来源:CommonHelper.cs

示例3: Transaction_RemoveTab

 private object Transaction_RemoveTab(IDesignerHost host, object parameter)
 {
     // Tab Control
     NeoTabWindow tabControl = (NeoTabWindow)parameter;
     MemberDescriptor md = TypeDescriptor.GetProperties(tabControl)["Controls"];
     RaiseComponentChanging(md);
     host.DestroyComponent(tabControl.SelectedTab);
     RaiseComponentChanged(md, null, null);
     return parameter;
 }
开发者ID:xieguigang,项目名称:Reference_SharedLib,代码行数:10,代码来源:NeoTabWindowDesigner.cs

示例4: RemoveRecursive

        public void RemoveRecursive(IContainsRibbonComponents item, IDesignerHost service)
        {
            if (item == null || service == null) return;

            foreach (Component c in item.GetAllChildComponents())
            {
                if (c is IContainsRibbonComponents)
                {
                    RemoveRecursive(c as IContainsRibbonComponents, service);
                }
                service.DestroyComponent(c);
            }
        }
开发者ID:daywrite,项目名称:EApp,代码行数:13,代码来源:RibbonDesigner.cs

示例5: CreateComponentsCore

        /// <include file='doc\ToolboxItem.uex' path='docs/doc[@for="ToolboxItem.CreateComponentsCore1"]/*' />
        /// <devdoc>
        ///     Creates objects from the type contained in this toolbox item.  If designerHost is non-null
        ///     this will also add them to the designer.
        /// </devdoc>
        protected virtual IComponent[] CreateComponentsCore(IDesignerHost host, IDictionary defaultValues) {
            IComponent[] components = CreateComponentsCore(host);

            if (host != null) {
                for (int i = 0; i < components.Length; i++) {
                    IComponentInitializer init = host.GetDesigner(components[i]) as IComponentInitializer;
                    if (init != null) {
                        bool removeComponent = true;
                        
                        try {
                            init.InitializeNewComponent(defaultValues);
                            removeComponent = false;

                        }
                        finally 
                        {
                            if (removeComponent) {
                                for (int index = 0; index < components.Length; index++) {
                                    host.DestroyComponent(components[index]);
                                }
                            }
                        }

                    }
                }
            }

            return components;
        }
开发者ID:salim18,项目名称:DemoProject2,代码行数:34,代码来源:ToolboxItem.cs

示例6: Transaction_RemovePage

        private object Transaction_RemovePage(IDesignerHost theHost, object theParam)
        {
            if (mySelectedPage == null)
                return null;

            MultiPaneControl aCtl = DesignedControl;

            MemberDescriptor aMember_Controls = TypeDescriptor.GetProperties(aCtl)["Controls"];

            RaiseComponentChanging(aMember_Controls);

            try
            {
                theHost.DestroyComponent(mySelectedPage);
                // NOTE: we don't process anything here because processing will
                // be performed in Handler_ComponentRemoving
            }
            catch { }

            RaiseComponentChanged(aMember_Controls, null, null);

            return null;
        }
开发者ID:Stoner19,项目名称:Memory-Lifter,代码行数:23,代码来源:MultiPane_Design.cs

示例7: DestroySubItems

		protected virtual void DestroySubItems(BaseItem parent, IDesignerHost dh)
		{
			if(parent is ControlContainerItem)
			{
				if(((ControlContainerItem)parent).Control!=null)
				{
					Control c=((ControlContainerItem)parent).Control;
					((ControlContainerItem)parent).Control=null;
					dh.DestroyComponent(c);
				}
			}
			else if(parent is DockContainerItem)
			{
				if(((DockContainerItem)parent).Control!=null)
				{
					Control c=((DockContainerItem)parent).Control;
					((DockContainerItem)parent).Control=null;
					dh.DestroyComponent(c);
				}
			}

			BaseItem[] subitems=new BaseItem[parent.SubItems.Count];
			parent.SubItems.CopyTo(subitems,0);
			foreach(BaseItem item in subitems)
			{
				DestroySubItems(item,dh);
				dh.DestroyComponent(item);
			}
		}
开发者ID:huamanhtuyen,项目名称:VNACCS,代码行数:29,代码来源:BarBaseControlDesigner.cs

示例8: DestroyComponent

		/// <summary>
		/// Destroys the component
		/// </summary>
		/// <param name="oDesignerHost">The designer instance interface</param>
		internal void DestroyComponent(IDesignerHost oDesignerHost)
		{
			// destroy subnodes
			foreach (Node oSubNode in Nodes.ToNodeArray())			
				oSubNode.DestroyComponent(oDesignerHost);	
		
			if (this.Panel != null)
			{
				if (GetTreeView() != null)
					GetTreeView().Controls.Remove(this.Panel);

				oDesignerHost.DestroyComponent(this.Panel);

				this.Panel = null;
			}

			// destroys the component
			oDesignerHost.DestroyComponent(this);			
		}
开发者ID:ChrisMoreton,项目名称:Test3,代码行数:23,代码来源:Node.cs

示例9: DestroyComponentNoRemove

		/// <summary>
		/// Destroys the component
		/// </summary>
		/// <param name="oDesignerHost">The designer instance interface</param>
		internal void DestroyComponentNoRemove(IDesignerHost oDesignerHost)
		{
			// destroy subnodes
			Node [] aNodes = Nodes.ToNodeArray();

			foreach (Node oNode in aNodes)			
				oNode.DestroyComponentNoRemove(oDesignerHost);			

			// destroys the component
			oDesignerHost.DestroyComponent(this);			
		}
开发者ID:ChrisMoreton,项目名称:Test3,代码行数:15,代码来源:Node.cs

示例10: DeletePage

        internal static void DeletePage(WizardPage page, IDesignerHost dh, IComponentChangeService cc)
        {
            if (page == null || !(page.Parent is Wizard))
                return;

            Wizard w = page.Parent as Wizard;

            DesignerTransaction dt = dh.CreateTransaction();

            try
            {
                if (cc != null)
                    cc.OnComponentChanging(w, TypeDescriptor.GetProperties(w)["WizardPages"]);

                w.WizardPages.Remove(page);

                if (cc != null)
                    cc.OnComponentChanged(w, TypeDescriptor.GetProperties(w)["WizardPages"], null, null);

                dh.DestroyComponent(page);
            }
            catch
            {
                dt.Cancel();
            }
            finally
            {
                if (!dt.Canceled)
                    dt.Commit();
            }
        }
开发者ID:huamanhtuyen,项目名称:VNACCS,代码行数:31,代码来源:WizardDesigner.cs

示例11: DestroyObjectGraphFromDesignerHost

        internal static void DestroyObjectGraphFromDesignerHost(IDesignerHost designerHost, Activity activity)
        {
            if (designerHost == null)
                throw new ArgumentNullException("designerHost");
            if (activity == null)
                throw new ArgumentNullException("activity");

            designerHost.DestroyComponent(activity);

            if (activity is CompositeActivity)
            {
                foreach (Activity activity2 in GetNestedActivities(activity as CompositeActivity))
                    designerHost.DestroyComponent(activity2);
            }
        }
开发者ID:ssickles,项目名称:archive,代码行数:15,代码来源:Loader.cs

示例12: DeletePage

        internal static void DeletePage(WizardPage page, IDesignerHost dh, IComponentChangeService cc)
        {
            if (page == null || !(page.Parent is PageSlider))
                return;

            PageSlider slider = (PageSlider)page.Parent;

            DesignerTransaction dt = dh.CreateTransaction("Deleting page");

            try
            {
                if (cc != null)
                    cc.OnComponentChanging(slider, TypeDescriptor.GetProperties(slider)["Controls"]);

                slider.Controls.Remove(page);

                if (cc != null)
                    cc.OnComponentChanged(slider, TypeDescriptor.GetProperties(slider)["Controls"], null, null);

                dh.DestroyComponent(page);
            }
            catch
            {
                dt.Cancel();
            }
            finally
            {
                if (!dt.Canceled)
                    dt.Commit();
            }
        }
开发者ID:huamanhtuyen,项目名称:VNACCS,代码行数:31,代码来源:PageSliderDesigner.cs

示例13: RemoveFromDesigner

 public void RemoveFromDesigner(IDesignerHost designer, Activity workflow)
 {
     if (workflow != null)
     {
         designer.DestroyComponent(workflow);
         if (workflow is CompositeActivity)
         {
             List<Activity> children = new List<Activity>();
             GetChildActivities(workflow as CompositeActivity, children);
             foreach (Activity child in children)
             {
                 designer.DestroyComponent(child);
             }
         }
     }
 }
开发者ID:ssickles,项目名称:archive,代码行数:16,代码来源:WorkflowLoader.cs

示例14: CreateComponentsCore

 protected virtual IComponent[] CreateComponentsCore(IDesignerHost host, IDictionary defaultValues)
 {
     IComponent[] componentArray = this.CreateComponentsCore(host);
     if (host != null)
     {
         for (int i = 0; i < componentArray.Length; i++)
         {
             IComponentInitializer designer = host.GetDesigner(componentArray[i]) as IComponentInitializer;
             if (designer != null)
             {
                 bool flag = true;
                 try
                 {
                     designer.InitializeNewComponent(defaultValues);
                     flag = false;
                 }
                 finally
                 {
                     if (flag)
                     {
                         for (int j = 0; j < componentArray.Length; j++)
                         {
                             host.DestroyComponent(componentArray[j]);
                         }
                     }
                 }
             }
         }
     }
     return componentArray;
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:31,代码来源:ToolboxItem.cs


注:本文中的IDesignerHost.DestroyComponent方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。