AboutDialog.xaml.cs 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  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. TbVersion.Text = App.MainPageLoader.GetString("About_Version") + " " + App.Version + test+"-"+buildDate;
  37. TbTitle.Text = App.Name;
  38. //初始化多语文案
  39. SetLangText();
  40. }
  41. public string Title => "";
  42. public event Action<IDialogResult> RequestClose;
  43. #region 框架行为
  44. public bool CanCloseDialog()
  45. {
  46. return true;
  47. }
  48. public void OnDialogClosed()
  49. {
  50. RequestClose?.Invoke(new DialogResult());
  51. }
  52. public void OnDialogOpened(IDialogParameters parameters)
  53. {
  54. }
  55. #endregion 框架行为
  56. private void SetLangText()
  57. {
  58. TbPrivacy.Text = App.MainPageLoader.GetString("About_PrivacyAgreement");
  59. TbService.Text = App.MainPageLoader.GetString("About_TermsOfService");
  60. TbComPDFKit.Text = App.MainPageLoader.GetString("Powered_by_ComPDFKit");
  61. TbCopyRight.Text = string.Format(App.MainPageLoader.GetString("About_Copyright"), 2014, 2023);
  62. }
  63. private void TbPrivacy_PreviewMouseLeftButtonDown(object sender, MouseButtonEventArgs e)
  64. {
  65. //单击文案跳转不同链接
  66. var text = sender as TextBlock;
  67. if (text != null)
  68. {
  69. switch (text.Tag.ToString())
  70. {
  71. case "1":
  72. //Privacy Agreement
  73. System.Diagnostics.Process.Start(@"https://www.pdfreaderpro.com/privacy-policy");
  74. break;
  75. case "2":
  76. //Privacy Agreement
  77. System.Diagnostics.Process.Start(@"https://www.pdfreaderpro.com/terms_of_service");
  78. break;
  79. case "3":
  80. //Powered by ComPDFKit
  81. System.Diagnostics.Process.Start(@"https://www.compdf.com?utm_source=winapp&utm_medium=pdfwin&utm_campaign=compdfkit");
  82. break;
  83. default:
  84. break;
  85. }
  86. }
  87. }
  88. }
  89. }