Example #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();
        }
Example #2
0
 public MainWindow()
 {
     InitializeComponent();
     _bonusRepository = new BonusRepository(App.BonusFactory);
     _setRepository   = new SetRepository(App.SetFactory);
     _musicPath       = _setRepository.GetOne().Music;
     _mediaPlayer     = new MediaPlayer();
 }
Example #3
0
        private void LoadSets()
        {
            var item = _setRepository.GetOne();

            if (item == null)
            {
                return;
            }
            PageNumber.Value = item.Page;

            if (!string.IsNullOrWhiteSpace(item.Music))
            {
                TxtMusic.Text = item.Music;
            }
        }