Beispiel #1
0
 private void Scores_CollectionChanged(object sender, System.Collections.Specialized.NotifyCollectionChangedEventArgs e)
 {
     if (e.Action == System.Collections.Specialized.NotifyCollectionChangedAction.Add)
     {
         ScoresById.Add(((Score)e.NewItems[0]).IdPlayer, (Score)e.NewItems[0]);
     }
     else if (e.Action == System.Collections.Specialized.NotifyCollectionChangedAction.Remove)
     {
         ScoresById.Remove(((Score)e.OldItems[0]).IdPlayer);
     }
 }
Beispiel #2
0
        /// <summary>
        /// Initializes the ScoresById collection after the result has been populated.
        /// </summary>
        internal void Init()
        {
            if (ScoresById == null)
            {
                ScoresById = new Dictionary <Guid, Score>();
            }
            else
            {
                ScoresById.Clear();
            }

            foreach (Score i_Score in Scores)
            {
                ScoresById.Add(i_Score.IdPlayer, i_Score);
            }
        }