AboutDialog.xaml.cs 3.0 KB

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