Example #1
0
 internal void PopulateCommentaryView(Grid commentaryView, EventOfMatch summaryEventOfMatch)
 {
     if (summaryEventOfMatch != null)
     {
         StackLayout mainLayout      = new StackLayout();
         View        summaryItemView = summaryEventOfMatch.HomeTeamVisible ? GetHomeTeamCommentaryItemView(summaryEventOfMatch) : GetAwayTeamCommentaryItemView(summaryEventOfMatch);
         Label       commentaryLabel = new Label()
         {
             Text                    = summaryEventOfMatch.EventText,
             MaxLines                = 8,
             HorizontalOptions       = LayoutOptions.FillAndExpand,
             HorizontalTextAlignment = TextAlignment.Center
         };
         mainLayout.Children.Add(summaryItemView);
         mainLayout.Children.Add(commentaryLabel);
         BoxView separateLine = new BoxView()
         {
             HeightRequest   = 1,
             BackgroundColor = Color.DimGray,
             Margin          = new Thickness(0, 5, 0, 3)
         };
         mainLayout.Children.Add(separateLine);
         commentaryView.Children.Add(mainLayout);
     }
 }
Example #2
0
 public EventSelectedPage(MatchesViewModel viewModel, string matchEventName, EventOfMatch eventOfMatch)
 {
     InitializeComponent();
     _viewModel        = viewModel;
     _eventOfMatch     = eventOfMatch;
     _eventText        = "";
     _teamName         = eventOfMatch?.EventTeam ?? string.Empty;
     _matchEventName   = matchEventName;
     _selectedMatch    = viewModel.SelectedLiveMatch;
     _isUpdateEvent    = _eventOfMatch != null;
     _isConfirmChanges = false;
     if (_isUpdateEvent)
     {
         _previousTotalTime      = _eventOfMatch.EventTotalTime;
         _previousPeriodID       = _eventOfMatch.EventPeriodID;
         _previousMainPlayerID   = _eventOfMatch.MainPlayerOfMatchID;
         _previousSecondPlayerID = _eventOfMatch.SecondPlayerOfMatchID;
         if (_matchEventName?.ToUpper().Trim() == "CORNER")
         {
             _playersList = new List <PlayerOfMatch>();
         }
     }
     else
     {
         _eventOfMatch = new EventOfMatch()
         {
             EventTotalTime = new TotalTimeFromSelectedMatchTimeConverter()?.Convert(_selectedMatch, null, null, CultureInfo.CurrentCulture)?.ToString(),
             EventPeriodID  = (int)_selectedMatch.StatusID
         };
         DeleteEventView.IsVisible = false;
     }
     BindingContext = _viewModel.SelectedLiveMatch;
 }
Example #3
0
 public SelectedEventPage(Match selectedMatch, EventOfMatch eventOfMatch)
 {
     InitializeComponent();
     SelectedMatch       = selectedMatch;
     FocusedEventOfMatch = eventOfMatch;
     SetAdditionalEventOfMatch();
     BindingContext = FocusedEventOfMatch;
 }
        private async void Edit_Event_Tapped(object sender, EventArgs e)
        {
            EventOfMatch eventOfMatch = (e as TappedEventArgs).Parameter as EventOfMatch;

            eventOfMatch.HomeTeam    = _selectedLiveMatch.HomeTeam;
            eventOfMatch.AwayTeam    = _selectedLiveMatch.AwayTeam;
            eventOfMatch.PlayersList = new ObservableCollection <PlayerOfMatch>(GetPlayersList(eventOfMatch.EventTeam));
            eventOfMatch.TeamsList   = new ObservableCollection <string>(new string[] { eventOfMatch.HomeTeam, eventOfMatch.AwayTeam });
            await Navigation.PushAsync(new SelectedEventPage(_selectedLiveMatch, eventOfMatch), false);
        }
        private async void Delete_Event_Tapped(object sender, EventArgs e)
        {
            EventOfMatch eventOfMatch = (e as TappedEventArgs).Parameter as EventOfMatch;
            var          answer       = await Application.Current.MainPage.DisplayAlert("Delete event", "Do you want to delete event\n\n" + eventOfMatch.EventText, "yes", "cancel");

            if (answer)
            {
                await eventOfMatch.DeleteEventOfMatchAsync();
            }
        }
