diff --git a/YJMPD-UWP/MainPage.xaml.cs b/YJMPD-UWP/MainPage.xaml.cs index c9d2b7e..38e5833 100644 --- a/YJMPD-UWP/MainPage.xaml.cs +++ b/YJMPD-UWP/MainPage.xaml.cs @@ -121,7 +121,11 @@ namespace YJMPD_UWP NavView.IsPaneOpen = false; if (NavListHome.IsSelected) + { + if (Frame.BackStack.Count >= 1) + Frame.BackStack.Clear(); Frame.Navigate(typeof(MatchView)); + } else if (NavListStatistics.IsSelected) Frame.Navigate(typeof(StatisticsView)); @@ -138,13 +142,10 @@ namespace YJMPD_UWP NavView.IsPaneOpen = false; } - private async void BackToGame_Click(object sender, RoutedEventArgs e) + private void BackToGame_Click(object sender, RoutedEventArgs e) { - bool b = await Util.ShowConfirmDialog("View Scores", "Go to the scores page (test)?", Util.DialogType.OKCANCEL); - if(b) - { - App.Navigate(typeof(ScoreView)); - } + NavView.IsPaneOpen = false; + App.Game.BackToGame(); } private void Content_ManipulationCompleted(object sender, ManipulationCompletedRoutedEventArgs e) diff --git a/YJMPD-UWP/Model/GameHandler.cs b/YJMPD-UWP/Model/GameHandler.cs index 5ef01d0..c1fd045 100644 --- a/YJMPD-UWP/Model/GameHandler.cs +++ b/YJMPD-UWP/Model/GameHandler.cs @@ -3,6 +3,7 @@ using System.Collections.Generic; using System.Threading.Tasks; using YJMPD_UWP.Helpers.EventArgs; using YJMPD_UWP.Model.Object; +using YJMPD_UWP.Views; namespace YJMPD_UWP.Model { @@ -124,5 +125,28 @@ namespace YJMPD_UWP.Model UpdateGameStatus(GameStatus.STOPPED); return true; } + + + public void BackToGame() + { + switch(Status) + { + default: + case GameStatus.STOPPED: + break; + case GameStatus.SEARCHING: + App.Navigate(typeof(MatchView)); + break; + case GameStatus.WAITING: + App.Navigate(typeof(WaitingView)); + break; + case GameStatus.STARTED: + App.Navigate(typeof(GameView)); + break; + case GameStatus.ENDED: + App.Navigate(typeof(ScoreView)); + break; + } + } } } diff --git a/YJMPD-UWP/ViewModels/GameVM.cs b/YJMPD-UWP/ViewModels/GameVM.cs new file mode 100644 index 0000000..7b2fdb3 --- /dev/null +++ b/YJMPD-UWP/ViewModels/GameVM.cs @@ -0,0 +1,16 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace YJMPD_UWP.ViewModels +{ + public class GameVM : TemplateVM + { + public GameVM() : base("Game") + { + + } + } +} diff --git a/YJMPD-UWP/ViewModels/PhotoVM.cs b/YJMPD-UWP/ViewModels/PhotoVM.cs new file mode 100644 index 0000000..5838103 --- /dev/null +++ b/YJMPD-UWP/ViewModels/PhotoVM.cs @@ -0,0 +1,16 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace YJMPD_UWP.ViewModels +{ + public class PhotoVM : TemplateVM + { + public PhotoVM() : base("Photo") + { + + } + } +} diff --git a/YJMPD-UWP/Views/GameView.xaml b/YJMPD-UWP/Views/GameView.xaml new file mode 100644 index 0000000..ae8a5ac --- /dev/null +++ b/YJMPD-UWP/Views/GameView.xaml @@ -0,0 +1,15 @@ + + + + + + + + diff --git a/YJMPD-UWP/Views/GameView.xaml.cs b/YJMPD-UWP/Views/GameView.xaml.cs new file mode 100644 index 0000000..35f8783 --- /dev/null +++ b/YJMPD-UWP/Views/GameView.xaml.cs @@ -0,0 +1,30 @@ +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Runtime.InteropServices.WindowsRuntime; +using Windows.Foundation; +using Windows.Foundation.Collections; +using Windows.UI.Xaml; +using Windows.UI.Xaml.Controls; +using Windows.UI.Xaml.Controls.Primitives; +using Windows.UI.Xaml.Data; +using Windows.UI.Xaml.Input; +using Windows.UI.Xaml.Media; +using Windows.UI.Xaml.Navigation; +using YJMPD_UWP.ViewModels; + +namespace YJMPD_UWP.Views +{ + public sealed partial class GameView : Page + { + GameVM gamevm; + + public GameView() + { + gamevm = new GameVM(); + this.DataContext = gamevm; + this.InitializeComponent(); + } + } +} diff --git a/YJMPD-UWP/Views/PhotoView.xaml b/YJMPD-UWP/Views/PhotoView.xaml new file mode 100644 index 0000000..0469134 --- /dev/null +++ b/YJMPD-UWP/Views/PhotoView.xaml @@ -0,0 +1,15 @@ + + + + + + + + diff --git a/YJMPD-UWP/Views/PhotoView.xaml.cs b/YJMPD-UWP/Views/PhotoView.xaml.cs new file mode 100644 index 0000000..40dea4f --- /dev/null +++ b/YJMPD-UWP/Views/PhotoView.xaml.cs @@ -0,0 +1,30 @@ +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Runtime.InteropServices.WindowsRuntime; +using Windows.Foundation; +using Windows.Foundation.Collections; +using Windows.UI.Xaml; +using Windows.UI.Xaml.Controls; +using Windows.UI.Xaml.Controls.Primitives; +using Windows.UI.Xaml.Data; +using Windows.UI.Xaml.Input; +using Windows.UI.Xaml.Media; +using Windows.UI.Xaml.Navigation; +using YJMPD_UWP.ViewModels; + +namespace YJMPD_UWP.Views +{ + public sealed partial class PhotoView : Page + { + PhotoVM photovm; + + public PhotoView() + { + photovm = new PhotoVM(); + this.DataContext = photovm; + this.InitializeComponent(); + } + } +} diff --git a/YJMPD-UWP/Views/ScoreView.xaml.cs b/YJMPD-UWP/Views/ScoreView.xaml.cs index 8114478..0e9938a 100644 --- a/YJMPD-UWP/Views/ScoreView.xaml.cs +++ b/YJMPD-UWP/Views/ScoreView.xaml.cs @@ -3,6 +3,7 @@ using System.Collections.Generic; using System.IO; using System.Linq; using System.Runtime.InteropServices.WindowsRuntime; +using System.Threading.Tasks; using Windows.Foundation; using Windows.Foundation.Collections; using Windows.UI.Xaml; @@ -28,9 +29,18 @@ namespace YJMPD_UWP.Views } private void ReadyButton_Click(object sender, RoutedEventArgs e) + { + Ready(); + } + + private async void Ready() { ReadyCheck.Visibility = Visibility.Visible; ReadyButton.IsEnabled = false; + + Task.Delay(TimeSpan.FromMilliseconds(1500)); + + App.Navigate(typeof(WaitingView)); } } } diff --git a/YJMPD-UWP/Views/WaitingView.xaml b/YJMPD-UWP/Views/WaitingView.xaml new file mode 100644 index 0000000..0aa24ee --- /dev/null +++ b/YJMPD-UWP/Views/WaitingView.xaml @@ -0,0 +1,16 @@ + + + + + + + + + diff --git a/YJMPD-UWP/Views/WaitingView.xaml.cs b/YJMPD-UWP/Views/WaitingView.xaml.cs new file mode 100644 index 0000000..194e42c --- /dev/null +++ b/YJMPD-UWP/Views/WaitingView.xaml.cs @@ -0,0 +1,30 @@ +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Runtime.InteropServices.WindowsRuntime; +using Windows.Foundation; +using Windows.Foundation.Collections; +using Windows.UI.Xaml; +using Windows.UI.Xaml.Controls; +using Windows.UI.Xaml.Controls.Primitives; +using Windows.UI.Xaml.Data; +using Windows.UI.Xaml.Input; +using Windows.UI.Xaml.Media; +using Windows.UI.Xaml.Navigation; + +// The Blank Page item template is documented at http://go.microsoft.com/fwlink/?LinkId=234238 + +namespace YJMPD_UWP.Views +{ + /// + /// An empty page that can be used on its own or navigated to within a Frame. + /// + public sealed partial class WaitingView : Page + { + public WaitingView() + { + this.InitializeComponent(); + } + } +} diff --git a/YJMPD-UWP/YJMPD-UWP.csproj b/YJMPD-UWP/YJMPD-UWP.csproj index ff7d919..a6fbb45 100644 --- a/YJMPD-UWP/YJMPD-UWP.csproj +++ b/YJMPD-UWP/YJMPD-UWP.csproj @@ -117,8 +117,10 @@ + + @@ -126,9 +128,15 @@ AboutView.xaml + + GameView.xaml + MatchView.xaml + + PhotoView.xaml + ScoreView.xaml @@ -138,6 +146,9 @@ StatisticsView.xaml + + WaitingView.xaml + @@ -183,10 +194,18 @@ MSBuild:Compile Designer + + Designer + MSBuild:Compile + Designer MSBuild:Compile + + Designer + MSBuild:Compile + Designer MSBuild:Compile @@ -199,6 +218,10 @@ Designer MSBuild:Compile + + Designer + MSBuild:Compile +