Archived
1
0

Notification center has been cut off

This commit is contained in:
Michael Gordeev
2018-10-22 21:24:26 +03:00
parent fb3b88a046
commit 4cb9bdd8cb
5 changed files with 39 additions and 205 deletions
+28 -59
View File
@@ -14,24 +14,7 @@
PreviewKeyUp="Page_PreviewKeyUp">
<Grid Name="grid" Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
<VisualStateManager.VisualStateGroups>
<VisualStateGroup>
<VisualState>
<VisualState.StateTriggers>
<AdaptiveTrigger MinWindowWidth="641"/>
</VisualState.StateTriggers>
<VisualState.Setters>
<Setter Target="header.FontSize" Value="28"/>
<Setter Target="headerGrid.Margin" Value="10,25,0,0"/>
<Setter Target="account.Height" Value="50"/>
<Setter Target="notificationMenu.Height" Value="50"/>
<Setter Target="avatar.Height" Value="50"/>
</VisualState.Setters>
</VisualState>
</VisualStateGroup>
</VisualStateManager.VisualStateGroups>
<NavigationView SelectedItem="toHome" Windows10version1803:BackRequested="nav_BackRequested" Windows10version1803:PaneTitle="FoxTube" OpenPaneLength="300" Name="nav" SelectionChanged="nav_SelectionChanged">
<NavigationView Header="Home" SelectedItem="toHome" Windows10version1803:BackRequested="nav_BackRequested" Windows10version1803:PaneTitle="FoxTube" OpenPaneLength="300" Name="nav" SelectionChanged="nav_SelectionChanged">
<NavigationView.MenuItems>
<NavigationViewItem x:Uid="/Main/home" Icon="Home" Content="Home" Name="toHome"/>
@@ -63,6 +46,33 @@
<TextBlock x:Uid="/Main/adsFree" Text="Remove ads"/>
</StackPanel>
</Button>
<Button Visibility="Visible" Name="account" Height="40" HorizontalAlignment="Stretch" Background="Transparent" HorizontalContentAlignment="Left">
<StackPanel Orientation="Horizontal">
<FontIcon Glyph="&#xE8FA;" FontSize="16" Margin="6,0,16,0"/>
<TextBlock x:Uid="/Main/signIn" Text="Add account"/>
</StackPanel>
<Button.Flyout>
<MenuFlyout>
<MenuFlyoutItem x:Uid="/Main/signEx" Text="Sign in with existing account" Name="signIn" Click="signIn_Click"/>
<MenuFlyoutItem x:Uid="/Main/signNew" Text="Create new Google account" Name="createAccount" Click="createAccount_Click"/>
</MenuFlyout>
</Button.Flyout>
</Button>
<Button Visibility="Collapsed" Name="avatar" Height="40" HorizontalAlignment="Stretch" Background="Transparent" HorizontalContentAlignment="Left">
<StackPanel Orientation="Horizontal">
<PersonPicture Height="23" Margin="3,0,12,0"/>
<TextBlock Name="myName" Text="My account"/>
</StackPanel>
<Button.Flyout>
<MenuFlyout>
<MenuFlyoutItem x:Uid="/Main/myChannelContext" Text="My channel" Name="myChannel" Click="myChannel_Click"/>
<MenuFlyoutSeparator/>
<MenuFlyoutItem x:Uid="/Main/signOut" Text="Log out" Name="logout" Click="logout_Click"/>
</MenuFlyout>
</Button.Flyout>
</Button>
</StackPanel>
</NavigationView.PaneFooter>
@@ -70,47 +80,6 @@
<AutoSuggestBox x:Name="search" QueryIcon="Find" QuerySubmitted="search_QuerySubmitted" TextChanged="search_TextChanged" x:Uid="/Main/searchPlaceholder" PlaceholderText="Search"/>
</NavigationView.AutoSuggestBox>
<NavigationView.Header>
<Grid Name="headerGrid" Margin="0,-10,0,0">
<Grid.ColumnDefinitions>
<ColumnDefinition/>
<ColumnDefinition Width="Auto"/>
</Grid.ColumnDefinitions>
<TextBlock FontSize="24" VerticalAlignment="Center" Text="Home" Name="header"/>
<StackPanel Orientation="Horizontal" Grid.Column="1">
<Button Name="notificationMenu" Click="notificationMenu_Click"
FontFamily="Segoe MDL2 Assets" Content="&#xED0D;"
Width="50" Height="42" Background="Transparent" x:Uid="notifications" ToolTipService.ToolTip="Notifications">
<Button.Flyout>
<Flyout Content="{x:Bind notificationsCenter}"/>
</Button.Flyout>
</Button>
<Button Name="account"
FontFamily="Segoe MDL2 Assets" Content="&#xE8FA;"
Width="50" Height="42" Background="Transparent" x:Uid="signIn" ToolTipService.ToolTip="Sign in">
<Button.Flyout>
<MenuFlyout>
<MenuFlyoutItem x:Uid="/Main/signEx" Text="Sign in with existing account" Name="signIn" Click="signIn_Click"/>
<MenuFlyoutItem x:Uid="/Main/signNew" Text="Create new Google account" Name="createAccount" Click="createAccount_Click"/>
</MenuFlyout>
</Button.Flyout>
</Button>
<Button Width="50" Background="Transparent" Height="42" Visibility="Collapsed" Name="avatar">
<PersonPicture Width="30" ToolTipService.ToolTip="My account" x:Uid="myAccount"/>
<Button.Flyout>
<MenuFlyout>
<MenuFlyoutItem x:Uid="/Main/myChannelContext" Text="My channel" Name="myChannel" Click="myChannel_Click"/>
<MenuFlyoutSeparator/>
<MenuFlyoutItem x:Uid="/Main/signOut" Text="Log out" Name="logout" Click="logout_Click"/>
</MenuFlyout>
</Button.Flyout>
</Button>
</StackPanel>
</Grid>
</NavigationView.Header>
<Grid>
<Frame Name="content" Navigated="content_Navigated"/>
<Frame Name="videoPlaceholder"/>
+11 -23
View File
@@ -40,8 +40,7 @@ namespace FoxTube
public DownloadAgent Agent = new DownloadAgent();
ApplicationDataContainer settings = ApplicationData.Current.LocalSettings;
NotificationsCenter notificationsCenter = new NotificationsCenter();
Sender s = Sender.None;
public MainPage()
{
@@ -111,7 +110,6 @@ namespace FoxTube
}
catch { }
}
notificationsCenter.Initialize();
SecretsVault.AuthorizationStateChanged += Vault_AuthorizationStateChanged;
SecretsVault.SubscriptionsChanged += SecretsVault_SubscriptionsChanged;
@@ -191,8 +189,8 @@ namespace FoxTube
{
Userinfoplus info = await new Oauth2Service(SecretsVault.Initializer).Userinfo.Get().ExecuteAsync();
ToolTipService.SetToolTip(avatar, new ToolTip() { Content = info.Name });
(avatar.Content as PersonPicture).ProfilePicture = new BitmapImage(new Uri(info.Picture));
myName.Text = info.Name;
((avatar.Content as StackPanel).Children[0] as PersonPicture).ProfilePicture = new BitmapImage(new Uri(info.Picture));
}
catch { }
avatar.Visibility = Visibility.Visible;
@@ -256,16 +254,6 @@ namespace FoxTube
GoToVideo((videoPlaceholder.Content as VideoPage).videoId);
}
public void GotNotification()
{
notificationMenu.Content = "\xED0C";
}
public void notificationMenu_Click(object sender, RoutedEventArgs e)
{
notificationMenu.Content = "\xED0D";
}
private async void feedback_Click(object sender, RoutedEventArgs e)
{
await Launcher.LaunchUriAsync(new Uri("feedback-hub:"));
@@ -502,14 +490,14 @@ namespace FoxTube
{
Dictionary<Type, Action> switchCase = new Dictionary<Type, Action>()
{
{ typeof(Settings), () => header.Text = "Settings" },
{ typeof(ChannelPage), () => header.Text = "Channel" },
{ typeof(PlaylistPage), () => header.Text = "Playlist" },
{ typeof(Search), () => header.Text = "Search" },
{ typeof(Subscriptions), () => header.Text = "Subscriptions" },
{ typeof(History), () => header.Text = "History" },
{ typeof(Home), () => header.Text = "Home" },
{ typeof(Downloads), () => header.Text = "Downloads" }
{ typeof(Settings), () => nav.Header = "Settings" },
{ typeof(ChannelPage), () => nav.Header = "Channel" },
{ typeof(PlaylistPage), () => nav.Header = "Playlist" },
{ typeof(Search), () => nav.Header = "Search" },
{ typeof(Subscriptions), () => nav.Header = "Subscriptions" },
{ typeof(History), () => nav.Header = "History" },
{ typeof(Home), () => nav.Header = "Home" },
{ typeof(Downloads), () => nav.Header = "Downloads" }
};
try { switchCase[e.SourcePageType](); }