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>
|
||||
</root>
|
||||
<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,23 +18,24 @@
|
|||
</Style>
|
||||
</Page.Resources>
|
||||
|
||||
<Grid x:Name="PageGrid" AutomationProperties.LandmarkType="Main">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="1*"
|
||||
<ScrollViewer>
|
||||
<Grid x:Name="PageGrid" AutomationProperties.LandmarkType="Main">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="1*"
|
||||
MinHeight="{StaticResource HamburgerHeight}"
|
||||
MaxHeight="52"/>
|
||||
<RowDefinition Height="1*"/>
|
||||
</Grid.RowDefinitions>
|
||||
<RowDefinition Height="1*"/>
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<Grid Height="{StaticResource HamburgerHeight}"
|
||||
<Grid Height="{StaticResource HamburgerHeight}"
|
||||
HorizontalAlignment="Left"
|
||||
VerticalAlignment="Top">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="{StaticResource HamburgerHeightGridLength}"/>
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="{StaticResource HamburgerHeightGridLength}"/>
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
|
||||
<Button x:Name="BackButton"
|
||||
<Button x:Name="BackButton"
|
||||
x:Uid="BackButton"
|
||||
HorizontalAlignment="Stretch"
|
||||
VerticalAlignment="Stretch"
|
||||
|
@ -45,101 +46,119 @@
|
|||
Click="BackButtonClick"
|
||||
Content=""/>
|
||||
|
||||
<TextBlock x:Uid="SettingsHeader"
|
||||
<TextBlock x:Uid="SettingsHeader"
|
||||
Grid.Column="1"
|
||||
Margin="8,-3,0,0"
|
||||
HorizontalAlignment="Left"
|
||||
VerticalAlignment="Center"
|
||||
Style="{StaticResource CategoryNameTextBlockStyle}"/>
|
||||
</Grid>
|
||||
</Grid>
|
||||
|
||||
<StackPanel Grid.Row="1" Margin="12,0,12,0">
|
||||
<StackPanel x:Name="SettingsStack"
|
||||
<StackPanel Grid.Row="1" Margin="12,0,12,0">
|
||||
<StackPanel x:Name="SettingsStack"
|
||||
AutomationProperties.LabeledBy="{Binding ElementName=SettingsAppTheme}"
|
||||
Orientation="Vertical">
|
||||
|
||||
<TextBlock x:Name="SettingsAppTheme"
|
||||
<TextBlock x:Name="SettingsAppTheme"
|
||||
x:Uid="SettingsAppTheme"
|
||||
Style="{StaticResource SubtitleTextBlockStyle}"
|
||||
AutomationProperties.HeadingLevel="Level1"
|
||||
TextTrimming="Clip"/>
|
||||
|
||||
<RadioButton x:Name="SettingsLightTheme"
|
||||
<RadioButton x:Name="SettingsLightTheme"
|
||||
x:Uid="SettingsLightTheme"
|
||||
Grid.Row="3"
|
||||
Checked="LightChecked"/>
|
||||
|
||||
<RadioButton x:Name="SettingsDarkTheme"
|
||||
<RadioButton x:Name="SettingsDarkTheme"
|
||||
x:Uid="SettingsDarkTheme"
|
||||
Grid.Row="2"
|
||||
Checked="DarkChecked"/>
|
||||
|
||||
<RadioButton x:Name="SettingsSystemTheme"
|
||||
<RadioButton x:Name="SettingsSystemTheme"
|
||||
x:Uid="SettingsSystemTheme"
|
||||
Grid.Row="4"
|
||||
Checked="SystemChecked"/>
|
||||
|
||||
|
||||
<TextBlock x:Name="SettingsRestartApp"
|
||||
<TextBlock x:Name="SettingsRestartApp"
|
||||
Style="{StaticResource CaptionTextBlockStyle}"
|
||||
Foreground="{StaticResource SystemColorGrayTextColor}"/>
|
||||
|
||||
<HyperlinkButton x:Name="ColorSettingsButton"
|
||||
<HyperlinkButton x:Name="ColorSettingsButton"
|
||||
Margin="0,-2"
|
||||
HorizontalAlignment="Left"
|
||||
Click="ColorSettingsButtonClicked">
|
||||
<TextBlock x:Uid="ColorSettingsButton" TextWrapping="Wrap"/>
|
||||
</HyperlinkButton>
|
||||
</StackPanel>
|
||||
<TextBlock x:Uid="ColorSettingsButton" TextWrapping="Wrap"/>
|
||||
</HyperlinkButton>
|
||||
</StackPanel>
|
||||
|
||||
<StackPanel x:Name="AboutStack"
|
||||
<StackPanel x:Name="AboutStack"
|
||||
Margin="0,32,0,0"
|
||||
AutomationProperties.LabeledBy="{Binding ElementName=SettingsAboutLabel}"
|
||||
Orientation="Vertical">
|
||||
|
||||
<TextBlock x:Name="SettingsAboutLabel"
|
||||
<TextBlock x:Name="SettingsAboutLabel"
|
||||
x:Uid="SettingsAboutLabel"
|
||||
Style="{StaticResource SubtitleTextBlockStyle}"
|
||||
AutomationProperties.HeadingLevel="Level2"
|
||||
TextTrimming="Clip"/>
|
||||
|
||||
<TextBlock Margin="0,0,0,4"
|
||||
<TextBlock Margin="0,0,0,4"
|
||||
Style="{StaticResource BodyTextBlockStyle}"
|
||||
IsTextSelectionEnabled="True">
|
||||
<Run x:Name="SettingsVersion"/>
|
||||
<LineBreak/>
|
||||
<Run x:Name="SettingsCopyright"/>
|
||||
</TextBlock>
|
||||
</TextBlock>
|
||||
|
||||
<HyperlinkButton Margin="0,-2"
|
||||
<HyperlinkButton Margin="0,-2"
|
||||
HorizontalAlignment="Left"
|
||||
NavigateUri="https://go.microsoft.com/fwlink/?LinkID=529064"
|
||||
ToolTipService.ToolTip="https://go.microsoft.com/fwlink/?LinkID=529064">
|
||||
<TextBlock x:Uid="SettingsEULA" TextWrapping="Wrap"/>
|
||||
</HyperlinkButton>
|
||||
<TextBlock x:Uid="SettingsEULA" TextWrapping="Wrap"/>
|
||||
</HyperlinkButton>
|
||||
|
||||
<HyperlinkButton Margin="0,-2"
|
||||
<HyperlinkButton Margin="0,-2"
|
||||
HorizontalAlignment="Left"
|
||||
NavigateUri="https://go.microsoft.com/fwlink/?LinkID=822631"
|
||||
ToolTipService.ToolTip="https://go.microsoft.com/fwlink/?LinkID=822631">
|
||||
<TextBlock x:Uid="SettingsServicesAgreement" TextWrapping="Wrap"/>
|
||||
</HyperlinkButton>
|
||||
<TextBlock x:Uid="SettingsServicesAgreement" TextWrapping="Wrap"/>
|
||||
</HyperlinkButton>
|
||||
|
||||
<HyperlinkButton Margin="0,-2"
|
||||
<HyperlinkButton Margin="0,-2"
|
||||
HorizontalAlignment="Left"
|
||||
NavigateUri="https://go.microsoft.com/fwlink/?LinkID=521839"
|
||||
ToolTipService.ToolTip="https://go.microsoft.com/fwlink/?LinkID=521839">
|
||||
<TextBlock x:Uid="SettingsPrivacyStatment" TextWrapping="Wrap"/>
|
||||
</HyperlinkButton>
|
||||
<TextBlock x:Uid="SettingsPrivacyStatment" TextWrapping="Wrap"/>
|
||||
</HyperlinkButton>
|
||||
|
||||
<Button x:Name="SettingsFeedbackButton"
|
||||
<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>
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
</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