private void CheckedExecute(SportBarItem barItem)
        {
            if (barItem.SportDescriptor == SportSr.ALL_SPORTS && SelectedDescriptors.Count == 1 && SelectedDescriptors.Contains(SportSr.ALL_SPORTS))
            {
                SportBarItem allsports = SportsBarItemsPreMatch.Where(x => x.SportDescriptor == SportSr.ALL_SPORTS).First();
                if (allsports != null)
                {
                    allsports.IsChecked = true;
                }

                return;
            }
            else if (SelectedDescriptors.Contains(barItem.SportDescriptor))
            {
                SelectedDescriptors.Remove(barItem.SportDescriptor);
            }
            else
            {
                if (barItem.SportDescriptor == SportSr.ALL_SPORTS)
                {
                    for (int i = 1; i < SportsBarItemsPreMatch.Count; i++)
                    {
                        SportsBarItemsPreMatch[i].IsChecked = false;
                    }

                    SelectedDescriptors.Clear();
                }
                else //all sports should be unchecked automatically
                {
                    if (SelectedDescriptors.Contains(SportSr.ALL_SPORTS))
                    {
                        SportsBarItemsPreMatch[0].IsChecked = false;
                        SelectedDescriptors.Remove(SportSr.ALL_SPORTS);
                    }
                }

                SelectedDescriptors.Add(barItem.SportDescriptor);
            }

            if (SelectedDescriptors.Count == 0)
            {
                SportBarItem allsports = SportsBarItemsPreMatch.Where(x => x.SportDescriptor == SportSr.ALL_SPORTS).First();
                if (allsports != null)
                {
                    allsports.IsChecked = true;
                    SelectedDescriptors.Add(allsports.SportDescriptor);
                }
            }

            Refresh(true);

            ScrollToVertivalOffset(0);
        }
Esempio n. 2
0
        private void CheckedExecute(SportBarItem barItem)
        {
            if (barItem.SportDescriptor == SportSr.ALL_SPORTS && SelectedDescriptors.Count == 1 && SelectedDescriptors.Contains(SportSr.ALL_SPORTS))
            {
                SportBarItem allsports = SportsBarItemsPreMatch.Where(x => x.SportDescriptor == SportSr.ALL_SPORTS).First();
                if (allsports != null)
                {
                    allsports.IsChecked = true;
                }

                return;
            }
            else if (SelectedDescriptors.Contains(barItem.SportDescriptor))
            {
                SelectedDescriptors.Remove(barItem.SportDescriptor);
            }
            else
            {
                if (barItem.SportDescriptor == SportSr.ALL_SPORTS)
                {
                    for (int i = 1; i < SportsBarItemsPreMatch.Count; i++)
                    {
                        SportsBarItemsPreMatch[i].IsChecked = false;
                    }

                    SelectedDescriptors.Clear();
                }
                else //all sports should be unchecked automatically
                {
                    if (SelectedDescriptors.Contains(SportSr.ALL_SPORTS))
                    {
                        SportsBarItemsPreMatch[0].IsChecked = false;
                        SelectedDescriptors.Remove(SportSr.ALL_SPORTS);
                    }
                }

                SelectedDescriptors.Add(barItem.SportDescriptor);
            }

            if (SelectedDescriptors.Count == 0)
            {
                SportBarItem allsports = SportsBarItemsPreMatch.Where(x => x.SportDescriptor == SportSr.ALL_SPORTS).First();
                if (allsports != null)
                {
                    allsports.IsChecked = true;
                    SelectedDescriptors.Add(allsports.SportDescriptor);
                }
            }


            SoccerVisibility = SportsBarItemsPreMatch.Any(x => x.SportDescriptor == SportSr.SPORT_DESCRIPTOR_SOCCER && x.IsChecked) ? Visibility.Visible : Visibility.Collapsed;
            if (SoccerVisibility == Visibility.Visible)
            {
                SoccerExpanderIsExpanded = true;
            }
            else
            {
                SoccerExpanderIsExpanded = false;
            }

            TennisVisibility = SportsBarItemsPreMatch.Any(x => x.SportDescriptor == SportSr.SPORT_DESCRIPTOR_TENNIS && x.IsChecked) ? Visibility.Visible : Visibility.Collapsed;
            if (TennisVisibility == Visibility.Visible)
            {
                TennisExpanderIsExpanded = true;
            }
            else
            {
                SoccerExpanderIsExpanded = false;
            }

            BasketballVisibility = SportsBarItemsPreMatch.Any(x => x.SportDescriptor == SportSr.SPORT_DESCRIPTOR_BASKETBALL && x.IsChecked) ? Visibility.Visible : Visibility.Collapsed;
            if (BasketballVisibility == Visibility.Visible)
            {
                BasketballExpanderIsExpanded = true;
            }
            else
            {
                BasketballExpanderIsExpanded = false;
            }

            HockeyVisibility = SportsBarItemsPreMatch.Any(x => x.SportDescriptor == SportSr.SPORT_DESCRIPTOR_ICE_HOCKEY && x.IsChecked) ? Visibility.Visible : Visibility.Collapsed;
            if (HockeyVisibility == Visibility.Visible)
            {
                HockeyExpanderIsExpanded = true;
            }
            else
            {
                HockeyExpanderIsExpanded = false;
            }

            RugbyVisibility = SportsBarItemsPreMatch.Any(x => x.SportDescriptor == SportSr.SPORT_DESCRIPTOR_RUGBY && x.IsChecked) ? Visibility.Visible : Visibility.Collapsed;
            if (RugbyVisibility == Visibility.Visible)
            {
                RugbyExpanderIsExpanded = true;
            }
            else
            {
                RugbyExpanderIsExpanded = false;
            }

            HandballVisibility = SportsBarItemsPreMatch.Any(x => x.SportDescriptor == SportSr.SPORT_DESCRIPTOR_HANDBALL && x.IsChecked) ? Visibility.Visible : Visibility.Collapsed;
            if (HandballVisibility == Visibility.Visible)
            {
                HandballExpanderIsExpanded = true;
            }
            else
            {
                HandballExpanderIsExpanded = false;
            }

            VolleyballVisibility = SportsBarItemsPreMatch.Any(x => x.SportDescriptor == SportSr.SPORT_DESCRIPTOR_VOLLEYBALL && x.IsChecked) ? Visibility.Visible : Visibility.Collapsed;
            if (VolleyballVisibility == Visibility.Visible)
            {
                VolleyballExpanderIsExpanded = true;
            }
            else
            {
                VolleyballExpanderIsExpanded = false;
            }

            if (SportsBarItemsPreMatch.Any(x => x.SportDescriptor == SportSr.ALL_SPORTS && x.IsChecked))
            {
                SoccerVisibility     = Visibility.Visible;
                TennisVisibility     = Visibility.Visible;
                BasketballVisibility = Visibility.Visible;
                HockeyVisibility     = Visibility.Visible;
                RugbyVisibility      = Visibility.Visible;
                HandballVisibility   = Visibility.Visible;
                VolleyballVisibility = Visibility.Visible;

                SoccerExpanderIsExpanded     = false;
                TennisExpanderIsExpanded     = false;
                BasketballExpanderIsExpanded = false;
                HockeyExpanderIsExpanded     = false;
                RugbyExpanderIsExpanded      = false;
                HandballExpanderIsExpanded   = false;
                VolleyballExpanderIsExpanded = false;
            }


            Refresh(true);

            ScrollToVertivalOffset(0);
        }