Example #6
0
 public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
 {
     if (value != null && value is EventOfMatch)
     {
         EventOfMatch eventOfMatch = (EventOfMatch)value;
         if (eventOfMatch?.EventName?.ToUpper() == "SUBSTITUTION")
         {
             return(true);
         }
     }
     return(false);
 }
Example #7
0
        public void AddSummaryMinute(EventOfMatch summaryEventOfMatch, StackLayout summaryItemView)
        {
            Label minuteLabel = new Label()
            {
                Text            = summaryEventOfMatch.EventMinute,
                VerticalOptions = LayoutOptions.Center,
                TextColor       = Color.Khaki,
                FontFamily      = Application.Current.Resources["NormalFont"].ToString(),
            };

            summaryItemView.Children.Add(minuteLabel);
        }
Example #8
0
        public async Task <bool> DeleteEventOfMatchAsync(EventOfMatch eventOfMatch)
        {
            HttpClient          client   = new HttpClient();
            HttpResponseMessage response = await client.DeleteAsync(Url + "EventsOfMatches/" + eventOfMatch.EventOfMatchID);

            if (response.IsSuccessStatusCode)
            {
                return(await Task.FromResult(true));
            }
            else
            {
                return(await Task.FromResult(true));
            }
        }
        private async void SetEvent(string eventName, string teamName)
        {
            EventOfMatch newEvent = new EventOfMatch()
            {
                EventName = eventName,
                EventTeam = teamName,
                HomeTeam  = _selectedLiveMatch.HomeTeam,
                AwayTeam  = _selectedLiveMatch.AwayTeam
            };

            newEvent.PlayersList = new ObservableCollection <PlayerOfMatch>(GetPlayersList(teamName));
            newEvent.TeamsList   = new ObservableCollection <string>(new string[] { newEvent.HomeTeam, newEvent.AwayTeam });
            await Navigation.PushAsync(new SelectedEventPage(_selectedLiveMatch, newEvent), false);
        }
Example #10
0
        private View GetAwayTeamCommentaryItemView(EventOfMatch summaryEventOfMatch)
        {
            Grid commentaryItemView = new Grid()
            {
                RowSpacing        = 0,
                ColumnSpacing     = 3,
                HorizontalOptions = LayoutOptions.CenterAndExpand,
                Padding           = new Thickness(0, 0, 0, 3)
            };
            ColumnDefinition cd = new ColumnDefinition
            {
                Width = new GridLength(1, GridUnitType.Star)
            };

            commentaryItemView.ColumnDefinitions.Add(cd);
            cd = new ColumnDefinition
            {
                Width = new GridLength(1, GridUnitType.Auto)
            };
            commentaryItemView.ColumnDefinitions.Add(cd);
            cd = new ColumnDefinition
            {
                Width = new GridLength(1, GridUnitType.Star)
            };
            commentaryItemView.ColumnDefinitions.Add(cd);

            StackLayout minuteCommentryItemView = new StackLayout()
            {
                Orientation       = StackOrientation.Horizontal,
                HorizontalOptions = LayoutOptions.CenterAndExpand
            };

            Grid.SetColumn(minuteCommentryItemView, 1);
            StackLayout eventCommentryItemView = new StackLayout()
            {
                Orientation       = StackOrientation.Horizontal,
                HorizontalOptions = LayoutOptions.StartAndExpand
            };

            Grid.SetColumn(eventCommentryItemView, 2);

            summary.AddSummaryMinute(summaryEventOfMatch, minuteCommentryItemView);
            commentaryItemView.Children.Add(minuteCommentryItemView);

            summary.AddSummaryEventName(summaryEventOfMatch, eventCommentryItemView);
            summary.AddSummaryScore(summaryEventOfMatch, eventCommentryItemView);
            commentaryItemView.Children.Add(eventCommentryItemView);

            return(commentaryItemView);
        }
