| 123456789101112131415161718192021222324252627282930313233343536373839404142434445 |
- using System;
- using System.Diagnostics;
- using Windows.UI.Xaml;
- using Windows.UI.Xaml.Media;
- using Windows.UI.Xaml.Media.Imaging;
- namespace YJMPD_UWP.ViewModels
- {
- public class PhotoVM : TemplateVM
- {
- DispatcherTimer timer;
- int secondsleft = 60;
- public PhotoVM() : base("Photo")
- {
- timer = new DispatcherTimer();
- timer.Interval = TimeSpan.FromSeconds(1);
- timer.Tick += Timer_Tick;
- timer.Start();
- }
- private void Timer_Tick(object sender, object e)
- {
- NotifyPropertyChanged(nameof(TimeOut));
- secondsleft--;
- if(secondsleft <= 0)
- {
- timer.Stop();
- secondsleft = 60;
- App.Game.StopGame();
- }
- }
- public string TimeOut
- {
- get
- {
- return "Take a photo within " + secondsleft + " seconds";
- }
- }
- }
- }
|