From 9b4a34933f1645234263b12e5103343e5158f89d Mon Sep 17 00:00:00 2001 From: Tian L <60599517+tian-lt@users.noreply.github.com> Date: Thu, 15 Apr 2021 12:48:55 +0800 Subject: [PATCH] fixes crash in MathRichEditBox.ctor() (#14) * fixes crash in MathRichEditBox.ctor() * typo --- src/Calculator/Controls/MathRichEditBox.cs | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/src/Calculator/Controls/MathRichEditBox.cs b/src/Calculator/Controls/MathRichEditBox.cs index 73aefac2..23966eb3 100644 --- a/src/Calculator/Controls/MathRichEditBox.cs +++ b/src/Calculator/Controls/MathRichEditBox.cs @@ -1,4 +1,4 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. +// Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. using System; @@ -8,7 +8,7 @@ using Windows.UI.Core; using Windows.UI.Text; using Windows.UI.Xaml; using Windows.UI.Xaml.Input; -//using Microsoft.WRL; +using Windows.ApplicationModel; namespace CalculatorApp { @@ -84,6 +84,23 @@ namespace CalculatorApp { public MathRichEditBox() { + string packageName = Package.Current.Id.Name; + + if(packageName == "Microsoft.WindowsCalculator.Dev") + { + LimitedAccessFeatures.TryUnlockFeature( + "com.microsoft.windows.richeditmath", + "BeDD/jxKhz/yfVNA11t4uA==", // Microsoft.WindowsCalculator.Dev + "8wekyb3d8bbwe has registered their use of com.microsoft.windows.richeditmath with Microsoft and agrees to the terms of use."); + } + else if(packageName == "Microsoft.WindowsCalculator") + { + LimitedAccessFeatures.TryUnlockFeature( + "com.microsoft.windows.richeditmath", + "pfanNuxnzo+mAkBQ3N/rGQ==", // Microsoft.WindowsCalculator + "8wekyb3d8bbwe has registered their use of com.microsoft.windows.richeditmath with Microsoft and agrees to the terms of use."); + } + TextDocument.SetMathMode(RichEditMathMode.MathOnly); LosingFocus += OnLosingFocus; KeyUp += OnKeyUp;