diff --git a/App.xaml b/App.xaml new file mode 100644 index 0000000..7ee88df --- /dev/null +++ b/App.xaml @@ -0,0 +1,9 @@ + + + + + diff --git a/App.xaml.cs b/App.xaml.cs new file mode 100644 index 0000000..ee14c28 --- /dev/null +++ b/App.xaml.cs @@ -0,0 +1,14 @@ +using System.Configuration; +using System.Data; +using System.Windows; + +namespace PetroleumViscosityTest +{ + /// + /// Interaction logic for App.xaml + /// + public partial class App : Application + { + } + +} diff --git a/AssemblyInfo.cs b/AssemblyInfo.cs new file mode 100644 index 0000000..b0ec827 --- /dev/null +++ b/AssemblyInfo.cs @@ -0,0 +1,10 @@ +using System.Windows; + +[assembly: ThemeInfo( + ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located + //(used if a resource is not found in the page, + // or application resource dictionaries) + ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located + //(used if a resource is not found in the page, + // app, or any theme specific resource dictionaries) +)] diff --git a/Controls/TestRecordControl.xaml b/Controls/TestRecordControl.xaml new file mode 100644 index 0000000..53b5ee7 --- /dev/null +++ b/Controls/TestRecordControl.xaml @@ -0,0 +1,76 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Controls/TestRecordControl.xaml.cs b/Controls/TestRecordControl.xaml.cs new file mode 100644 index 0000000..9b6d704 --- /dev/null +++ b/Controls/TestRecordControl.xaml.cs @@ -0,0 +1,36 @@ +using System; +using System.Linq; +using System.Windows.Controls; +using PetroleumViscosityTest.Models; + +namespace PetroleumViscosityTest.Controls +{ + public partial class TestRecordControl : UserControl + { + public TestRecordControl() + { + InitializeComponent(); + } + + public void LoadData(ViscosityTestData data) + { + txtSampleID.Text = data.SampleID; + txtSampleName.Text = data.SampleName; + txtTestTemp.Text = data.TestTemp.ToString("F1"); + txtThermostatTime.Text = Constants.GetThermostatTime(data.TestTemp).ToString(); + txtConstant.Text = data.Constant.ToString("G5"); + txtDensity.Text = data.Density.HasValue ? data.Density.Value.ToString("F3") : "—"; + txtAvgTime.Text = data.AvgTime.ToString("F3"); + txtViscosity.Text = data.Viscosity.ToString("G4"); + txtDynamicViscosity.Text = data.DynamicViscosity > 0 ? data.DynamicViscosity.ToString("G4") : "—"; + txtValidCount.Text = $"{data.ValidTimes.Count} / {data.RawTimes.Count}"; + txtOperator.Text = data.Operator; + txtTestDate.Text = data.TestDate.ToString("yyyy-MM-dd"); + txtRemark.Text = data.Remark; + + // 显示所有流动时间 + var timeItems = data.RawTimes.Select((t, i) => new { Display = $"第{i + 1}次: {t:F3}s" }).ToList(); + lstTimes.ItemsSource = timeItems; + } + } +} \ No newline at end of file diff --git a/Controls/TestReportControl.xaml b/Controls/TestReportControl.xaml new file mode 100644 index 0000000..4ac0ef5 --- /dev/null +++ b/Controls/TestReportControl.xaml @@ -0,0 +1,50 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Controls/TestReportControl.xaml.cs b/Controls/TestReportControl.xaml.cs new file mode 100644 index 0000000..d5fe49a --- /dev/null +++ b/Controls/TestReportControl.xaml.cs @@ -0,0 +1,27 @@ +using System; +using System.Windows.Controls; +using PetroleumViscosityTest.Models; + +namespace PetroleumViscosityTest.Controls +{ + public partial class TestReportControl : UserControl + { + public TestReportControl() + { + InitializeComponent(); + txtReportNo.Text = "R" + DateTime.Now.ToString("yyyyMMddHHmmss"); + } + + public void LoadData(ViscosityTestData data) + { + txtTestDate.Text = data.TestDate.ToString("yyyy-MM-dd"); + txtSampleID.Text = data.SampleID; + txtSampleName.Text = data.SampleName; + txtTestTemp.Text = data.TestTemp.ToString("F1"); + txtConstant.Text = data.Constant.ToString("G5"); + txtViscosity.Text = data.Viscosity.ToString("G4"); + txtDynamicViscosity.Text = data.DynamicViscosity > 0 ? data.DynamicViscosity.ToString("G4") : "—"; + txtPrecision.Text = data.IsRepeatabilityOK ? "符合重复性要求" : "重复性超差,数据仅供参考"; + } + } +} \ No newline at end of file diff --git a/MainWindow.xaml b/MainWindow.xaml new file mode 100644 index 0000000..af6d933 --- /dev/null +++ b/MainWindow.xaml @@ -0,0 +1,203 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +