Actual fix random network sending + stopgame command

This commit is contained in:
2016-01-21 21:33:59 +01:00
parent 29c7e5d1bb
commit 8ceb630bc2
2 changed files with 21 additions and 1 deletions
+5 -1
View File
@@ -26,7 +26,8 @@ namespace YJMPD_UWP.Model
PictureUrl,
DestinationReached,
GameEnded,
PlayerReady
PlayerReady,
StopGame
}
public ApiHandler()
@@ -94,6 +95,9 @@ namespace YJMPD_UWP.Model
App.Game.StopMatch();
break;
case Command.StopGame:
App.Game.StopGame();
break;
default:
//Do nothing
break;
+16
View File
@@ -19,6 +19,22 @@ namespace YJMPD_UWP.ViewModels
timer.Interval = TimeSpan.FromSeconds(1);
timer.Tick += Timer_Tick;
timer.Start();
App.Photo.OnStatusUpdate += Photo_OnStatusUpdate;
}
private void Photo_OnStatusUpdate(object sender, Helpers.EventArgs.PhotoStatusUpdatedEventArgs e)
{
dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.Normal, () =>
{
if (e.Status == Model.PhotoHandler.PhotoStatus.NOPHOTO)
timer.Start();
else
{
secondsleft = 60;
timer.Stop();
}
});
}
private void Timer_Tick(object sender, object e)