public virtual void Initialize(IComponent component)
        {
            ControlDesigner.VerifyInitializeArgument(component, typeof(TemplateControl));
            this._component = component;
            IServiceContainer container = (IServiceContainer)this.GetService(typeof(IServiceContainer));

            if (container != null)
            {
                this._urlResolutionService = this.CreateUrlResolutionService();
                if (this._urlResolutionService != null)
                {
                    container.AddService(typeof(IUrlResolutionService), this._urlResolutionService);
                }
                this._designerActionService   = this.CreateDesignerActionService(this._component.Site);
                this._designerActionUIService = new DesignerActionUIService(this._component.Site);
                ServiceCreatorCallback callback = new ServiceCreatorCallback(this.OnCreateService);
                container.AddService(typeof(IImplicitResourceProvider), callback);
            }
            IPropertyValueUIService service = (IPropertyValueUIService)this.GetService(typeof(IPropertyValueUIService));

            if (service != null)
            {
                service.AddPropertyValueUIHandler(new PropertyValueUIHandler(this.OnGetUIValueItem));
            }
        }
示例#2
0
        public override void Initialize(System.ComponentModel.IComponent component)
        {
            base.Initialize(component);
            DesignerActionService service = this.GetService(typeof(DesignerActionService)) as DesignerActionService;

            if (service != null)
            {
                service.Remove(component);
            }
        }
示例#3
0
        public override void Initialize(System.ComponentModel.IComponent component)
        {
            base.Initialize(component);
            //base.Glyphs.Add(new WizardPageDesignerGlyph(this));
            DesignerActionService service = GetService(typeof(DesignerActionService)) as DesignerActionService;

            if (service != null)
            {
                service.Remove(component);
            }
        }
示例#4
0
        // This utility method connects the designer to various
        // services it will use.
        private void InitializeServices()
        {
            // Acquire a reference to DesignerActionService.
            this.actionService = GetService(typeof(DesignerActionService)) as DesignerActionService;

            // Acquire a reference to DesignerActionUIService.
            this.actionUiService = GetService(typeof(DesignerActionUIService)) as DesignerActionUIService;

            // Acquire a reference to IComponentChangeService.
            this.changeService = GetService(typeof(IComponentChangeService)) as IComponentChangeService;

            // Acquire a reference to IDesignerHost.
            this.host = GetService(typeof(IDesignerHost)) as IDesignerHost;

            // Acquire a reference to IDesignerOptionService.
            this.optionService =
                GetService(typeof(IDesignerOptionService)) as IDesignerOptionService;

            // Acquire a reference to IEventBindingService.
            this.eventBindingService =
                GetService(typeof(IEventBindingService)) as IEventBindingService;

            // Acquire a reference to IExtenderListService.
            this.listService =
                GetService(typeof(IExtenderListService)) as IExtenderListService;

            // Acquire a reference to IReferenceService.
            this.referenceService =
                GetService(typeof(IReferenceService)) as IReferenceService;

            // Acquire a reference to ITypeResolutionService.
            this.typeResService = GetService(typeof(ITypeResolutionService))
                                  as ITypeResolutionService;

            // Acquire a reference to IComponentDiscoveryService.
            this.componentDiscoveryService = GetService(typeof(IComponentDiscoveryService))
                                             as IComponentDiscoveryService;

            // Acquire a reference to IToolboxService.
            this.toolboxService = GetService(typeof(IToolboxService)) as IToolboxService;

            // Acquire a reference to UndoEngine.
            this.undoEng = GetService(typeof(UndoEngine)) as UndoEngine;

            if (this.undoEng != null)
            {
                //MessageBox.Show("UndoEngine");
            }
        }
示例#5
0
        internal DesignerActionUIService(IServiceProvider serviceProvider)
        {
            _serviceProvider = serviceProvider;

            if (serviceProvider != null)
            {
                _serviceProvider = serviceProvider;

                IDesignerHost host = (IDesignerHost)serviceProvider.GetService(typeof(IDesignerHost));
                host.AddService(typeof(DesignerActionUIService), this);

                _designerActionService = serviceProvider.GetService(typeof(DesignerActionService)) as DesignerActionService;
                Debug.Assert(_designerActionService != null, "we should have created and registered the DAService first");
            }
        }
