Merge pull request #43 from nventive/dev/pako/about-flyout

Integrated about flyout.
This commit is contained in:
David 2019-05-24 17:11:44 -04:00 committed by GitHub
commit c3f172b37d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 112 additions and 21 deletions

View file

@ -1,11 +1,75 @@
<UserControl x:Class="CalculatorApp.AboutFlyout" <UserControl x:Class="CalculatorApp.AboutFlyout"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:CalculatorApp.Views" xmlns:local="using:CalculatorApp.Views"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable=""> 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> </Grid>
</UserControl> </UserControl>

View file

@ -3,6 +3,8 @@ using System.Collections.Generic;
using System.IO; using System.IO;
using System.Linq; using System.Linq;
using System.Runtime.InteropServices.WindowsRuntime; using System.Runtime.InteropServices.WindowsRuntime;
using Windows.ApplicationModel;
using Windows.ApplicationModel.Resources;
using Windows.Foundation; using Windows.Foundation;
using Windows.Foundation.Collections; using Windows.Foundation.Collections;
using Windows.UI.Xaml; using Windows.UI.Xaml;
@ -22,6 +24,23 @@ namespace CalculatorApp
public AboutFlyout() public AboutFlyout()
{ {
this.InitializeComponent(); 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}" <FontIcon FontFamily="{StaticResource CalculatorFontFamily}"
Glyph="&#xe946;"/> Glyph="&#xe946;"/>
</NavigationViewItem.Icon> </NavigationViewItem.Icon>
<TextBlock Text=""
<FlyoutBase.AttachedFlyout> x:Name="AboutText" />
<NavigationViewItem.ContextFlyout>
<Flyout x:Name="AboutPageFlyout" <Flyout x:Name="AboutPageFlyout"
x:Uid="AboutPageFlyout" x:Uid="AboutPageFlyout"
@ -177,7 +178,7 @@
<local:AboutFlyout x:Name="AboutPage" <local:AboutFlyout x:Name="AboutPage"
x:Load="False"/> x:Load="False"/>
</Flyout> </Flyout>
</FlyoutBase.AttachedFlyout> </NavigationViewItem.ContextFlyout>
</NavigationViewItem> </NavigationViewItem>
</NavigationViewList.Items> </NavigationViewList.Items>
</NavigationViewList> </NavigationViewList>

View file

@ -62,15 +62,22 @@ namespace CalculatorApp
double sizeInInches = 0.0; double sizeInInches = 0.0;
// UNO TODO // UNO TODO
//if (SUCCEEDED(GetIntegratedDisplaySize(&sizeInInches))) //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 // 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; // 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) protected override void OnNavigatedTo(NavigationEventArgs e)
@ -502,7 +509,7 @@ namespace CalculatorApp
this.FindName("AboutPage"); this.FindName("AboutPage");
} }
FlyoutBase.ShowAttachedFlyout(AboutButton); AboutButton.ContextFlyout.ShowAt(AboutButton);
} }
void UnregisterEventHandlers() void UnregisterEventHandlers()