Run C# import cleanup based on the Solution files (#1838)
This is to make the style consistent with the rest of the project as well as removing unused imports.
This commit is contained in:
		@@ -8,6 +8,7 @@
 | 
			
		||||
 | 
			
		||||
using CalculatorApp.ViewModel.Common;
 | 
			
		||||
using CalculatorApp.ViewModel.Common.Automation;
 | 
			
		||||
 | 
			
		||||
using System;
 | 
			
		||||
using System.Collections.Generic;
 | 
			
		||||
using System.Diagnostics;
 | 
			
		||||
@@ -29,7 +30,7 @@ namespace CalculatorApp
 | 
			
		||||
{
 | 
			
		||||
    namespace ApplicationResourceKeys
 | 
			
		||||
    {
 | 
			
		||||
        static public partial class Globals
 | 
			
		||||
        public static partial class Globals
 | 
			
		||||
        {
 | 
			
		||||
            public static readonly string AppMinWindowHeight = "AppMinWindowHeight";
 | 
			
		||||
            public static readonly string AppMinWindowWidth = "AppMinWindowWidth";
 | 
			
		||||
@@ -39,7 +40,7 @@ namespace CalculatorApp
 | 
			
		||||
    /// <summary>
 | 
			
		||||
    /// Provides application-specific behavior to supplement the default Application class.
 | 
			
		||||
    /// </summary>
 | 
			
		||||
    sealed partial class App
 | 
			
		||||
    public sealed partial class App
 | 
			
		||||
    {
 | 
			
		||||
        /// <summary>
 | 
			
		||||
        /// Initializes the singleton application object. This is the first line of authored code
 | 
			
		||||
@@ -124,8 +125,10 @@ namespace CalculatorApp
 | 
			
		||||
 | 
			
		||||
        private static Frame CreateFrame()
 | 
			
		||||
        {
 | 
			
		||||
            var frame = new Frame();
 | 
			
		||||
            frame.FlowDirection = LocalizationService.GetInstance().GetFlowDirection();
 | 
			
		||||
            var frame = new Frame
 | 
			
		||||
            {
 | 
			
		||||
                FlowDirection = LocalizationService.GetInstance().GetFlowDirection()
 | 
			
		||||
            };
 | 
			
		||||
            return frame;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
@@ -224,8 +227,7 @@ namespace CalculatorApp
 | 
			
		||||
                        _ = newCoreAppView.Dispatcher.RunAsync(
 | 
			
		||||
                            CoreDispatcherPriority.Normal, async () =>
 | 
			
		||||
                            {
 | 
			
		||||
                                var that = weak.Target as App;
 | 
			
		||||
                                if (that != null)
 | 
			
		||||
                                if (weak.Target is App that)
 | 
			
		||||
                                {
 | 
			
		||||
                                    var newRootFrame = App.CreateFrame();
 | 
			
		||||
 | 
			
		||||
@@ -399,9 +401,9 @@ namespace CalculatorApp
 | 
			
		||||
                Dispose();
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            private WindowFrameService m_frameService;
 | 
			
		||||
            private readonly WindowFrameService m_frameService;
 | 
			
		||||
            private bool m_frameOpenedInWindow;
 | 
			
		||||
            private App m_parent;
 | 
			
		||||
            private readonly App m_parent;
 | 
			
		||||
        };
 | 
			
		||||
 | 
			
		||||
        private async Task SetupJumpList()
 | 
			
		||||
@@ -502,7 +504,7 @@ namespace CalculatorApp
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        private readonly ReaderWriterLockSlim m_windowsMapLock = new ReaderWriterLockSlim();
 | 
			
		||||
        private Dictionary<int, WindowFrameService> m_secondaryWindows = new Dictionary<int, WindowFrameService>();
 | 
			
		||||
        private readonly Dictionary<int, WindowFrameService> m_secondaryWindows = new Dictionary<int, WindowFrameService>();
 | 
			
		||||
        private int m_mainViewId;
 | 
			
		||||
        private bool m_preLaunched;
 | 
			
		||||
    }
 | 
			
		||||
 
 | 
			
		||||
@@ -145,7 +145,6 @@
 | 
			
		||||
    <Compile Include="Common\AppLifecycleLogger.cs" />
 | 
			
		||||
    <Compile Include="Common\KeyboardShortcutManager.cs" />
 | 
			
		||||
    <Compile Include="Common\ValidatingConverters.cs" />
 | 
			
		||||
    <Compile Include="Common\ViewState.cs" />
 | 
			
		||||
    <Compile Include="Controls\CalculationResult.cs" />
 | 
			
		||||
    <Compile Include="Controls\CalculationResultAutomationPeer.cs" />
 | 
			
		||||
    <Compile Include="Controls\CalculatorButton.cs" />
 | 
			
		||||
 
 | 
			
		||||
@@ -4,6 +4,7 @@
 | 
			
		||||
using System;
 | 
			
		||||
using System.Collections;
 | 
			
		||||
using System.Collections.Generic;
 | 
			
		||||
 | 
			
		||||
using Windows.Foundation;
 | 
			
		||||
using Windows.Foundation.Collections;
 | 
			
		||||
using Windows.UI.Xaml.Data;
 | 
			
		||||
@@ -12,15 +13,14 @@ namespace CalculatorApp
 | 
			
		||||
{
 | 
			
		||||
    namespace Common
 | 
			
		||||
    {
 | 
			
		||||
        sealed class AlwaysSelectedCollectionView : Windows.UI.Xaml.DependencyObject, Windows.UI.Xaml.Data.ICollectionView
 | 
			
		||||
        internal sealed class AlwaysSelectedCollectionView : Windows.UI.Xaml.DependencyObject, Windows.UI.Xaml.Data.ICollectionView
 | 
			
		||||
        {
 | 
			
		||||
            internal AlwaysSelectedCollectionView(IList source)
 | 
			
		||||
            {
 | 
			
		||||
                m_currentPosition = -1;
 | 
			
		||||
                CurrentPosition = -1;
 | 
			
		||||
                m_source = source;
 | 
			
		||||
 | 
			
		||||
                var observable = source as Windows.UI.Xaml.Interop.IBindableObservableVector;
 | 
			
		||||
                if (observable != null)
 | 
			
		||||
                if (source is Windows.UI.Xaml.Interop.IBindableObservableVector observable)
 | 
			
		||||
                {
 | 
			
		||||
                    observable.VectorChanged += OnSourceBindableVectorChanged;
 | 
			
		||||
                }
 | 
			
		||||
@@ -33,7 +33,7 @@ namespace CalculatorApp
 | 
			
		||||
                    int newCurrentPosition = m_source.IndexOf(item);
 | 
			
		||||
                    if (newCurrentPosition != -1)
 | 
			
		||||
                    {
 | 
			
		||||
                        m_currentPosition = newCurrentPosition;
 | 
			
		||||
                        CurrentPosition = newCurrentPosition;
 | 
			
		||||
                        CurrentChanged?.Invoke(this, null);
 | 
			
		||||
                        return true;
 | 
			
		||||
                    }
 | 
			
		||||
@@ -42,7 +42,7 @@ namespace CalculatorApp
 | 
			
		||||
                // The item is not in the collection
 | 
			
		||||
                // We're going to schedule a call back later so we
 | 
			
		||||
                // restore the selection to the way we wanted it to begin with
 | 
			
		||||
                if (m_currentPosition >= 0 && m_currentPosition < m_source.Count)
 | 
			
		||||
                if (CurrentPosition >= 0 && CurrentPosition < m_source.Count)
 | 
			
		||||
                {
 | 
			
		||||
                    Dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.Normal, new Windows.UI.Core.DispatchedHandler(() =>
 | 
			
		||||
                    {
 | 
			
		||||
@@ -59,7 +59,7 @@ namespace CalculatorApp
 | 
			
		||||
                    return false;
 | 
			
		||||
                }
 | 
			
		||||
 | 
			
		||||
                m_currentPosition = index;
 | 
			
		||||
                CurrentPosition = index;
 | 
			
		||||
                CurrentChanged?.Invoke(this, null);
 | 
			
		||||
                return true;
 | 
			
		||||
            }
 | 
			
		||||
@@ -132,73 +132,34 @@ namespace CalculatorApp
 | 
			
		||||
 | 
			
		||||
            public object this[int index]
 | 
			
		||||
            {
 | 
			
		||||
                get
 | 
			
		||||
                {
 | 
			
		||||
                    return m_source[index];
 | 
			
		||||
                }
 | 
			
		||||
                get => m_source[index];
 | 
			
		||||
 | 
			
		||||
                set => throw new NotImplementedException();
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            public int Count
 | 
			
		||||
            {
 | 
			
		||||
                get
 | 
			
		||||
                {
 | 
			
		||||
                    return m_source.Count;
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
            public int Count => m_source.Count;
 | 
			
		||||
 | 
			
		||||
            public IObservableVector<object> CollectionGroups
 | 
			
		||||
            {
 | 
			
		||||
                get
 | 
			
		||||
                {
 | 
			
		||||
                    return (IObservableVector<object>)new List<object>();
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
            public IObservableVector<object> CollectionGroups => (IObservableVector<object>)new List<object>();
 | 
			
		||||
 | 
			
		||||
            public object CurrentItem
 | 
			
		||||
            {
 | 
			
		||||
                get
 | 
			
		||||
                {
 | 
			
		||||
                    if (m_currentPosition >= 0 && m_currentPosition < m_source.Count)
 | 
			
		||||
                    if (CurrentPosition >= 0 && CurrentPosition < m_source.Count)
 | 
			
		||||
                    {
 | 
			
		||||
                        return m_source[m_currentPosition];
 | 
			
		||||
                        return m_source[CurrentPosition];
 | 
			
		||||
                    }
 | 
			
		||||
                    return null;
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            public int CurrentPosition
 | 
			
		||||
            {
 | 
			
		||||
                get
 | 
			
		||||
                {
 | 
			
		||||
                    return m_currentPosition;
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
            public int CurrentPosition { get; private set; }
 | 
			
		||||
 | 
			
		||||
            public bool HasMoreItems
 | 
			
		||||
            {
 | 
			
		||||
                get
 | 
			
		||||
                {
 | 
			
		||||
                    return false;
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
            public bool HasMoreItems => false;
 | 
			
		||||
 | 
			
		||||
            public bool IsCurrentAfterLast
 | 
			
		||||
            {
 | 
			
		||||
                get
 | 
			
		||||
                {
 | 
			
		||||
                    return m_currentPosition >= m_source.Count;
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
            public bool IsCurrentAfterLast => CurrentPosition >= m_source.Count;
 | 
			
		||||
 | 
			
		||||
            public bool IsCurrentBeforeFirst
 | 
			
		||||
            {
 | 
			
		||||
                get
 | 
			
		||||
                {
 | 
			
		||||
                    return m_currentPosition < 0;
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
            public bool IsCurrentBeforeFirst => CurrentPosition < 0;
 | 
			
		||||
 | 
			
		||||
            public int IndexOf(object item)
 | 
			
		||||
            {
 | 
			
		||||
@@ -216,7 +177,7 @@ namespace CalculatorApp
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            // Event handlers
 | 
			
		||||
            void OnSourceBindableVectorChanged(Windows.UI.Xaml.Interop.IBindableObservableVector source, object e)
 | 
			
		||||
            private void OnSourceBindableVectorChanged(Windows.UI.Xaml.Interop.IBindableObservableVector source, object e)
 | 
			
		||||
            {
 | 
			
		||||
                Windows.Foundation.Collections.IVectorChangedEventArgs args = (Windows.Foundation.Collections.IVectorChangedEventArgs)e;
 | 
			
		||||
                VectorChanged?.Invoke(this, args);
 | 
			
		||||
@@ -230,8 +191,7 @@ namespace CalculatorApp
 | 
			
		||||
                remove => throw new NotImplementedException();
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            IList m_source;
 | 
			
		||||
            int m_currentPosition;
 | 
			
		||||
            private readonly IList m_source;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        public sealed class AlwaysSelectedCollectionViewConverter : Windows.UI.Xaml.Data.IValueConverter
 | 
			
		||||
@@ -242,8 +202,7 @@ namespace CalculatorApp
 | 
			
		||||
 | 
			
		||||
            public object Convert(object value, Type targetType, object parameter, string language)
 | 
			
		||||
            {
 | 
			
		||||
                var result = value as IList;
 | 
			
		||||
                if (result != null)
 | 
			
		||||
                if (value is IList result)
 | 
			
		||||
                {
 | 
			
		||||
                    return new AlwaysSelectedCollectionView(result);
 | 
			
		||||
                }
 | 
			
		||||
 
 | 
			
		||||
@@ -1,9 +1,10 @@
 | 
			
		||||
// Copyright (c) Microsoft Corporation. All rights reserved.
 | 
			
		||||
// Copyright (c) Microsoft Corporation. All rights reserved.
 | 
			
		||||
// Licensed under the MIT License.
 | 
			
		||||
 | 
			
		||||
using CalculatorApp.ViewModel.Common;
 | 
			
		||||
 | 
			
		||||
using System;
 | 
			
		||||
 | 
			
		||||
using CalculatorApp.ViewModel.Common;
 | 
			
		||||
using Windows.ApplicationModel;
 | 
			
		||||
using Windows.ApplicationModel.Core;
 | 
			
		||||
using Windows.Foundation.Diagnostics;
 | 
			
		||||
@@ -11,7 +12,7 @@ using Windows.UI.ViewManagement;
 | 
			
		||||
 | 
			
		||||
namespace CalculatorApp
 | 
			
		||||
{
 | 
			
		||||
    static public partial class Globals
 | 
			
		||||
    public static class Globals
 | 
			
		||||
    {
 | 
			
		||||
#if SEND_DIAGNOSTICS
 | 
			
		||||
        // c.f. WINEVENT_KEYWORD_RESERVED_63-56 0xFF00000000000000 // Bits 63-56 - channel keywords
 | 
			
		||||
@@ -29,7 +30,7 @@ namespace CalculatorApp
 | 
			
		||||
#endif
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    class AppLifecycleLogger
 | 
			
		||||
    internal class AppLifecycleLogger
 | 
			
		||||
    {
 | 
			
		||||
        public static AppLifecycleLogger GetInstance()
 | 
			
		||||
        {
 | 
			
		||||
@@ -145,7 +146,7 @@ namespace CalculatorApp
 | 
			
		||||
            fields.AddString("PsmKey", psmKey);
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        private LoggingChannel m_appLifecycleProvider;
 | 
			
		||||
        private readonly LoggingChannel m_appLifecycleProvider;
 | 
			
		||||
        private static readonly Lazy<AppLifecycleLogger> s_selfInstance = new Lazy<AppLifecycleLogger>(() => new AppLifecycleLogger(), true);
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -3,39 +3,39 @@
 | 
			
		||||
 | 
			
		||||
using CalculatorApp.ViewModel;
 | 
			
		||||
using CalculatorApp.ViewModel.Common;
 | 
			
		||||
 | 
			
		||||
using System;
 | 
			
		||||
using System.Collections.Generic;
 | 
			
		||||
using System.Collections.ObjectModel;
 | 
			
		||||
using System.Diagnostics;
 | 
			
		||||
using System.Linq;
 | 
			
		||||
using Windows.Foundation.Collections;
 | 
			
		||||
 | 
			
		||||
using Windows.UI.Core;
 | 
			
		||||
using Windows.UI.Xaml;
 | 
			
		||||
using Windows.UI.Xaml.Controls;
 | 
			
		||||
using Windows.UI.Xaml.Controls.Primitives;
 | 
			
		||||
 | 
			
		||||
using MUXC = Microsoft.UI.Xaml.Controls;
 | 
			
		||||
 | 
			
		||||
namespace CalculatorApp
 | 
			
		||||
{
 | 
			
		||||
    namespace Common
 | 
			
		||||
    {
 | 
			
		||||
        static partial class KeyboardShortcutManagerLocals
 | 
			
		||||
        internal static class KeyboardShortcutManagerLocals
 | 
			
		||||
        {
 | 
			
		||||
            // Lights up all of the buttons in the given range
 | 
			
		||||
            // The range is defined by a pair of iterators
 | 
			
		||||
            static public void LightUpButtons(IEnumerable<WeakReference> buttons)
 | 
			
		||||
            public static void LightUpButtons(IEnumerable<WeakReference> buttons)
 | 
			
		||||
            {
 | 
			
		||||
                foreach (var button in buttons)
 | 
			
		||||
                {
 | 
			
		||||
                    var btn = button.Target as ButtonBase;
 | 
			
		||||
                    if (btn != null && btn.IsEnabled)
 | 
			
		||||
                    if (button.Target is ButtonBase btn && btn.IsEnabled)
 | 
			
		||||
                    {
 | 
			
		||||
                        LightUpButton(btn);
 | 
			
		||||
                    }
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            static public void LightUpButton(ButtonBase button)
 | 
			
		||||
            public static void LightUpButton(ButtonBase button)
 | 
			
		||||
            {
 | 
			
		||||
                // If the button is a toggle button then we don't need
 | 
			
		||||
                // to change the UI of the button
 | 
			
		||||
@@ -58,14 +58,12 @@ namespace CalculatorApp
 | 
			
		||||
                var buttonWeakReference = new WeakReference(button);
 | 
			
		||||
                timer.Tick += (sender, args) =>
 | 
			
		||||
                {
 | 
			
		||||
                    var btn = buttonWeakReference.Target as ButtonBase;
 | 
			
		||||
                    if (btn != null)
 | 
			
		||||
                    if (buttonWeakReference.Target is ButtonBase btn)
 | 
			
		||||
                    {
 | 
			
		||||
                        VisualStateManager.GoToState(button, "Normal", true);
 | 
			
		||||
                    }
 | 
			
		||||
 | 
			
		||||
                    var tmr = timerWeakReference.Target as DispatcherTimer;
 | 
			
		||||
                    if (tmr != null)
 | 
			
		||||
                    if (timerWeakReference.Target is DispatcherTimer tmr)
 | 
			
		||||
                    {
 | 
			
		||||
                        tmr.Stop();
 | 
			
		||||
                    }
 | 
			
		||||
@@ -77,12 +75,11 @@ namespace CalculatorApp
 | 
			
		||||
            // and execute its command.
 | 
			
		||||
            // NOTE: It is assumed that all buttons associated with a particular
 | 
			
		||||
            // key have the same command
 | 
			
		||||
            static public void RunFirstEnabledButtonCommand(IEnumerable<WeakReference> buttons)
 | 
			
		||||
            public static void RunFirstEnabledButtonCommand(IEnumerable<WeakReference> buttons)
 | 
			
		||||
            {
 | 
			
		||||
                foreach (var button in buttons)
 | 
			
		||||
                {
 | 
			
		||||
                    var btn = button.Target as ButtonBase;
 | 
			
		||||
                    if (btn != null && btn.IsEnabled)
 | 
			
		||||
                    if (button.Target is ButtonBase btn && btn.IsEnabled)
 | 
			
		||||
                    {
 | 
			
		||||
                        RunButtonCommand(btn);
 | 
			
		||||
                        break;
 | 
			
		||||
@@ -90,7 +87,7 @@ namespace CalculatorApp
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            static public void RunButtonCommand(ButtonBase button)
 | 
			
		||||
            public static void RunButtonCommand(ButtonBase button)
 | 
			
		||||
            {
 | 
			
		||||
                if (button.IsEnabled)
 | 
			
		||||
                {
 | 
			
		||||
@@ -101,15 +98,13 @@ namespace CalculatorApp
 | 
			
		||||
                        command.Execute(parameter);
 | 
			
		||||
                    }
 | 
			
		||||
 | 
			
		||||
                    var radio = (button as RadioButton);
 | 
			
		||||
                    if (radio != null)
 | 
			
		||||
                    if (button is RadioButton radio)
 | 
			
		||||
                    {
 | 
			
		||||
                        radio.IsChecked = true;
 | 
			
		||||
                        return;
 | 
			
		||||
                    }
 | 
			
		||||
 | 
			
		||||
                    var toggle = (button as ToggleButton);
 | 
			
		||||
                    if (toggle != null)
 | 
			
		||||
                    if (button is ToggleButton toggle)
 | 
			
		||||
                    {
 | 
			
		||||
                        toggle.IsChecked = !(toggle.IsChecked != null && toggle.IsChecked.Value);
 | 
			
		||||
                        return;
 | 
			
		||||
@@ -585,7 +580,7 @@ namespace CalculatorApp
 | 
			
		||||
            private static bool CanNavigateModeByShortcut(MUXC.NavigationView navView, object nvi
 | 
			
		||||
                , ApplicationViewModel vm, ViewMode toMode)
 | 
			
		||||
            {
 | 
			
		||||
                if(nvi != null && nvi is NavCategory navCategory)
 | 
			
		||||
                if (nvi != null && nvi is NavCategory navCategory)
 | 
			
		||||
                {
 | 
			
		||||
                    return navCategory.IsEnabled
 | 
			
		||||
                        && navView.Visibility == Visibility.Visible
 | 
			
		||||
@@ -604,10 +599,9 @@ namespace CalculatorApp
 | 
			
		||||
                    var listItems = EqualRange(lookupMap, (MyVirtualKey)key);
 | 
			
		||||
                    foreach (var itemRef in listItems)
 | 
			
		||||
                    {
 | 
			
		||||
                        var item = itemRef.Target as MUXC.NavigationView;
 | 
			
		||||
                        if (item != null)
 | 
			
		||||
                        if (itemRef.Target is MUXC.NavigationView item)
 | 
			
		||||
                        {
 | 
			
		||||
                            var navView = (MUXC.NavigationView)item;
 | 
			
		||||
                            var navView = item;
 | 
			
		||||
 | 
			
		||||
                            var menuItems = ((List<object>)navView.MenuItemsSource);
 | 
			
		||||
                            if (menuItems != null)
 | 
			
		||||
@@ -668,7 +662,7 @@ namespace CalculatorApp
 | 
			
		||||
                // Handle Ctrl + E for DateCalculator
 | 
			
		||||
                if ((key == Windows.System.VirtualKey.E) && isControlKeyPressed && !isShiftKeyPressed && !isAltKeyPressed)
 | 
			
		||||
                {
 | 
			
		||||
                    NavigateModeByShortcut(isControlKeyPressed, isShiftKeyPressed, false, key, ViewMode.Date);
 | 
			
		||||
                    NavigateModeByShortcut(true, false, false, key, ViewMode.Date);
 | 
			
		||||
                    return;
 | 
			
		||||
                }
 | 
			
		||||
 | 
			
		||||
@@ -699,7 +693,7 @@ namespace CalculatorApp
 | 
			
		||||
                        }
 | 
			
		||||
 | 
			
		||||
                        var buttons = EqualRange(lookupMap, (MyVirtualKey)myVirtualKey);
 | 
			
		||||
                        if (buttons.Count() <= 0)
 | 
			
		||||
                        if (!buttons.Any())
 | 
			
		||||
                        {
 | 
			
		||||
                            return;
 | 
			
		||||
                        }
 | 
			
		||||
@@ -754,7 +748,7 @@ namespace CalculatorApp
 | 
			
		||||
                    }
 | 
			
		||||
 | 
			
		||||
                    bool shiftKeyPressed = (Window.Current.CoreWindow.GetKeyState(Windows.System.VirtualKey.Shift) & CoreVirtualKeyStates.Down) == CoreVirtualKeyStates.Down;
 | 
			
		||||
                    NavigateModeByShortcut(controlKeyPressed, shiftKeyPressed, altPressed, key, null);
 | 
			
		||||
                    NavigateModeByShortcut(false, shiftKeyPressed, true, key, null);
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
@@ -835,18 +829,18 @@ namespace CalculatorApp
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            private static SortedDictionary<int, SortedDictionary<char, List<WeakReference>>> s_characterForButtons = new SortedDictionary<int, SortedDictionary<char, List<WeakReference>>>();
 | 
			
		||||
            private static SortedDictionary<int, SortedDictionary<MyVirtualKey, List<WeakReference>>> s_virtualKey = new SortedDictionary<int, SortedDictionary<MyVirtualKey, List<WeakReference>>>();
 | 
			
		||||
            private static SortedDictionary<int, SortedDictionary<MyVirtualKey, List<WeakReference>>> s_VirtualKeyControlChordsForButtons = new SortedDictionary<int, SortedDictionary<MyVirtualKey, List<WeakReference>>>();
 | 
			
		||||
            private static SortedDictionary<int, SortedDictionary<MyVirtualKey, List<WeakReference>>> s_VirtualKeyShiftChordsForButtons = new SortedDictionary<int, SortedDictionary<MyVirtualKey, List<WeakReference>>>();
 | 
			
		||||
            private static SortedDictionary<int, SortedDictionary<MyVirtualKey, List<WeakReference>>> s_VirtualKeyAltChordsForButtons = new SortedDictionary<int, SortedDictionary<MyVirtualKey, List<WeakReference>>>();
 | 
			
		||||
            private static SortedDictionary<int, SortedDictionary<MyVirtualKey, List<WeakReference>>> s_VirtualKeyControlShiftChordsForButtons = new SortedDictionary<int, SortedDictionary<MyVirtualKey, List<WeakReference>>>();
 | 
			
		||||
            private static readonly SortedDictionary<int, SortedDictionary<char, List<WeakReference>>> s_characterForButtons = new SortedDictionary<int, SortedDictionary<char, List<WeakReference>>>();
 | 
			
		||||
            private static readonly SortedDictionary<int, SortedDictionary<MyVirtualKey, List<WeakReference>>> s_virtualKey = new SortedDictionary<int, SortedDictionary<MyVirtualKey, List<WeakReference>>>();
 | 
			
		||||
            private static readonly SortedDictionary<int, SortedDictionary<MyVirtualKey, List<WeakReference>>> s_VirtualKeyControlChordsForButtons = new SortedDictionary<int, SortedDictionary<MyVirtualKey, List<WeakReference>>>();
 | 
			
		||||
            private static readonly SortedDictionary<int, SortedDictionary<MyVirtualKey, List<WeakReference>>> s_VirtualKeyShiftChordsForButtons = new SortedDictionary<int, SortedDictionary<MyVirtualKey, List<WeakReference>>>();
 | 
			
		||||
            private static readonly SortedDictionary<int, SortedDictionary<MyVirtualKey, List<WeakReference>>> s_VirtualKeyAltChordsForButtons = new SortedDictionary<int, SortedDictionary<MyVirtualKey, List<WeakReference>>>();
 | 
			
		||||
            private static readonly SortedDictionary<int, SortedDictionary<MyVirtualKey, List<WeakReference>>> s_VirtualKeyControlShiftChordsForButtons = new SortedDictionary<int, SortedDictionary<MyVirtualKey, List<WeakReference>>>();
 | 
			
		||||
 | 
			
		||||
            private static SortedDictionary<int, bool> s_IsDropDownOpen = new SortedDictionary<int, bool>();
 | 
			
		||||
            private static SortedDictionary<int, bool> s_ignoreNextEscape = new SortedDictionary<int, bool>();
 | 
			
		||||
            private static SortedDictionary<int, bool> s_keepIgnoringEscape = new SortedDictionary<int, bool>();
 | 
			
		||||
            private static SortedDictionary<int, bool> s_fHonorShortcuts = new SortedDictionary<int, bool>();
 | 
			
		||||
            private static SortedDictionary<int, bool> s_fDisableShortcuts = new SortedDictionary<int, bool>();
 | 
			
		||||
            private static readonly SortedDictionary<int, bool> s_IsDropDownOpen = new SortedDictionary<int, bool>();
 | 
			
		||||
            private static readonly SortedDictionary<int, bool> s_ignoreNextEscape = new SortedDictionary<int, bool>();
 | 
			
		||||
            private static readonly SortedDictionary<int, bool> s_keepIgnoringEscape = new SortedDictionary<int, bool>();
 | 
			
		||||
            private static readonly SortedDictionary<int, bool> s_fHonorShortcuts = new SortedDictionary<int, bool>();
 | 
			
		||||
            private static readonly SortedDictionary<int, bool> s_fDisableShortcuts = new SortedDictionary<int, bool>();
 | 
			
		||||
 | 
			
		||||
            //private static Concurrency.reader_writer_lock s_keyboardShortcutMapLock;
 | 
			
		||||
            private static readonly object s_keyboardShortcutMapLockMutex = new object();
 | 
			
		||||
 
 | 
			
		||||
@@ -46,8 +46,7 @@ namespace CalculatorApp
 | 
			
		||||
                // extract that value and ensure it is valid, ie >= 0
 | 
			
		||||
                if (value != null)
 | 
			
		||||
                {
 | 
			
		||||
                    var box = value as Windows.Foundation.IPropertyValue;
 | 
			
		||||
                    if (box != null && box.Type == Windows.Foundation.PropertyType.Int32)
 | 
			
		||||
                    if (value is Windows.Foundation.IPropertyValue box && box.Type == Windows.Foundation.PropertyType.Int32)
 | 
			
		||||
                    {
 | 
			
		||||
                        int index = box.GetInt32();
 | 
			
		||||
                        if (index >= 0)
 | 
			
		||||
 
 | 
			
		||||
@@ -1,17 +0,0 @@
 | 
			
		||||
// Copyright (c) Microsoft Corporation. All rights reserved.
 | 
			
		||||
// Licensed under the MIT License.
 | 
			
		||||
 | 
			
		||||
namespace CalculatorApp
 | 
			
		||||
{
 | 
			
		||||
    static class ViewState
 | 
			
		||||
    {
 | 
			
		||||
        public static readonly string Snap = "Snap";
 | 
			
		||||
        public static readonly string DockedView = "DockedView";
 | 
			
		||||
 | 
			
		||||
        public static bool IsValidViewState(string viewState)
 | 
			
		||||
        {
 | 
			
		||||
            return (viewState == Snap) || (viewState == DockedView);
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@@ -1,27 +1,15 @@
 | 
			
		||||
// Copyright (c) Microsoft Corporation. All rights reserved.
 | 
			
		||||
// Licensed under the MIT License.
 | 
			
		||||
 | 
			
		||||
using System;
 | 
			
		||||
using System.Collections.Generic;
 | 
			
		||||
using System.Threading.Tasks;
 | 
			
		||||
using System.Diagnostics;
 | 
			
		||||
using CalculatorApp;
 | 
			
		||||
using CalculatorApp.Controls;
 | 
			
		||||
using CalculatorApp.ViewModel.Common;
 | 
			
		||||
 | 
			
		||||
using Windows.Devices.Input;
 | 
			
		||||
using Windows.Foundation;
 | 
			
		||||
using Windows.Foundation.Collections;
 | 
			
		||||
using System;
 | 
			
		||||
using System.Diagnostics;
 | 
			
		||||
 | 
			
		||||
using Windows.UI.Xaml;
 | 
			
		||||
using Windows.UI.Xaml.Controls;
 | 
			
		||||
using Windows.UI.Xaml.Controls.Primitives;
 | 
			
		||||
using Windows.UI.Xaml.Data;
 | 
			
		||||
using Windows.UI.Xaml.Input;
 | 
			
		||||
using Windows.UI.Xaml.Media;
 | 
			
		||||
using Windows.UI.Xaml.Navigation;
 | 
			
		||||
using Windows.UI.Xaml.Automation;
 | 
			
		||||
using Windows.UI.Xaml.Automation.Peers;
 | 
			
		||||
using System.Reflection;
 | 
			
		||||
using Windows.UI.Xaml.Controls;
 | 
			
		||||
using Windows.UI.Xaml.Input;
 | 
			
		||||
 | 
			
		||||
namespace CalculatorApp
 | 
			
		||||
{
 | 
			
		||||
@@ -39,8 +27,8 @@ namespace CalculatorApp
 | 
			
		||||
 | 
			
		||||
            public double MinFontSize
 | 
			
		||||
            {
 | 
			
		||||
                get { return (double)GetValue(MinFontSizeProperty); }
 | 
			
		||||
                set { SetValue(MinFontSizeProperty, value); }
 | 
			
		||||
                get => (double)GetValue(MinFontSizeProperty);
 | 
			
		||||
                set => SetValue(MinFontSizeProperty, value);
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            // Using a DependencyProperty as the backing store for MinFontSize.  This enables animation, styling, binding, etc...
 | 
			
		||||
@@ -53,8 +41,8 @@ namespace CalculatorApp
 | 
			
		||||
 | 
			
		||||
            public double MaxFontSize
 | 
			
		||||
            {
 | 
			
		||||
                get { return (double)GetValue(MaxFontSizeProperty); }
 | 
			
		||||
                set { SetValue(MaxFontSizeProperty, value); }
 | 
			
		||||
                get => (double)GetValue(MaxFontSizeProperty);
 | 
			
		||||
                set => SetValue(MaxFontSizeProperty, value);
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            // Using a DependencyProperty as the backing store for MaxFontSize.  This enables animation, styling, binding, etc...
 | 
			
		||||
@@ -67,8 +55,8 @@ namespace CalculatorApp
 | 
			
		||||
 | 
			
		||||
            public Thickness DisplayMargin
 | 
			
		||||
            {
 | 
			
		||||
                get { return (Thickness)GetValue(DisplayMarginProperty); }
 | 
			
		||||
                set { SetValue(DisplayMarginProperty, value); }
 | 
			
		||||
                get => (Thickness)GetValue(DisplayMarginProperty);
 | 
			
		||||
                set => SetValue(DisplayMarginProperty, value);
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            // Using a DependencyProperty as the backing store for DisplayMargin.  This enables animation, styling, binding, etc...
 | 
			
		||||
@@ -77,8 +65,8 @@ namespace CalculatorApp
 | 
			
		||||
 | 
			
		||||
            public bool IsActive
 | 
			
		||||
            {
 | 
			
		||||
                get { return (bool)GetValue(IsActiveProperty); }
 | 
			
		||||
                set { SetValue(IsActiveProperty, value); }
 | 
			
		||||
                get => (bool)GetValue(IsActiveProperty);
 | 
			
		||||
                set => SetValue(IsActiveProperty, value);
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            // Using a DependencyProperty as the backing store for IsActive.  This enables animation, styling, binding, etc...
 | 
			
		||||
@@ -91,8 +79,8 @@ namespace CalculatorApp
 | 
			
		||||
 | 
			
		||||
            public string DisplayValue
 | 
			
		||||
            {
 | 
			
		||||
                get { return (string)GetValue(DisplayValueProperty); }
 | 
			
		||||
                set { SetValue(DisplayValueProperty, value); }
 | 
			
		||||
                get => (string)GetValue(DisplayValueProperty);
 | 
			
		||||
                set => SetValue(DisplayValueProperty, value);
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            // Using a DependencyProperty as the backing store for DisplayValue.  This enables animation, styling, binding, etc...
 | 
			
		||||
@@ -105,8 +93,8 @@ namespace CalculatorApp
 | 
			
		||||
 | 
			
		||||
            public bool IsInError
 | 
			
		||||
            {
 | 
			
		||||
                get { return (bool)GetValue(IsInErrorProperty); }
 | 
			
		||||
                set { SetValue(IsInErrorProperty, value); }
 | 
			
		||||
                get => (bool)GetValue(IsInErrorProperty);
 | 
			
		||||
                set => SetValue(IsInErrorProperty, value);
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            // Using a DependencyProperty as the backing store for IsInError.  This enables animation, styling, binding, etc...
 | 
			
		||||
@@ -119,8 +107,8 @@ namespace CalculatorApp
 | 
			
		||||
 | 
			
		||||
            public bool IsOperatorCommand
 | 
			
		||||
            {
 | 
			
		||||
                get { return (bool)GetValue(IsOperatorCommandProperty); }
 | 
			
		||||
                set { SetValue(IsOperatorCommandProperty, value); }
 | 
			
		||||
                get => (bool)GetValue(IsOperatorCommandProperty);
 | 
			
		||||
                set => SetValue(IsOperatorCommandProperty, value);
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            // Using a DependencyProperty as the backing store for IsOperatorCommand.  This enables animation, styling, binding, etc...
 | 
			
		||||
@@ -278,7 +266,7 @@ namespace CalculatorApp
 | 
			
		||||
            {
 | 
			
		||||
                var requestedElement = e.OriginalSource;
 | 
			
		||||
 | 
			
		||||
                if (requestedElement.Equals(m_textBlock as object))
 | 
			
		||||
                if (requestedElement.Equals(m_textBlock))
 | 
			
		||||
                {
 | 
			
		||||
                    m_textBlock.Focus(FocusState.Programmatic);
 | 
			
		||||
                }
 | 
			
		||||
@@ -364,14 +352,7 @@ namespace CalculatorApp
 | 
			
		||||
 | 
			
		||||
            private void UpdateVisualState()
 | 
			
		||||
            {
 | 
			
		||||
                if (IsActive)
 | 
			
		||||
                {
 | 
			
		||||
                    VisualStateManager.GoToState(this, "Active", true);
 | 
			
		||||
                }
 | 
			
		||||
                else
 | 
			
		||||
                {
 | 
			
		||||
                    VisualStateManager.GoToState(this, "Normal", true);
 | 
			
		||||
                }
 | 
			
		||||
                VisualStateManager.GoToState(this, IsActive ? "Active" : "Normal", true);
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            private void OnScrollLeftClick(object sender, RoutedEventArgs e)
 | 
			
		||||
@@ -387,14 +368,13 @@ namespace CalculatorApp
 | 
			
		||||
            private void ModifyFontAndMargin(TextBlock textBox, double fontChange)
 | 
			
		||||
            {
 | 
			
		||||
                double cur = textBox.FontSize;
 | 
			
		||||
                double newFontSize = 0.0;
 | 
			
		||||
                double scaleFactor = SCALEFACTOR;
 | 
			
		||||
                if (m_textContainer.ActualHeight <= HEIGHTCUTOFF)
 | 
			
		||||
                {
 | 
			
		||||
                    scaleFactor = SMALLHEIGHTSCALEFACTOR;
 | 
			
		||||
                }
 | 
			
		||||
 | 
			
		||||
                newFontSize = Math.Min(Math.Max(cur + fontChange, MinFontSize), MaxFontSize);
 | 
			
		||||
                double newFontSize = Math.Min(Math.Max(cur + fontChange, MinFontSize), MaxFontSize);
 | 
			
		||||
                m_textContainer.Padding = new Thickness(0, 0, 0, scaleFactor * Math.Abs(cur - newFontSize));
 | 
			
		||||
                textBox.FontSize = newFontSize;
 | 
			
		||||
            }
 | 
			
		||||
 
 | 
			
		||||
@@ -1,10 +1,6 @@
 | 
			
		||||
// Copyright (c) Microsoft Corporation. All rights reserved.
 | 
			
		||||
// Licensed under the MIT License.
 | 
			
		||||
 | 
			
		||||
using System;
 | 
			
		||||
using System.Collections.Generic;
 | 
			
		||||
using System.Threading.Tasks;
 | 
			
		||||
using System.Diagnostics;
 | 
			
		||||
using Windows.UI.Xaml;
 | 
			
		||||
using Windows.UI.Xaml.Automation.Peers;
 | 
			
		||||
 | 
			
		||||
@@ -26,12 +22,7 @@ namespace CalculatorApp
 | 
			
		||||
 | 
			
		||||
            protected override object GetPatternCore(PatternInterface pattern)
 | 
			
		||||
            {
 | 
			
		||||
                if (pattern == PatternInterface.Invoke)
 | 
			
		||||
                {
 | 
			
		||||
                    return this;
 | 
			
		||||
                }
 | 
			
		||||
 | 
			
		||||
                return base.GetPatternCore(pattern);
 | 
			
		||||
                return pattern == PatternInterface.Invoke ? this : base.GetPatternCore(pattern);
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            public void Invoke()
 | 
			
		||||
 
 | 
			
		||||
@@ -1,19 +1,12 @@
 | 
			
		||||
// Copyright (c) Microsoft Corporation. All rights reserved.
 | 
			
		||||
// Licensed under the MIT License.
 | 
			
		||||
 | 
			
		||||
using System;
 | 
			
		||||
using System.Collections.Generic;
 | 
			
		||||
using System.Threading.Tasks;
 | 
			
		||||
using System.Diagnostics;
 | 
			
		||||
using CalculatorApp;
 | 
			
		||||
using CalculatorApp.Controls;
 | 
			
		||||
using CalculatorApp.ViewModel.Common;
 | 
			
		||||
 | 
			
		||||
using Windows.System;
 | 
			
		||||
using Windows.UI.Xaml;
 | 
			
		||||
using Windows.UI.Xaml.Input;
 | 
			
		||||
using Windows.UI.Xaml.Data;
 | 
			
		||||
using Windows.Foundation.Collections;
 | 
			
		||||
using Windows.Storage.Pickers;
 | 
			
		||||
using Windows.UI.Xaml.Input;
 | 
			
		||||
 | 
			
		||||
namespace CalculatorApp
 | 
			
		||||
{
 | 
			
		||||
@@ -25,15 +18,17 @@ namespace CalculatorApp
 | 
			
		||||
            {
 | 
			
		||||
                // Set the default bindings for this button, these can be overwritten by Xaml if needed
 | 
			
		||||
                // These are a replacement for binding in styles
 | 
			
		||||
                Binding commandBinding = new Binding();
 | 
			
		||||
                commandBinding.Path = new PropertyPath("ButtonPressed");
 | 
			
		||||
                Binding commandBinding = new Binding
 | 
			
		||||
                {
 | 
			
		||||
                    Path = new PropertyPath("ButtonPressed")
 | 
			
		||||
                };
 | 
			
		||||
                this.SetBinding(CommandProperty, commandBinding);
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            public NumbersAndOperatorsEnum ButtonId
 | 
			
		||||
            {
 | 
			
		||||
                get { return (NumbersAndOperatorsEnum)GetValue(ButtonIdProperty); }
 | 
			
		||||
                set { SetValue(ButtonIdProperty, value); }
 | 
			
		||||
                get => (NumbersAndOperatorsEnum)GetValue(ButtonIdProperty);
 | 
			
		||||
                set => SetValue(ButtonIdProperty, value);
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            // Using a DependencyProperty as the backing store for ButtonId.  This enables animation, styling, binding, etc...
 | 
			
		||||
@@ -46,8 +41,8 @@ namespace CalculatorApp
 | 
			
		||||
 | 
			
		||||
            public string AuditoryFeedback
 | 
			
		||||
            {
 | 
			
		||||
                get { return (string)GetValue(AuditoryFeedbackProperty); }
 | 
			
		||||
                set { SetValue(AuditoryFeedbackProperty, value); }
 | 
			
		||||
                get => (string)GetValue(AuditoryFeedbackProperty);
 | 
			
		||||
                set => SetValue(AuditoryFeedbackProperty, value);
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            // Using a DependencyProperty as the backing store for AuditoryFeedback.  This enables animation, styling, binding, etc...
 | 
			
		||||
@@ -60,8 +55,8 @@ namespace CalculatorApp
 | 
			
		||||
 | 
			
		||||
            public Windows.UI.Xaml.Media.Brush HoverBackground
 | 
			
		||||
            {
 | 
			
		||||
                get { return (Windows.UI.Xaml.Media.Brush)GetValue(HoverBackgroundProperty); }
 | 
			
		||||
                set { SetValue(HoverBackgroundProperty, value); }
 | 
			
		||||
                get => (Windows.UI.Xaml.Media.Brush)GetValue(HoverBackgroundProperty);
 | 
			
		||||
                set => SetValue(HoverBackgroundProperty, value);
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            // Using a DependencyProperty as the backing store for HoverBackground.  This enables animation, styling, binding, etc...
 | 
			
		||||
@@ -70,8 +65,8 @@ namespace CalculatorApp
 | 
			
		||||
 | 
			
		||||
            public Windows.UI.Xaml.Media.Brush HoverForeground
 | 
			
		||||
            {
 | 
			
		||||
                get { return (Windows.UI.Xaml.Media.Brush)GetValue(HoverForegroundProperty); }
 | 
			
		||||
                set { SetValue(HoverForegroundProperty, value); }
 | 
			
		||||
                get => (Windows.UI.Xaml.Media.Brush)GetValue(HoverForegroundProperty);
 | 
			
		||||
                set => SetValue(HoverForegroundProperty, value);
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            // Using a DependencyProperty as the backing store for HoverForeground.  This enables animation, styling, binding, etc...
 | 
			
		||||
@@ -80,8 +75,8 @@ namespace CalculatorApp
 | 
			
		||||
 | 
			
		||||
            public Windows.UI.Xaml.Media.Brush PressBackground
 | 
			
		||||
            {
 | 
			
		||||
                get { return (Windows.UI.Xaml.Media.Brush)GetValue(PressBackgroundProperty); }
 | 
			
		||||
                set { SetValue(PressBackgroundProperty, value); }
 | 
			
		||||
                get => (Windows.UI.Xaml.Media.Brush)GetValue(PressBackgroundProperty);
 | 
			
		||||
                set => SetValue(PressBackgroundProperty, value);
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            // Using a DependencyProperty as the backing store for PressBackground.  This enables animation, styling, binding, etc...
 | 
			
		||||
@@ -90,8 +85,8 @@ namespace CalculatorApp
 | 
			
		||||
 | 
			
		||||
            public Windows.UI.Xaml.Media.Brush PressForeground
 | 
			
		||||
            {
 | 
			
		||||
                get { return (Windows.UI.Xaml.Media.Brush)GetValue(PressForegroundProperty); }
 | 
			
		||||
                set { SetValue(PressForegroundProperty, value); }
 | 
			
		||||
                get => (Windows.UI.Xaml.Media.Brush)GetValue(PressForegroundProperty);
 | 
			
		||||
                set => SetValue(PressForegroundProperty, value);
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            // Using a DependencyProperty as the backing store for PressForeground.  This enables animation, styling, binding, etc...
 | 
			
		||||
@@ -100,8 +95,8 @@ namespace CalculatorApp
 | 
			
		||||
 | 
			
		||||
            public Windows.UI.Xaml.Media.Brush DisabledBackground
 | 
			
		||||
            {
 | 
			
		||||
                get { return (Windows.UI.Xaml.Media.Brush)GetValue(DisabledBackgroundProperty); }
 | 
			
		||||
                set { SetValue(DisabledBackgroundProperty, value); }
 | 
			
		||||
                get => (Windows.UI.Xaml.Media.Brush)GetValue(DisabledBackgroundProperty);
 | 
			
		||||
                set => SetValue(DisabledBackgroundProperty, value);
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            // Using a DependencyProperty as the backing store for DisabledBackground.  This enables animation, styling, binding, etc...
 | 
			
		||||
@@ -110,8 +105,8 @@ namespace CalculatorApp
 | 
			
		||||
 | 
			
		||||
            public Windows.UI.Xaml.Media.Brush DisabledForeground
 | 
			
		||||
            {
 | 
			
		||||
                get { return (Windows.UI.Xaml.Media.Brush)GetValue(DisabledForegroundProperty); }
 | 
			
		||||
                set { SetValue(DisabledForegroundProperty, value); }
 | 
			
		||||
                get => (Windows.UI.Xaml.Media.Brush)GetValue(DisabledForegroundProperty);
 | 
			
		||||
                set => SetValue(DisabledForegroundProperty, value);
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            // Using a DependencyProperty as the backing store for DisabledForeground.  This enables animation, styling, binding, etc...
 | 
			
		||||
 
 | 
			
		||||
@@ -2,7 +2,7 @@
 | 
			
		||||
// Licensed under the MIT License.
 | 
			
		||||
 | 
			
		||||
using CalculatorApp.ViewModel.Common;
 | 
			
		||||
using System;
 | 
			
		||||
 | 
			
		||||
using Windows.UI.Text;
 | 
			
		||||
using Windows.UI.Xaml;
 | 
			
		||||
using Windows.UI.Xaml.Automation;
 | 
			
		||||
@@ -22,8 +22,8 @@ namespace CalculatorApp
 | 
			
		||||
 | 
			
		||||
            public Windows.UI.Xaml.Media.SolidColorBrush EquationColor
 | 
			
		||||
            {
 | 
			
		||||
                get { return (Windows.UI.Xaml.Media.SolidColorBrush)GetValue(EquationColorProperty); }
 | 
			
		||||
                set { SetValue(EquationColorProperty, value); }
 | 
			
		||||
                get => (Windows.UI.Xaml.Media.SolidColorBrush)GetValue(EquationColorProperty);
 | 
			
		||||
                set => SetValue(EquationColorProperty, value);
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            // Using a DependencyProperty as the backing store for EquationColor.  This enables animation, styling, binding, etc...
 | 
			
		||||
@@ -32,8 +32,8 @@ namespace CalculatorApp
 | 
			
		||||
 | 
			
		||||
            public Windows.UI.Xaml.Media.SolidColorBrush EquationButtonForegroundColor
 | 
			
		||||
            {
 | 
			
		||||
                get { return (Windows.UI.Xaml.Media.SolidColorBrush)GetValue(EquationButtonForegroundColorProperty); }
 | 
			
		||||
                set { SetValue(EquationButtonForegroundColorProperty, value); }
 | 
			
		||||
                get => (Windows.UI.Xaml.Media.SolidColorBrush)GetValue(EquationButtonForegroundColorProperty);
 | 
			
		||||
                set => SetValue(EquationButtonForegroundColorProperty, value);
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            // Using a DependencyProperty as the backing store for EquationButtonForegroundColor.  This enables animation, styling, binding, etc...
 | 
			
		||||
@@ -42,8 +42,8 @@ namespace CalculatorApp
 | 
			
		||||
 | 
			
		||||
            public Windows.UI.Xaml.Controls.Flyout ColorChooserFlyout
 | 
			
		||||
            {
 | 
			
		||||
                get { return (Windows.UI.Xaml.Controls.Flyout)GetValue(ColorChooserFlyoutProperty); }
 | 
			
		||||
                set { SetValue(ColorChooserFlyoutProperty, value); }
 | 
			
		||||
                get => (Windows.UI.Xaml.Controls.Flyout)GetValue(ColorChooserFlyoutProperty);
 | 
			
		||||
                set => SetValue(ColorChooserFlyoutProperty, value);
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            // Using a DependencyProperty as the backing store for ColorChooserFlyout.  This enables animation, styling, binding, etc...
 | 
			
		||||
@@ -52,8 +52,8 @@ namespace CalculatorApp
 | 
			
		||||
 | 
			
		||||
            public string EquationButtonContentIndex
 | 
			
		||||
            {
 | 
			
		||||
                get { return (string)GetValue(EquationButtonContentIndexProperty); }
 | 
			
		||||
                set { SetValue(EquationButtonContentIndexProperty, value); }
 | 
			
		||||
                get => (string)GetValue(EquationButtonContentIndexProperty);
 | 
			
		||||
                set => SetValue(EquationButtonContentIndexProperty, value);
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            // Using a DependencyProperty as the backing store for EquationButtonContentIndex.  This enables animation, styling, binding, etc...
 | 
			
		||||
@@ -66,8 +66,8 @@ namespace CalculatorApp
 | 
			
		||||
 | 
			
		||||
            public string MathEquation
 | 
			
		||||
            {
 | 
			
		||||
                get { return (string)GetValue(MathEquationProperty); }
 | 
			
		||||
                set { SetValue(MathEquationProperty, value); }
 | 
			
		||||
                get => (string)GetValue(MathEquationProperty);
 | 
			
		||||
                set => SetValue(MathEquationProperty, value);
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            // Using a DependencyProperty as the backing store for MathEquation.  This enables animation, styling, binding, etc...
 | 
			
		||||
@@ -76,8 +76,8 @@ namespace CalculatorApp
 | 
			
		||||
 | 
			
		||||
            public bool HasError
 | 
			
		||||
            {
 | 
			
		||||
                get { return (bool)GetValue(HasErrorProperty); }
 | 
			
		||||
                set { SetValue(HasErrorProperty, value); }
 | 
			
		||||
                get => (bool)GetValue(HasErrorProperty);
 | 
			
		||||
                set => SetValue(HasErrorProperty, value);
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            // Using a DependencyProperty as the backing store for HasError.  This enables animation, styling, binding, etc...
 | 
			
		||||
@@ -90,8 +90,8 @@ namespace CalculatorApp
 | 
			
		||||
 | 
			
		||||
            public bool IsAddEquationMode
 | 
			
		||||
            {
 | 
			
		||||
                get { return (bool)GetValue(IsAddEquationModeProperty); }
 | 
			
		||||
                set { SetValue(IsAddEquationModeProperty, value); }
 | 
			
		||||
                get => (bool)GetValue(IsAddEquationModeProperty);
 | 
			
		||||
                set => SetValue(IsAddEquationModeProperty, value);
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            // Using a DependencyProperty as the backing store for IsAddEquationMode.  This enables animation, styling, binding, etc...
 | 
			
		||||
@@ -104,8 +104,8 @@ namespace CalculatorApp
 | 
			
		||||
 | 
			
		||||
            public string ErrorText
 | 
			
		||||
            {
 | 
			
		||||
                get { return (string)GetValue(ErrorTextProperty); }
 | 
			
		||||
                set { SetValue(ErrorTextProperty, value); }
 | 
			
		||||
                get => (string)GetValue(ErrorTextProperty);
 | 
			
		||||
                set => SetValue(ErrorTextProperty, value);
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            // Using a DependencyProperty as the backing store for ErrorText.  This enables animation, styling, binding, etc...
 | 
			
		||||
@@ -114,19 +114,15 @@ namespace CalculatorApp
 | 
			
		||||
 | 
			
		||||
            public bool IsEquationLineDisabled
 | 
			
		||||
            {
 | 
			
		||||
                get { return (bool)GetValue(IsEquationLineDisabledProperty); }
 | 
			
		||||
                set { SetValue(IsEquationLineDisabledProperty, value); }
 | 
			
		||||
                get => (bool)GetValue(IsEquationLineDisabledProperty);
 | 
			
		||||
                set => SetValue(IsEquationLineDisabledProperty, value);
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            // Using a DependencyProperty as the backing store for IsEquationLineDisabled.  This enables animation, styling, binding, etc...
 | 
			
		||||
            public static readonly DependencyProperty IsEquationLineDisabledProperty =
 | 
			
		||||
                DependencyProperty.Register(nameof(IsEquationLineDisabled), typeof(bool), typeof(EquationTextBox), new PropertyMetadata(default(bool)));
 | 
			
		||||
 | 
			
		||||
            public bool HasFocus
 | 
			
		||||
            {
 | 
			
		||||
                get => m_HasFocus;
 | 
			
		||||
            }
 | 
			
		||||
            private bool m_HasFocus;
 | 
			
		||||
            private bool HasFocus { get; set; }
 | 
			
		||||
 | 
			
		||||
            public event Windows.UI.Xaml.RoutedEventHandler RemoveButtonClicked;
 | 
			
		||||
            public event Windows.UI.Xaml.RoutedEventHandler KeyGraphFeaturesButtonClicked;
 | 
			
		||||
@@ -296,18 +292,18 @@ namespace CalculatorApp
 | 
			
		||||
 | 
			
		||||
            private void UpdateCommonVisualState()
 | 
			
		||||
            {
 | 
			
		||||
                string state = null;
 | 
			
		||||
                string state;
 | 
			
		||||
                bool richEditHasContent = RichEditHasContent();
 | 
			
		||||
 | 
			
		||||
                if (m_HasFocus && HasError)
 | 
			
		||||
                if (HasFocus && HasError)
 | 
			
		||||
                {
 | 
			
		||||
                    state = "FocusedError";
 | 
			
		||||
                }
 | 
			
		||||
                else if (IsAddEquationMode && m_HasFocus && !richEditHasContent)
 | 
			
		||||
                else if (IsAddEquationMode && HasFocus && !richEditHasContent)
 | 
			
		||||
                {
 | 
			
		||||
                    state = "AddEquationFocused";
 | 
			
		||||
                }
 | 
			
		||||
                else if (m_HasFocus)
 | 
			
		||||
                else if (HasFocus)
 | 
			
		||||
                {
 | 
			
		||||
                    state = "Focused";
 | 
			
		||||
                }
 | 
			
		||||
@@ -342,7 +338,7 @@ namespace CalculatorApp
 | 
			
		||||
            {
 | 
			
		||||
                string state;
 | 
			
		||||
 | 
			
		||||
                if (m_HasFocus && RichEditHasContent())
 | 
			
		||||
                if (HasFocus && RichEditHasContent())
 | 
			
		||||
                {
 | 
			
		||||
                    state = "ButtonVisible";
 | 
			
		||||
                }
 | 
			
		||||
@@ -361,16 +357,13 @@ namespace CalculatorApp
 | 
			
		||||
            private bool RichEditHasContent()
 | 
			
		||||
            {
 | 
			
		||||
                string text = null;
 | 
			
		||||
                if (m_richEditBox != null)
 | 
			
		||||
                {
 | 
			
		||||
                    m_richEditBox.TextDocument.GetText(Windows.UI.Text.TextGetOptions.NoHidden, out text);
 | 
			
		||||
                }
 | 
			
		||||
                m_richEditBox?.TextDocument.GetText(Windows.UI.Text.TextGetOptions.NoHidden, out text);
 | 
			
		||||
                return !string.IsNullOrEmpty(text);
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            private void OnRichEditBoxGotFocus(object sender, RoutedEventArgs e)
 | 
			
		||||
            {
 | 
			
		||||
                m_HasFocus = true;
 | 
			
		||||
                HasFocus = true;
 | 
			
		||||
                UpdateCommonVisualState();
 | 
			
		||||
                UpdateButtonsVisualState();
 | 
			
		||||
            }
 | 
			
		||||
@@ -379,7 +372,7 @@ namespace CalculatorApp
 | 
			
		||||
            {
 | 
			
		||||
                if (!m_richEditBox.ContextFlyout.IsOpen)
 | 
			
		||||
                {
 | 
			
		||||
                    m_HasFocus = false;
 | 
			
		||||
                    HasFocus = false;
 | 
			
		||||
                }
 | 
			
		||||
 | 
			
		||||
                UpdateCommonVisualState();
 | 
			
		||||
@@ -458,10 +451,7 @@ namespace CalculatorApp
 | 
			
		||||
            private void OnFunctionMenuButtonClicked(object sender, RoutedEventArgs e)
 | 
			
		||||
            {
 | 
			
		||||
                // Submit the equation before trying to analyze it if invoked from context menu
 | 
			
		||||
                if (m_richEditBox != null)
 | 
			
		||||
                {
 | 
			
		||||
                    m_richEditBox.SubmitEquation(EquationSubmissionSource.FOCUS_LOST);
 | 
			
		||||
                }
 | 
			
		||||
                m_richEditBox?.SubmitEquation(EquationSubmissionSource.FOCUS_LOST);
 | 
			
		||||
 | 
			
		||||
                KeyGraphFeaturesButtonClicked?.Invoke(this, new RoutedEventArgs());
 | 
			
		||||
            }
 | 
			
		||||
@@ -475,7 +465,7 @@ namespace CalculatorApp
 | 
			
		||||
 | 
			
		||||
                if (m_kgfEquationMenuItem != null)
 | 
			
		||||
                {
 | 
			
		||||
                    m_kgfEquationMenuItem.IsEnabled = m_HasFocus && !HasError && RichEditHasContent();
 | 
			
		||||
                    m_kgfEquationMenuItem.IsEnabled = HasFocus && !HasError && RichEditHasContent();
 | 
			
		||||
                }
 | 
			
		||||
 | 
			
		||||
                if (m_colorChooserMenuItem != null)
 | 
			
		||||
@@ -506,42 +496,27 @@ namespace CalculatorApp
 | 
			
		||||
 | 
			
		||||
            private void OnCutClicked(object sender, RoutedEventArgs e)
 | 
			
		||||
            {
 | 
			
		||||
                if (m_richEditBox != null)
 | 
			
		||||
                {
 | 
			
		||||
                    m_richEditBox.TextDocument.Selection.Cut();
 | 
			
		||||
                }
 | 
			
		||||
                m_richEditBox?.TextDocument.Selection.Cut();
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            private void OnCopyClicked(object sender, RoutedEventArgs e)
 | 
			
		||||
            {
 | 
			
		||||
                if (m_richEditBox != null)
 | 
			
		||||
                {
 | 
			
		||||
                    m_richEditBox.TextDocument.Selection.Copy();
 | 
			
		||||
                }
 | 
			
		||||
                m_richEditBox?.TextDocument.Selection.Copy();
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            private void OnPasteClicked(object sender, RoutedEventArgs e)
 | 
			
		||||
            {
 | 
			
		||||
                if (m_richEditBox != null)
 | 
			
		||||
                {
 | 
			
		||||
                    m_richEditBox.TextDocument.Selection.Paste(0);
 | 
			
		||||
                }
 | 
			
		||||
                m_richEditBox?.TextDocument.Selection.Paste(0);
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            private void OnUndoClicked(object sender, RoutedEventArgs e)
 | 
			
		||||
            {
 | 
			
		||||
                if (m_richEditBox != null)
 | 
			
		||||
                {
 | 
			
		||||
                    m_richEditBox.TextDocument.Undo();
 | 
			
		||||
                }
 | 
			
		||||
                m_richEditBox?.TextDocument.Undo();
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            private void OnSelectAllClicked(object sender, RoutedEventArgs e)
 | 
			
		||||
            {
 | 
			
		||||
                if (m_richEditBox != null)
 | 
			
		||||
                {
 | 
			
		||||
                    m_richEditBox.TextDocument.Selection.SetRange(0, m_richEditBox.TextDocument.Selection.EndPosition);
 | 
			
		||||
                }
 | 
			
		||||
                m_richEditBox?.TextDocument.Selection.SetRange(0, m_richEditBox.TextDocument.Selection.EndPosition);
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            private void OnColorFlyoutOpened(object sender, object e)
 | 
			
		||||
 
 | 
			
		||||
@@ -2,6 +2,7 @@
 | 
			
		||||
// Licensed under the MIT License.
 | 
			
		||||
 | 
			
		||||
using CalculatorApp.ViewModel.Common;
 | 
			
		||||
 | 
			
		||||
using Windows.System;
 | 
			
		||||
using Windows.UI.Xaml;
 | 
			
		||||
using Windows.UI.Xaml.Input;
 | 
			
		||||
@@ -14,8 +15,8 @@ namespace CalculatorApp
 | 
			
		||||
        {
 | 
			
		||||
            public NumbersAndOperatorsEnum ButtonId
 | 
			
		||||
            {
 | 
			
		||||
                get { return (NumbersAndOperatorsEnum)GetValue(ButtonIdProperty); }
 | 
			
		||||
                set { SetValue(ButtonIdProperty, value); }
 | 
			
		||||
                get => (NumbersAndOperatorsEnum)GetValue(ButtonIdProperty);
 | 
			
		||||
                set => SetValue(ButtonIdProperty, value);
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            // Using a DependencyProperty as the backing store for ButtonId.  This enables animation, styling, binding, etc...
 | 
			
		||||
@@ -24,8 +25,8 @@ namespace CalculatorApp
 | 
			
		||||
 | 
			
		||||
            public Windows.UI.Xaml.Media.Brush HoverBackground
 | 
			
		||||
            {
 | 
			
		||||
                get { return (Windows.UI.Xaml.Media.Brush)GetValue(HoverBackgroundProperty); }
 | 
			
		||||
                set { SetValue(HoverBackgroundProperty, value); }
 | 
			
		||||
                get => (Windows.UI.Xaml.Media.Brush)GetValue(HoverBackgroundProperty);
 | 
			
		||||
                set => SetValue(HoverBackgroundProperty, value);
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            // Using a DependencyProperty as the backing store for HoverBackground.  This enables animation, styling, binding, etc...
 | 
			
		||||
@@ -34,8 +35,8 @@ namespace CalculatorApp
 | 
			
		||||
 | 
			
		||||
            public Windows.UI.Xaml.Media.Brush HoverForeground
 | 
			
		||||
            {
 | 
			
		||||
                get { return (Windows.UI.Xaml.Media.Brush)GetValue(HoverForegroundProperty); }
 | 
			
		||||
                set { SetValue(HoverForegroundProperty, value); }
 | 
			
		||||
                get => (Windows.UI.Xaml.Media.Brush)GetValue(HoverForegroundProperty);
 | 
			
		||||
                set => SetValue(HoverForegroundProperty, value);
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            // Using a DependencyProperty as the backing store for HoverForeground.  This enables animation, styling, binding, etc...
 | 
			
		||||
@@ -44,8 +45,8 @@ namespace CalculatorApp
 | 
			
		||||
 | 
			
		||||
            public Windows.UI.Xaml.Media.Brush PressBackground
 | 
			
		||||
            {
 | 
			
		||||
                get { return (Windows.UI.Xaml.Media.Brush)GetValue(PressBackgroundProperty); }
 | 
			
		||||
                set { SetValue(PressBackgroundProperty, value); }
 | 
			
		||||
                get => (Windows.UI.Xaml.Media.Brush)GetValue(PressBackgroundProperty);
 | 
			
		||||
                set => SetValue(PressBackgroundProperty, value);
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            // Using a DependencyProperty as the backing store for PressBackground.  This enables animation, styling, binding, etc...
 | 
			
		||||
@@ -54,8 +55,8 @@ namespace CalculatorApp
 | 
			
		||||
 | 
			
		||||
            public Windows.UI.Xaml.Media.Brush PressForeground
 | 
			
		||||
            {
 | 
			
		||||
                get { return (Windows.UI.Xaml.Media.Brush)GetValue(PressForegroundProperty); }
 | 
			
		||||
                set { SetValue(PressForegroundProperty, value); }
 | 
			
		||||
                get => (Windows.UI.Xaml.Media.Brush)GetValue(PressForegroundProperty);
 | 
			
		||||
                set => SetValue(PressForegroundProperty, value);
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            // Using a DependencyProperty as the backing store for PressForeground.  This enables animation, styling, binding, etc...
 | 
			
		||||
 
 | 
			
		||||
@@ -7,6 +7,7 @@
 | 
			
		||||
//
 | 
			
		||||
 | 
			
		||||
using System;
 | 
			
		||||
 | 
			
		||||
using Windows.Foundation;
 | 
			
		||||
using Windows.UI.Xaml.Automation;
 | 
			
		||||
using Windows.UI.Xaml.Automation.Peers;
 | 
			
		||||
 
 | 
			
		||||
@@ -3,12 +3,13 @@
 | 
			
		||||
 | 
			
		||||
using System;
 | 
			
		||||
using System.Runtime.InteropServices;
 | 
			
		||||
 | 
			
		||||
using Windows.ApplicationModel;
 | 
			
		||||
using Windows.System;
 | 
			
		||||
using Windows.UI.Core;
 | 
			
		||||
using Windows.UI.Text;
 | 
			
		||||
using Windows.UI.Xaml;
 | 
			
		||||
using Windows.UI.Xaml.Input;
 | 
			
		||||
using Windows.ApplicationModel;
 | 
			
		||||
 | 
			
		||||
namespace CalculatorApp
 | 
			
		||||
{
 | 
			
		||||
@@ -16,14 +17,14 @@ namespace CalculatorApp
 | 
			
		||||
    {
 | 
			
		||||
        namespace Windows_2004_Prerelease
 | 
			
		||||
        {
 | 
			
		||||
            public enum RichEditMathMode : int
 | 
			
		||||
            public enum RichEditMathMode
 | 
			
		||||
            {
 | 
			
		||||
                NoMath,
 | 
			
		||||
                MathOnly
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            [Guid("619c20f2-cb3b-4521-981f-2865b1b93f04")]
 | 
			
		||||
            interface ITextDocument4
 | 
			
		||||
            internal interface ITextDocument4
 | 
			
		||||
            {
 | 
			
		||||
                int SetMath(string value);
 | 
			
		||||
                int GetMath(out string value);
 | 
			
		||||
@@ -40,44 +41,29 @@ namespace CalculatorApp
 | 
			
		||||
 | 
			
		||||
        public sealed class MathRichEditBoxSubmission
 | 
			
		||||
        {
 | 
			
		||||
            public bool HasTextChanged
 | 
			
		||||
            {
 | 
			
		||||
                get => m_HasTextChanged;
 | 
			
		||||
            }
 | 
			
		||||
            public bool HasTextChanged { get; }
 | 
			
		||||
 | 
			
		||||
            public EquationSubmissionSource Source
 | 
			
		||||
            {
 | 
			
		||||
                get => m_Source;
 | 
			
		||||
            }
 | 
			
		||||
            public EquationSubmissionSource Source { get; }
 | 
			
		||||
 | 
			
		||||
            public MathRichEditBoxSubmission(bool hasTextChanged, EquationSubmissionSource source)
 | 
			
		||||
            {
 | 
			
		||||
                m_HasTextChanged = hasTextChanged;
 | 
			
		||||
                m_Source = source;
 | 
			
		||||
                HasTextChanged = hasTextChanged;
 | 
			
		||||
                Source = source;
 | 
			
		||||
            }
 | 
			
		||||
            private bool m_HasTextChanged;
 | 
			
		||||
            private EquationSubmissionSource m_Source;
 | 
			
		||||
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        public sealed class MathRichEditBoxFormatRequest
 | 
			
		||||
        {
 | 
			
		||||
            public string OriginalText
 | 
			
		||||
            {
 | 
			
		||||
                get => m_OriginalText;
 | 
			
		||||
            }
 | 
			
		||||
            public string OriginalText { get; }
 | 
			
		||||
 | 
			
		||||
            public string FormattedText
 | 
			
		||||
            {
 | 
			
		||||
                get => m_FormattedText;
 | 
			
		||||
                set => m_FormattedText = value;
 | 
			
		||||
            }
 | 
			
		||||
            public string FormattedText { get; set; }
 | 
			
		||||
 | 
			
		||||
            public MathRichEditBoxFormatRequest(string originalText)
 | 
			
		||||
            {
 | 
			
		||||
                m_OriginalText = originalText;
 | 
			
		||||
                OriginalText = originalText;
 | 
			
		||||
            }
 | 
			
		||||
            private string m_OriginalText;
 | 
			
		||||
            private string m_FormattedText;
 | 
			
		||||
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        public sealed class MathRichEditBox : Windows.UI.Xaml.Controls.RichEditBox
 | 
			
		||||
@@ -86,14 +72,14 @@ namespace CalculatorApp
 | 
			
		||||
            {
 | 
			
		||||
                string packageName = Package.Current.Id.Name;
 | 
			
		||||
 | 
			
		||||
                if(packageName == "Microsoft.WindowsCalculator.Dev")
 | 
			
		||||
                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")
 | 
			
		||||
                else if (packageName == "Microsoft.WindowsCalculator")
 | 
			
		||||
                {
 | 
			
		||||
                    LimitedAccessFeatures.TryUnlockFeature(
 | 
			
		||||
                                "com.microsoft.windows.richeditmath",
 | 
			
		||||
@@ -108,8 +94,8 @@ namespace CalculatorApp
 | 
			
		||||
 | 
			
		||||
            public string MathText
 | 
			
		||||
            {
 | 
			
		||||
                get { return (string)GetValue(MathTextProperty); }
 | 
			
		||||
                set { SetValue(MathTextProperty, value); }
 | 
			
		||||
                get => (string)GetValue(MathTextProperty);
 | 
			
		||||
                set => SetValue(MathTextProperty, value);
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            // Using a DependencyProperty as the backing store for MathText.  This enables animation, styling, binding, etc...
 | 
			
		||||
 
 | 
			
		||||
@@ -1,19 +1,8 @@
 | 
			
		||||
// Copyright (c) Microsoft Corporation. All rights reserved.
 | 
			
		||||
// Licensed under the MIT License.
 | 
			
		||||
 | 
			
		||||
using System;
 | 
			
		||||
using System.Collections.Generic;
 | 
			
		||||
using System.Threading.Tasks;
 | 
			
		||||
using System.Diagnostics;
 | 
			
		||||
 | 
			
		||||
using Windows.Foundation;
 | 
			
		||||
using Windows.UI.ViewManagement;
 | 
			
		||||
using Windows.UI.Xaml;
 | 
			
		||||
using Windows.UI.Xaml.Controls;
 | 
			
		||||
using Windows.UI.Xaml.Media;
 | 
			
		||||
using CalculatorApp;
 | 
			
		||||
using CalculatorApp.Common;
 | 
			
		||||
using CalculatorApp.Controls;
 | 
			
		||||
 | 
			
		||||
namespace CalculatorApp
 | 
			
		||||
{
 | 
			
		||||
@@ -27,8 +16,8 @@ namespace CalculatorApp
 | 
			
		||||
 | 
			
		||||
            public string Text
 | 
			
		||||
            {
 | 
			
		||||
                get { return (string)GetValue(TextProperty); }
 | 
			
		||||
                set { SetValue(TextProperty, value); }
 | 
			
		||||
                get => (string)GetValue(TextProperty);
 | 
			
		||||
                set => SetValue(TextProperty, value);
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            // Using a DependencyProperty as the backing store for Text.  This enables animation, styling, binding, etc...
 | 
			
		||||
@@ -37,8 +26,8 @@ namespace CalculatorApp
 | 
			
		||||
 | 
			
		||||
            public string Glyph
 | 
			
		||||
            {
 | 
			
		||||
                get { return (string)GetValue(GlyphProperty); }
 | 
			
		||||
                set { SetValue(GlyphProperty, value); }
 | 
			
		||||
                get => (string)GetValue(GlyphProperty);
 | 
			
		||||
                set => SetValue(GlyphProperty, value);
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            // Using a DependencyProperty as the backing store for Glyph.  This enables animation, styling, binding, etc...
 | 
			
		||||
@@ -47,8 +36,8 @@ namespace CalculatorApp
 | 
			
		||||
 | 
			
		||||
            public double GlyphFontSize
 | 
			
		||||
            {
 | 
			
		||||
                get { return (double)GetValue(GlyphFontSizeProperty); }
 | 
			
		||||
                set { SetValue(GlyphFontSizeProperty, value); }
 | 
			
		||||
                get => (double)GetValue(GlyphFontSizeProperty);
 | 
			
		||||
                set => SetValue(GlyphFontSizeProperty, value);
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            // Using a DependencyProperty as the backing store for GlyphFontSize.  This enables animation, styling, binding, etc...
 | 
			
		||||
@@ -57,8 +46,8 @@ namespace CalculatorApp
 | 
			
		||||
 | 
			
		||||
            public double ChevronFontSize
 | 
			
		||||
            {
 | 
			
		||||
                get { return (double)GetValue(ChevronFontSizeProperty); }
 | 
			
		||||
                set { SetValue(ChevronFontSizeProperty, value); }
 | 
			
		||||
                get => (double)GetValue(ChevronFontSizeProperty);
 | 
			
		||||
                set => SetValue(ChevronFontSizeProperty, value);
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            // Using a DependencyProperty as the backing store for ChevronFontSize.  This enables animation, styling, binding, etc...
 | 
			
		||||
@@ -67,8 +56,8 @@ namespace CalculatorApp
 | 
			
		||||
 | 
			
		||||
            public Flyout FlyoutMenu
 | 
			
		||||
            {
 | 
			
		||||
                get { return (Flyout)GetValue(FlyoutMenuProperty); }
 | 
			
		||||
                set { SetValue(FlyoutMenuProperty, value); }
 | 
			
		||||
                get => (Flyout)GetValue(FlyoutMenuProperty);
 | 
			
		||||
                set => SetValue(FlyoutMenuProperty, value);
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            // Using a DependencyProperty as the backing store for FlyoutMenu.  This enables animation, styling, binding, etc...
 | 
			
		||||
 
 | 
			
		||||
@@ -1,18 +1,10 @@
 | 
			
		||||
// Copyright (c) Microsoft Corporation. All rights reserved.
 | 
			
		||||
// Licensed under the MIT License.
 | 
			
		||||
 | 
			
		||||
using System;
 | 
			
		||||
using System.Collections.Generic;
 | 
			
		||||
using System.Threading.Tasks;
 | 
			
		||||
using System.Diagnostics;
 | 
			
		||||
using CalculatorApp;
 | 
			
		||||
using CalculatorApp.Controls;
 | 
			
		||||
 | 
			
		||||
using Windows.Foundation;
 | 
			
		||||
using Windows.Devices.Input;
 | 
			
		||||
using Windows.UI.Xaml;
 | 
			
		||||
using Windows.UI.Xaml.Input;
 | 
			
		||||
using Windows.UI.Xaml.Controls;
 | 
			
		||||
using Windows.UI.Xaml.Input;
 | 
			
		||||
 | 
			
		||||
namespace CalculatorApp
 | 
			
		||||
{
 | 
			
		||||
@@ -151,7 +143,7 @@ namespace CalculatorApp
 | 
			
		||||
                m_scrollViewer.ChangeView(offset, null, null);
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            private double scrollRatio = 0.7;
 | 
			
		||||
            private readonly double scrollRatio = 0.7;
 | 
			
		||||
 | 
			
		||||
            private bool m_isPointerEntered;
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -1,33 +1,17 @@
 | 
			
		||||
// Copyright (c) Microsoft Corporation. All rights reserved.
 | 
			
		||||
// Licensed under the MIT License.
 | 
			
		||||
 | 
			
		||||
using System;
 | 
			
		||||
using System.Collections.Generic;
 | 
			
		||||
using System.Threading.Tasks;
 | 
			
		||||
using System.Diagnostics;
 | 
			
		||||
using CalculatorApp;
 | 
			
		||||
using CalculatorApp.Common;
 | 
			
		||||
using CalculatorApp.Controls;
 | 
			
		||||
 | 
			
		||||
using Windows.Foundation;
 | 
			
		||||
using Windows.Foundation.Collections;
 | 
			
		||||
using Windows.Devices.Input;
 | 
			
		||||
using Windows.UI.Xaml;
 | 
			
		||||
using Windows.UI.Xaml.Automation;
 | 
			
		||||
using Windows.UI.Xaml.Automation.Peers;
 | 
			
		||||
using Windows.UI.Xaml.Controls;
 | 
			
		||||
using Windows.UI.Xaml.Controls.Primitives;
 | 
			
		||||
using Windows.UI.Xaml.Data;
 | 
			
		||||
using Windows.UI.Xaml.Input;
 | 
			
		||||
using Windows.UI.Xaml.Media;
 | 
			
		||||
using Windows.UI.Xaml.Navigation;
 | 
			
		||||
using Windows.ApplicationModel.Store;
 | 
			
		||||
 | 
			
		||||
namespace CalculatorApp
 | 
			
		||||
{
 | 
			
		||||
    namespace Controls
 | 
			
		||||
    {
 | 
			
		||||
        public enum OverflowButtonPlacement : int
 | 
			
		||||
        public enum OverflowButtonPlacement
 | 
			
		||||
        {
 | 
			
		||||
            InLine,
 | 
			
		||||
            Above
 | 
			
		||||
@@ -47,8 +31,8 @@ namespace CalculatorApp
 | 
			
		||||
 | 
			
		||||
            public bool TokensUpdated
 | 
			
		||||
            {
 | 
			
		||||
                get { return (bool)GetValue(TokensUpdatedProperty); }
 | 
			
		||||
                set { SetValue(TokensUpdatedProperty, value); }
 | 
			
		||||
                get => (bool)GetValue(TokensUpdatedProperty);
 | 
			
		||||
                set => SetValue(TokensUpdatedProperty, value);
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            // Using a DependencyProperty as the backing store for TokensUpdated.  This enables animation, styling, binding, etc...
 | 
			
		||||
@@ -61,8 +45,8 @@ namespace CalculatorApp
 | 
			
		||||
 | 
			
		||||
            public OverflowButtonPlacement ScrollButtonsPlacement
 | 
			
		||||
            {
 | 
			
		||||
                get { return (OverflowButtonPlacement)GetValue(ScrollButtonsPlacementProperty); }
 | 
			
		||||
                set { SetValue(ScrollButtonsPlacementProperty, value); }
 | 
			
		||||
                get => (OverflowButtonPlacement)GetValue(ScrollButtonsPlacementProperty);
 | 
			
		||||
                set => SetValue(ScrollButtonsPlacementProperty, value);
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            // Using a DependencyProperty as the backing store for ScrollButtonsPlacement.  This enables animation, styling, binding, etc...
 | 
			
		||||
@@ -75,8 +59,8 @@ namespace CalculatorApp
 | 
			
		||||
 | 
			
		||||
            public bool IsActive
 | 
			
		||||
            {
 | 
			
		||||
                get { return (bool)GetValue(IsActiveProperty); }
 | 
			
		||||
                set { SetValue(IsActiveProperty, value); }
 | 
			
		||||
                get => (bool)GetValue(IsActiveProperty);
 | 
			
		||||
                set => SetValue(IsActiveProperty, value);
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            // Using a DependencyProperty as the backing store for IsActive.  This enables animation, styling, binding, etc...
 | 
			
		||||
@@ -85,8 +69,8 @@ namespace CalculatorApp
 | 
			
		||||
 | 
			
		||||
            public Windows.UI.Xaml.Style TextStyle
 | 
			
		||||
            {
 | 
			
		||||
                get { return (Style)GetValue(TextStyleProperty); }
 | 
			
		||||
                set { SetValue(TextStyleProperty, value); }
 | 
			
		||||
                get => (Style)GetValue(TextStyleProperty);
 | 
			
		||||
                set => SetValue(TextStyleProperty, value);
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            // Using a DependencyProperty as the backing store for TextStyle.  This enables animation, styling, binding, etc...
 | 
			
		||||
@@ -95,8 +79,8 @@ namespace CalculatorApp
 | 
			
		||||
 | 
			
		||||
            public double ScrollButtonsWidth
 | 
			
		||||
            {
 | 
			
		||||
                get { return (double)GetValue(ScrollButtonsWidthProperty); }
 | 
			
		||||
                set { SetValue(ScrollButtonsWidthProperty, value); }
 | 
			
		||||
                get => (double)GetValue(ScrollButtonsWidthProperty);
 | 
			
		||||
                set => SetValue(ScrollButtonsWidthProperty, value);
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            // Using a DependencyProperty as the backing store for ScrollButtonsWidth.  This enables animation, styling, binding, etc...
 | 
			
		||||
@@ -105,8 +89,8 @@ namespace CalculatorApp
 | 
			
		||||
 | 
			
		||||
            public double ScrollButtonsFontSize
 | 
			
		||||
            {
 | 
			
		||||
                get { return (double)GetValue(ScrollButtonsFontSizeProperty); }
 | 
			
		||||
                set { SetValue(ScrollButtonsFontSizeProperty, value); }
 | 
			
		||||
                get => (double)GetValue(ScrollButtonsFontSizeProperty);
 | 
			
		||||
                set => SetValue(ScrollButtonsFontSizeProperty, value);
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            // Using a DependencyProperty as the backing store for ScrollButtonsFontSize.  This enables animation, styling, binding, etc...
 | 
			
		||||
@@ -279,14 +263,7 @@ namespace CalculatorApp
 | 
			
		||||
 | 
			
		||||
            private void UpdateVisualState()
 | 
			
		||||
            {
 | 
			
		||||
                if (IsActive)
 | 
			
		||||
                {
 | 
			
		||||
                    VisualStateManager.GoToState(this, "Active", true);
 | 
			
		||||
                }
 | 
			
		||||
                else
 | 
			
		||||
                {
 | 
			
		||||
                    VisualStateManager.GoToState(this, "Normal", true);
 | 
			
		||||
                }
 | 
			
		||||
                VisualStateManager.GoToState(this, IsActive ? "Active" : "Normal", true);
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            private void UpdateAllState()
 | 
			
		||||
 
 | 
			
		||||
@@ -1,12 +1,9 @@
 | 
			
		||||
// Copyright (c) Microsoft Corporation. All rights reserved.
 | 
			
		||||
// Licensed under the MIT License.
 | 
			
		||||
 | 
			
		||||
using System;
 | 
			
		||||
using System.Collections.Generic;
 | 
			
		||||
using System.Threading.Tasks;
 | 
			
		||||
using System.Diagnostics;
 | 
			
		||||
 | 
			
		||||
using Windows.UI.Xaml.Automation.Peers;
 | 
			
		||||
using Windows.Foundation.Collections;
 | 
			
		||||
 | 
			
		||||
namespace CalculatorApp
 | 
			
		||||
{
 | 
			
		||||
 
 | 
			
		||||
@@ -1,4 +1,4 @@
 | 
			
		||||
// Copyright (c) Microsoft Corporation. All rights reserved.
 | 
			
		||||
// Copyright (c) Microsoft Corporation. All rights reserved.
 | 
			
		||||
// Licensed under the MIT License.
 | 
			
		||||
 | 
			
		||||
using CalculatorApp.ViewModel.Common;
 | 
			
		||||
@@ -14,7 +14,7 @@ namespace CalculatorApp
 | 
			
		||||
 | 
			
		||||
            internal string GetRawDisplayValue()
 | 
			
		||||
            {
 | 
			
		||||
                string radixContent = Content.ToString();
 | 
			
		||||
                string radixContent = Content?.ToString();
 | 
			
		||||
                return LocalizationSettings.GetInstance().RemoveGroupSeparators(radixContent);
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
 
 | 
			
		||||
@@ -1,22 +1,14 @@
 | 
			
		||||
// Copyright (c) Microsoft Corporation. All rights reserved.
 | 
			
		||||
// Licensed under the MIT License.
 | 
			
		||||
 | 
			
		||||
using System;
 | 
			
		||||
using System.Collections.Generic;
 | 
			
		||||
using System.Threading.Tasks;
 | 
			
		||||
using System.Diagnostics;
 | 
			
		||||
using CalculatorApp;
 | 
			
		||||
using CalculatorApp.Controls;
 | 
			
		||||
using CalculatorApp.ViewModel;
 | 
			
		||||
using Windows.System;
 | 
			
		||||
 | 
			
		||||
using System.Collections.Generic;
 | 
			
		||||
 | 
			
		||||
using Windows.UI.Xaml;
 | 
			
		||||
using Windows.UI.Xaml.Input;
 | 
			
		||||
using Windows.UI.Xaml.Controls;
 | 
			
		||||
using Windows.UI.Xaml.Data;
 | 
			
		||||
using Windows.UI.Xaml.Automation;
 | 
			
		||||
using Windows.UI.Xaml.Automation.Peers;
 | 
			
		||||
 | 
			
		||||
using Windows.Foundation.Collections;
 | 
			
		||||
using Windows.UI.Xaml.Controls;
 | 
			
		||||
 | 
			
		||||
namespace CalculatorApp
 | 
			
		||||
{
 | 
			
		||||
@@ -37,8 +29,7 @@ namespace CalculatorApp
 | 
			
		||||
            {
 | 
			
		||||
                base.PrepareContainerForItemOverride(element, item);
 | 
			
		||||
 | 
			
		||||
                var supplementaryResult = item as SupplementaryResult;
 | 
			
		||||
                if (supplementaryResult != null)
 | 
			
		||||
                if (item is SupplementaryResult supplementaryResult)
 | 
			
		||||
                {
 | 
			
		||||
                    AutomationProperties.SetName(element, supplementaryResult.GetLocalizedAutomationName());
 | 
			
		||||
                }
 | 
			
		||||
@@ -57,7 +48,7 @@ namespace CalculatorApp
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        sealed class SupplementaryContentPresenterAP : FrameworkElementAutomationPeer
 | 
			
		||||
        internal sealed class SupplementaryContentPresenterAP : FrameworkElementAutomationPeer
 | 
			
		||||
        {
 | 
			
		||||
            protected override AutomationControlType GetAutomationControlTypeCore()
 | 
			
		||||
            {
 | 
			
		||||
 
 | 
			
		||||
@@ -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;
 | 
			
		||||
@@ -15,15 +15,13 @@ namespace CalculatorApp
 | 
			
		||||
        {
 | 
			
		||||
            public object Convert(object value, Type targetType, object parameter, string language)
 | 
			
		||||
            {
 | 
			
		||||
                var boxedBool = value as bool?;
 | 
			
		||||
                var boolValue = (boxedBool != null && boxedBool.Value);
 | 
			
		||||
                var boolValue = (value is bool boxedBool && boxedBool);
 | 
			
		||||
                return !boolValue;
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            public object ConvertBack(object value, Type targetType, object parameter, string language)
 | 
			
		||||
            {
 | 
			
		||||
                var boxedBool = (value as bool?);
 | 
			
		||||
                var boolValue = (boxedBool != null && boxedBool.Value);
 | 
			
		||||
                var boolValue = (value is bool boxedBool && boxedBool);
 | 
			
		||||
                return !boolValue;
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
 
 | 
			
		||||
@@ -1,7 +1,8 @@
 | 
			
		||||
// Copyright (c) Microsoft Corporation. All rights reserved.
 | 
			
		||||
// Copyright (c) Microsoft Corporation. All rights reserved.
 | 
			
		||||
// Licensed under the MIT License.
 | 
			
		||||
 | 
			
		||||
using System;
 | 
			
		||||
 | 
			
		||||
using Windows.UI.Xaml;
 | 
			
		||||
 | 
			
		||||
namespace CalculatorApp
 | 
			
		||||
@@ -21,15 +22,13 @@ namespace CalculatorApp
 | 
			
		||||
 | 
			
		||||
            public object Convert(object value, Type targetType, object parameter, string language)
 | 
			
		||||
            {
 | 
			
		||||
                var boxedBool = (value as bool?);
 | 
			
		||||
                var boolValue = (boxedBool != null && boxedBool.Value);
 | 
			
		||||
                var boolValue = (value is bool boxedBool && boxedBool);
 | 
			
		||||
                return BooleanToVisibilityConverter.Convert(boolValue);
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            public object ConvertBack(object value, Type targetType, object parameter, string language)
 | 
			
		||||
            {
 | 
			
		||||
                var visibility = (value as Visibility?);
 | 
			
		||||
                return (visibility != null && visibility.Value == Visibility.Visible);
 | 
			
		||||
                return (value is Visibility visibility && visibility == Visibility.Visible);
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
@@ -41,15 +40,13 @@ namespace CalculatorApp
 | 
			
		||||
        {
 | 
			
		||||
            public object Convert(object value, Type targetType, object parameter, string language)
 | 
			
		||||
            {
 | 
			
		||||
                var boxedBool = (value as bool?);
 | 
			
		||||
                var boolValue = (boxedBool != null && boxedBool.Value);
 | 
			
		||||
                var boolValue = (value is bool boxedBool && boxedBool);
 | 
			
		||||
                return BooleanToVisibilityConverter.Convert(!boolValue);
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            public object ConvertBack(object value, Type targetType, object parameter, string language)
 | 
			
		||||
            {
 | 
			
		||||
                var visibility = (value as Visibility?);
 | 
			
		||||
                return (visibility != null && visibility.Value != Visibility.Visible);
 | 
			
		||||
                return (value is Visibility visibility && visibility != Visibility.Visible);
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 
 | 
			
		||||
@@ -2,7 +2,9 @@
 | 
			
		||||
// Licensed under the MIT License.
 | 
			
		||||
 | 
			
		||||
using CalculatorApp.ViewModel.Common;
 | 
			
		||||
 | 
			
		||||
using System;
 | 
			
		||||
 | 
			
		||||
using Windows.UI.Xaml;
 | 
			
		||||
 | 
			
		||||
namespace CalculatorApp
 | 
			
		||||
@@ -22,61 +24,24 @@ namespace CalculatorApp
 | 
			
		||||
                    switch (type)
 | 
			
		||||
                    {
 | 
			
		||||
                        case TokenType.Operator:
 | 
			
		||||
                            return m_operatorTemplate;
 | 
			
		||||
                            return OperatorTemplate;
 | 
			
		||||
                        case TokenType.Operand:
 | 
			
		||||
                            return m_operandTemplate;
 | 
			
		||||
                            return OperandTemplate;
 | 
			
		||||
                        case TokenType.Separator:
 | 
			
		||||
                            return m_separatorTemplate;
 | 
			
		||||
                            return SeparatorTemplate;
 | 
			
		||||
                        default:
 | 
			
		||||
                            throw new Exception("Invalid token type");
 | 
			
		||||
                    }
 | 
			
		||||
                }
 | 
			
		||||
 | 
			
		||||
                return m_separatorTemplate;
 | 
			
		||||
                return SeparatorTemplate;
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            public Windows.UI.Xaml.DataTemplate OperatorTemplate
 | 
			
		||||
            {
 | 
			
		||||
                get
 | 
			
		||||
                {
 | 
			
		||||
                    return m_operatorTemplate;
 | 
			
		||||
                }
 | 
			
		||||
            public Windows.UI.Xaml.DataTemplate OperatorTemplate { get; set; }
 | 
			
		||||
 | 
			
		||||
                set
 | 
			
		||||
                {
 | 
			
		||||
                    m_operatorTemplate = value;
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
            public Windows.UI.Xaml.DataTemplate OperandTemplate { get; set; }
 | 
			
		||||
 | 
			
		||||
            public Windows.UI.Xaml.DataTemplate OperandTemplate
 | 
			
		||||
            {
 | 
			
		||||
                get
 | 
			
		||||
                {
 | 
			
		||||
                    return m_operandTemplate;
 | 
			
		||||
                }
 | 
			
		||||
 | 
			
		||||
                set
 | 
			
		||||
                {
 | 
			
		||||
                    m_operandTemplate = value;
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            public Windows.UI.Xaml.DataTemplate SeparatorTemplate
 | 
			
		||||
            {
 | 
			
		||||
                get
 | 
			
		||||
                {
 | 
			
		||||
                    return m_separatorTemplate;
 | 
			
		||||
                }
 | 
			
		||||
 | 
			
		||||
                set
 | 
			
		||||
                {
 | 
			
		||||
                    m_separatorTemplate = value;
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            private Windows.UI.Xaml.DataTemplate m_operatorTemplate;
 | 
			
		||||
            private Windows.UI.Xaml.DataTemplate m_operandTemplate;
 | 
			
		||||
            private Windows.UI.Xaml.DataTemplate m_separatorTemplate;
 | 
			
		||||
            public Windows.UI.Xaml.DataTemplate SeparatorTemplate { get; set; }
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -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;
 | 
			
		||||
@@ -12,8 +12,7 @@ namespace CalculatorApp
 | 
			
		||||
        {
 | 
			
		||||
            public object Convert(object value, Type targetType, object parameter, string language)
 | 
			
		||||
            {
 | 
			
		||||
                var items = (value as int?);
 | 
			
		||||
                var boolValue = (items != null && (items.Value == 0));
 | 
			
		||||
                var boolValue = (value is int items && (items == 0));
 | 
			
		||||
                return BooleanToVisibilityConverter.Convert(boolValue);
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
@@ -27,8 +26,7 @@ namespace CalculatorApp
 | 
			
		||||
        {
 | 
			
		||||
            public object Convert(object value, Type targetType, object parameter, string language)
 | 
			
		||||
            {
 | 
			
		||||
                var items = (value as int?);
 | 
			
		||||
                var boolValue = (items != null && (items.Value > 0));
 | 
			
		||||
                var boolValue = (value is int items && (items > 0));
 | 
			
		||||
                return BooleanToVisibilityConverter.Convert(boolValue);
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -2,6 +2,7 @@
 | 
			
		||||
// Licensed under the MIT License.
 | 
			
		||||
 | 
			
		||||
using CalculatorApp.ViewModel.Common;
 | 
			
		||||
 | 
			
		||||
using System;
 | 
			
		||||
 | 
			
		||||
namespace CalculatorApp
 | 
			
		||||
 
 | 
			
		||||
@@ -1,7 +1,8 @@
 | 
			
		||||
// Copyright (c) Microsoft Corporation. All rights reserved.
 | 
			
		||||
// Copyright (c) Microsoft Corporation. All rights reserved.
 | 
			
		||||
// Licensed under the MIT License.
 | 
			
		||||
 | 
			
		||||
using System;
 | 
			
		||||
 | 
			
		||||
using Windows.UI.Xaml;
 | 
			
		||||
 | 
			
		||||
namespace CalculatorApp
 | 
			
		||||
@@ -16,8 +17,7 @@ namespace CalculatorApp
 | 
			
		||||
        {
 | 
			
		||||
            public object Convert(object value, Type targetType, object parameter, string language)
 | 
			
		||||
            {
 | 
			
		||||
                var boxedVisibility = (value as Visibility?);
 | 
			
		||||
                if (boxedVisibility != null && boxedVisibility.Value == Visibility.Collapsed)
 | 
			
		||||
                if (value is Visibility boxedVisibility && boxedVisibility == Visibility.Collapsed)
 | 
			
		||||
                {
 | 
			
		||||
                    return Visibility.Visible;
 | 
			
		||||
                }
 | 
			
		||||
 
 | 
			
		||||
@@ -1,5 +1,4 @@
 | 
			
		||||
using System.Reflection;
 | 
			
		||||
using System.Runtime.CompilerServices;
 | 
			
		||||
using System.Runtime.InteropServices;
 | 
			
		||||
 | 
			
		||||
// General Information about an assembly is controlled through the following 
 | 
			
		||||
 
 | 
			
		||||
@@ -2,7 +2,9 @@
 | 
			
		||||
// Licensed under the MIT License.
 | 
			
		||||
 | 
			
		||||
using CalculatorApp.ViewModel.Common;
 | 
			
		||||
 | 
			
		||||
using System;
 | 
			
		||||
 | 
			
		||||
using Windows.UI.Xaml;
 | 
			
		||||
using Windows.UI.Xaml.Controls;
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -1,12 +1,13 @@
 | 
			
		||||
// Copyright (c) Microsoft Corporation. All rights reserved.
 | 
			
		||||
// Licensed under the MIT License.
 | 
			
		||||
 | 
			
		||||
using System;
 | 
			
		||||
using CalculatorApp.ViewModel.Common;
 | 
			
		||||
 | 
			
		||||
using System;
 | 
			
		||||
 | 
			
		||||
namespace CalculatorApp.Utils
 | 
			
		||||
{
 | 
			
		||||
    static class DelegateCommandUtils
 | 
			
		||||
    internal static class DelegateCommandUtils
 | 
			
		||||
    {
 | 
			
		||||
        public static DelegateCommand MakeDelegateCommand<TTarget>(TTarget target, Action<TTarget, object> handler)
 | 
			
		||||
            where TTarget : class
 | 
			
		||||
@@ -14,8 +15,7 @@ namespace CalculatorApp.Utils
 | 
			
		||||
            WeakReference weakTarget = new WeakReference(target);
 | 
			
		||||
            return new DelegateCommand(param =>
 | 
			
		||||
            {
 | 
			
		||||
                TTarget thatTarget = weakTarget.Target as TTarget;
 | 
			
		||||
                if(null != thatTarget)
 | 
			
		||||
                if (weakTarget.Target is TTarget thatTarget)
 | 
			
		||||
                {
 | 
			
		||||
                    handler.Invoke(thatTarget, param);
 | 
			
		||||
                }
 | 
			
		||||
 
 | 
			
		||||
@@ -2,6 +2,7 @@
 | 
			
		||||
// Licensed under the MIT License.
 | 
			
		||||
 | 
			
		||||
using System;
 | 
			
		||||
 | 
			
		||||
using Windows.UI.Xaml;
 | 
			
		||||
 | 
			
		||||
namespace CalculatorApp
 | 
			
		||||
@@ -12,8 +13,10 @@ namespace CalculatorApp
 | 
			
		||||
 | 
			
		||||
        public DispatcherTimerDelayer(TimeSpan timeSpan)
 | 
			
		||||
        {
 | 
			
		||||
            m_timer = new DispatcherTimer();
 | 
			
		||||
            m_timer.Interval = timeSpan;
 | 
			
		||||
            m_timer = new DispatcherTimer
 | 
			
		||||
            {
 | 
			
		||||
                Interval = timeSpan
 | 
			
		||||
            };
 | 
			
		||||
            var interval = m_timer.Interval;
 | 
			
		||||
            m_timer.Tick += Timer_Tick;
 | 
			
		||||
        }
 | 
			
		||||
@@ -40,6 +43,6 @@ namespace CalculatorApp
 | 
			
		||||
            Action?.Invoke(this, null);
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        private DispatcherTimer m_timer;
 | 
			
		||||
        private readonly DispatcherTimer m_timer;
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -3,9 +3,8 @@
 | 
			
		||||
 | 
			
		||||
using System;
 | 
			
		||||
using System.Reflection;
 | 
			
		||||
 | 
			
		||||
using Windows.Storage;
 | 
			
		||||
using Windows.UI;
 | 
			
		||||
using Windows.UI.ViewManagement;
 | 
			
		||||
using Windows.UI.Xaml;
 | 
			
		||||
using Windows.UI.Xaml.Controls;
 | 
			
		||||
 | 
			
		||||
@@ -71,13 +70,13 @@ namespace CalculatorApp.Utils
 | 
			
		||||
        public static ThemeChangedCallbackToken RegisterAppThemeChangedCallback(DependencyPropertyChangedCallback callback)
 | 
			
		||||
        {
 | 
			
		||||
            Frame rootFrame = Window.Current.Content as Frame;
 | 
			
		||||
            long token = rootFrame.RegisterPropertyChangedCallback(Frame.RequestedThemeProperty, callback);
 | 
			
		||||
            return new ThemeChangedCallbackToken{ RootFrame = new WeakReference(rootFrame), Token = token };
 | 
			
		||||
            long token = rootFrame.RegisterPropertyChangedCallback(FrameworkElement.RequestedThemeProperty, callback);
 | 
			
		||||
            return new ThemeChangedCallbackToken { RootFrame = new WeakReference(rootFrame), Token = token };
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        public static void UnregisterAppThemeChangedCallback(ThemeChangedCallbackToken callbackToken)
 | 
			
		||||
        {
 | 
			
		||||
            if(callbackToken.RootFrame.IsAlive)
 | 
			
		||||
            if (callbackToken.RootFrame.IsAlive)
 | 
			
		||||
            {
 | 
			
		||||
                Frame rootFrame = callbackToken.RootFrame.Target as Frame;
 | 
			
		||||
                rootFrame.UnregisterPropertyChangedCallback(Frame.RequestedThemeProperty, callbackToken.Token);
 | 
			
		||||
 
 | 
			
		||||
@@ -2,6 +2,7 @@
 | 
			
		||||
// Licensed under the MIT License.
 | 
			
		||||
 | 
			
		||||
using System;
 | 
			
		||||
 | 
			
		||||
using Windows.UI.Xaml;
 | 
			
		||||
using Windows.UI.Xaml.Media;
 | 
			
		||||
 | 
			
		||||
@@ -14,7 +15,7 @@ namespace Calculator.Utils
 | 
			
		||||
    /// <summary>
 | 
			
		||||
    /// Defines a collection of extensions methods for UI.
 | 
			
		||||
    /// </summary>
 | 
			
		||||
    sealed class VisualTree
 | 
			
		||||
    internal static class VisualTree
 | 
			
		||||
    {
 | 
			
		||||
        /// <summary>
 | 
			
		||||
        /// Find descendant <see cref="Windows.UI.Xaml.FrameworkElement ^"/> control using its name.
 | 
			
		||||
@@ -29,14 +30,13 @@ namespace Calculator.Utils
 | 
			
		||||
                return null;
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            var frameworkElement = (element as FrameworkElement);
 | 
			
		||||
            if (frameworkElement != null && name.Equals(frameworkElement.Name))
 | 
			
		||||
            if (element is FrameworkElement frameworkElement && name.Equals(frameworkElement.Name))
 | 
			
		||||
            {
 | 
			
		||||
                return frameworkElement;
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            var childCount = VisualTreeHelper.GetChildrenCount(element);
 | 
			
		||||
            for (int i = 0; i < childCount; i++)
 | 
			
		||||
            for (var i = 0; i < childCount; i++)
 | 
			
		||||
            {
 | 
			
		||||
                var result = FindDescendantByName(VisualTreeHelper.GetChild(element, i), name);
 | 
			
		||||
                if (result != null)
 | 
			
		||||
@@ -52,7 +52,7 @@ namespace Calculator.Utils
 | 
			
		||||
        /// Find first descendant control of a specified type.
 | 
			
		||||
        /// </summary>
 | 
			
		||||
        /// <param name="element">Parent element.</param>
 | 
			
		||||
        /// <param name="type">Type of descendant.</param>
 | 
			
		||||
        /// <param name="typeName">Type of descendant.</param>
 | 
			
		||||
        /// <returns>Descendant control or null if not found.</returns>
 | 
			
		||||
        private static DependencyObject FindDescendant(DependencyObject element, Type typeName)
 | 
			
		||||
        {
 | 
			
		||||
@@ -98,8 +98,8 @@ namespace Calculator.Utils
 | 
			
		||||
            {
 | 
			
		||||
                return null;
 | 
			
		||||
            }
 | 
			
		||||
            var frameworkElement = (parent as FrameworkElement);
 | 
			
		||||
            if (frameworkElement != null && name.Equals(frameworkElement.Name))
 | 
			
		||||
 | 
			
		||||
            if (parent is FrameworkElement frameworkElement && name.Equals(frameworkElement.Name))
 | 
			
		||||
            {
 | 
			
		||||
                return frameworkElement;
 | 
			
		||||
            }
 | 
			
		||||
 
 | 
			
		||||
@@ -1,33 +1,21 @@
 | 
			
		||||
// Copyright (c) Microsoft Corporation. All rights reserved.
 | 
			
		||||
// Licensed under the MIT License.
 | 
			
		||||
 | 
			
		||||
using System;
 | 
			
		||||
using System.Collections.Generic;
 | 
			
		||||
using System.Threading.Tasks;
 | 
			
		||||
using System.Diagnostics;
 | 
			
		||||
using CalculatorApp;
 | 
			
		||||
using CalculatorApp.Converters;
 | 
			
		||||
using CalculatorApp.Controls;
 | 
			
		||||
using CalculatorApp.Utils;
 | 
			
		||||
using CalculatorApp.ViewModel;
 | 
			
		||||
using CalculatorApp.ViewModel.Common;
 | 
			
		||||
 | 
			
		||||
using System;
 | 
			
		||||
 | 
			
		||||
using Windows.Foundation;
 | 
			
		||||
using Windows.Foundation.Collections;
 | 
			
		||||
using Windows.Globalization.NumberFormatting;
 | 
			
		||||
using Windows.System;
 | 
			
		||||
using Windows.UI.Core;
 | 
			
		||||
using Windows.UI.ViewManagement;
 | 
			
		||||
using Windows.UI.Xaml;
 | 
			
		||||
using Windows.UI.Xaml.Automation;
 | 
			
		||||
using Windows.UI.Xaml.Automation.Peers;
 | 
			
		||||
using Windows.UI.Xaml.Controls;
 | 
			
		||||
using Windows.UI.Xaml.Controls.Primitives;
 | 
			
		||||
using Windows.UI.Xaml.Data;
 | 
			
		||||
using Windows.UI.Xaml.Input;
 | 
			
		||||
using Windows.UI.Xaml.Media;
 | 
			
		||||
using Windows.UI.Xaml.Navigation;
 | 
			
		||||
using Windows.System.Threading;
 | 
			
		||||
using Windows.UI.ViewManagement;
 | 
			
		||||
 | 
			
		||||
namespace CalculatorApp
 | 
			
		||||
{
 | 
			
		||||
@@ -74,15 +62,12 @@ namespace CalculatorApp
 | 
			
		||||
            this.SizeChanged += Calculator_SizeChanged;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        public CalculatorApp.ViewModel.StandardCalculatorViewModel Model
 | 
			
		||||
        {
 | 
			
		||||
            get => (StandardCalculatorViewModel)this.DataContext;
 | 
			
		||||
        }
 | 
			
		||||
        public CalculatorApp.ViewModel.StandardCalculatorViewModel Model => (StandardCalculatorViewModel)this.DataContext;
 | 
			
		||||
 | 
			
		||||
        public bool IsStandard
 | 
			
		||||
        {
 | 
			
		||||
            get { return (bool)GetValue(IsStandardProperty); }
 | 
			
		||||
            set { SetValue(IsStandardProperty, value); }
 | 
			
		||||
            get => (bool)GetValue(IsStandardProperty);
 | 
			
		||||
            set => SetValue(IsStandardProperty, value);
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        // Using a DependencyProperty as the backing store for IsStandard.  This enables animation, styling, binding, etc...
 | 
			
		||||
@@ -95,8 +80,8 @@ namespace CalculatorApp
 | 
			
		||||
 | 
			
		||||
        public bool IsScientific
 | 
			
		||||
        {
 | 
			
		||||
            get { return (bool)GetValue(IsScientificProperty); }
 | 
			
		||||
            set { SetValue(IsScientificProperty, value); }
 | 
			
		||||
            get => (bool)GetValue(IsScientificProperty);
 | 
			
		||||
            set => SetValue(IsScientificProperty, value);
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        // Using a DependencyProperty as the backing store for IsScientific.  This enables animation, styling, binding, etc...
 | 
			
		||||
@@ -109,8 +94,8 @@ namespace CalculatorApp
 | 
			
		||||
 | 
			
		||||
        public bool IsProgrammer
 | 
			
		||||
        {
 | 
			
		||||
            get { return (bool)GetValue(IsProgrammerProperty); }
 | 
			
		||||
            set { SetValue(IsProgrammerProperty, value); }
 | 
			
		||||
            get => (bool)GetValue(IsProgrammerProperty);
 | 
			
		||||
            set => SetValue(IsProgrammerProperty, value);
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        // Using a DependencyProperty as the backing store for IsProgrammer.  This enables animation, styling, binding, etc...
 | 
			
		||||
@@ -123,8 +108,8 @@ namespace CalculatorApp
 | 
			
		||||
 | 
			
		||||
        public bool IsAlwaysOnTop
 | 
			
		||||
        {
 | 
			
		||||
            get { return (bool)GetValue(IsAlwaysOnTopProperty); }
 | 
			
		||||
            set { SetValue(IsAlwaysOnTopProperty, value); }
 | 
			
		||||
            get => (bool)GetValue(IsAlwaysOnTopProperty);
 | 
			
		||||
            set => SetValue(IsAlwaysOnTopProperty, value);
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        // Using a DependencyProperty as the backing store for IsAlwaysOnTop.  This enables animation, styling, binding, etc...
 | 
			
		||||
@@ -152,7 +137,7 @@ namespace CalculatorApp
 | 
			
		||||
        }
 | 
			
		||||
        private System.Windows.Input.ICommand donotuse_HistoryButtonPressed;
 | 
			
		||||
 | 
			
		||||
        private static UISettings uiSettings = new UISettings();
 | 
			
		||||
        private static readonly UISettings uiSettings = new UISettings();
 | 
			
		||||
        public void AnimateCalculator(bool resultAnimate)
 | 
			
		||||
        {
 | 
			
		||||
            if (uiSettings.AnimationsEnabled)
 | 
			
		||||
@@ -174,8 +159,10 @@ namespace CalculatorApp
 | 
			
		||||
        {
 | 
			
		||||
            if (m_historyList == null)
 | 
			
		||||
            {
 | 
			
		||||
                m_historyList = new HistoryList();
 | 
			
		||||
                m_historyList.DataContext = historyVM;
 | 
			
		||||
                m_historyList = new HistoryList
 | 
			
		||||
                {
 | 
			
		||||
                    DataContext = historyVM
 | 
			
		||||
                };
 | 
			
		||||
                historyVM.HideHistoryClicked += OnHideHistoryClicked;
 | 
			
		||||
                historyVM.HistoryItemClicked += OnHistoryItemClicked;
 | 
			
		||||
            }
 | 
			
		||||
@@ -247,11 +234,11 @@ namespace CalculatorApp
 | 
			
		||||
            // Delay load things later when we get a chance.
 | 
			
		||||
            WeakReference weakThis = new WeakReference(this);
 | 
			
		||||
            _ = this.Dispatcher.RunAsync(
 | 
			
		||||
                CoreDispatcherPriority.Normal, new DispatchedHandler(() => {
 | 
			
		||||
                CoreDispatcherPriority.Normal, new DispatchedHandler(() =>
 | 
			
		||||
                {
 | 
			
		||||
                    if (TraceLogger.GetInstance().IsWindowIdInLog(ApplicationView.GetApplicationViewIdForWindow(CoreWindow.GetForCurrentThread())))
 | 
			
		||||
                    {
 | 
			
		||||
                        var refThis = weakThis.Target as Calculator;
 | 
			
		||||
                        if (refThis != null)
 | 
			
		||||
                        if (weakThis.Target is Calculator refThis)
 | 
			
		||||
                        {
 | 
			
		||||
                            refThis.GetMemory();
 | 
			
		||||
                        }
 | 
			
		||||
@@ -361,8 +348,7 @@ namespace CalculatorApp
 | 
			
		||||
 | 
			
		||||
            PasteMenuItem.IsEnabled = CopyPasteManager.HasStringToPaste();
 | 
			
		||||
 | 
			
		||||
            Point point;
 | 
			
		||||
            if (e.TryGetPosition(requestedElement, out point))
 | 
			
		||||
            if (e.TryGetPosition(requestedElement, out Point point))
 | 
			
		||||
            {
 | 
			
		||||
                m_displayFlyout.ShowAt(requestedElement, point);
 | 
			
		||||
            }
 | 
			
		||||
@@ -629,7 +615,7 @@ namespace CalculatorApp
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        private Windows.UI.Xaml.Controls.MenuFlyout m_displayFlyout;
 | 
			
		||||
        private readonly Windows.UI.Xaml.Controls.MenuFlyout m_displayFlyout;
 | 
			
		||||
        private bool m_doAnimate;
 | 
			
		||||
        private bool m_resultAnimate;
 | 
			
		||||
        private bool m_isLastAnimatedInScientific;
 | 
			
		||||
 
 | 
			
		||||
@@ -8,20 +8,14 @@
 | 
			
		||||
 | 
			
		||||
// The User Control item template is documented at https://go.microsoft.com/fwlink/?LinkId=234236
 | 
			
		||||
 | 
			
		||||
using System;
 | 
			
		||||
using System.Collections.Generic;
 | 
			
		||||
using System.Threading.Tasks;
 | 
			
		||||
using System.Diagnostics;
 | 
			
		||||
using CalculatorApp;
 | 
			
		||||
using CalculatorApp.Controls;
 | 
			
		||||
using CalculatorApp.ViewModel;
 | 
			
		||||
using CalculatorApp.ViewModel.Common;
 | 
			
		||||
 | 
			
		||||
using System.Diagnostics;
 | 
			
		||||
 | 
			
		||||
using Windows.UI.Xaml;
 | 
			
		||||
using Windows.UI.Xaml.Automation;
 | 
			
		||||
using Windows.UI.Xaml.Controls;
 | 
			
		||||
using Windows.UI.Xaml.Data;
 | 
			
		||||
using Windows.UI.Xaml.Input;
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
namespace CalculatorApp
 | 
			
		||||
@@ -41,10 +35,7 @@ namespace CalculatorApp
 | 
			
		||||
            return index <= GetIndexOfLastBit(length);
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        public StandardCalculatorViewModel Model
 | 
			
		||||
        {
 | 
			
		||||
            get { return (StandardCalculatorViewModel)this.DataContext; }
 | 
			
		||||
        }
 | 
			
		||||
        public StandardCalculatorViewModel Model => (StandardCalculatorViewModel)this.DataContext;
 | 
			
		||||
 | 
			
		||||
        private void OnLoaded(object sender, RoutedEventArgs e)
 | 
			
		||||
        {
 | 
			
		||||
@@ -276,7 +267,7 @@ namespace CalculatorApp
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        private static readonly uint s_numBits = 64;
 | 
			
		||||
        private FlipButtons[] m_flipButtons = new FlipButtons[s_numBits];
 | 
			
		||||
        private readonly FlipButtons[] m_flipButtons = new FlipButtons[s_numBits];
 | 
			
		||||
        private bool m_updatingCheckedStates;
 | 
			
		||||
        private BitLength m_currentValueBitLength;
 | 
			
		||||
    }
 | 
			
		||||
 
 | 
			
		||||
@@ -1,9 +1,11 @@
 | 
			
		||||
using CalculatorApp.Utils;
 | 
			
		||||
using CalculatorApp.ViewModel.Common;
 | 
			
		||||
 | 
			
		||||
using System.Diagnostics;
 | 
			
		||||
using System.Windows.Input;
 | 
			
		||||
 | 
			
		||||
using Windows.UI.Xaml;
 | 
			
		||||
using Windows.UI.Xaml.Controls;
 | 
			
		||||
using CalculatorApp.Utils;
 | 
			
		||||
 | 
			
		||||
// The User Control item template is documented at https://go.microsoft.com/fwlink/?LinkId=234236
 | 
			
		||||
 | 
			
		||||
@@ -41,10 +43,7 @@ namespace CalculatorApp
 | 
			
		||||
 | 
			
		||||
        public bool IsErrorVisualState
 | 
			
		||||
        {
 | 
			
		||||
            get
 | 
			
		||||
            {
 | 
			
		||||
                return m_isErrorVisualState;
 | 
			
		||||
            }
 | 
			
		||||
            get => m_isErrorVisualState;
 | 
			
		||||
 | 
			
		||||
            set
 | 
			
		||||
            {
 | 
			
		||||
 
 | 
			
		||||
@@ -1,29 +1,13 @@
 | 
			
		||||
// Copyright (c) Microsoft Corporation. All rights reserved.
 | 
			
		||||
// Licensed under the MIT License.
 | 
			
		||||
 | 
			
		||||
using System;
 | 
			
		||||
using System.Collections.Generic;
 | 
			
		||||
using System.Threading.Tasks;
 | 
			
		||||
using System.Diagnostics;
 | 
			
		||||
using CalculatorApp;
 | 
			
		||||
using CalculatorApp.Controls;
 | 
			
		||||
using CalculatorApp.ViewModel;
 | 
			
		||||
using CalculatorApp.ViewModel.Common;
 | 
			
		||||
using Windows.Devices.Input;
 | 
			
		||||
 | 
			
		||||
using Windows.Foundation;
 | 
			
		||||
using Windows.Foundation.Collections;
 | 
			
		||||
using System.Diagnostics;
 | 
			
		||||
 | 
			
		||||
using Windows.UI.Xaml;
 | 
			
		||||
using Windows.UI.Xaml.Controls;
 | 
			
		||||
using Windows.UI.Xaml.Controls.Primitives;
 | 
			
		||||
using Windows.UI.Xaml.Data;
 | 
			
		||||
using Windows.UI.Xaml.Input;
 | 
			
		||||
using Windows.UI.Xaml.Media;
 | 
			
		||||
using Windows.UI.Xaml.Navigation;
 | 
			
		||||
using Windows.UI.Xaml.Automation;
 | 
			
		||||
using Windows.UI.Xaml.Automation.Peers;
 | 
			
		||||
using Windows.UI.ViewManagement;
 | 
			
		||||
using Windows.UI.Core;
 | 
			
		||||
 | 
			
		||||
namespace CalculatorApp
 | 
			
		||||
{
 | 
			
		||||
@@ -37,15 +21,12 @@ namespace CalculatorApp
 | 
			
		||||
            CopyMenuItem.Text = AppResourceProvider.GetInstance().GetResourceString("copyMenuItem");
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        public StandardCalculatorViewModel Model
 | 
			
		||||
        {
 | 
			
		||||
            get { return (StandardCalculatorViewModel)this.DataContext; }
 | 
			
		||||
        }
 | 
			
		||||
        public StandardCalculatorViewModel Model => (StandardCalculatorViewModel)this.DataContext;
 | 
			
		||||
 | 
			
		||||
        public Style SymbolButtonStyle
 | 
			
		||||
        {
 | 
			
		||||
            get { return (Style)GetValue(SymbolButtonStyleProperty); }
 | 
			
		||||
            set { SetValue(SymbolButtonStyleProperty, value); }
 | 
			
		||||
            get => (Style)GetValue(SymbolButtonStyleProperty);
 | 
			
		||||
            set => SetValue(SymbolButtonStyleProperty, value);
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        // Using a DependencyProperty as the backing store for SymbolButtonStyle.  This enables animation, styling, binding, etc...
 | 
			
		||||
 
 | 
			
		||||
@@ -1,21 +1,11 @@
 | 
			
		||||
// Copyright (c) Microsoft Corporation. All rights reserved.
 | 
			
		||||
// Licensed under the MIT License.
 | 
			
		||||
 | 
			
		||||
using System;
 | 
			
		||||
using System.Collections.Generic;
 | 
			
		||||
using System.Threading.Tasks;
 | 
			
		||||
using System.Diagnostics;
 | 
			
		||||
 | 
			
		||||
using CalculatorApp;
 | 
			
		||||
using CalculatorApp.ViewModel;
 | 
			
		||||
using CalculatorApp.ViewModel.Common;
 | 
			
		||||
 | 
			
		||||
using Windows.UI.Xaml;
 | 
			
		||||
using Windows.UI.Xaml.Controls;
 | 
			
		||||
using Windows.UI.Xaml.Controls.Primitives;
 | 
			
		||||
using Windows.UI.Xaml.Data;
 | 
			
		||||
using CalculatorApp.Common;
 | 
			
		||||
using Windows.UI.Xaml.Media;
 | 
			
		||||
 | 
			
		||||
namespace CalculatorApp
 | 
			
		||||
{
 | 
			
		||||
@@ -29,17 +19,14 @@ namespace CalculatorApp
 | 
			
		||||
            LoadResourceStrings();
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        public StandardCalculatorViewModel Model
 | 
			
		||||
        {
 | 
			
		||||
            get { return (StandardCalculatorViewModel)this.DataContext; }
 | 
			
		||||
        }
 | 
			
		||||
        public StandardCalculatorViewModel Model => (StandardCalculatorViewModel)this.DataContext;
 | 
			
		||||
 | 
			
		||||
        public bool IsErrorVisualState
 | 
			
		||||
        {
 | 
			
		||||
            get => m_isErrorVisualState;
 | 
			
		||||
            set
 | 
			
		||||
            {
 | 
			
		||||
                if(m_isErrorVisualState != value)
 | 
			
		||||
                if (m_isErrorVisualState != value)
 | 
			
		||||
                {
 | 
			
		||||
                    m_isErrorVisualState = value;
 | 
			
		||||
                    string newState = m_isErrorVisualState ? "ErrorLayout" : "NoErrorLayout";
 | 
			
		||||
 
 | 
			
		||||
@@ -6,26 +6,11 @@
 | 
			
		||||
// Declaration of the CalculatorScientificAngleButtons class
 | 
			
		||||
//
 | 
			
		||||
 | 
			
		||||
using System;
 | 
			
		||||
using System.Collections.Generic;
 | 
			
		||||
using System.Threading.Tasks;
 | 
			
		||||
using System.Diagnostics;
 | 
			
		||||
using CalculatorApp;
 | 
			
		||||
using CalculatorApp.Utils;
 | 
			
		||||
using CalculatorApp.ViewModel;
 | 
			
		||||
using CalculatorApp.ViewModel.Common;
 | 
			
		||||
 | 
			
		||||
using Windows.Foundation;
 | 
			
		||||
using Windows.Foundation.Collections;
 | 
			
		||||
using Windows.UI.Xaml;
 | 
			
		||||
using Windows.UI.Xaml.Controls;
 | 
			
		||||
using Windows.UI.Xaml.Controls.Primitives;
 | 
			
		||||
using Windows.UI.Xaml.Data;
 | 
			
		||||
using Windows.UI.Xaml.Input;
 | 
			
		||||
using Windows.UI.Xaml.Media;
 | 
			
		||||
using Windows.UI.Xaml.Navigation;
 | 
			
		||||
using Windows.UI.ViewManagement;
 | 
			
		||||
using Windows.UI.Core;
 | 
			
		||||
 | 
			
		||||
namespace CalculatorApp
 | 
			
		||||
{
 | 
			
		||||
@@ -38,10 +23,7 @@ namespace CalculatorApp
 | 
			
		||||
            InitializeComponent();
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        public StandardCalculatorViewModel Model
 | 
			
		||||
        {
 | 
			
		||||
            get { return (StandardCalculatorViewModel)this.DataContext; }
 | 
			
		||||
        }
 | 
			
		||||
        public StandardCalculatorViewModel Model => (StandardCalculatorViewModel)this.DataContext;
 | 
			
		||||
 | 
			
		||||
        public System.Windows.Input.ICommand ButtonPressed
 | 
			
		||||
        {
 | 
			
		||||
@@ -50,7 +32,7 @@ namespace CalculatorApp
 | 
			
		||||
                if (donotuse_ButtonPressed == null)
 | 
			
		||||
                {
 | 
			
		||||
                    donotuse_ButtonPressed = DelegateCommandUtils.MakeDelegateCommand(this,
 | 
			
		||||
                        (that, param)=>
 | 
			
		||||
                        (that, param) =>
 | 
			
		||||
                        {
 | 
			
		||||
                            that.OnAngleButtonPressed(param);
 | 
			
		||||
                        });
 | 
			
		||||
@@ -65,7 +47,7 @@ namespace CalculatorApp
 | 
			
		||||
            get => m_isErrorVisualState;
 | 
			
		||||
            set
 | 
			
		||||
            {
 | 
			
		||||
                if(m_isErrorVisualState != value)
 | 
			
		||||
                if (m_isErrorVisualState != value)
 | 
			
		||||
                {
 | 
			
		||||
                    m_isErrorVisualState = value;
 | 
			
		||||
                    string newState = m_isErrorVisualState ? "ErrorFlyout" : "NoErrorFlyout";
 | 
			
		||||
 
 | 
			
		||||
@@ -6,26 +6,11 @@
 | 
			
		||||
// Declaration of the CalculatorScientificOperators class
 | 
			
		||||
//
 | 
			
		||||
 | 
			
		||||
using System;
 | 
			
		||||
using System.Collections.Generic;
 | 
			
		||||
using System.Threading.Tasks;
 | 
			
		||||
using System.Diagnostics;
 | 
			
		||||
using CalculatorApp;
 | 
			
		||||
using CalculatorApp.Common;
 | 
			
		||||
using CalculatorApp.ViewModel;
 | 
			
		||||
using CalculatorApp.ViewModel.Common;
 | 
			
		||||
 | 
			
		||||
using Windows.Foundation;
 | 
			
		||||
using Windows.Foundation.Collections;
 | 
			
		||||
using Windows.UI.Core;
 | 
			
		||||
using Windows.UI.ViewManagement;
 | 
			
		||||
using Windows.UI.Xaml;
 | 
			
		||||
using Windows.UI.Xaml.Controls;
 | 
			
		||||
using Windows.UI.Xaml.Controls.Primitives;
 | 
			
		||||
using Windows.UI.Xaml.Data;
 | 
			
		||||
using Windows.UI.Xaml.Input;
 | 
			
		||||
using Windows.UI.Xaml.Media;
 | 
			
		||||
using Windows.UI.Xaml.Navigation;
 | 
			
		||||
 | 
			
		||||
namespace CalculatorApp
 | 
			
		||||
{
 | 
			
		||||
@@ -39,15 +24,12 @@ namespace CalculatorApp
 | 
			
		||||
            ExpButton.SetValue(KeyboardShortcutManager.VirtualKeyProperty, MyVirtualKey.E);
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        public StandardCalculatorViewModel Model
 | 
			
		||||
        {
 | 
			
		||||
            get { return (StandardCalculatorViewModel)this.DataContext; }
 | 
			
		||||
        }
 | 
			
		||||
        public StandardCalculatorViewModel Model => (StandardCalculatorViewModel)this.DataContext;
 | 
			
		||||
 | 
			
		||||
        public bool IsErrorVisualState
 | 
			
		||||
        {
 | 
			
		||||
            get { return (bool)GetValue(IsErrorVisualStateProperty); }
 | 
			
		||||
            set { SetValue(IsErrorVisualStateProperty, value); }
 | 
			
		||||
            get => (bool)GetValue(IsErrorVisualStateProperty);
 | 
			
		||||
            set => SetValue(IsErrorVisualStateProperty, value);
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        // Using a DependencyProperty as the backing store for IsErrorVisualState.  This enables animation, styling, binding, etc...
 | 
			
		||||
 
 | 
			
		||||
@@ -6,21 +6,7 @@
 | 
			
		||||
// Declaration of the CalculatorStandardOperators class
 | 
			
		||||
//
 | 
			
		||||
 | 
			
		||||
using System;
 | 
			
		||||
using System.Collections.Generic;
 | 
			
		||||
using System.Threading.Tasks;
 | 
			
		||||
using System.Diagnostics;
 | 
			
		||||
using CalculatorApp;
 | 
			
		||||
 | 
			
		||||
using Windows.Foundation;
 | 
			
		||||
using Windows.Foundation.Collections;
 | 
			
		||||
using Windows.UI.Xaml;
 | 
			
		||||
using Windows.UI.Xaml.Controls;
 | 
			
		||||
using Windows.UI.Xaml.Controls.Primitives;
 | 
			
		||||
using Windows.UI.Xaml.Data;
 | 
			
		||||
using Windows.UI.Xaml.Input;
 | 
			
		||||
using Windows.UI.Xaml.Media;
 | 
			
		||||
using Windows.UI.Xaml.Navigation;
 | 
			
		||||
 | 
			
		||||
namespace CalculatorApp
 | 
			
		||||
{
 | 
			
		||||
@@ -35,7 +21,7 @@ namespace CalculatorApp
 | 
			
		||||
 | 
			
		||||
        public bool IsErrorVisualState
 | 
			
		||||
        {
 | 
			
		||||
            get { return m_isErrorVisualState; }
 | 
			
		||||
            get => m_isErrorVisualState;
 | 
			
		||||
            set
 | 
			
		||||
            {
 | 
			
		||||
                if (m_isErrorVisualState != value)
 | 
			
		||||
 
 | 
			
		||||
@@ -8,30 +8,17 @@
 | 
			
		||||
 | 
			
		||||
// The User Control item template is documented at https://go.microsoft.com/fwlink/?LinkId=234236
 | 
			
		||||
 | 
			
		||||
using System;
 | 
			
		||||
using System.Collections.Generic;
 | 
			
		||||
using System.Threading.Tasks;
 | 
			
		||||
using System.Diagnostics;
 | 
			
		||||
using CalculatorApp;
 | 
			
		||||
using CalculatorApp.ViewModel;
 | 
			
		||||
using CalculatorApp.ViewModel.Common;
 | 
			
		||||
 | 
			
		||||
using Windows.Foundation;
 | 
			
		||||
using Windows.Foundation.Collections;
 | 
			
		||||
using System;
 | 
			
		||||
 | 
			
		||||
using Windows.Globalization;
 | 
			
		||||
using Windows.Globalization.DateTimeFormatting;
 | 
			
		||||
using Windows.System.UserProfile;
 | 
			
		||||
using Windows.UI.Core;
 | 
			
		||||
using Windows.UI.ViewManagement;
 | 
			
		||||
using Windows.UI.Xaml;
 | 
			
		||||
using Windows.UI.Xaml.Automation;
 | 
			
		||||
using Windows.UI.Xaml.Automation.Peers;
 | 
			
		||||
using Windows.UI.Xaml.Controls;
 | 
			
		||||
using Windows.UI.Xaml.Controls.Primitives;
 | 
			
		||||
using Windows.UI.Xaml.Data;
 | 
			
		||||
using Windows.UI.Xaml.Input;
 | 
			
		||||
using Windows.UI.Xaml.Media;
 | 
			
		||||
using Windows.UI.Xaml.Navigation;
 | 
			
		||||
 | 
			
		||||
namespace CalculatorApp
 | 
			
		||||
{
 | 
			
		||||
 
 | 
			
		||||
@@ -1,29 +1,28 @@
 | 
			
		||||
// Copyright (c) Microsoft Corporation. All rights reserved.
 | 
			
		||||
// Licensed under the MIT License.
 | 
			
		||||
 | 
			
		||||
using Calculator.Utils;
 | 
			
		||||
 | 
			
		||||
using CalculatorApp.Controls;
 | 
			
		||||
using CalculatorApp.ViewModel;
 | 
			
		||||
using CalculatorApp.ViewModel.Common;
 | 
			
		||||
using CalculatorApp.ViewModel.Common.Automation;
 | 
			
		||||
 | 
			
		||||
using GraphControl;
 | 
			
		||||
 | 
			
		||||
using System;
 | 
			
		||||
using System.Collections.Generic;
 | 
			
		||||
using System.Collections.ObjectModel;
 | 
			
		||||
using System.Threading.Tasks;
 | 
			
		||||
using System.Diagnostics;
 | 
			
		||||
using CalculatorApp;
 | 
			
		||||
using CalculatorApp.Common;
 | 
			
		||||
using CalculatorApp.ViewModel.Common;
 | 
			
		||||
using CalculatorApp.ViewModel.Common.Automation;
 | 
			
		||||
using GraphControl;
 | 
			
		||||
using CalculatorApp.ViewModel;
 | 
			
		||||
using CalculatorApp.Controls;
 | 
			
		||||
using Windows.Foundation;
 | 
			
		||||
 | 
			
		||||
using Windows.System;
 | 
			
		||||
using Windows.UI;
 | 
			
		||||
using Windows.UI.Core;
 | 
			
		||||
using Windows.UI.ViewManagement;
 | 
			
		||||
using Windows.UI.Xaml;
 | 
			
		||||
using Windows.UI.Xaml.Media;
 | 
			
		||||
using Windows.UI.Xaml.Controls;
 | 
			
		||||
using Windows.UI.Xaml.Controls.Primitives;
 | 
			
		||||
using Windows.UI.Xaml.Input;
 | 
			
		||||
using Calculator.Utils;
 | 
			
		||||
using Windows.UI.Xaml.Media;
 | 
			
		||||
 | 
			
		||||
namespace CalculatorApp
 | 
			
		||||
{
 | 
			
		||||
@@ -56,7 +55,7 @@ namespace CalculatorApp
 | 
			
		||||
 | 
			
		||||
        public Windows.Foundation.Collections.IObservableVector<ViewModel.EquationViewModel> Equations
 | 
			
		||||
        {
 | 
			
		||||
            get { return m_Equations; }
 | 
			
		||||
            get => m_Equations;
 | 
			
		||||
            set
 | 
			
		||||
            {
 | 
			
		||||
                if (m_Equations != value)
 | 
			
		||||
@@ -70,7 +69,7 @@ namespace CalculatorApp
 | 
			
		||||
 | 
			
		||||
        public Windows.Foundation.Collections.IObservableVector<ViewModel.VariableViewModel> Variables
 | 
			
		||||
        {
 | 
			
		||||
            get { return m_Variables; }
 | 
			
		||||
            get => m_Variables;
 | 
			
		||||
            set
 | 
			
		||||
            {
 | 
			
		||||
                if (m_Variables != value)
 | 
			
		||||
@@ -84,7 +83,7 @@ namespace CalculatorApp
 | 
			
		||||
 | 
			
		||||
        public ObservableCollection<SolidColorBrush> AvailableColors
 | 
			
		||||
        {
 | 
			
		||||
            get { return m_AvailableColors; }
 | 
			
		||||
            get => m_AvailableColors;
 | 
			
		||||
            set
 | 
			
		||||
            {
 | 
			
		||||
                if (m_AvailableColors != value)
 | 
			
		||||
@@ -99,7 +98,7 @@ namespace CalculatorApp
 | 
			
		||||
 | 
			
		||||
        public bool IsMatchAppTheme
 | 
			
		||||
        {
 | 
			
		||||
            get { return m_IsMatchAppTheme; }
 | 
			
		||||
            get => m_IsMatchAppTheme;
 | 
			
		||||
            set
 | 
			
		||||
            {
 | 
			
		||||
                if (m_IsMatchAppTheme != value)
 | 
			
		||||
@@ -156,8 +155,7 @@ namespace CalculatorApp
 | 
			
		||||
                {
 | 
			
		||||
                    return;
 | 
			
		||||
                }
 | 
			
		||||
                var equationTextBox = equationInput as EquationTextBox;
 | 
			
		||||
                if (equationTextBox != null)
 | 
			
		||||
                if (equationInput is EquationTextBox equationTextBox)
 | 
			
		||||
                {
 | 
			
		||||
                    equationTextBox.FocusTextBox();
 | 
			
		||||
                }
 | 
			
		||||
@@ -225,8 +223,10 @@ namespace CalculatorApp
 | 
			
		||||
                colorIndex = colorAssignmentMapping[colorIndex];
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            var eq = new EquationViewModel(new Equation(), ++m_lastFunctionLabelIndex, AvailableColors[colorIndex].Color, colorIndex);
 | 
			
		||||
            eq.IsLastItemInList = true;
 | 
			
		||||
            var eq = new EquationViewModel(new Equation(), ++m_lastFunctionLabelIndex, AvailableColors[colorIndex].Color, colorIndex)
 | 
			
		||||
            {
 | 
			
		||||
                IsLastItemInList = true
 | 
			
		||||
            };
 | 
			
		||||
            m_equationToFocus = eq;
 | 
			
		||||
            Equations.Add(eq);
 | 
			
		||||
        }
 | 
			
		||||
@@ -355,13 +355,13 @@ namespace CalculatorApp
 | 
			
		||||
        {
 | 
			
		||||
 | 
			
		||||
            WeakReference weakThis = new WeakReference(this);
 | 
			
		||||
            _ = this.Dispatcher.RunAsync(CoreDispatcherPriority.Normal, new DispatchedHandler(() => {
 | 
			
		||||
                    var refThis = weakThis.Target as EquationInputArea;
 | 
			
		||||
                    if (refThis != null && refThis.m_isHighContrast == refThis.m_accessibilitySettings.HighContrast)
 | 
			
		||||
                    {
 | 
			
		||||
                        refThis.ReloadAvailableColors(false, false);
 | 
			
		||||
                    }
 | 
			
		||||
                }));
 | 
			
		||||
            _ = this.Dispatcher.RunAsync(CoreDispatcherPriority.Normal, new DispatchedHandler(() =>
 | 
			
		||||
            {
 | 
			
		||||
                if (weakThis.Target is EquationInputArea refThis && refThis.m_isHighContrast == refThis.m_accessibilitySettings.HighContrast)
 | 
			
		||||
                {
 | 
			
		||||
                    refThis.ReloadAvailableColors(false, false);
 | 
			
		||||
                }
 | 
			
		||||
            }));
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        private void EquationTextBox_RemoveButtonClicked(object sender, RoutedEventArgs e)
 | 
			
		||||
@@ -416,7 +416,7 @@ namespace CalculatorApp
 | 
			
		||||
            var eq = GetViewModelFromEquationTextBox(sender);
 | 
			
		||||
            eq.IsLineEnabled = !eq.IsLineEnabled;
 | 
			
		||||
 | 
			
		||||
            CalculatorApp.ViewModel.Common.TraceLogger.GetInstance().LogShowHideButtonClicked(eq.IsLineEnabled ? false : true);
 | 
			
		||||
            CalculatorApp.ViewModel.Common.TraceLogger.GetInstance().LogShowHideButtonClicked(!eq.IsLineEnabled);
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        private void EquationTextBox_Loaded(object sender, RoutedEventArgs e)
 | 
			
		||||
@@ -594,7 +594,8 @@ namespace CalculatorApp
 | 
			
		||||
            {
 | 
			
		||||
                TimeSpan timeSpan = new TimeSpan(10000000); // 1 tick = 100 nanoseconds, and 10000000 ticks = 1 second.
 | 
			
		||||
                DispatcherTimerDelayer delayer = new DispatcherTimerDelayer(timeSpan);
 | 
			
		||||
                delayer.Action += new EventHandler<object>((object s, object arg) => {
 | 
			
		||||
                delayer.Action += new EventHandler<object>((object s, object arg) =>
 | 
			
		||||
                {
 | 
			
		||||
                    CalculatorApp.ViewModel.Common.TraceLogger.GetInstance().LogVariableChanged("Slider", name);
 | 
			
		||||
                    variableSliders.Remove(name);
 | 
			
		||||
                });
 | 
			
		||||
@@ -641,8 +642,8 @@ namespace CalculatorApp
 | 
			
		||||
        private const string EquationsPropertyName = "Equations";
 | 
			
		||||
        private const string IsMatchAppThemePropertyName = "IsMatchAppTheme";
 | 
			
		||||
 | 
			
		||||
        private Windows.UI.ViewManagement.AccessibilitySettings m_accessibilitySettings;
 | 
			
		||||
        private Windows.UI.ViewManagement.UISettings m_uiSettings;
 | 
			
		||||
        private readonly Windows.UI.ViewManagement.AccessibilitySettings m_accessibilitySettings;
 | 
			
		||||
        private readonly Windows.UI.ViewManagement.UISettings m_uiSettings;
 | 
			
		||||
        private int m_lastLineColorIndex;
 | 
			
		||||
        private int m_lastFunctionLabelIndex;
 | 
			
		||||
        private bool m_isHighContrast;
 | 
			
		||||
 
 | 
			
		||||
@@ -1,8 +1,9 @@
 | 
			
		||||
using CalculatorApp.ViewModel.Common;
 | 
			
		||||
 | 
			
		||||
using GraphControl;
 | 
			
		||||
using System;
 | 
			
		||||
 | 
			
		||||
using System.Collections.Generic;
 | 
			
		||||
using System.Linq;
 | 
			
		||||
 | 
			
		||||
using Windows.UI;
 | 
			
		||||
using Windows.UI.Xaml;
 | 
			
		||||
using Windows.UI.Xaml.Controls;
 | 
			
		||||
@@ -18,18 +19,20 @@ namespace CalculatorApp
 | 
			
		||||
        {
 | 
			
		||||
            InitializeComponent();
 | 
			
		||||
 | 
			
		||||
            var allStyles = new List<EquationLineStyle>();
 | 
			
		||||
            allStyles.Add(EquationLineStyle.Solid);
 | 
			
		||||
            allStyles.Add(EquationLineStyle.Dash);
 | 
			
		||||
            allStyles.Add(EquationLineStyle.Dot);
 | 
			
		||||
            var allStyles = new List<EquationLineStyle>
 | 
			
		||||
            {
 | 
			
		||||
                EquationLineStyle.Solid,
 | 
			
		||||
                EquationLineStyle.Dash,
 | 
			
		||||
                EquationLineStyle.Dot
 | 
			
		||||
            };
 | 
			
		||||
 | 
			
		||||
            StyleChooserBox.ItemsSource = allStyles;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        public Windows.UI.Color SelectedColor
 | 
			
		||||
        {
 | 
			
		||||
            get { return (Windows.UI.Color)GetValue(SelectedColorProperty); }
 | 
			
		||||
            set { SetValue(SelectedColorProperty, value); }
 | 
			
		||||
            get => (Windows.UI.Color)GetValue(SelectedColorProperty);
 | 
			
		||||
            set => SetValue(SelectedColorProperty, value);
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        // Using a DependencyProperty as the backing store for SelectedColor.  This enables animation, styling, binding, etc...
 | 
			
		||||
@@ -42,8 +45,8 @@ namespace CalculatorApp
 | 
			
		||||
 | 
			
		||||
        public GraphControl.EquationLineStyle SelectedStyle
 | 
			
		||||
        {
 | 
			
		||||
            get { return (GraphControl.EquationLineStyle)GetValue(SelectedStyleProperty); }
 | 
			
		||||
            set { SetValue(SelectedStyleProperty, value); }
 | 
			
		||||
            get => (GraphControl.EquationLineStyle)GetValue(SelectedStyleProperty);
 | 
			
		||||
            set => SetValue(SelectedStyleProperty, value);
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        // Using a DependencyProperty as the backing store for SelectedStyle.  This enables animation, styling, binding, etc...
 | 
			
		||||
@@ -56,8 +59,8 @@ namespace CalculatorApp
 | 
			
		||||
 | 
			
		||||
        public int SelectedColorIndex
 | 
			
		||||
        {
 | 
			
		||||
            get { return (int)GetValue(SelectedColorIndexProperty); }
 | 
			
		||||
            set { SetValue(SelectedColorIndexProperty, value); }
 | 
			
		||||
            get => (int)GetValue(SelectedColorIndexProperty);
 | 
			
		||||
            set => SetValue(SelectedColorIndexProperty, value);
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        // Using a DependencyProperty as the backing store for SelectedColorIndex.  This enables animation, styling, binding, etc...
 | 
			
		||||
@@ -66,8 +69,8 @@ namespace CalculatorApp
 | 
			
		||||
 | 
			
		||||
        public IList<Windows.UI.Xaml.Media.SolidColorBrush> AvailableColors
 | 
			
		||||
        {
 | 
			
		||||
            get { return (IList<Windows.UI.Xaml.Media.SolidColorBrush>)GetValue(AvailableColorsProperty); }
 | 
			
		||||
            set { SetValue(AvailableColorsProperty, value); }
 | 
			
		||||
            get => (IList<Windows.UI.Xaml.Media.SolidColorBrush>)GetValue(AvailableColorsProperty);
 | 
			
		||||
            set => SetValue(AvailableColorsProperty, value);
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        // Using a DependencyProperty as the backing store for AvailableColors.  This enables animation, styling, binding, etc...
 | 
			
		||||
@@ -76,8 +79,8 @@ namespace CalculatorApp
 | 
			
		||||
 | 
			
		||||
        public bool EnableLineStylePicker
 | 
			
		||||
        {
 | 
			
		||||
            get { return (bool)GetValue(EnableLineStylePickerProperty); }
 | 
			
		||||
            set { SetValue(EnableLineStylePickerProperty, value); }
 | 
			
		||||
            get => (bool)GetValue(EnableLineStylePickerProperty);
 | 
			
		||||
            set => SetValue(EnableLineStylePickerProperty, value);
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        // Using a DependencyProperty as the backing store for EnableLineStylePicker.  This enables animation, styling, binding, etc...
 | 
			
		||||
 
 | 
			
		||||
@@ -1,38 +1,30 @@
 | 
			
		||||
// Copyright (c) Microsoft Corporation. All rights reserved.
 | 
			
		||||
// Licensed under the MIT License.
 | 
			
		||||
 | 
			
		||||
using System;
 | 
			
		||||
using System.Collections.Generic;
 | 
			
		||||
using System.Threading.Tasks;
 | 
			
		||||
using System.Diagnostics;
 | 
			
		||||
using CalculatorApp;
 | 
			
		||||
using CalculatorApp.Common;
 | 
			
		||||
using CalculatorApp.ViewModel.Common;
 | 
			
		||||
using CalculatorApp.ViewModel.Common.Automation;
 | 
			
		||||
using CalculatorApp.Controls;
 | 
			
		||||
using CalculatorApp.Utils;
 | 
			
		||||
using CalculatorApp.ViewModel;
 | 
			
		||||
using CalculatorApp.ViewModel.Common;
 | 
			
		||||
using CalculatorApp.ViewModel.Common.Automation;
 | 
			
		||||
 | 
			
		||||
using GraphControl;
 | 
			
		||||
 | 
			
		||||
using System;
 | 
			
		||||
 | 
			
		||||
using Windows.ApplicationModel.DataTransfer;
 | 
			
		||||
using Windows.ApplicationModel.Resources;
 | 
			
		||||
using Windows.Foundation;
 | 
			
		||||
using Windows.Foundation.Collections;
 | 
			
		||||
using Windows.Storage;
 | 
			
		||||
using Windows.Storage.Streams;
 | 
			
		||||
using Windows.System;
 | 
			
		||||
using Windows.UI.Core;
 | 
			
		||||
using Windows.UI.Input;
 | 
			
		||||
using Windows.UI.ViewManagement;
 | 
			
		||||
using Windows.UI.Xaml;
 | 
			
		||||
using Windows.UI.Xaml.Automation;
 | 
			
		||||
using Windows.UI.Xaml.Automation.Peers;
 | 
			
		||||
using Windows.UI.Xaml.Data;
 | 
			
		||||
using Windows.UI.Xaml.Controls;
 | 
			
		||||
using Windows.UI.Xaml.Controls.Primitives;
 | 
			
		||||
using Windows.UI.Xaml.Input;
 | 
			
		||||
using Windows.UI.Xaml.Media;
 | 
			
		||||
using Windows.UI.Xaml.Media.Imaging;
 | 
			
		||||
using Windows.UI.Popups;
 | 
			
		||||
 | 
			
		||||
namespace CalculatorApp
 | 
			
		||||
{
 | 
			
		||||
@@ -62,14 +54,18 @@ namespace CalculatorApp
 | 
			
		||||
            GraphingControl.UseCommaDecimalSeperator = LocalizationSettings.GetInstance().GetDecimalSeparator() == ',';
 | 
			
		||||
 | 
			
		||||
            // OemMinus and OemAdd aren't declared in the VirtualKey enum, we can't add this accelerator XAML-side
 | 
			
		||||
            var virtualKey = new KeyboardAccelerator();
 | 
			
		||||
            virtualKey.Key = (VirtualKey)189; // OemPlus key
 | 
			
		||||
            virtualKey.Modifiers = VirtualKeyModifiers.Control;
 | 
			
		||||
            var virtualKey = new KeyboardAccelerator
 | 
			
		||||
            {
 | 
			
		||||
                Key = (VirtualKey)189, // OemPlus key
 | 
			
		||||
                Modifiers = VirtualKeyModifiers.Control
 | 
			
		||||
            };
 | 
			
		||||
            ZoomOutButton.KeyboardAccelerators.Add(virtualKey);
 | 
			
		||||
 | 
			
		||||
            virtualKey = new KeyboardAccelerator();
 | 
			
		||||
            virtualKey.Key = (VirtualKey)187; // OemAdd key
 | 
			
		||||
            virtualKey.Modifiers = VirtualKeyModifiers.Control;
 | 
			
		||||
            virtualKey = new KeyboardAccelerator
 | 
			
		||||
            {
 | 
			
		||||
                Key = (VirtualKey)187, // OemAdd key
 | 
			
		||||
                Modifiers = VirtualKeyModifiers.Control
 | 
			
		||||
            };
 | 
			
		||||
            ZoomInButton.KeyboardAccelerators.Add(virtualKey);
 | 
			
		||||
 | 
			
		||||
            if (Windows.Foundation.Metadata.ApiInformation.IsTypePresent("Windows.UI.Xaml.Media.ThemeShadow"))
 | 
			
		||||
@@ -144,7 +140,7 @@ namespace CalculatorApp
 | 
			
		||||
 | 
			
		||||
        public bool IsKeyGraphFeaturesVisible
 | 
			
		||||
        {
 | 
			
		||||
            get { return m_IsKeyGraphFeaturesVisible; }
 | 
			
		||||
            get => m_IsKeyGraphFeaturesVisible;
 | 
			
		||||
            private set
 | 
			
		||||
            {
 | 
			
		||||
                if (m_IsKeyGraphFeaturesVisible != value)
 | 
			
		||||
@@ -158,8 +154,8 @@ namespace CalculatorApp
 | 
			
		||||
 | 
			
		||||
        public bool IsSmallState
 | 
			
		||||
        {
 | 
			
		||||
            get { return (bool)GetValue(IsSmallStateProperty); }
 | 
			
		||||
            set { SetValue(IsSmallStateProperty, value); }
 | 
			
		||||
            get => (bool)GetValue(IsSmallStateProperty);
 | 
			
		||||
            set => SetValue(IsSmallStateProperty, value);
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        // Using a DependencyProperty as the backing store for IsSmallState.  This enables animation, styling, binding, etc...
 | 
			
		||||
@@ -168,8 +164,8 @@ namespace CalculatorApp
 | 
			
		||||
 | 
			
		||||
        public string GraphControlAutomationName
 | 
			
		||||
        {
 | 
			
		||||
            get { return (string)GetValue(GraphControlAutomationNameProperty); }
 | 
			
		||||
            set { SetValue(GraphControlAutomationNameProperty, value); }
 | 
			
		||||
            get => (string)GetValue(GraphControlAutomationNameProperty);
 | 
			
		||||
            set => SetValue(GraphControlAutomationNameProperty, value);
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        // Using a DependencyProperty as the backing store for GraphControlAutomationName.  This enables animation, styling, binding, etc...
 | 
			
		||||
@@ -178,7 +174,7 @@ namespace CalculatorApp
 | 
			
		||||
 | 
			
		||||
        public bool IsMatchAppTheme
 | 
			
		||||
        {
 | 
			
		||||
            get { return m_IsMatchAppTheme; }
 | 
			
		||||
            get => m_IsMatchAppTheme;
 | 
			
		||||
            private set
 | 
			
		||||
            {
 | 
			
		||||
                if (m_IsMatchAppTheme != value)
 | 
			
		||||
@@ -192,7 +188,7 @@ namespace CalculatorApp
 | 
			
		||||
 | 
			
		||||
        public bool IsManualAdjustment
 | 
			
		||||
        {
 | 
			
		||||
            get { return m_IsManualAdjustment; }
 | 
			
		||||
            get => m_IsManualAdjustment;
 | 
			
		||||
            set
 | 
			
		||||
            {
 | 
			
		||||
                if (m_IsManualAdjustment != value)
 | 
			
		||||
@@ -206,7 +202,7 @@ namespace CalculatorApp
 | 
			
		||||
 | 
			
		||||
        public CalculatorApp.ViewModel.GraphingCalculatorViewModel ViewModel
 | 
			
		||||
        {
 | 
			
		||||
            get { return m_viewModel; }
 | 
			
		||||
            get => m_viewModel;
 | 
			
		||||
            set
 | 
			
		||||
            {
 | 
			
		||||
                if (m_viewModel != value)
 | 
			
		||||
@@ -239,7 +235,7 @@ namespace CalculatorApp
 | 
			
		||||
            return numberOfVariables == 0 ? Visibility.Collapsed : Visibility.Visible;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        public static String GetTracingLegend(bool? isTracing)
 | 
			
		||||
        public static string GetTracingLegend(bool? isTracing)
 | 
			
		||||
        {
 | 
			
		||||
            var resProvider = AppResourceProvider.GetInstance();
 | 
			
		||||
            return isTracing != null && isTracing.Value ? resProvider.GetResourceString("disableTracingButtonToolTip")
 | 
			
		||||
@@ -374,8 +370,7 @@ namespace CalculatorApp
 | 
			
		||||
 | 
			
		||||
        private void OnTracePointChanged(double xPointValue, double yPointValue)
 | 
			
		||||
        {
 | 
			
		||||
            double xAxisMin, xAxisMax, yAxisMin, yAxisMax;
 | 
			
		||||
            GraphingControl.GetDisplayRanges(out xAxisMin, out xAxisMax, out yAxisMin, out yAxisMax);
 | 
			
		||||
            GraphingControl.GetDisplayRanges(out double xAxisMin, out double xAxisMax, out double yAxisMin, out double yAxisMax);
 | 
			
		||||
 | 
			
		||||
            TraceValue.Text = "(" + xPointValue.ToString("R") + ", " + yPointValue.ToString("N15") + ")";
 | 
			
		||||
 | 
			
		||||
@@ -523,8 +518,7 @@ namespace CalculatorApp
 | 
			
		||||
 | 
			
		||||
        private void GraphingControl_LosingFocus(UIElement sender, LosingFocusEventArgs args)
 | 
			
		||||
        {
 | 
			
		||||
            var newFocusElement = args.NewFocusedElement as FrameworkElement;
 | 
			
		||||
            if (newFocusElement == null || newFocusElement.Name == null)
 | 
			
		||||
            if (!(args.NewFocusedElement is FrameworkElement newFocusElement) || newFocusElement.Name == null)
 | 
			
		||||
            {
 | 
			
		||||
                // Because clicking on the swap chain panel will try to move focus to a control that can't actually take focus
 | 
			
		||||
                // we will get a null destination.  So we are going to try and cancel that request.
 | 
			
		||||
@@ -676,7 +670,7 @@ namespace CalculatorApp
 | 
			
		||||
        private void SwitchModeToggleButton_Toggled(object sender, RoutedEventArgs e)
 | 
			
		||||
        {
 | 
			
		||||
            var narratorNotifier = new NarratorNotifier();
 | 
			
		||||
            String announcementText;
 | 
			
		||||
            string announcementText;
 | 
			
		||||
            if (SwitchModeToggleButton.IsOn)
 | 
			
		||||
            {
 | 
			
		||||
                announcementText = AppResourceProvider.GetInstance().GetResourceString("GraphSwitchedToEquationModeAnnouncement");
 | 
			
		||||
@@ -700,15 +694,19 @@ namespace CalculatorApp
 | 
			
		||||
 | 
			
		||||
            if (m_graphFlyout == null)
 | 
			
		||||
            {
 | 
			
		||||
                m_graphFlyout = new Flyout();
 | 
			
		||||
                m_graphFlyout.Content = m_graphSettings;
 | 
			
		||||
                m_graphFlyout = new Flyout
 | 
			
		||||
                {
 | 
			
		||||
                    Content = m_graphSettings
 | 
			
		||||
                };
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            m_graphSettings.SetGrapher(this.GraphingControl);
 | 
			
		||||
            m_graphSettings.IsMatchAppTheme = IsMatchAppTheme;
 | 
			
		||||
 | 
			
		||||
            var options = new FlyoutShowOptions();
 | 
			
		||||
            options.Placement = FlyoutPlacementMode.BottomEdgeAlignedRight;
 | 
			
		||||
            var options = new FlyoutShowOptions
 | 
			
		||||
            {
 | 
			
		||||
                Placement = FlyoutPlacementMode.BottomEdgeAlignedRight
 | 
			
		||||
            };
 | 
			
		||||
            m_graphFlyout.ShowAt(GraphSettingsButton, options);
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
@@ -730,7 +728,6 @@ namespace CalculatorApp
 | 
			
		||||
        private void UpdateGraphAutomationName()
 | 
			
		||||
        {
 | 
			
		||||
            int numEquations = 0;
 | 
			
		||||
            double xAxisMin, xAxisMax, yAxisMin, yAxisMax;
 | 
			
		||||
 | 
			
		||||
            // Only count equations that are graphed
 | 
			
		||||
            foreach (var equation in ViewModel.Equations)
 | 
			
		||||
@@ -741,7 +738,7 @@ namespace CalculatorApp
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            GraphingControl.GetDisplayRanges(out xAxisMin, out xAxisMax, out yAxisMin, out yAxisMax);
 | 
			
		||||
            GraphingControl.GetDisplayRanges(out double xAxisMin, out double xAxisMax, out double yAxisMin, out double yAxisMax);
 | 
			
		||||
 | 
			
		||||
            GraphControlAutomationName = LocalizationStringUtil.GetLocalizedString(
 | 
			
		||||
                AppResourceProvider.GetInstance().GetResourceString("graphAutomationName"),
 | 
			
		||||
@@ -755,9 +752,9 @@ namespace CalculatorApp
 | 
			
		||||
        private void OnColorValuesChanged(UISettings sender, object args)
 | 
			
		||||
        {
 | 
			
		||||
            WeakReference weakThis = new WeakReference(this);
 | 
			
		||||
            _ = this.Dispatcher.RunAsync(CoreDispatcherPriority.Normal, new DispatchedHandler(() => {
 | 
			
		||||
                GraphingCalculator refThis = weakThis.Target as GraphingCalculator;
 | 
			
		||||
                if (refThis != null && IsMatchAppTheme)
 | 
			
		||||
            _ = this.Dispatcher.RunAsync(CoreDispatcherPriority.Normal, new DispatchedHandler(() =>
 | 
			
		||||
            {
 | 
			
		||||
                if (weakThis.Target is GraphingCalculator refThis && IsMatchAppTheme)
 | 
			
		||||
                {
 | 
			
		||||
                    refThis.UpdateGraphTheme();
 | 
			
		||||
                }
 | 
			
		||||
@@ -793,8 +790,7 @@ namespace CalculatorApp
 | 
			
		||||
            WeakReference weakThis = new WeakReference(this);
 | 
			
		||||
            _ = this.Dispatcher.RunAsync(CoreDispatcherPriority.Normal, new DispatchedHandler(() =>
 | 
			
		||||
            {
 | 
			
		||||
                var refThis = weakThis.Target as GraphingCalculator;
 | 
			
		||||
                if (refThis != null)
 | 
			
		||||
                if (weakThis.Target is GraphingCalculator refThis)
 | 
			
		||||
                {
 | 
			
		||||
                    refThis.UpdateGraphTheme();
 | 
			
		||||
                }
 | 
			
		||||
@@ -807,9 +803,9 @@ namespace CalculatorApp
 | 
			
		||||
        private const string sc_IsGraphThemeMatchApp = "IsGraphThemeMatchApp";
 | 
			
		||||
 | 
			
		||||
        private CalculatorApp.ViewModel.GraphingCalculatorViewModel m_viewModel;
 | 
			
		||||
        private Windows.UI.ViewManagement.AccessibilitySettings m_accessibilitySettings;
 | 
			
		||||
        private readonly Windows.UI.ViewManagement.AccessibilitySettings m_accessibilitySettings;
 | 
			
		||||
        private bool m_cursorShadowInitialized;
 | 
			
		||||
        private Windows.UI.ViewManagement.UISettings m_uiSettings;
 | 
			
		||||
        private readonly Windows.UI.ViewManagement.UISettings m_uiSettings;
 | 
			
		||||
        private Windows.UI.Xaml.Controls.Flyout m_graphFlyout;
 | 
			
		||||
        private CalculatorApp.GraphingSettings m_graphSettings;
 | 
			
		||||
 | 
			
		||||
@@ -843,8 +839,10 @@ namespace CalculatorApp
 | 
			
		||||
 | 
			
		||||
        private void GraphMenuFlyoutItem_Click(object sender, RoutedEventArgs e)
 | 
			
		||||
        {
 | 
			
		||||
            var dataPackage = new DataPackage();
 | 
			
		||||
            dataPackage.RequestedOperation = DataPackageOperation.Copy;
 | 
			
		||||
            var dataPackage = new DataPackage
 | 
			
		||||
            {
 | 
			
		||||
                RequestedOperation = DataPackageOperation.Copy
 | 
			
		||||
            };
 | 
			
		||||
 | 
			
		||||
            var bitmapStream = GraphingControl.GetGraphBitmapStream();
 | 
			
		||||
            dataPackage.SetBitmap(bitmapStream);
 | 
			
		||||
@@ -882,9 +880,11 @@ namespace CalculatorApp
 | 
			
		||||
        {
 | 
			
		||||
            // Something went wrong, notify the user.
 | 
			
		||||
            var resourceLoader = ResourceLoader.GetForCurrentView();
 | 
			
		||||
            var errDialog = new ContentDialog();
 | 
			
		||||
            errDialog.Content = resourceLoader.GetString("ShareActionErrorMessage");
 | 
			
		||||
            errDialog.CloseButtonText = resourceLoader.GetString("ShareActionErrorOk");
 | 
			
		||||
            var errDialog = new ContentDialog
 | 
			
		||||
            {
 | 
			
		||||
                Content = resourceLoader.GetString("ShareActionErrorMessage"),
 | 
			
		||||
                CloseButtonText = resourceLoader.GetString("ShareActionErrorOk")
 | 
			
		||||
            };
 | 
			
		||||
            _ = errDialog.ShowAsync();
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -1,22 +1,15 @@
 | 
			
		||||
// Copyright (c) Microsoft Corporation. All rights reserved.
 | 
			
		||||
// Licensed under the MIT License.
 | 
			
		||||
 | 
			
		||||
using System;
 | 
			
		||||
using System.Collections.Generic;
 | 
			
		||||
using System.Threading.Tasks;
 | 
			
		||||
using System.Diagnostics;
 | 
			
		||||
using CalculatorApp;
 | 
			
		||||
using CalculatorApp.ViewModel.Common;
 | 
			
		||||
 | 
			
		||||
using Windows.Foundation;
 | 
			
		||||
using Windows.Foundation.Collections;
 | 
			
		||||
using System;
 | 
			
		||||
using System.Collections.Generic;
 | 
			
		||||
 | 
			
		||||
using Windows.UI.Xaml;
 | 
			
		||||
using Windows.UI.Xaml.Controls;
 | 
			
		||||
using Windows.UI.Xaml.Controls.Primitives;
 | 
			
		||||
using Windows.UI.Xaml.Data;
 | 
			
		||||
using Windows.UI.Xaml.Input;
 | 
			
		||||
using Windows.UI.Xaml.Media;
 | 
			
		||||
using Windows.UI.Xaml.Navigation;
 | 
			
		||||
 | 
			
		||||
namespace CalculatorApp
 | 
			
		||||
{
 | 
			
		||||
@@ -152,8 +145,7 @@ namespace CalculatorApp
 | 
			
		||||
            var mathRichEdit = GetActiveRichEdit();
 | 
			
		||||
            if (mathRichEdit != null)
 | 
			
		||||
            {
 | 
			
		||||
                string text;
 | 
			
		||||
                mathRichEdit.TextDocument.GetText(Windows.UI.Text.TextGetOptions.NoHidden, out text);
 | 
			
		||||
                mathRichEdit.TextDocument.GetText(Windows.UI.Text.TextGetOptions.NoHidden, out string text);
 | 
			
		||||
 | 
			
		||||
                if (!string.IsNullOrEmpty(text))
 | 
			
		||||
                {
 | 
			
		||||
@@ -189,8 +181,7 @@ namespace CalculatorApp
 | 
			
		||||
        // Adding event because the ShowMode property is ignored in xaml.
 | 
			
		||||
        private void Flyout_Opening(object sender, object e)
 | 
			
		||||
        {
 | 
			
		||||
            var flyout = sender as Flyout;
 | 
			
		||||
            if (flyout != null)
 | 
			
		||||
            if (sender is Flyout flyout)
 | 
			
		||||
            {
 | 
			
		||||
                flyout.ShowMode = FlyoutShowMode.Transient;
 | 
			
		||||
            }
 | 
			
		||||
@@ -269,8 +260,7 @@ namespace CalculatorApp
 | 
			
		||||
 | 
			
		||||
        private static Tuple<string, int, int> GetButtonOutput(NumbersAndOperatorsEnum id)
 | 
			
		||||
        {
 | 
			
		||||
            Tuple<string, int, int> output;
 | 
			
		||||
            if (buttonOutput.TryGetValue(id, out output))
 | 
			
		||||
            if (buttonOutput.TryGetValue(id, out Tuple<string, int, int> output))
 | 
			
		||||
            {
 | 
			
		||||
                return output;
 | 
			
		||||
            }
 | 
			
		||||
 
 | 
			
		||||
@@ -3,28 +3,15 @@
 | 
			
		||||
// Declaration of the MyUserControl class
 | 
			
		||||
//
 | 
			
		||||
 | 
			
		||||
using System;
 | 
			
		||||
using System.Collections.Generic;
 | 
			
		||||
using System.Threading.Tasks;
 | 
			
		||||
using System.Diagnostics;
 | 
			
		||||
 | 
			
		||||
//using Graphing;
 | 
			
		||||
using GraphControl;
 | 
			
		||||
using CalculatorApp;
 | 
			
		||||
using CalculatorApp.ViewModel;
 | 
			
		||||
using CalculatorApp.ViewModel.Common;
 | 
			
		||||
 | 
			
		||||
using Windows.Foundation;
 | 
			
		||||
using Windows.Foundation.Collections;
 | 
			
		||||
using Windows.Storage;
 | 
			
		||||
using Windows.System;
 | 
			
		||||
using Windows.UI.Xaml;
 | 
			
		||||
using Windows.UI.Xaml.Controls;
 | 
			
		||||
using Windows.UI.Xaml.Controls.Primitives;
 | 
			
		||||
using Windows.UI.Xaml.Data;
 | 
			
		||||
using Windows.UI.Xaml.Input;
 | 
			
		||||
using Windows.UI.Xaml.Media;
 | 
			
		||||
using Windows.UI.Xaml.Navigation;
 | 
			
		||||
 | 
			
		||||
namespace CalculatorApp
 | 
			
		||||
{
 | 
			
		||||
@@ -33,20 +20,16 @@ namespace CalculatorApp
 | 
			
		||||
    {
 | 
			
		||||
        public GraphingSettings()
 | 
			
		||||
        {
 | 
			
		||||
            m_ViewModel = new GraphingSettingsViewModel();
 | 
			
		||||
            ViewModel = new GraphingSettingsViewModel();
 | 
			
		||||
            m_IsMatchAppTheme = false;
 | 
			
		||||
            InitializeComponent();
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        public CalculatorApp.ViewModel.GraphingSettingsViewModel ViewModel
 | 
			
		||||
        {
 | 
			
		||||
            get { return m_ViewModel; }
 | 
			
		||||
            set { m_ViewModel = value; }
 | 
			
		||||
        }
 | 
			
		||||
        public CalculatorApp.ViewModel.GraphingSettingsViewModel ViewModel { get; set; }
 | 
			
		||||
 | 
			
		||||
        public bool IsMatchAppTheme
 | 
			
		||||
        {
 | 
			
		||||
            get { return m_IsMatchAppTheme; }
 | 
			
		||||
            get => m_IsMatchAppTheme;
 | 
			
		||||
            set
 | 
			
		||||
            {
 | 
			
		||||
                if (m_IsMatchAppTheme == value)
 | 
			
		||||
@@ -73,7 +56,7 @@ namespace CalculatorApp
 | 
			
		||||
 | 
			
		||||
        public void SetGrapher(GraphControl.Grapher grapher)
 | 
			
		||||
        {
 | 
			
		||||
            m_ViewModel.SetGrapher(grapher);
 | 
			
		||||
            ViewModel.SetGrapher(grapher);
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        public void RefreshRanges()
 | 
			
		||||
@@ -133,6 +116,5 @@ namespace CalculatorApp
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        private bool m_IsMatchAppTheme;
 | 
			
		||||
        private CalculatorApp.ViewModel.GraphingSettingsViewModel m_ViewModel;
 | 
			
		||||
    };
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -1,18 +1,10 @@
 | 
			
		||||
// Copyright (c) Microsoft Corporation. All rights reserved.
 | 
			
		||||
// Licensed under the MIT License.
 | 
			
		||||
 | 
			
		||||
using System;
 | 
			
		||||
using System.Collections.Generic;
 | 
			
		||||
using System.Threading.Tasks;
 | 
			
		||||
using System.Diagnostics;
 | 
			
		||||
using CalculatorApp;
 | 
			
		||||
using CalculatorApp.ViewModel;
 | 
			
		||||
 | 
			
		||||
using Windows.UI;
 | 
			
		||||
using Windows.UI.Xaml;
 | 
			
		||||
using Windows.UI.Xaml.Controls;
 | 
			
		||||
using System.ComponentModel;
 | 
			
		||||
 | 
			
		||||
using Windows.UI.Xaml;
 | 
			
		||||
 | 
			
		||||
namespace CalculatorApp
 | 
			
		||||
{
 | 
			
		||||
    public sealed partial class KeyGraphFeaturesPanel : System.ComponentModel.INotifyPropertyChanged
 | 
			
		||||
@@ -33,7 +25,7 @@ namespace CalculatorApp
 | 
			
		||||
 | 
			
		||||
        public CalculatorApp.ViewModel.EquationViewModel ViewModel
 | 
			
		||||
        {
 | 
			
		||||
            get { return m_viewModel; }
 | 
			
		||||
            get => m_viewModel;
 | 
			
		||||
            set
 | 
			
		||||
            {
 | 
			
		||||
                if (m_viewModel != value)
 | 
			
		||||
 
 | 
			
		||||
@@ -1,8 +1,9 @@
 | 
			
		||||
using CalculatorApp.ViewModel;
 | 
			
		||||
using CalculatorApp.ViewModel.Common;
 | 
			
		||||
using System;
 | 
			
		||||
 | 
			
		||||
using Windows.UI.Xaml;
 | 
			
		||||
using Windows.UI.Xaml.Controls;
 | 
			
		||||
 | 
			
		||||
using MUXC = Microsoft.UI.Xaml.Controls;
 | 
			
		||||
 | 
			
		||||
// The User Control item template is documented at https://go.microsoft.com/fwlink/?LinkId=234236
 | 
			
		||||
@@ -19,10 +20,7 @@ namespace CalculatorApp
 | 
			
		||||
            HistoryEmpty.FlowDirection = LocalizationService.GetInstance().GetFlowDirection();
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        public CalculatorApp.ViewModel.HistoryViewModel Model
 | 
			
		||||
        {
 | 
			
		||||
            get => (CalculatorApp.ViewModel.HistoryViewModel)DataContext;
 | 
			
		||||
        }
 | 
			
		||||
        public CalculatorApp.ViewModel.HistoryViewModel Model => (CalculatorApp.ViewModel.HistoryViewModel)DataContext;
 | 
			
		||||
 | 
			
		||||
        public void ScrollToBottom()
 | 
			
		||||
        {
 | 
			
		||||
@@ -35,8 +33,8 @@ namespace CalculatorApp
 | 
			
		||||
 | 
			
		||||
        public Windows.UI.Xaml.GridLength RowHeight
 | 
			
		||||
        {
 | 
			
		||||
            get { return (Windows.UI.Xaml.GridLength)GetValue(RowHeightProperty); }
 | 
			
		||||
            set { SetValue(RowHeightProperty, value); }
 | 
			
		||||
            get => (Windows.UI.Xaml.GridLength)GetValue(RowHeightProperty);
 | 
			
		||||
            set => SetValue(RowHeightProperty, value);
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        // Using a DependencyProperty as the backing store for RowHeight.  This enables animation, styling, binding, etc...
 | 
			
		||||
 
 | 
			
		||||
@@ -3,9 +3,11 @@ using CalculatorApp.Converters;
 | 
			
		||||
using CalculatorApp.ViewModel;
 | 
			
		||||
using CalculatorApp.ViewModel.Common;
 | 
			
		||||
using CalculatorApp.ViewModel.Common.Automation;
 | 
			
		||||
 | 
			
		||||
using System;
 | 
			
		||||
using System.Collections.Generic;
 | 
			
		||||
using System.ComponentModel;
 | 
			
		||||
 | 
			
		||||
using Windows.Foundation;
 | 
			
		||||
using Windows.Graphics.Display;
 | 
			
		||||
using Windows.Storage;
 | 
			
		||||
@@ -17,6 +19,7 @@ using Windows.UI.Xaml.Controls;
 | 
			
		||||
using Windows.UI.Xaml.Controls.Primitives;
 | 
			
		||||
using Windows.UI.Xaml.Data;
 | 
			
		||||
using Windows.UI.Xaml.Navigation;
 | 
			
		||||
 | 
			
		||||
using MUXC = Microsoft.UI.Xaml.Controls;
 | 
			
		||||
 | 
			
		||||
namespace CalculatorApp
 | 
			
		||||
@@ -31,27 +34,27 @@ namespace CalculatorApp
 | 
			
		||||
 | 
			
		||||
        public List<object> NavViewCategoriesSource
 | 
			
		||||
        {
 | 
			
		||||
            get { return (List<object>)GetValue(NavViewCategoriesSourceProperty); }
 | 
			
		||||
            set { SetValue(NavViewCategoriesSourceProperty, value); }
 | 
			
		||||
            get => (List<object>)GetValue(NavViewCategoriesSourceProperty);
 | 
			
		||||
            set => SetValue(NavViewCategoriesSourceProperty, value);
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        public ApplicationViewModel Model => m_model;
 | 
			
		||||
        public ApplicationViewModel Model { get; }
 | 
			
		||||
 | 
			
		||||
        public MainPage()
 | 
			
		||||
        {
 | 
			
		||||
            m_model = new ApplicationViewModel();
 | 
			
		||||
            Model = new ApplicationViewModel();
 | 
			
		||||
            InitializeNavViewCategoriesSource();
 | 
			
		||||
            InitializeComponent();
 | 
			
		||||
 | 
			
		||||
            KeyboardShortcutManager.Initialize();
 | 
			
		||||
 | 
			
		||||
            Application.Current.Suspending += App_Suspending;
 | 
			
		||||
            m_model.PropertyChanged += OnAppPropertyChanged;
 | 
			
		||||
            Model.PropertyChanged += OnAppPropertyChanged;
 | 
			
		||||
            m_accessibilitySettings = new AccessibilitySettings();
 | 
			
		||||
 | 
			
		||||
            if(Utilities.GetIntegratedDisplaySize(out var sizeInInches))
 | 
			
		||||
            if (Utilities.GetIntegratedDisplaySize(out var sizeInInches))
 | 
			
		||||
            {
 | 
			
		||||
                if(sizeInInches < 7.0) // If device's display size (diagonal length) is less than 7 inches then keep the calc always in Portrait mode only
 | 
			
		||||
                if (sizeInInches < 7.0) // If device's display size (diagonal length) is less than 7 inches then keep the calc always in Portrait mode only
 | 
			
		||||
                {
 | 
			
		||||
                    DisplayInformation.AutoRotationPreferences = DisplayOrientations.Portrait | DisplayOrientations.PortraitFlipped;
 | 
			
		||||
                }
 | 
			
		||||
@@ -91,7 +94,7 @@ namespace CalculatorApp
 | 
			
		||||
 | 
			
		||||
        public void SetHeaderAutomationName()
 | 
			
		||||
        {
 | 
			
		||||
            ViewMode mode = m_model.Mode;
 | 
			
		||||
            ViewMode mode = Model.Mode;
 | 
			
		||||
            var resProvider = AppResourceProvider.GetInstance();
 | 
			
		||||
 | 
			
		||||
            string name;
 | 
			
		||||
@@ -110,7 +113,7 @@ namespace CalculatorApp
 | 
			
		||||
                {
 | 
			
		||||
                    full = resProvider.GetResourceString("HeaderAutomationName_Converter");
 | 
			
		||||
                }
 | 
			
		||||
                name = LocalizationStringUtil.GetLocalizedString(full, m_model.CategoryName);
 | 
			
		||||
                name = LocalizationStringUtil.GetLocalizedString(full, Model.CategoryName);
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            AutomationProperties.SetName(Header, name);
 | 
			
		||||
@@ -134,7 +137,7 @@ namespace CalculatorApp
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            m_model.Initialize(initialMode);
 | 
			
		||||
            Model.Initialize(initialMode);
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        private void InitializeNavViewCategoriesSource()
 | 
			
		||||
@@ -150,7 +153,7 @@ namespace CalculatorApp
 | 
			
		||||
            {
 | 
			
		||||
                var graphCategory = (NavCategory)NavViewCategoriesSource.Find(x =>
 | 
			
		||||
                {
 | 
			
		||||
                    if(x is NavCategory category)
 | 
			
		||||
                    if (x is NavCategory category)
 | 
			
		||||
                    {
 | 
			
		||||
                        return category.ViewMode == ViewMode.Graphing;
 | 
			
		||||
                    }
 | 
			
		||||
@@ -166,10 +169,10 @@ namespace CalculatorApp
 | 
			
		||||
        private List<object> ExpandNavViewCategoryGroups(IEnumerable<NavCategoryGroup> groups)
 | 
			
		||||
        {
 | 
			
		||||
            var result = new List<object>();
 | 
			
		||||
            foreach(var group in groups)
 | 
			
		||||
            foreach (var group in groups)
 | 
			
		||||
            {
 | 
			
		||||
                result.Add(group);
 | 
			
		||||
                foreach(var category in group.Categories)
 | 
			
		||||
                foreach (var category in group.Categories)
 | 
			
		||||
                {
 | 
			
		||||
                    result.Add(category);
 | 
			
		||||
                }
 | 
			
		||||
@@ -179,7 +182,7 @@ namespace CalculatorApp
 | 
			
		||||
 | 
			
		||||
        private void UpdatePopupSize(Windows.UI.Core.WindowSizeChangedEventArgs e)
 | 
			
		||||
        {
 | 
			
		||||
            if(PopupContent != null)
 | 
			
		||||
            if (PopupContent != null)
 | 
			
		||||
            {
 | 
			
		||||
                PopupContent.Width = e.Size.Width;
 | 
			
		||||
                PopupContent.Height = e.Size.Height;
 | 
			
		||||
@@ -198,43 +201,43 @@ namespace CalculatorApp
 | 
			
		||||
            string propertyName = e.PropertyName;
 | 
			
		||||
            if (propertyName == ApplicationViewModel.ModePropertyName)
 | 
			
		||||
            {
 | 
			
		||||
                ViewMode newValue = m_model.Mode;
 | 
			
		||||
                ViewMode previousMode = m_model.PreviousMode;
 | 
			
		||||
                ViewMode newValue = Model.Mode;
 | 
			
		||||
                ViewMode previousMode = Model.PreviousMode;
 | 
			
		||||
 | 
			
		||||
                KeyboardShortcutManager.DisableShortcuts(false);
 | 
			
		||||
 | 
			
		||||
                if (newValue == ViewMode.Standard)
 | 
			
		||||
                {
 | 
			
		||||
                    EnsureCalculator();
 | 
			
		||||
                    m_model.CalculatorViewModel.HistoryVM.AreHistoryShortcutsEnabled = true;
 | 
			
		||||
                    Model.CalculatorViewModel.HistoryVM.AreHistoryShortcutsEnabled = true;
 | 
			
		||||
                    m_calculator.AnimateCalculator(NavCategory.IsConverterViewMode(previousMode));
 | 
			
		||||
                    m_model.CalculatorViewModel.HistoryVM.ReloadHistory(newValue);
 | 
			
		||||
                    Model.CalculatorViewModel.HistoryVM.ReloadHistory(newValue);
 | 
			
		||||
                }
 | 
			
		||||
                else if (newValue == ViewMode.Scientific)
 | 
			
		||||
                {
 | 
			
		||||
                    EnsureCalculator();
 | 
			
		||||
                    m_model.CalculatorViewModel.HistoryVM.AreHistoryShortcutsEnabled = true;
 | 
			
		||||
                    if (m_model.PreviousMode != ViewMode.Scientific)
 | 
			
		||||
                    Model.CalculatorViewModel.HistoryVM.AreHistoryShortcutsEnabled = true;
 | 
			
		||||
                    if (Model.PreviousMode != ViewMode.Scientific)
 | 
			
		||||
                    {
 | 
			
		||||
                        m_calculator.AnimateCalculator(NavCategory.IsConverterViewMode(previousMode));
 | 
			
		||||
                    }
 | 
			
		||||
 | 
			
		||||
                    m_model.CalculatorViewModel.HistoryVM.ReloadHistory(newValue);
 | 
			
		||||
                    Model.CalculatorViewModel.HistoryVM.ReloadHistory(newValue);
 | 
			
		||||
                }
 | 
			
		||||
                else if (newValue == ViewMode.Programmer)
 | 
			
		||||
                {
 | 
			
		||||
                    m_model.CalculatorViewModel.HistoryVM.AreHistoryShortcutsEnabled = false;
 | 
			
		||||
                    Model.CalculatorViewModel.HistoryVM.AreHistoryShortcutsEnabled = false;
 | 
			
		||||
                    EnsureCalculator();
 | 
			
		||||
                    if (m_model.PreviousMode != ViewMode.Programmer)
 | 
			
		||||
                    if (Model.PreviousMode != ViewMode.Programmer)
 | 
			
		||||
                    {
 | 
			
		||||
                        m_calculator.AnimateCalculator(NavCategory.IsConverterViewMode(previousMode));
 | 
			
		||||
                    }
 | 
			
		||||
                }
 | 
			
		||||
                else if (NavCategory.IsDateCalculatorViewMode(newValue))
 | 
			
		||||
                {
 | 
			
		||||
                    if (m_model.CalculatorViewModel != null)
 | 
			
		||||
                    if (Model.CalculatorViewModel != null)
 | 
			
		||||
                    {
 | 
			
		||||
                        m_model.CalculatorViewModel.HistoryVM.AreHistoryShortcutsEnabled = false;
 | 
			
		||||
                        Model.CalculatorViewModel.HistoryVM.AreHistoryShortcutsEnabled = false;
 | 
			
		||||
                    }
 | 
			
		||||
                    EnsureDateCalculator();
 | 
			
		||||
                }
 | 
			
		||||
@@ -245,9 +248,9 @@ namespace CalculatorApp
 | 
			
		||||
                }
 | 
			
		||||
                else if (NavCategory.IsConverterViewMode(newValue))
 | 
			
		||||
                {
 | 
			
		||||
                    if (m_model.CalculatorViewModel != null)
 | 
			
		||||
                    if (Model.CalculatorViewModel != null)
 | 
			
		||||
                    {
 | 
			
		||||
                        m_model.CalculatorViewModel.HistoryVM.AreHistoryShortcutsEnabled = false;
 | 
			
		||||
                        Model.CalculatorViewModel.HistoryVM.AreHistoryShortcutsEnabled = false;
 | 
			
		||||
                    }
 | 
			
		||||
 | 
			
		||||
                    EnsureConverter();
 | 
			
		||||
@@ -359,7 +362,7 @@ namespace CalculatorApp
 | 
			
		||||
 | 
			
		||||
        private void OnNavSelectionChanged(object sender, MUXC.NavigationViewSelectionChangedEventArgs e)
 | 
			
		||||
        {
 | 
			
		||||
            if(e.IsSettingsSelected)
 | 
			
		||||
            if (e.IsSettingsSelected)
 | 
			
		||||
            {
 | 
			
		||||
                ShowSettingsPopup();
 | 
			
		||||
                return;
 | 
			
		||||
@@ -423,10 +426,10 @@ namespace CalculatorApp
 | 
			
		||||
        private void UpdateViewState()
 | 
			
		||||
        {
 | 
			
		||||
            // All layout related view states are now handled only inside individual controls (standard, scientific, programmer, date, converter)
 | 
			
		||||
            if (NavCategory.IsConverterViewMode(m_model.Mode))
 | 
			
		||||
            if (NavCategory.IsConverterViewMode(Model.Mode))
 | 
			
		||||
            {
 | 
			
		||||
                int modeIndex = NavCategoryStates.GetIndexInGroup(m_model.Mode, CategoryGroupType.Converter);
 | 
			
		||||
                m_model.ConverterViewModel.CurrentCategory = m_model.ConverterViewModel.Categories[modeIndex];
 | 
			
		||||
                int modeIndex = NavCategoryStates.GetIndexInGroup(Model.Mode, CategoryGroupType.Converter);
 | 
			
		||||
                Model.ConverterViewModel.CurrentCategory = Model.ConverterViewModel.Categories[modeIndex];
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
@@ -453,7 +456,7 @@ namespace CalculatorApp
 | 
			
		||||
            {
 | 
			
		||||
                // We have just launched into our default mode (standard calc) so ensure calc is loaded
 | 
			
		||||
                EnsureCalculator();
 | 
			
		||||
                m_model.CalculatorViewModel.IsStandard = true;
 | 
			
		||||
                Model.CalculatorViewModel.IsStandard = true;
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            Window.Current.SizeChanged += WindowSizeChanged;
 | 
			
		||||
@@ -477,7 +480,7 @@ namespace CalculatorApp
 | 
			
		||||
 | 
			
		||||
        private void App_Suspending(object sender, Windows.ApplicationModel.SuspendingEventArgs e)
 | 
			
		||||
        {
 | 
			
		||||
            if (m_model.IsAlwaysOnTop)
 | 
			
		||||
            if (Model.IsAlwaysOnTop)
 | 
			
		||||
            {
 | 
			
		||||
                ApplicationDataContainer localSettings = ApplicationData.Current.LocalSettings;
 | 
			
		||||
                localSettings.Values[ApplicationViewModel.WidthLocalSettings] = ActualWidth;
 | 
			
		||||
@@ -490,20 +493,30 @@ namespace CalculatorApp
 | 
			
		||||
            if (m_calculator == null)
 | 
			
		||||
            {
 | 
			
		||||
                // delay load calculator.
 | 
			
		||||
                m_calculator = new Calculator();
 | 
			
		||||
                m_calculator.Name = "Calculator";
 | 
			
		||||
                m_calculator.DataContext = m_model.CalculatorViewModel;
 | 
			
		||||
                Binding isStandardBinding = new Binding();
 | 
			
		||||
                isStandardBinding.Path = new PropertyPath("IsStandard");
 | 
			
		||||
                m_calculator = new Calculator
 | 
			
		||||
                {
 | 
			
		||||
                    Name = "Calculator",
 | 
			
		||||
                    DataContext = Model.CalculatorViewModel
 | 
			
		||||
                };
 | 
			
		||||
                Binding isStandardBinding = new Binding
 | 
			
		||||
                {
 | 
			
		||||
                    Path = new PropertyPath("IsStandard")
 | 
			
		||||
                };
 | 
			
		||||
                m_calculator.SetBinding(Calculator.IsStandardProperty, isStandardBinding);
 | 
			
		||||
                Binding isScientificBinding = new Binding();
 | 
			
		||||
                isScientificBinding.Path = new PropertyPath("IsScientific");
 | 
			
		||||
                Binding isScientificBinding = new Binding
 | 
			
		||||
                {
 | 
			
		||||
                    Path = new PropertyPath("IsScientific")
 | 
			
		||||
                };
 | 
			
		||||
                m_calculator.SetBinding(Calculator.IsScientificProperty, isScientificBinding);
 | 
			
		||||
                Binding isProgramerBinding = new Binding();
 | 
			
		||||
                isProgramerBinding.Path = new PropertyPath("IsProgrammer");
 | 
			
		||||
                Binding isProgramerBinding = new Binding
 | 
			
		||||
                {
 | 
			
		||||
                    Path = new PropertyPath("IsProgrammer")
 | 
			
		||||
                };
 | 
			
		||||
                m_calculator.SetBinding(Calculator.IsProgrammerProperty, isProgramerBinding);
 | 
			
		||||
                Binding isAlwaysOnTopBinding = new Binding();
 | 
			
		||||
                isAlwaysOnTopBinding.Path = new PropertyPath("IsAlwaysOnTop");
 | 
			
		||||
                Binding isAlwaysOnTopBinding = new Binding
 | 
			
		||||
                {
 | 
			
		||||
                    Path = new PropertyPath("IsAlwaysOnTop")
 | 
			
		||||
                };
 | 
			
		||||
                m_calculator.SetBinding(Calculator.IsAlwaysOnTopProperty, isAlwaysOnTopBinding);
 | 
			
		||||
                m_calculator.Style = CalculatorBaseStyle;
 | 
			
		||||
 | 
			
		||||
@@ -526,9 +539,11 @@ namespace CalculatorApp
 | 
			
		||||
            if (m_dateCalculator == null)
 | 
			
		||||
            {
 | 
			
		||||
                // delay loading converter
 | 
			
		||||
                m_dateCalculator = new DateCalculator();
 | 
			
		||||
                m_dateCalculator.Name = "dateCalculator";
 | 
			
		||||
                m_dateCalculator.DataContext = m_model.DateCalcViewModel;
 | 
			
		||||
                m_dateCalculator = new DateCalculator
 | 
			
		||||
                {
 | 
			
		||||
                    Name = "dateCalculator",
 | 
			
		||||
                    DataContext = Model.DateCalcViewModel
 | 
			
		||||
                };
 | 
			
		||||
 | 
			
		||||
                DateCalcHolder.Child = m_dateCalculator;
 | 
			
		||||
            }
 | 
			
		||||
@@ -544,9 +559,11 @@ namespace CalculatorApp
 | 
			
		||||
        {
 | 
			
		||||
            if (m_graphingCalculator == null)
 | 
			
		||||
            {
 | 
			
		||||
                m_graphingCalculator = new GraphingCalculator();
 | 
			
		||||
                m_graphingCalculator.Name = "GraphingCalculator";
 | 
			
		||||
                m_graphingCalculator.DataContext = m_model.GraphingCalcViewModel;
 | 
			
		||||
                m_graphingCalculator = new GraphingCalculator
 | 
			
		||||
                {
 | 
			
		||||
                    Name = "GraphingCalculator",
 | 
			
		||||
                    DataContext = Model.GraphingCalcViewModel
 | 
			
		||||
                };
 | 
			
		||||
 | 
			
		||||
                GraphingCalcHolder.Child = m_graphingCalculator;
 | 
			
		||||
            }
 | 
			
		||||
@@ -557,10 +574,12 @@ namespace CalculatorApp
 | 
			
		||||
            if (m_converter == null)
 | 
			
		||||
            {
 | 
			
		||||
                // delay loading converter
 | 
			
		||||
                m_converter = new CalculatorApp.UnitConverter();
 | 
			
		||||
                m_converter.Name = "unitConverter";
 | 
			
		||||
                m_converter.DataContext = m_model.ConverterViewModel;
 | 
			
		||||
                m_converter.Style = UnitConverterBaseStyle;
 | 
			
		||||
                m_converter = new CalculatorApp.UnitConverter
 | 
			
		||||
                {
 | 
			
		||||
                    Name = "unitConverter",
 | 
			
		||||
                    DataContext = Model.ConverterViewModel,
 | 
			
		||||
                    Style = UnitConverterBaseStyle
 | 
			
		||||
                };
 | 
			
		||||
                ConverterHolder.Child = m_converter;
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
@@ -596,7 +615,6 @@ namespace CalculatorApp
 | 
			
		||||
        private GraphingCalculator m_graphingCalculator;
 | 
			
		||||
        private UnitConverter m_converter;
 | 
			
		||||
        private DateCalculator m_dateCalculator;
 | 
			
		||||
        private ApplicationViewModel m_model;
 | 
			
		||||
        private AccessibilitySettings m_accessibilitySettings;
 | 
			
		||||
        private readonly AccessibilitySettings m_accessibilitySettings;
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -1,6 +1,6 @@
 | 
			
		||||
using CalculatorApp.ViewModel;
 | 
			
		||||
using CalculatorApp.ViewModel.Common;
 | 
			
		||||
using System;
 | 
			
		||||
 | 
			
		||||
using Windows.UI.Xaml;
 | 
			
		||||
using Windows.UI.Xaml.Controls;
 | 
			
		||||
 | 
			
		||||
@@ -17,18 +17,12 @@ namespace CalculatorApp
 | 
			
		||||
            MemoryPaneEmpty.FlowDirection = LocalizationService.GetInstance().GetFlowDirection();
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        public CalculatorApp.ViewModel.StandardCalculatorViewModel Model
 | 
			
		||||
        {
 | 
			
		||||
            get
 | 
			
		||||
            {
 | 
			
		||||
                return (CalculatorApp.ViewModel.StandardCalculatorViewModel)this.DataContext;
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
        public CalculatorApp.ViewModel.StandardCalculatorViewModel Model => (CalculatorApp.ViewModel.StandardCalculatorViewModel)this.DataContext;
 | 
			
		||||
 | 
			
		||||
        public GridLength RowHeight
 | 
			
		||||
        {
 | 
			
		||||
            get { return (GridLength)GetValue(RowHeightProperty); }
 | 
			
		||||
            set { SetValue(RowHeightProperty, value); }
 | 
			
		||||
            get => (GridLength)GetValue(RowHeightProperty);
 | 
			
		||||
            set => SetValue(RowHeightProperty, value);
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        // Using a DependencyProperty as the backing store for RowHeight.  This enables animation, styling, binding, etc...
 | 
			
		||||
 
 | 
			
		||||
@@ -1,5 +1,4 @@
 | 
			
		||||
using System;
 | 
			
		||||
using Windows.UI.Xaml;
 | 
			
		||||
using Windows.UI.Xaml;
 | 
			
		||||
using Windows.UI.Xaml.Controls;
 | 
			
		||||
 | 
			
		||||
// The User Control item template is documented at https://go.microsoft.com/fwlink/?LinkId=234236
 | 
			
		||||
@@ -16,8 +15,8 @@ namespace CalculatorApp
 | 
			
		||||
 | 
			
		||||
        public CalculatorApp.ViewModel.MemoryItemViewModel Model
 | 
			
		||||
        {
 | 
			
		||||
            get { return (CalculatorApp.ViewModel.MemoryItemViewModel)GetValue(ModelProperty); }
 | 
			
		||||
            set { SetValue(ModelProperty, value); }
 | 
			
		||||
            get => (CalculatorApp.ViewModel.MemoryItemViewModel)GetValue(ModelProperty);
 | 
			
		||||
            set => SetValue(ModelProperty, value);
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        // Using a DependencyProperty as the backing store for Model.  This enables animation, styling, binding, etc...
 | 
			
		||||
 
 | 
			
		||||
@@ -1,4 +1,5 @@
 | 
			
		||||
using CalculatorApp.ViewModel.Common;
 | 
			
		||||
 | 
			
		||||
using Windows.UI.Xaml;
 | 
			
		||||
using Windows.UI.Xaml.Controls;
 | 
			
		||||
 | 
			
		||||
@@ -30,8 +31,8 @@ namespace CalculatorApp
 | 
			
		||||
 | 
			
		||||
        public Windows.UI.Xaml.Style ButtonStyle
 | 
			
		||||
        {
 | 
			
		||||
            get { return (Windows.UI.Xaml.Style)GetValue(ButtonStyleProperty); }
 | 
			
		||||
            set { SetValue(ButtonStyleProperty, value); }
 | 
			
		||||
            get => (Windows.UI.Xaml.Style)GetValue(ButtonStyleProperty);
 | 
			
		||||
            set => SetValue(ButtonStyleProperty, value);
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        // Using a DependencyProperty as the backing store for ButtonStyle.  This enables animation, styling, binding, etc...
 | 
			
		||||
@@ -40,8 +41,8 @@ namespace CalculatorApp
 | 
			
		||||
 | 
			
		||||
        public CalculatorApp.ViewModel.Common.NumberBase CurrentRadixType
 | 
			
		||||
        {
 | 
			
		||||
            get { return (CalculatorApp.ViewModel.Common.NumberBase)GetValue(CurrentRadixTypeProperty); }
 | 
			
		||||
            set { SetValue(CurrentRadixTypeProperty, value); }
 | 
			
		||||
            get => (CalculatorApp.ViewModel.Common.NumberBase)GetValue(CurrentRadixTypeProperty);
 | 
			
		||||
            set => SetValue(CurrentRadixTypeProperty, value);
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        // Using a DependencyProperty as the backing store for CurrentRadixType.  This enables animation, styling, binding, etc...
 | 
			
		||||
@@ -54,7 +55,7 @@ namespace CalculatorApp
 | 
			
		||||
 | 
			
		||||
        public bool IsErrorVisualState
 | 
			
		||||
        {
 | 
			
		||||
            get { return m_isErrorVisualState; }
 | 
			
		||||
            get => m_isErrorVisualState;
 | 
			
		||||
            set
 | 
			
		||||
            {
 | 
			
		||||
                if (m_isErrorVisualState != value)
 | 
			
		||||
 
 | 
			
		||||
@@ -8,10 +8,7 @@ namespace CalculatorApp
 | 
			
		||||
    [Windows.Foundation.Metadata.WebHostHidden]
 | 
			
		||||
    public sealed partial class OperatorsPanel : UserControl
 | 
			
		||||
    {
 | 
			
		||||
        public CalculatorApp.ViewModel.StandardCalculatorViewModel Model
 | 
			
		||||
        {
 | 
			
		||||
            get => (CalculatorApp.ViewModel.StandardCalculatorViewModel)DataContext;
 | 
			
		||||
        }
 | 
			
		||||
        public CalculatorApp.ViewModel.StandardCalculatorViewModel Model => (CalculatorApp.ViewModel.StandardCalculatorViewModel)DataContext;
 | 
			
		||||
 | 
			
		||||
        public OperatorsPanel()
 | 
			
		||||
        {
 | 
			
		||||
@@ -20,8 +17,8 @@ namespace CalculatorApp
 | 
			
		||||
 | 
			
		||||
        public bool IsBitFlipChecked
 | 
			
		||||
        {
 | 
			
		||||
            get { return (bool)GetValue(IsBitFlipCheckedProperty); }
 | 
			
		||||
            set { SetValue(IsBitFlipCheckedProperty, value); }
 | 
			
		||||
            get => (bool)GetValue(IsBitFlipCheckedProperty);
 | 
			
		||||
            set => SetValue(IsBitFlipCheckedProperty, value);
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        // Using a DependencyProperty as the backing store for IsBitFlipChecked.  This enables animation, styling, binding, etc...
 | 
			
		||||
@@ -34,8 +31,8 @@ namespace CalculatorApp
 | 
			
		||||
 | 
			
		||||
        public bool IsErrorVisualState
 | 
			
		||||
        {
 | 
			
		||||
            get { return (bool)GetValue(IsErrorVisualStateProperty); }
 | 
			
		||||
            set { SetValue(IsErrorVisualStateProperty, value); }
 | 
			
		||||
            get => (bool)GetValue(IsErrorVisualStateProperty);
 | 
			
		||||
            set => SetValue(IsErrorVisualStateProperty, value);
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        // Using a DependencyProperty as the backing store for IsErrorVisualState.  This enables animation, styling, binding, etc...
 | 
			
		||||
@@ -46,7 +43,7 @@ namespace CalculatorApp
 | 
			
		||||
                self.OnIsErrorVisualStatePropertyChanged((bool)args.OldValue, (bool)args.NewValue);
 | 
			
		||||
            }));
 | 
			
		||||
 | 
			
		||||
        void OnIsBitFlipCheckedPropertyChanged(bool oldValue, bool newValue)
 | 
			
		||||
        private void OnIsBitFlipCheckedPropertyChanged(bool oldValue, bool newValue)
 | 
			
		||||
        {
 | 
			
		||||
            if (newValue)
 | 
			
		||||
            {
 | 
			
		||||
 
 | 
			
		||||
@@ -1,21 +1,18 @@
 | 
			
		||||
using CalculatorApp.Utils;
 | 
			
		||||
using CalculatorApp.ViewModel.Common;
 | 
			
		||||
using System;
 | 
			
		||||
using System.Collections.Generic;
 | 
			
		||||
using System.Diagnostics;
 | 
			
		||||
using System.IO;
 | 
			
		||||
using System.Linq;
 | 
			
		||||
using System.Runtime.InteropServices.WindowsRuntime;
 | 
			
		||||
using Windows.ApplicationModel;
 | 
			
		||||
using Windows.Foundation;
 | 
			
		||||
using Windows.Foundation.Collections;
 | 
			
		||||
using Windows.System;
 | 
			
		||||
using Windows.UI.Xaml;
 | 
			
		||||
using Windows.UI.Xaml.Controls;
 | 
			
		||||
using CalculatorApp.ViewModel.Common.Automation;
 | 
			
		||||
 | 
			
		||||
using System;
 | 
			
		||||
using System.Diagnostics;
 | 
			
		||||
using System.Linq;
 | 
			
		||||
 | 
			
		||||
using Windows.ApplicationModel;
 | 
			
		||||
using Windows.System;
 | 
			
		||||
using Windows.UI.Core;
 | 
			
		||||
using Windows.UI.Xaml;
 | 
			
		||||
using Windows.UI.Xaml.Automation.Peers;
 | 
			
		||||
using Windows.UI.Xaml.Automation.Provider;
 | 
			
		||||
using Windows.UI.Xaml.Controls;
 | 
			
		||||
 | 
			
		||||
// The User Control item template is documented at https://go.microsoft.com/fwlink/?LinkId=234236
 | 
			
		||||
 | 
			
		||||
@@ -29,8 +26,8 @@ namespace CalculatorApp
 | 
			
		||||
 | 
			
		||||
        public GridLength TitleBarHeight
 | 
			
		||||
        {
 | 
			
		||||
            get { return (GridLength)GetValue(TitleBarHeightProperty); }
 | 
			
		||||
            set { SetValue(TitleBarHeightProperty, value); }
 | 
			
		||||
            get => (GridLength)GetValue(TitleBarHeightProperty);
 | 
			
		||||
            set => SetValue(TitleBarHeightProperty, value);
 | 
			
		||||
        }
 | 
			
		||||
        public static readonly DependencyProperty TitleBarHeightProperty =
 | 
			
		||||
            DependencyProperty.Register(nameof(TitleBarHeight), typeof(GridLength), typeof(Settings), new PropertyMetadata(default(GridLength)));
 | 
			
		||||
 
 | 
			
		||||
@@ -30,8 +30,8 @@ namespace CalculatorApp.Views.StateTriggers
 | 
			
		||||
        /* The source for which this class will respond to size changed events. */
 | 
			
		||||
        public FrameworkElement Source
 | 
			
		||||
        {
 | 
			
		||||
            get { return (FrameworkElement)GetValue(SourceProperty); }
 | 
			
		||||
            set { SetValue(SourceProperty, value); }
 | 
			
		||||
            get => (FrameworkElement)GetValue(SourceProperty);
 | 
			
		||||
            set => SetValue(SourceProperty, value);
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        // Using a DependencyProperty as the backing store for Source.  This enables animation, styling, binding, etc...
 | 
			
		||||
@@ -46,8 +46,8 @@ namespace CalculatorApp.Views.StateTriggers
 | 
			
		||||
           the aspect ratio. */
 | 
			
		||||
        public Aspect NumeratorAspect
 | 
			
		||||
        {
 | 
			
		||||
            get { return (Aspect)GetValue(NumeratorAspectProperty); }
 | 
			
		||||
            set { SetValue(NumeratorAspectProperty, value); }
 | 
			
		||||
            get => (Aspect)GetValue(NumeratorAspectProperty);
 | 
			
		||||
            set => SetValue(NumeratorAspectProperty, value);
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        // Using a DependencyProperty as the backing store for NumeratorAspect  This enables animation, styling, binding, etc...
 | 
			
		||||
@@ -57,8 +57,8 @@ namespace CalculatorApp.Views.StateTriggers
 | 
			
		||||
        /* The threshold that will cause the trigger to fire when the aspect ratio exceeds this value. */
 | 
			
		||||
        public double Threshold
 | 
			
		||||
        {
 | 
			
		||||
            get { return (double)GetValue(ThresholdProperty); }
 | 
			
		||||
            set { SetValue(ThresholdProperty, value); }
 | 
			
		||||
            get => (double)GetValue(ThresholdProperty);
 | 
			
		||||
            set => SetValue(ThresholdProperty, value);
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        // Using a DependencyProperty as the backing store for Threshold.  This enables animation, styling, binding, etc...
 | 
			
		||||
@@ -68,8 +68,8 @@ namespace CalculatorApp.Views.StateTriggers
 | 
			
		||||
        /* If true, the trigger will fire if the aspect ratio is greater than or equal to the threshold. */
 | 
			
		||||
        public bool ActiveIfEqual
 | 
			
		||||
        {
 | 
			
		||||
            get { return (bool)GetValue(ActiveIfEqualProperty); }
 | 
			
		||||
            set { SetValue(ActiveIfEqualProperty, value); }
 | 
			
		||||
            get => (bool)GetValue(ActiveIfEqualProperty);
 | 
			
		||||
            set => SetValue(ActiveIfEqualProperty, value);
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        // Using a DependencyProperty as the backing store for ActiveEqual.  This enables animation, styling, binding, etc...
 | 
			
		||||
 
 | 
			
		||||
@@ -1,8 +1,6 @@
 | 
			
		||||
// Copyright (c) Microsoft Corporation. All rights reserved.
 | 
			
		||||
// Licensed under the MIT License.
 | 
			
		||||
 | 
			
		||||
using System;
 | 
			
		||||
 | 
			
		||||
using Windows.Foundation;
 | 
			
		||||
using Windows.UI.Xaml;
 | 
			
		||||
 | 
			
		||||
@@ -17,8 +15,8 @@ namespace CalculatorApp.Views.StateTriggers
 | 
			
		||||
 | 
			
		||||
        public FrameworkElement Source
 | 
			
		||||
        {
 | 
			
		||||
            get { return (FrameworkElement)GetValue(SourceProperty); }
 | 
			
		||||
            set { SetValue(SourceProperty, value); }
 | 
			
		||||
            get => (FrameworkElement)GetValue(SourceProperty);
 | 
			
		||||
            set => SetValue(SourceProperty, value);
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        // Using a DependencyProperty as the backing store for Source.  This enables animation, styling, binding, etc...
 | 
			
		||||
@@ -31,8 +29,8 @@ namespace CalculatorApp.Views.StateTriggers
 | 
			
		||||
 | 
			
		||||
        public double MinHeight
 | 
			
		||||
        {
 | 
			
		||||
            get { return (double)GetValue(MinHeightProperty); }
 | 
			
		||||
            set { SetValue(MinHeightProperty, value); }
 | 
			
		||||
            get => (double)GetValue(MinHeightProperty);
 | 
			
		||||
            set => SetValue(MinHeightProperty, value);
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        // Using a DependencyProperty as the backing store for MinHeight.  This enables animation, styling, binding, etc...
 | 
			
		||||
@@ -41,8 +39,8 @@ namespace CalculatorApp.Views.StateTriggers
 | 
			
		||||
 | 
			
		||||
        public double MinWidth
 | 
			
		||||
        {
 | 
			
		||||
            get { return (double)GetValue(MinWidthProperty); }
 | 
			
		||||
            set { SetValue(MinWidthProperty, value); }
 | 
			
		||||
            get => (double)GetValue(MinWidthProperty);
 | 
			
		||||
            set => SetValue(MinWidthProperty, value);
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        // Using a DependencyProperty as the backing store for MinWidth.  This enables animation, styling, binding, etc...
 | 
			
		||||
 
 | 
			
		||||
@@ -1,7 +1,9 @@
 | 
			
		||||
using CalculatorApp.ViewModel;
 | 
			
		||||
 | 
			
		||||
using System;
 | 
			
		||||
using System.Collections.Generic;
 | 
			
		||||
using System.Diagnostics;
 | 
			
		||||
 | 
			
		||||
using Windows.UI.Xaml;
 | 
			
		||||
using Windows.UI.Xaml.Controls;
 | 
			
		||||
 | 
			
		||||
@@ -13,8 +15,10 @@ namespace CalculatorApp
 | 
			
		||||
    {
 | 
			
		||||
        public DelighterUnitToStyleConverter()
 | 
			
		||||
        {
 | 
			
		||||
            m_delighters = new Windows.UI.Xaml.ResourceDictionary();
 | 
			
		||||
            m_delighters.Source = new Uri(@"ms-appx:///Views/DelighterUnitStyles.xaml");
 | 
			
		||||
            m_delighters = new Windows.UI.Xaml.ResourceDictionary
 | 
			
		||||
            {
 | 
			
		||||
                Source = new Uri(@"ms-appx:///Views/DelighterUnitStyles.xaml")
 | 
			
		||||
            };
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        public object Convert(object value, Type targetType, object parameter, string language)
 | 
			
		||||
@@ -37,7 +41,7 @@ namespace CalculatorApp
 | 
			
		||||
            return null;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        private Windows.UI.Xaml.ResourceDictionary m_delighters;
 | 
			
		||||
        private readonly Windows.UI.Xaml.ResourceDictionary m_delighters;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public sealed class SupplementaryResultDataTemplateSelector : Windows.UI.Xaml.Controls.DataTemplateSelector
 | 
			
		||||
@@ -45,17 +49,9 @@ namespace CalculatorApp
 | 
			
		||||
        public SupplementaryResultDataTemplateSelector()
 | 
			
		||||
        { }
 | 
			
		||||
 | 
			
		||||
        public Windows.UI.Xaml.DataTemplate RegularTemplate
 | 
			
		||||
        {
 | 
			
		||||
            get => m_regularTemplate;
 | 
			
		||||
            set => m_regularTemplate = value;
 | 
			
		||||
        }
 | 
			
		||||
        public Windows.UI.Xaml.DataTemplate RegularTemplate { get; set; }
 | 
			
		||||
 | 
			
		||||
        public Windows.UI.Xaml.DataTemplate DelighterTemplate
 | 
			
		||||
        {
 | 
			
		||||
            get => m_delighterTemplate;
 | 
			
		||||
            set => m_delighterTemplate = value;
 | 
			
		||||
        }
 | 
			
		||||
        public Windows.UI.Xaml.DataTemplate DelighterTemplate { get; set; }
 | 
			
		||||
 | 
			
		||||
        protected override DataTemplate SelectTemplateCore(object item, DependencyObject container)
 | 
			
		||||
        {
 | 
			
		||||
@@ -69,9 +65,6 @@ namespace CalculatorApp
 | 
			
		||||
                return RegularTemplate;
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        private Windows.UI.Xaml.DataTemplate m_regularTemplate;
 | 
			
		||||
        private Windows.UI.Xaml.DataTemplate m_delighterTemplate;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public sealed class SupplementaryResultNoOverflowStackPanel : CalculatorApp.Controls.HorizontalNoOverflowStackPanel
 | 
			
		||||
@@ -83,14 +76,12 @@ namespace CalculatorApp
 | 
			
		||||
                return false;
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            var lastChild = Children[Children.Count - 1] as FrameworkElement;
 | 
			
		||||
            if (lastChild == null)
 | 
			
		||||
            if (!(Children[Children.Count - 1] is FrameworkElement lastChild))
 | 
			
		||||
            {
 | 
			
		||||
                return false;
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            var suppResult = lastChild.DataContext as SupplementaryResult;
 | 
			
		||||
            return suppResult == null ? false : suppResult.IsWhimsical();
 | 
			
		||||
            return lastChild.DataContext is SupplementaryResult suppResult && suppResult.IsWhimsical();
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
@@ -104,8 +95,8 @@ namespace CalculatorApp
 | 
			
		||||
 | 
			
		||||
        public IEnumerable<ViewModel.SupplementaryResult> Results
 | 
			
		||||
        {
 | 
			
		||||
            get { return (IEnumerable<ViewModel.SupplementaryResult>)GetValue(ResultsProperty); }
 | 
			
		||||
            set { SetValue(ResultsProperty, value); }
 | 
			
		||||
            get => (IEnumerable<ViewModel.SupplementaryResult>)GetValue(ResultsProperty);
 | 
			
		||||
            set => SetValue(ResultsProperty, value);
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        // Using a DependencyProperty as the backing store for Results.  This enables animation, styling, binding, etc...
 | 
			
		||||
 
 | 
			
		||||
@@ -1,4 +1,5 @@
 | 
			
		||||
using CalculatorApp.ViewModel.Common;
 | 
			
		||||
 | 
			
		||||
using Windows.ApplicationModel.Core;
 | 
			
		||||
using Windows.System.Profile;
 | 
			
		||||
using Windows.UI.Core;
 | 
			
		||||
@@ -34,8 +35,8 @@ namespace CalculatorApp
 | 
			
		||||
 | 
			
		||||
        public bool IsAlwaysOnTopMode
 | 
			
		||||
        {
 | 
			
		||||
            get { return (bool)GetValue(IsAlwaysOnTopModeProperty); }
 | 
			
		||||
            set { SetValue(IsAlwaysOnTopModeProperty, value); }
 | 
			
		||||
            get => (bool)GetValue(IsAlwaysOnTopModeProperty);
 | 
			
		||||
            set => SetValue(IsAlwaysOnTopModeProperty, value);
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        // Using a DependencyProperty as the backing store for IsAlwaysOnTopMode.  This enables animation, styling, binding, etc...
 | 
			
		||||
@@ -89,7 +90,7 @@ namespace CalculatorApp
 | 
			
		||||
 | 
			
		||||
        private void RootFrame_RequestedThemeChanged(DependencyObject sender, DependencyProperty dp)
 | 
			
		||||
        {
 | 
			
		||||
            if(Frame.RequestedThemeProperty == dp)
 | 
			
		||||
            if (Frame.RequestedThemeProperty == dp)
 | 
			
		||||
            {
 | 
			
		||||
                _ = Dispatcher.RunAsync(CoreDispatcherPriority.Normal, new DispatchedHandler(() => { SetTitleBarControlColors(); }));
 | 
			
		||||
            }
 | 
			
		||||
@@ -210,64 +211,64 @@ namespace CalculatorApp
 | 
			
		||||
        // Dependency properties for the color of the system title bar buttons
 | 
			
		||||
        public Windows.UI.Xaml.Media.SolidColorBrush ButtonBackground
 | 
			
		||||
        {
 | 
			
		||||
            get { return (Windows.UI.Xaml.Media.SolidColorBrush)GetValue(ButtonBackgroundProperty); }
 | 
			
		||||
            set { SetValue(ButtonBackgroundProperty, value); }
 | 
			
		||||
            get => (Windows.UI.Xaml.Media.SolidColorBrush)GetValue(ButtonBackgroundProperty);
 | 
			
		||||
            set => SetValue(ButtonBackgroundProperty, value);
 | 
			
		||||
        }
 | 
			
		||||
        public static readonly DependencyProperty ButtonBackgroundProperty =
 | 
			
		||||
            DependencyProperty.Register(nameof(ButtonBackground), typeof(Windows.UI.Xaml.Media.SolidColorBrush), typeof(TitleBar), new PropertyMetadata(null));
 | 
			
		||||
 | 
			
		||||
        public Windows.UI.Xaml.Media.SolidColorBrush ButtonForeground
 | 
			
		||||
        {
 | 
			
		||||
            get { return (Windows.UI.Xaml.Media.SolidColorBrush)GetValue(ButtonForegroundProperty); }
 | 
			
		||||
            set { SetValue(ButtonForegroundProperty, value); }
 | 
			
		||||
            get => (Windows.UI.Xaml.Media.SolidColorBrush)GetValue(ButtonForegroundProperty);
 | 
			
		||||
            set => SetValue(ButtonForegroundProperty, value);
 | 
			
		||||
        }
 | 
			
		||||
        public static readonly DependencyProperty ButtonForegroundProperty =
 | 
			
		||||
            DependencyProperty.Register(nameof(ButtonForeground), typeof(Windows.UI.Xaml.Media.SolidColorBrush), typeof(TitleBar), new PropertyMetadata(null));
 | 
			
		||||
 | 
			
		||||
        public Windows.UI.Xaml.Media.SolidColorBrush ButtonInactiveBackground
 | 
			
		||||
        {
 | 
			
		||||
            get { return (Windows.UI.Xaml.Media.SolidColorBrush)GetValue(ButtonInactiveBackgroundProperty); }
 | 
			
		||||
            set { SetValue(ButtonInactiveBackgroundProperty, value); }
 | 
			
		||||
            get => (Windows.UI.Xaml.Media.SolidColorBrush)GetValue(ButtonInactiveBackgroundProperty);
 | 
			
		||||
            set => SetValue(ButtonInactiveBackgroundProperty, value);
 | 
			
		||||
        }
 | 
			
		||||
        public static readonly DependencyProperty ButtonInactiveBackgroundProperty =
 | 
			
		||||
            DependencyProperty.Register(nameof(ButtonInactiveBackground), typeof(Windows.UI.Xaml.Media.SolidColorBrush), typeof(TitleBar), new PropertyMetadata(null));
 | 
			
		||||
 | 
			
		||||
        public Windows.UI.Xaml.Media.SolidColorBrush ButtonInactiveForeground
 | 
			
		||||
        {
 | 
			
		||||
            get { return (Windows.UI.Xaml.Media.SolidColorBrush)GetValue(ButtonInactiveForegroundProperty); }
 | 
			
		||||
            set { SetValue(ButtonInactiveForegroundProperty, value); }
 | 
			
		||||
            get => (Windows.UI.Xaml.Media.SolidColorBrush)GetValue(ButtonInactiveForegroundProperty);
 | 
			
		||||
            set => SetValue(ButtonInactiveForegroundProperty, value);
 | 
			
		||||
        }
 | 
			
		||||
        public static readonly DependencyProperty ButtonInactiveForegroundProperty =
 | 
			
		||||
            DependencyProperty.Register(nameof(ButtonInactiveForeground), typeof(Windows.UI.Xaml.Media.SolidColorBrush), typeof(TitleBar), new PropertyMetadata(null));
 | 
			
		||||
 | 
			
		||||
        public Windows.UI.Xaml.Media.SolidColorBrush ButtonHoverBackground
 | 
			
		||||
        {
 | 
			
		||||
            get { return (Windows.UI.Xaml.Media.SolidColorBrush)GetValue(ButtonHoverBackgroundProperty); }
 | 
			
		||||
            set { SetValue(ButtonHoverBackgroundProperty, value); }
 | 
			
		||||
            get => (Windows.UI.Xaml.Media.SolidColorBrush)GetValue(ButtonHoverBackgroundProperty);
 | 
			
		||||
            set => SetValue(ButtonHoverBackgroundProperty, value);
 | 
			
		||||
        }
 | 
			
		||||
        public static readonly DependencyProperty ButtonHoverBackgroundProperty =
 | 
			
		||||
            DependencyProperty.Register(nameof(ButtonHoverBackground), typeof(Windows.UI.Xaml.Media.SolidColorBrush), typeof(TitleBar), new PropertyMetadata(null));
 | 
			
		||||
 | 
			
		||||
        public Windows.UI.Xaml.Media.SolidColorBrush ButtonHoverForeground
 | 
			
		||||
        {
 | 
			
		||||
            get { return (Windows.UI.Xaml.Media.SolidColorBrush)GetValue(ButtonHoverForegroundProperty); }
 | 
			
		||||
            set { SetValue(ButtonHoverForegroundProperty, value); }
 | 
			
		||||
            get => (Windows.UI.Xaml.Media.SolidColorBrush)GetValue(ButtonHoverForegroundProperty);
 | 
			
		||||
            set => SetValue(ButtonHoverForegroundProperty, value);
 | 
			
		||||
        }
 | 
			
		||||
        public static readonly DependencyProperty ButtonHoverForegroundProperty =
 | 
			
		||||
            DependencyProperty.Register(nameof(ButtonHoverForeground), typeof(Windows.UI.Xaml.Media.SolidColorBrush), typeof(TitleBar), new PropertyMetadata(null));
 | 
			
		||||
 | 
			
		||||
        public Windows.UI.Xaml.Media.SolidColorBrush ButtonPressedBackground
 | 
			
		||||
        {
 | 
			
		||||
            get { return (Windows.UI.Xaml.Media.SolidColorBrush)GetValue(ButtonPressedBackgroundProperty); }
 | 
			
		||||
            set { SetValue(ButtonPressedBackgroundProperty, value); }
 | 
			
		||||
            get => (Windows.UI.Xaml.Media.SolidColorBrush)GetValue(ButtonPressedBackgroundProperty);
 | 
			
		||||
            set => SetValue(ButtonPressedBackgroundProperty, value);
 | 
			
		||||
        }
 | 
			
		||||
        public static readonly DependencyProperty ButtonPressedBackgroundProperty =
 | 
			
		||||
            DependencyProperty.Register(nameof(ButtonPressedBackground), typeof(Windows.UI.Xaml.Media.SolidColorBrush), typeof(TitleBar), new PropertyMetadata(null));
 | 
			
		||||
 | 
			
		||||
        public Windows.UI.Xaml.Media.SolidColorBrush ButtonPressedForeground
 | 
			
		||||
        {
 | 
			
		||||
            get { return (Windows.UI.Xaml.Media.SolidColorBrush)GetValue(ButtonPressedForegroundProperty); }
 | 
			
		||||
            set { SetValue(ButtonPressedForegroundProperty, value); }
 | 
			
		||||
            get => (Windows.UI.Xaml.Media.SolidColorBrush)GetValue(ButtonPressedForegroundProperty);
 | 
			
		||||
            set => SetValue(ButtonPressedForegroundProperty, value);
 | 
			
		||||
        }
 | 
			
		||||
        public static readonly DependencyProperty ButtonPressedForegroundProperty =
 | 
			
		||||
            DependencyProperty.Register(nameof(ButtonPressedForeground), typeof(Windows.UI.Xaml.Media.SolidColorBrush), typeof(TitleBar), new PropertyMetadata(null));
 | 
			
		||||
@@ -280,15 +281,16 @@ namespace CalculatorApp
 | 
			
		||||
        public static readonly DependencyProperty BackButtonSpaceReservedProperty =
 | 
			
		||||
            DependencyProperty.Register(
 | 
			
		||||
                nameof(BackButtonSpaceReserved), typeof(bool), typeof(TitleBar),
 | 
			
		||||
                new PropertyMetadata(false, new PropertyChangedCallback((sender, args)=> {
 | 
			
		||||
                new PropertyMetadata(false, new PropertyChangedCallback((sender, args) =>
 | 
			
		||||
                {
 | 
			
		||||
                    var self = sender as TitleBar;
 | 
			
		||||
                    VisualStateManager.GoToState(
 | 
			
		||||
                        self, (bool)args.NewValue ? self.BackButtonVisible.Name : self.BackButtonCollapsed.Name, true);
 | 
			
		||||
                })));
 | 
			
		||||
 | 
			
		||||
        private Windows.ApplicationModel.Core.CoreApplicationViewTitleBar m_coreTitleBar;
 | 
			
		||||
        private Windows.UI.ViewManagement.UISettings m_uiSettings;
 | 
			
		||||
        private Windows.UI.ViewManagement.AccessibilitySettings m_accessibilitySettings;
 | 
			
		||||
        private readonly Windows.ApplicationModel.Core.CoreApplicationViewTitleBar m_coreTitleBar;
 | 
			
		||||
        private readonly Windows.UI.ViewManagement.UISettings m_uiSettings;
 | 
			
		||||
        private readonly Windows.UI.ViewManagement.AccessibilitySettings m_accessibilitySettings;
 | 
			
		||||
        private Utils.ThemeHelper.ThemeChangedCallbackToken m_rootFrameRequestedThemeCallbackToken;
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -2,10 +2,12 @@ using CalculatorApp.Common;
 | 
			
		||||
using CalculatorApp.Controls;
 | 
			
		||||
using CalculatorApp.ViewModel;
 | 
			
		||||
using CalculatorApp.ViewModel.Common;
 | 
			
		||||
 | 
			
		||||
using System;
 | 
			
		||||
using System.ComponentModel;
 | 
			
		||||
using System.Diagnostics;
 | 
			
		||||
using System.Threading.Tasks;
 | 
			
		||||
 | 
			
		||||
using Windows.Foundation;
 | 
			
		||||
using Windows.System;
 | 
			
		||||
using Windows.UI.ViewManagement;
 | 
			
		||||
@@ -18,7 +20,7 @@ using Windows.UI.Xaml.Input;
 | 
			
		||||
 | 
			
		||||
namespace CalculatorApp
 | 
			
		||||
{
 | 
			
		||||
    class Activatable : ViewModel.IActivatable
 | 
			
		||||
    internal class Activatable : ViewModel.IActivatable
 | 
			
		||||
    {
 | 
			
		||||
        public Activatable(Func<bool> getter, Action<bool> setter)
 | 
			
		||||
        {
 | 
			
		||||
@@ -32,8 +34,8 @@ namespace CalculatorApp
 | 
			
		||||
            set => m_setter(value);
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        private Func<bool> m_getter;
 | 
			
		||||
        private Action<bool> m_setter;
 | 
			
		||||
        private readonly Func<bool> m_getter;
 | 
			
		||||
        private readonly Action<bool> m_setter;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public sealed partial class UnitConverter : UserControl
 | 
			
		||||
@@ -41,8 +43,8 @@ namespace CalculatorApp
 | 
			
		||||
        public UnitConverter()
 | 
			
		||||
        {
 | 
			
		||||
            m_meteredConnectionOverride = false;
 | 
			
		||||
            m_layoutDirection = LocalizationService.GetInstance().GetFlowDirection();
 | 
			
		||||
            m_FlowDirectionHorizontalAlignment = m_layoutDirection == FlowDirection.RightToLeft ? HorizontalAlignment.Right : HorizontalAlignment.Left;
 | 
			
		||||
            LayoutDirection = LocalizationService.GetInstance().GetFlowDirection();
 | 
			
		||||
            FlowDirectionHorizontalAlignment = LayoutDirection == FlowDirection.RightToLeft ? HorizontalAlignment.Right : HorizontalAlignment.Left;
 | 
			
		||||
 | 
			
		||||
            InitializeComponent();
 | 
			
		||||
 | 
			
		||||
@@ -68,12 +70,7 @@ namespace CalculatorApp
 | 
			
		||||
            PasteMenuItem.Text = resLoader.GetResourceString("pasteMenuItem");
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        public Windows.UI.Xaml.HorizontalAlignment FlowDirectionHorizontalAlignment
 | 
			
		||||
        {
 | 
			
		||||
            get => this.m_FlowDirectionHorizontalAlignment;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        private Windows.UI.Xaml.HorizontalAlignment m_FlowDirectionHorizontalAlignment = default(HorizontalAlignment);
 | 
			
		||||
        public Windows.UI.Xaml.HorizontalAlignment FlowDirectionHorizontalAlignment { get; } = default;
 | 
			
		||||
 | 
			
		||||
        public void AnimateConverter()
 | 
			
		||||
        {
 | 
			
		||||
@@ -83,15 +80,9 @@ namespace CalculatorApp
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        public CalculatorApp.ViewModel.UnitConverterViewModel Model
 | 
			
		||||
        {
 | 
			
		||||
            get => (CalculatorApp.ViewModel.UnitConverterViewModel)this.DataContext;
 | 
			
		||||
        }
 | 
			
		||||
        public CalculatorApp.ViewModel.UnitConverterViewModel Model => (CalculatorApp.ViewModel.UnitConverterViewModel)this.DataContext;
 | 
			
		||||
 | 
			
		||||
        public Windows.UI.Xaml.FlowDirection LayoutDirection
 | 
			
		||||
        {
 | 
			
		||||
            get => this.m_layoutDirection;
 | 
			
		||||
        }
 | 
			
		||||
        public Windows.UI.Xaml.FlowDirection LayoutDirection { get; } = default;
 | 
			
		||||
 | 
			
		||||
        public void SetDefaultFocus()
 | 
			
		||||
        {
 | 
			
		||||
@@ -121,8 +112,7 @@ namespace CalculatorApp
 | 
			
		||||
 | 
			
		||||
            PasteMenuItem.IsEnabled = CopyPasteManager.HasStringToPaste();
 | 
			
		||||
 | 
			
		||||
            Point point;
 | 
			
		||||
            if (e.TryGetPosition(requestedElement, out point))
 | 
			
		||||
            if (e.TryGetPosition(requestedElement, out Point point))
 | 
			
		||||
            {
 | 
			
		||||
                m_resultsFlyout.ShowAt(requestedElement, point);
 | 
			
		||||
            }
 | 
			
		||||
@@ -146,7 +136,7 @@ namespace CalculatorApp
 | 
			
		||||
            CopyPasteManager.CopyToClipboard(calcResult.GetRawDisplayValue());
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        void OnPasteMenuItemClicked(object sender, RoutedEventArgs e)
 | 
			
		||||
        private void OnPasteMenuItemClicked(object sender, RoutedEventArgs e)
 | 
			
		||||
        {
 | 
			
		||||
            UnitConverter that = this;
 | 
			
		||||
            _ = Task.Run(async () =>
 | 
			
		||||
@@ -276,7 +266,7 @@ namespace CalculatorApp
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        void OnOptInNetworkAccess()
 | 
			
		||||
        private void OnOptInNetworkAccess()
 | 
			
		||||
        {
 | 
			
		||||
            CurrencyRefreshBlockControl.Visibility = Visibility.Visible;
 | 
			
		||||
            OfflineBlock.Visibility = Visibility.Collapsed;
 | 
			
		||||
@@ -291,7 +281,7 @@ namespace CalculatorApp
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        void OnOfflineNetworkAccess()
 | 
			
		||||
        private void OnOfflineNetworkAccess()
 | 
			
		||||
        {
 | 
			
		||||
            CurrencyRefreshBlockControl.Visibility = Visibility.Collapsed;
 | 
			
		||||
            OfflineBlock.Visibility = Visibility.Visible;
 | 
			
		||||
@@ -361,8 +351,10 @@ namespace CalculatorApp
 | 
			
		||||
 | 
			
		||||
            TimeSpan delay = TimeSpan.FromMilliseconds(500);
 | 
			
		||||
 | 
			
		||||
            m_delayTimer = new DispatcherTimer();
 | 
			
		||||
            m_delayTimer.Interval = delay;
 | 
			
		||||
            m_delayTimer = new DispatcherTimer
 | 
			
		||||
            {
 | 
			
		||||
                Interval = delay
 | 
			
		||||
            };
 | 
			
		||||
            m_delayTimer.Tick += OnDelayTimerTick;
 | 
			
		||||
 | 
			
		||||
            m_delayTimer.Start();
 | 
			
		||||
@@ -396,12 +388,11 @@ namespace CalculatorApp
 | 
			
		||||
            TraceLogger.GetInstance().LogVisualStateChanged(mode, e.NewState.Name, false);
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        private static Lazy<UISettings> uiSettings = new Lazy<UISettings>(true);
 | 
			
		||||
        private Windows.UI.Xaml.FlowDirection m_layoutDirection = default(FlowDirection);
 | 
			
		||||
        private Windows.UI.Xaml.Controls.MenuFlyout m_resultsFlyout = default(MenuFlyout);
 | 
			
		||||
        private static readonly Lazy<UISettings> uiSettings = new Lazy<UISettings>(true);
 | 
			
		||||
        private readonly Windows.UI.Xaml.Controls.MenuFlyout m_resultsFlyout = default;
 | 
			
		||||
 | 
			
		||||
        private string m_chargesMayApplyText = string.Empty;
 | 
			
		||||
        private string m_failedToRefreshText = string.Empty;
 | 
			
		||||
        private readonly string m_chargesMayApplyText = string.Empty;
 | 
			
		||||
        private readonly string m_failedToRefreshText = string.Empty;
 | 
			
		||||
 | 
			
		||||
        private bool m_meteredConnectionOverride;
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -3,11 +3,13 @@
 | 
			
		||||
 | 
			
		||||
using CalculatorApp.Common;
 | 
			
		||||
using CalculatorApp.ViewModel.Common;
 | 
			
		||||
 | 
			
		||||
using System;
 | 
			
		||||
using System.Collections.Generic;
 | 
			
		||||
using System.Data;
 | 
			
		||||
using System.Diagnostics;
 | 
			
		||||
using System.Threading.Tasks;
 | 
			
		||||
 | 
			
		||||
using Windows.ApplicationModel.Core;
 | 
			
		||||
using Windows.UI.Core;
 | 
			
		||||
using Windows.UI.ViewManagement;
 | 
			
		||||
@@ -164,8 +166,7 @@ namespace CalculatorApp
 | 
			
		||||
        // Returns nullptr if no service is registered with the specified id
 | 
			
		||||
        private object TryResolveRuntimeWindowService(Type serviceId)
 | 
			
		||||
        {
 | 
			
		||||
            object retval;
 | 
			
		||||
            if (m_runtimeServicesMap.TryGetValue(serviceId.Name, out retval))
 | 
			
		||||
            if (m_runtimeServicesMap.TryGetValue(serviceId.Name, out object retval))
 | 
			
		||||
            {
 | 
			
		||||
                return retval;
 | 
			
		||||
            }
 | 
			
		||||
@@ -175,14 +176,14 @@ namespace CalculatorApp
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        private Windows.UI.Core.CoreWindow m_currentWindow;
 | 
			
		||||
        private Windows.UI.Core.CoreDispatcher m_coreDispatcher;
 | 
			
		||||
        private readonly Windows.UI.Core.CoreWindow m_currentWindow;
 | 
			
		||||
        private readonly Windows.UI.Core.CoreDispatcher m_coreDispatcher;
 | 
			
		||||
        private Windows.UI.Xaml.Controls.Frame m_frame;
 | 
			
		||||
        private int m_viewId;
 | 
			
		||||
        private WeakReference m_parent;
 | 
			
		||||
        private readonly int m_viewId;
 | 
			
		||||
        private readonly WeakReference m_parent;
 | 
			
		||||
 | 
			
		||||
        private Dictionary<string, object> m_runtimeServicesMap = new Dictionary<string, object>();
 | 
			
		||||
        private List<Action> m_onWindowClosingHandlers = new List<Action>();
 | 
			
		||||
        private readonly Dictionary<string, object> m_runtimeServicesMap = new Dictionary<string, object>();
 | 
			
		||||
        private readonly List<Action> m_onWindowClosingHandlers = new List<Action>();
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -2,6 +2,7 @@
 | 
			
		||||
// Licensed under the MIT License.
 | 
			
		||||
using OpenQA.Selenium;
 | 
			
		||||
using OpenQA.Selenium.Appium.Windows;
 | 
			
		||||
 | 
			
		||||
using System.Drawing;
 | 
			
		||||
 | 
			
		||||
namespace CalculatorUITestFramework
 | 
			
		||||
 
 | 
			
		||||
@@ -1,9 +1,10 @@
 | 
			
		||||
// Copyright (c) Microsoft Corporation. All rights reserved.
 | 
			
		||||
// Licensed under the MIT License.
 | 
			
		||||
using Microsoft.VisualStudio.TestTools.UnitTesting;
 | 
			
		||||
 | 
			
		||||
using OpenQA.Selenium.Appium.Windows;
 | 
			
		||||
 | 
			
		||||
using System;
 | 
			
		||||
using OpenQA.Selenium.Interactions;
 | 
			
		||||
 | 
			
		||||
namespace CalculatorUITestFramework
 | 
			
		||||
{
 | 
			
		||||
 
 | 
			
		||||
@@ -2,9 +2,6 @@
 | 
			
		||||
// Licensed under the MIT License.
 | 
			
		||||
 | 
			
		||||
using OpenQA.Selenium.Appium;
 | 
			
		||||
using System;
 | 
			
		||||
using System.Collections.Generic;
 | 
			
		||||
using System.Text;
 | 
			
		||||
 | 
			
		||||
namespace CalculatorUITestFramework
 | 
			
		||||
{
 | 
			
		||||
 
 | 
			
		||||
@@ -2,11 +2,10 @@
 | 
			
		||||
// Licensed under the MIT License.
 | 
			
		||||
 | 
			
		||||
using OpenQA.Selenium;
 | 
			
		||||
using OpenQA.Selenium.Appium;
 | 
			
		||||
using OpenQA.Selenium.Appium.Windows;
 | 
			
		||||
using OpenQA.Selenium.Interactions;
 | 
			
		||||
 | 
			
		||||
using System.Collections.Generic;
 | 
			
		||||
using System.Collections.ObjectModel;
 | 
			
		||||
using System.Drawing;
 | 
			
		||||
using System.Linq;
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -2,9 +2,6 @@
 | 
			
		||||
// Licensed under the MIT License.
 | 
			
		||||
 | 
			
		||||
using OpenQA.Selenium.Appium;
 | 
			
		||||
using System;
 | 
			
		||||
using System.Collections.Generic;
 | 
			
		||||
using System.Text;
 | 
			
		||||
 | 
			
		||||
namespace CalculatorUITestFramework
 | 
			
		||||
{
 | 
			
		||||
 
 | 
			
		||||
@@ -2,12 +2,12 @@
 | 
			
		||||
// Licensed under the MIT License.
 | 
			
		||||
 | 
			
		||||
using Microsoft.VisualStudio.TestTools.UnitTesting;
 | 
			
		||||
 | 
			
		||||
using OpenQA.Selenium;
 | 
			
		||||
using OpenQA.Selenium.Appium;
 | 
			
		||||
using OpenQA.Selenium.Appium.Windows;
 | 
			
		||||
using OpenQA.Selenium.Interactions;
 | 
			
		||||
 | 
			
		||||
using System.Collections.Generic;
 | 
			
		||||
using System.Collections.ObjectModel;
 | 
			
		||||
using System.Drawing;
 | 
			
		||||
using System.Linq;
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -2,6 +2,7 @@
 | 
			
		||||
// Licensed under the MIT License.
 | 
			
		||||
 | 
			
		||||
using OpenQA.Selenium.Appium.Windows;
 | 
			
		||||
 | 
			
		||||
using System;
 | 
			
		||||
 | 
			
		||||
namespace CalculatorUITestFramework
 | 
			
		||||
@@ -44,7 +45,7 @@ namespace CalculatorUITestFramework
 | 
			
		||||
            switch (mode)
 | 
			
		||||
            {
 | 
			
		||||
                case CalculatorMode.StandardCalculator:
 | 
			
		||||
                    modeAccessibilityId =  "Standard";
 | 
			
		||||
                    modeAccessibilityId = "Standard";
 | 
			
		||||
                    break;
 | 
			
		||||
                case CalculatorMode.ScientificCalculator:
 | 
			
		||||
                    modeAccessibilityId = "Scientific";
 | 
			
		||||
 
 | 
			
		||||
@@ -2,6 +2,7 @@
 | 
			
		||||
// Licensed under the MIT License.
 | 
			
		||||
 | 
			
		||||
using OpenQA.Selenium.Appium.Windows;
 | 
			
		||||
 | 
			
		||||
using System;
 | 
			
		||||
using System.Globalization;
 | 
			
		||||
 | 
			
		||||
@@ -76,7 +77,7 @@ namespace CalculatorUITestFramework
 | 
			
		||||
                        this.NegateButton.Click();
 | 
			
		||||
                        break;
 | 
			
		||||
                    default:
 | 
			
		||||
                        throw (new ArgumentException(String.Format("{0} is not valid", digit)));
 | 
			
		||||
                        throw (new ArgumentException(string.Format("{0} is not valid", digit)));
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
 
 | 
			
		||||
@@ -1,7 +1,6 @@
 | 
			
		||||
// Copyright (c) Microsoft Corporation. All rights reserved.
 | 
			
		||||
// Licensed under the MIT License.
 | 
			
		||||
 | 
			
		||||
using Microsoft.VisualStudio.TestTools.UnitTesting;
 | 
			
		||||
using OpenQA.Selenium.Appium.Windows;
 | 
			
		||||
 | 
			
		||||
namespace CalculatorUITestFramework
 | 
			
		||||
 
 | 
			
		||||
@@ -3,11 +3,6 @@
 | 
			
		||||
 | 
			
		||||
using OpenQA.Selenium;
 | 
			
		||||
using OpenQA.Selenium.Appium.Windows;
 | 
			
		||||
using System.Collections.Generic;
 | 
			
		||||
using System.Diagnostics.Contracts;
 | 
			
		||||
using System.Runtime.InteropServices.ComTypes;
 | 
			
		||||
using System;
 | 
			
		||||
using System.Diagnostics;
 | 
			
		||||
 | 
			
		||||
namespace CalculatorUITestFramework
 | 
			
		||||
{
 | 
			
		||||
@@ -192,7 +187,7 @@ namespace CalculatorUITestFramework
 | 
			
		||||
            else
 | 
			
		||||
            {
 | 
			
		||||
                throw new NotFoundException("Could not find word size buttons in page source");
 | 
			
		||||
            } 
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
        public void ResetNumberSystem()
 | 
			
		||||
        {
 | 
			
		||||
 
 | 
			
		||||
@@ -1,7 +1,6 @@
 | 
			
		||||
// Copyright (c) Microsoft Corporation. All rights reserved.
 | 
			
		||||
// Licensed under the MIT License.
 | 
			
		||||
 | 
			
		||||
using Microsoft.VisualStudio.TestTools.UnitTesting;
 | 
			
		||||
using OpenQA.Selenium.Appium.Windows;
 | 
			
		||||
 | 
			
		||||
namespace CalculatorUITestFramework
 | 
			
		||||
 
 | 
			
		||||
@@ -3,11 +3,8 @@
 | 
			
		||||
 | 
			
		||||
using OpenQA.Selenium;
 | 
			
		||||
using OpenQA.Selenium.Appium.Windows;
 | 
			
		||||
using System.Collections.Generic;
 | 
			
		||||
using System.Diagnostics.Contracts;
 | 
			
		||||
using System.Runtime.InteropServices.ComTypes;
 | 
			
		||||
 | 
			
		||||
using System;
 | 
			
		||||
using System.Diagnostics;
 | 
			
		||||
 | 
			
		||||
namespace CalculatorUITestFramework
 | 
			
		||||
{
 | 
			
		||||
@@ -112,25 +109,25 @@ namespace CalculatorUITestFramework
 | 
			
		||||
        public void SetAngleOperator(AngleOperatorState value)
 | 
			
		||||
        {
 | 
			
		||||
            //set the desired string value for the button
 | 
			
		||||
                string desiredId;
 | 
			
		||||
                switch (value)
 | 
			
		||||
                {
 | 
			
		||||
                    case AngleOperatorState.Degrees:
 | 
			
		||||
                        desiredId = "degButton";
 | 
			
		||||
                        break;
 | 
			
		||||
                    case AngleOperatorState.Gradians:
 | 
			
		||||
                        desiredId = "gradButton";
 | 
			
		||||
                        break;
 | 
			
		||||
                    case AngleOperatorState.Radians:
 | 
			
		||||
                        desiredId = "radButton";
 | 
			
		||||
                        break;
 | 
			
		||||
                    default:
 | 
			
		||||
                        throw new NotImplementedException();
 | 
			
		||||
                }
 | 
			
		||||
                while (this.DegRadGradButton.GetAttribute("AutomationId") != desiredId)
 | 
			
		||||
                {
 | 
			
		||||
                    this.DegRadGradButton.Click();
 | 
			
		||||
                }
 | 
			
		||||
            string desiredId;
 | 
			
		||||
            switch (value)
 | 
			
		||||
            {
 | 
			
		||||
                case AngleOperatorState.Degrees:
 | 
			
		||||
                    desiredId = "degButton";
 | 
			
		||||
                    break;
 | 
			
		||||
                case AngleOperatorState.Gradians:
 | 
			
		||||
                    desiredId = "gradButton";
 | 
			
		||||
                    break;
 | 
			
		||||
                case AngleOperatorState.Radians:
 | 
			
		||||
                    desiredId = "radButton";
 | 
			
		||||
                    break;
 | 
			
		||||
                default:
 | 
			
		||||
                    throw new NotImplementedException();
 | 
			
		||||
            }
 | 
			
		||||
            while (this.DegRadGradButton.GetAttribute("AutomationId") != desiredId)
 | 
			
		||||
            {
 | 
			
		||||
                this.DegRadGradButton.Click();
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        public void ResetFEButton(FEButtonState value)
 | 
			
		||||
 
 | 
			
		||||
@@ -1,10 +1,12 @@
 | 
			
		||||
// Copyright (c) Microsoft Corporation. All rights reserved.
 | 
			
		||||
// Licensed under the MIT License.
 | 
			
		||||
using Microsoft.VisualStudio.TestTools.UnitTesting;
 | 
			
		||||
 | 
			
		||||
using OpenQA.Selenium;
 | 
			
		||||
using OpenQA.Selenium.Appium;
 | 
			
		||||
using OpenQA.Selenium.Appium.Windows;
 | 
			
		||||
using OpenQA.Selenium.Interactions;
 | 
			
		||||
 | 
			
		||||
using System.Drawing;
 | 
			
		||||
 | 
			
		||||
namespace CalculatorUITestFramework
 | 
			
		||||
 
 | 
			
		||||
@@ -1,9 +1,6 @@
 | 
			
		||||
// Copyright (c) Microsoft Corporation. All rights reserved.
 | 
			
		||||
// Licensed under the MIT License.
 | 
			
		||||
using OpenQA.Selenium.Appium.Windows;
 | 
			
		||||
using System;
 | 
			
		||||
using System.Collections.Generic;
 | 
			
		||||
using System.Text;
 | 
			
		||||
 | 
			
		||||
namespace CalculatorUITestFramework
 | 
			
		||||
{
 | 
			
		||||
 
 | 
			
		||||
@@ -1,9 +1,6 @@
 | 
			
		||||
// Copyright (c) Microsoft Corporation. All rights reserved.
 | 
			
		||||
// Licensed under the MIT License.
 | 
			
		||||
using OpenQA.Selenium.Appium.Windows;
 | 
			
		||||
using System;
 | 
			
		||||
using System.Collections.Generic;
 | 
			
		||||
using System.Text;
 | 
			
		||||
 | 
			
		||||
namespace CalculatorUITestFramework
 | 
			
		||||
{
 | 
			
		||||
 
 | 
			
		||||
@@ -1,9 +1,9 @@
 | 
			
		||||
// Copyright (c) Microsoft Corporation. All rights reserved.
 | 
			
		||||
// Licensed under the MIT License.
 | 
			
		||||
using Microsoft.VisualStudio.TestTools.UnitTesting;
 | 
			
		||||
 | 
			
		||||
using OpenQA.Selenium.Appium.Windows;
 | 
			
		||||
using System;
 | 
			
		||||
using OpenQA.Selenium.Interactions;
 | 
			
		||||
 | 
			
		||||
using System.Text.RegularExpressions;
 | 
			
		||||
 | 
			
		||||
namespace CalculatorUITestFramework
 | 
			
		||||
 
 | 
			
		||||
@@ -2,10 +2,11 @@
 | 
			
		||||
// Licensed under the MIT License.
 | 
			
		||||
 | 
			
		||||
using Microsoft.VisualStudio.TestTools.UnitTesting;
 | 
			
		||||
 | 
			
		||||
using OpenQA.Selenium.Appium;
 | 
			
		||||
using OpenQA.Selenium.Appium.Windows;
 | 
			
		||||
 | 
			
		||||
using System;
 | 
			
		||||
using System.Diagnostics;
 | 
			
		||||
 | 
			
		||||
namespace CalculatorUITestFramework
 | 
			
		||||
{
 | 
			
		||||
@@ -41,7 +42,7 @@ namespace CalculatorUITestFramework
 | 
			
		||||
            this.windowsDriverService.OutputDataReceived += (sender, e) =>
 | 
			
		||||
            {
 | 
			
		||||
                var outputData = e.Data?.Replace("\0", string.Empty);
 | 
			
		||||
                if (!String.IsNullOrEmpty(outputData))
 | 
			
		||||
                if (!string.IsNullOrEmpty(outputData))
 | 
			
		||||
                {
 | 
			
		||||
                    Console.WriteLine(outputData);
 | 
			
		||||
                }
 | 
			
		||||
 
 | 
			
		||||
@@ -24,10 +24,10 @@ namespace CalculatorUITestFramework
 | 
			
		||||
{
 | 
			
		||||
    public class WindowsDriverLocalService : IDisposable
 | 
			
		||||
    {
 | 
			
		||||
        private FileInfo FileName;
 | 
			
		||||
        private string Arguments;
 | 
			
		||||
        private IPAddress IP;
 | 
			
		||||
        private int Port;
 | 
			
		||||
        private readonly FileInfo FileName;
 | 
			
		||||
        private readonly string Arguments;
 | 
			
		||||
        private readonly IPAddress IP;
 | 
			
		||||
        private readonly int Port;
 | 
			
		||||
        private TimeSpan InitializationTimeout;
 | 
			
		||||
        private Process Service;
 | 
			
		||||
 | 
			
		||||
@@ -119,11 +119,7 @@ namespace CalculatorUITestFramework
 | 
			
		||||
            GC.SuppressFinalize(this);
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        public Uri ServiceUrl
 | 
			
		||||
        {
 | 
			
		||||
            // Note: append /wd/hub to the URL if you're directing the test at Appium
 | 
			
		||||
            get { return new Uri($"http://{this.IP}:{Convert.ToString(this.Port)}"); }
 | 
			
		||||
        }
 | 
			
		||||
        public Uri ServiceUrl => new Uri($"http://{this.IP}:{Convert.ToString(this.Port)}");
 | 
			
		||||
 | 
			
		||||
        private void DestroyProcess()
 | 
			
		||||
        {
 | 
			
		||||
 
 | 
			
		||||
@@ -39,11 +39,7 @@ namespace CalculatorUITestFramework
 | 
			
		||||
 | 
			
		||||
        public WindowsDriverServiceBuilder WithFileInfo(FileInfo fileInfo)
 | 
			
		||||
        {
 | 
			
		||||
            if (fileInfo == null)
 | 
			
		||||
            {
 | 
			
		||||
                throw new ArgumentNullException("FileInfo should not be NULL");
 | 
			
		||||
            }
 | 
			
		||||
            this.FileInfo = fileInfo;
 | 
			
		||||
            this.FileInfo = fileInfo ?? throw new ArgumentNullException("FileInfo should not be NULL");
 | 
			
		||||
            return this;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -3,8 +3,9 @@
 | 
			
		||||
 | 
			
		||||
using Microsoft.VisualStudio.TestTools.UnitTesting;
 | 
			
		||||
using Microsoft.VisualStudio.TestTools.UnitTesting.Logging;
 | 
			
		||||
 | 
			
		||||
using OpenQA.Selenium.Appium.Windows;
 | 
			
		||||
using System;
 | 
			
		||||
 | 
			
		||||
using System.Diagnostics;
 | 
			
		||||
using System.Threading;
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -1,16 +1,15 @@
 | 
			
		||||
// Copyright (c) Microsoft Corporation. All rights reserved.
 | 
			
		||||
// Licensed under the MIT License.
 | 
			
		||||
using CalculatorUITestFramework;
 | 
			
		||||
 | 
			
		||||
using Microsoft.VisualStudio.TestTools.UnitTesting;
 | 
			
		||||
using OpenQA.Selenium;
 | 
			
		||||
using System;
 | 
			
		||||
 | 
			
		||||
namespace CalculatorUITests
 | 
			
		||||
{
 | 
			
		||||
    [TestClass]
 | 
			
		||||
    public class CurrencyConverterFunctionalTests
 | 
			
		||||
    {
 | 
			
		||||
        private static UnitConverterPage page = new UnitConverterPage();
 | 
			
		||||
        private static readonly UnitConverterPage page = new UnitConverterPage();
 | 
			
		||||
 | 
			
		||||
        public TestContext TestContext { get; set; }
 | 
			
		||||
 | 
			
		||||
@@ -64,7 +63,7 @@ namespace CalculatorUITests
 | 
			
		||||
            }
 | 
			
		||||
            else
 | 
			
		||||
            {
 | 
			
		||||
                parts[1] = parts[1].Substring(0, fractionDigits);
 | 
			
		||||
                parts[1] = parts[1][..fractionDigits];
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            return $"{parts[0]}.{parts[1]}".TrimEnd('.');
 | 
			
		||||
 
 | 
			
		||||
@@ -2,9 +2,12 @@
 | 
			
		||||
// Licensed under the MIT License.
 | 
			
		||||
 | 
			
		||||
using CalculatorUITestFramework;
 | 
			
		||||
 | 
			
		||||
using Microsoft.VisualStudio.TestTools.UnitTesting;
 | 
			
		||||
 | 
			
		||||
using OpenQA.Selenium;
 | 
			
		||||
using OpenQA.Selenium.Interactions;
 | 
			
		||||
 | 
			
		||||
using System;
 | 
			
		||||
 | 
			
		||||
namespace CalculatorUITests
 | 
			
		||||
@@ -12,7 +15,7 @@ namespace CalculatorUITests
 | 
			
		||||
    [TestClass]
 | 
			
		||||
    public class HistoryFunctionalTests
 | 
			
		||||
    {
 | 
			
		||||
        private static StandardCalculatorPage page = new StandardCalculatorPage();
 | 
			
		||||
        private static readonly StandardCalculatorPage page = new StandardCalculatorPage();
 | 
			
		||||
 | 
			
		||||
        /// <summary>
 | 
			
		||||
        /// Initializes the WinAppDriver web driver session.
 | 
			
		||||
 
 | 
			
		||||
@@ -2,9 +2,12 @@
 | 
			
		||||
// Licensed under the MIT License.
 | 
			
		||||
 | 
			
		||||
using CalculatorUITestFramework;
 | 
			
		||||
 | 
			
		||||
using Microsoft.VisualStudio.TestTools.UnitTesting;
 | 
			
		||||
 | 
			
		||||
using OpenQA.Selenium;
 | 
			
		||||
using OpenQA.Selenium.Interactions;
 | 
			
		||||
 | 
			
		||||
using System;
 | 
			
		||||
 | 
			
		||||
namespace CalculatorUITests
 | 
			
		||||
@@ -12,7 +15,7 @@ namespace CalculatorUITests
 | 
			
		||||
    [TestClass]
 | 
			
		||||
    public class MemoryFunctionalTests
 | 
			
		||||
    {
 | 
			
		||||
        private static StandardCalculatorPage page = new StandardCalculatorPage();
 | 
			
		||||
        private static readonly StandardCalculatorPage page = new StandardCalculatorPage();
 | 
			
		||||
 | 
			
		||||
        /// <summary>
 | 
			
		||||
        /// Initializes the WinAppDriver web driver session.
 | 
			
		||||
 
 | 
			
		||||
@@ -2,8 +2,11 @@
 | 
			
		||||
// Licensed under the MIT License.
 | 
			
		||||
 | 
			
		||||
using CalculatorUITestFramework;
 | 
			
		||||
 | 
			
		||||
using Microsoft.VisualStudio.TestTools.UnitTesting;
 | 
			
		||||
 | 
			
		||||
using OpenQA.Selenium;
 | 
			
		||||
 | 
			
		||||
using System;
 | 
			
		||||
 | 
			
		||||
namespace CalculatorUITests
 | 
			
		||||
@@ -11,7 +14,7 @@ namespace CalculatorUITests
 | 
			
		||||
    [TestClass]
 | 
			
		||||
    public class ProgrammerModeFunctionalTests
 | 
			
		||||
    {
 | 
			
		||||
        private static ProgrammerCalculatorPage page = new ProgrammerCalculatorPage();
 | 
			
		||||
        private static readonly ProgrammerCalculatorPage page = new ProgrammerCalculatorPage();
 | 
			
		||||
 | 
			
		||||
        /// <summary>
 | 
			
		||||
        /// Initializes the WinAppDriver web driver session.
 | 
			
		||||
@@ -637,7 +640,7 @@ namespace CalculatorUITests
 | 
			
		||||
            page.ProgrammerOperators.RightShiftLogicalButton.Click();
 | 
			
		||||
            page.StandardOperators.NumberPad.Input(1);
 | 
			
		||||
            page.StandardOperators.EqualButton.Click();
 | 
			
		||||
            Assert.IsTrue(String.Equals(page.CalculatorResults.GetCalculatorResultText(), "0 1 1 1  1 1 1 1  1 1 1 1  1 1 1 1  1 1 1 1  1 1 1 1  1 1 1 1  1 1 1 1  1 1 1 1  1 1 1 1  1 1 1 1  1 1 1 1  1 1 1 1  1 1 1 1  1 1 1 1  1 0 1 1", StringComparison.OrdinalIgnoreCase));
 | 
			
		||||
            Assert.IsTrue(string.Equals(page.CalculatorResults.GetCalculatorResultText(), "0 1 1 1  1 1 1 1  1 1 1 1  1 1 1 1  1 1 1 1  1 1 1 1  1 1 1 1  1 1 1 1  1 1 1 1  1 1 1 1  1 1 1 1  1 1 1 1  1 1 1 1  1 1 1 1  1 1 1 1  1 0 1 1", StringComparison.OrdinalIgnoreCase));
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        /// <summary>
 | 
			
		||||
 
 | 
			
		||||
@@ -2,18 +2,15 @@
 | 
			
		||||
// Licensed under the MIT License.
 | 
			
		||||
 | 
			
		||||
using CalculatorUITestFramework;
 | 
			
		||||
 | 
			
		||||
using Microsoft.VisualStudio.TestTools.UnitTesting;
 | 
			
		||||
using OpenQA.Selenium;
 | 
			
		||||
using OpenQA.Selenium.Appium.Windows;
 | 
			
		||||
using System;
 | 
			
		||||
using System.Collections.Generic;
 | 
			
		||||
 | 
			
		||||
namespace CalculatorUITests
 | 
			
		||||
{
 | 
			
		||||
    [TestClass]
 | 
			
		||||
    public class ScientificModeFunctionalTests
 | 
			
		||||
    {
 | 
			
		||||
        private static ScientificCalculatorPage page = new ScientificCalculatorPage();
 | 
			
		||||
        private static readonly ScientificCalculatorPage page = new ScientificCalculatorPage();
 | 
			
		||||
 | 
			
		||||
        /// <summary>
 | 
			
		||||
        /// Initializes the WinAppDriver web driver session.
 | 
			
		||||
 
 | 
			
		||||
@@ -2,8 +2,11 @@
 | 
			
		||||
// Licensed under the MIT License.
 | 
			
		||||
 | 
			
		||||
using CalculatorUITestFramework;
 | 
			
		||||
 | 
			
		||||
using Microsoft.VisualStudio.TestTools.UnitTesting;
 | 
			
		||||
 | 
			
		||||
using OpenQA.Selenium;
 | 
			
		||||
 | 
			
		||||
using System;
 | 
			
		||||
using System.Text.RegularExpressions;
 | 
			
		||||
 | 
			
		||||
@@ -12,7 +15,7 @@ namespace CalculatorUITests
 | 
			
		||||
    [TestClass]
 | 
			
		||||
    public class StandardModeFunctionalTests
 | 
			
		||||
    {
 | 
			
		||||
        private static StandardCalculatorPage page = new StandardCalculatorPage();
 | 
			
		||||
        private static readonly StandardCalculatorPage page = new StandardCalculatorPage();
 | 
			
		||||
 | 
			
		||||
        /// <summary>
 | 
			
		||||
        /// Initializes the WinAppDriver web driver session.
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user