示例#6
0
        /*private static string[] propsToRemove = new string[] { "Anchor", "AutoScrollOffset", "AutoSize", "BackColor",
         *      "BackgroundImage", "BackgroundImageLayout", "ContextMenuStrip", "Cursor", "Dock", "Enabled", "Font",
         *      "ForeColor", "Location", "Margin", "MaximumSize", "MinimumSize", "Padding", "Size", "TabStop", "UseWaitCursor",
         *      "Visible" };
         *
         * protected override void PreFilterProperties(System.Collections.IDictionary properties)
         * {
         *      base.PreFilterProperties(properties);
         *      foreach (string p in propsToRemove)
         *              if (properties.Contains(p))
         *                      properties.Remove(p);
         * }*/

        public override void Initialize(System.ComponentModel.IComponent component)
        {
            base.Initialize(component);

            if (this.Control is HidableDetailPanel)
            {
                this.EnableDesignMode(((HidableDetailPanel)this.Control).DetailArea, "DetailArea");
            }

            DesignerActionService service = this.GetService(typeof(DesignerActionService)) as DesignerActionService;

            if (service != null)
            {
                service.Remove(component);
            }
        }
 public void Dispose()
 {
     if (this.marshalingControl != null)
     {
         this.marshalingControl.Dispose();
         this.marshalingControl = null;
     }
     if (this.serviceProvider != null)
     {
         IComponentChangeService service = (IComponentChangeService)this.serviceProvider.GetService(typeof(IComponentChangeService));
         if (service != null)
         {
             service.ComponentChanged -= new ComponentChangedEventHandler(this.OnComponentChanged);
         }
         if (this.cmdShowDesignerActions != null)
         {
             IMenuCommandService service2 = (IMenuCommandService)this.serviceProvider.GetService(typeof(IMenuCommandService));
             if (service2 != null)
             {
                 service2.RemoveCommand(this.cmdShowDesignerActions);
             }
         }
     }
     this.serviceProvider = null;
     this.behaviorService = null;
     this.selSvc          = null;
     if (this.designerActionService != null)
     {
         this.designerActionService.DesignerActionListsChanged -= new DesignerActionListsChangedEventHandler(this.OnDesignerActionsChanged);
         if (this.disposeActionService)
         {
             this.designerActionService.Dispose();
         }
     }
     this.designerActionService = null;
     if (this.designerActionUIService != null)
     {
         this.designerActionUIService.DesignerActionUIStateChange -= new DesignerActionUIStateChangeEventHandler(this.OnDesignerActionUIStateChange);
         if (this.disposeActionUIService)
         {
             this.designerActionUIService.Dispose();
         }
     }
     this.designerActionUIService = null;
     this.designerActionAdorner   = null;
 }
 /// <summary>
 /// Removes the duplicate DockingActionList added by this designer to the <see cref="DesignerActionService"/>.
 /// </summary>
 /// <remarks>
 /// <see cref="ControlDesigner.Initialize"/> adds an internal DockingActionList : 'Dock/Undock in Parent Container'.
 /// But the default designer has already added that action list. So we need to remove one.
 /// </remarks>
 private void RemoveDuplicateDockingActionList() {
     // This is a true hack -- in a class that is basically a huge hack itself.
     // Reach into the bowel of our base class, get a private field, and use that fields value to
     // remove an action from the designer.
     // In ControlDesigner, there is "private DockingActionList dockingAction;"
     // Don't you just love Reflector?!
     FieldInfo fi = typeof(ControlDesigner).GetField("dockingAction", BindingFlags.Instance | BindingFlags.NonPublic);
     if (fi != null) {
         DesignerActionList dockingAction = (DesignerActionList)fi.GetValue(this);
         if (dockingAction != null) {
             DesignerActionService service = (DesignerActionService)GetService(typeof(DesignerActionService));
             if (service != null) {
                 service.Remove(this.Control, dockingAction);
             }
         }
     }
 }
 public DesignerActionUI(IServiceProvider serviceProvider, Adorner containerAdorner)
 {
     this.serviceProvider       = serviceProvider;
     this.designerActionAdorner = containerAdorner;
     this.behaviorService       = (BehaviorService)serviceProvider.GetService(typeof(BehaviorService));
     this.menuCommandService    = (IMenuCommandService)serviceProvider.GetService(typeof(IMenuCommandService));
     this.selSvc = (ISelectionService)serviceProvider.GetService(typeof(ISelectionService));
     if ((this.behaviorService != null) && (this.selSvc != null))
     {
         this.designerActionService = (DesignerActionService)serviceProvider.GetService(typeof(DesignerActionService));
         if (this.designerActionService == null)
         {
             this.designerActionService = new DesignerActionService(serviceProvider);
             this.disposeActionService  = true;
         }
         this.designerActionUIService = (DesignerActionUIService)serviceProvider.GetService(typeof(DesignerActionUIService));
         if (this.designerActionUIService == null)
         {
             this.designerActionUIService = new DesignerActionUIService(serviceProvider);
             this.disposeActionUIService  = true;
         }
         this.designerActionUIService.DesignerActionUIStateChange += new DesignerActionUIStateChangeEventHandler(this.OnDesignerActionUIStateChange);
         this.designerActionService.DesignerActionListsChanged    += new DesignerActionListsChangedEventHandler(this.OnDesignerActionsChanged);
         this.lastPanelComponent = null;
         IComponentChangeService service = (IComponentChangeService)serviceProvider.GetService(typeof(IComponentChangeService));
         if (service != null)
         {
             service.ComponentChanged += new ComponentChangedEventHandler(this.OnComponentChanged);
         }
         if (this.menuCommandService != null)
         {
             this.cmdShowDesignerActions = new MenuCommand(new EventHandler(this.OnKeyShowDesignerActions), MenuCommands.KeyInvokeSmartTag);
             this.menuCommandService.AddCommand(this.cmdShowDesignerActions);
         }
         this.uiService = (IUIService)serviceProvider.GetService(typeof(IUIService));
         if (this.uiService != null)
         {
             this.mainParentWindow = this.uiService.GetDialogOwnerWindow();
         }
         this.componentToGlyph  = new Hashtable();
         this.marshalingControl = new Control();
         this.marshalingControl.CreateControl();
     }
 }
