/// <summary>
        /// Fill properties from the current match
        /// </summary>
        /// <param name="_CurrentMatch"></param>
        public void Fill(vmMatchState _CurrentMatch)
        {
            CurrentPointDescription = _CurrentMatch.CurrentPointDescription;
            NamePlayer1             = _CurrentMatch.NamePlayer1;
            NamePlayer2             = _CurrentMatch.NamePlayer2;
            ScorePlayer1            = _CurrentMatch.ScorePlayer1;
            ScorePlayer2            = _CurrentMatch.ScorePlayer2;
            PrintableScore          = _CurrentMatch.PrintableScore;
            Status           = _CurrentMatch.Status;
            MatchType        = _CurrentMatch.MatchType;
            Surface          = _CurrentMatch.Surface;
            Duration         = _CurrentMatch.Duration;
            Server           = _CurrentMatch.Server;
            Winner           = _CurrentMatch.Winner;
            InProgress       = _CurrentMatch.InProgress;
            Completed        = _CurrentMatch.Completed;
            Paused           = _CurrentMatch.Paused;
            IsExtendPossible = _CurrentMatch.IsExtendPossible;
            Undo             = _CurrentMatch.Undo;
            Switch           = _CurrentMatch.Switch;
            TotalSets        = new vmSetScore(_CurrentMatch.TotalSets);
            CurrentSetScore  = new vmSetScore(_CurrentMatch.CurrentSetScore);

            if (StatisticsCollection == null)
            {
                StatisticsCollection = _CurrentMatch.StatisticsCollection;
            }
            else
            {
                StatisticsCollection.Update(_CurrentMatch.StatisticsCollection);
            }

            Notify();
        }
示例#2
0
        protected override DataTemplate SelectTemplateCore(object item)
        {
            vmSetScore _object = (vmSetScore)item;

            if (_object.InProgress)
            {
                return(SetInProgressTemplate);
            }

            return(SetFinishedHeaderTemplate);
        }
 /// <summary>
 /// Make a copy of the vmSetScore instance
 /// </summary>
 /// <param name="instance"></param>
 private void Initialize(vmSetScore instance)
 {
     if (instance != null)
     {
         Score1         = instance.Score1;
         Score2         = instance.Score2;
         Score1Tiebreak = instance.Score1Tiebreak;
         Score2Tiebreak = instance.Score2Tiebreak;
         IsTiebreak     = instance.IsTiebreak;
         InProgress     = instance.InProgress;
     }
 }
示例#4
0
        public void GetData(TennisMatch Match)
        {
            ID          = Match.ID;
            StartTime   = Match.Duration.FirstSession;
            Duration    = Match.Duration.Duration;
            Winner      = Match.Winner;
            Status      = Match.Status;
            Contestant1 = Match.Contestant1.getName();
            Contestant2 = Match.Contestant2.getName();
            MatchType   = Match.Type.ToString() + " | best of " + Match.BestOutOf.ToString();
            MatchType   = MatchType.ToUpper();
            Location    = Match.Location;
            Surface     = Match.MatchSurface == TennisMatch.Surface.ArtificialGrass ? "Artificial grass" :  Match.MatchSurface.ToString();

            Sets.Clear();

            foreach (TennisSet Set in Match.Sets)
            {
                vmSetScore _sSet = new vmSetScore(Set);
                Sets.Add(_sSet);
            }
        }
        /// <summary>
        /// Initialize an instance with the contents of a tennisset
        /// </summary>
        /// <param name="instance"></param>
        /// <param name="set"></param>
        public static void Initialize(vmSetScore instance, TennisSet set)
        {
            instance.Score1 = set.ScoreContestant1.ToString();
            instance.Score2 = set.ScoreContestant2.ToString();

            instance.Index      = set.PartOf.Sets.IndexOf(set) + 1;
            instance.InProgress = (set.Winner == 0);

            if (set.Games.Count > 1)
            {
                TennisGame LastGame = set.Games[set.Games.Count - 1];
                if (LastGame.GetType() == typeof(TennisTiebreak))
                {
                    instance.IsTiebreak = true;

                    if (!instance.InProgress)
                    {
                        instance.Score1Tiebreak = LastGame.getScoreContestant(1);
                        instance.Score2Tiebreak = LastGame.getScoreContestant(2);
                    }
                }
            }
        }
 public vmSetScore(vmSetScore _setScore)
 {
     Initialize(_setScore);
 }