From a47bbe8211c4b7a02c6974cba017d77ea31ffc37 Mon Sep 17 00:00:00 2001 From: Roy Date: Sun, 5 Mar 2023 22:47:23 +0200 Subject: Dialog Adaptations. Separate Job View. Machine Status View Start. EurekaTouchPanel. --- .../Tango.PPC.UI/Views/MachineStatusView.xaml.cs | 61 ++++++++++++++++++++++ 1 file changed, 61 insertions(+) create mode 100644 Software/Visual_Studio/PPC/Tango.PPC.UI/Views/MachineStatusView.xaml.cs (limited to 'Software/Visual_Studio/PPC/Tango.PPC.UI/Views/MachineStatusView.xaml.cs') 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 +{ + /// + /// Interaction logic for MachineStatusView.xaml + /// + 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(); + } + } +} -- cgit v1.3.1