Example #1
0
 void componentChangeService_ComponentRemoving(object sender, ComponentEventArgs e)
 {
     // If the user is removing the control itself
     if (e.Component == DBInterface)
     {
         IComponentChangeService componentChangeService = (IComponentChangeService)GetService(typeof(IComponentChangeService));
         DBInterface.DestroyVisibleComponents();
         componentChangeService.OnComponentChanged(DBInterface, null, null, null);
     }
 }
Example #2
0
        /// <summary>
        /// Удаление компонента и других связанных с ним компонентов.
        /// </summary>
        public void DestroyVisibleComponents()
        {
            IDesignerHost       host        = (IDesignerHost)GetService(typeof(IDesignerHost));
            DesignerTransaction transaction = host.CreateTransaction("DestroyVisibleComponent");

            DBInterface.DestroyVisibleComponents();

            HostComponent.DestroyComponent(host, DBInterface);

            transaction.Commit();
        }