aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio/PPC/Tango.PPC.UI/Views/MachineStatusView.xaml.cs
diff options
context:
space:
mode:
Diffstat (limited to 'Software/Visual_Studio/PPC/Tango.PPC.UI/Views/MachineStatusView.xaml.cs')
-rw-r--r--Software/Visual_Studio/PPC/Tango.PPC.UI/Views/MachineStatusView.xaml.cs61
1 files changed, 61 insertions, 0 deletions
diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/Views/MachineStatusView.xaml.cs b/Software/Visual_Studio/PPC/Tango.PPC.UI/Views/MachineStatusView.xaml.cs
new file mode 100644
index 000000000..2ee98bc2b
--- /dev/null
+++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/Views/MachineStatusView.xaml.cs
@@ -0,0 +1,61 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows;
+using System.Windows.Controls;
+using System.Windows.Data;
+using System.Windows.Documents;
+using System.Windows.Input;
+using System.Windows.Media;
+using System.Windows.Media.Imaging;
+using System.Windows.Navigation;
+using System.Windows.Shapes;
+using Tango.Core.EventArguments;
+using Tango.PPC.UI.ViewModels;
+
+namespace Tango.PPC.UI.Views
+{
+ /// <summary>
+ /// Interaction logic for MachineStatusView.xaml
+ /// </summary>
+ public partial class MachineStatusView : UserControl
+ {
+ private MachineStatusViewVM _vm;
+ private System.Timers.Timer _timer;
+
+ public MachineStatusView()
+ {
+ InitializeComponent();
+
+ techPressElement.RegisterForPreviewMouseOrTouchDown(OnMouseOrTouchDown);
+ techPressElement.RegisterForPreviewMouseOrTouchUp(OnMouseOrTouchUp);
+ _timer = new System.Timers.Timer();
+ _timer.Interval = TimeSpan.FromSeconds(10).TotalMilliseconds;
+ _timer.Elapsed += _timer_Elapsed;
+
+ Loaded += (_, __) => _vm = DataContext as MachineStatusViewVM;
+ }
+
+ private void _timer_Elapsed(object sender, System.Timers.ElapsedEventArgs e)
+ {
+ _timer.Stop();
+
+ Dispatcher.BeginInvoke(new Action(() =>
+ {
+ _vm.ToggleTechnicianMode();
+ }));
+ }
+
+ private void OnMouseOrTouchDown(object sender, MouseOrTouchEventArgs e)
+ {
+ _timer.Start();
+ }
+
+ private void OnMouseOrTouchUp(object sender, MouseOrTouchEventArgs e)
+ {
+ _timer.Stop();
+ }
+ }
+}