Пример #1
0
 private void IconFilter_Tapped(object sender, EventArgs e)
 {
     if (FilterCommand?.CanExecute(FilterCommandParameter) ?? false)
     {
         FilterCommand?.Execute(FilterCommandParameter);
     }
 }
Пример #2
0
        /// <summary>
        ///     Created a new instance of <see cref="MainWindowViewModel" />
        /// </summary>
        internal MainWindowViewModel()
        {
            AddFilesCommand = new AddFilesCommand(this);
            ExtractCommand  = new ExtractCommand(this);
            ExportCommand   = new ExportCommand(this);
            FilterCommand   = new FilterCommand(this);
            PopulateCategoryFiltersCommand = new PopulateCategoryFiltersCommand(this);

            Files               = new List <string>();
            ExtractedData       = new ObservableCollection <INode>();
            ExtractedDataShadow = new List <INode>();
            NodeTypeFilters     = new ObservableCollection <INodeTypeFilterViewModel>();
            CategoryFilters     = new ObservableCollection <ICategoryFilterViewModel>();
            ExtractSuits        = true;
            _includeIgnores     = true;

            foreach (
                var filter in
                Enum.GetValues(typeof(NodeTypes))
                .Cast <NodeTypes>()
                .Select(nodeType => new NodeTypeFilterViewModel(nodeType)))
            {
                NodeTypeFilters.Add(filter);
                filter.PropertyChanged += delegate
                {
                    FilterCommand.Execute(null);
                    PopulateCategoryFiltersCommand.Execute(null);
                };
            }
        }
        public SearchNavigationBar()
        {
            InitializeComponent();
            gridNav.Margin        = new Thickness(0, App.HeightStatusBar, 0, 0);
            this.HeightRequest    = App.HeightNavigationIOS;
            gridNav.HeightRequest = App.HeightNavigationIOS;
            //
            var gestureRecognizer = new TapGestureRecognizer();

            gestureRecognizer.Tapped += (sender, e) => FilterCommand?.Execute(sender);
            filter.GestureRecognizers.Add(gestureRecognizer);
            //
            var backGR = new TapGestureRecognizer();

            backGR.Tapped += (sender, e) => BackCommand?.Execute(sender);
            back.GestureRecognizers.Add(backGR);
            //
            var searchGR = new TapGestureRecognizer();

            searchBar.GestureRecognizers.Add(searchGR);
            searchBar.BindingContext = this;
        }
Пример #4
0
 private void BaseContent_Appearing(object sender, EventArgs e)
 {
     if (FilterPage == null)
     {
         FilterCommand.Execute(null);
     }
     else
     {
         Task.Run(async() =>
         {
             var data = await(FilterPage?.BindingContext as PrepareReportViewModel)?.GetFilteredItems();
             if (data != null)
             {
                 Records = new ObservableCollection <InterruptionDbModel>(data);
             }
             else
             {
                 Records = null;
             }
         });
     }
 }
        public void ExecuteTest()
        {
            var table  = new Mock <Table>();
            var table2 = new Mock <Table>();

            var cell1 = new Mock <Cell>();
            var cell2 = new Mock <Cell>();

            cell1.Setup(foo => foo.Content).Returns(1.0);
            cell2.Setup(foo => foo.Content).Returns(5.0);
            var cell3 = new Mock <Cell>();
            var cell4 = new Mock <Cell>();
            //var cell5 = new Mock<Cell>();
            //var cell6 = new Mock<Cell>();
            //var cell7 = new Mock<Cell>();
            //var cell8 = new Mock<Cell>();

            List <Cell> list1 = new List <Cell>();
            List <Cell> list2 = new List <Cell>();

            List <Cell> list3 = new List <Cell>();
            List <Cell> list4 = new List <Cell>();

            list1.Add(cell1.Object);
            list1.Add(cell2.Object);
            list2.Add(cell3.Object);
            list2.Add(cell4.Object);
            list3.Add(cell2.Object);
            list4.Add(cell4.Object);

            var column1 = new Mock <Column>();
            var column2 = new Mock <Column>();
            var column3 = new Mock <Column>();
            var column4 = new Mock <Column>();

            column1.Setup(foo => foo.Cells).Returns(list1);
            column2.Setup(foo => foo.Cells).Returns(list2);
            column3.Setup(foo => foo.Cells).Returns(list3);
            column4.Setup(foo => foo.Cells).Returns(list4);

            List <Column> columns1 = new List <Column>();
            List <Column> columns2 = new List <Column>();

            columns1.Add(column1.Object);
            columns1.Add(column2.Object);
            columns2.Add(column3.Object);
            columns2.Add(column4.Object);

            //tabela do filtrowania
            table.Setup(foo => foo.Columns).Returns(columns1);
            table2.Setup(foo => foo.Columns).Returns(columns2);

            FilterCommand.Del del = c => (double)c > 2.0;
            Command           cmd = new FilterCommand(column1.Object, del);
            var result            = cmd.Execute(table.Object);


            int n = table2.Object.Columns.Count;
            int m = result.Columns.Count;

            Assert.AreEqual(n, m);

            for (int i = 0; i < n; i++)
            {
                CollectionAssert.AreEqual(table2.Object.Columns[i].Cells, result.Columns[i].Cells);
            }
        }