public EntitySearchViewModel(IEntityAutocompleteSelector <TEntity> autocompleteSelector) { if (autocompleteSelector != null) { this.AutocompleteSelector = autocompleteSelector; } }
public virtual CommonEEVMBuilder <TEntity> MakeByType() { if (parameters.AutofacScope == null) { throw new NullReferenceException($"{nameof(parameters.AutofacScope)} не задан для билдера. Без него использование {nameof(MakeByType)} невозможно."); } var resolver = parameters.AutofacScope.Resolve <IViewModelResolver>(); var journalViewModelType = resolver.GetTypeOfViewModel(typeof(TEntity), TypeOfViewModel.Journal); if (journalViewModelType != null) { var entitySelectorType = typeof(JournalViewModelSelector <,>).MakeGenericType(typeof(TEntity), journalViewModelType); EntitySelector = (IEntitySelector)Activator.CreateInstance(entitySelectorType, parameters.DialogViewModel, parameters.UnitOfWork, parameters.NavigationManager); var entityAutocompleteSelectorType = typeof(JournalViewModelAutocompleteSelector <,>).MakeGenericType(typeof(TEntity), journalViewModelType); EntityAutocompleteSelector = (IEntityAutocompleteSelector <TEntity>)Activator.CreateInstance(entityAutocompleteSelectorType, parameters.UnitOfWork, parameters.AutofacScope); } var dialogViewModelType = resolver.GetTypeOfViewModel(typeof(TEntity), TypeOfViewModel.EditDialog); if (dialogViewModelType != null) { var entityDlgOpenerType = typeof(EntityViewModelOpener <>).MakeGenericType(dialogViewModelType); EntityDlgOpener = (IEntityDlgOpener)Activator.CreateInstance(entityDlgOpenerType, parameters.NavigationManager, parameters.DialogViewModel); } return(this); }
public virtual CommonEEVMBuilder <TEntity> UseViewModelJournalAndAutocompleter <TJournalViewModel>() where TJournalViewModel : JournalViewModelBase { EntitySelector = new JournalViewModelSelector <TEntity, TJournalViewModel>(parameters.DialogViewModel, parameters.UnitOfWork, parameters.NavigationManager); EntityAutocompleteSelector = new JournalViewModelAutocompleteSelector <TEntity, TJournalViewModel>(parameters.UnitOfWork, parameters.AutofacScope); return(this); }
public EntityEntryViewModel( IPropertyBinder <TEntity> binder = null, IEntitySelector entitySelector = null, IEntityDlgOpener dlgOpener = null, IEntityAutocompleteSelector <TEntity> autocompleteSelector = null, IEntityAdapter <TEntity> entityAdapter = null ) { if (binder != null) { this.EntityBinder = binder; } if (entitySelector != null) { this.EntitySelector = entitySelector; } if (dlgOpener != null) { this.DlgOpener = dlgOpener; } if (autocompleteSelector != null) { this.AutocompleteSelector = autocompleteSelector; } if (entityAdapter != null) { this.EntityAdapter = entityAdapter; } }
private void FillAutocomplete() { logger.Info("Запрос данных для автодополнения..."); completionListStore = new ListStore(typeof(string), typeof(object)); if (entitySelectorAutocompleteFactory == null) { return; } autoCompleteSelector = entitySelectorAutocompleteFactory.CreateAutocompleteSelector(); autoCompleteSelector.ListUpdated += OnListUpdated; autoCompleteSelector.SearchValues(entryObject.Text); }