sunhonglei 5 months ago
commit dd4d57f8c3
  1. BIN
      Resource/Images/UserControl/03-8-3.png
  2. 3
      SparkClient.csproj
  3. 5
      SparkClient.sln.DotSettings.user
  4. 364
      ViewModel/Grading/GradingResultVM.cs
  5. 20
      Views/Grading/GradingResult.xaml
  6. 4
      Views/UserControl/Viewport3D.xaml
  7. 10
      Views/UserControl/Viewport3D.xaml.cs
  8. 18
      Views/UserControl/ViewportData/Helper/UnityHelper.cs
  9. 1
      Views/UserControl/ViewportData/Helper/ViewportHelperPro.cs
  10. 23
      Views/UserControl/ViewportData/Helper/ViewportManager.cs

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.8 KiB

@ -24,6 +24,7 @@
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" /> <PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
<PackageReference Include="NPOI" Version="2.7.2" /> <PackageReference Include="NPOI" Version="2.7.2" />
<PackageReference Include="SQLitePCLRaw.bundle_e_sqlcipher" Version="2.1.10" /> <PackageReference Include="SQLitePCLRaw.bundle_e_sqlcipher" Version="2.1.10" />
<PackageReference Include="System.IO.Ports" Version="9.0.1" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
@ -189,6 +190,8 @@
<Resource Include="Resource\Images\UIResource\08-5.jpg" /> <Resource Include="Resource\Images\UIResource\08-5.jpg" />
<None Remove="Resource\Images\UIResource\03-0.jpg" /> <None Remove="Resource\Images\UIResource\03-0.jpg" />
<Resource Include="Resource\Images\UIResource\03-0.jpg" /> <Resource Include="Resource\Images\UIResource\03-0.jpg" />
<None Remove="Resource\Images\UserControl\03-8-3.png" />
<Resource Include="Resource\Images\UserControl\03-8-3.png" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>

