aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio/PPC/Tango.PPC.UI/Views/LayoutView.xaml.cs
diff options
context:
space:
mode:
authorRoy Ben Shabat <Roy.mail.net@gmail.com>2020-09-10 20:31:59 +0300
committerRoy Ben Shabat <Roy.mail.net@gmail.com>2020-09-10 20:31:59 +0300
commite318068258baf07b4d1d70725a5c35232aee8547 (patch)
tree0374b1beec7b61804c22f716d1373ec68319648b /Software/Visual_Studio/PPC/Tango.PPC.UI/Views/LayoutView.xaml.cs
parent42a59f0ee4547552971ec493d6982e4235215eea (diff)
downloadTango-e318068258baf07b4d1d70725a5c35232aee8547.tar.gz
Tango-e318068258baf07b4d1d70725a5c35232aee8547.zip
Improved accuracy of technician mode timer.
Diffstat (limited to 'Software/Visual_Studio/PPC/Tango.PPC.UI/Views/LayoutView.xaml.cs')
-rw-r--r--Software/Visual_Studio/PPC/Tango.PPC.UI/Views/LayoutView.xaml.cs16
1 files changed, 10 insertions, 6 deletions
diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/Views/LayoutView.xaml.cs b/Software/Visual_Studio/PPC/Tango.PPC.UI/Views/LayoutView.xaml.cs
index 883d3f893..b87f14b89 100644
--- a/Software/Visual_Studio/PPC/Tango.PPC.UI/Views/LayoutView.xaml.cs
+++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/Views/LayoutView.xaml.cs
@@ -30,7 +30,7 @@ namespace Tango.PPC.UI.Views
{
public static LayoutView Instance { get; private set; }
private LayoutViewVM _vm;
- private DispatcherTimer _timer;
+ private System.Timers.Timer _timer;
public LayoutView()
{
@@ -39,9 +39,9 @@ namespace Tango.PPC.UI.Views
Loaded += (_, __) => _vm = DataContext as LayoutViewVM;
techPressElement.RegisterForPreviewMouseOrTouchDown(OnMouseOrTouchDown);
techPressElement.RegisterForPreviewMouseOrTouchUp(OnMouseOrTouchUp);
- _timer = new DispatcherTimer();
- _timer.Interval = TimeSpan.FromSeconds(10);
- _timer.Tick += _timer_Tick;
+ _timer = new System.Timers.Timer();
+ _timer.Interval = TimeSpan.FromSeconds(10).TotalMilliseconds;
+ _timer.Elapsed += _timer_Elapsed;
this.PreviewMouseUp += LayoutView_PreviewMouseUp;
}
@@ -51,10 +51,14 @@ namespace Tango.PPC.UI.Views
_vm.ApplicationManager.ResetScreenLockTimer();
}
- private void _timer_Tick(object sender, EventArgs e)
+ private void _timer_Elapsed(object sender, System.Timers.ElapsedEventArgs e)
{
_timer.Stop();
- _vm.ToggleTechnicianMode();
+
+ Dispatcher.BeginInvoke(new Action(() =>
+ {
+ _vm.ToggleTechnicianMode();
+ }));
}
private void OnMouseOrTouchDown(object sender, MouseOrTouchEventArgs e)