예제 #1
0
        /// <summary>
        /// Finishes initializing component by setting up settings service and registering command</summary>
        public virtual void Initialize()
        {
            if (m_settingsService != null)
            {
                // create setting to store command shortcuts
                m_settingsService.RegisterSettings(this,
                                                   new BoundPropertyDescriptor(
                                                       this, () => CommandShortcuts, "Keyboard Shortcuts".Localize(), null, null)
                                                   );

                PropertyDescriptor[] userPrefs = new PropertyDescriptor[]
                {
                    // setting that allows user to set toolbar image size.
                    new BoundPropertyDescriptor(
                        this, () => UserSelectedImageSize, "Command Icon Size".Localize(), null, "Size of icons on Toolbar buttons".Localize())
                };
                m_settingsService.RegisterSettings(this, userPrefs);
                SettingsServices.RegisterUserSettings(m_settingsService, "Application".Localize(), userPrefs);
            }

            // Register our own "edit keyboard" command
            this.RegisterCommand(
                CommandId.EditKeyboard,
                StandardMenu.Edit,
                StandardCommandGroup.EditPreferences,
                "Keyboard Shortcuts".Localize() + " ...",
                "Customize keyboard shortcuts".Localize(),
                this);
        }
        void IInitializable.Initialize()
        {
            // subscribe as late as possible to allow other parts to load/save state before controls are created/destroyed
            m_mainForm.Load    += new EventHandler(mainForm_Load);
            m_mainForm.Closing += new CancelEventHandler(mainForm_Closing);

            m_dockPanel.SuspendLayout();

            ShowDefaultControls();

            m_dockPanel.ResumeLayout(false);

            if (m_settingsService != null)
            {
                SettingsServices.RegisterSettings(m_settingsService,
                                                  this,
                                                  new BoundPropertyDescriptor(this, "DockPanelState", "DockPanelState", null, null));
            }

            m_commandService.RegisterCommand(CommandInfo.WindowTileHorizontal, this);
            m_commandService.RegisterCommand(CommandInfo.WindowTileVertical, this);
            m_commandService.RegisterCommand(CommandInfo.WindowTileTabbed, this);
        }