Notification system done
This commit is contained in:
@@ -1,20 +0,0 @@
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -5,55 +5,13 @@
|
||||
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"
|
||||
xmlns:classes="using:FoxTube.Classes">
|
||||
mc:Ignorable="d">
|
||||
|
||||
<Grid>
|
||||
<VisualStateManager.VisualStateGroups>
|
||||
<VisualStateGroup>
|
||||
<VisualState>
|
||||
<VisualState.StateTriggers>
|
||||
<AdaptiveTrigger MinWindowWidth="320"/>
|
||||
<classes:AdSizeTrigger Class="{x:Bind Instance}"/>
|
||||
</VisualState.StateTriggers>
|
||||
|
||||
<VisualState.Setters>
|
||||
<Setter Target="ad.Width" Value="320"/>
|
||||
<Setter Target="ad.Height" Value="50"/>
|
||||
</VisualState.Setters>
|
||||
</VisualState>
|
||||
<VisualState>
|
||||
<VisualState.StateTriggers>
|
||||
<AdaptiveTrigger MinWindowWidth="640"/>
|
||||
<classes:AdSizeTrigger Class="{x:Bind Instance}"/>
|
||||
</VisualState.StateTriggers>
|
||||
|
||||
<VisualState.Setters>
|
||||
<Setter Target="ad.Width" Value="640"/>
|
||||
<Setter Target="ad.Height" Value="100"/>
|
||||
</VisualState.Setters>
|
||||
</VisualState>
|
||||
<VisualState>
|
||||
<VisualState.StateTriggers>
|
||||
<AdaptiveTrigger MinWindowWidth="728"/>
|
||||
<classes:AdSizeTrigger Class="{x:Bind Instance}"/>
|
||||
</VisualState.StateTriggers>
|
||||
|
||||
<VisualState.Setters>
|
||||
<Setter Target="ad.Width" Value="728"/>
|
||||
<Setter Target="ad.Height" Value="90"/>
|
||||
</VisualState.Setters>
|
||||
</VisualState>
|
||||
</VisualStateGroup>
|
||||
</VisualStateManager.VisualStateGroups>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="auto"/>
|
||||
<RowDefinition/>
|
||||
</Grid.RowDefinitions>
|
||||
<Grid Name="grid" SizeChanged="Grid_SizeChanged">
|
||||
<ad:AdControl VerticalAlignment="Top"
|
||||
Name="ad" ApplicationId="{x:Bind AppId}"
|
||||
AdUnitId="{x:Bind AdUnitId}"
|
||||
Height="{x:Bind Height}"
|
||||
Width="{x:Bind Width}"/>
|
||||
Height="50"
|
||||
Width="300"/>
|
||||
</Grid>
|
||||
</UserControl>
|
||||
|
||||
@@ -1,20 +1,6 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Runtime.InteropServices.WindowsRuntime;
|
||||
using Windows.Foundation;
|
||||
using Windows.Foundation.Collections;
|
||||
using System.Diagnostics;
|
||||
using Windows.UI.Xaml;
|
||||
using Windows.UI.Xaml.Controls;
|
||||
using Windows.UI.Xaml.Controls.Primitives;
|
||||
using Windows.UI.Xaml.Data;
|
||||
using Windows.UI.Xaml.Input;
|
||||
using Windows.UI.Xaml.Media;
|
||||
using Windows.UI.Xaml.Navigation;
|
||||
|
||||
// The User Control item template is documented at https://go.microsoft.com/fwlink/?LinkId=234236
|
||||
|
||||
namespace FoxTube.Controls
|
||||
{
|
||||
@@ -23,10 +9,26 @@ 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 new double Height
|
||||
{
|
||||
get { return ad.Height; }
|
||||
set
|
||||
{
|
||||
ad.Height = value;
|
||||
OverrideSize = true;
|
||||
}
|
||||
}
|
||||
|
||||
public new double Width
|
||||
{
|
||||
get { return ad.Width; }
|
||||
set
|
||||
{
|
||||
ad.Width = value;
|
||||
OverrideSize = true;
|
||||
}
|
||||
}
|
||||
|
||||
public Advert()
|
||||
{
|
||||
@@ -37,5 +39,32 @@ namespace FoxTube.Controls
|
||||
Visibility = Visibility.Collapsed;
|
||||
SecretsVault.NotPurchased += () => Visibility = Visibility.Visible;
|
||||
}
|
||||
|
||||
private void Grid_SizeChanged(object sender, SizeChangedEventArgs e)
|
||||
{
|
||||
if (OverrideSize)
|
||||
return;
|
||||
|
||||
if(grid.ActualWidth >= 728)
|
||||
{
|
||||
ad.Width = 728;
|
||||
ad.Height = 90;
|
||||
}
|
||||
else if (grid.ActualWidth >= 640)
|
||||
{
|
||||
ad.Width = 640;
|
||||
ad.Height = 100;
|
||||
}
|
||||
else if (grid.ActualWidth >= 320)
|
||||
{
|
||||
ad.Width = 320;
|
||||
ad.Height = 50;
|
||||
}
|
||||
else
|
||||
{
|
||||
ad.Width = 300;
|
||||
ad.Height = 50;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -96,7 +96,6 @@
|
||||
<Compile Include="App.xaml.cs">
|
||||
<DependentUpon>App.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Classes\AdSizeTrigger.cs" />
|
||||
<Compile Include="Classes\Caption.cs" />
|
||||
<Compile Include="Classes\DownloadItemContainer.cs" />
|
||||
<Compile Include="Classes\InboxItem.cs" />
|
||||
|
||||
@@ -124,30 +124,15 @@ namespace FoxTube
|
||||
public void SetTitleBar()
|
||||
{
|
||||
var titleBar = ApplicationView.GetForCurrentView().TitleBar;
|
||||
|
||||
titleBar.ButtonBackgroundColor = Colors.Transparent;
|
||||
|
||||
titleBar.BackgroundColor = Colors.Red;
|
||||
titleBar.ButtonBackgroundColor = Colors.Red;
|
||||
titleBar.ButtonHoverBackgroundColor = Colors.IndianRed;
|
||||
titleBar.ButtonPressedBackgroundColor = Colors.DarkRed;
|
||||
titleBar.ButtonInactiveBackgroundColor = Colors.Transparent;
|
||||
titleBar.ButtonInactiveBackgroundColor = Colors.DeepPink;
|
||||
titleBar.ForegroundColor = Colors.White;
|
||||
|
||||
if((int)settings.Values["themeMode"] == 2)
|
||||
{
|
||||
Color uiTheme = new UISettings().GetColorValue(UIColorType.Background);
|
||||
if (uiTheme == Colors.Black)
|
||||
titleBar.ButtonForegroundColor = Colors.White;
|
||||
else
|
||||
titleBar.ButtonForegroundColor = Colors.Black;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (RequestedTheme == ElementTheme.Dark)
|
||||
titleBar.ButtonForegroundColor = Colors.White;
|
||||
else if (RequestedTheme == ElementTheme.Light)
|
||||
titleBar.ButtonForegroundColor = Colors.Black;
|
||||
}
|
||||
|
||||
CoreApplicationViewTitleBar coreTitleBar = CoreApplication.GetCurrentView().TitleBar;
|
||||
coreTitleBar.ExtendViewIntoTitleBar = true;
|
||||
CoreApplication.GetCurrentView().TitleBar.ExtendViewIntoTitleBar = false;
|
||||
}
|
||||
|
||||
private void SecretsVault_SubscriptionsChanged(object sender, params object[] args)
|
||||
@@ -393,6 +378,7 @@ namespace FoxTube
|
||||
nav.IsBackEnabled = true;
|
||||
else
|
||||
nav.IsBackEnabled = false;
|
||||
CoreApplication.GetCurrentView().TitleBar.ExtendViewIntoTitleBar = true;
|
||||
}
|
||||
|
||||
public void MaximizeVideo()
|
||||
@@ -404,25 +390,33 @@ namespace FoxTube
|
||||
videoPlaceholder.Margin = new Thickness(0);
|
||||
|
||||
nav.IsBackEnabled = true;
|
||||
CoreApplication.GetCurrentView().TitleBar.ExtendViewIntoTitleBar = false;
|
||||
}
|
||||
|
||||
public void Fullscreen(bool on)
|
||||
{
|
||||
if (on)
|
||||
{
|
||||
nav.CompactModeThresholdWidth = short.MaxValue;
|
||||
nav.ExpandedModeThresholdWidth = short.MaxValue;
|
||||
nav.OpenPaneLength = 0;
|
||||
nav.CompactPaneLength = 0;
|
||||
if ((videoPlaceholder.Content as VideoPage).player.MiniView)
|
||||
nav.Margin = new Thickness(0, -80, 0, 0);
|
||||
nav.Margin = new Thickness(0, -48, 0, 0);
|
||||
else
|
||||
nav.Margin = new Thickness(0, -91, 0, 0);
|
||||
nav.Margin = new Thickness(0, -60, 0, 0);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
nav.CompactModeThresholdWidth = 641;
|
||||
nav.ExpandedModeThresholdWidth = 1008;
|
||||
nav.Margin = new Thickness(0);
|
||||
nav.OpenPaneLength = 300;
|
||||
nav.CompactPaneLength = 48;
|
||||
}
|
||||
|
||||
CoreApplication.GetCurrentView().TitleBar.ExtendViewIntoTitleBar = on;
|
||||
}
|
||||
|
||||
public void CloseVideo()
|
||||
@@ -441,6 +435,8 @@ namespace FoxTube
|
||||
nav.IsBackEnabled = true;
|
||||
else
|
||||
nav.IsBackEnabled = false;
|
||||
|
||||
CoreApplication.GetCurrentView().TitleBar.ExtendViewIntoTitleBar = false;
|
||||
}
|
||||
|
||||
private void search_QuerySubmitted(AutoSuggestBox sender, AutoSuggestBoxQuerySubmittedEventArgs args)
|
||||
|
||||
@@ -153,12 +153,12 @@
|
||||
<AppBarButton Name="openBrowser" Click="openBrowser_Click" Icon="Globe" Label="Open in browser"/>
|
||||
</CommandBar>
|
||||
|
||||
<Grid Grid.Column="1" Name="tabsPlaceholder">
|
||||
<StackPanel Grid.Column="1" Name="tabsPlaceholder">
|
||||
<controls1:Advert/>
|
||||
<Pivot Grid.Row="1" Name="pivot" SelectedIndex="0" IsHeaderItemsCarouselEnabled="False">
|
||||
<PivotItem Header="Suggestions">
|
||||
<ScrollViewer>
|
||||
<StackPanel>
|
||||
<controls1:Advert/>
|
||||
<StackPanel Name="relatedVideos"/>
|
||||
</StackPanel>
|
||||
</ScrollViewer>
|
||||
@@ -194,7 +194,7 @@
|
||||
</ScrollViewer>
|
||||
</PivotItem>
|
||||
</Pivot>
|
||||
</Grid>
|
||||
</StackPanel>
|
||||
|
||||
<local:LoadingPage Grid.ColumnSpan="2" Visibility="Collapsed"/>
|
||||
</Grid>
|
||||
|
||||
Reference in New Issue
Block a user