Esempio n. 1
0
 public void FinalizeLiveMode()
 {
     if (Rallies.Last().Winner == MatchPlayer.None && Rallies.Last().Length == 0)
     {
         Rallies.Remove(Rallies.Last());
         Rallies.Last().UpdateServerAndScore();
     }
 }
Esempio n. 2
0
 public void PreviousRally()
 {
     if (Rallies.Where(r => r.Number == CurrentRally.Number - 1).FirstOrDefault() != null)
     {
         var rally = Rallies.Where(r => r.Number == CurrentRally.Number - 1).FirstOrDefault();
         CurrentRally = rally;
     }
 }
 public void Handle(ResultsChangedEvent message)
 {
     if (IsActive)
     {
         Rallies.Clear();
         message.Rallies.Apply(rally => Rallies.Add(rally));
     }
 }
        protected override void OnViewReady(object view)
        {
            base.OnViewReady(view);
            Rallies.Clear();

            RallyLength = Manager.CurrentRallyLength;

            Manager.SelectedRallies.Apply(rally => Rallies.Add(rally));

            Rally activeRally = Manager.ActiveRally;

            if (activeRally != null)
            {
                ActiveRally = activeRally;
            }
        }
Esempio n. 5
0
 public void DeleteLastRally()
 {
     if (Rallies.Count == 2)
     {
         Rally lastRally = Rallies.Last();
         if (lastRally.Winner == MatchPlayer.None)
         {
             Rallies.Remove(lastRally);
             lastRally = Rallies.Last();
         }
         Rallies.Remove(lastRally);
         Rallies.Add(new Rally(Match));
         CurrentRally        = Rallies.Last();
         this.Server         = firstServerBackup;
         CurrentRally.Server = this.Server;
         NotifyOfPropertyChange("LiveView.Server");
         NotifyOfPropertyChange("LiveView.FirstServerSet");
         MatchManager.MatchModified = true;
         CurrentRally.UpdateServerAndScore();
         IsNewRally                 = true;
         IsWinnerEnabled            = false;
         MatchManager.MatchModified = true;
         NotifyOfPropertyChange("FirstServerSet");
         NotifyOfPropertyChange("CurrentRally");
     }
     if (Rallies.Count > 2)
     {
         Rally lastRally = Rallies.Last();
         if (lastRally.Winner == MatchPlayer.None)
         {
             Rallies.Remove(lastRally);
             lastRally = Rallies.Last();
         }
         Rallies.Remove(lastRally);
         Rallies.Add(new Rally(Match));
         CurrentRally = Rallies.Last();
         CurrentRally.UpdateServerAndScore();
         IsNewRally                 = true;
         IsWinnerEnabled            = false;
         MatchManager.MatchModified = true;
         NotifyOfPropertyChange("FirstServerSet");
         NotifyOfPropertyChange("CurrentRally");
     }
 }
        public void Handle(MediaControlEvent message)
        {
            if (message.Source == Media.Source.Viewer)
            {
                var idx = Rallies.IndexOf(Manager.ActiveRally);
                switch (message.Ctrl)
                {
                case Media.Control.Previous:
                    var rallyP = idx - 1 >= 0 ? Rallies[idx - 1] : null;
                    if (rallyP != null)
                    {
                        RallySelected(rallyP);
                    }
                    break;

                case Media.Control.Next:
                    if (Rallies.Count() != 0)
                    {
                        var rallyN = idx + 1 < Rallies.Count ? Rallies[idx + 1] : Rallies[0];
                        if (rallyN != null && rallyN != Rallies[0])
                        {
                            RallySelected(rallyN);
                        }
                        else if (rallyN != null && rallyN == Rallies[0])
                        {
                            Events.PublishOnUIThread(new MediaControlEvent(Media.Control.Pause, Media.Source.Viewer));
                        }
                    }
                    else
                    {
                        Events.PublishOnUIThread(new MediaControlEvent(Media.Control.Stop, Media.Source.Viewer));
                    }
                    break;

                case Media.Control.Stop:

                default:
                    break;
                }
            }
        }
Esempio n. 7
0
        public void RallyWon(int player)
        {
            if (!IsNewRally)
            {
                // Add CurrentRally to Playlists (Alle und Markiert, falls Checkbox)
                //   -> CurrentRally neu setzen mit Bindings
                if (player == 1)
                {
                    CurrentRally.Winner = MatchPlayer.First;
                }
                else
                {
                    CurrentRally.Winner = MatchPlayer.Second;
                }

                CurrentRally.End = MediaPlayer.MediaPosition.TotalMilliseconds + Match.Synchro;

                if (Markiert)
                {
                    Playlist marked = Match.Playlists.Where(p => p.Name == "Markiert").FirstOrDefault();
                    marked.Add(CurrentRally);
                }

                CurrentRally = new Rally(Match);
                Rallies.Add(CurrentRally);
                CurrentRally.UpdateServerAndScore();
                Server = CurrentRally.Server;
                //LengthHelper = 0;
                NotifyOfPropertyChange("CurrentRally");
                NotifyOfPropertyChange();
                NotifyOfPropertyChange("Server");
                IsNewRally                 = true;
                IsWinnerEnabled            = false;
                MatchManager.MatchModified = true;
            }
        }
 protected override void OnDeactivate(bool close)
 {
     Events.Unsubscribe(this);
     Rallies.Clear();
     base.OnDeactivate(close);
 }
Esempio n. 9
0
 protected internal int RalliesWonCount(Player player)
 {
     return(Rallies.Count(x => x.Winner.Equals(player)));
 }