AboutDialog.xaml.cs 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  1. using Prism.Services.Dialogs;
  2. using System;
  3. using System.Collections.Generic;
  4. using System.Linq;
  5. using System.Text;
  6. using System.Threading.Tasks;
  7. using System.Windows;
  8. using System.Windows.Controls;
  9. using System.Windows.Data;
  10. using System.Windows.Documents;
  11. using System.Windows.Input;
  12. using System.Windows.Media;
  13. using System.Windows.Media.Imaging;
  14. using System.Windows.Navigation;
  15. using System.Windows.Shapes;
  16. namespace PDF_Master.Views.Dialog
  17. {
  18. /// <summary>
  19. /// AboutDialog.xaml 的交互逻辑
  20. /// 因为本窗体仅用于纯展示功能,逻辑较少,因此没有额外写VM文件
  21. /// 采用简单的形式处理
  22. /// </summary>
  23. public partial class AboutDialog : UserControl, IDialogAware
  24. {
  25. public AboutDialog()
  26. {
  27. InitializeComponent();
  28. this.DataContext = this;
  29. // 补充编译时间,方便测试区分版本
  30. var buildDate = System.IO.File.GetLastWriteTime(this.GetType().Assembly.Location).ToString("yyyy-MM-dd HH:mm");
  31. //正式版本不显示后缀
  32. string test = "";
  33. #if DEBUG
  34. test = "_Test";
  35. #endif
  36. //上架版本不显示编译时间
  37. TbVersion.Text = App.MainPageLoader.GetString("About_Version") + " " + App.Version + test;
  38. TbTitle.Text = App.Name;
  39. //初始化多语文案
  40. SetLangText();
  41. }
  42. public string Title => "";
  43. public event Action<IDialogResult> RequestClose;
  44. #region 框架行为
  45. public bool CanCloseDialog()
  46. {
  47. return true;
  48. }
  49. public void OnDialogClosed()
  50. {
  51. RequestClose?.Invoke(new DialogResult());
  52. }
  53. public void OnDialogOpened(IDialogParameters parameters)
  54. {
  55. }
  56. #endregion 框架行为
  57. private void SetLangText()
  58. {
  59. TbPrivacy.Text = App.MainPageLoader.GetString("About_PrivacyAgreement");
  60. TbService.Text = App.MainPageLoader.GetString("About_TermsOfService");
  61. TbComPDFKit.Text = App.MainPageLoader.GetString("Powered_by_ComPDFKit");
  62. TbCopyRight.Text = string.Format(App.MainPageLoader.GetString("About_Copyright"), 2014, 2023);
  63. }
  64. private void TbPrivacy_PreviewMouseLeftButtonDown(object sender, MouseButtonEventArgs e)
  65. {
  66. //单击文案跳转不同链接
  67. var text = sender as TextBlock;
  68. if (text != null)
  69. {
  70. switch (text.Tag.ToString())
  71. {
  72. case "1":
  73. //Privacy Agreement
  74. System.Diagnostics.Process.Start(@"https://www.pdfreaderpro.com/privacy-policy");
  75. break;
  76. case "2":
  77. //Privacy Agreement
  78. System.Diagnostics.Process.Start(@"https://www.pdfreaderpro.com/terms_of_service");
  79. break;
  80. case "3":
  81. //Powered by ComPDFKit
  82. System.Diagnostics.Process.Start(@"https://www.compdf.com?utm_source=winapp&utm_medium=pdfwin&utm_campaign=compdfkit");
  83. break;
  84. default:
  85. break;
  86. }
  87. }
  88. }
  89. }
  90. }