Example #11
0
 public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
 {
     if (value != null && value is EventOfMatch)
     {
         EventOfMatch eventOfMatch = (EventOfMatch)value;
         if (eventOfMatch?.EventName?.ToUpper() == "GOAL" ||
             eventOfMatch?.EventName?.ToUpper() == "OWNGOAL" ||
             eventOfMatch?.EventName?.ToUpper() == "PENALTYSCORED")
         {
             return(true);
         }
     }
     return(false);
 }
Example #12
0
        public async Task <bool> AddEventOfMatchAsync(EventOfMatch eventOfMatch)
        {
            HttpClient          client   = new HttpClient();
            StringContent       content  = new StringContent(JsonConvert.SerializeObject(eventOfMatch), Encoding.UTF8, "application/json");
            HttpResponseMessage response = await client.PostAsync(Url + "EventsOfMatches", content);

            if (response.IsSuccessStatusCode)
            {
                return(await Task.FromResult(true));
            }
            else
            {
                return(await Task.FromResult(false));
            }
        }
Example #13
0
 internal async Task DeleteEventOfMatchAsync(EventOfMatch eventOfMatch, Match selectedMatch)
 {
     IsLoading     = true;
     MainException = null;
     try
     {
         await GetDataStore().DeleteEventOfMatchAsync(eventOfMatch);
         await GetSelectedLiveMatch(selectedMatch, false);
     }
     catch (Exception ex)
     {
         MainException = ex;
     }
     IsLoading = false;
 }
Example #14
0
 public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
 {
     if (value != null && value is EventOfMatch)
     {
         EventOfMatch eventOfMatch = (EventOfMatch)value;
         if (eventOfMatch?.EventName?.ToUpper() == "CORNER" ||
             eventOfMatch?.EventName?.ToUpper() == "PENALTY" ||
             eventOfMatch?.EventName?.ToUpper() == "DOMINATION" ||
             eventOfMatch?.EventName?.ToUpper() == "COMMENTARY")
         {
             return(false);
         }
     }
     return(true);
 }
Example #15
0
 internal void PopulateSummaryView(Grid parentLayout, EventOfMatch summaryEventOfMatch)
 {
     if (summaryEventOfMatch != null)
     {
         StackLayout mainLayout      = new StackLayout();
         View        summaryItemView = summaryEventOfMatch.HomeTeamVisible ? GetHomeTeamSummaryItemView(summaryEventOfMatch) : GetAwayTeamSummaryItemView(summaryEventOfMatch);
         BoxView     separateLine    = new BoxView()
         {
             HeightRequest   = 1,
             BackgroundColor = Color.DimGray
         };
         mainLayout.Children.Add(summaryItemView);
         mainLayout.Children.Add(separateLine);
         parentLayout.Children.Add(mainLayout);
     }
 }
Example #16
0
        private View GetAwayTeamSummaryItemView(EventOfMatch summaryEventOfMatch)
        {
            StackLayout awaySummaryItemView = new StackLayout()
            {
                Spacing           = 5,
                Orientation       = StackOrientation.Horizontal,
                HorizontalOptions = LayoutOptions.EndAndExpand,
                HeightRequest     = 40,
                Padding           = new Thickness(3, 0, 3, 3)
            };

            AddPlayerName(awaySummaryItemView, summaryEventOfMatch);
            AddSummaryScore(summaryEventOfMatch, awaySummaryItemView);
            AddSummaryEventName(summaryEventOfMatch, awaySummaryItemView);
            AddSummaryMinute(summaryEventOfMatch, awaySummaryItemView);
            return(awaySummaryItemView);
        }
