예제 #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);
        }
예제 #2
0
        protected override void ApplyFilters(object obj)
        {
            foreach (var filter in FilterViewCollection)
            {
                filter.ViewModel.UpdateDefaultState();
            }

            var currentFilter = GetCurrentFilter();

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

            var isApplyForBoth = ServiceLocator.Current.GetInstance <ISettingsService>()
                                 .GetSettings()
                                 .GeneralSettings
                                 .IsApplyFiltersToTournamentsAndCashGames;

            if (isApplyForBoth)
            {
                StorageModel.CashFilterPredicate       = currentFilter;
                StorageModel.TournamentFilterPredicate = currentFilter;

                builtFilterArgs.AffectedFilter = new[] { EnumFilterType.Cash, EnumFilterType.Tournament };

                FilterModelManager.SpreadFilter();
            }
            else if (FilterModelManager.FilterType == EnumFilterType.Cash)
            {
                StorageModel.CashFilterPredicate = currentFilter;
                builtFilterArgs.AffectedFilter   = new[] { EnumFilterType.Cash };
            }
            else
            {
                StorageModel.TournamentFilterPredicate = currentFilter;
                builtFilterArgs.AffectedFilter         = new[] { EnumFilterType.Tournament };
            }

            eventAggregator
            .GetEvent <BuiltFilterChangedEvent>()
            .Publish(builtFilterArgs);
        }