@ -12,6 +12,7 @@
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003AButton_002Ecs_002Fl_003AC_0021_003FUsers_003Ftongg_003FAppData_003FRoaming_003FJetBrains_003FRider2024_002E3_003Fresharper_002Dhost_003FSourcesCache_003F89a2b53da2e32f22f450ecab5f59ea9f03bfe76b409627069931a786fcee_003FButton_002Ecs/@EntryIndexedValue">ForceIncluded</s:String> <s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003AButton_002Ecs_002Fl_003AC_0021_003FUsers_003Ftongg_003FAppData_003FRoaming_003FJetBrains_003FRider2024_002E3_003Fresharper_002Dhost_003FSourcesCache_003F89a2b53da2e32f22f450ecab5f59ea9f03bfe76b409627069931a786fcee_003FButton_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003ACallerMemberNameAttribute_002Ecs_002Fl_003AC_0021_003FUsers_003FAdministrator_003FAppData_003FRoaming_003FJetBrains_003FRider2024_002E3_003Fresharper_002Dhost_003FDecompilerCache_003Fdecompiler_003F211e6f3b24fa438a92f1815153647ce2c8f908_003F33_003F7a9a7620_003FCallerMemberNameAttribute_002Ecs/@EntryIndexedValue">ForceIncluded</s:String> <s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003ACallerMemberNameAttribute_002Ecs_002Fl_003AC_0021_003FUsers_003FAdministrator_003FAppData_003FRoaming_003FJetBrains_003FRider2024_002E3_003Fresharper_002Dhost_003FDecompilerCache_003Fdecompiler_003F211e6f3b24fa438a92f1815153647ce2c8f908_003F33_003F7a9a7620_003FCallerMemberNameAttribute_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003AClrObjectRuntime_002Ecs_002Fl_003AC_0021_003FUsers_003Ftongg_003FAppData_003FRoaming_003FJetBrains_003FRider2024_002E3_003Fresharper_002Dhost_003FDecompilerCache_003Fdecompiler_003Fab21534b1ec041498b3c23a65e9ed82b15a918_003F19_003F3f4e517b_003FClrObjectRuntime_002Ecs/@EntryIndexedValue">ForceIncluded</s:String> <s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003AClrObjectRuntime_002Ecs_002Fl_003AC_0021_003FUsers_003Ftongg_003FAppData_003FRoaming_003FJetBrains_003FRider2024_002E3_003Fresharper_002Dhost_003FDecompilerCache_003Fdecompiler_003Fab21534b1ec041498b3c23a65e9ed82b15a918_003F19_003F3f4e517b_003FClrObjectRuntime_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003AColor_002Ecs_002Fl_003AC_0021_003FUsers_003FAdministrator_003FAppData_003FRoaming_003FJetBrains_003FRider2024_002E3_003Fresharper_002Dhost_003FDecompilerCache_003Fdecompiler_003Fc45597e5b7ab42d99b3882b94d97e64034a00_003Ffb_003F5b076364_003FColor_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003AConfigurationManager_002Ecs_002Fl_003AC_0021_003FUsers_003FAdministrator_003FAppData_003FRoaming_003FJetBrains_003FRider2024_002E3_003Fresharper_002Dhost_003FDecompilerCache_003Fdecompiler_003F4855f825db5f4f469faf36f45940559e106918_003Fff_003Fb357c8b2_003FConfigurationManager_002Ecs/@EntryIndexedValue">ForceIncluded</s:String> <s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003AConfigurationManager_002Ecs_002Fl_003AC_0021_003FUsers_003FAdministrator_003FAppData_003FRoaming_003FJetBrains_003FRider2024_002E3_003Fresharper_002Dhost_003FDecompilerCache_003Fdecompiler_003F4855f825db5f4f469faf36f45940559e106918_003Fff_003Fb357c8b2_003FConfigurationManager_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003AContentControl_002Ecs_002Fl_003AC_0021_003FUsers_003Ftongg_003FAppData_003FRoaming_003FJetBrains_003FRider2024_002E3_003Fresharper_002Dhost_003FSourcesCache_003F27bb3fae2c21cbe9a2565477feaa7a5b3a19cd779b4a91a98edfff9cd468972_003FContentControl_002Ecs/@EntryIndexedValue">ForceIncluded</s:String> <s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003AContentControl_002Ecs_002Fl_003AC_0021_003FUsers_003Ftongg_003FAppData_003FRoaming_003FJetBrains_003FRider2024_002E3_003Fresharper_002Dhost_003FSourcesCache_003F27bb3fae2c21cbe9a2565477feaa7a5b3a19cd779b4a91a98edfff9cd468972_003FContentControl_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003ADependencyObject_002Ecs_002Fl_003AC_0021_003FUsers_003Ftongg_003FAppData_003FRoaming_003FJetBrains_003FRider2024_002E3_003Fresharper_002Dhost_003FDecompilerCache_003Fdecompiler_003F60b63c019ead4a238340b47a1c0010d5226910_003Fca_003F09e9dbc0_003FDependencyObject_002Ecs/@EntryIndexedValue">ForceIncluded</s:String> <s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003ADependencyObject_002Ecs_002Fl_003AC_0021_003FUsers_003Ftongg_003FAppData_003FRoaming_003FJetBrains_003FRider2024_002E3_003Fresharper_002Dhost_003FDecompilerCache_003Fdecompiler_003F60b63c019ead4a238340b47a1c0010d5226910_003Fca_003F09e9dbc0_003FDependencyObject_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
@ -31,9 +32,11 @@
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003AExecutionContext_002Ecs_002Fl_003AC_0021_003FUsers_003FAdministrator_003FAppData_003FRoaming_003FJetBrains_003FRider2024_002E3_003Fresharper_002Dhost_003FDecompilerCache_003Fdecompiler_003F211e6f3b24fa438a92f1815153647ce2c8f908_003F35_003F053c62c1_003FExecutionContext_002Ecs/@EntryIndexedValue">ForceIncluded</s:String> <s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003AExecutionContext_002Ecs_002Fl_003AC_0021_003FUsers_003FAdministrator_003FAppData_003FRoaming_003FJetBrains_003FRider2024_002E3_003Fresharper_002Dhost_003FDecompilerCache_003Fdecompiler_003F211e6f3b24fa438a92f1815153647ce2c8f908_003F35_003F053c62c1_003FExecutionContext_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003AFileSystem_002Ecs_002Fl_003AC_0021_003FUsers_003Ftongg_003FAppData_003FRoaming_003FJetBrains_003FRider2024_002E3_003Fresharper_002Dhost_003FDecompilerCache_003Fdecompiler_003F4c69bf2d25bb4f2497b2dbd14727a7811308b0_003F9b_003F7ca26691_003FFileSystem_002Ecs/@EntryIndexedValue">ForceIncluded</s:String> <s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003AFileSystem_002Ecs_002Fl_003AC_0021_003FUsers_003Ftongg_003FAppData_003FRoaming_003FJetBrains_003FRider2024_002E3_003Fresharper_002Dhost_003FDecompilerCache_003Fdecompiler_003F4c69bf2d25bb4f2497b2dbd14727a7811308b0_003F9b_003F7ca26691_003FFileSystem_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003AFile_002Ecs_002Fl_003AC_0021_003FUsers_003FAdministrator_003FAppData_003FRoaming_003FJetBrains_003FRider2024_002E3_003Fresharper_002Dhost_003FDecompilerCache_003Fdecompiler_003F211e6f3b24fa438a92f1815153647ce2c8f908_003F00_003Fb0994fb0_003FFile_002Ecs/@EntryIndexedValue">ForceIncluded</s:String> <s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003AFile_002Ecs_002Fl_003AC_0021_003FUsers_003FAdministrator_003FAppData_003FRoaming_003FJetBrains_003FRider2024_002E3_003Fresharper_002Dhost_003FDecompilerCache_003Fdecompiler_003F211e6f3b24fa438a92f1815153647ce2c8f908_003F00_003Fb0994fb0_003FFile_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003AFrameworkElement_002Ecs_002Fl_003AC_0021_003FUsers_003FAdministrator_003FAppData_003FRoaming_003FJetBrains_003FRider2024_002E3_003Fresharper_002Dhost_003FDecompilerCache_003Fdecompiler_003F6412d4331611499aab4eb63809a2a83bf60910_003F07_003Fdab5922a_003FFrameworkElement_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003AFrameworkElement_002Ecs_002Fl_003AC_0021_003FUsers_003Ftongg_003FAppData_003FRoaming_003FJetBrains_003FRider2024_002E3_003Fresharper_002Dhost_003FDecompilerCache_003Fdecompiler_003F6412d4331611499aab4eb63809a2a83bf60910_003F07_003Fdab5922a_003FFrameworkElement_002Ecs/@EntryIndexedValue">ForceIncluded</s:String> <s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003AFrameworkElement_002Ecs_002Fl_003AC_0021_003FUsers_003Ftongg_003FAppData_003FRoaming_003FJetBrains_003FRider2024_002E3_003Fresharper_002Dhost_003FDecompilerCache_003Fdecompiler_003F6412d4331611499aab4eb63809a2a83bf60910_003F07_003Fdab5922a_003FFrameworkElement_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003AFuture_002Ecs_002Fl_003AC_0021_003FUsers_003FAdministrator_003FAppData_003FRoaming_003FJetBrains_003FRider2024_002E3_003Fresharper_002Dhost_003FSourcesCache_003F6f90c6c13479b8c2a5be98f3d75dfc3bd885a055652d8a32904ca2448132949e_003FFuture_002Ecs/@EntryIndexedValue">ForceIncluded</s:String> <s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003AFuture_002Ecs_002Fl_003AC_0021_003FUsers_003FAdministrator_003FAppData_003FRoaming_003FJetBrains_003FRider2024_002E3_003Fresharper_002Dhost_003FSourcesCache_003F6f90c6c13479b8c2a5be98f3d75dfc3bd885a055652d8a32904ca2448132949e_003FFuture_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003AGuid_002Ecs_002Fl_003AC_0021_003FUsers_003Ftongg_003FAppData_003FRoaming_003FJetBrains_003FRider2024_002E3_003Fresharper_002Dhost_003FDecompilerCache_003Fdecompiler_003F211e6f3b24fa438a92f1815153647ce2c8f908_003Faa_003Fa49e75b9_003FGuid_002Ecs/@EntryIndexedValue">ForceIncluded</s:String> <s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003AGuid_002Ecs_002Fl_003AC_0021_003FUsers_003Ftongg_003FAppData_003FRoaming_003FJetBrains_003FRider2024_002E3_003Fresharper_002Dhost_003FDecompilerCache_003Fdecompiler_003F211e6f3b24fa438a92f1815153647ce2c8f908_003Faa_003Fa49e75b9_003FGuid_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003AHorizontalAlignment_002Ecs_002Fl_003AC_0021_003FUsers_003FAdministrator_003FAppData_003FRoaming_003FJetBrains_003FRider2024_002E3_003Fresharper_002Dhost_003FDecompilerCache_003Fdecompiler_003F6412d4331611499aab4eb63809a2a83bf60910_003F45_003F96f9f663_003FHorizontalAlignment_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003AILog_002Ecs_002Fl_003AC_0021_003FUsers_003FAdministrator_003FAppData_003FRoaming_003FJetBrains_003FRider2024_002E3_003Fresharper_002Dhost_003FSourcesCache_003Fcd69d110241e68c102d90de60fe9abbdef79631973c35119af9fe6139bcdbc_003FILog_002Ecs/@EntryIndexedValue">ForceIncluded</s:String> <s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003AILog_002Ecs_002Fl_003AC_0021_003FUsers_003FAdministrator_003FAppData_003FRoaming_003FJetBrains_003FRider2024_002E3_003Fresharper_002Dhost_003FSourcesCache_003Fcd69d110241e68c102d90de60fe9abbdef79631973c35119af9fe6139bcdbc_003FILog_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003AILog_002Ecs_002Fl_003AC_0021_003FUsers_003Ftongg_003FAppData_003FRoaming_003FJetBrains_003FRider2024_002E3_003Fresharper_002Dhost_003FDecompilerCache_003Fdecompiler_003F6f4e00a876324444bc5ae4e52ed22ade46200_003F49_003Fe673ccfc_003FILog_002Ecs/@EntryIndexedValue">ForceIncluded</s:String> <s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003AILog_002Ecs_002Fl_003AC_0021_003FUsers_003Ftongg_003FAppData_003FRoaming_003FJetBrains_003FRider2024_002E3_003Fresharper_002Dhost_003FDecompilerCache_003Fdecompiler_003F6f4e00a876324444bc5ae4e52ed22ade46200_003F49_003Fe673ccfc_003FILog_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003AInputManager_002Ecs_002Fl_003AC_0021_003FUsers_003FAdministrator_003FAppData_003FRoaming_003FJetBrains_003FRider2024_002E3_003Fresharper_002Dhost_003FSourcesCache_003F59d3cbd3f2f27be170d8c07c2c3947fe0efe92848ebab828a63cfbe1ef3a1d_003FInputManager_002Ecs/@EntryIndexedValue">ForceIncluded</s:String> <s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003AInputManager_002Ecs_002Fl_003AC_0021_003FUsers_003FAdministrator_003FAppData_003FRoaming_003FJetBrains_003FRider2024_002E3_003Fresharper_002Dhost_003FSourcesCache_003F59d3cbd3f2f27be170d8c07c2c3947fe0efe92848ebab828a63cfbe1ef3a1d_003FInputManager_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
@ -50,11 +53,13 @@
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003AMessageBox_002Ecs_002Fl_003AC_0021_003FUsers_003Ftongg_003FAppData_003FRoaming_003FJetBrains_003FRider2024_002E3_003Fresharper_002Dhost_003FDecompilerCache_003Fdecompiler_003F476b8dbfd2cb40ab8ff230fdcda5e37081d20_003F0e_003F12425a46_003FMessageBox_002Ecs_002Fz_003A2_002D1/@EntryIndexedValue">ForceIncluded</s:String> <s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003AMessageBox_002Ecs_002Fl_003AC_0021_003FUsers_003Ftongg_003FAppData_003FRoaming_003FJetBrains_003FRider2024_002E3_003Fresharper_002Dhost_003FDecompilerCache_003Fdecompiler_003F476b8dbfd2cb40ab8ff230fdcda5e37081d20_003F0e_003F12425a46_003FMessageBox_002Ecs_002Fz_003A2_002D1/@EntryIndexedValue">ForceIncluded</s:String>
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003AMessageBox_002Ecs_002Fl_003AC_0021_003FUsers_003Ftongg_003FAppData_003FRoaming_003FJetBrains_003FRider2024_002E3_003Fresharper_002Dhost_003FDecompilerCache_003Fdecompiler_003Ffdc001c928464b80ad45ffa09b838a3a15e200_003F55_003F1a844f6e_003FMessageBox_002Ecs/@EntryIndexedValue">ForceIncluded</s:String> <s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003AMessageBox_002Ecs_002Fl_003AC_0021_003FUsers_003Ftongg_003FAppData_003FRoaming_003FJetBrains_003FRider2024_002E3_003Fresharper_002Dhost_003FDecompilerCache_003Fdecompiler_003Ffdc001c928464b80ad45ffa09b838a3a15e200_003F55_003F1a844f6e_003FMessageBox_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003AMethodBaseInvoker_002Ecs_002Fl_003AC_0021_003FUsers_003FAdministrator_003FAppData_003FRoaming_003FJetBrains_003FRider2024_002E3_003Fresharper_002Dhost_003FSourcesCache_003Fd882146b4f265f10bcbec2663fce248db9ffec5fa1aeaf76e32a11ba5eafcd6_003FMethodBaseInvoker_002Ecs/@EntryIndexedValue">ForceIncluded</s:String> <s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003AMethodBaseInvoker_002Ecs_002Fl_003AC_0021_003FUsers_003FAdministrator_003FAppData_003FRoaming_003FJetBrains_003FRider2024_002E3_003Fresharper_002Dhost_003FSourcesCache_003Fd882146b4f265f10bcbec2663fce248db9ffec5fa1aeaf76e32a11ba5eafcd6_003FMethodBaseInvoker_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003APrintPreviewDialog_002Ecs_002Fl_003AC_0021_003FUsers_003FAdministrator_003FAppData_003FRoaming_003FJetBrains_003FRider2024_002E3_003Fresharper_002Dhost_003FDecompilerCache_003Fdecompiler_003F1f2f0b08d2574f1aa35973d1cd0ae347cef920_003F07_003Fd26ee918_003FPrintPreviewDialog_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003APropertyChangedEventArgs_002Ecs_002Fl_003AC_0021_003FUsers_003FAdministrator_003FAppData_003FRoaming_003FJetBrains_003FRider2024_002E3_003Fresharper_002Dhost_003FDecompilerCache_003Fdecompiler_003F4a37508f5f72412da47f18c02ce8145313928_003F27_003F53f616d3_003FPropertyChangedEventArgs_002Ecs/@EntryIndexedValue">ForceIncluded</s:String> <s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003APropertyChangedEventArgs_002Ecs_002Fl_003AC_0021_003FUsers_003FAdministrator_003FAppData_003FRoaming_003FJetBrains_003FRider2024_002E3_003Fresharper_002Dhost_003FDecompilerCache_003Fdecompiler_003F4a37508f5f72412da47f18c02ce8145313928_003F27_003F53f616d3_003FPropertyChangedEventArgs_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003ARoutedEventArgs_002Ecs_002Fl_003AC_0021_003FUsers_003Ftongg_003FAppData_003FRoaming_003FJetBrains_003FRider2024_002E3_003Fresharper_002Dhost_003FSourcesCache_003F1a88b4a860176dd5f825206bbebf3ee3d44ff3f058ceed9eb693c1eaa018_003FRoutedEventArgs_002Ecs/@EntryIndexedValue">ForceIncluded</s:String> <s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003ARoutedEventArgs_002Ecs_002Fl_003AC_0021_003FUsers_003Ftongg_003FAppData_003FRoaming_003FJetBrains_003FRider2024_002E3_003Fresharper_002Dhost_003FSourcesCache_003F1a88b4a860176dd5f825206bbebf3ee3d44ff3f058ceed9eb693c1eaa018_003FRoutedEventArgs_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003ARuntimeType_002ECoreCLR_002Ecs_002Fl_003AC_0021_003FUsers_003Ftongg_003FAppData_003FRoaming_003FJetBrains_003FRider2024_002E3_003Fresharper_002Dhost_003FSourcesCache_003F955ec549fe664629353c3b5424b6ad6c7dfcec4ab59bae709ab962c228cf45_003FRuntimeType_002ECoreCLR_002Ecs/@EntryIndexedValue">ForceIncluded</s:String> <s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003ARuntimeType_002ECoreCLR_002Ecs_002Fl_003AC_0021_003FUsers_003Ftongg_003FAppData_003FRoaming_003FJetBrains_003FRider2024_002E3_003Fresharper_002Dhost_003FSourcesCache_003F955ec549fe664629353c3b5424b6ad6c7dfcec4ab59bae709ab962c228cf45_003FRuntimeType_002ECoreCLR_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003ARuntimeType_002Ecs_002Fl_003AC_0021_003FUsers_003Ftongg_003FAppData_003FRoaming_003FJetBrains_003FRider2024_002E3_003Fresharper_002Dhost_003FDecompilerCache_003Fdecompiler_003F5147b10c5a8c4522b56fba0a889139cfc8f908_003F45_003F2a5f113e_003FRuntimeType_002Ecs/@EntryIndexedValue">ForceIncluded</s:String> <s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003ARuntimeType_002Ecs_002Fl_003AC_0021_003FUsers_003Ftongg_003FAppData_003FRoaming_003FJetBrains_003FRider2024_002E3_003Fresharper_002Dhost_003FDecompilerCache_003Fdecompiler_003F5147b10c5a8c4522b56fba0a889139cfc8f908_003F45_003F2a5f113e_003FRuntimeType_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003AScreenSpacedNode_002Ecs_002Fl_003AC_0021_003FUsers_003Ftongg_003FAppData_003FRoaming_003FJetBrains_003FRider2024_002E3_003Fresharper_002Dhost_003FDecompilerCache_003Fdecompiler_003F68d37d16685244cf9996bf767117a771210200_003Ff9_003F61fd6f6c_003FScreenSpacedNode_002Ecs/@EntryIndexedValue">ForceIncluded</s:String> <s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003AScreenSpacedNode_002Ecs_002Fl_003AC_0021_003FUsers_003Ftongg_003FAppData_003FRoaming_003FJetBrains_003FRider2024_002E3_003Fresharper_002Dhost_003FDecompilerCache_003Fdecompiler_003F68d37d16685244cf9996bf767117a771210200_003Ff9_003F61fd6f6c_003FScreenSpacedNode_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003ASerialPort_002Ecs_002Fl_003AC_0021_003FUsers_003FAdministrator_003FAppData_003FRoaming_003FJetBrains_003FRider2024_002E3_003Fresharper_002Dhost_003FDecompilerCache_003Fdecompiler_003F5d0eccfb3f30419a9d4fa45d3592504e15930_003F76_003Fea59f066_003FSerialPort_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003ASqliteCommand_002Ecs_002Fl_003AC_0021_003FUsers_003Ftongg_003FAppData_003FRoaming_003FJetBrains_003FRider2024_002E3_003Fresharper_002Dhost_003FDecompilerCache_003Fdecompiler_003Fc7a59cb727594ed7a94648b2d66dbf702aa28_003F2f_003Fdc5f3094_003FSqliteCommand_002Ecs/@EntryIndexedValue">ForceIncluded</s:String> <s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003ASqliteCommand_002Ecs_002Fl_003AC_0021_003FUsers_003Ftongg_003FAppData_003FRoaming_003FJetBrains_003FRider2024_002E3_003Fresharper_002Dhost_003FDecompilerCache_003Fdecompiler_003Fc7a59cb727594ed7a94648b2d66dbf702aa28_003F2f_003Fdc5f3094_003FSqliteCommand_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003AStaticResourceExtension_002Ecs_002Fl_003AC_0021_003FUsers_003FAdministrator_003FAppData_003FRoaming_003FJetBrains_003FRider2024_002E3_003Fresharper_002Dhost_003FDecompilerCache_003Fdecompiler_003F6412d4331611499aab4eb63809a2a83bf60910_003F88_003Fef12a016_003FStaticResourceExtension_002Ecs/@EntryIndexedValue">ForceIncluded</s:String> <s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003AStaticResourceExtension_002Ecs_002Fl_003AC_0021_003FUsers_003FAdministrator_003FAppData_003FRoaming_003FJetBrains_003FRider2024_002E3_003Fresharper_002Dhost_003FDecompilerCache_003Fdecompiler_003F6412d4331611499aab4eb63809a2a83bf60910_003F88_003Fef12a016_003FStaticResourceExtension_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003ATaskCompletionSource_00601_002Ecs_002Fl_003AC_0021_003FUsers_003Ftongg_003FAppData_003FRoaming_003FJetBrains_003FRider2024_002E3_003Fresharper_002Dhost_003FDecompilerCache_003Fdecompiler_003F5147b10c5a8c4522b56fba0a889139cfc8f908_003Ffc_003Fe9092391_003FTaskCompletionSource_00601_002Ecs/@EntryIndexedValue">ForceIncluded</s:String> <s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003ATaskCompletionSource_00601_002Ecs_002Fl_003AC_0021_003FUsers_003Ftongg_003FAppData_003FRoaming_003FJetBrains_003FRider2024_002E3_003Fresharper_002Dhost_003FDecompilerCache_003Fdecompiler_003F5147b10c5a8c4522b56fba0a889139cfc8f908_003Ffc_003Fe9092391_003FTaskCompletionSource_00601_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>

