Esempio n. 1
0
        /// <summary>
        /// Set the match source of this collection
        /// </summary>
        /// <param name="Match"></param>
        public void SetSource(TennisMatch Match)
        {
            Children.Clear();

            if (Match != null)
            {
                vmStatistics newStatistics = new vmStatistics("Match", Match.Statistics, this);
                newStatistics.Selected += newStatistics_Selected;

                Children.Add(newStatistics);

                Match.NewSet += Match_NewSet;

                int i = 1;

                foreach (TennisSet Set in Match.Sets)
                {
                    newStatistics           = new vmStatistics(String.Format("Set {0}", i), Set.Statistics, this);
                    newStatistics.Selected += newStatistics_Selected;

                    Children.Add(newStatistics);

                    i++;
                }

                Selected = this.Children[0];
            }
        }
Esempio n. 2
0
        /// <summary>
        /// Add a new set to the collection (event handler)
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="_newSet"></param>
        void Match_NewSet(object sender, TennisSet _newSet)
        {
            vmStatistics newStatistics = new vmStatistics(String.Format("Set {0}", this.Children.Count), _newSet.Statistics, this);

            newStatistics.Selected += newStatistics_Selected;

            Children.Add(newStatistics);
        }
Esempio n. 3
0
 private void M_Children_CollectionChanged(object sender, System.Collections.Specialized.NotifyCollectionChangedEventArgs e)
 {
     if (e.Action == System.Collections.Specialized.NotifyCollectionChangedAction.Add)
     {
         foreach (var item in e.NewItems)
         {
             vmStatistics _newItem = (vmStatistics)item;
             _newItem.Selected += _newItem_Selected;
         }
     }
 }