Ejemplo n.º 1
0
        protected override void OnConfiguring(DialogContextConfigureOptionsBuilder <AuthDialogContext> builder)
        {
            builder.UseMetroStyle()
            .HasTitle("Authentification")
            .HasButton("Sign in")
            .HasWidth(400);

            builder.Item(x => x.Password)
            .AsTextBox()
            .UsePasswordChar();

            builder.Item(x => x.Robot)
            .HasName("I`m not a robot");
        }
Ejemplo n.º 2
0
        protected override void OnConfiguring(DialogContextConfigureOptionsBuilder <DialogWithBasicSupportedTypes> builder)
        {
            builder.HasTitle("Supported types sample");

            builder.Item(x => x.FullRow)
            .PlaceSeparatorBefore(SeparatorStyle.Line)
            .AsTextBox()
            .AsFullRow()
            .HasValue("Full row");

            builder.Item(x => x.Disabled)
            .Disabled();

            builder.Item(x => x.Multiline)
            .AsTextBox()
            .IsMultiline();

            builder.Item(x => x.StringLabel)
            .AsLabel()
            .HasText("Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod " +
                     "tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, " +
                     "quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. ")
            .HasHeight(50);

            builder.Item(x => x.ComboBox)
            .PlaceSeparatorBefore(SeparatorStyle.Line)
            .HasDataSource(new[] { "First", "Second", "Third" })
            .HasValue("First");

            builder.Item(x => x.ListBox)
            .AsListBox()
            .HasDataSource(new[] { "Third", "First", "Second" })
            .HasValue("Third");

            builder.Item(x => x.Int)
            .PlaceSeparatorBefore(SeparatorStyle.Line)
            .AsNumericUpDown()
            .HasDecimalPlaces(0)
            .HasMaximum(int.MaxValue)
            .HasMinimum(int.MinValue)
            .HasValue(0);

            builder.Item(x => x.DateTime)
            .AsDateTimePicker()
            .HasFormat(DateTimePickerFormat.Long)
            .HasMaximumDate(System.DateTime.MaxValue)
            .HasMinimumDate(System.DateTime.MinValue);

            builder.Item(x => x.Bool)
            .PlaceSeparatorBefore(SeparatorStyle.Line);
        }
        protected override void OnConfiguring(DialogContextConfigureOptionsBuilder <TimeSpanTypeDialogContext> builder)
        {
            builder.HasTitle("Custom type sample");

            builder.Item(x => x.Time)
            .AsControl <TextBox>()
            .ConfigureGetter((control) => TimeSpan.Parse(control.Text))
            .ConfigureSetter((control, value) => control.Text = value.ToString());
        }
Ejemplo n.º 4
0
        protected override void OnConfiguring(DialogContextConfigureOptionsBuilder <ButtonControlDialogContext> builder)
        {
            builder.HasTitle("Custom control sample");

            var template = GetButton();

            builder.Item(x => x.Switcher)
            .HasHeight(template.Height)
            .AsControl(template)
            .ConfigureGetter((control) => control.Text == "On")
            .ConfigureSetter((control, value) => control.Text = value ? "On" : "Off");
        }
Ejemplo n.º 5
0
        protected override void OnConfiguring(DialogContextConfigureOptionsBuilder <TimeSpanCollectionDialogContext> builder)
        {
            builder.HasTitle("Custom type collection sample");

            builder.Item(x => x.Times)
            .AsControl <ComboBox>()
            .ConfigureGetter((control) => TimeSpan.Parse(control.Text))
            .ConfigureSetter((control, value) => control.Text = value.ToString())
            .ConfigureOnUpdateItemsAction((control, source) =>
            {
                control.Items.Clear();
                source.ToList().ForEach(x => control.Items.Add(x));
            })
            .HasDataSource(new[] { TimeSpan.FromHours(1), TimeSpan.FromHours(2), TimeSpan.FromHours(3) })
            .HasValue(Times.DataSource.First());
        }