Ejemplo n.º 1
0
        public AsyncConverterConfigureAwaitPage([NotNull] Lifetime lifetime, [NotNull] OptionsSettingsSmartContext store,
                                                IPromptWinForm promptWinForms)
            : base(lifetime, store)
        {
            AddHeader("In class and method will be ignored ConfigureAwait suggestion");
            var editItemViewModelFactory = new DefaultCollectionEditItemViewModelFactory(null);
            var buttonProviderFactory    = new DefaultButtonProviderFactory(lifetime, promptWinForms, editItemViewModelFactory);
            var attributeTypes           = new StringCollectionEditViewModel(lifetime, "Attributes:",
                                                                             buttonProviderFactory, editItemViewModelFactory);

            foreach (var type in store.EnumIndexedValues(AsyncConverterSettingsAccessor.ConfigureAwaitIgnoreAttributeTypes))
            {
                attributeTypes.AddItem(type);
            }

            attributeTypes.Items.CollectionChanged += (o, e) =>
            {
                foreach (
                    var entryIndex in
                    OptionsSettingsSmartContext.EnumEntryIndices(AsyncConverterSettingsAccessor.ConfigureAwaitIgnoreAttributeTypes)
                    .ToArray())
                {
                    OptionsSettingsSmartContext.RemoveIndexedValue(AsyncConverterSettingsAccessor.ConfigureAwaitIgnoreAttributeTypes,
                                                                   entryIndex);
                }
                foreach (
                    var editItemViewModel in
                    attributeTypes.Items)
                {
                    OptionsSettingsSmartContext.SetIndexedValue(AsyncConverterSettingsAccessor.ConfigureAwaitIgnoreAttributeTypes,
                                                                editItemViewModel.PresentableName, editItemViewModel.PresentableName);
                }
            };
            AddCustomOption(attributeTypes);
        }
        private void InitControls()
        {
            using (new LayoutSuspender(this))
            {
                var tablePanel = new TableLayoutPanel
                {
                    AutoSizeMode = AutoSizeMode.GrowAndShrink,
                    Margin       = Padding.Empty,
                    Padding      = Padding.Empty,
                    Size         = ClientSize
                };
                tablePanel.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 100f));
                tablePanel.RowStyles.Add(new RowStyle(SizeType.AutoSize));
                tablePanel.RowStyles.Add(new RowStyle(SizeType.Percent, 50f));
                Controls.Add(tablePanel);

                GroupingEvent sizeEvent = Environment.Threading.GroupingEvents[Rgc.Invariant].CreateEvent(
                    _lifetime,
                    Pid + ".SizeChanged",
                    TimeSpan.FromMilliseconds(300.0), () =>
                {
                    var clientSize = new Size(ClientSize.Width - _margin, ClientSize.Height - _margin);
                    if (!clientSize.Equals(tablePanel.Size))
                    {
                        using (new LayoutSuspender(this))
                        {
                            tablePanel.Size = clientSize;
                        }
                    }
                });
                EventHandler handler = (sender, args) => sizeEvent.FireIncoming();
                _lifetime.AddBracket(() => SizeChanged += handler, () => SizeChanged -= handler);

                string titleCaption = "Specify external file and directory paths to include in the code inspection. " +
                                      "Relative paths are relative to the directory containing the project. " +
                                      "Exclusions specified in the Generated Code settings apply." +
                                      System.Environment.NewLine +
                                      "NOTE: Changes do not take affect until project is loaded." +
                                      System.Environment.NewLine;
                var titleLabel = new Controls.Label(titleCaption)
                {
                    AutoSize = true, Dock = DockStyle.Top
                };
                tablePanel.Controls.Add(titleLabel);

                string[] externalCodePaths = _settings.EnumIndexedValues(ExternalCodeSettingsAccessor.Paths).ToArray();
                _externalCodePathsCollectionEdit = new StringCollectionEdit(Environment, "External files and directories:", null, _mainWindow, _windowsHookManager, _formValidators)
                {
                    Dock = DockStyle.Fill
                };
                _externalCodePathsCollectionEdit.Items.Value = externalCodePaths;
                tablePanel.Controls.Add(_externalCodePathsCollectionEdit, 0, 1);
            }
        }
Ejemplo n.º 3
0
        private void InitControls()
        {
            using (new LayoutSuspender(this))
            {
                TableLayoutPanel tablePanel = new TableLayoutPanel
                {
                    AutoSizeMode = AutoSizeMode.GrowAndShrink,
                    Margin       = Padding.Empty,
                    Padding      = Padding.Empty,
                    Size         = ClientSize
                };
                tablePanel.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 100f));
                tablePanel.RowStyles.Add(new RowStyle(SizeType.AutoSize));
                tablePanel.RowStyles.Add(new RowStyle(SizeType.Percent, 25f));
                tablePanel.RowStyles.Add(new RowStyle(SizeType.AutoSize));
                tablePanel.RowStyles.Add(new RowStyle(SizeType.Percent, 25f));
                Controls.Add(tablePanel);

                GroupingEvent sizeEvent = Environment.Threading.GroupingEvents[Rgc.Invariant].CreateEvent(
                    m_lifetime,
                    PID + ".SizeChanged",
                    TimeSpan.FromMilliseconds(300.0), () =>
                {
                    Size clientSize = new Size(ClientSize.Width - MARGIN, ClientSize.Height - MARGIN);
                    if (!clientSize.Equals(tablePanel.Size))
                    {
                        using (new LayoutSuspender(this))
                        {
                            tablePanel.Size = clientSize;
                        }
                    }
                });
                EventHandler handler = (sender, args) => sizeEvent.FireIncoming();
                m_lifetime.AddBracket(() => SizeChanged += handler, () => SizeChanged -= handler);

                string titleCaption = "Specify Unity Classes" +
                                      System.Environment.NewLine;
                Controls.Label titleLabel = new Controls.Label(titleCaption)
                {
                    AutoSize = true, Dock = DockStyle.Top
                };
                tablePanel.Controls.Add(titleLabel);

                string[] unityClasses = m_settings.EnumIndexedValues(UnitySettingsAccessor.UnityClasses).ToArray();
                m_unityClassesCollectionEdit = new StringCollectionEdit(Environment,
                                                                        "Unity Classes:", null, m_mainWindow, m_windowsHookManager, m_formValidators)
                {
                    Dock = DockStyle.Fill
                };
                m_unityClassesCollectionEdit.Items.Value = unityClasses;
                tablePanel.Controls.Add(m_unityClassesCollectionEdit, 0, 1);

                string attributesTitleCaption = "Implicit Attributes" +
                                                System.Environment.NewLine;
                Controls.Label attributesTitleLabel = new Controls.Label(attributesTitleCaption)
                {
                    AutoSize = true, Dock = DockStyle.Top
                };
                tablePanel.Controls.Add(attributesTitleLabel, 0, 2);

                string[] unityAttributes = m_settings.EnumIndexedValues(UnitySettingsAccessor.UnityAttributes).ToArray();
                m_unityAttributesCollectionEdit = new StringCollectionEdit(Environment,
                                                                           "Unity Attributes:", null, m_mainWindow, m_windowsHookManager, m_formValidators)
                {
                    Dock = DockStyle.Fill
                };
                m_unityAttributesCollectionEdit.Items.Value = unityAttributes;
                tablePanel.Controls.Add(m_unityAttributesCollectionEdit, 0, 3);
            }
        }