| | |
| | | using HMI.Core.Manager; |
| | | using HMI.Core.Util; |
| | | using HMI.UI; |
| | | using HMI.UI.Util; |
| | | using HMI.Util; |
| | | using NationalInstruments.TestStand.Interop.API; |
| | | using Plugin.TsExecution.Entity; |
| | |
| | | using System.ComponentModel; |
| | | using System.IO; |
| | | using System.Runtime.CompilerServices; |
| | | using System.Threading; |
| | | using System.Timers; |
| | | using System.Windows; |
| | | using System.Windows.Controls; |
| | | using System.Windows.Media; |
| | | |
| | | namespace Plugin.TsExecution |
| | | { |
| | |
| | | if (value == "Start Timing") |
| | | { |
| | | this.refreshTimer.Enabled = true; |
| | | TimeNow = DateTime.Now; |
| | | TestStartTime = DateTime.Now; |
| | | StepStartTime = DateTime.Now; |
| | | } |
| | | else |
| | | { |
| | |
| | | } |
| | | } |
| | | |
| | | private DateTime TimeNow = new DateTime(); |
| | | private DateTime TestStartTime = new DateTime(); |
| | | private DateTime StepStartTime = new DateTime(); |
| | | private TimeSpan TimeCount = new TimeSpan(); |
| | | |
| | | private System.Timers.Timer refreshTimer; |
| | |
| | | |
| | | //AddTestData("1", "1", "1", "1", "1", "1", "1"); |
| | | |
| | | TimeCount = DateTime.Now - TimeNow; |
| | | TimeCount = DateTime.Now - TestStartTime; |
| | | elapseTime = string.Format("{0:00}:{1:00}:{2:00}", TimeCount.Hours, TimeCount.Minutes, TimeCount.Seconds); |
| | | Set("ElapseTime"); |
| | | Set("TestInfo"); |
| | |
| | | Unit = unit, |
| | | Result = Status |
| | | }; |
| | | Dispatcher.BeginInvoke(new Action(() => |
| | | table.Dispatcher.Invoke(new Action(() => |
| | | { |
| | | var now = DateTime.Now; |
| | | var span = now - StepStartTime; |
| | | StepStartTime = now; |
| | | data.ConsumeTime = $"{span.Seconds}s"; |
| | | Datasource.Add(data); |
| | | table.ScrollIntoView(data); |
| | | })); |
| | |
| | | } |
| | | public void ShowScannerPanel() |
| | | { |
| | | scannerPanel.Visibility = Visibility.Visible; |
| | | //scannerPanel.Visibility = Visibility.Visible; |
| | | } |
| | | |
| | | private void SendSnr2Ts() |
| | | { |
| | | try |
| | | { |
| | | string snr = TbManualSnr.Text; |
| | | SequenceFileContext?.StationGlobals.SetValString($"StationState.SN[{index}]", 1, snr); |
| | | scannerPanel.Visibility = Visibility.Collapsed; |
| | | TbManualSnr.Text = string.Empty; |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | ToastHelper.Error(ex.Message); |
| | | } |
| | | //try |
| | | //{ |
| | | // string snr = TbManualSnr.Text; |
| | | // SequenceFileContext?.StationGlobals.SetValString($"StationState.SN[{index}]", 1, snr); |
| | | // scannerPanel.Visibility = Visibility.Collapsed; |
| | | // TbManualSnr.Text = string.Empty; |
| | | //} |
| | | //catch (Exception ex) |
| | | //{ |
| | | // ToastHelper.Error(ex.Message); |
| | | //} |
| | | } |
| | | |
| | | private void pausePanel_Loaded(object sender, RoutedEventArgs e) |
| | |
| | | } |
| | | else |
| | | { |
| | | var can = scannerPanel; |
| | | var modal = scannerVisualModal; |
| | | Canvas.SetLeft(modal, (scannerPanel.ActualWidth - scannerVisualModal.ActualWidth) / 2); |
| | | Canvas.SetTop(modal, (scannerPanel.ActualHeight - scannerVisualModal.ActualHeight) / 2); |
| | | //var can = scannerPanel; |
| | | //var modal = scannerVisualModal; |
| | | //Canvas.SetLeft(modal, (scannerPanel.ActualWidth - scannerVisualModal.ActualWidth) / 2); |
| | | //Canvas.SetTop(modal, (scannerPanel.ActualHeight - scannerVisualModal.ActualHeight) / 2); |
| | | } |
| | | } |
| | | |
| | | private void TextBlock_MouseDown(object sender, System.Windows.Input.MouseButtonEventArgs e) |
| | | { |
| | | DependencyObject parent = VisualTreeHelper.GetParent((DependencyObject)sender); |
| | | while (parent != null) { |
| | | parent = VisualTreeHelper.GetParent(parent); |
| | | } |
| | | } |
| | | } |