public FormArrayReadOnlyObject(string name, FormGroupArraySettingsDescriptor setting, IContextProvider contextProvider) : base(name, setting.FormGroupTemplate.TemplateName, contextProvider.UiNotificationService) { this.FormSettings = setting; this.formsCollectionDisplayTemplateDescriptor = setting.FormsCollectionDisplayTemplate; this.itemBindings = this.formsCollectionDisplayTemplateDescriptor.Bindings.Values.ToList(); this.Title = this.FormSettings.Title; this.Placeholder = this.FormSettings.Placeholder; this.contextProvider = contextProvider; }
public FormArrayValidatableObject(string name, FormGroupArraySettingsDescriptor setting, IEnumerable <IValidationRule> validations, IContextProvider contextProvider) : base(name, setting.FormGroupTemplate.TemplateName, validations, contextProvider.UiNotificationService) { this.FormSettings = setting; this.formsCollectionDisplayTemplateDescriptor = setting.FormsCollectionDisplayTemplate; this.itemBindings = this.formsCollectionDisplayTemplateDescriptor.Bindings.Values.ToList(); this.Title = this.FormSettings.Title; this.Placeholder = setting.Placeholder; this.contextProvider = contextProvider; Value = (T) new ObservableCollection <E>(); }
private void AddFormGroupArray(FormGroupArraySettingsDescriptor setting, string name) { if (setting.FormGroupTemplate == null || string.IsNullOrEmpty(setting.FormGroupTemplate.TemplateName)) { throw new ArgumentException($"{nameof(setting.FormGroupTemplate)}: 0B1F7121-915F-48B9-96A3-B410A67E6853"); } if (setting.FormGroupTemplate.TemplateName == nameof(QuestionTemplateSelector.FormGroupArrayTemplate)) { properties.Add(CreateFormArrayValidatableObject(setting, name)); } else { throw new ArgumentException($"{nameof(setting.FormGroupTemplate)}: 5E4E494A-E3FE-4016-ABB3-F238DC8E72F9"); } }
private IReadOnly CreateFormArrayReadOnlyObject(FormGroupArraySettingsDescriptor setting) { return(GetValidatable(Type.GetType(setting.ModelType))); IReadOnly GetValidatable(Type elementType) => (IReadOnly)Activator.CreateInstance ( typeof(FormArrayReadOnlyObject <,>).MakeGenericType ( typeof(ObservableCollection <>).MakeGenericType(elementType), elementType ), GetFieldName(setting.Field), setting, this.contextProvider ); }
private void AddFormGroupArray(FormGroupArraySettingsDescriptor setting) { ValidateSettingType(GetFieldName(setting.Field), setting.Type); if (setting.FormGroupTemplate == null || string.IsNullOrEmpty(setting.FormGroupTemplate.TemplateName)) { throw new ArgumentException($"{nameof(setting.FormGroupTemplate)}: 0B1F7121-915F-48B9-96A3-B410A67E6853"); } if (setting.FormGroupTemplate.TemplateName == nameof(QuestionTemplateSelector.FormGroupArrayTemplate)) { formLayout.Add(CreateFormArrayValidatableObject(setting), this.groupBoxSettings); } else { throw new ArgumentException($"{nameof(setting.FormGroupTemplate)}: 5E4E494A-E3FE-4016-ABB3-F238DC8E72F9"); } }
private void AddFormGroupArray(FormGroupArraySettingsDescriptor setting) { ValidateSettingType(GetFieldName(setting.Field), setting.Type); if (setting.FormGroupTemplate == null || string.IsNullOrEmpty(setting.FormGroupTemplate.TemplateName)) { throw new ArgumentException($"{nameof(setting.FormGroupTemplate)}: 0D7B0F95-8230-4ABD-B5B1-479558B4C4F1"); } if (setting.FormGroupTemplate.TemplateName == nameof(QuestionTemplateSelector.FormGroupArrayTemplate)) { formLayout.Add(CreateFormArrayReadOnlyObject(setting), this.groupBoxSettings); } else { throw new ArgumentException($"{nameof(setting.FormGroupTemplate)}: 3B2D01FD-4405-484C-A325-E3C9E8E56A3A"); } }
public FormArrayValidatableObject(string name, FormGroupArraySettingsDescriptor setting, IEnumerable <IValidationRule> validations, UiNotificationService uiNotificationService) : base(name, setting.FormGroupTemplate.TemplateName, validations, uiNotificationService) { }