Пример #1
0
 public vmStatistics(String _Description, TennisStatistics _Source, vmStatisticsCollection _Owner)
 {
     _StatisticElements = new List <vmStatistic>(0);
     Children           = new ObservableCollection <vmStatistic>();
     Description        = _Description;
     Owner = _Owner;
     SetSource(_Source);
 }
Пример #2
0
        public void SetSource(TennisStatistics Source)
        {
            _Source = Source;

            Children.Clear();

            var allValues = (vmStatistic.StatisticElement[])Enum.GetValues(typeof(vmStatistic.StatisticElement));

            vmStatistic LastHeader = null;

            TennisMatch.LogLevelEnum _LogLevel = Source.currentMatch.LogLevel;

            foreach (var element in allValues)
            {
                if (VisibleLogLevel(_LogLevel, element))
                {
                    vmStatistic newElement = new vmStatistic();
                    newElement.Statistic = element;
                    newElement.Source    = Source;
                    newElement.Visible   = true;
                    // _StatisticElements.Add(newElement);

                    if (newElement.Header)
                    {
                        LastHeader = newElement;
                        _StatisticElements.Add(newElement);
                        Children.Add(LastHeader);
                    }
                    else
                    {
                        if (LastHeader != null)
                        {
                            LastHeader.Children.Add(newElement);
                        }
                    }
                }
            }
        }