Beispiel #1
0
        private void UpdateFilter(UpdateFilterRequestEventArgs obj)
        {
            InitializeViewModel(null);

            FilterViewCollection.ForEach(x => x.ViewModel.InitializeFilterModel());

            var currentFilter = GetCurrentFilter();

            if (FilterModelManager.FilterType == EnumFilterType.Cash)
            {
                StorageModel.CashFilterPredicate = currentFilter;
            }
            else
            {
                StorageModel.TournamentFilterPredicate = currentFilter;
            }

            var builtFilterArgs = new BuiltFilterChangedEventArgs(CurrentlyBuiltFilter.DeepCloneJson(), currentFilter);

            eventAggregator.GetEvent <BuiltFilterRefreshEvent>().Publish(builtFilterArgs);
        }
Beispiel #2
0
        private void ApplyLoadedData(string filename, ICollection <IFilterModel> loadedFilter)
        {
            try
            {
                var defaultStateModels = FilterViewCollection
                                         .Select(x => x.ViewModel.GetDefaultStateModel() as FilterBaseEntity)
                                         .Where(x => x != null)
                                         .ToList();

                var loadedList = loadedFilter
                                 .Select(x => x as FilterBaseEntity)
                                 .Where(x => x != null);

                foreach (var viewModel in FilterViewCollection)
                {
                    var model = viewModel.ViewModel.GetDefaultStateModel() as FilterBaseEntity;

                    if (model == null)
                    {
                        continue;
                    }

                    var loadedModel = loadedList.FirstOrDefault(x => x.GetType() == model.GetType());

                    if (loadedModel == null)
                    {
                        continue;
                    }

                    viewModel.ViewModel.UpdateDefaultStateModel(loadedModel);
                }

                RestoreDefaultFiltersState();
            }
            catch (Exception ex)
            {
                LogProvider.Log.Error(this, String.Format("Error during applying filter '{0}'", filename), ex);
            }
        }
Beispiel #3
0
        private void InitializeData(FilterTuple filterTupleStartup)
        {
            if (filterTupleStartup != null)
            {
                EnumViewModelType enumViewModelTypeStartup = filterTupleStartup.ViewModelType;

                if (FilterViewCollection.Where(x => x.ViewModel.GetType().Name == filterTupleStartup.ViewModelType.ToString()).Any())
                {
                    FilterViewSelectedItem = FilterViewCollection.FirstOrDefault(x => x.ViewModel.GetType().Name == filterTupleStartup.ViewModelType.ToString());
                }
                else
                {
                    FilterViewSelectedItem = FilterViewCollection.ElementAt(0);
                }
            }
            else
            {
                FilterViewSelectedItem = FilterViewCollection.ElementAt(0);
            }

            CurrentlyBuiltFilter = new BuiltFilterModel(FilterService);
            CurrentlyBuiltFilter.BindFilterSectionCollection();
        }
Beispiel #4
0
 private void ViewModelSwitch(FilterTuple filterTuple)
 {
     FilterViewSelectedItem = FilterViewCollection.FirstOrDefault(x => x.ViewModel.GetType().Name == filterTuple.ViewModelType.ToString());
 }