Esempio n. 1
0
        public AStyleOptionsControl(AStyleOptionsPage astyleOptionsPage)
        {
            InitializeComponent();

            void InitializeOptionPanel(TableLayoutPanel panel, AStyleOptionControl[] options)
            {
                panel.ColumnStyles.Clear();
                panel.RowStyles.Clear();
                foreach (AStyleOptionControl option in options)
                {
                    option.Changed += OnOptionChanged;

                    panel.Controls.Add(option);
                }
            }

            InitializeOptionPanel(tableLayoutPanel1, braceStyleOptions);
            InitializeOptionPanel(tableLayoutPanel2, tabOptions);
            InitializeOptionPanel(tableLayoutPanel3, braceModifyOptions);
            InitializeOptionPanel(tableLayoutPanel4, indentationOptions);
            InitializeOptionPanel(tableLayoutPanel5, paddingOptions);
            InitializeOptionPanel(tableLayoutPanel6, formattingOptions);

            this.astyleOptionsPage = astyleOptionsPage;

            commandLineTextBox.TextChanged -= CommandLineTextBoxChanged;
            commandLineTextBox.Text         = astyleOptionsPage.CommandLine;
            commandLineTextBox.TextChanged += CommandLineTextBoxChanged;

            ParseCommandLine(commandLineTextBox.Text);
        }
Esempio n. 2
0
        protected override async Task InitializeAsync(CancellationToken cancellationToken, IProgress <ServiceProgressData> progress)
        {
            await JoinableTaskFactory.SwitchToMainThreadAsync(cancellationToken);

            dte = await GetServiceAsync(typeof(DTE)) as DTE;

            rdt = GetGlobalService(typeof(SVsRunningDocumentTable)) as IVsRunningDocumentTable;
            rdt.AdviseRunningDocTableEvents(this, out cookie);

            OleMenuCommandService commandService = await GetServiceAsync(typeof(IMenuCommandService)) as OleMenuCommandService;

            //Assumes.Present(commandService);

            OleMenuCommand command = new OleMenuCommand(FormatDocumentCall, null, OnBeforeQueryStatus, new CommandID(new Guid("497A6C02-150A-4169-A09B-8592571306B9"), 0x0100));

            commandService.AddCommand(command);

            generalOptionsPage = GetDialogPage(typeof(GeneralOptionsPage)) as GeneralOptionsPage;
            csOptionsPage      = GetDialogPage(typeof(CSharpOptionsPage)) as AStyleOptionsPage;
            cppOptionsPage     = GetDialogPage(typeof(COptionsPage)) as AStyleOptionsPage;
        }