示例#10
0
        /// <summary>
        /// Initializes a new instance of the UpgradeHelpers.Windows.Forms.ExtendedGridView class with the corresponding container
        /// </summary>
        /// <param name="container">The container where the Grid is going to be hosted</param>
        public DataGridViewFlex(IContainer container)
        {
            DoubleBuffered = true;
            InitializeComponent();
            _controlKeyDown           = new KeyEventHandler(control_KeyDown);
            _controlKeyUp             = new KeyEventHandler(control_KeyUp);
            _controlKeyPress          = new KeyPressEventHandler(control_KeyPress);
            this.CellMouseEnter      -= new DataGridViewCellEventHandler(ExtendedDataGridView_CellMouseEnter);
            this.CellMouseEnter      += new DataGridViewCellEventHandler(ExtendedDataGridView_CellMouseEnter);
            this.RowHeaderMouseClick += ExtendedDataGridView_RowHeaderMouseClick;
            isInitializing            = false;
            Reset();
            #region Designer related code

            IServiceContainer serviceContainer = container as IServiceContainer;
            if (serviceContainer != null)
            {
                ExtendedDataGridViewPropertyFilter newMyFilter = new ExtendedDataGridViewPropertyFilter();
                DesignerActionService designerActionService    = serviceContainer.GetService(typeof(DesignerActionService)) as DesignerActionService;
                //DesignerActionUIService designerActionUIService = serviceContainer.GetService(typeof(DesignerActionUIService)) as DesignerActionUIService;
                newMyFilter.oldService            = (ITypeDescriptorFilterService)serviceContainer.GetService(typeof(ITypeDescriptorFilterService));
                newMyFilter.designerActionService = designerActionService;
                //newMyFilter.designerActionUIService = designerActionUIService;
                if (newMyFilter.oldService != null)
                {
                    serviceContainer.RemoveService(typeof(ITypeDescriptorFilterService));
                }

                serviceContainer.AddService(typeof(ITypeDescriptorFilterService), newMyFilter);
            }

            // Acquire a reference to IComponentChangeService
            //This service is used during design to make sure that we do not allow the user
            //to edit Columns properties when the grid is in MSFlexGrid compatibility
            IComponentChangeService changeService = container as IComponentChangeService;
            if (changeService != null)
            {
                changeEventHandler = new ComponentChangingEventHandler(changeService_ComponentChanging);
                changeService.ComponentChanging -= changeEventHandler;
                changeService.ComponentChanging += changeEventHandler;
            }
            #endregion
        }
