CustomFilterViewModel CreateCustomFilterViewModel(FilterItem existing, bool save)
        {
            var viewModel = CustomFilterViewModel.Create(typeof(TEntity), settings.HiddenFilterProperties, settings.AdditionalFilterProperties);

            viewModel.FilterCriteria = existing.FilterCriteria;
            viewModel.FilterName     = existing.Name;
            viewModel.Save           = save;
            viewModel.SetParentViewModel(this);
            return(viewModel);
        }
示例#2
0
        public void Modify(FilterItem item)
        {
            CustomFilterViewModel viewModel = CreateCustomFilterViewModel <CustomFilterViewModel>(item);

            if (ShowFilterDialog(viewModel, "Custom Filter"))
            {
                if (viewModel.Save)
                {
                    SaveCustomFilters();
                    RaiseFilterTreeChanged();
                }
                ApplyFilter(item);
            }
        }
 void ShowFilter(FilterItem filterItem, CustomFilterViewModel filterViewModel, Action onSave)
 {
     if (FilterDialogService.ShowDialog(MessageButton.OKCancel, "Create Custom Filter", "CustomFilterView", filterViewModel) != MessageResult.OK)
     {
         return;
     }
     filterItem.FilterCriteria = filterViewModel.FilterCriteria;
     filterItem.Name           = filterViewModel.FilterName;
     ActiveFilterItem          = filterItem;
     if (filterViewModel.Save)
     {
         onSave();
         UpdateFilters();
     }
 }
示例#4
0
        public void New()
        {
            var newFilterItem = CreateFilterItem(null, null, null);
            CustomFilterViewModel viewModel = CreateCustomFilterViewModel <CustomFilterViewModel>(newFilterItem);

            if (ShowFilterDialog(viewModel, "Custom Filter"))
            {
                if (viewModel.Save)
                {
                    AddNewCustomFilter(newFilterItem);
                    RaiseFilterTreeChanged();
                }
                SelectedItem = newFilterItem;
            }
        }