| | |
| | | } |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 进度值 |
| | | /// </summary> |
| | | private int _processValue; |
| | | public int ProcessValue |
| | | { |
| | | get => _processValue; |
| | | set |
| | | { |
| | | Set(ref _processValue, value); |
| | | } |
| | | } |
| | | |
| | | public string ProcessValueLabel |
| | | { |
| | | get |
| | | { |
| | | if (ProcessValue > 0) return $"{ProcessValue}%"; |
| | | return ""; |
| | | } |
| | | set |
| | | { |
| | | } |
| | | } |
| | | |
| | | public void SetSimpleUI(bool flag) |
| | | { |
| | | if (flag) |
| | | { |
| | | simplePanel.Visibility = Visibility.Visible; |
| | | detailPanel.Visibility = Visibility.Collapsed; |
| | | } |
| | | else |
| | | { |
| | | simplePanel.Visibility = Visibility.Collapsed; |
| | | detailPanel.Visibility = Visibility.Visible; |
| | | } |
| | | } |
| | | |
| | | public int ProbeWarn { get; private set; } |
| | | |
| | | public SingleControl(int Index, string CountIniPath, int probeWarn) |
| | |
| | | /// <param name="ProcessVal"></param> |
| | | public void SetTestProcess(int ProcessVal) |
| | | { |
| | | this.testProcess.Value = ProcessVal; |
| | | this.testProcessLabel.Content = ProcessVal.ToString() + "%"; |
| | | ProcessValue = ProcessVal; |
| | | Set("ProcessValueLabel"); |
| | | } |
| | | |
| | | private void UserControl_Loaded(object sender, RoutedEventArgs e) |
| | |
| | | |
| | | public void ResetCounter() |
| | | { |
| | | this.passNum = 0; |
| | | this.failNum = 0; |
| | | this.PassNum = 0; |
| | | this.FailNum = 0; |
| | | this.UpdateTestCounter(null); |
| | | } |
| | | |
| | | public void WriteToCSV(string path) |
| | | { |
| | | try |
| | | Dispatcher.BeginInvoke(new Action(() => |
| | | { |
| | | |
| | | FileInfo fi = new FileInfo(path); |
| | | if (!fi.Directory.Exists) |
| | | try |
| | | { |
| | | fi.Directory.Create(); //文件不存在,创建文件 |
| | | } |
| | | |
| | | using (FileStream fs = new FileStream(path, FileMode.Create, FileAccess.Write)) |
| | | using (StreamWriter sw = new StreamWriter(fs, System.Text.Encoding.UTF8)) |
| | | { |
| | | string title = "项目名称,测试参数,测试值,上限,下限,单位,结果"; |
| | | sw.WriteLine(title); |
| | | |
| | | if (Datasource != null && Datasource.Count > 0) |
| | | FileInfo fi = new FileInfo(path); |
| | | if (!fi.Directory.Exists) |
| | | { |
| | | foreach (var data in Datasource) |
| | | fi.Directory.Create(); //文件不存在,创建文件 |
| | | } |
| | | |
| | | using (FileStream fs = new FileStream(path, FileMode.Create, FileAccess.Write)) |
| | | using (StreamWriter sw = new StreamWriter(fs, System.Text.Encoding.UTF8)) |
| | | { |
| | | string title = "项目名称,测试参数,测试值,上限,下限,单位,结果"; |
| | | sw.WriteLine(title); |
| | | |
| | | if (Datasource != null && Datasource.Count > 0) |
| | | { |
| | | sw.WriteLine($"{data.Name},{data.Step},{data.Value},{data.LimitUp},{data.LimitDown},{data.Unit},{data.Result}"); |
| | | foreach (var data in Datasource) |
| | | { |
| | | sw.WriteLine($"{data.Name},{data.Step},{data.Value},{data.LimitUp},{data.LimitDown},{data.Unit},{data.Result}"); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | TsExecution.logger.Error("Write CSV File Failed.", ex); |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | TsExecution.logger.Error("Write CSV File Failed.", ex); |
| | | } |
| | | })); |
| | | } |
| | | |
| | | public void ShowPausePanel() |
| | | { |
| | | pausePanel.Visibility = Visibility.Visible; |
| | | } |
| | | |
| | | private void Button_Click(object sender, RoutedEventArgs e) |
| | |
| | | case "clear": |
| | | UpdateProbeCount(0); |
| | | break; |
| | | case "cancelPauseBtn": |
| | | SequenceFileContext?.StationGlobals.SetValBoolean($"StationState.IsContinue_{index}", 1, false); |
| | | pausePanel.Visibility = Visibility.Collapsed; |
| | | break; |
| | | case "continuePauseBtn": |
| | | SequenceFileContext?.StationGlobals.SetValBoolean($"StationState.IsContinue_{index}", 1, true); |
| | | pausePanel.Visibility = Visibility.Collapsed; |
| | | break; |
| | | default: |
| | | break; |
| | | } |
| | | } |
| | | |
| | | private void pausePanel_Loaded(object sender, RoutedEventArgs e) |
| | | { |
| | | var can = pausePanel; |
| | | var modal = visualModal; |
| | | Canvas.SetLeft(modal, (pausePanel.ActualWidth - visualModal.ActualWidth) / 2); |
| | | Canvas.SetTop(modal, (pausePanel.ActualHeight - visualModal.ActualHeight) / 2); |
| | | } |
| | | } |
| | | } |