private async void Button_Clicked() { if (CurrentSelectedIndex == 0) { if (string.IsNullOrWhiteSpace(Player1)) { await DialogService.DisplayAlertAsync("", "Please insert player 1", "OK"); return; } else if (string.IsNullOrWhiteSpace(Player2)) { await DialogService.DisplayAlertAsync("", "Please insert player 2", "OK"); return; } else if (string.IsNullOrWhiteSpace(Player3)) { await DialogService.DisplayAlertAsync("", "Please insert player 3", "OK"); return; } else if (string.IsNullOrWhiteSpace(Player4)) { await DialogService.DisplayAlertAsync("", "Please insert player 4", "OK"); return; } } else if (CurrentSelectedIndex == 1) { if (string.IsNullOrWhiteSpace(Player1)) { await DialogService.DisplayAlertAsync("", "Please insert player 1", "OK"); return; } else if (string.IsNullOrWhiteSpace(Player2)) { await DialogService.DisplayAlertAsync("", "Please insert player 2", "OK"); return; } else if (string.IsNullOrWhiteSpace(Player3)) { await DialogService.DisplayAlertAsync("", "Please insert player 3", "OK"); return; } else if (string.IsNullOrWhiteSpace(Player4)) { await DialogService.DisplayAlertAsync("", "Please insert player 4", "OK"); return; } else if (string.IsNullOrWhiteSpace(Player5)) { await DialogService.DisplayAlertAsync("", "Please insert player 5", "OK"); return; } } else { if (string.IsNullOrWhiteSpace(Player1)) { await DialogService.DisplayAlertAsync("", "Please insert player 1", "OK"); return; } else if (string.IsNullOrWhiteSpace(Player2)) { await DialogService.DisplayAlertAsync("", "Please insert player 2", "OK"); return; } else if (string.IsNullOrWhiteSpace(Player3)) { await DialogService.DisplayAlertAsync("", "Please insert player 3", "OK"); return; } else if (string.IsNullOrWhiteSpace(Player4)) { await DialogService.DisplayAlertAsync("", "Please insert player 4", "OK"); return; } else if (string.IsNullOrWhiteSpace(Player5)) { await DialogService.DisplayAlertAsync("", "Please insert player 5", "OK"); return; } else if (string.IsNullOrWhiteSpace(Player6)) { await DialogService.DisplayAlertAsync("", "Please insert player 6", "OK"); return; } } List <Player> players = new List <Player>(); if (CurrentSelectedIndex == 0) { await NavigationMethod.NavigateAsync(nameof(MainPage)); players.Add(new Player(Player1.ToString())); players.Add(new Player(Player2.ToString())); players.Add(new Player(Player3.ToString())); players.Add(new Player(Player4.ToString())); EventAggregator.GetEvent <MessageSentEvent>().Publish(players); } else if (CurrentSelectedIndex == 1) { await NavigationMethod.NavigateAsync(nameof(MainPageWith5Players)); players.Add(new Player(Player1.ToString())); players.Add(new Player(Player2.ToString())); players.Add(new Player(Player3.ToString())); players.Add(new Player(Player4.ToString())); players.Add(new Player(Player5.ToString())); EventAggregator.GetEvent <MessageSentEvent5Players>().Publish(players); } else { await NavigationMethod.NavigateAsync(nameof(MainPageWith6Players)); players.Add(new Player(Player1.ToString())); players.Add(new Player(Player2.ToString())); players.Add(new Player(Player3.ToString())); players.Add(new Player(Player4.ToString())); players.Add(new Player(Player5.ToString())); players.Add(new Player(Player6.ToString())); EventAggregator.GetEvent <MessageSentEvent6Players>().Publish(players); } }