Ejemplo n.º 1
0
        private void LoadBounds()
        {
            var mainContainer = (Grid)this.Content;
            var element       = mainContainer.Children;
            var lstElement    = element.Cast <FrameworkElement>().ToList();
            var lstControl    = lstElement.OfType <Control>();
            var buttons       = lstControl.Where(p => (p is Button)).Cast <Button>().ToList();
            var items         = _bonusRepository.GetAll();

            _totalPage = _setRepository.GetOne()?.Page;
            var lists = items as IList <Bonus> ?? items.ToList();

            lists.Shuffle();
            for (var i = 0; i < buttons.Count; i++)
            {
                buttons[i].Background = Brushes.LightGray;
                buttons[i].Content    = string.Empty;
                buttons[i].Tag        = string.IsNullOrWhiteSpace(lists[i].Name) ? null : lists[i].Name;
            }

            var count      = lists.Count(p => !string.IsNullOrWhiteSpace(p.Name));
            var totalCount = count * _totalPage;            //总共

            _totalCount = totalCount - (count * _currPage); //剩余

            this.LblTotal.Dispatcher?.Invoke(DispatcherPriority.Normal,
                                             new Action(() => { this.LblTotal.Content = string.Concat(TOTAL_BOUNDS, totalCount); }));

            this.LoadLave();
        }
Ejemplo n.º 2
0
        private void LoadBonus(IList <TextBox> textBoxes)
        {
            var items = _bonusRepository.GetAll();

            foreach (var item in items)
            {
                var tag = string.Concat(item.X, ",", item.Y);
                foreach (var box in textBoxes)
                {
                    if (tag != box.Tag.ToString() || item.Name == null)
                    {
                        continue;
                    }
                    box.Text = item.Name.Trim();
                }
            }
        }