Integrated about flyout. Changed the AttachedFlyout by a ContextFlyout

This commit is contained in:
Papus Koulibaly 2019-05-24 14:44:00 -04:00
commit 63de0d1d9f
4 changed files with 112 additions and 21 deletions

View file

@ -1,11 +1,75 @@
<UserControl x:Class="CalculatorApp.AboutFlyout"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:CalculatorApp.Views"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="">
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:CalculatorApp.Views"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="">
<Grid>
<UserControl.Transitions>
<TransitionCollection>
<EdgeUIThemeTransition Edge="Left" />
</TransitionCollection>
</UserControl.Transitions>
<Grid Width="250">
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<TextBlock x:Name="Header"
Grid.Column="1"
Margin="12,10,12,0"
Style="{ThemeResource SubtitleTextBlockStyle}" />
<StackPanel Grid.Row="1"
Grid.ColumnSpan="2"
Margin="0,12,0,0"
Orientation="Vertical">
<TextBlock Foreground="{ThemeResource SystemControlPageTextBaseHighBrush}"
FontSize="{ThemeResource BodyFontSize}"
Margin="12,0,12,18"
HorizontalAlignment="Left"
MaxWidth="292"
TextWrapping="Wrap">
<Run x:Name="AboutFlyoutVersion" />
<LineBreak />
<Run x:Name="AboutControlCopyrightRun" />
</TextBlock>
<HyperlinkButton x:Name="AboutFlyoutEULA"
Margin="12,0,12,6"
NavigateUri="https://go.microsoft.com/fwlink/?LinkID=529064"
ToolTipService.ToolTip="https://go.microsoft.com/fwlink/?LinkID=529064">
<TextBlock x:Uid="AboutFlyoutEULA"
Text=""
FontSize="{ThemeResource BodyFontSize}"
TextWrapping="Wrap" />
</HyperlinkButton>
<HyperlinkButton Margin="12,0,12,6"
NavigateUri="https://go.microsoft.com/fwlink/?LinkID=822631"
ToolTipService.ToolTip="https://go.microsoft.com/fwlink/?LinkID=822631">
<TextBlock x:Uid="AboutControlServicesAgreement"
Text=""
FontSize="{ThemeResource BodyFontSize}"
TextWrapping="Wrap" />
</HyperlinkButton>
<HyperlinkButton Margin="12,0,12,6"
NavigateUri="https://go.microsoft.com/fwlink/?LinkID=521839"
ToolTipService.ToolTip="https://go.microsoft.com/fwlink/?LinkID=521839">
<TextBlock x:Uid="AboutControlPrivacyStatement"
Text=""
FontSize="{ThemeResource BodyFontSize}"
TextWrapping="Wrap" />
</HyperlinkButton>
<Button x:Name="FeedbackButton"
x:Uid="FeedbackButton"
Content=""
MinWidth="120"
Margin="12,12,0,0"
HorizontalAlignment="Left"
VerticalAlignment="Top" />
</StackPanel>
</Grid>
</UserControl>

View file

@ -3,6 +3,8 @@ using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Runtime.InteropServices.WindowsRuntime;
using Windows.ApplicationModel;
using Windows.ApplicationModel.Resources;
using Windows.Foundation;
using Windows.Foundation.Collections;
using Windows.UI.Xaml;
@ -22,6 +24,23 @@ namespace CalculatorApp
public AboutFlyout()
{
this.InitializeComponent();
PopulateStrings();
}
private void PopulateStrings()
{
var resourceLoader = Windows.ApplicationModel.Resources.ResourceLoader.GetForCurrentView();
Header.Text = resourceLoader.GetString("AboutButton/Content");
var version = Package.Current.Id.Version;
var versionNumber = $"Version {version.Major}.{version.Minor}.{version.Build}.{version.Revision}";
AboutFlyoutVersion.Text = versionNumber;
AboutControlCopyrightRun.Text = resourceLoader.GetString("AboutControlCopyright").Replace("%1", "2019");
}
}
}

View file

@ -165,8 +165,9 @@
<FontIcon FontFamily="{StaticResource CalculatorFontFamily}"
Glyph="&#xe946;"/>
</NavigationViewItem.Icon>
<FlyoutBase.AttachedFlyout>
<TextBlock Text=""
x:Name="AboutText" />
<NavigationViewItem.ContextFlyout>
<Flyout x:Name="AboutPageFlyout"
x:Uid="AboutPageFlyout"
@ -177,7 +178,7 @@
<local:AboutFlyout x:Name="AboutPage"
x:Load="False"/>
</Flyout>
</FlyoutBase.AttachedFlyout>
</NavigationViewItem.ContextFlyout>
</NavigationViewItem>
</NavigationViewList.Items>
</NavigationViewList>

View file

@ -62,15 +62,22 @@ namespace CalculatorApp
double sizeInInches = 0.0;
// UNO TODO
//if (SUCCEEDED(GetIntegratedDisplaySize(&sizeInInches)))
//{
// if (sizeInInches < 7.0) // If device's display size (diagonal length) is less than 7 inches then keep the calc always in Portrait mode only
// {
// DisplayInformation.AutoRotationPreferences = DisplayOrientations.Portrait | DisplayOrientations.PortraitFlipped;
// }
//}
}
// UNO TODO
//if (SUCCEEDED(GetIntegratedDisplaySize(&sizeInInches)))
//{
// if (sizeInInches < 7.0) // If device's display size (diagonal length) is less than 7 inches then keep the calc always in Portrait mode only
// {
// DisplayInformation.AutoRotationPreferences = DisplayOrientations.Portrait | DisplayOrientations.PortraitFlipped;
// }
//}
//UNO_TODO /Workaround to have both the Text localisation and the glyph working on all platforms
var resourceLoader = Windows.ApplicationModel.Resources.ResourceLoader.GetForCurrentView();
if (AboutText != null)
{
AboutText.Text = resourceLoader.GetString("AboutButton/Content");
}
}
protected override void OnNavigatedTo(NavigationEventArgs e)
@ -502,7 +509,7 @@ namespace CalculatorApp
this.FindName("AboutPage");
}
FlyoutBase.ShowAttachedFlyout(AboutButton);
AboutButton.ContextFlyout.ShowAt(AboutButton);
}
void UnregisterEventHandlers()