private void JoinTournament(VisualizableTorunamentSettings s)
        {
            if (s == null || s.Settings.Running || s.Settings.PlayedMatches > 0)
            {
                return;
            }

            App.Instance.StartTournamentGame(serverAddress, s.Settings.ServerId);
        }
        public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {
            VisualizableTorunamentSettings vts = value as VisualizableTorunamentSettings;

            if (vts.Settings.Running || vts.Settings.PlayedMatches > 0)
            {
                return(Brushes.Orange);
            }
            else
            {
                return(Brushes.Green);
            }
        }
        private void ReceivedTournaments(NetIncomingMessage msg)
        {
            SetServerStatus(OnlineStatus.ONLINE);
            statusReceived = true;

            var previouslySelectedTournament = lvTournaments.SelectedItem == null ? null : lvTournaments.SelectedItem as VisualizableTorunamentSettings;
            VisualizableTorunamentSettings selectedTournament = null;

            availableTournaments.Clear();
            List <TournamentSettings> tss = new List <TournamentSettings>();

            int count = msg.ReadInt32();

            for (int i = 0; i < count; ++i)
            {
                TournamentSettings ts = msg.ReadTournamentSettings();
                tss.Add(ts);
                var vts = new VisualizableTorunamentSettings(ts);
                availableTournaments.Add(vts);

                if (previouslySelectedTournament != null && selectedTournament == null && previouslySelectedTournament.Name == ts.Name)
                {
                    lvTournaments.SelectedItem = vts;
                }
            }

            //if (previouslySelectedTournament != null)
            //    lvTournaments.SelectedItem = ;

            if (ReceivedNewTournamentsCallback != null)
            {
                ReceivedNewTournamentsCallback(tss, serverAddress);
            }

            lblTournamentCount.Content = count.ToString(Strings.Culture);
        }