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 { /// /// PromotionContent.xaml 的交互逻辑 /// public partial class PromotionContent : UserControl { private ObservableCollection PDFProPromotion = new ObservableCollection(); private ObservableCollection OthersPromotion = new ObservableCollection(); /// /// 活动链接 /// 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); } /// /// 跳转到链接 /// /// private void GotoURI(string uri) { try { System.Diagnostics.Process.Start(uri); } catch { } } } }