@ -1,6 +1,7 @@
using System.ComponentModel; using System.ComponentModel;
using System.Data; using System.Data;
using System.IO; using System.IO;
using System.IO.Ports;
using System.Reflection; using System.Reflection;
using System.Windows.Forms; using System.Windows.Forms;
using System.Windows.Input; using System.Windows.Input;
@ -12,27 +13,16 @@ using SaveFileDialog = Microsoft.Win32.SaveFileDialog;
using NPOI.SS.UserModel; using NPOI.SS.UserModel;
using NPOI.XSSF.UserModel; using NPOI.XSSF.UserModel;
using SparkClient.Views.Dialog; using SparkClient.Views.Dialog;
using NPOI.HPSF;
using Application = System.Windows.Application; using Application = System.Windows.Application;
using MessageBox = SparkClient.Views.Dialog.MessageBox; using MessageBox = SparkClient.Views.Dialog.MessageBox;
using System.Windows; using System.Windows;
using SharpDX;
using SparkClient.Views.UserControl.ViewportData.Entity; using SparkClient.Views.UserControl.ViewportData.Entity;
using SparkClient.ViewModel.Configuration.SettingsPages; using SparkClient.ViewModel.Configuration.SettingsPages;
using SparkClient.Views.UserControl.ViewportData.Helper; using SparkClient.Views.UserControl.ViewportData.Helper;
using System.Diagnostics.Metrics;
using log4net; using log4net;
using SparkClient.ViewModel.Configuration;
using System.Drawing.Printing; using System.Drawing.Printing;
using System.Drawing; using System.Drawing;
using RectangleF = System.Drawing.RectangleF; using HandyControl.Controls;
using FontFamily = System.Drawing.FontFamily;
using FontStyle = System.Drawing.FontStyle;
using NPOI.SS.Formula.Functions;
using System.Windows.Media;
using Brush = System.Drawing.Brush;
using Brushes = System.Drawing.Brushes;
namespace SparkClient.ViewModel.Grading; namespace SparkClient.ViewModel.Grading;
/// <summary> /// <summary>
/// 检测结果画面VM /// 检测结果画面VM
@ -67,6 +57,10 @@ public class GradingResultVM : BaseViewModel
public ICommand SaveFileCommand { get; } public ICommand SaveFileCommand { get; }
public ICommand SaveAsCommand { get; } public ICommand SaveAsCommand { get; }
// 热敏标签打印
public ICommand ThermalPrintCommand { get; }
private SerialPort _serialPort;
/// <summary> /// <summary>
/// 左侧计算结果展示数据 /// 左侧计算结果展示数据
/// </summary> /// </summary>
@ -167,6 +161,10 @@ public class GradingResultVM : BaseViewModel
{ {
SaveAsCommand = new RelayCommand(SaveAs); SaveAsCommand = new RelayCommand(SaveAs);
SaveFileCommand = new RelayCommand(SaveFile); SaveFileCommand = new RelayCommand(SaveFile);
// 热敏标签打印
ThermalPrintCommand = new RelayCommand(ExecuteThermalPrint);
// 初始化 SerialPort
InitializeSerialPort();
if (result != null) if (result != null)
{ {
@ -1685,130 +1683,246 @@ public class GradingResultVM : BaseViewModel
} }
#endregion #endregion
public void PrintLabel()
// 执行热敏打印的方法
private void ExecuteThermalPrint(object parameter)
{ {
PrintDocument printDoc = new PrintDocument(); try
printDoc.PrintPage += new PrintPageEventHandler(PrintPageHandler); {
printDoc.DefaultPageSettings.PaperSize = new System.Drawing.Printing.PaperSize("Custom", 550, 300); // 准备要打印的数据
string printData = PreparePrintData();
// 创建打印文档
PrintDocument printDocument = new PrintDocument();
// 确保 PrintPage 事件处理程序正确实现
printDocument.PrintPage += (sender, e) =>
{
// 设置打印字体和格式
Font printFont = new Font("Courier", 10);
SolidBrush drawBrush = new SolidBrush(System.Drawing.Color.Black);
float yPos = 0f;
int linesPerPage = 0;
// 逐行打印数据
using (StringReader sr = new StringReader(printData))
{
string line;
while ((line = sr.ReadLine()) != null)
{
yPos = e.MarginBounds.Top + (linesPerPage * printFont.GetHeight(e.Graphics));
e.Graphics.DrawString(line, printFont, drawBrush, e.MarginBounds.Left, yPos);
linesPerPage++;
}
}
// 表示已完成打印,不需要额外的页面
e.HasMorePages = false;
};
// 创建自定义打印预览窗体
CustomPrintPreviewForm customPreviewForm = new CustomPrintPreviewForm(printDocument);
// 显示自定义打印预览窗体
DialogResult result = customPreviewForm.ShowDialog();
if (result == DialogResult.OK)
{
// 打开串口
if (!_serialPort.IsOpen)
{
_serialPort.Open();
}
// 将数据转换为字节数组
byte[] dataToSend = System.Text.Encoding.UTF8.GetBytes(printData);
// 发送数据到串口
_serialPort.Write(dataToSend, 0, dataToSend.Length);
Logger.Info("数据已发送到热敏打印机。");
}
}
catch (Exception ex)
{
Logger.Error($"热敏打印发生错误: {ex.Message}");
Growl.Error("热敏打印发生错误");
}
finally
{
// 关闭串口
if (_serialPort.IsOpen)
{
_serialPort.Close();
}
}
}
// 自定义打印预览窗体类
public class CustomPrintPreviewForm : Form
{
private PrintPreviewControl printPreviewControl;
private Button confirmButton;
private Button systemPrintButton; // 新增的系统打印按钮
private PrintDocument printDocument;
public CustomPrintPreviewForm(PrintDocument document)
{
this.printDocument = document;
PrintDialog printDialog = new PrintDialog(); // 初始化打印预览控件
printDialog.Document = printDoc; printPreviewControl = new PrintPreviewControl();
printPreviewControl.Dock = DockStyle.Fill;
printPreviewControl.Document = printDocument;
if (printDialog.ShowDialog() == DialogResult.OK) // 初始化确认按钮
confirmButton = new Button();
confirmButton.Text = "确认打印";
confirmButton.Dock = DockStyle.Bottom;
confirmButton.Click += ConfirmButton_Click;
// 初始化系统打印按钮
systemPrintButton = new Button();
systemPrintButton.Text = "系统打印";
systemPrintButton.Dock = DockStyle.Bottom;
systemPrintButton.Click += SystemPrintButton_Click;
// 将控件添加到窗体
this.Controls.Add(printPreviewControl);
this.Controls.Add(confirmButton);
this.Controls.Add(systemPrintButton);
// 设置窗体属性
this.Size = new System.Drawing.Size(800, 600);
}
private void ConfirmButton_Click(object sender, EventArgs e)
{ {
printDoc.Print(); this.DialogResult = DialogResult.OK;
this.Close();
}
private void SystemPrintButton_Click(object sender, EventArgs e)
{
// 创建一个打印对话框
PrintDialog printDialog = new PrintDialog();
// 将打印对话框关联到当前的 PrintDocument
printDialog.Document = printDocument;
// 显示打印对话框,如果用户点击了“确定”按钮
if (printDialog.ShowDialog() == DialogResult.OK)
{
// 使用用户在对话框中选择的打印机和设置进行打印
printDocument.Print();
}
} }
} }
// 准备要打印的数据
private void PrintPageHandler(object sender, PrintPageEventArgs e) private string PreparePrintData()
{ {
var result = algorithmResult.measurements; var result = algorithmResult.measurements;
int startX = 10;
int startY = 10;
var col2X = startX + 90;
var col3X = col2X + 70;
// 设置字体
Font font = new Font(FontFamily.GenericSerif, 12, FontStyle.Bold);
// 设置颜色
Brush brush = Brushes.Black;
// 设置对齐方式
StringFormat format = new StringFormat();
format.Alignment = StringAlignment.Center; // 水平居中
format.LineAlignment = StringAlignment.Center; // 垂直居中
// 绘制文本
// 第一行
int X = startX;
int Y = startY;
e.Graphics.DrawString(Standard, font, brush, new PointF(X, Y));
X += 70;
e.Graphics.DrawString(Shape, font, brush, new PointF(X, Y));
X += 50;
e.Graphics.DrawString($"ID:{DiamondCode}", font, brush, new PointF(X, Y));
X += 100;
e.Graphics.DrawString($"Weight:{Wight}ct.", font, brush, new PointF(X, Y));
X += 120;
Brush backgroundBrush = new SolidBrush(System.Drawing.Color.Black); // 背景色为黄色
e.Graphics.FillRectangle(backgroundBrush, new RectangleF(X, Y, 200, font.Height));
e.Graphics.DrawString(CutLevelTotal, font, Brushes.White, new PointF(X, Y));
// 第二行
X = startX;
Y += font.Height;
e.Graphics.DrawString("Diameter", font, brush, new PointF(X, Y));
e.Graphics.DrawString($"{FormatDouble_D(result.DIAMETER)}mm", font, brush, new PointF(col2X, Y));
e.Graphics.DrawString($"({FormatDouble_D(result.M1)}mm-{FormatDouble_D(result.M2)}mm)", font, brush, new PointF(col3X, Y));
e.Graphics.DrawString($"0.3%", font, brush, new PointF(310, Y));
e.Graphics.FillRectangle(backgroundBrush, new RectangleF(350, Y, 200, font.Height));
e.Graphics.DrawString(SymLevelTotal, font, Brushes.White, new PointF(X, Y));
// 第三行
X = startX;
Y += font.Height;
e.Graphics.DrawString("Total Dep.", font, brush, new PointF(X, Y));
X = col2X;
e.Graphics.DrawString($"{FormatDouble_D(result.DIAMETER * result.TOTAL_DEPTH)}mm", font, brush, new PointF(X, Y));
X = col3X;
e.Graphics.DrawString($"{FormatDouble_P(result.TOTAL_DEPTH)}%", font, brush, new PointF(X, Y));
e.Graphics.DrawString($"{DtResults.Where(X=> "TOTAL_DEPTH".Equals(X.TestItemId)).Select(X=>X.CutLevel).FirstOrDefault()}", font, brush, new PointF(480, Y));
// 第四行
X = startX;
Y += font.Height;
e.Graphics.DrawString("Table", font, brush, new PointF(X, Y));
X = col2X;
e.Graphics.DrawString($"{FormatDouble_D(result.DIAMETER * result.TABLE)}mm", font, brush, new PointF(X, Y));
X = col3X;
e.Graphics.DrawString($"{FormatDouble_P(result.TABLE)}%", font, brush, new PointF(X, Y));
e.Graphics.DrawString($"{DtResults.Where(X => "TABLE".Equals(X.TestItemId)).Select(X => X.CutLevel).FirstOrDefault()}", font, brush, new PointF(480, Y));
// 第五行
X = startX;
Y += font.Height;
e.Graphics.DrawString("Crown", font, brush, new PointF(X, Y));
X = col2X;
e.Graphics.DrawString($"{FormatDouble_A(result.CROWN_ANGLE)}°", font, brush, new PointF(X, Y));
X = col3X;
e.Graphics.DrawString($"({FormatDouble_A(result.CROWN_ANGLE_MIN)}°-{FormatDouble_A(result.CROWN_ANGLE_MAX)}°)", font, brush, new PointF(X, Y));
X += 120;
e.Graphics.DrawString($"({FormatDouble_A(result.CROWN_HEIGHT)}%)", font, brush, new PointF(X, Y));
e.Graphics.DrawString($"{DtResults.Where(X => "CROWN_ANGLE".Equals(X.TestItemId)).Select(X => X.CutLevel).FirstOrDefault()}", font, brush, new PointF(410, Y));
e.Graphics.DrawString($"{DtResults.Where(X => "CROWN_HEIGHT".Equals(X.TestItemId)).Select(X => X.CutLevel).FirstOrDefault()}", font, brush, new PointF(480, Y));
// 第六行
X = startX;
Y += font.Height;
e.Graphics.DrawString("Pavil.", font, brush, new PointF(X, Y));
X = col2X;
e.Graphics.DrawString($"{FormatDouble_A(result.PAV_ANGLE)}°", font, brush, new PointF(X, Y));
X = col3X;
e.Graphics.DrawString($"({FormatDouble_A(result.PAV_ANGLE_MIN)}°-{FormatDouble_A(result.PAV_ANGLE_MAX)}°)", font, brush, new PointF(X, Y));
X += 120;
e.Graphics.DrawString($"({FormatDouble_A(result.PAV_DEPTH)}%)", font, brush, new PointF(X, Y));
e.Graphics.DrawString($"{DtResults.Where(X => "PAV_ANGLE".Equals(X.TestItemId)).Select(X => X.CutLevel).FirstOrDefault()}", font, brush, new PointF(410, Y));
e.Graphics.DrawString($"{DtResults.Where(X => "PAV_DEPTH".Equals(X.TestItemId)).Select(X => X.CutLevel).FirstOrDefault()}", font, brush, new PointF(480, Y));
// 第七行
X = startX;
Y += font.Height;
e.Graphics.DrawString("Culet", font, brush, new PointF(X, Y));
X = col2X;
e.Graphics.DrawString($"{FormatDouble_P(result.CULET)}%", font, brush, new PointF(X, Y));
X = col3X;
e.Graphics.DrawString($"Twist", font, brush, new PointF(X, Y));
X += 60;
e.Graphics.DrawString($"({FormatDouble_A(result.TWIST_MIN)}°-{FormatDouble_A(result.TWIST_MAX)}°)", font, brush, new PointF(X, Y));
// 第八行
X = startX;
Y += font.Height;
e.Graphics.DrawString("Girdle 16M", font, brush, new PointF(X, Y));
X = col2X;
e.Graphics.DrawString($"{FormatDouble_D(result.GIRDLE_VALLEY)}", font, brush, new PointF(X, Y));
X = col3X;
e.Graphics.DrawString($"({FormatDouble_P(result.GIRDLE_VALLEY_MIN)}%-{FormatDouble_P(result.GIRDLE_VALLEY_MAX)}%)", font, brush, new PointF(X, Y));
e.Graphics.DrawString($"{DtResults.Where(X => "GIRDLE".Equals(X.TestItemId)).Select(X => X.CutLevel).FirstOrDefault()}", font, brush, new PointF(480, Y));
// 定义每个字段的目标宽度,确保每个字段有足够的空间
int paramWidth = 20; // 参数列宽度
int avgWidth = 15; // 平均值列宽度
int rangeWidth = 50; // 区间列宽度
int cutGradeWidth = 15; // 切工等级列宽度
int symGradeWidth = 15; // 对称性等级列宽度
// 格式化数值,确保数值位数一致
string formatNumber = "{0,8:F2}"; // 数值占8个字符宽度,保留两位小数
// 使用固定宽度填充每个字段,确保整齐
string data = $"{string.Format(formatNumber, ":IGI").PadRight(paramWidth)}" +
$"{string.Format(formatNumber, ":").PadRight(avgWidth)}" +
$"{string.Format(formatNumber, $":{DiamondCode}").PadRight(rangeWidth)}" +
$"{string.Format(formatNumber, $": {Wight}ct.").PadRight(paramWidth)}" + "\n";
data += $"{string.Format(formatNumber, "").PadRight(paramWidth)}" +
$"{string.Format(formatNumber, "").PadRight(avgWidth)}" +
$"{string.Format(formatNumber, "(Min/Max)").PadRight(rangeWidth)}" +
$"{string.Format(formatNumber, "").PadRight(cutGradeWidth)}" +
$"{string.Format(formatNumber, "").PadRight(symGradeWidth)}" + "\n";
// 使用 PadRight 对齐每列,确保每一列内容在宽度内对齐
data += $"{string.Format(formatNumber, "(mm)").PadRight(paramWidth)}" +
$"{string.Format(formatNumber, result.DIAMETER).PadRight(avgWidth)}" +
$"{string.Format($"({formatNumber}-{formatNumber})", result.M1, result.M2).PadRight(rangeWidth)}" +
$"{string.Format(formatNumber, "").PadRight(cutGradeWidth)}" +
$"{string.Format(formatNumber, "").PadRight(symGradeWidth)}" + "\n";
data += $"{string.Format(formatNumber, "(%)").PadRight(paramWidth)}" +
$"{string.Format(formatNumber, result.TOTAL_DEPTH * 100).PadRight(avgWidth)}" +
$"{string.Format(formatNumber, "-").PadRight(rangeWidth)}" +
$"{string.Format(formatNumber, CutLevelTotal).PadRight(cutGradeWidth)}" +
$"{string.Format(formatNumber, "-").PadRight(symGradeWidth)}" + "\n";
data += $"{string.Format(formatNumber, "(%)").PadRight(paramWidth)}" +
$"{string.Format(formatNumber, result.TABLE * 100).PadRight(avgWidth)}" +
$"{string.Format($"({formatNumber}-{formatNumber})", result.TABLE * 100 - 0.7, result.TABLE * 100 + 0.3).PadRight(rangeWidth)}" +
$"{string.Format(formatNumber, "").PadRight(cutGradeWidth)}" +
$"{string.Format(formatNumber, "-").PadRight(symGradeWidth)}" + "\n";
data += $"{string.Format(formatNumber, "(°)").PadRight(paramWidth)}" +
$"{string.Format(formatNumber, result.CROWN_ANGLE).PadRight(avgWidth)}" +
$"{string.Format($"({formatNumber}-{formatNumber})", result.CROWN_ANGLE_MIN, result.CROWN_ANGLE_MAX).PadRight(rangeWidth)}" +
$"{string.Format(formatNumber, " - ").PadRight(cutGradeWidth)}" +
$"{string.Format(formatNumber, "").PadRight(symGradeWidth)}" + "\n";
data += $"{string.Format(formatNumber, "(%)").PadRight(paramWidth)}" +
$"{string.Format(formatNumber, result.CROWN_HEIGHT).PadRight(avgWidth)}" +
$"{string.Format(formatNumber, "-").PadRight(rangeWidth)}" +
$"{string.Format(formatNumber, "").PadRight(cutGradeWidth)}" +
$"{string.Format(formatNumber, "").PadRight(symGradeWidth)}" + "\n";
data += $"{string.Format(formatNumber, "(%)").PadRight(paramWidth)}" +
$"{string.Format(formatNumber, result.GIRDLE_VALLEY).PadRight(avgWidth)}" +
$"{string.Format($"({formatNumber}-{formatNumber})", result.GIRDLE_VALLEY_MIN, result.GIRDLE_VALLEY_MAX).PadRight(rangeWidth)}" +
$"{string.Format(formatNumber, "").PadRight(cutGradeWidth)}" +
$"{string.Format(formatNumber, "-").PadRight(symGradeWidth)}" + "\n";
data += $"{string.Format(formatNumber, "(%)").PadRight(paramWidth)}" +
$"{string.Format(formatNumber, result.PAV_DEPTH).PadRight(avgWidth)}" +
$"{string.Format($"({formatNumber}-{formatNumber})", result.PAV_DEPTH - 0.3, result.PAV_DEPTH + 0.3).PadRight(rangeWidth)}" +
$"{string.Format(formatNumber, "").PadRight(cutGradeWidth)}" +
$"{string.Format(formatNumber, "").PadRight(symGradeWidth)}" + "\n";
data += $"{string.Format(formatNumber, ": - ").PadRight(paramWidth + avgWidth + rangeWidth)}" +
$"{string.Format(formatNumber, ": ").PadRight(cutGradeWidth)}" +
$"{string.Format(formatNumber, $": {DateTime.Now:yyyy/M/d}").PadRight(symGradeWidth)}" + "\n";
return data;
}
private void InitializeSerialPort()
{
try
{
string _serialPortName = "COM1"; // 根据实际情况设置串口号
int _baudRate = 9600; // 根据实际情况设置波特率
_serialPort = new SerialPort(_serialPortName, _baudRate);
_serialPort.ReadTimeout = 500;
_serialPort.WriteTimeout = 500;
}
catch (UnauthorizedAccessException ex)
{
Logger.Error($"无法访问串口: {ex.Message}");
Growl.Error("热敏打印发生错误");
}
catch (IOException ex)
{
Logger.Error($"串口操作失败: {ex.Message}");
Growl.Error("热敏打印发生错误");
}
catch (ArgumentOutOfRangeException ex)
{
Logger.Error($"参数超出范围: {ex.Message}");
Growl.Error("热敏打印发生错误");
}
} }
#region 钻石操作相关 #region 钻石操作相关
//暂略 //暂略
//部分代码(直接操作控件)需要在xaml.cs里边写 //部分代码(直接操作控件)需要在xaml.cs里边写

@ -139,6 +139,26 @@
Margin="10 0 0 0" FontSize="16" Width="80" BorderBrush="Black" BorderThickness="0" Height="30"/> Margin="10 0 0 0" FontSize="16" Width="80" BorderBrush="Black" BorderThickness="0" Height="30"/>
</Grid> </Grid>
</Border> </Border>
<!-- 打印按钮 -->
<Button Grid.Column="3" Padding="0" Margin="20,0,0,0" Height="50" BorderThickness="0" IsEnabled="{Binding IsEnabled}"
Background="Transparent" FocusVisualStyle="{x:Null}" Command="{Binding ThermalPrintCommand}" HorizontalAlignment="Left">
<Border
HorizontalAlignment="Center"
VerticalAlignment="Center"
Margin="0 0 0 0"
Padding="10, 10"
Width="100"
BorderThickness="0"
CornerRadius="20">
<Border.Background>
<LinearGradientBrush StartPoint="0,0" EndPoint="0,1">
<GradientStop Color="#3C9CE6" Offset="0"/>
<GradientStop Color="#FF557766" Offset="1"/>
</LinearGradientBrush>
</Border.Background>
<TextBlock FontSize="18" TextAlignment="Center" Foreground="#ffffff" Text="打印" />
</Border>
</Button>
<!-- 卡片 --> <!-- 卡片 -->
<!-- 标准 --> <!-- 标准 -->
<Border Grid.Column="4" Background="#EBEEF5" Width="170" Height="80" CornerRadius="10" Margin="0 0 10 0"> <Border Grid.Column="4" Background="#EBEEF5" Width="170" Height="80" CornerRadius="10" Margin="0 0 10 0">

@ -45,6 +45,10 @@
x:Name="BtnFcuntion3View" Click="BtnFunction_OnClick"> x:Name="BtnFcuntion3View" Click="BtnFunction_OnClick">
<Image Source="pack://Application:,,,/Resource/Images/UserControl/03-8-2.png" Width="40" Height="40"></Image> <Image Source="pack://Application:,,,/Resource/Images/UserControl/03-8-2.png" Width="40" Height="40"></Image>
</Button> </Button>
<Button Grid.Column="5" Background="Transparent" BorderBrush="Transparent" Height="50" Padding="2"
x:Name="BtnShow3DView" Click="BtnFunction_OnClick">
<Image Source="pack://Application:,,,/Resource/Images/UserControl/03-8-3.png" Width="40" Height="40"></Image>
</Button>
</Grid> </Grid>
<Border Grid.Row="1" x:Name="MainBorder"> <Border Grid.Row="1" x:Name="MainBorder">
<Border.ContextMenu > <Border.ContextMenu >

@ -42,7 +42,12 @@ public partial class Viewport3D
private void Viewport3D_OnLoaded(object sender, RoutedEventArgs e) private void Viewport3D_OnLoaded(object sender, RoutedEventArgs e)
{ {
ViewportManager.SetViewport3D(Viewport3Dx); ViewportManager.SetViewport3D(Viewport3Dx);
ViewportManager.SetViewport(this);
ViewportManager.LoadModelByEntities(new List<Viewport3DTriangleEntity>()); ViewportManager.LoadModelByEntities(new List<Viewport3DTriangleEntity>());
#if DEBUG
#else
BtnShow3DView.Visibility = Visibility.Hidden;
#endif
//选项初始化 显示-后端-管理类 一致 //选项初始化 显示-后端-管理类 一致
ViewportRightMenuSelectFaceFrame.IsEnabled = ViewportRightMenuSelectFace.IsChecked ; ViewportRightMenuSelectFaceFrame.IsEnabled = ViewportRightMenuSelectFace.IsChecked ;
@ -175,6 +180,8 @@ public partial class Viewport3D
var directionName = ((Button)sender).Name.ToString(); var directionName = ((Button)sender).Name.ToString();
var directionValue = (int) TbCustomizeRevolve.Value; var directionValue = (int) TbCustomizeRevolve.Value;
switch (directionName) switch (directionName)
{ {
case "BtnFcuntion1View": case "BtnFcuntion1View":
@ -210,6 +217,9 @@ public partial class Viewport3D
await Task.Delay(7000); await Task.Delay(7000);
ViewportManager.DoubleClickSelect = !false; ViewportManager.DoubleClickSelect = !false;
break; break;
case "BtnShow3DView":
break;
} }

@ -0,0 +1,18 @@
namespace SparkClient.Views.UserControl.ViewportData.Helper;
public class UnityHelper
{
private static string _image_path = AppDomain.CurrentDomain.BaseDirectory + "/temp/image/";
/***
* 1stl文件名ViewportHelperPro.ExportModelsToStl(null, path+filename)
* 2STL文件是否存在 7
* 3 temp下imagestl两个目录
* 4stl文件paramA
* 5 xx.exe --model=_stl_path+paramA --output=_image_path --type=0/1 00.png 11.png
* 6
* 7 --->> --->>21
* 8
* 9
*/
}

@ -899,6 +899,7 @@ public class ViewportHelperPro
/// <param name="speed">旋转时间 秒</param> /// <param name="speed">旋转时间 秒</param>
public static void RotateModel(Vector3D axis, bool hasLine = true, int speed = 7, int to = 360) public static void RotateModel(Vector3D axis, bool hasLine = true, int speed = 7, int to = 360)
{ {
ViewportManager.GetViewport().ViewportRightMenuShowModelFaceByType.IsChecked = false;
ViewportManager.ClearDicModels(); ViewportManager.ClearDicModels();
ViewportManager.DoubleClickSelect = false; ViewportManager.DoubleClickSelect = false;

@ -63,6 +63,8 @@ public class ViewportManager
/// 网格线(圈) /// 网格线(圈)
/// </summary> /// </summary>
public static LineGeometryModel3D MainModelCircleLine_P = new LineGeometryModel3D(); public static LineGeometryModel3D MainModelCircleLine_P = new LineGeometryModel3D();
/// <summary> /// <summary>
/// 腰垂直线 /// 腰垂直线
/// </summary> /// </summary>
@ -88,6 +90,9 @@ public class ViewportManager
/// 模型控件对象映射 /// 模型控件对象映射
/// </summary> /// </summary>
private static Viewport3DX _viewport; private static Viewport3DX _viewport;
//模型
private static Viewport3D _viewport3D = null;
public static void SetViewport3D(Viewport3DX viewport3D) public static void SetViewport3D(Viewport3DX viewport3D)
{ {
if (_viewport != null) if (_viewport != null)
@ -105,6 +110,24 @@ public class ViewportManager
throw new Exception("Viewport is not set"); throw new Exception("Viewport is not set");
return _viewport; return _viewport;
}
public static void SetViewport(Viewport3D viewport3D)
{
if (_viewport != null)
{
ClearDicModels();
_viewport.Items.Clear();
}
_viewport3D = viewport3D;
}
public static Viewport3D GetViewport()
{
if (_viewport3D == null)
throw new Exception("Viewport is not set");
return _viewport3D;
} }
#region 模型选中交互管理 #region 模型选中交互管理
//是否双击选中 //是否双击选中

Loading…
Cancel
Save