private void OnComponentRemoving(object sender,ComponentEventArgs e) { if(e.Component!=this.Component) { return; } // Unhook events IComponentChangeService cc=(IComponentChangeService)GetService(typeof(IComponentChangeService)); if(cc!=null) cc.ComponentRemoving-=new ComponentEventHandler(this.OnComponentRemoving); DockSite c=this.Control as DockSite; if(c==null) return; if(c.Owner!=null) { if(c.Owner.FillDockSite==c) c.Owner.FillDockSite=null; else if(c.Owner.LeftDockSite==c) c.Owner.LeftDockSite=null; else if(c.Owner.RightDockSite==c) c.Owner.RightDockSite=null; else if(c.Owner.TopDockSite==c) c.Owner.TopDockSite=null; else if(c.Owner.BottomDockSite==c) c.Owner.BottomDockSite=null; } }
protected virtual void OnComponentRemoved(ComponentEventArgs e) { if (this.ComponentRemoved != null) { this.ComponentRemoved(this, e); } }
private void OnRemoving(object sender, ComponentEventArgs e) { IDesignerHost host = (IDesignerHost) GetService(typeof (IDesignerHost)); //Removing a button if (e.Component is FATabStripItem) { FATabStripItem itm = e.Component as FATabStripItem; if (Control.Items.Contains(itm)) { changeService.OnComponentChanging(Control, null); Control.RemoveTab(itm); changeService.OnComponentChanged(Control, null, null, null); return; } } if (e.Component is FATabStrip) { for (int i = Control.Items.Count - 1; i >= 0; i--) { FATabStripItem itm = Control.Items[i]; changeService.OnComponentChanging(Control, null); Control.RemoveTab(itm); host.DestroyComponent(itm); changeService.OnComponentChanged(Control, null, null, null); } } }
private void OnComponentRemoving(object sender, ComponentEventArgs e) { // If our control is being removed if ((_dateTimePicker != null) && (e.Component == _dateTimePicker)) { // Need access to host in order to delete a component IDesignerHost host = (IDesignerHost)GetService(typeof(IDesignerHost)); // We need to remove all the button spec instances for (int i = _dateTimePicker.ButtonSpecs.Count - 1; i >= 0; i--) { // Get access to the indexed button spec ButtonSpec spec = _dateTimePicker.ButtonSpecs[i]; // Must wrap button spec removal in change notifications _changeService.OnComponentChanging(_dateTimePicker, null); // Perform actual removal of button spec from textbox _dateTimePicker.ButtonSpecs.Remove(spec); // Get host to remove it from design time host.DestroyComponent(spec); // Must wrap button spec removal in change notifications _changeService.OnComponentChanged(_dateTimePicker, null, null, null); } } }
private void OnComponentAdded(object sender, ComponentEventArgs eventArgs) { IDesignerHost designerHost = (IDesignerHost)this.serviceProvider.GetService(typeof(IDesignerHost)); if (designerHost != null) { if (designerHost.RootComponent == eventArgs.Component) { Activity rootActivity = designerHost.RootComponent as Activity; if (rootActivity != null) { CompositeActivity compositeActivity = rootActivity as CompositeActivity; if (compositeActivity != null) { if (this.ensureChildHierarchyHandler == null) { this.ensureChildHierarchyHandler = new EventHandler(OnEnsureChildHierarchy); Application.Idle += this.ensureChildHierarchyHandler; } } rootActivity.UserData[UserDataKeys.CustomActivity] = false; } } else if (eventArgs.Component is Activity) { if ((eventArgs.Component is CompositeActivity) && Helpers.IsCustomActivity(eventArgs.Component as CompositeActivity)) (eventArgs.Component as Activity).UserData[UserDataKeys.CustomActivity] = true; else (eventArgs.Component as Activity).UserData[UserDataKeys.CustomActivity] = false; } } }
private void DesignPanel_ComponentAdded(object sender, System.ComponentModel.Design.ComponentEventArgs e) { PageHeaderBand headerBand; host = (IDesignerHost)designer.DesignRibbonForm.DesignMdiController.ActiveDesignPanel.Report.Site.GetService(typeof(IDesignerHost)); if (!(e.Component is XRLabel) && !(e.Component is XRTable)) { return; } if (e.Component is XRLabel) { XRLabel label = e.Component as XRLabel; if (label.ExpressionBindings.Count == 0) { return; } if (label.Parent is XRTableRow) { return; } headerBand = CreatePageHeaderBand(designer.Report); XRLabel newLabel = CopyLabel(label, headerBand); headerBand.Controls.Add(newLabel); DesignToolHelper.AddToContainer(host, newLabel); } if (e.Component is XRTable) { headerBand = CreatePageHeaderBand(designer.Report); XRTableRow sourceRow = (e.Component as XRTable).Rows[0]; XRTable headerTable = CreateTable(sourceRow, headerBand.HeightF); headerBand.Controls.Add(headerTable); DesignToolHelper.AddToContainer(host, headerTable); } }
private void DataSource_ComponentRemoved(object sender, ComponentEventArgs e) { DataGrid component = (DataGrid) base.Component; if (e.Component == component.DataSource) { component.DataSource = null; } }
void panel_ComponentAdded(object sender, System.ComponentModel.Design.ComponentEventArgs e) { XRDesignPanel panel = sender as XRDesignPanel; if (checkedListBoxControl1.Items.Contains(e.Component.GetType().Name) && checkedListBoxControl1.Items[e.Component.GetType().Name].CheckState == CheckState.Checked) { panel.BeginInvoke(new SmartTagInvoker(ShowSmartTag), new object[] { panel, e.Component }); } }
private void OnComponentRemoving (object sender, ComponentEventArgs args) { if (this.GetComponentSelected (args.Component)) #if NET_2_0 this.SetSelectedComponents (new IComponent[] { args.Component }, SelectionTypes.Remove); #else this.SetSelectedComponents (new IComponent[] { this.RootComponent }, SelectionTypes.Click); #endif }
private void OnComponentRemoving(object sender, ComponentEventArgs e) { var control = e.Component as DockControl; if (control?.LayoutSystem != null && control.LayoutSystem.DockContainer == _dockContainer) { _dockControl = control; RaiseComponentChanging(TypeDescriptor.GetProperties(_dockContainer)["LayoutSystem"]); } }
private void CategoryComponentRemoved(object sender, ComponentEventArgs e) { this.RemoveComponent(e.Component); Category category = (Category) sender; if (!this.ComponentCategoryMap.ContainsValue(category)) { category.ComponentAdded -= new ComponentEventHandler(this.CategoryComponentAdded); category.ComponentRemoved -= new ComponentEventHandler(this.CategoryComponentRemoved); category.Disposed -= new EventHandler(this.CategoryDisposed); } }
private void doComponentRemoving(object sender, ComponentEventArgs e) { if (e.Component is ModelBase) { RecordContextPanel ctl = Control as RecordContextPanel; if (ctl != null) { if (e.Component == ctl.AttachToRecord) ctl.AttachToRecord = null; } } }
private void doComponentRemoving(object sender, ComponentEventArgs e) { if (e.Component is ModelBase) { FieldContextControl ctl = Control as FieldContextControl; if (ctl!=null) { if (e.Component == ctl.AttachToRecord) ctl.AttachToRecord = null; else if (e.Component == ctl.AttachToField) ctl.AttachToField = null; } } }
private void OnComponentRemoving(object sender,ComponentEventArgs e) { if(e.Component!=this.Component) { return; } DockSite c = this.Control as DockSite; if (c.Dock != DockStyle.Fill && !DotNetBarManagerRemoving) { throw new InvalidOperationException("DotNetBarManager dock sites must not be removed manually. Delete DotNetBarManager component to remove all dock sites."); } else { IDesignerHost dh = (IDesignerHost)GetService(typeof(IDesignerHost)); if (dh != null) { Bar[] bars = new Bar[c.Controls.Count]; c.Controls.CopyTo(bars, 0); foreach (Bar bar in bars) { if (bar != null) { dh.DestroyComponent(bar); } } } } // Unhook events IComponentChangeService cc=(IComponentChangeService)GetService(typeof(IComponentChangeService)); if(cc!=null) cc.ComponentRemoving-=new ComponentEventHandler(this.OnComponentRemoving); if(c==null) return; if(c.Owner!=null) { if(c.Owner.FillDockSite==c) c.Owner.FillDockSite=null; else if(c.Owner.LeftDockSite==c) c.Owner.LeftDockSite=null; else if(c.Owner.RightDockSite==c) c.Owner.RightDockSite=null; else if(c.Owner.TopDockSite==c) c.Owner.TopDockSite=null; else if(c.Owner.BottomDockSite==c) c.Owner.BottomDockSite=null; } }
private void OnComponentRemoved(object sender,ComponentEventArgs e) { if(e.Component is BaseItem) { BaseItem parent=this.Component as BaseItem; BaseItem item=e.Component as BaseItem; if(item!=null && parent!=null && parent.SubItems.Contains(item)) { IComponentChangeService cc=(IComponentChangeService)GetService(typeof(IComponentChangeService)); if(cc!=null) cc.OnComponentChanging(parent,TypeDescriptor.GetProperties(parent)["SubItems"]); parent.SubItems.Remove(item); if(cc!=null) cc.OnComponentChanged(parent,TypeDescriptor.GetProperties(parent)["SubItems"],null,null); this.RecalcLayout(); } } }
protected override void InternalComponentRemoving(ComponentEventArgs e) { if(m_InternalRemove) return; IDesignerHost dh=(IDesignerHost)GetService(typeof(IDesignerHost)); if(dh==null) return; if(e.Component is TabControlPanel && this.Control!=null && this.Control.Controls.Contains(e.Component as Control)) { try { TabControlPanel panel=e.Component as TabControlPanel; if(panel.TabItem!=null) { TabControl tabControl=this.Control as TabControl; tabControl.Tabs.Remove(panel.TabItem); dh.DestroyComponent(panel.TabItem); } } finally { m_InternalRemove=false; } } else if(e.Component is TabItem && this.Control!=null && ((TabControl)this.Control).Tabs.Contains(e.Component as TabItem)) { try { TabItem item=e.Component as TabItem; if(item.AttachedControl!=null && this.Control.Controls.Contains(item.AttachedControl)) { TabControl tabControl=this.Control as TabControl; tabControl.Controls.Remove(item.AttachedControl); dh.DestroyComponent(item.AttachedControl); } } finally { m_InternalRemove=false; } } }
private void OnComponentRemoved(object sender, ComponentEventArgs e) { if (e.Component is WizardPage) { WizardPage page = e.Component as WizardPage; Wizard w = this.Control as Wizard; if (page != null && w.WizardPages.Contains(page)) { IComponentChangeService cc = this.GetService(typeof(IComponentChangeService)) as IComponentChangeService; 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); } } }
private void OnComponentRemoved(object sender, ComponentEventArgs e) { if (e.Component is PageSliderPage) { PageSliderPage page = e.Component as PageSliderPage; PageSlider slider = this.Control as PageSlider; if (page != null && slider.Controls.Contains(page)) { IComponentChangeService cc = this.GetService(typeof(IComponentChangeService)) as IComponentChangeService; 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); } } }
private void OnComponentRemoving(object sender, ComponentEventArgs e) { BindingSource component = base.Component as BindingSource; if ((component != null) && (component.DataSource == e.Component)) { IComponentChangeService service = (IComponentChangeService) this.GetService(typeof(IComponentChangeService)); string dataMember = component.DataMember; PropertyDescriptorCollection properties = TypeDescriptor.GetProperties(component); PropertyDescriptor member = (properties != null) ? properties["DataMember"] : null; if ((service != null) && (member != null)) { service.OnComponentChanging(component, member); } component.DataSource = null; if ((service != null) && (member != null)) { service.OnComponentChanged(component, member, dataMember, ""); } } }
protected virtual void ComponentChangeComponentAdded(object sender, ComponentEventArgs e) { if (m_AddingItem) { m_AddingItem = false; IComponentChangeService cc = this.GetService(typeof(IComponentChangeService)) as IComponentChangeService; BaseItem parent = this.Component as BaseItem; if (cc != null) cc.OnComponentChanging(parent, TypeDescriptor.GetProperties(parent)["SubItems"]); parent.SubItems.Add(e.Component as BaseItem); if (cc != null) cc.OnComponentChanged(parent, TypeDescriptor.GetProperties(parent)["SubItems"], null, null); m_InsertItemTransaction.Commit(); m_InsertItemTransaction = null; this.RecalcLayout(); } }
/// <summary> /// Occurs when the component is being removed from the designer. /// </summary> /// <param name="sender">Source of the event.</param> /// <param name="e">A ComponentEventArgs containing event data.</param> protected override void OnComponentRemoving(object sender, ComponentEventArgs e) { // If our control is being removed if (e.Component == Navigator) { // If this workspace cell is inside a parent KryptonWorkspaceCell cell = (KryptonWorkspaceCell)Navigator; if (cell.WorkspaceParent != null) { // Cell an only be inside a workspace sequence KryptonWorkspaceSequence sequence = (KryptonWorkspaceSequence)cell.WorkspaceParent; if (sequence != null) { // Remove the cell from the parent sequence.Children.Remove(cell); } } } base.OnComponentRemoving(sender, e); }
private void ComponentRemoved(object sender, ComponentEventArgs e) { BaseItem item = e.Component as BaseItem; if (item != null) { BindingNavigatorEx navigator = (BindingNavigatorEx)base.Component; if (item == navigator.MoveFirstButton) { navigator.MoveFirstButton = null; } else if (item == navigator.MovePreviousButton) { navigator.MovePreviousButton = null; } else if (item == navigator.MoveNextButton) { navigator.MoveNextButton = null; } else if (item == navigator.MoveLastButton) { navigator.MoveLastButton = null; } else if (item == navigator.PositionTextBox) { navigator.PositionTextBox = null; } else if (item == navigator.CountLabel) { navigator.CountLabel = null; } else if (item == navigator.AddNewRecordButton) { navigator.AddNewRecordButton = null; } else if (item == navigator.DeleteButton) { navigator.DeleteButton = null; } } }
private void ComponentChangeSvc_ComponentRemoved(object sender, ComponentEventArgs e) { ToolStripItem component = e.Component as ToolStripItem; if (component != null) { BindingNavigator navigator = (BindingNavigator) base.Component; if (component == navigator.MoveFirstItem) { navigator.MoveFirstItem = null; } else if (component == navigator.MovePreviousItem) { navigator.MovePreviousItem = null; } else if (component == navigator.MoveNextItem) { navigator.MoveNextItem = null; } else if (component == navigator.MoveLastItem) { navigator.MoveLastItem = null; } else if (component == navigator.PositionItem) { navigator.PositionItem = null; } else if (component == navigator.CountItem) { navigator.CountItem = null; } else if (component == navigator.AddNewItem) { navigator.AddNewItem = null; } else if (component == navigator.DeleteItem) { navigator.DeleteItem = null; } } }
private void OnComponentAdding(object sender, ComponentEventArgs eventArgs) { //We are adding root component, while doing this make sure that we provide the root designer attribute IDesignerHost designerHost = (IDesignerHost)this.serviceProvider.GetService(typeof(IDesignerHost)); if (designerHost != null) { if (designerHost.RootComponent == null) { Activity rootActivity = eventArgs.Component as Activity; if (rootActivity != null) { //Add root designer attribute DesignerAttribute rootDesignerAttrib = GetDesignerAttribute(rootActivity, typeof(IRootDesigner)); if (rootDesignerAttrib.DesignerTypeName == typeof(ActivityDesigner).AssemblyQualifiedName) { DesignerAttribute designerAttrib = GetDesignerAttribute(rootActivity, typeof(IDesigner)); if (designerAttrib != null) TypeDescriptor.AddAttributes(rootActivity, new Attribute[] { new DesignerAttribute(designerAttrib.DesignerTypeName, typeof(IRootDesigner)) }); } } } } }
static void ComponentContainerSetUp(object sender, ComponentEventArgs e) { // HACK: This reflection mess fixes SD2-1374 and SD2-1375. However I am not sure why it is needed in the first place. // There seems to be a problem with the nested container class used // by the designer. It only establishes a connection to the service // provider of the DesignerHost after it has been queried for // an IServiceContainer service. This does not always happen // automatically, so we enforce that here. We have to use // reflection because the request for IServiceContainer is // not forwarded by higher-level GetService methods. // Also, be very careful when trying to troubleshoot this using // the debugger because it automatically gets all properties and // this can cause side effects here, such as initializing that service // so that the problem no longer appears. INestedContainer nestedContainer = e.Component.Site.GetService(typeof(INestedContainer)) as INestedContainer; if (nestedContainer != null) { MethodInfo getServiceMethod = nestedContainer.GetType().GetMethod("GetService", BindingFlags.Instance | BindingFlags.NonPublic, null, new [] {typeof(Type)}, null); if (getServiceMethod != null) { LoggingService.Debug("Forms designer: Initializing nested service container of " + e.Component.ToString() + " using Reflection"); getServiceMethod.Invoke(nestedContainer, BindingFlags.InvokeMethod | BindingFlags.Instance | BindingFlags.NonPublic, null, new [] {typeof(IServiceContainer)}, null); } } }
/// <summary> /// We hook the OnComponentRemoved event so we can clean up all associated actions. /// </summary> private void OnComponentRemoved(object source, ComponentEventArgs ce) { Remove(ce.Component); }
private void OnComponentAdding (object sender, ComponentEventArgs args) { if (_currentUnit == null) _currentUnit = CreateUndoUnit ("Add " + args.Component.GetType ().Name, true); _currentUnit.ComponentAdding (args); }
private void OnComponentRemoved (object sender, ComponentEventArgs args) { if (_currentUnit == null) _currentUnit = CreateUndoUnit ("Remove " + args.Component.GetType ().Name, true); _currentUnit.ComponentRemoved (args); IDesignerHost host = GetRequiredService (typeof (IDesignerHost)) as IDesignerHost; if (!host.InTransaction) { _currentUnit.Close (); AddUndoUnit (_currentUnit); _currentUnit = null; } }
public virtual void ComponentRemoved (ComponentEventArgs e) { }
private void OnComponentRemoving (object sender, ComponentEventArgs args) { if (_currentUnit == null) _currentUnit = CreateUndoUnit ("Remove " + args.Component.Site.Name, true); _currentUnit.ComponentRemoving (args); }
private void OnComponentAdded(object sender, ComponentEventArgs ce) { if (ce.Component != null && ((IComponent)ce.Component).Site != null) { Control control = ce.Component as Control; if (control != null) { if (!_designTimeControls.ContainsKey(control.Name)) { _designTimeControls.Add(control.Name, control); } else { _designTimeControls[control.Name] = control; } } else if (ce.Component is ToolStripItem) { ToolStripItem item = ce.Component as ToolStripItem; if (!_designTimeControls.ContainsKey(item.Name)) { _designTimeToolStripItems.Add(item.Name, item); } else { _designTimeToolStripItems[item.Name] = item; } } } }
public virtual void ComponentAdding (ComponentEventArgs e) { }
private void OnComponentAdded(object sender, ComponentEventArgs args) { _references.Add(args.Component); }
public virtual void ComponentRemoving (ComponentEventArgs e) { if (!_closed) { // Console.WriteLine ("New Action: ComponentAdd*Remove*Action (" + ((IComponent)e.Component).Site.Name + ")"); _actions.Add (new ComponentAddRemoveAction (_engine, e.Component, false)); } }
private void OnComponentRemoved(object sender, ComponentEventArgs args) { _references.Remove(args.Component); }