public PreviewViewModel(IEventAggregator events, FormDefinition definition, FormData data, INZazuWpfFieldFactory fieldFactory = null) { _events = events ?? throw new ArgumentNullException(nameof(events)); _events.Subscribe(this); _definition = definition ?? throw new ArgumentNullException(nameof(definition)); _data = data ?? throw new ArgumentNullException(nameof(data)); _fieldFactory = fieldFactory ?? new XceedFieldFactory(); _fieldFactory.Use <INZazuTableDataSerializer>(new NZazuTableDataJsonSerializer()); _fieldFactory.Use <ISupportGeoLocationBox>(new SupportGeoLocationBox()); var dbSuggestor = new SuggestionsProxy( new ElasticSearchSuggestions( connectionPrefix: "http://127.0.0.1:9200")) // instead of localhost. this changes the server { BlackListSize = 10, CacheSize = 3000, MaxFailures = int.MaxValue }; // lets do some stuff with the suggestor _fieldFactory.Use <IProvideSuggestions>(new AggregateProvideSuggestions(new IProvideSuggestions[] { new ProvideValueSuggestions(), new ProvideFileSuggestions(), dbSuggestor })); }
private void UpdateFields( FormDefinition formDefinition, INZazuWpfFieldFactory fieldFactory, IResolveLayout resolveLayout) { Dispose(); DisposeChecks(); // make sure at least the minimum is set for render the layout if (formDefinition?.Fields == null) { return; } CreateFields(formDefinition.Fields, fieldFactory); if (formDefinition.Checks != null) { CreateFormChecks(formDefinition.Checks, fieldFactory.Resolve <ICheckFactory>()); } var layout = resolveLayout.Resolve(formDefinition.Layout); var parentFields = FormDefinition.Fields.Select(fd => GetField(fd.Key)); layout.DoLayout(Layout, parentFields, resolveLayout); this.SetFieldValues(FormData.Values); SetReadOnly(IsReadOnly); }
public NZazuGroupField(FieldDefinition definition, Func <Type, object> serviceLocatorFunc) : base(definition, serviceLocatorFunc) { _factory = (INZazuWpfFieldFactory)serviceLocatorFunc(typeof(INZazuWpfFieldFactory)); IsEditable = false; CreateChildControls(); }
private void CreateFields(IEnumerable <FieldDefinition> formDefinition, INZazuWpfFieldFactory fieldFactory) { formDefinition.ToList().ForEach(f => { // create field var field = fieldFactory.CreateField(f); AddField(field); AddGroupFieldKeys(field as INZazuWpfFieldContainer); }); }
public NZazuDataTableField(FieldDefinition definition, Func <Type, object> serviceLocatorFunc) : base(definition, serviceLocatorFunc) { _serializer = (INZazuTableDataSerializer)serviceLocatorFunc(typeof(INZazuTableDataSerializer)); _factory = (INZazuWpfFieldFactory)serviceLocatorFunc(typeof(INZazuWpfFieldFactory)); }