コード例 #1
0
        protected override void OnClosed(EventArgs e)
        {
            if (!IsActivated)
            {
                // Do nothing
            }
            else
            {
                IndentGuideService service = Site != null?Site.GetService(typeof(SIndentGuide)) as IndentGuideService : null;

                if (service != null)
                {
                    if (ShouldSave)
                    {
                        service.AcceptSettings();
                    }
                    else
                    {
                        service.RollbackSettings();
                    }
                }
            }

            // Settings are saved automatically by the final accept/rollback.
            IsActivated = false;

            Wrapper.Close();
            base.OnClosed(e);
        }
コード例 #2
0
        public ThemeOptionsControl(IThemeAwareDialog child)
        {
            InitializeComponent();

            Child = child;
            Control control = child as Control;

            Debug.Assert(Child != null);
            Debug.Assert(control != null);

            tableContent.Controls.Add(control);
            tableContent.SetColumn(control, 0);
            tableContent.SetRow(control, 1);
            control.Dock = DockStyle.Fill;

            ServiceProvider provider = ServiceProvider.GlobalProvider;

            Service       = provider.GetService(typeof(SIndentGuide)) as IndentGuideService;
            Child.Service = Service;

            TextManagerService = (IVsTextManager)provider.GetService(typeof(SVsTextManager));

            IComponentModel componentModel = (IComponentModel)provider.GetService(typeof(SComponentModel));

            EditorAdapters = componentModel
                             .GetService <IVsEditorAdaptersFactoryService>();

            ActiveThemeChanged += ActiveTheme_Changed;
        }
コード例 #3
0
        protected override void OnActivate(CancelEventArgs e)
        {
            if (IsActivated == false)
            {
                IndentGuideService service = Site != null?Site.GetService(typeof(SIndentGuide)) as IndentGuideService : null;

                if (service != null)
                {
                    service.PreserveSettings();
                }
                IsActivated = true;
                ShouldSave  = false;
            }

            base.OnActivate(e);
            Wrapper.Activate();
        }