From 3661f9be3867d1586a53b5f259ccf7bfa6145b25 Mon Sep 17 00:00:00 2001 From: Michael Gordeev Date: Fri, 2 Nov 2018 17:40:08 +0300 Subject: [PATCH] Development 110218-1 --- FoxTube/Classes/AdSizeTrigger.cs | 20 ++++++++++++++++++++ FoxTube/Classes/SecretsVault.cs | 3 ++- FoxTube/Controls/Advert.xaml | 19 +++++++++++++------ FoxTube/Controls/Advert.xaml.cs | 7 +++++++ FoxTube/FoxTube.csproj | 3 ++- FoxTube/Pages/MainPage.xaml.cs | 2 ++ 6 files changed, 46 insertions(+), 8 deletions(-) create mode 100644 FoxTube/Classes/AdSizeTrigger.cs diff --git a/FoxTube/Classes/AdSizeTrigger.cs b/FoxTube/Classes/AdSizeTrigger.cs new file mode 100644 index 0000000..380cda6 --- /dev/null +++ b/FoxTube/Classes/AdSizeTrigger.cs @@ -0,0 +1,20 @@ +using FoxTube.Controls; +using Windows.UI.Xaml; + +namespace FoxTube.Classes +{ + public class AdSizeTrigger : StateTriggerBase + { + private Advert _class; + + public Advert Class + { + get { return _class; } + set + { + _class = value; + SetActive(!_class.OverrideSize); + } + } + } +} diff --git a/FoxTube/Classes/SecretsVault.cs b/FoxTube/Classes/SecretsVault.cs index 09d1e82..9e49c12 100644 --- a/FoxTube/Classes/SecretsVault.cs +++ b/FoxTube/Classes/SecretsVault.cs @@ -282,7 +282,8 @@ namespace FoxTube if(!purchased) { AdsDisabled = false; - NotPurchased.Invoke(); + if(NotPurchased != null) + NotPurchased.Invoke(); } } diff --git a/FoxTube/Controls/Advert.xaml b/FoxTube/Controls/Advert.xaml index f1eb237..0db12aa 100644 --- a/FoxTube/Controls/Advert.xaml +++ b/FoxTube/Controls/Advert.xaml @@ -5,7 +5,8 @@ xmlns:ad="using:Microsoft.Advertising.WinRT.UI" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" - mc:Ignorable="d"> + mc:Ignorable="d" + xmlns:classes="using:FoxTube.Classes"> @@ -13,6 +14,7 @@ + @@ -20,10 +22,10 @@ - + @@ -31,10 +33,10 @@ - + @@ -44,9 +46,14 @@ - + + + + + Height="{x:Bind Height}" + Width="{x:Bind Width}"/> diff --git a/FoxTube/Controls/Advert.xaml.cs b/FoxTube/Controls/Advert.xaml.cs index d8a7724..05276aa 100644 --- a/FoxTube/Controls/Advert.xaml.cs +++ b/FoxTube/Controls/Advert.xaml.cs @@ -1,5 +1,6 @@ using System; using System.Collections.Generic; +using System.Diagnostics; using System.IO; using System.Linq; using System.Runtime.InteropServices.WindowsRuntime; @@ -21,6 +22,12 @@ namespace FoxTube.Controls { public string AdUnitId { get; set; } = "test"; public string AppId => "3f83fe91-d6be-434d-a0ae-7351c5a997f1"; + public bool OverrideSize { get; set; } = false; + public Advert Instance => this; + + public int Height { get; set; } = 50; + public int Width { get; set; } = 300; + public Advert() { this.InitializeComponent(); diff --git a/FoxTube/FoxTube.csproj b/FoxTube/FoxTube.csproj index fd5e489..99aa405 100644 --- a/FoxTube/FoxTube.csproj +++ b/FoxTube/FoxTube.csproj @@ -96,6 +96,7 @@ App.xaml + @@ -432,7 +433,7 @@ 4.3.2 - 4.4.0 + 4.5.1 0.10.11 diff --git a/FoxTube/Pages/MainPage.xaml.cs b/FoxTube/Pages/MainPage.xaml.cs index 611833e..fe5a2bb 100644 --- a/FoxTube/Pages/MainPage.xaml.cs +++ b/FoxTube/Pages/MainPage.xaml.cs @@ -93,7 +93,9 @@ namespace FoxTube SecretsVault.AuthorizationStateChanged += Vault_AuthorizationStateChanged; SecretsVault.SubscriptionsChanged += SecretsVault_SubscriptionsChanged; + SecretsVault.NotPurchased += () => removeAds.Visibility = Visibility.Visible; SecretsVault.CheckAuthorization(); + SecretsVault.CheckAddons(); SetTitleBar(); Initialize(); }