public DataGroupRCPlayers(FootballMatch match, FootballTeam team, Player player, RedCard redCard)
 {
     this.match = match;
     this.team = team;
     this.player = player;
     this.redCard = redCard;
 }
        public DataGroupMatchPlayers(FootballMatch match, FootballTeam team, Player player)
        {
            this.match = match;
            this.team = team;
            this.player = player;
            this.matchPlayer = new MatchPlayer(-1, -1, -1, -1);
            this.showProperties = false;

        }
        private async Task GetRefereeMatchCollectionAsync()
        {
            if (this._tournaments.Count != 0)
            {
                return;
            }
            if (DataSource.busy == true)
            {
                return;
            }
            try
            {
                busy = true;
                Uri dataUri = new Uri(host + "referee/me/match?access_token=" + accessToken + "&filter=future");
                var responseR = await httpClient.GetAsync(dataUri);
                try
                {
                    responseR.EnsureSuccessStatusCode();
                }
                catch (Exception ex)
                {
                    if (responseR.StatusCode == HttpStatusCode.Unauthorized)
                    {
                        logout();
                    }
                    //
                    //Возможно, следует обрабатывать исключение здесь и возвращать HttpStatusCode здесь и во всех подобных запросах, которые сейчас кидают Exception
                    //
                    throw new Exception(ex.Message);
                    return;
                }
                JsonArray jsonArray;
                string resultR = await responseR.Content.ReadAsStringAsync();
                JsonObject jsonObject = JsonObject.Parse(resultR);
                if (jsonObject.ContainsKey("rows"))
                {
                    jsonArray = jsonObject["rows"].GetArray();
                    if (jsonArray.Count > 0)
                    {
                        foreach (JsonValue itemValue in jsonArray)
                        {
                            JsonObject itemObject = itemValue.GetObject();
                            //JsonObject groupObject = jsonArray[0].GetObject();
                            FootballMatch item = new FootballMatch((int)itemObject["id"].GetNumber(), true);
                            if (itemObject["start_at"].ValueType.Equals(JsonValueType.String)) item.start_at = itemObject["start_at"].GetString();
                            if (itemObject["place"].ValueType.Equals(JsonValueType.String)) item.place = itemObject["place"].GetString();
                            if (itemObject["goals1"].ValueType.Equals(JsonValueType.Number)) item.goals1 = (int)itemObject["goals1"].GetNumber();
                            if (itemObject["goals2"].ValueType.Equals(JsonValueType.Number)) item.goals2 = (int)itemObject["goals2"].GetNumber();
                            if (itemObject["penalty1"].ValueType.Equals(JsonValueType.Number)) item.penalty1 = (int)itemObject["penalty1"].GetNumber();
                            if (itemObject["penalty2"].ValueType.Equals(JsonValueType.Number)) item.penalty2 = (int)itemObject["penalty2"].GetNumber();
                            if (itemObject["round_id"].ValueType.Equals(JsonValueType.Number)) item.round_id = (int)itemObject["round_id"].GetNumber();
                            if (itemObject["is_technical"].ValueType.Equals(JsonValueType.Boolean)) item.is_technical = (bool)itemObject["is_technical"].GetBoolean();
                            if (itemObject["is_overtime"].ValueType.Equals(JsonValueType.Boolean)) item.is_overtime = (bool)itemObject["is_overtime"].GetBoolean();
                            if (itemObject["is_shootout"].ValueType.Equals(JsonValueType.Boolean)) item.is_shootout = (bool)itemObject["is_shootout"].GetBoolean();
                            JsonObject jsonObjectTeam = itemObject["team1"].GetObject();
                            FootballTeam _team1 = new FootballTeam((int)(jsonObjectTeam["id"].GetNumber()));
                            _team1.title = jsonObjectTeam["title"].GetString();
                            if (jsonObjectTeam["image_path"].ValueType.Equals(JsonValueType.String)) _team1.image_path = jsonObjectTeam["image_path"].GetString();
                            else _team1.image_path = "ms-appx:///Assets/noIm.png";
                            item.team1 = _team1;
                            jsonObjectTeam = itemObject["team2"].GetObject();
                            FootballTeam _team2 = new FootballTeam((int)(jsonObjectTeam["id"].GetNumber()));
                            _team2.title = jsonObjectTeam["title"].GetString();
                            if (jsonObjectTeam["image_path"].ValueType.Equals(JsonValueType.String)) _team2.image_path = jsonObjectTeam["image_path"].GetString();
                            else _team2.image_path = "ms-appx:///Assets/noIm.png";
                            item.team2 = _team2;
                            Addition ad = new Addition(0);
                            bool b = await ad.Get(item.id);
                            if (b)
                            {
                                item.addition = ad;
                            }
                            b = false;

                            try { await GetItemsForMatch(item); }
                            catch (Exception ex)
                            {
                                busy = false;
                                throw new Exception("Error aquired while loading data " + ex.Message);
                            }
                        }
                    }
                }
                //this.Groups.Add(actual);

                dataUri = new Uri(host + "referee/me/match?access_token=" + accessToken + "&filter=past");
                var responseL = await httpClient.GetAsync(dataUri);
                try
                {
                    responseL.EnsureSuccessStatusCode();
                }
                catch (Exception ex)
                {
                    busy = false;
                    return;
                }
                string resultL = await responseL.Content.ReadAsStringAsync();
                JsonObject jsonObjectL = JsonObject.Parse(resultL);
                if (jsonObjectL.ContainsKey("rows"))
                {
                    jsonArray = jsonObjectL["rows"].GetArray();
                    if (jsonArray.Count > 0)
                    {
                        //DataGroup past = new DataGroup(false);
                        foreach (JsonValue itemValue in jsonArray)
                        {
                            JsonObject itemObject = itemValue.GetObject();
                            FootballMatch item = new FootballMatch(((int)itemObject["id"].GetNumber()), false);
                            if (itemObject["start_at"].ValueType.Equals(JsonValueType.String)) item.start_at = itemObject["start_at"].GetString();
                            if (itemObject["place"].ValueType.Equals(JsonValueType.String)) item.place = itemObject["place"].GetString();
                            if (itemObject["goals1"].ValueType.Equals(JsonValueType.Number)) item.goals1 = (int)itemObject["goals1"].GetNumber();
                            if (itemObject["goals2"].ValueType.Equals(JsonValueType.Number)) item.goals2 = (int)itemObject["goals2"].GetNumber();
                            if (itemObject["penalty1"].ValueType.Equals(JsonValueType.Number)) item.penalty1 = (int)itemObject["penalty1"].GetNumber();
                            if (itemObject["penalty2"].ValueType.Equals(JsonValueType.Number)) item.penalty2 = (int)itemObject["penalty2"].GetNumber();
                            if (itemObject["round_id"].ValueType.Equals(JsonValueType.Number)) item.round_id = (int)itemObject["round_id"].GetNumber();
                            if (itemObject["is_technical"].ValueType.Equals(JsonValueType.Boolean)) item.is_technical = (bool)itemObject["is_technical"].GetBoolean();
                            if (itemObject["is_overtime"].ValueType.Equals(JsonValueType.Boolean)) item.is_overtime = (bool)itemObject["is_overtime"].GetBoolean();
                            if (itemObject["is_shootout"].ValueType.Equals(JsonValueType.Boolean)) item.is_shootout = (bool)itemObject["is_shootout"].GetBoolean();
                            JsonObject jsonObjectTeam = itemObject["team1"].GetObject();
                            FootballTeam _team1 = new FootballTeam((int)(jsonObjectTeam["id"].GetNumber()));
                            _team1.title = jsonObjectTeam["title"].GetString();
                            if (jsonObjectTeam["image_path"].ValueType.Equals(JsonValueType.String)) _team1.image_path = jsonObjectTeam["image_path"].GetString();
                            else _team1.image_path = "ms-appx:///Assets/noIm.png";
                            item.team1 = _team1;
                            jsonObjectTeam = itemObject["team2"].GetObject();
                            FootballTeam _team2 = new FootballTeam((int)(jsonObjectTeam["id"].GetNumber()));
                            _team2.title = jsonObjectTeam["title"].GetString();
                            if (jsonObjectTeam["image_path"].ValueType.Equals(JsonValueType.String)) _team2.image_path = jsonObjectTeam["image_path"].GetString();
                            else _team2.image_path = "ms-appx:///Assets/noIm.png";
                            item.team2 = _team2;
                            Addition ad = new Addition(9);
                            ad.attendance = 12;
                            item.addition = ad;
                            //past.Items.Add(item);
                            try { await GetItemsForMatch(item); }
                            catch (Exception ex)
                            {
                                DataSource.busy = false;
                                throw new Exception("Error aquired while loading data " + ex.Message);
                            }
                        }
                    }
                }
                if (_DataSource._tournaments.Count > 0)
                {
                    await Save();
                }
                else
                {
                    logout();
                }
            }
            catch (Exception ex)
            {
                busy = false;
                throw new Exception("Error aquired while loading data " + ex.Message);
            }
            finally
            {
                busy = false;
            }
            
        }
 public DataGroupGoalsPlayers(FootballMatch match, FootballTeam team, Player player, Goal goal)
 {
     this.match = match;
     this.team = team;
     this.player = player;
     this._goals = goal;
 }
 public DataGroupYCPlayers(FootballMatch match, FootballTeam team, Player player, YellowCard yellowCard)
 {
     this.match = match;
     this.team = team;
     this.player = player;
     this.yellowCard = yellowCard;
 }