diff --git a/src/Calculator/AboutFlyout.xaml b/src/Calculator/AboutFlyout.xaml index 50f6f4e1..d781f79a 100644 --- a/src/Calculator/AboutFlyout.xaml +++ b/src/Calculator/AboutFlyout.xaml @@ -14,6 +14,7 @@ + @@ -72,5 +73,21 @@ Click="FeedbackButton_Click"/> + + + + + + + diff --git a/src/Calculator/AboutFlyout.xaml.cpp b/src/Calculator/AboutFlyout.xaml.cpp index 5f295c59..9a84a752 100644 --- a/src/Calculator/AboutFlyout.xaml.cpp +++ b/src/Calculator/AboutFlyout.xaml.cpp @@ -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; +} diff --git a/src/Calculator/AboutFlyout.xaml.h b/src/Calculator/AboutFlyout.xaml.h index ab0e481e..f4e47a36 100644 --- a/src/Calculator/AboutFlyout.xaml.h +++ b/src/Calculator/AboutFlyout.xaml.h @@ -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 */ diff --git a/src/Calculator/Resources/en-US/Resources.resw b/src/Calculator/Resources/en-US/Resources.resw index c4c99678..32426cd3 100644 --- a/src/Calculator/Resources/en-US/Resources.resw +++ b/src/Calculator/Resources/en-US/Resources.resw @@ -2717,6 +2717,10 @@ © %1 Microsoft. All rights reserved. {Locked="%1"}. Copyright statement, displayed on the About panel. %1 = the current year (4 digits) + + Windows Calculator is made available under the MIT license. To learn more and contribute, check out the project on %HL%GitHub%HL%. + {Locked="%HL%GitHub%HL%"}. GitHub link, Displayed on the About panel + About The text that shows in the dropdown navigation control to open About panel diff --git a/src/Calculator/Views/MainPage.xaml b/src/Calculator/Views/MainPage.xaml index dae7b25f..8d0af906 100644 --- a/src/Calculator/Views/MainPage.xaml +++ b/src/Calculator/Views/MainPage.xaml @@ -28,6 +28,7 @@