diff --git a/YJMPD-UWP/Model/ApiHandler.cs b/YJMPD-UWP/Model/ApiHandler.cs index a941445..b242619 100644 --- a/YJMPD-UWP/Model/ApiHandler.cs +++ b/YJMPD-UWP/Model/ApiHandler.cs @@ -7,6 +7,7 @@ using System.Linq; using System.Text; using System.Threading.Tasks; using YJMPD_UWP.Helpers; +using YJMPD_UWP.Views; namespace YJMPD_UWP.Model { @@ -54,7 +55,10 @@ namespace YJMPD_UWP.Model { Debug.WriteLine("Selected player taking picture"); App.Game.Selected = true; + App.Navigate(typeof(PhotoView)); } + else + App.Navigate(typeof(WaitingView)); break; default: //Do nothing diff --git a/YJMPD-UWP/Model/GameHandler.cs b/YJMPD-UWP/Model/GameHandler.cs index b9371d2..ff2a32b 100644 --- a/YJMPD-UWP/Model/GameHandler.cs +++ b/YJMPD-UWP/Model/GameHandler.cs @@ -107,14 +107,8 @@ namespace YJMPD_UWP.Model private async Task StartGame() { UpdateGameStatus(GameStatus.SEARCHING); + Search(); - - - UpdateGameStatus(GameStatus.WAITING); - - await Task.Delay(TimeSpan.FromSeconds(5)); - - UpdateGameStatus(GameStatus.STARTED); return true; } @@ -122,7 +116,6 @@ namespace YJMPD_UWP.Model private async Task StopGame() { Reset(); - //Do stuff UpdateGameStatus(GameStatus.STOPPED); return true; diff --git a/YJMPD-UWP/Model/NetworkHandler.cs b/YJMPD-UWP/Model/NetworkHandler.cs index 4991444..2b8509b 100644 --- a/YJMPD-UWP/Model/NetworkHandler.cs +++ b/YJMPD-UWP/Model/NetworkHandler.cs @@ -83,7 +83,7 @@ namespace YJMPD_UWP.Model BackgroundReader = Windows.System.Threading.ThreadPool.RunAsync(async (workItem) => { - while (true) + while (workItem.Status != AsyncStatus.Canceled) { Debug.WriteLine("Awaiting incoming data..."); string data = await App.Network.Read(); diff --git a/YJMPD-UWP/ViewModels/MatchVM.cs b/YJMPD-UWP/ViewModels/MatchVM.cs index b532b1e..fc2f31c 100644 --- a/YJMPD-UWP/ViewModels/MatchVM.cs +++ b/YJMPD-UWP/ViewModels/MatchVM.cs @@ -36,6 +36,7 @@ namespace YJMPD_UWP.ViewModels dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.Normal, () => { NotifyPropertyChanged(nameof(MatchAvailable)); + NotifyPropertyChanged(nameof(ConnectingServer)); }); } @@ -44,6 +45,7 @@ namespace YJMPD_UWP.ViewModels dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.Normal, () => { NotifyPropertyChanged(nameof(MatchAvailable)); + NotifyPropertyChanged(nameof(ConnectingServer)); }); } @@ -72,6 +74,14 @@ namespace YJMPD_UWP.ViewModels } } + public bool ConnectingServer + { + get + { + return !MatchAvailable; + } + } + public bool StartMatch { get diff --git a/YJMPD-UWP/Views/MatchView.xaml b/YJMPD-UWP/Views/MatchView.xaml index 09a0392..de8292b 100644 --- a/YJMPD-UWP/Views/MatchView.xaml +++ b/YJMPD-UWP/Views/MatchView.xaml @@ -11,31 +11,43 @@ - - - - - -