Example #1
0
        public DataNavigatorViewModel(IViewNavigator regionNavigator, IFormsManager forms)
            : base(regionNavigator, forms)
        {
            VisibilityProvider = new SimpleVisibilityProvider();

            ShowNavigators = true;
            NavigationsVisible.CollectionChanged += NavigationsVisible_CollectionChanged;
            EditStatesVisible.CollectionChanged += EditStatesVisible_CollectionChanged;

            ChangeSearchFilter = new RelayCommand(ShowSearchFilterControl);
        }
Example #2
0
        public RecordSearchViewModel(RecordSearch search, IDataNavigator navigator, Action closeAction)
        {
            _Navigator = navigator;
            Search = search;

            Apply = new RelayCommand(() =>
            {
                Search.Apply();
                closeAction();
            });

            Cancel = new RelayCommand(closeAction);

            Clear = new RelayCommand(() =>
            {
                Search.Take = 0;
                _FilterGroups.Clear();
            });
        }
        public RecordFilterGroupViewModel(RecordFilterGroup group, Type baseType)
        {
            _BaseType = baseType;
            Group = group;
            ShowOrHeading = Group.Ordinal == 1 ?
                Visibility.Collapsed :
                Visibility.Visible;

            _Filters = new ObservableCollection<RecordFilterViewModel>();
            Filters = (ListCollectionView)CollectionViewSource.GetDefaultView(_Filters);

            foreach (var filter in group.Filters
                .Cast<RecordFilter>())
            {
                AddNewFilter(filter);
            };

            AddNewFilterCommand = new RelayCommand(AddNewFilter);
        }
Example #4
0
        public void Initialize()
        {
            _RecordSearchRouter = WeakEventRouter.CreateInstance(this,
                Search,
                () => default(PropertyChangedEventArgs),
                (p, d) => p.PropertyChanged += d.Handler,
                (p, d) => p.PropertyChanged -= d.Handler,
                (s, p, a) =>
                {
                    if (a.PropertyName == BindingHelper.Name((RecordSearch rs) => rs.IsAdvancedMode))
                    {
                        foreach (var group in _FilterGroups)
                        {
                            group.ShowOrHeading = p.IsAdvancedMode && group.Group.Ordinal > 1 ?
                                Visibility.Visible :
                                Visibility.Collapsed;
                        }
                    }
                });

            _FilterGroups = new ObservableCollection<RecordFilterGroupViewModel>();
            FilterGroups = (ListCollectionView)CollectionViewSource.GetDefaultView(_FilterGroups);

            foreach (var group in Search.FilterGroups
                .Cast<RecordFilterGroup>())
            {
                AddGroup(new RecordFilterGroupViewModel(group, Search.BaseType));
            }

            AddGroupCommand = new RelayCommand(AddGroup);

            if (!Search.FilterGroups.Any())
            {
                AddGroup();
            }
        }