mirror of
https://github.com/Microsoft/calculator.git
synced 2025-08-22 22:23:29 -07:00
Add GitHub contribution string
This commit is contained in:
parent
19a1409d37
commit
75a08a01fd
4 changed files with 96 additions and 43 deletions
|
@ -4734,4 +4734,8 @@
|
|||
<value>Settings</value>
|
||||
<comment>Text for the "Settings" header</comment>
|
||||
</data>
|
||||
<data name="SettingsContribute" xml:space="preserve">
|
||||
<value>To learn how you can contribute to Windows Calculator, visit the project on %HL%GitHub%HL%.</value>
|
||||
<comment>{Locked="%HL%GitHub%HL%"}</comment>
|
||||
</data>
|
||||
</root>
|
|
@ -6,7 +6,7 @@
|
|||
xmlns:local="using:CalculatorApp"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
Background="{ThemeResource AppChromeAcrylicHostBackdropMediumLowBrush}"
|
||||
d:Height="455"
|
||||
d:Height="465"
|
||||
d:Width="445"
|
||||
mc:Ignorable="d">
|
||||
|
||||
|
@ -18,6 +18,7 @@
|
|||
</Style>
|
||||
</Page.Resources>
|
||||
|
||||
<ScrollViewer>
|
||||
<Grid x:Name="PageGrid" AutomationProperties.LandmarkType="Main">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="1*"
|
||||
|
@ -134,12 +135,30 @@
|
|||
|
||||
<Button x:Name="SettingsFeedbackButton"
|
||||
x:Uid="SettingsFeedbackButton"
|
||||
Margin="0,24"
|
||||
Margin="0,12,0,0"
|
||||
HorizontalAlignment="Left"
|
||||
VerticalAlignment="Top"
|
||||
Style="{StaticResource ButtonRevealStyle}"
|
||||
Click="SettingsFeedbackButtonClick"/>
|
||||
|
||||
<RichTextBlock x:Name="SettingsContribute"
|
||||
Margin="0,12,12,6"
|
||||
HorizontalAlignment="Left"
|
||||
Foreground="{ThemeResource SystemControlPageTextBaseHighBrush}"
|
||||
Style="{ThemeResource BodyRichTextBlockStyle}"
|
||||
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>
|
||||
</StackPanel>
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
</ScrollViewer>
|
||||
</Page>
|
||||
|
|
|
@ -60,6 +60,8 @@ SettingsPage::SettingsPage()
|
|||
{
|
||||
SettingsSystemTheme->IsChecked = true;
|
||||
}
|
||||
|
||||
InitializeContributeTextBlock();
|
||||
}
|
||||
|
||||
void SettingsPage::OnNavigatedTo(Windows::UI::Xaml::Navigation::NavigationEventArgs ^ e)
|
||||
|
@ -71,6 +73,33 @@ void SettingsPage::OnNavigatedTo(Windows::UI::Xaml::Navigation::NavigationEventA
|
|||
}
|
||||
}
|
||||
|
||||
void SettingsPage::InitializeContributeTextBlock()
|
||||
{
|
||||
std::wstring contributeHyperlinkText = resourceLoader->GetResourceString(L"SettingsContribute")->Data();
|
||||
|
||||
// The resource string has '%HL%' wrapped around 'GitHub'
|
||||
// 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;
|
||||
|
||||
}
|
||||
|
||||
void SettingsPage::BackButtonClick(Platform::Object ^ sender, Windows::UI::Xaml::RoutedEventArgs ^ e)
|
||||
{
|
||||
MainPageProperty->CollapseSettings();
|
||||
|
|
|
@ -19,6 +19,7 @@ namespace CalculatorApp
|
|||
virtual void OnNavigatedTo(Windows::UI::Xaml::Navigation::NavigationEventArgs ^ e) override;
|
||||
|
||||
private:
|
||||
void InitializeContributeTextBlock();
|
||||
void BackButtonClick(Platform::Object ^ sender, Windows::UI::Xaml::RoutedEventArgs ^ e);
|
||||
void ColorSettingsButtonClicked(_In_ Platform::Object ^ sender, _In_ Windows::UI::Xaml::RoutedEventArgs ^ e);
|
||||
void SettingsFeedbackButtonClick(_In_ Platform::Object ^ sender, _In_ Windows::UI::Xaml::RoutedEventArgs ^ e);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue