示例#1
0
        public ItemFilterBlockGroupViewModel(ItemFilterBlockGroup itemFilterBlockGroup, bool showAdvanced, ItemFilterBlockGroupViewModel parent)
        {
            GroupName        = itemFilterBlockGroup.GroupName;
            ParentGroup      = parent;
            Advanced         = itemFilterBlockGroup.Advanced;
            SourceBlockGroup = itemFilterBlockGroup;
            SourceBlockGroup.ClearStatusChangeSubscribers();
            SourceBlockGroup.BlockGroupStatusChanged += OnSourceBlockGroupStatusChanged;
            IsShowChecked   = itemFilterBlockGroup.IsShowChecked;
            IsEnableChecked = itemFilterBlockGroup.IsEnableChecked;

            ChildGroups = new ObservableCollection <ItemFilterBlockGroupViewModel>();
            foreach (var childGroup in itemFilterBlockGroup.ChildGroups.Where(c => showAdvanced || !c.Advanced))
            {
                ChildGroups.Add(new ItemFilterBlockGroupViewModel(childGroup, showAdvanced, this));
            }

            VisibleChildGroups = new ObservableCollection <ItemFilterBlockGroupViewModel>();
            foreach (var childGroup in ChildGroups.Where(item => !item.IsHidden))
            {
                VisibleChildGroups.Add(childGroup);
            }

            if (ChildGroups.Any())
            {
                SetIsCheckedBasedOnChildGroups();
            }
        }
示例#2
0
        public ItemFilterBlockGroupViewModel(ItemFilterBlockGroup itemFilterBlockGroup, bool showAdvanced, ItemFilterBlockGroupViewModel parent)
        {
            GroupName        = itemFilterBlockGroup.GroupName;
            ParentGroup      = parent;
            Advanced         = itemFilterBlockGroup.Advanced;
            SourceBlockGroup = itemFilterBlockGroup;
            IsChecked        = itemFilterBlockGroup.IsChecked;

            ChildGroups = new ObservableCollection <ItemFilterBlockGroupViewModel>();
            foreach (var childGroup in itemFilterBlockGroup.ChildGroups.Where(c => showAdvanced || !c.Advanced))
            {
                ChildGroups.Add(new ItemFilterBlockGroupViewModel(childGroup, showAdvanced, this));
            }

            if (ChildGroups.Any())
            {
                SetIsCheckedBasedOnChildGroups();
            }
        }
示例#3
0
        public static void ItemFilterBlockGroupViewModelPostMap(ItemFilterBlockGroupViewModel viewModel)
        {
            foreach (var childViewModel in viewModel.ChildGroups)
            {
                ItemFilterBlockGroupViewModelPostMap(childViewModel);
            }

            if (viewModel.ChildGroups.Count > 0)
            {
                if (viewModel.ChildGroups.All(g => g.IsChecked == true))
                {
                    viewModel.IsChecked = true;
                } else if (viewModel.ChildGroups.Any(g => g.IsChecked == true))
                {
                    viewModel.IsChecked = null;
                }
                else
                {
                    viewModel.IsChecked = false;
                }
            }
        }