Example #17
0
 public void AddSummaryScore(EventOfMatch summaryEventOfMatch, StackLayout summaryItemView)
 {
     switch (summaryEventOfMatch.EventName.ToUpper())
     {
     case "GOAL":
     case "OWNGOAL":
     case "PENALTYSCORED":
         Label goalScoreLabel = new Label()
         {
             Text           = summaryEventOfMatch.HomeTeamScore + ":" + summaryEventOfMatch.AwayTeamScore,
             FontAttributes = FontAttributes.Bold,
             FontFamily     = Application.Current.Resources["BoldFont"].ToString(),
         };
         summaryItemView.Children.Add(goalScoreLabel);
         break;
     }
 }
 public MatchTimeAndPeriodPage(MatchesViewModel viewModel, EventOfMatch eventOfMatch)
 {
     _isMatchTime = false;
     _match       = viewModel.SelectedLiveMatch;
     EventOfMatch = eventOfMatch;
     if (eventOfMatch != null)
     {
         _periodID = eventOfMatch.EventPeriodID;
         _totalEventMinutesAndSeconds = eventOfMatch.EventTotalTime;
     }
     else
     {
         _periodID = (int)_match.StatusID;
         _totalEventMinutesAndSeconds = new TotalTimeFromSelectedMatchTimeConverter()?.Convert(_match, null, null, CultureInfo.CurrentCulture)?.ToString();
     }
     InitializeComponent();
     Populate(_match);
     BindingContext = this;
 }
Example #19
0
        internal async Task <bool> UpdateEventOfMatchAsync(EventOfMatch eventOfMatch, Match selectedMatch)
        {
            bool result = true;

            IsLoading     = true;
            MainException = null;
            try
            {
                await GetDataStore().UpdateEventOfMatchAsync(eventOfMatch);
                await GetSelectedLiveMatch(selectedMatch, false);
            }
            catch (Exception ex)
            {
                MainException = ex;
                result        = false;
            }
            IsLoading = false;
            return(result);
        }
Example #20
0
 private void GoalEvent_Clicked(object sender, EventArgs e)
 {
     _matchEventName         = (sender as Button).CommandParameter?.ToString();
     _playersList            = GetPlayersList();
     GoalEventView.IsVisible = false;
     MainView.IsVisible      = true;
     if (_matchEventName == "ASSIST")
     {
         _isUpdateEvent = false;
         var eventTotalTime = _eventOfMatch.EventTotalTime;
         var eventPeriodID  = (int)_selectedMatch.StatusID;
         _eventOfMatch = new EventOfMatch()
         {
             EventTotalTime = eventTotalTime,
             EventPeriodID  = eventPeriodID
         };
         DeleteEventView.IsVisible = false;
     }
     PopulateEventData();
 }
Example #21
0
        private void AddPlayerName(StackLayout summaryItemView, EventOfMatch summaryEventOfMatch)
        {
            string mainPlayer   = summaryEventOfMatch.HomeMainPlayer;
            string secondPlayer = summaryEventOfMatch.HomeSecondPlayer;

            if (summaryEventOfMatch.AwayTeamVisible)
            {
                mainPlayer   = summaryEventOfMatch.AwayMainPlayer;
                secondPlayer = summaryEventOfMatch.AwaySecondPlayer;
            }
            StackLayout playersLayout = new StackLayout()
            {
                Spacing         = 0,
                VerticalOptions = LayoutOptions.Center
            };
            Label mainPlayersLabel = new Label()
            {
                Text                    = mainPlayer,
                TextColor               = summaryEventOfMatch.EventName.ToUpper() == "SUBSTITUTION" ? Color.DarkRed : Color.White,
                VerticalOptions         = LayoutOptions.Center,
                HorizontalOptions       = LayoutOptions.FillAndExpand,
                HorizontalTextAlignment = summaryEventOfMatch.HomeTeamVisible ? TextAlignment.Start : TextAlignment.End
            };

            playersLayout.Children.Add(mainPlayersLabel);
            if (!string.IsNullOrWhiteSpace(secondPlayer))
            {
                Label secondPlayersLabel = new Label()
                {
                    Text                    = secondPlayer,
                    TextColor               = summaryEventOfMatch.EventName.ToUpper() == "SUBSTITUTION" ? Color.Green : Color.FromHex("#a6a6a6"),
                    VerticalOptions         = LayoutOptions.Center,
                    HorizontalOptions       = LayoutOptions.FillAndExpand,
                    HorizontalTextAlignment = summaryEventOfMatch.HomeTeamVisible ? TextAlignment.Start : TextAlignment.End
                };
                playersLayout.Children.Add(secondPlayersLabel);
            }
            summaryItemView.Children.Add(playersLayout);
        }
