Fixes: GraphingNumber doesn't work correctly (#1585)

* fixes: GraphingNumber doesn't work correctly

* Avoid crashing
This commit is contained in:
Tian L 2021-06-15 14:11:15 +08:00 committed by GitHub
commit cc8f8b44c4
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 5 additions and 5 deletions

View file

@ -159,7 +159,7 @@ namespace CalculatorApp
// For very first launch, set the size of the calc as size of the default standard mode // For very first launch, set the size of the calc as size of the default standard mode
if (!localSettings.Values.ContainsKey("VeryFirstLaunch")) if (!localSettings.Values.ContainsKey("VeryFirstLaunch"))
{ {
localSettings.Values.Add("VeryFirstLaunch", false); localSettings.Values["VeryFirstLaunch"] = false;
appView.SetPreferredMinSize(minWindowSize); appView.SetPreferredMinSize(minWindowSize);
appView.TryResizeView(minWindowSize); appView.TryResizeView(minWindowSize);
} }

View file

@ -137,7 +137,7 @@ namespace CalculatorApp
// If the rich edit has content already, then the mathzone will already be created due to mathonly mode being set and the selection will exist inside the // If the rich edit has content already, then the mathzone will already be created due to mathonly mode being set and the selection will exist inside the
// math zone. To handle this, we will force a math zone to be created in teh case of the text being empty and then replacing the text inside of the math // math zone. To handle this, we will force a math zone to be created in teh case of the text being empty and then replacing the text inside of the math
// zone with the newly inserted text. // zone with the newly inserted text.
if (GetMathTextProperty() == null) if (string.IsNullOrEmpty(GetMathTextProperty()))
{ {
SetMathTextProperty("<math xmlns=\"http://www.w3.org/1998/Math/MathML\"><mi>x</mi></math>"); SetMathTextProperty("<math xmlns=\"http://www.w3.org/1998/Math/MathML\"><mi>x</mi></math>");
TextDocument.Selection.StartPosition = 0; TextDocument.Selection.StartPosition = 0;

View file

@ -129,7 +129,7 @@ namespace CalculatorApp
{ {
string propertyName = isMatchAppTheme ? "IsMatchAppTheme" : "IsAlwaysLightTheme"; string propertyName = isMatchAppTheme ? "IsMatchAppTheme" : "IsAlwaysLightTheme";
ApplicationDataContainer localSettings = ApplicationData.Current.LocalSettings; ApplicationDataContainer localSettings = ApplicationData.Current.LocalSettings;
localSettings.Values.Add("IsGraphThemeMatchApp", isMatchAppTheme); localSettings.Values["IsGraphThemeMatchApp"] = isMatchAppTheme;
GraphThemeSettingChanged?.Invoke(this, isMatchAppTheme); GraphThemeSettingChanged?.Invoke(this, isMatchAppTheme);
CalculatorApp.ViewModel.Common.TraceLogger.GetInstance().LogGraphSettingsChanged(GraphSettingsType.Theme, propertyName); CalculatorApp.ViewModel.Common.TraceLogger.GetInstance().LogGraphSettingsChanged(GraphSettingsType.Theme, propertyName);
} }

View file

@ -463,8 +463,8 @@ namespace CalculatorApp
if (m_model.IsAlwaysOnTop) if (m_model.IsAlwaysOnTop)
{ {
ApplicationDataContainer localSettings = ApplicationData.Current.LocalSettings; ApplicationDataContainer localSettings = ApplicationData.Current.LocalSettings;
localSettings.Values.Add(ApplicationViewModel.WidthLocalSettings, ActualWidth); localSettings.Values[ApplicationViewModel.WidthLocalSettings] = ActualWidth;
localSettings.Values.Add(ApplicationViewModel.HeightLocalSettings, ActualHeight); localSettings.Values[ApplicationViewModel.HeightLocalSettings] = ActualHeight;
} }
} }