コード例 #1
0
        public void FillSportsBar()
        {
            SortableObservableCollection <MatchResultVw> ResultMatches = new SortableObservableCollection <MatchResultVw>();

            Repository.FindResults(ResultMatches, SportBarMatchFilter, Comparison);
            Dispatcher.Invoke(() =>
            {
                try
                {
                    var sports = ResultMatches.Where(x => x.SportView != null).Select(x => x.SportView).Distinct().ToList();

                    SportBarItem allsports = SportsBarItems.FirstOrDefault(x => x.SportDescriptor == SportSr.ALL_SPORTS);
                    if (allsports != null)
                    {
                        allsports.SportName = TranslationProvider.Translate(MultistringTags.ALL_SPORTS) as string;
                    }

                    foreach (var group in sports)
                    {
                        if (SportsBarItems.Count(x => x.SportDescriptor == group.LineObject.GroupSport.SportDescriptor) == 0)
                        {
                            SportsBarItems.Add(new SportBarItem(group.DisplayName, group.LineObject.GroupSport.SportDescriptor));
                        }
                        else
                        {
                            SportsBarItems.First(x => x.SportDescriptor == @group.LineObject.GroupSport.SportDescriptor).SportName = @group.DisplayName;
                        }
                    }

                    for (int i = 1; i < SportsBarItems.Count;)
                    {
                        var item = SportsBarItems[i];

                        if (sports.Count(x => x.LineObject.GroupSport.SportDescriptor == item.SportDescriptor) == 0)
                        {
                            SportsBarItems.RemoveAt(i);
                        }
                        else
                        {
                            i++;
                        }
                    }

                    SportsBarItems.Sort(ComparisonSportsBar);

                    OnPropertyChanged("SportsBarVisibility");
                }
                catch (Exception ex)
                {
                }
            });
        }
コード例 #2
0
        public override void OnNavigationCompleted()
        {
            Mediator.SendMessage(true, MsgTag.ActivateForwardSelected);
            Mediator.SendMessage <bool>(true, MsgTag.ShowResultFilters);
            Mediator.Register <bool>(this, ResetSportBar, MsgTag.ClearSelectedSports);

            Results.Clear();
            SportsBarItems.Clear();
            FillResults();

            timer.Tick += timer_Elapsed;
            timer.Start();
            ChangeTracker.SelectedResults = true;

            SportsBarItems.Add(new SportBarItem(TranslationProvider.Translate(MultistringTags.ALL_SPORTS) as string, SportSr.ALL_SPORTS));
            FillSportsBar();
            if (ChangeTracker.SelectedDescriptors.Count == 0)
            {
                ChangeTracker.SelectedDescriptors.Add(SportsBarItems.ElementAt(0).SportDescriptor);
                SportsBarItems.ElementAt(0).IsChecked = true;
            }
            else
            {
                var arraycopy = ChangeTracker.SelectedDescriptors.ToArray();
                ChangeTracker.SelectedDescriptors.Clear();
                foreach (var selectedDescriptor in arraycopy)
                {
                    var sport = SportsBarItems.FirstOrDefault(x => x.SportDescriptor == selectedDescriptor);
                    sport.IsChecked = true;
                    CheckedExecute(sport);
                }
            }

            base.OnNavigationCompleted();
            Mediator.SendMessage <bool>(true, MsgTag.UpdateLiveMonitorTemplates);
            CheckSportBarButtons();
        }
コード例 #3
0
        private void ResetSportBar(bool res)
        {
            SportsBarItems.Clear();
            ChangeTracker.SelectedDescriptors.Clear();
            SportsBarItems.Add(new SportBarItem(TranslationProvider.Translate(MultistringTags.ALL_SPORTS) as string, SportSr.ALL_SPORTS));
            SportsBarItems.ElementAt(0).IsChecked = true;
            ChangeTracker.SelectedDescriptors.Add(SportsBarItems.ElementAt(0).SportDescriptor);

            GetSportsBarScrollviewer();

            if (scrollViewer == null)
            {
                return;
            }

            if (ChangeTracker.IsLandscapeMode)
            {
                scrollViewer.ScrollToVerticalOffset(0);
            }
            else
            {
                scrollViewer.ScrollToHorizontalOffset(0);
            }
        }