示例#11
0
        public RecordingTimerControl()
        {
            InitializeComponent();

            if (DesignerProperties.GetIsInDesignMode(this))
            {
                ActionService         = new DesignerActionService();
                SettingService        = new DesignerAppSettingService();
                AudioRecordingService = new DesignerAudioRecordingService();

                return;
            }
            else
            {
                // ToDo: Evil Hack to have the cake (see actual design in design mode) and eat it too (have different styles at runtime)
                this.Resources = null;

                ActionService         = UnityHandler.UnityContainer.Resolve <IActionService>();
                SettingService        = UnityHandler.UnityContainer.Resolve <IAppSettingService>();
                AudioRecordingService = UnityHandler.UnityContainer.Resolve <IAudioRecordingService>();
            }
        }
示例#12
0
    // </snippet6>

    // <snippet7>
    // This utility method connects the designer to various
    // services it will use.
    private void InitializeServices()
    {
        // Acquire a reference to DesignerActionService.
        this.actionService =
            GetService(typeof(DesignerActionService))
            as DesignerActionService;

        // Acquire a reference to DesignerActionUIService.
        this.actionUiService =
            GetService(typeof(DesignerActionUIService))
            as DesignerActionUIService;

        // Acquire a reference to IComponentChangeService.
        this.changeService =
            GetService(typeof(IComponentChangeService))
            as IComponentChangeService;

        // <snippet14>
        // Hook the IComponentChangeService events.
        if (this.changeService != null)
        {
            this.changeService.ComponentChanged +=
                new ComponentChangedEventHandler(
                    ChangeService_ComponentChanged);

            this.changeService.ComponentAdded +=
                new ComponentEventHandler(
                    ChangeService_ComponentAdded);

            this.changeService.ComponentRemoved +=
                new ComponentEventHandler(
                    changeService_ComponentRemoved);
        }
        // </snippet14>

        // Acquire a reference to ISelectionService.
        this.selectionService =
            GetService(typeof(ISelectionService))
            as ISelectionService;

        // Hook the SelectionChanged event.
        if (this.selectionService != null)
        {
            this.selectionService.SelectionChanged +=
                new EventHandler(selectionService_SelectionChanged);
        }

        // Acquire a reference to IDesignerEventService.
        this.eventService =
            GetService(typeof(IDesignerEventService))
            as IDesignerEventService;

        if (this.eventService != null)
        {
            this.eventService.ActiveDesignerChanged +=
                new ActiveDesignerEventHandler(
                    eventService_ActiveDesignerChanged);
        }

        // Acquire a reference to IDesignerHost.
        this.host =
            GetService(typeof(IDesignerHost))
            as IDesignerHost;

        // Acquire a reference to IDesignerOptionService.
        this.optionService =
            GetService(typeof(IDesignerOptionService))
            as IDesignerOptionService;

        // Acquire a reference to IEventBindingService.
        this.eventBindingService =
            GetService(typeof(IEventBindingService))
            as IEventBindingService;

        // Acquire a reference to IExtenderListService.
        this.listService =
            GetService(typeof(IExtenderListService))
            as IExtenderListService;

        // Acquire a reference to IReferenceService.
        this.referenceService =
            GetService(typeof(IReferenceService))
            as IReferenceService;

        // Acquire a reference to ITypeResolutionService.
        this.typeResService =
            GetService(typeof(ITypeResolutionService))
            as ITypeResolutionService;

        // Acquire a reference to IComponentDiscoveryService.
        this.componentDiscoveryService =
            GetService(typeof(IComponentDiscoveryService))
            as IComponentDiscoveryService;

        // Acquire a reference to IToolboxService.
        this.toolboxService =
            GetService(typeof(IToolboxService))
            as IToolboxService;

        // Acquire a reference to UndoEngine.
        this.undoEng =
            GetService(typeof(UndoEngine))
            as UndoEngine;

        if (this.undoEng != null)
        {
            MessageBox.Show("UndoEngine");
        }
    }