This commit is contained in:
2016-01-19 21:51:19 +01:00
parent e59aad59ed
commit cf6861d86f
4 changed files with 25 additions and 13 deletions
+16 -4
View File
@@ -49,6 +49,9 @@ namespace YJMPD_UWP.Model
public async Task<bool> Write(string data)
{
if (client.InputStream == null || client.OutputStream == null)
return false;
dout.WriteString(data + Environment.NewLine);
await dout.StoreAsync();
await dout.FlushAsync();
@@ -86,9 +89,18 @@ namespace YJMPD_UWP.Model
while (workItem.Status != AsyncStatus.Canceled)
{
Debug.WriteLine("Awaiting incoming data...");
string data = await App.Network.Read();
App.Network.HandleMessage(data);
await Task.Delay(TimeSpan.FromMilliseconds(50));
if(client.InputStream != null && client.OutputStream != null)
{
string data = await Read();
HandleMessage(data);
await Task.Delay(TimeSpan.FromMilliseconds(50));
}
else
{
Disconnect();
workItem.Cancel();
}
}
});
@@ -98,7 +110,7 @@ namespace YJMPD_UWP.Model
public async Task<bool> Disconnect()
{
if(App.Game.Status != GameHandler.GameStatus.STOPPED)
App.Api.LeaveGame();
await App.Api.LeaveGame();
UpdateNetworkStatus(NetworkStatus.DISCONNECTED);
+4 -1
View File
@@ -62,7 +62,10 @@ namespace YJMPD_UWP.ViewModels
{
get
{
return "There are currently " + App.Game.Players.Count + " players in the match.";
if (App.Game.Players.Count == 1)
return "There is currently " + App.Game.Players.Count + " player in the match.";
else
return "There are currently " + App.Game.Players.Count + " players in the match.";
}
}
+4 -1
View File
@@ -36,7 +36,10 @@ namespace YJMPD_UWP.ViewModels
{
get
{
return "There are currently " + App.Game.Players.Count + " players in the match.";
if (App.Game.Players.Count == 1)
return "There is currently " + App.Game.Players.Count + " player in the match.";
else
return "There are currently " + App.Game.Players.Count + " players in the match.";
}
}
}
+1 -7
View File
@@ -1,4 +1,5 @@
using System;
using System.Diagnostics;
using System.Threading.Tasks;
using Windows.UI.Xaml.Controls;
@@ -9,13 +10,6 @@ namespace YJMPD_UWP.Views
public WaitingView()
{
this.InitializeComponent();
StartWait();
}
private async void StartWait()
{
await Task.Delay(TimeSpan.FromSeconds(2));
App.Navigate(typeof(PhotoView));
}
}
}