Example #22
0
        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
        {
            string liveMatchTime = string.Empty;

            if (value != null)
            {
                EventOfMatch eventOfMatch = (EventOfMatch)value;
                int          totalMinutes = 0;
                string       eventMinute  = eventOfMatch.EventMinute.TrimStart('0').Replace("'", "");
                try
                {
                    int index = eventMinute.IndexOf('+');
                    if (index > 0)
                    {
                        totalMinutes = int.Parse(eventMinute.Substring(0, index));
                    }
                    else
                    {
                        totalMinutes = int.Parse(eventMinute);
                    }
                }
                catch
                {
                    totalMinutes = 0;
                }

                int    minutes  = 0;
                int    seconds  = 0;
                string addtime  = "";
                int    statusID = 0;
                if (parameter != null)
                {
                    statusID = (int)parameter;
                }
                switch (statusID)
                {
                case 1:
                    return("00:00");

                case 2:
                    if (minutes > 45)
                    {
                        addtime = "45+";
                        minutes = minutes - 45;
                    }
                    break;

                case 3:
                    return("half time");

                case 4:
                    minutes = minutes + 45;
                    if (minutes > 90)
                    {
                        addtime = "90+";
                        minutes = minutes - 90;
                    }
                    break;

                case 5:
                    return("full time");

                case 6:
                    minutes = minutes + 90;
                    if (minutes > 105)
                    {
                        addtime = "105+";
                        minutes = minutes - 105;
                    }
                    break;

                case 7:
                    return("ex time pause");

                case 8:
                    minutes = minutes + 105;
                    if (minutes > 120)
                    {
                        addtime = "120+";
                        minutes = minutes - 120;
                    }
                    break;

                case 9:
                    return("ex time finished");

                case 10:
                    return("penalties");

                default:
                    return("finished");
                }
                string min = minutes.ToString();
                string sec = seconds.ToString();
                if (minutes < 10)
                {
                    min = "0" + minutes;
                }
                if (seconds < 10)
                {
                    sec = "0" + seconds;
                }
                liveMatchTime = addtime + " " + min + ":" + sec;
            }
            return(liveMatchTime);
        }
