123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126 |
- using System;
- using System.Collections.Generic;
- using System.Collections.ObjectModel;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- using System.Windows;
- using System.Windows.Controls;
- using System.Windows.Data;
- using System.Windows.Documents;
- using System.Windows.Input;
- using System.Windows.Media;
- using System.Windows.Media.Imaging;
- using System.Windows.Navigation;
- using System.Windows.Shapes;
- namespace PDF_Master.Views.HomePanel
- {
- /// <summary>
- /// PromotionContent.xaml 的交互逻辑
- /// </summary>
- public partial class PromotionContent : UserControl
- {
- private ObservableCollection<PromotionBanner> PDFProPromotion = new ObservableCollection<PromotionBanner>();
- private ObservableCollection<PromotionBanner> OthersPromotion = new ObservableCollection<PromotionBanner>();
- /// <summary>
- /// 活动链接
- /// </summary>
- public string ActiveUri = @"https://apps.apple.com/app/apple-store/id1475051178?pt=118745145&ct=pdfmac-promo&mt=8";
- public string WindowsUri = @"https://www.pdfreaderpro.com/windows";
- public string iPad = @"https://www.pdfreaderpro.com/ios";
- public string Mac = @"https://www.pdfreaderpro.com/mac";
- public string Android = @"https://www.pdfreaderpro.com/android";
- public string ComPDFKit = @"https://www.compdf.com?utm_source=macapp&utm_medium=pdfmac&utm_campaign=compdfkit-promp";
- public string ComVideoKit = @"https://www.filmagepro.com/video-sdk?utm_source=macapp&utm_medium=pdfmac&utm_campaign=comvideosdk-promo";
- public string SignFlow = @"https://apps.apple.com/app/apple-store/id1584624017?pt=118745145&ct=pdfmac-promo&mt=8";
- public string FilmageEditor = @"https://apps.apple.com/app/apple-store/id1475051178?pt=118745145&ct=pdfmac-promo&mt=8";
- public string FilmageScreen = @"https://apps.apple.com/app/apple-store/id1475049179?pt=118745145&ct=pdfmac-promo&mt=8";
- public string FreePDFTemplates = @"https://www.pdfreaderpro.com/templates?utm_source=MacApp&utm_campaign=PDFProMac&utm_medium=pdfmac_promo";
- public PromotionContent()
- {
- InitializeComponent();
- InitPromotionBanner();
- LoadPromotionContents();
- ImgeActivity.Source = new BitmapImage(new Uri("pack://application:,,,/Resources/PromotionIcon/black_pdfreaderpro_home_en.png"));
- }
- private void InitPromotionBanner()
- {
- PDFProPromotion.Add(new PromotionBanner("pack://application:,,,/Resources/PromotionIcon/Mac.png", "Mac",Mac));
- PDFProPromotion.Add(new PromotionBanner("pack://application:,,,/Resources/PromotionIcon/IPhoneiPad.png", "IPhone /iPad",iPad));
- PDFProPromotion.Add(new PromotionBanner("pack://application:,,,/Resources/PromotionIcon/Android.png", "Android",Android));
- PDFProListview.ItemsSource = PDFProPromotion;
- OthersPromotion.Add(new PromotionBanner("pack://application:,,,/Resources/PromotionIcon/ComPDFKit.png", "ComPDFKit",ComPDFKit));
- OthersPromotion.Add(new PromotionBanner("pack://application:,,,/Resources/PromotionIcon/ComVideoKit.png", "ComVideoKit",ComVideoKit));
- OthersPromotion.Add(new PromotionBanner("pack://application:,,,/Resources/PromotionIcon/SignFlow.png", "SignFlow",SignFlow));
- OthersPromotion.Add(new PromotionBanner("pack://application:,,,/Resources/PromotionIcon/FilmageEditor.png", "Filmage Editor",FilmageEditor));
- OthersPromotion.Add(new PromotionBanner("pack://application:,,,/Resources/PromotionIcon/FilmageScreen.png", "Filmage Screen",FilmageEditor));
- OthersPromotion.Add(new PromotionBanner("pack://application:,,,/Resources/PromotionIcon/FreePDFTemplates.png", "Free PDF Templates",FreePDFTemplates));
- OthersListview.ItemsSource = OthersPromotion;
- }
- private void LoadPromotionContents()
- {
- if(ImgeActivity.Visibility == Visibility.Visible)
- {
- }
- else
- {
- PDFProSeriesExpander.IsExpanded = false;
- OthersExpander.IsExpanded = false;
- }
- }
- private void UserControl_SizeChanged(object sender, SizeChangedEventArgs e)
- {
- }
- private void FrameworkElement_PreviewMouseLeftButtonDown(object sender, MouseButtonEventArgs e)
- {
- var item = sender as ListViewItem;
- if(item!=null)
- {
- if(!string.IsNullOrEmpty((item.DataContext as PromotionBanner).Uri))
- {
- GotoURI((item.DataContext as PromotionBanner).Uri);
- }
- }
- }
- private void ImgeActivity_PreviewMouseLeftButtonDown(object sender, MouseButtonEventArgs e)
- {
- GotoURI(ActiveUri);
- }
- /// <summary>
- /// 跳转到链接
- /// </summary>
- /// <param name="uri"></param>
- private void GotoURI(string uri)
- {
- try
- {
- System.Diagnostics.Process.Start(uri);
- }
- catch { }
- }
- }
- }
|