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