Beispiel #1
0
        public AdditionalFileLayoutOptionsPage(Lifetime lifetime, OptionsPageContext optionsPageContext,
                                               OptionsSettingsSmartContext optionsSettingsSmartContext,
                                               RiderDialogHost dialogHost)
            : base(lifetime, optionsPageContext, optionsSettingsSmartContext)
        {
            var fileLayoutSettings = new AdditionalFileLayoutSettingsHelper(lifetime, optionsSettingsSmartContext, dialogHost);
            var textControl        = BeControls.GetLanguageTextControl(fileLayoutSettings.Text, lifetime, false, myFileLayoutLanguage, DummyFileName, true);
            var toolbar            = BeControls.GetToolbar(textControl);

            var emptyPatternItem = BeControls.GetButton("Empty", lifetime, () => fileLayoutSettings.LoadDefaultPattern(DefaultPatternKind.Empty));
            var defaultPatternWithoutRegionsItem = BeControls.GetButton("Default", lifetime, () => fileLayoutSettings.LoadDefaultPattern(DefaultPatternKind.WithoutRegions));
            var defaultPatternWithRegionsItem    = BeControls.GetButton("Default with regions", lifetime, () => fileLayoutSettings.LoadDefaultPattern(DefaultPatternKind.WithRegions));

            toolbar.AddItem("Load patterns:".GetBeLabel());
            toolbar.AddItem(emptyPatternItem);
            toolbar.AddItem(defaultPatternWithoutRegionsItem);
            toolbar.AddItem(defaultPatternWithRegionsItem);

            var grid = BeControls.GetGrid();

            grid.AddElement(toolbar, BeSizingType.Fill);

            var margin = BeMargins.Create(5, 1, 5, 1);

            AddControl(grid.WithMargin(margin), true);

            AddKeyword("File Layout");
        }
Beispiel #2
0
        private BeControl AddListControl <TKeyClass>(Expression <Func <TKeyClass, string> > lambdaExpression,
                                                     string[] defaults, string description)
        {
            var property = new Property <string>(description);

            OptionsSettingsSmartContext.SetBinding(Lifetime, lambdaExpression, property);
            if (string.IsNullOrEmpty(property.Value))
            {
                property.Value = string.Join("\n", defaults);
            }

            var model = new StringListViewModel(Lifetime, property);

            var list = model.SelectedEntry.GetBeSingleSelectionListWithToolbar(
                model.Entries,
                Lifetime,
                (entryLt, entry, properties) => new List <BeControl>
            {
                entry.Value.GetBeTextBox(entryLt)
                .WithValidationRule <BeTextBox, string>(
                    Lifetime,
                    value => !value.IsEmpty(),
                    "Value must not be empty.")
            },
                iconHost: _iconHost,
                columnsAndSizes: new[] { "Value,*" },
                dock: BeDock.RIGHT)
                       .AddButtonWithListAction(BeListAddAction.ADD, i => model.CreateNewEntry())
                       .AddButtonWithListAction <StringListViewModel.StringListEntry>(BeListAction.REMOVE, i => model.OnEntryRemoved())
                       .AddButtonWithListAction <StringListViewModel.StringListEntry>(BeListAction.MOVE_UP, i => model.OnEntryMoved())
                       .AddButtonWithListAction <StringListViewModel.StringListEntry>(BeListAction.MOVE_DOWN, i => model.OnEntryMoved());

            var grid  = BeControls.GetGrid();
            var label = description.GetBeLabel();

            grid.AddElement(label);
            grid.AddElement(list);
            AddKeyword(description);

            AddControl(grid.WithMargin(BeMargins.Create(SideMargin, TopMargin, SideMargin)));

            return(list);
        }