Example #23
0
        public void AddSummaryEventName(EventOfMatch summaryEventOfMatch, StackLayout summaryItemView)
        {
            switch (summaryEventOfMatch.EventName.ToUpper())
            {
            case "GOAL":
            case "OWNGOAL":
            case "PENALTYSCORED":
                StackLayout goalNameLayout = new StackLayout()
                {
                    BackgroundColor = Color.DarkGreen,
                    VerticalOptions = LayoutOptions.Center,
                    Padding         = new Thickness(5)
                };
                Label goalNameLabel = new Label()
                {
                    Text                  = GetEventNameText(summaryEventOfMatch.EventName.ToUpper()),
                    TextColor             = Color.White,
                    FontAttributes        = FontAttributes.Bold,
                    FontFamily            = Application.Current.Resources["BoldFont"].ToString(),
                    VerticalOptions       = LayoutOptions.CenterAndExpand,
                    VerticalTextAlignment = TextAlignment.Center
                };
                goalNameLayout.Children.Add(goalNameLabel);
                summaryItemView.Children.Add(goalNameLayout);
                break;

            case "ASSIST":
                StackLayout assistNameLayout = new StackLayout()
                {
                    VerticalOptions = LayoutOptions.Center
                };
                Label assistNameLabel = new Label()
                {
                    Text                  = Properties.Resources.Assist,
                    TextColor             = Color.LightBlue,
                    VerticalOptions       = LayoutOptions.CenterAndExpand,
                    VerticalTextAlignment = TextAlignment.Center
                };
                assistNameLayout.Children.Add(assistNameLabel);
                summaryItemView.Children.Add(assistNameLayout);
                break;

            case "YELLOW":
                Grid yellowCardGrid = new Grid()
                {
                    BackgroundColor = Color.Gold,
                    VerticalOptions = LayoutOptions.Center,
                    WidthRequest    = 9,
                    HeightRequest   = 12
                };
                summaryItemView.Children.Add(yellowCardGrid);
                break;

            case "RED":
                Grid redCardGrid = new Grid()
                {
                    BackgroundColor = Color.Red,
                    VerticalOptions = LayoutOptions.Center,
                    WidthRequest    = 9,
                    HeightRequest   = 12
                };
                summaryItemView.Children.Add(redCardGrid);
                break;

            case "SUBSTITUTION":
                Label subINLabel = new Label()
                {
                    Text                  = string.Format("{0} ", char.ConvertFromUtf32(0x25B2)).ToString(),
                    TextColor             = Color.Green,
                    FontAttributes        = FontAttributes.Bold,
                    FontFamily            = Application.Current.Resources["BoldFont"].ToString(),
                    VerticalOptions       = LayoutOptions.CenterAndExpand,
                    VerticalTextAlignment = TextAlignment.Center,
                    Margin                = new Thickness(0, 0, -3, 0),
                    FontSize              = 12
                };
                summaryItemView.Children.Add(subINLabel);
                Label subOutLabel = new Label()
                {
                    Text                  = string.Format("{0} ", char.ConvertFromUtf32(0x25BC)).ToString(),
                    TextColor             = Color.Red,
                    VerticalOptions       = LayoutOptions.CenterAndExpand,
                    VerticalTextAlignment = TextAlignment.Center,
                    Margin                = new Thickness(-3, 0, 0, 0),
                    FontSize              = 12
                };
                summaryItemView.Children.Add(subOutLabel);
                break;

            case "BIGCHANCE":
                StackLayout bigChanceNameLayout = new StackLayout()
                {
                    VerticalOptions = LayoutOptions.Center
                };
                Label bigChanceNameLabel = new Label()
                {
                    Text                  = Properties.Resources.BigChance,
                    TextColor             = Color.LightBlue,
                    VerticalOptions       = LayoutOptions.CenterAndExpand,
                    VerticalTextAlignment = TextAlignment.Center
                };
                bigChanceNameLayout.Children.Add(bigChanceNameLabel);
                summaryItemView.Children.Add(bigChanceNameLayout);
                break;

            case "PENALTY":
                StackLayout penaltyNameLayout = new StackLayout()
                {
                    VerticalOptions = LayoutOptions.Center
                };
                Label penaltyNameLabel = new Label()
                {
                    Text                  = Properties.Resources.Penalty,
                    TextColor             = Color.LightBlue,
                    VerticalOptions       = LayoutOptions.CenterAndExpand,
                    VerticalTextAlignment = TextAlignment.Center
                };
                penaltyNameLayout.Children.Add(penaltyNameLabel);
                summaryItemView.Children.Add(penaltyNameLayout);
                break;

            case "PENALTYMISSED":
                StackLayout penaltyMissedNameLayout = new StackLayout()
                {
                    VerticalOptions = LayoutOptions.Center
                };
                Label penaltyMissedNameLabel = new Label()
                {
                    Text                  = Properties.Resources.PenaltyMissed,
                    TextColor             = Color.Red,
                    VerticalOptions       = LayoutOptions.CenterAndExpand,
                    VerticalTextAlignment = TextAlignment.Center
                };
                penaltyMissedNameLayout.Children.Add(penaltyMissedNameLabel);
                summaryItemView.Children.Add(penaltyMissedNameLayout);
                break;

            case "CORNER":
                StackLayout cornerNameLayout = new StackLayout()
                {
                    VerticalOptions = LayoutOptions.Center
                };
                Label cornerNameLabel = new Label()
                {
                    Text                  = Properties.Resources.Corner,
                    TextColor             = Color.FromHex("#a6a6a6"),
                    VerticalOptions       = LayoutOptions.CenterAndExpand,
                    VerticalTextAlignment = TextAlignment.Center
                };
                cornerNameLayout.Children.Add(cornerNameLabel);
                summaryItemView.Children.Add(cornerNameLayout);
                break;

            case "ONTARGET":
                StackLayout onTargetNameLayout = new StackLayout()
                {
                    VerticalOptions = LayoutOptions.Center
                };
                Label onTargetNameLabel = new Label()
                {
                    Text                  = Properties.Resources.OnTarget,
                    TextColor             = Color.FromHex("#a6a6a6"),
                    VerticalOptions       = LayoutOptions.CenterAndExpand,
                    VerticalTextAlignment = TextAlignment.Center
                };
                onTargetNameLayout.Children.Add(onTargetNameLabel);
                summaryItemView.Children.Add(onTargetNameLayout);
                break;

            case "OFFTARGET":
                StackLayout offTargetNameLayout = new StackLayout()
                {
                    VerticalOptions = LayoutOptions.Center
                };
                Label offTargetNameLabel = new Label()
                {
                    Text                  = Properties.Resources.OffTarget,
                    TextColor             = Color.FromHex("#a6a6a6"),
                    VerticalOptions       = LayoutOptions.CenterAndExpand,
                    VerticalTextAlignment = TextAlignment.Center
                };
                offTargetNameLayout.Children.Add(offTargetNameLabel);
                summaryItemView.Children.Add(offTargetNameLayout);
                break;

            case "BLOCKEDSHOT":
                StackLayout blockedShotNameLayout = new StackLayout()
                {
                    VerticalOptions = LayoutOptions.Center
                };
                Label blockedShotNameLabel = new Label()
                {
                    Text                  = Properties.Resources.BlockedShot,
                    TextColor             = Color.FromHex("#a6a6a6"),
                    VerticalOptions       = LayoutOptions.CenterAndExpand,
                    VerticalTextAlignment = TextAlignment.Center
                };
                blockedShotNameLayout.Children.Add(blockedShotNameLabel);
                summaryItemView.Children.Add(blockedShotNameLayout);
                break;
            }
        }
