private void TryResolveDefaultControl(IDialogSet item, PropertyInfo property) { // If control was not configured by .AsControl<TControl>() or by another extensions methods, // then it should create some default controls for its value, in case that DialogSet is not configured as Ignored // string -> TextBox // int, decimal -> NumericUpDown // DateTime -> DateTimePicker // etc... var type = property.PropertyType.GenericTypeArguments.First(); if (item.SupportedTypesSetups.ContainsKey(type)) { var setup = item.SupportedTypesSetups.GetValueOrDefault(type); item.Data.Control = setup.ControlFactory.Invoke(); item.Data.Getter = setup.Getter; item.Data.Setter = setup.Setter; if (item is IDialogCollectionSet collectionSet) { collectionSet.OnUpdateItemsAction = setup.UpdateItemsEvent; } } }
internal DialogSetOptionsBuilder(IDialogSet set) : base(set) { }
public static DialogContextConfigureException SetterIsNotConfiguredException(IDialogSet set) => new DialogContextConfigureException($"Setter of item '{set.Data.PropertyName}' is not configured. Configure it by calling .ConfigureSetter(...)\n" + $"You can find usage and samples here: https://github.com/bubuntoid/EasyDialog");
public static DialogContextConfigureException UpdateItemsEventNotSpecifiedException(IDialogSet set) => new DialogContextConfigureException($"UpdateItemsEvent of item '{set.Data.PropertyName}' is not not configured. Configure it by calling .ConfigureUpdateItemsEvent(...)\n" + $"You can find usage and samples here: https://github.com/bubuntoid/EasyDialog");
public static DialogContextConfigureException ControlIsNotSpecifiedException(IDialogSet set) => new DialogContextConfigureException($"Control of item '{set.Data.PropertyName}' is not recognized by default or not configured. Configure it by calling .AsControl<YourControl>()\n" + $"You can find usage and samples here: https://github.com/bubuntoid/EasyDialog");
internal DialogSetOptionsBuilderBase(IDialogSet item) { Item = item; }
internal DialogSetOptionsWithSpecifiedControlBuilder(IDialogSet set) : base(set) { }