Exemple #1
0
        protected override void OnParametersSet()
        {
            base.OnParametersSet();

            if (IsServerPaging && (!OnNextPage.HasDelegate || !OnPreviousPage.HasDelegate))
            {
                throw new ArgumentException("When server paging is enabled OnNextPage and OnPreviousPage have to be bound.");
            }

            if (!IsServerPaging)
            {
                CurrentPage = 1;
            }

            ItemsToShow = Items;

            // TODO: Filtering and sorting needs to be server side
            if (_filterPredicate != null)
            {
                ItemsToShow = ItemsToShow.Where(_filterPredicate);
            }

            if (OrderBy != null && OrderBy.Any())
            {
                foreach (var orderConfig in OrderBy)
                {
                    ItemsToShow = orderConfig.IsDescending ? ItemsToShow.OrderByDescending(orderConfig.Property) : ItemsToShow.OrderBy(orderConfig.Property);
                }
            }

            if (!IsServerPaging)
            {
                TotalPages = (int)Math.Ceiling(Items.Count() / (decimal)PageSize);
            }
        }
Exemple #2
0
        private void DisplayPage(int nextPage)
        {
            if (NumPages == 0)
            {
                return;
            }

            CurrentPage = nextPage;
            if (CurrentPage > NumPages)
            {
                CurrentPage = 1;
            }
            else if (CurrentPage < 1)
            {
                CurrentPage = NumPages;
            }

            int iFirst    = ((CurrentPage - 1) * NumGroupsPerPage);
            int iNextPage = iFirst + NumGroupsPerPage;

            if (iNextPage > _allItemsToShow.Count)
            {
                iNextPage = _allItemsToShow.Count;
            }

            ItemsToShow.Clear();
            for (int i = iFirst; i < iNextPage; i++)        // Remember these are groups, not individual items
            {
                ItemsToShow.Add(_allItemsToShow[i]);
            }

            OnPropertyChanged("PageNumberText");
        }
Exemple #3
0
        private void toolStripShowAll_Click(object sender, EventArgs e)
        {
            ItemsToShow its = new ItemsToShow();

            its.buttOK.Click += new System.EventHandler(this.buttOk_Click);
            its.Show();
        }
Exemple #4
0
        private void RefreshBindingSourceForChart()
        {
            // I need to show top N items sorted by Characteristic, so we use appropriate comparer for sorting
            _tables.Sort(GetComparer());
            _tables.Reverse();

            // and linq to select items needed
            List <TableInfoViewItem> items = _tables
                                             .Take(NumValues.Value)
                                             .Select(x => new TableInfoViewItem(x, _characteristicToDisplay))
                                             .ToList();

            ItemsToShow.Clear();
            foreach (TableInfoViewItem item in items)
            {
                ItemsToShow.Add(item);
            }
        }
Exemple #5
0
        public VwSelectStringsFromList(IDictionary <string, /*selected*/ bool> itemsAndSelections, string title, string subTitle, Func <IDictionary <string, /*selected*/ bool>, bool /*Result: not used*/> okCallback)
        {
            InitializeComponent();

            DisplayTitle    = title;
            DisplaySubTitle = subTitle;
            OkCallback      = okCallback;

            foreach (var item in itemsAndSelections)
            {
                ItemsToShow.Add(new DisplayItem()
                {
                    TextToDisplay = item.Key,
                    IsSelected    = item.Value,
                });
            }

            this.BindingContext = this;
        }
        void UpdateShownItems()
        {
            ItemsToShow.Clear();

            if (Feeds == null || Feeds.Count <= 0)
            {
                ListViewPlaceholderText = "No Feeds Available";
                return;
            }

            foreach (var item in Feeds.SelectMany(f => f.GetItemsBySearchTerm(SearchTerm)))
            {
                ItemsToShow.Add(item);
            }

            if (ItemsToShow.Count <= 0)
            {
                ListViewPlaceholderText = "No Feeds to Show";
            }
            else
            {
                ListViewPlaceholderText = string.Empty;
            }
        }
Exemple #7
0
 private void toolStripShowAll_Click(object sender, EventArgs e)
 {
     ItemsToShow its = new ItemsToShow();
     its.buttOK.Click += new System.EventHandler(this.buttOk_Click);
     its.Show();
 }