/// <summary> /// Clean up. /// </summary> protected override void OnDispose() { base.OnDispose(); if (searchResultViewModels != null) { searchResultViewModels.Clear(); } searchResultViewModels = null; searchAction = null; sortAction = null; }
/// <summary> /// Constuctor. /// </summary> /// <param name="viewModelStore">The store this view model belongs to.</param> /// <param name="selectableElements"> /// List of existing elements, that are allowed to be selected. /// </param> /// <param name="searchAction">Search action.</param> /// <param name="sortAction">Sort action.</param> public SelectGenericSearchViewModel(ViewModelStore viewModelStore, IEnumerable <T> selectableElements, GenericSearchDelegate <T> searchAction, GenericSortDelegate <T> sortAction) : base(viewModelStore) { searchResultViewModels = new ObservableCollection <T>(); searchCommand = new DelegateCommand(SearchCommand_Executed); activatedCommand = new DelegateCommand(ActivatedCommand_Executed); this.searchAction = searchAction; this.sortAction = sortAction; this.selectableElements = selectableElements; // 'search' to display all selectableElements in the search list. // 'search' to display all selectableElements in the search list. Threading.DispatcherExtensions.InvokeAsynchronouslyInBackground( System.Windows.Threading.Dispatcher.CurrentDispatcher, new Action(SearchCommand_Executed)); }
/// <summary> /// Constuctor. /// </summary> /// <param name="viewModelStore">The store this view model belongs to.</param> /// <param name="selectableElements"> /// List of existing elements, that are allowed to be selected. Can be null to specify that /// the is no such restriction needed and that all elements can be selected. /// </param> /// <param name="searchAction">Search action.</param> /// <param name="sortAction">Sort action.</param> public SelectGenericViewModel(ViewModelStore viewModelStore, List <T> selectableElements, GenericSearchDelegate <T> searchAction, GenericSortDelegate <T> sortAction) : base(viewModelStore) { selectElementSearchViewModel = new SelectGenericSearchViewModel <T>(viewModelStore, selectableElements, searchAction, sortAction); selectElementSearchViewModel.PropertyChanged += new System.ComponentModel.PropertyChangedEventHandler(SubModel_PropertyChanged); this.selectableElements = selectableElements; }