Beispiel #1
0
 /// <summary>
 /// Configures DialogSet<TimeSpan> as DateTimePicker with Format = DateTimePickerFormat.Time
 /// </summary>
 /// <param name="builder"></param>
 /// <returns></returns>
 public static DialogSetOptionsWithSpecifiedControlBuilder <DateTimePicker, TimeSpan> AsDateTimePicker(this DialogSetOptionsBuilder <TimeSpan> builder) =>
 builder.AsControl <DateTimePicker>()
 .UseTemplate(new DateTimePicker {
     Format = DateTimePickerFormat.Time
 })
 .ConfigureGetter((control) => control.Value.TimeOfDay)
 .ConfigureSetter((control, value) => control.Value = new DateTime() + value);
 /// <summary>
 /// Sets DialogSet<double> control as NumericUpDown
 /// </summary>
 /// <param name="builder"></param>
 /// <returns></returns>
 public static DialogSetOptionsWithSpecifiedControlBuilder <NumericUpDown, double> AsNumericUpDown(this DialogSetOptionsBuilder <double> builder) =>
 builder.AsControl <NumericUpDown>()
 .ConfigureGetter((control) => Convert.ToDouble(control.Value))
 .ConfigureSetter((control, value) => control.Value = (decimal)value);
 /// <summary>
 /// Sets DialogSet<float> control as NumericUpDown
 /// </summary>
 /// <param name="builder"></param>
 /// <returns></returns>
 public static DialogSetOptionsWithSpecifiedControlBuilder <NumericUpDown, float> AsNumericUpDown(this DialogSetOptionsBuilder <float> builder) =>
 builder.AsControl <NumericUpDown>()
 .ConfigureGetter((control) => (float)control.Value)
 .ConfigureSetter((control, value) => control.Value = (decimal)value);
 /// <summary>
 /// Sets DialogSet<int> control as NumericUpDown
 /// </summary>
 /// <param name="builder"></param>
 /// <returns></returns>
 public static DialogSetOptionsWithSpecifiedControlBuilder <NumericUpDown, int> AsNumericUpDown(this DialogSetOptionsBuilder <int> builder) =>
 builder.AsControl <NumericUpDown>()
 .ConfigureGetter((control) => Convert.ToInt32(control.Value))
 .ConfigureSetter((control, value) => control.Value = value);
Beispiel #5
0
 /// <summary>
 /// Configures DialogSet<DateTime> as DateTimePicker
 /// </summary>
 /// <param name="builder"></param>
 /// <returns></returns>
 public static DialogSetOptionsWithSpecifiedControlBuilder <DateTimePicker, DateTime> AsDateTimePicker(this DialogSetOptionsBuilder <DateTime> builder) =>
 builder.AsControl <DateTimePicker>()
 .ConfigureGetter((control) => control.Value)
 .ConfigureSetter((control, value) => control.Value = value);
Beispiel #6
0
 /// <summary>
 /// Sets DialogSet<string> control as TextBox
 /// </summary>
 /// <param name="builder"></param>
 /// <returns></returns>
 public static DialogSetOptionsWithSpecifiedControlBuilder <TextBox, string> AsTextBox(this DialogSetOptionsBuilder <string> builder) =>
 builder.AsControl <TextBox>()
 .ConfigureGetter((control) => control.Text)
 .ConfigureSetter((control, value) => control.Text = value);