Add link to GitHub repo on about flyout (#1449)

* Add link to GitHub repo on about flyout

* Update AboutFlyout page GitHub link margin.

* Update AboutPage GitHub link string.
This commit is contained in:
Chaitanya Mehta 2020-12-11 00:04:18 -05:00 committed by GitHub
parent 61d06b2d2f
commit c4793785c3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 59 additions and 7 deletions

View File

@ -14,6 +14,7 @@
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto"/>
@ -72,5 +73,21 @@
Click="FeedbackButton_Click"/>
</StackPanel>
<RichTextBlock x:Name="AboutFlyoutContribute"
Grid.Row="2"
Grid.ColumnSpan="2"
Margin="12,18,12,6"
HorizontalAlignment="Left"
Foreground="{ThemeResource SystemControlPageTextBaseHighBrush}"
FontSize="{ThemeResource BodyFontSize}"
TextWrapping="Wrap">
<Paragraph>
<Run x:Name="ContributeRunBeforeLink"/><Hyperlink NavigateUri="https://go.microsoft.com/fwlink/?linkid=2099939"
TextDecorations="None"
ToolTipService.ToolTip="https://go.microsoft.com/fwlink/?linkid=2099939">
<Run x:Name="ContributeRunLink"/>
</Hyperlink><Run x:Name="ContributeRunAfterLink"/>
</Paragraph>
</RichTextBlock>
</Grid>
</UserControl>

View File

@ -40,6 +40,8 @@ AboutFlyout::AboutFlyout()
auto copyrightText =
LocalizationStringUtil::GetLocalizedString(resourceLoader->GetResourceString("AboutControlCopyright"), StringReference(to_wstring(BUILD_YEAR).c_str()));
AboutControlCopyrightRun->Text = copyrightText;
InitializeContributeTextBlock();
}
void AboutFlyout::FeedbackButton_Click(_In_ Object ^ sender, _In_ RoutedEventArgs ^ e)
@ -61,3 +63,30 @@ void AboutFlyout::SetDefaultFocus()
{
AboutFlyoutEULA->Focus(::FocusState::Programmatic);
}
void AboutFlyout::InitializeContributeTextBlock()
{
auto resProvider = AppResourceProvider::GetInstance();
std::wstring contributeHyperlinkText = resProvider->GetResourceString(L"AboutFlyoutContribute")->Data();
// The resource string has the 'GitHub' hyperlink wrapped with '%HL%'.
// Break the string and assign pieces appropriately.
static const std::wstring delimiter{ L"%HL%" };
static const size_t delimiterLength{ delimiter.length() };
// Find the delimiters.
size_t firstSplitPosition = contributeHyperlinkText.find(delimiter, 0);
assert(firstSplitPosition != std::wstring::npos);
size_t secondSplitPosition = contributeHyperlinkText.find(delimiter, firstSplitPosition + 1);
assert(secondSplitPosition != std::wstring::npos);
size_t hyperlinkTextLength = secondSplitPosition - (firstSplitPosition + delimiterLength);
// Assign pieces.
auto contributeTextBeforeHyperlink = ref new String(contributeHyperlinkText.substr(0, firstSplitPosition).c_str());
auto contributeTextLink = ref new String(contributeHyperlinkText.substr(firstSplitPosition + delimiterLength, hyperlinkTextLength).c_str());
auto contributeTextAfterHyperlink = ref new String(contributeHyperlinkText.substr(secondSplitPosition + delimiterLength).c_str());
ContributeRunBeforeLink->Text = contributeTextBeforeHyperlink;
ContributeRunLink->Text = contributeTextLink;
ContributeRunAfterLink->Text = contributeTextAfterHyperlink;
}

View File

@ -18,5 +18,6 @@ public
private:
void FeedbackButton_Click(_In_ Platform::Object ^ sender, _In_ Windows::UI::Xaml::RoutedEventArgs ^ e);
void SetVersionString();
void InitializeContributeTextBlock();
};
} /* namespace CalculatorApp */

View File

@ -2717,6 +2717,10 @@
<value>© %1 Microsoft. All rights reserved.</value>
<comment>{Locked="%1"}. Copyright statement, displayed on the About panel. %1 = the current year (4 digits)</comment>
</data>
<data name="AboutFlyoutContribute" xml:space="preserve">
<value>To learn how you can contribute to Windows Calculator, check out the project on %HL%GitHub%HL%.</value>
<comment>{Locked="%HL%GitHub%HL%"}. GitHub link, Displayed on the About panel</comment>
</data>
<data name="AboutButton.Content" xml:space="preserve">
<value>About</value>
<comment>The text that shows in the dropdown navigation control to open About panel</comment>

View File

@ -28,6 +28,7 @@
<Style x:Key="AboutFlyoutPresenterStyle" TargetType="FlyoutPresenter">
<Setter Property="IsTabStop" Value="False"/>
<Setter Property="AutomationProperties.AccessibilityView" Value="Raw"/>
<Setter Property="ScrollViewer.HorizontalScrollBarVisibility" Value="Disabled"/>
</Style>
<Style x:Key="NavViewItemStyle" TargetType="muxc:NavigationViewItem">
<Setter Property="KeyTipPlacementMode" Value="Right"/>
@ -174,18 +175,18 @@
<muxc:NavigationView.PaneFooter>
<muxc:NavigationViewItem x:Name="AboutButton"
x:Uid="AboutButton"
Style="{StaticResource NavViewItemStyle}"
Tapped="OnAboutButtonClick">
x:Uid="AboutButton"
Style="{StaticResource NavViewItemStyle}"
Tapped="OnAboutButtonClick">
<muxc:NavigationViewItem.Icon>
<FontIcon FontFamily="{StaticResource CalculatorFontFamily}" Glyph="&#xe946;"/>
</muxc:NavigationViewItem.Icon>
<FlyoutBase.AttachedFlyout>
<Flyout x:Name="AboutPageFlyout"
x:Uid="AboutPageFlyout"
Closed="OnAboutFlyoutClosed"
FlyoutPresenterStyle="{StaticResource AboutFlyoutPresenterStyle}"
Opened="OnAboutFlyoutOpened">
x:Uid="AboutPageFlyout"
Closed="OnAboutFlyoutClosed"
FlyoutPresenterStyle="{StaticResource AboutFlyoutPresenterStyle}"
Opened="OnAboutFlyoutOpened">
<local:AboutFlyout x:Name="AboutPage" x:Load="False"/>
</Flyout>
</FlyoutBase.AttachedFlyout>