Merge branch 'dev' of https://github.com/kennyboy55/YJMPD-UWP into dev
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -107,14 +107,8 @@ namespace YJMPD_UWP.Model
|
||||
private async Task<bool> 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<bool> StopGame()
|
||||
{
|
||||
Reset();
|
||||
//Do stuff
|
||||
|
||||
UpdateGameStatus(GameStatus.STOPPED);
|
||||
return true;
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -11,31 +11,43 @@
|
||||
<Page.Resources>
|
||||
<convert:BoolToVisibilityConverter x:Key="BoolToVisConverter" />
|
||||
</Page.Resources>
|
||||
|
||||
<ScrollViewer>
|
||||
<StackPanel Style="{StaticResource BaseStackPanel}" >
|
||||
<StackPanel>
|
||||
<TextBlock Text="Start a match" Style="{StaticResource Header}" />
|
||||
<Button Content="Start match" Style="{StaticResource Green}" Click="StartMatchButton_Click" IsEnabled="{Binding MatchAvailable}" Visibility="{Binding StartMatch, Converter={StaticResource BoolToVisConverter}}" />
|
||||
<Button Content="Leave match" Style="{StaticResource Red}" Click="StopMatchButton_Click" Visibility="{Binding StopMatch, Converter={StaticResource BoolToVisConverter}}" />
|
||||
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="*" />
|
||||
<RowDefinition Height="Auto" />
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<ScrollViewer Grid.Row="0">
|
||||
<StackPanel Style="{StaticResource BaseStackPanel}" >
|
||||
<StackPanel>
|
||||
<TextBlock Text="Start a match" Style="{StaticResource Header}" />
|
||||
<Button Content="Start match" Style="{StaticResource Green}" Click="StartMatchButton_Click" IsEnabled="{Binding MatchAvailable}" Visibility="{Binding StartMatch, Converter={StaticResource BoolToVisConverter}}" />
|
||||
<Button Content="Leave match" Style="{StaticResource Red}" Click="StopMatchButton_Click" Visibility="{Binding StopMatch, Converter={StaticResource BoolToVisConverter}}" />
|
||||
</StackPanel>
|
||||
|
||||
<StackPanel Visibility="{Binding StopMatch, Converter={StaticResource BoolToVisConverter}}" Margin="0,10,0,0">
|
||||
<TextBlock Text="Current players in match" Style="{StaticResource Header}" />
|
||||
|
||||
<TextBlock Text="{Binding PlayersCount}" />
|
||||
|
||||
<ListView x:Name="PlayersList" ItemsSource="{Binding Players}" SelectionMode="None" IsTapEnabled="False">
|
||||
<ListView.ItemTemplate>
|
||||
<DataTemplate x:Name="ListViewDataTemplate">
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<TextBlock Text="{Binding Username}" />
|
||||
</StackPanel>
|
||||
</DataTemplate>
|
||||
</ListView.ItemTemplate>
|
||||
</ListView>
|
||||
|
||||
</StackPanel>
|
||||
</StackPanel>
|
||||
</ScrollViewer>
|
||||
|
||||
<StackPanel Visibility="{Binding StopMatch, Converter={StaticResource BoolToVisConverter}}" Margin="0,10,0,0">
|
||||
<TextBlock Text="Current players in match" Style="{StaticResource Header}" />
|
||||
|
||||
<TextBlock Text="{Binding PlayersCount}" />
|
||||
|
||||
<ListView x:Name="PlayersList" ItemsSource="{Binding Players}" SelectionMode="None" IsTapEnabled="False">
|
||||
<ListView.ItemTemplate>
|
||||
<DataTemplate x:Name="ListViewDataTemplate">
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<TextBlock Text="{Binding Username}" />
|
||||
</StackPanel>
|
||||
</DataTemplate>
|
||||
</ListView.ItemTemplate>
|
||||
</ListView>
|
||||
|
||||
</StackPanel>
|
||||
<StackPanel Orientation="Horizontal" Grid.Row="1" Visibility="{Binding ConnectingServer, Converter={StaticResource BoolToVisConverter}}" Padding="20" Background="Gray">
|
||||
<ProgressRing Width="20" Height="20" IsActive="True" Margin="0,0,10,0" Foreground="White"/>
|
||||
<TextBlock Text="Waiting on server..." Foreground="White" />
|
||||
</StackPanel>
|
||||
</ScrollViewer>
|
||||
</Grid>
|
||||
</Page>
|
||||
|
||||
Reference in New Issue
Block a user