Example #24
0
        internal List <EventOfMatch> GetSummaryEventsList(MatchDetails selectedMatch)
        {
            List <EventOfMatch> summaryEventOfMatchesList = new List <EventOfMatch>();
            var eventsList = selectedMatch?.EventsOfMatch?.ToList();
            int homeScore  = 0;
            int awayScore  = 0;

            foreach (var eventOfMatch in eventsList ?? new List <EventOfMatch>())
            {
                EventOfMatch summaryEventOfMatch = new EventOfMatch()
                {
                    HomeTeamScore    = 0,
                    AwayTeamScore    = 0,
                    HomeTeam         = eventOfMatch?.EventTeam == selectedMatch?.Match?.HomeTeam ? selectedMatch?.Match?.HomeTeam : string.Empty,
                    AwayTeam         = eventOfMatch?.EventTeam == selectedMatch?.Match?.AwayTeam ? selectedMatch?.Match?.AwayTeam : string.Empty,
                    EventName        = eventOfMatch?.EventName,
                    EventMinute      = eventOfMatch?.EventMinute,
                    HomeMainPlayer   = GetEventPlayer(selectedMatch, eventOfMatch?.EventTeam.ToUpper().Trim() == selectedMatch?.Match?.HomeTeam?.ToUpper().Trim() ? eventOfMatch?.MainPlayerOfMatchID : null),
                    HomeSecondPlayer = GetEventPlayer(selectedMatch, eventOfMatch?.EventTeam.ToUpper().Trim() == selectedMatch?.Match?.HomeTeam?.ToUpper().Trim() ? eventOfMatch?.SecondPlayerOfMatchID : null),
                    AwayMainPlayer   = GetEventPlayer(selectedMatch, eventOfMatch?.EventTeam.ToUpper().Trim() == selectedMatch?.Match?.AwayTeam?.ToUpper().Trim() ? eventOfMatch?.MainPlayerOfMatchID : null),
                    AwaySecondPlayer = GetEventPlayer(selectedMatch, eventOfMatch?.EventTeam.ToUpper().Trim() == selectedMatch?.Match?.AwayTeam?.ToUpper().Trim() ? eventOfMatch?.SecondPlayerOfMatchID : null)
                };
                summaryEventOfMatch.HomeTeamVisible = !string.IsNullOrEmpty(summaryEventOfMatch.HomeTeam);
                summaryEventOfMatch.AwayTeamVisible = !string.IsNullOrEmpty(summaryEventOfMatch.AwayTeam);
                if (IsGoal(eventOfMatch))
                {
                    if (eventOfMatch.EventTeam.ToUpper().Trim() == selectedMatch?.Match?.HomeTeam?.ToUpper().Trim())
                    {
                        homeScore += 1;
                    }
                    if (eventOfMatch.EventTeam.ToUpper().Trim() == selectedMatch?.Match?.AwayTeam.ToUpper().Trim())
                    {
                        awayScore += 1;
                    }
                }
                summaryEventOfMatch.HomeTeamScore = homeScore;
                summaryEventOfMatch.AwayTeamScore = awayScore;

                if (eventOfMatch.EventName == "GOAL")
                {
                    int eventIndex = eventsList.IndexOf(eventOfMatch);
                    if (eventIndex + 1 < eventsList.Count)
                    {
                        EventOfMatch nextEvent = eventsList[eventIndex + 1];
                        if (nextEvent.EventName == "ASSIST")
                        {
                            if (eventOfMatch.EventTeam.ToUpper().Trim() == selectedMatch?.Match?.HomeTeam.ToUpper().Trim())
                            {
                                summaryEventOfMatch.HomeSecondPlayer = GetEventPlayer(selectedMatch, nextEvent?.EventTeam.ToUpper().Trim() == selectedMatch?.Match?.HomeTeam.ToUpper().Trim() ? nextEvent?.MainPlayerOfMatchID : null);
                            }
                            if (eventOfMatch.EventTeam.ToUpper().Trim() == selectedMatch?.Match?.AwayTeam.ToUpper().Trim())
                            {
                                summaryEventOfMatch.AwaySecondPlayer = GetEventPlayer(selectedMatch, nextEvent?.EventTeam.ToUpper().Trim() == selectedMatch?.Match?.AwayTeam.ToUpper().Trim() ? nextEvent?.MainPlayerOfMatchID : null);
                            }
                        }
                    }
                }
                summaryEventOfMatchesList.Add(summaryEventOfMatch);
            }

            return(summaryEventOfMatchesList.ToList());
        }
 private async void Edit_Event_Tapped(object sender, EventArgs e)
 {
     EventOfMatch eventOfMatch = (e as TappedEventArgs).Parameter as EventOfMatch;
     var          playersList  = GetPlayersList(eventOfMatch.EventTeam);
     await Navigation.PushAsync(new SelectedEventPage(_selectedLiveMatch, eventOfMatch.EventTeam, eventOfMatch.EventName, playersList, eventOfMatch), false);
 }
 private async void EditEvent_Tapped(object sender, EventArgs e)
 {
     EventOfMatch eventOfMatch = (e as TappedEventArgs).Parameter as EventOfMatch;
     await Navigation.PushAsync(new EventSelectedPage(_viewModel, eventOfMatch.EventName, eventOfMatch), false);
 }
Example #27
0
 bool IsGoal(EventOfMatch matchEvent)
 {
     return(matchEvent.EventName == "GOAL" ||
            matchEvent.EventName == "OWNGOAL" ||
            matchEvent.EventName == "PENALTYSCORED");
 }