PromotionContent.xaml.cs 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Collections.ObjectModel;
  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.HomePanel
  17. {
  18. /// <summary>
  19. /// PromotionContent.xaml 的交互逻辑
  20. /// </summary>
  21. public partial class PromotionContent : UserControl
  22. {
  23. private ObservableCollection<PromotionBanner> PDFProPromotion = new ObservableCollection<PromotionBanner>();
  24. private ObservableCollection<PromotionBanner> OthersPromotion = new ObservableCollection<PromotionBanner>();
  25. /// <summary>
  26. /// 活动链接
  27. /// </summary>
  28. public string ActiveUri = @"https://apps.apple.com/app/apple-store/id1475051178?pt=118745145&ct=pdfmac-promo&mt=8";
  29. public string WindowsUri = @"https://www.pdfreaderpro.com/windows";
  30. public string iPad = @"https://www.pdfreaderpro.com/ios";
  31. public string Mac = @"https://www.pdfreaderpro.com/mac";
  32. public string Android = @"https://www.pdfreaderpro.com/android";
  33. public string ComPDFKit = @"https://www.compdf.com?utm_source=macapp&utm_medium=pdfmac&utm_campaign=compdfkit-promp";
  34. public string ComVideoKit = @"https://www.filmagepro.com/video-sdk?utm_source=macapp&utm_medium=pdfmac&utm_campaign=comvideosdk-promo";
  35. public string SignFlow = @"https://apps.apple.com/app/apple-store/id1584624017?pt=118745145&ct=pdfmac-promo&mt=8";
  36. public string FilmageEditor = @"https://apps.apple.com/app/apple-store/id1475051178?pt=118745145&ct=pdfmac-promo&mt=8";
  37. public string FilmageScreen = @"https://apps.apple.com/app/apple-store/id1475049179?pt=118745145&ct=pdfmac-promo&mt=8";
  38. public string FreePDFTemplates = @"https://www.pdfreaderpro.com/templates?utm_source=MacApp&utm_campaign=PDFProMac&utm_medium=pdfmac_promo";
  39. public PromotionContent()
  40. {
  41. InitializeComponent();
  42. InitPromotionBanner();
  43. LoadPromotionContents();
  44. ImgeActivity.Source = new BitmapImage(new Uri("pack://application:,,,/Resources/PromotionIcon/black_pdfreaderpro_home_en.png"));
  45. }
  46. private void InitPromotionBanner()
  47. {
  48. PDFProPromotion.Add(new PromotionBanner("pack://application:,,,/Resources/PromotionIcon/Mac.png", "Mac",Mac));
  49. PDFProPromotion.Add(new PromotionBanner("pack://application:,,,/Resources/PromotionIcon/IPhoneiPad.png", "IPhone /iPad",iPad));
  50. PDFProPromotion.Add(new PromotionBanner("pack://application:,,,/Resources/PromotionIcon/Android.png", "Android",Android));
  51. PDFProListview.ItemsSource = PDFProPromotion;
  52. OthersPromotion.Add(new PromotionBanner("pack://application:,,,/Resources/PromotionIcon/ComPDFKit.png", "ComPDFKit",ComPDFKit));
  53. OthersPromotion.Add(new PromotionBanner("pack://application:,,,/Resources/PromotionIcon/ComVideoKit.png", "ComVideoKit",ComVideoKit));
  54. OthersPromotion.Add(new PromotionBanner("pack://application:,,,/Resources/PromotionIcon/SignFlow.png", "SignFlow",SignFlow));
  55. OthersPromotion.Add(new PromotionBanner("pack://application:,,,/Resources/PromotionIcon/FilmageEditor.png", "Filmage Editor",FilmageEditor));
  56. OthersPromotion.Add(new PromotionBanner("pack://application:,,,/Resources/PromotionIcon/FilmageScreen.png", "Filmage Screen",FilmageEditor));
  57. OthersPromotion.Add(new PromotionBanner("pack://application:,,,/Resources/PromotionIcon/FreePDFTemplates.png", "Free PDF Templates",FreePDFTemplates));
  58. OthersListview.ItemsSource = OthersPromotion;
  59. }
  60. private void LoadPromotionContents()
  61. {
  62. if(ImgeActivity.Visibility == Visibility.Visible)
  63. {
  64. }
  65. else
  66. {
  67. PDFProSeriesExpander.IsExpanded = false;
  68. OthersExpander.IsExpanded = false;
  69. }
  70. }
  71. private void UserControl_SizeChanged(object sender, SizeChangedEventArgs e)
  72. {
  73. }
  74. private void FrameworkElement_PreviewMouseLeftButtonDown(object sender, MouseButtonEventArgs e)
  75. {
  76. var item = sender as ListViewItem;
  77. if(item!=null)
  78. {
  79. if(!string.IsNullOrEmpty((item.DataContext as PromotionBanner).Uri))
  80. {
  81. GotoURI((item.DataContext as PromotionBanner).Uri);
  82. }
  83. }
  84. }
  85. private void ImgeActivity_PreviewMouseLeftButtonDown(object sender, MouseButtonEventArgs e)
  86. {
  87. GotoURI(ActiveUri);
  88. }
  89. /// <summary>
  90. /// 跳转到链接
  91. /// </summary>
  92. /// <param name="uri"></param>
  93. private void GotoURI(string uri)
  94. {
  95. try
  96. {
  97. System.Diagnostics.Process.Start(uri);
  98. }
  99. catch { }
  100. }
  101. }
  102. }