Пример #1
0
        public PluginSettingsPageControl()
        {
            // new up the view model
            Model       = new PluginSettingsViewModel();
            DataContext = Model;

            // apply bindings
            tB_Port
            .TextBinding
            .BindDataContext(
                Binding
                .Property((PluginSettingsViewModel m) => m.Port)
                .Convert(r => r.ToString(), int.Parse)
                );

            eDD_PreviewType.SelectedValueBinding.Bind(Model, m => m.PreviewType);

            cB_ShouldScale.CheckedBinding.Bind(Model, m => m.ShouldScale);

            eDD_AssetGeometryType.SelectedValueBinding.Bind(Model, m => m.GeometryFlavor);

            // create the layout
            var layout = new DynamicLayout
            {
                Spacing = new Size(5, 5),
                Padding = new Padding(10)
            };

            // Add server settings group
            var group = new DynamicGroup();

            group.Spacing = new Size(5, 5);
            group.Title   = "Server settings";
            group.AddRow(new DynamicRow(new Control[] { lbl_Port, tB_Port }));
            layout.Add(group.Create(layout));

            // Add import settings group
            group         = new DynamicGroup();
            group.Spacing = new Size(5, 5);
            group.Title   = "Import settings";
            group.AddRow(new DynamicRow(new Control[] { lbl_PreviewType, eDD_PreviewType }));
            group.AddRow(new DynamicRow(new Control[] { lbl_ShouldScale, cB_ShouldScale }));
            group.AddRow(new DynamicRow(new Control[] { lbl_AssetGeometryType, eDD_AssetGeometryType }));
            layout.Add(group.Create(layout));

            // Add null and set content
            layout.Add(null);
            Content = layout;
        }
Пример #2
0
        /// <summary>
        /// Public parameterless constructor
        /// </summary>
        public EtoOptionsPageControl()
        {
            // call this.LoadSettings() to initialize default values for the form
            LoadSettings();

            // initialize all eventhandlers for forms
            #region eventHandlers
            tB_LineThickness.TextChanged           += tB_LineThickness_TextChanged;
            tB_LineMaxLength.TextChanged           += tB_LineMaxLength_TextChanged;
            tB_LineDividerLengthFactor.TextChanged += tB_LineDividerLengthFactor_TextChanged;
            tB_TextGap.TextChanged             += tB_TextGap_TextChanged;
            tB_TextHeight.TextChanged          += tB_TextHeight_TextChanged;
            tB_OffsetX.TextChanged             += tB_OffsetX_TextChanged;
            tB_OffsetY.TextChanged             += tB_OffsetY_TextChanged;
            btn_LineColor.Click                += btn_LineColor_Clicked;
            btn_TextColor.Click                += btn_TextColor_Clicked;
            fP_TextFont.ValueChanged           += fP_TextFont_ValueChanged;
            lB_ScaleStyle.SelectedIndexChanged += lB_ScaleStyle_SelectedIndexChanged;
            #endregion

            // create layout
            var layout = new DynamicLayout()
            {
                DefaultSpacing = new Size(5, 5), Padding = new Padding(10)
            };

            // create row vor line settings
            var row = layout.BeginHorizontal();

            // create empty groupBox and fill with linesettings controls
            var group = new DynamicGroup();
            group.Title = "Line Settings";
            group.AddRow(new DynamicRow(new Control[] { lbl_ScaleStyle, lB_ScaleStyle }));
            group.AddRow(new DynamicRow(new Control[] { lbl_LineMaxLength, tB_LineMaxLength }));
            group.AddRow(new DynamicRow(new Control[] { lbl_LineThickness, tB_LineThickness }));
            group.AddRow(new DynamicRow(new Control[] { lbl_LineDividerLengthFactor, tB_LineDividerLengthFactor }));

            row.Add(group);

            // create row for text settings
            row = layout.EndBeginHorizontal();

            // create empty groupBox and fill with textsettings controls
            group       = new DynamicGroup();
            group.Title = "Text Settings";
            group.AddRow(new DynamicRow(new Control[] { lbl_TextHeight, tB_TextHeight }));
            group.AddRow(new DynamicRow(new Control[] { lbl_TextGap, tB_TextGap }));
            group.AddRow(new DynamicRow(new Control[] { lbl_TextFont, fP_TextFont }));

            row.Add(group);

            // create row for margin settings
            row = layout.EndBeginHorizontal();

            // create empty groupBox and fill with marginsettings controls
            group       = new DynamicGroup();
            group.Title = "Margin Settings";
            group.AddRow(new DynamicRow(new Control[] { lbl_OffsetX, tB_OffsetX }));
            group.AddRow(new DynamicRow(new Control[] { lbl_OffsetY, tB_OffsetY }));

            row.Add(group);

            // create row for color settings
            row = layout.EndBeginHorizontal();

            // create empty groupBox and fill with colorsettings controls
            group       = new DynamicGroup();
            group.Title = "Color Settings";
            group.AddRow(new DynamicRow(new Control[] { lbl_LineColor, btn_LineColor }));
            group.AddRow(new DynamicRow(new Control[] { lbl_TextColor, btn_TextColor }));

            row.Add(group);

            // Clean up emd of layout and add null
            layout.EndBeginHorizontal();
            layout.Add(null);
            layout.EndHorizontal();
            Content = layout;
        }