mirror of
https://github.com/Microsoft/calculator.git
synced 2025-08-22 22:23:29 -07:00
Clean up #5
This commit is contained in:
parent
9df4d4d9de
commit
04f67e4f88
4 changed files with 15 additions and 17 deletions
|
@ -4722,9 +4722,9 @@
|
||||||
<value>Microsoft Privacy Statement</value>
|
<value>Microsoft Privacy Statement</value>
|
||||||
<comment>Displayed on a link to the Microsoft Privacy Statement on the Settings page.</comment>
|
<comment>Displayed on a link to the Microsoft Privacy Statement on the Settings page.</comment>
|
||||||
</data>
|
</data>
|
||||||
<data name="SettingsRestartNotice" xml:space="preserve">
|
<data name="SettingsRestartApp.Text" xml:space="preserve">
|
||||||
<value>You'll see your changes the next time you start the app.</value>
|
<value>You'll see your changes the next time you start the app.</value>
|
||||||
<comment>Notice when the user change the theme.</comment>
|
<comment>Notice prompting the user to restart the app for changes to theme to take effect.</comment>
|
||||||
</data>
|
</data>
|
||||||
<data name="BackButton.[using:Windows.UI.Xaml.Controls]ToolTipService.ToolTip" xml:space="preserve">
|
<data name="BackButton.[using:Windows.UI.Xaml.Controls]ToolTipService.ToolTip" xml:space="preserve">
|
||||||
<value>Back</value>
|
<value>Back</value>
|
||||||
|
|
|
@ -82,6 +82,7 @@
|
||||||
|
|
||||||
|
|
||||||
<TextBlock x:Name="SettingsRestartApp"
|
<TextBlock x:Name="SettingsRestartApp"
|
||||||
|
x:Uid="SettingsRestartApp"
|
||||||
Style="{StaticResource CaptionTextBlockStyle}"
|
Style="{StaticResource CaptionTextBlockStyle}"
|
||||||
Foreground="{StaticResource SystemBaseMediumColor}"/>
|
Foreground="{StaticResource SystemBaseMediumColor}"/>
|
||||||
|
|
||||||
|
|
|
@ -27,7 +27,6 @@ using namespace winrt::Windows::Storage;
|
||||||
|
|
||||||
SettingsPage::SettingsPage()
|
SettingsPage::SettingsPage()
|
||||||
{
|
{
|
||||||
auto resourceLoader = AppResourceProvider::GetInstance();
|
|
||||||
auto themevalue = Windows::Storage::ApplicationData::Current->LocalSettings->Values->Lookup(L"themeSetting");
|
auto themevalue = Windows::Storage::ApplicationData::Current->LocalSettings->Values->Lookup(L"themeSetting");
|
||||||
auto restartValue = Windows::Storage::ApplicationData::Current->LocalSettings->Values->Lookup(L"restartApp");
|
auto restartValue = Windows::Storage::ApplicationData::Current->LocalSettings->Values->Lookup(L"restartApp");
|
||||||
auto currentThemeValue = Windows::Storage::ApplicationData::Current->LocalSettings->Values->Lookup(L"CurrentTheme");
|
auto currentThemeValue = Windows::Storage::ApplicationData::Current->LocalSettings->Values->Lookup(L"CurrentTheme");
|
||||||
|
@ -44,7 +43,7 @@ SettingsPage::SettingsPage()
|
||||||
|
|
||||||
if (themevalue != nullptr)
|
if (themevalue != nullptr)
|
||||||
{
|
{
|
||||||
if (colorSetting == L"Light")
|
if (colorSetting == ApplicationTheme::Light.ToString())
|
||||||
{
|
{
|
||||||
SettingsLightTheme->IsChecked = true;
|
SettingsLightTheme->IsChecked = true;
|
||||||
if (currentTheme == nullptr)
|
if (currentTheme == nullptr)
|
||||||
|
@ -52,7 +51,7 @@ SettingsPage::SettingsPage()
|
||||||
Windows::Storage::ApplicationData::Current->LocalSettings->Values->Insert(L"CurrentTheme", L"Light");
|
Windows::Storage::ApplicationData::Current->LocalSettings->Values->Insert(L"CurrentTheme", L"Light");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (colorSetting == L"Dark")
|
else if (colorSetting == ApplicationTheme::Dark.ToString())
|
||||||
{
|
{
|
||||||
SettingsDarkTheme->IsChecked = true;
|
SettingsDarkTheme->IsChecked = true;
|
||||||
if (currentTheme == nullptr)
|
if (currentTheme == nullptr)
|
||||||
|
@ -131,15 +130,6 @@ void SettingsPage::InitializeContributeTextBlock()
|
||||||
void SettingsPage::BackButtonClick(Platform::Object ^ sender, Windows::UI::Xaml::RoutedEventArgs ^ e)
|
void SettingsPage::BackButtonClick(Platform::Object ^ sender, Windows::UI::Xaml::RoutedEventArgs ^ e)
|
||||||
{
|
{
|
||||||
auto rootFrame = dynamic_cast<::Frame ^>(Window::Current->Content);
|
auto rootFrame = dynamic_cast<::Frame ^>(Window::Current->Content);
|
||||||
|
|
||||||
if (SettingsRestartApp->Visibility == ::Visibility::Visible)
|
|
||||||
{
|
|
||||||
Windows::Storage::ApplicationData::Current->LocalSettings->Values->Insert(L"restartApp", L"True");
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
Windows::Storage::ApplicationData::Current->LocalSettings->Values->Insert(L"restartApp", L"False");
|
|
||||||
}
|
|
||||||
rootFrame->Navigate((MainPage::typeid), this);
|
rootFrame->Navigate((MainPage::typeid), this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -186,18 +176,19 @@ void SettingsPage::ThemeChecked(Platform::Object ^ sender, Windows::UI::Xaml::Ro
|
||||||
if (currentTheme == tag)
|
if (currentTheme == tag)
|
||||||
{
|
{
|
||||||
SettingsRestartApp->Visibility = ::Visibility::Collapsed;
|
SettingsRestartApp->Visibility = ::Visibility::Collapsed;
|
||||||
|
Windows::Storage::ApplicationData::Current->LocalSettings->Values->Insert(L"restartApp", L"False");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
SettingsRestartApp->Visibility = ::Visibility::Visible;
|
SettingsRestartApp->Visibility = ::Visibility::Visible;
|
||||||
SettingsRestartApp->Text = resourceLoader->GetResourceString("SettingsRestartNotice");
|
Windows::Storage::ApplicationData::Current->LocalSettings->Values->Insert(L"restartApp", L"True");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (tag == "Light")
|
if (tag == ApplicationTheme::Light.ToString())
|
||||||
{
|
{
|
||||||
Windows::Storage::ApplicationData::Current->LocalSettings->Values->Insert(L"themeSetting", ApplicationTheme::Light.ToString());
|
Windows::Storage::ApplicationData::Current->LocalSettings->Values->Insert(L"themeSetting", ApplicationTheme::Light.ToString());
|
||||||
}
|
}
|
||||||
else if (tag == "Dark")
|
else if (tag == ApplicationTheme::Dark.ToString())
|
||||||
{
|
{
|
||||||
Windows::Storage::ApplicationData::Current->LocalSettings->Values->Insert(L"themeSetting", ApplicationTheme::Dark.ToString());
|
Windows::Storage::ApplicationData::Current->LocalSettings->Values->Insert(L"themeSetting", ApplicationTheme::Dark.ToString());
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,6 +16,12 @@ namespace CalculatorApp
|
||||||
property MainPage ^ MainPageProperty;
|
property MainPage ^ MainPageProperty;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
enum Theme
|
||||||
|
{
|
||||||
|
Light,
|
||||||
|
Dark,
|
||||||
|
System
|
||||||
|
};
|
||||||
void SetDefaultFocus();
|
void SetDefaultFocus();
|
||||||
void InitializeContributeTextBlock();
|
void InitializeContributeTextBlock();
|
||||||
void BackButtonClick(Platform::Object ^ sender, Windows::UI::Xaml::RoutedEventArgs ^ e);
|
void BackButtonClick(Platform::Object ^ sender, Windows::UI::Xaml::RoutedEventArgs ^ e);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue