internal ComponentCache(IDesignerSerializationManager manager) { this.serManager = manager; IComponentChangeService service = (IComponentChangeService)manager.GetService(typeof(IComponentChangeService)); if (service != null) { service.ComponentChanging += new ComponentChangingEventHandler(this.OnComponentChanging); service.ComponentChanged += new ComponentChangedEventHandler(this.OnComponentChanged); service.ComponentRemoving += new ComponentEventHandler(this.OnComponentRemove); service.ComponentRemoved += new ComponentEventHandler(this.OnComponentRemove); service.ComponentRename += new ComponentRenameEventHandler(this.OnComponentRename); } DesignerOptionService service2 = manager.GetService(typeof(DesignerOptionService)) as DesignerOptionService; object obj2 = null; if (service2 != null) { PropertyDescriptor descriptor = service2.Options.Properties["UseOptimizedCodeGeneration"]; if (descriptor != null) { obj2 = descriptor.GetValue(null); } if ((obj2 != null) && (obj2 is bool)) { this.enabled = (bool)obj2; } } }
private void UseNewOptionService(DesignerOptionService opsServiceNew) { IServiceContainer serviceProvider = this.GetService(typeof(IServiceContainer)) as IServiceContainer; DesignerOptionService opsService = serviceProvider.GetService(typeof(DesignerOptionService)) as DesignerOptionService; if (null != opsService) { serviceProvider.RemoveService(typeof(DesignerOptionService)); } serviceProvider.AddService(typeof(DesignerOptionService), opsServiceNew); }
public void UseNoGuides() { serviceProvider = this.GetService(typeof(IServiceContainer)) as IServiceContainer; opsService = serviceProvider.GetService(typeof(DesignerOptionService)) as DesignerOptionService; if (null != opsService) { serviceProvider.RemoveService(typeof(DesignerOptionService)); } DesignerOptionService opsService2 = new DesignerOptionServiceExt4NoGuides(); serviceProvider.AddService(typeof(DesignerOptionService), opsService2); }
public void UseGridWithoutSnapping(Size gridSize) { IServiceContainer serviceProvider = this.GetService(typeof(IServiceContainer)) as IServiceContainer; DesignerOptionService opsService = serviceProvider.GetService(typeof(DesignerOptionService)) as DesignerOptionService; if (null != opsService) { serviceProvider.RemoveService(typeof(DesignerOptionService)); } DesignerOptionService opsService2 = new DesignerOptionServiceExt4GridWithoutSnapping(gridSize); serviceProvider.AddService(typeof(DesignerOptionService), opsService2); }
public void SetOptions() { IServiceContainer serviceProvider = this.GetService(typeof(IServiceContainer)) as IServiceContainer; DesignerOptionService opsService = serviceProvider.GetService(typeof(DesignerOptionService)) as DesignerOptionService; if (null != opsService) { serviceProvider.RemoveService(typeof(DesignerOptionService)); } DesignerOptionService opsService2 = new SMDesignerOptions(); serviceProvider.AddService(typeof(DesignerOptionService), opsService2); }
public static bool UseSnapLines(IServiceProvider provider) { bool flag = true; object obj2 = null; DesignerOptionService service = provider.GetService(typeof(DesignerOptionService)) as DesignerOptionService; if (service != null) { PropertyDescriptor descriptor = service.Options.Properties["UseSnapLines"]; if (descriptor != null) { obj2 = descriptor.GetValue(null); } } if ((obj2 != null) && (obj2 is bool)) { flag = (bool)obj2; } return(flag); }
public SelectionManager(IServiceProvider serviceProvider, BehaviorService behaviorService) { this.behaviorService = behaviorService; this.serviceProvider = serviceProvider; this.selSvc = (ISelectionService)serviceProvider.GetService(typeof(ISelectionService)); this.designerHost = (IDesignerHost)serviceProvider.GetService(typeof(IDesignerHost)); if (this.designerHost != null) { ISelectionService selSvc = this.selSvc; } behaviorService.BeginDrag += new BehaviorDragDropEventHandler(this.OnBeginDrag); behaviorService.Synchronize += new EventHandler(this.OnSynchronize); this.selSvc.SelectionChanged += new EventHandler(this.OnSelectionChanged); this.rootComponent = (Control)this.designerHost.RootComponent; this.selectionAdorner = new Adorner(); this.bodyAdorner = new Adorner(); behaviorService.Adorners.Add(this.bodyAdorner); behaviorService.Adorners.Add(this.selectionAdorner); this.componentToDesigner = new Hashtable(); IComponentChangeService service = (IComponentChangeService)serviceProvider.GetService(typeof(IComponentChangeService)); if (service != null) { service.ComponentAdded += new ComponentEventHandler(this.OnComponentAdded); service.ComponentRemoved += new ComponentEventHandler(this.OnComponentRemoved); service.ComponentChanged += new ComponentChangedEventHandler(this.OnComponentChanged); } this.designerHost.TransactionClosed += new DesignerTransactionCloseEventHandler(this.OnTransactionClosed); DesignerOptionService service2 = this.designerHost.GetService(typeof(DesignerOptionService)) as DesignerOptionService; if (service2 != null) { PropertyDescriptor descriptor = service2.Options.Properties["UseSmartTags"]; if (((descriptor != null) && (descriptor.PropertyType == typeof(bool))) && ((bool)descriptor.GetValue(null))) { this.designerActionUI = new DesignerActionUI(serviceProvider, this.selectionAdorner); behaviorService.DesignerActionUI = this.designerActionUI; } } }
public static object GetOptionValue(IServiceProvider provider, string name) { object optionValue = null; if (provider != null) { DesignerOptionService service = provider.GetService(typeof(DesignerOptionService)) as DesignerOptionService; if (service != null) { PropertyDescriptor descriptor = service.Options.Properties[name]; if (descriptor != null) { optionValue = descriptor.GetValue(null); } return(optionValue); } IDesignerOptionService service2 = provider.GetService(typeof(IDesignerOptionService)) as IDesignerOptionService; if (service2 != null) { optionValue = service2.GetOptionValue(@"WindowsFormsDesigner\General", name); } } return(optionValue); }
internal DesignerOptionCollection (DesignerOptionCollection parent, string name, object propertiesProvider, DesignerOptionService service) { _name = name; _propertiesProvider = propertiesProvider; _parent = parent; if (parent != null) { if (parent._children == null) parent._children = new ArrayList (); parent._children.Add (this); } _children = new ArrayList (); _optionService = service; service.PopulateOptionCollection (this); }