mirror of
https://github.com/Microsoft/calculator.git
synced 2025-08-22 22:23:29 -07:00
Normalize the namespace of CalcViewModel (#33)
* ViewMode: arrange namespaces * UI build pass * run release * UT build pass * pass build * resolve comment: make the diff results cleaner * resolve comment: make the diff results cleaner (2) * resolve comment: make the diff results cleaner (3) * resolve comment: move impl into a namespace * update: spaces * update: CalculatorButtonUser.h * UTF-8 to UTF-8-BOM * remove ViewState.h/.cpp from CalcViewModel path * revert changes for NavCategory.cpp * remove extra space * remove UCM * remove BOM
This commit is contained in:
parent
dce7d2a568
commit
09bbea692d
128 changed files with 461 additions and 461 deletions
|
@ -12,8 +12,8 @@
|
||||||
#include "DataLoaders/UnitConverterDataLoader.h"
|
#include "DataLoaders/UnitConverterDataLoader.h"
|
||||||
|
|
||||||
using namespace CalculatorApp;
|
using namespace CalculatorApp;
|
||||||
using namespace CalculatorApp::Common;
|
using namespace CalculatorApp::ViewModel::Common;
|
||||||
using namespace CalculatorApp::DataLoaders;
|
using namespace CalculatorApp::ViewModel::DataLoaders;
|
||||||
using namespace CalculatorApp::ViewModel;
|
using namespace CalculatorApp::ViewModel;
|
||||||
using namespace CalculationManager;
|
using namespace CalculationManager;
|
||||||
using namespace Platform;
|
using namespace Platform;
|
||||||
|
|
|
@ -17,14 +17,14 @@ namespace CalculatorApp
|
||||||
public:
|
public:
|
||||||
ApplicationViewModel();
|
ApplicationViewModel();
|
||||||
|
|
||||||
void Initialize(CalculatorApp::Common::ViewMode mode); // Use for first init, use deserialize for rehydration
|
void Initialize(CalculatorApp::ViewModel::Common::ViewMode mode); // Use for first init, use deserialize for rehydration
|
||||||
|
|
||||||
OBSERVABLE_OBJECT();
|
OBSERVABLE_OBJECT();
|
||||||
OBSERVABLE_PROPERTY_RW(StandardCalculatorViewModel ^, CalculatorViewModel);
|
OBSERVABLE_PROPERTY_RW(StandardCalculatorViewModel ^, CalculatorViewModel);
|
||||||
OBSERVABLE_PROPERTY_RW(DateCalculatorViewModel ^, DateCalcViewModel);
|
OBSERVABLE_PROPERTY_RW(DateCalculatorViewModel ^, DateCalcViewModel);
|
||||||
OBSERVABLE_PROPERTY_RW(GraphingCalculatorViewModel ^, GraphingCalcViewModel);
|
OBSERVABLE_PROPERTY_RW(GraphingCalculatorViewModel ^, GraphingCalcViewModel);
|
||||||
OBSERVABLE_PROPERTY_RW(UnitConverterViewModel ^, ConverterViewModel);
|
OBSERVABLE_PROPERTY_RW(UnitConverterViewModel ^, ConverterViewModel);
|
||||||
OBSERVABLE_PROPERTY_RW(CalculatorApp::Common::ViewMode, PreviousMode);
|
OBSERVABLE_PROPERTY_RW(CalculatorApp::ViewModel::Common::ViewMode, PreviousMode);
|
||||||
OBSERVABLE_PROPERTY_R(bool, IsAlwaysOnTop);
|
OBSERVABLE_PROPERTY_R(bool, IsAlwaysOnTop);
|
||||||
OBSERVABLE_NAMED_PROPERTY_RW(Platform::String ^, CategoryName);
|
OBSERVABLE_NAMED_PROPERTY_RW(Platform::String ^, CategoryName);
|
||||||
|
|
||||||
|
@ -34,14 +34,14 @@ namespace CalculatorApp
|
||||||
COMMAND_FOR_METHOD(CopyCommand, ApplicationViewModel::OnCopyCommand);
|
COMMAND_FOR_METHOD(CopyCommand, ApplicationViewModel::OnCopyCommand);
|
||||||
COMMAND_FOR_METHOD(PasteCommand, ApplicationViewModel::OnPasteCommand);
|
COMMAND_FOR_METHOD(PasteCommand, ApplicationViewModel::OnPasteCommand);
|
||||||
|
|
||||||
property CalculatorApp::Common::ViewMode Mode
|
property CalculatorApp::ViewModel::Common::ViewMode Mode
|
||||||
{
|
{
|
||||||
CalculatorApp::Common::ViewMode get()
|
CalculatorApp::ViewModel::Common::ViewMode get()
|
||||||
{
|
{
|
||||||
return m_mode;
|
return m_mode;
|
||||||
}
|
}
|
||||||
|
|
||||||
void set(CalculatorApp::Common::ViewMode value);
|
void set(CalculatorApp::ViewModel::Common::ViewMode value);
|
||||||
}
|
}
|
||||||
static property Platform::String^ ModePropertyName
|
static property Platform::String^ ModePropertyName
|
||||||
{
|
{
|
||||||
|
@ -51,21 +51,21 @@ namespace CalculatorApp
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
property Windows::Foundation::Collections::IObservableVector<CalculatorApp::Common::NavCategoryGroup^>^ Categories
|
property Windows::Foundation::Collections::IObservableVector<CalculatorApp::ViewModel::Common::NavCategoryGroup^>^ Categories
|
||||||
{
|
{
|
||||||
Windows::Foundation::Collections::IObservableVector<CalculatorApp::Common::NavCategoryGroup^>^ get()
|
Windows::Foundation::Collections::IObservableVector<CalculatorApp::ViewModel::Common::NavCategoryGroup^>^ get()
|
||||||
{
|
{
|
||||||
return m_categories;
|
return m_categories;
|
||||||
}
|
}
|
||||||
|
|
||||||
void set(Windows::Foundation::Collections::IObservableVector<CalculatorApp::Common::NavCategoryGroup^>^ value);
|
void set(Windows::Foundation::Collections::IObservableVector<CalculatorApp::ViewModel::Common::NavCategoryGroup^>^ value);
|
||||||
}
|
}
|
||||||
|
|
||||||
property Windows::UI::Xaml::Visibility ClearMemoryVisibility
|
property Windows::UI::Xaml::Visibility ClearMemoryVisibility
|
||||||
{
|
{
|
||||||
Windows::UI::Xaml::Visibility get()
|
Windows::UI::Xaml::Visibility get()
|
||||||
{
|
{
|
||||||
return CalculatorApp::Common::NavCategory::IsCalculatorViewMode(Mode) ? Windows::UI::Xaml::Visibility::Visible
|
return CalculatorApp::ViewModel::Common::NavCategory::IsCalculatorViewMode(Mode) ? Windows::UI::Xaml::Visibility::Visible
|
||||||
: Windows::UI::Xaml::Visibility::Collapsed;
|
: Windows::UI::Xaml::Visibility::Collapsed;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -106,8 +106,8 @@ namespace CalculatorApp
|
||||||
|
|
||||||
void SetMenuCategories();
|
void SetMenuCategories();
|
||||||
|
|
||||||
CalculatorApp::Common::ViewMode m_mode;
|
CalculatorApp::ViewModel::Common::ViewMode m_mode;
|
||||||
Windows::Foundation::Collections::IObservableVector<CalculatorApp::Common::NavCategoryGroup ^> ^ m_categories;
|
Windows::Foundation::Collections::IObservableVector<CalculatorApp::ViewModel::Common::NavCategoryGroup ^> ^ m_categories;
|
||||||
Concurrency::task<void> HandleToggleAlwaysOnTop(float width, float height);
|
Concurrency::task<void> HandleToggleAlwaysOnTop(float width, float height);
|
||||||
void SetDisplayNormalAlwaysOnTopOption();
|
void SetDisplayNormalAlwaysOnTopOption();
|
||||||
};
|
};
|
||||||
|
|
|
@ -37,7 +37,7 @@
|
||||||
<PropertyGroup Label="Globals">
|
<PropertyGroup Label="Globals">
|
||||||
<ProjectGuid>{812d1a7b-b8ac-49e4-8e6d-af5d59500d56}</ProjectGuid>
|
<ProjectGuid>{812d1a7b-b8ac-49e4-8e6d-af5d59500d56}</ProjectGuid>
|
||||||
<Keyword>WindowsRuntimeComponent</Keyword>
|
<Keyword>WindowsRuntimeComponent</Keyword>
|
||||||
<RootNamespace>CalculatorApp</RootNamespace>
|
<RootNamespace>CalculatorApp.ViewModel</RootNamespace>
|
||||||
<DefaultLanguage>en-US</DefaultLanguage>
|
<DefaultLanguage>en-US</DefaultLanguage>
|
||||||
<MinimumVisualStudioVersion>14.0</MinimumVisualStudioVersion>
|
<MinimumVisualStudioVersion>14.0</MinimumVisualStudioVersion>
|
||||||
<AppContainerApplication>true</AppContainerApplication>
|
<AppContainerApplication>true</AppContainerApplication>
|
||||||
|
|
|
@ -7,6 +7,7 @@
|
||||||
using namespace Platform;
|
using namespace Platform;
|
||||||
using namespace Windows::ApplicationModel::Resources;
|
using namespace Windows::ApplicationModel::Resources;
|
||||||
using namespace CalculatorApp;
|
using namespace CalculatorApp;
|
||||||
|
using namespace CalculatorApp::ViewModel::Common;
|
||||||
|
|
||||||
AppResourceProvider::AppResourceProvider()
|
AppResourceProvider::AppResourceProvider()
|
||||||
{
|
{
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
namespace CalculatorApp
|
namespace CalculatorApp::ViewModel::Common
|
||||||
{
|
{
|
||||||
public ref class AppResourceProvider sealed
|
public ref class AppResourceProvider sealed
|
||||||
{
|
{
|
||||||
|
|
|
@ -9,7 +9,7 @@
|
||||||
// being used. Depending on the version of the OS the app is running on,
|
// being used. Depending on the version of the OS the app is running on,
|
||||||
// the app may need a host that uses LiveRegionChanged or RaiseNotification.
|
// the app may need a host that uses LiveRegionChanged or RaiseNotification.
|
||||||
|
|
||||||
namespace CalculatorApp::Common::Automation
|
namespace CalculatorApp::ViewModel::Common::Automation
|
||||||
{
|
{
|
||||||
public
|
public
|
||||||
interface class INarratorAnnouncementHost
|
interface class INarratorAnnouncementHost
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
#include "pch.h"
|
#include "pch.h"
|
||||||
#include "LiveRegionHost.h"
|
#include "LiveRegionHost.h"
|
||||||
|
|
||||||
using namespace CalculatorApp::Common::Automation;
|
using namespace CalculatorApp::ViewModel::Common::Automation;
|
||||||
using namespace Windows::UI::Xaml::Automation;
|
using namespace Windows::UI::Xaml::Automation;
|
||||||
using namespace Windows::UI::Xaml::Automation::Peers;
|
using namespace Windows::UI::Xaml::Automation::Peers;
|
||||||
using namespace Windows::UI::Xaml::Controls;
|
using namespace Windows::UI::Xaml::Controls;
|
||||||
|
|
|
@ -9,7 +9,7 @@
|
||||||
// This event is unreliable and should be deprecated in favor of the new
|
// This event is unreliable and should be deprecated in favor of the new
|
||||||
// RaiseNotification API in RS3.
|
// RaiseNotification API in RS3.
|
||||||
|
|
||||||
namespace CalculatorApp::Common::Automation
|
namespace CalculatorApp::ViewModel::Common::Automation
|
||||||
{
|
{
|
||||||
// This class exists so that the app can run on RS2 and use LiveRegions
|
// This class exists so that the app can run on RS2 and use LiveRegions
|
||||||
// to host notifications on those builds.
|
// to host notifications on those builds.
|
||||||
|
|
|
@ -4,11 +4,11 @@
|
||||||
#include "pch.h"
|
#include "pch.h"
|
||||||
#include "NarratorAnnouncement.h"
|
#include "NarratorAnnouncement.h"
|
||||||
|
|
||||||
using namespace CalculatorApp::Common::Automation;
|
using namespace CalculatorApp::ViewModel::Common::Automation;
|
||||||
using namespace Platform;
|
using namespace Platform;
|
||||||
using namespace Windows::UI::Xaml::Automation::Peers;
|
using namespace Windows::UI::Xaml::Automation::Peers;
|
||||||
|
|
||||||
namespace CalculatorApp::Common::Automation
|
namespace CalculatorApp::ViewModel::Common::Automation
|
||||||
{
|
{
|
||||||
namespace CalculatorActivityIds
|
namespace CalculatorActivityIds
|
||||||
{
|
{
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
namespace CalculatorApp::Common::Automation
|
namespace CalculatorApp::ViewModel::Common::Automation
|
||||||
{
|
{
|
||||||
public
|
public
|
||||||
ref class NarratorAnnouncement sealed
|
ref class NarratorAnnouncement sealed
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
#include "NotificationHost.h"
|
#include "NotificationHost.h"
|
||||||
#include "LiveRegionHost.h"
|
#include "LiveRegionHost.h"
|
||||||
|
|
||||||
using namespace CalculatorApp::Common::Automation;
|
using namespace CalculatorApp::ViewModel::Common::Automation;
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
||||||
INarratorAnnouncementHost ^ NarratorAnnouncementHostFactory::s_hostProducer;
|
INarratorAnnouncementHost ^ NarratorAnnouncementHostFactory::s_hostProducer;
|
||||||
|
|
|
@ -9,7 +9,7 @@
|
||||||
// Depending on the version of the OS the app is running on, the factory will return
|
// Depending on the version of the OS the app is running on, the factory will return
|
||||||
// an announcement host appropriate for that version.
|
// an announcement host appropriate for that version.
|
||||||
|
|
||||||
namespace CalculatorApp::Common::Automation
|
namespace CalculatorApp::ViewModel::Common::Automation
|
||||||
{
|
{
|
||||||
class NarratorAnnouncementHostFactory
|
class NarratorAnnouncementHostFactory
|
||||||
{
|
{
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
#include "pch.h"
|
#include "pch.h"
|
||||||
#include "NarratorNotifier.h"
|
#include "NarratorNotifier.h"
|
||||||
|
|
||||||
using namespace CalculatorApp::Common::Automation;
|
using namespace CalculatorApp::ViewModel::Common::Automation;
|
||||||
using namespace Platform;
|
using namespace Platform;
|
||||||
using namespace Windows::UI::Xaml;
|
using namespace Windows::UI::Xaml;
|
||||||
using namespace Windows::UI::Xaml::Automation;
|
using namespace Windows::UI::Xaml::Automation;
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
#include "NarratorAnnouncement.h"
|
#include "NarratorAnnouncement.h"
|
||||||
|
|
||||||
namespace CalculatorApp::Common::Automation
|
namespace CalculatorApp::ViewModel::Common::Automation
|
||||||
{
|
{
|
||||||
public
|
public
|
||||||
ref class NarratorNotifier sealed : public Windows::UI::Xaml::DependencyObject
|
ref class NarratorNotifier sealed : public Windows::UI::Xaml::DependencyObject
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
#include "pch.h"
|
#include "pch.h"
|
||||||
#include "NotificationHost.h"
|
#include "NotificationHost.h"
|
||||||
|
|
||||||
using namespace CalculatorApp::Common::Automation;
|
using namespace CalculatorApp::ViewModel::Common::Automation;
|
||||||
using namespace Windows::Foundation::Metadata;
|
using namespace Windows::Foundation::Metadata;
|
||||||
using namespace Windows::UI::Xaml::Automation;
|
using namespace Windows::UI::Xaml::Automation;
|
||||||
using namespace Windows::UI::Xaml::Automation::Peers;
|
using namespace Windows::UI::Xaml::Automation::Peers;
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
// This class announces NarratorAnnouncements using the RaiseNotification API
|
// This class announces NarratorAnnouncements using the RaiseNotification API
|
||||||
// available in RS3.
|
// available in RS3.
|
||||||
|
|
||||||
namespace CalculatorApp::Common::Automation
|
namespace CalculatorApp::ViewModel::Common::Automation
|
||||||
{
|
{
|
||||||
public
|
public
|
||||||
ref class NotificationHost sealed : public INarratorAnnouncementHost
|
ref class NotificationHost sealed : public INarratorAnnouncementHost
|
||||||
|
@ -23,10 +23,10 @@ public
|
||||||
|
|
||||||
private:
|
private:
|
||||||
static Windows::UI::Xaml::Automation::Peers::AutomationNotificationKind
|
static Windows::UI::Xaml::Automation::Peers::AutomationNotificationKind
|
||||||
GetWindowsNotificationKind(CalculatorApp::Common::Automation::AutomationNotificationKind customKindType);
|
GetWindowsNotificationKind(CalculatorApp::ViewModel::Common::Automation::AutomationNotificationKind customKindType);
|
||||||
|
|
||||||
static Windows::UI::Xaml::Automation::Peers::AutomationNotificationProcessing
|
static Windows::UI::Xaml::Automation::Peers::AutomationNotificationProcessing
|
||||||
GetWindowsNotificationProcessing(CalculatorApp::Common::Automation::AutomationNotificationProcessing customProcessingType);
|
GetWindowsNotificationProcessing(CalculatorApp::ViewModel::Common::Automation::AutomationNotificationProcessing customProcessingType);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Windows::UI::Xaml::UIElement ^ m_host;
|
Windows::UI::Xaml::UIElement ^ m_host;
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
namespace CalculatorApp
|
namespace CalculatorApp::ViewModel
|
||||||
{
|
{
|
||||||
namespace Common
|
namespace Common
|
||||||
{
|
{
|
||||||
|
|
|
@ -5,7 +5,8 @@
|
||||||
#include "CalculatorButtonPressedEventArgs.h"
|
#include "CalculatorButtonPressedEventArgs.h"
|
||||||
|
|
||||||
using namespace CalculatorApp;
|
using namespace CalculatorApp;
|
||||||
using namespace CalculatorApp::Common;
|
using namespace CalculatorApp::ViewModel;
|
||||||
|
using namespace CalculatorApp::ViewModel::Common;
|
||||||
using namespace Platform;
|
using namespace Platform;
|
||||||
|
|
||||||
NumbersAndOperatorsEnum CalculatorButtonPressedEventArgs::GetOperationFromCommandParameter(_In_ Object ^ commandParameter)
|
NumbersAndOperatorsEnum CalculatorButtonPressedEventArgs::GetOperationFromCommandParameter(_In_ Object ^ commandParameter)
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
#include "CalculatorButtonUser.h"
|
#include "CalculatorButtonUser.h"
|
||||||
#include "Utils.h"
|
#include "Utils.h"
|
||||||
|
|
||||||
namespace CalculatorApp
|
namespace CalculatorApp::ViewModel
|
||||||
{
|
{
|
||||||
namespace Common
|
namespace Common
|
||||||
{
|
{
|
||||||
|
@ -15,15 +15,15 @@ namespace CalculatorApp
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
PROPERTY_R(Platform::String ^, AuditoryFeedback);
|
PROPERTY_R(Platform::String ^, AuditoryFeedback);
|
||||||
PROPERTY_R(CalculatorApp::NumbersAndOperatorsEnum, Operation);
|
PROPERTY_R(CalculatorApp::ViewModel::Common::NumbersAndOperatorsEnum, Operation);
|
||||||
|
|
||||||
CalculatorButtonPressedEventArgs(Platform::String ^ feedback, CalculatorApp::NumbersAndOperatorsEnum operation)
|
CalculatorButtonPressedEventArgs(Platform::String ^ feedback, CalculatorApp::ViewModel::Common::NumbersAndOperatorsEnum operation)
|
||||||
: m_AuditoryFeedback(feedback)
|
: m_AuditoryFeedback(feedback)
|
||||||
, m_Operation(operation)
|
, m_Operation(operation)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
static CalculatorApp::NumbersAndOperatorsEnum GetOperationFromCommandParameter(_In_ Platform::Object ^ commandParameter);
|
static CalculatorApp::ViewModel::Common::NumbersAndOperatorsEnum GetOperationFromCommandParameter(_In_ Platform::Object ^ commandParameter);
|
||||||
static Platform::String ^ GetAuditoryFeedbackFromCommandParameter(_In_ Platform::Object ^ commandParameter);
|
static Platform::String ^ GetAuditoryFeedbackFromCommandParameter(_In_ Platform::Object ^ commandParameter);
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,12 +5,11 @@
|
||||||
|
|
||||||
#include "CalcManager/Command.h"
|
#include "CalcManager/Command.h"
|
||||||
|
|
||||||
namespace CalculatorApp
|
namespace CalculatorApp::ViewModel::Common
|
||||||
{
|
{
|
||||||
namespace CM = CalculationManager;
|
namespace CM = CalculationManager;
|
||||||
|
|
||||||
public
|
public enum class NumbersAndOperatorsEnum
|
||||||
enum class NumbersAndOperatorsEnum
|
|
||||||
{
|
{
|
||||||
Zero = (int)CM::Command::Command0,
|
Zero = (int)CM::Command::Command0,
|
||||||
One = (int)CM::Command::Command1,
|
One = (int)CM::Command::Command1,
|
||||||
|
|
|
@ -8,26 +8,30 @@
|
||||||
#include "StandardCalculatorViewModel.h"
|
#include "StandardCalculatorViewModel.h"
|
||||||
|
|
||||||
using namespace CalculatorApp;
|
using namespace CalculatorApp;
|
||||||
|
using namespace CalculatorApp::ViewModel;
|
||||||
|
using namespace CalculatorApp::ViewModel::Common;
|
||||||
using namespace CalculationManager;
|
using namespace CalculationManager;
|
||||||
using namespace Platform;
|
using namespace Platform;
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
||||||
CalculatorDisplay::CalculatorDisplay()
|
namespace CalculatorApp::ViewModel::Common
|
||||||
{
|
{
|
||||||
}
|
CalculatorDisplay::CalculatorDisplay()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
void CalculatorDisplay::SetCallback(Platform::WeakReference callbackReference)
|
void CalculatorDisplay::SetCallback(Platform::WeakReference callbackReference)
|
||||||
{
|
{
|
||||||
m_callbackReference = callbackReference;
|
m_callbackReference = callbackReference;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CalculatorDisplay::SetHistoryCallback(Platform::WeakReference callbackReference)
|
void CalculatorDisplay::SetHistoryCallback(Platform::WeakReference callbackReference)
|
||||||
{
|
{
|
||||||
m_historyCallbackReference = callbackReference;
|
m_historyCallbackReference = callbackReference;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CalculatorDisplay::SetPrimaryDisplay(_In_ const wstring& displayStringValue, _In_ bool isError)
|
void CalculatorDisplay::SetPrimaryDisplay(_In_ const wstring& displayStringValue, _In_ bool isError)
|
||||||
{
|
{
|
||||||
if (m_callbackReference)
|
if (m_callbackReference)
|
||||||
{
|
{
|
||||||
if (auto calcVM = m_callbackReference.Resolve<ViewModel::StandardCalculatorViewModel>())
|
if (auto calcVM = m_callbackReference.Resolve<ViewModel::StandardCalculatorViewModel>())
|
||||||
|
@ -35,10 +39,10 @@ void CalculatorDisplay::SetPrimaryDisplay(_In_ const wstring& displayStringValue
|
||||||
calcVM->SetPrimaryDisplay(StringReference(displayStringValue.c_str()), isError);
|
calcVM->SetPrimaryDisplay(StringReference(displayStringValue.c_str()), isError);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CalculatorDisplay::SetParenthesisNumber(_In_ unsigned int parenthesisCount)
|
void CalculatorDisplay::SetParenthesisNumber(_In_ unsigned int parenthesisCount)
|
||||||
{
|
{
|
||||||
if (m_callbackReference != nullptr)
|
if (m_callbackReference != nullptr)
|
||||||
{
|
{
|
||||||
if (auto calcVM = m_callbackReference.Resolve<ViewModel::StandardCalculatorViewModel>())
|
if (auto calcVM = m_callbackReference.Resolve<ViewModel::StandardCalculatorViewModel>())
|
||||||
|
@ -46,10 +50,10 @@ void CalculatorDisplay::SetParenthesisNumber(_In_ unsigned int parenthesisCount)
|
||||||
calcVM->SetParenthesisCount(parenthesisCount);
|
calcVM->SetParenthesisCount(parenthesisCount);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CalculatorDisplay::OnNoRightParenAdded()
|
void CalculatorDisplay::OnNoRightParenAdded()
|
||||||
{
|
{
|
||||||
if (m_callbackReference != nullptr)
|
if (m_callbackReference != nullptr)
|
||||||
{
|
{
|
||||||
if (auto calcVM = m_callbackReference.Resolve<ViewModel::StandardCalculatorViewModel>())
|
if (auto calcVM = m_callbackReference.Resolve<ViewModel::StandardCalculatorViewModel>())
|
||||||
|
@ -57,10 +61,10 @@ void CalculatorDisplay::OnNoRightParenAdded()
|
||||||
calcVM->OnNoRightParenAdded();
|
calcVM->OnNoRightParenAdded();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CalculatorDisplay::SetIsInError(bool isError)
|
void CalculatorDisplay::SetIsInError(bool isError)
|
||||||
{
|
{
|
||||||
if (m_callbackReference != nullptr)
|
if (m_callbackReference != nullptr)
|
||||||
{
|
{
|
||||||
if (auto calcVM = m_callbackReference.Resolve<ViewModel::StandardCalculatorViewModel>())
|
if (auto calcVM = m_callbackReference.Resolve<ViewModel::StandardCalculatorViewModel>())
|
||||||
|
@ -68,12 +72,12 @@ void CalculatorDisplay::SetIsInError(bool isError)
|
||||||
calcVM->IsInError = isError;
|
calcVM->IsInError = isError;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CalculatorDisplay::SetExpressionDisplay(
|
void CalculatorDisplay::SetExpressionDisplay(
|
||||||
_Inout_ std::shared_ptr<std::vector<std::pair<std::wstring, int>>> const& tokens,
|
_Inout_ std::shared_ptr<std::vector<std::pair<std::wstring, int>>> const& tokens,
|
||||||
_Inout_ std::shared_ptr<std::vector<std::shared_ptr<IExpressionCommand>>> const& commands)
|
_Inout_ std::shared_ptr<std::vector<std::shared_ptr<IExpressionCommand>>> const& commands)
|
||||||
{
|
{
|
||||||
if (m_callbackReference != nullptr)
|
if (m_callbackReference != nullptr)
|
||||||
{
|
{
|
||||||
if (auto calcVM = m_callbackReference.Resolve<ViewModel::StandardCalculatorViewModel>())
|
if (auto calcVM = m_callbackReference.Resolve<ViewModel::StandardCalculatorViewModel>())
|
||||||
|
@ -81,10 +85,10 @@ void CalculatorDisplay::SetExpressionDisplay(
|
||||||
calcVM->SetExpressionDisplay(tokens, commands);
|
calcVM->SetExpressionDisplay(tokens, commands);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CalculatorDisplay::SetMemorizedNumbers(_In_ const vector<std::wstring>& newMemorizedNumbers)
|
void CalculatorDisplay::SetMemorizedNumbers(_In_ const vector<std::wstring>& newMemorizedNumbers)
|
||||||
{
|
{
|
||||||
if (m_callbackReference != nullptr)
|
if (m_callbackReference != nullptr)
|
||||||
{
|
{
|
||||||
if (auto calcVM = m_callbackReference.Resolve<ViewModel::StandardCalculatorViewModel>())
|
if (auto calcVM = m_callbackReference.Resolve<ViewModel::StandardCalculatorViewModel>())
|
||||||
|
@ -92,10 +96,10 @@ void CalculatorDisplay::SetMemorizedNumbers(_In_ const vector<std::wstring>& new
|
||||||
calcVM->SetMemorizedNumbers(newMemorizedNumbers);
|
calcVM->SetMemorizedNumbers(newMemorizedNumbers);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CalculatorDisplay::OnHistoryItemAdded(_In_ unsigned int addedItemIndex)
|
void CalculatorDisplay::OnHistoryItemAdded(_In_ unsigned int addedItemIndex)
|
||||||
{
|
{
|
||||||
if (m_historyCallbackReference != nullptr)
|
if (m_historyCallbackReference != nullptr)
|
||||||
{
|
{
|
||||||
if (auto historyVM = m_historyCallbackReference.Resolve<ViewModel::HistoryViewModel>())
|
if (auto historyVM = m_historyCallbackReference.Resolve<ViewModel::HistoryViewModel>())
|
||||||
|
@ -103,10 +107,10 @@ void CalculatorDisplay::OnHistoryItemAdded(_In_ unsigned int addedItemIndex)
|
||||||
historyVM->OnHistoryItemAdded(addedItemIndex);
|
historyVM->OnHistoryItemAdded(addedItemIndex);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CalculatorDisplay::MaxDigitsReached()
|
void CalculatorDisplay::MaxDigitsReached()
|
||||||
{
|
{
|
||||||
if (m_callbackReference != nullptr)
|
if (m_callbackReference != nullptr)
|
||||||
{
|
{
|
||||||
if (auto calcVM = m_callbackReference.Resolve<ViewModel::StandardCalculatorViewModel>())
|
if (auto calcVM = m_callbackReference.Resolve<ViewModel::StandardCalculatorViewModel>())
|
||||||
|
@ -114,10 +118,10 @@ void CalculatorDisplay::MaxDigitsReached()
|
||||||
calcVM->OnMaxDigitsReached();
|
calcVM->OnMaxDigitsReached();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CalculatorDisplay::BinaryOperatorReceived()
|
void CalculatorDisplay::BinaryOperatorReceived()
|
||||||
{
|
{
|
||||||
if (m_callbackReference != nullptr)
|
if (m_callbackReference != nullptr)
|
||||||
{
|
{
|
||||||
if (auto calcVM = m_callbackReference.Resolve<ViewModel::StandardCalculatorViewModel>())
|
if (auto calcVM = m_callbackReference.Resolve<ViewModel::StandardCalculatorViewModel>())
|
||||||
|
@ -125,10 +129,10 @@ void CalculatorDisplay::BinaryOperatorReceived()
|
||||||
calcVM->OnBinaryOperatorReceived();
|
calcVM->OnBinaryOperatorReceived();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CalculatorDisplay::MemoryItemChanged(unsigned int indexOfMemory)
|
void CalculatorDisplay::MemoryItemChanged(unsigned int indexOfMemory)
|
||||||
{
|
{
|
||||||
if (m_callbackReference != nullptr)
|
if (m_callbackReference != nullptr)
|
||||||
{
|
{
|
||||||
if (auto calcVM = m_callbackReference.Resolve<ViewModel::StandardCalculatorViewModel>())
|
if (auto calcVM = m_callbackReference.Resolve<ViewModel::StandardCalculatorViewModel>())
|
||||||
|
@ -136,10 +140,10 @@ void CalculatorDisplay::MemoryItemChanged(unsigned int indexOfMemory)
|
||||||
calcVM->OnMemoryItemChanged(indexOfMemory);
|
calcVM->OnMemoryItemChanged(indexOfMemory);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CalculatorDisplay::InputChanged()
|
void CalculatorDisplay::InputChanged()
|
||||||
{
|
{
|
||||||
if (m_callbackReference != nullptr)
|
if (m_callbackReference != nullptr)
|
||||||
{
|
{
|
||||||
if (auto calcVM = m_callbackReference.Resolve<ViewModel::StandardCalculatorViewModel>())
|
if (auto calcVM = m_callbackReference.Resolve<ViewModel::StandardCalculatorViewModel>())
|
||||||
|
@ -147,4 +151,6 @@ void CalculatorDisplay::InputChanged()
|
||||||
calcVM->OnInputChanged();
|
calcVM->OnInputChanged();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
|
|
||||||
#include "CalcManager/Header Files/ICalcDisplay.h"
|
#include "CalcManager/Header Files/ICalcDisplay.h"
|
||||||
|
|
||||||
namespace CalculatorApp
|
namespace CalculatorApp::ViewModel::Common
|
||||||
{
|
{
|
||||||
// Callback interface to be implemented by the CalculatorManager
|
// Callback interface to be implemented by the CalculatorManager
|
||||||
class CalculatorDisplay : public ICalcDisplay
|
class CalculatorDisplay : public ICalcDisplay
|
||||||
|
|
|
@ -9,7 +9,8 @@
|
||||||
using namespace std;
|
using namespace std;
|
||||||
using namespace concurrency;
|
using namespace concurrency;
|
||||||
using namespace CalculatorApp;
|
using namespace CalculatorApp;
|
||||||
using namespace CalculatorApp::Common;
|
using namespace CalculatorApp::ViewModel::Common;
|
||||||
|
using namespace CalculatorApp::ViewModel;
|
||||||
using namespace Platform;
|
using namespace Platform;
|
||||||
using namespace Platform::Collections;
|
using namespace Platform::Collections;
|
||||||
using namespace Windows::Foundation;
|
using namespace Windows::Foundation;
|
||||||
|
@ -614,7 +615,7 @@ ULONG32 CopyPasteManager::ProgrammerOperandLength(Platform::String ^ operand, Nu
|
||||||
Platform::String ^ CopyPasteManager::RemoveUnwantedCharsFromString(Platform::String ^ input)
|
Platform::String ^ CopyPasteManager::RemoveUnwantedCharsFromString(Platform::String ^ input)
|
||||||
{
|
{
|
||||||
constexpr wchar_t unWantedChars[] = { L' ', L',', L'"', 165, 164, 8373, 36, 8353, 8361, 8362, 8358, 8377, 163, 8364, 8234, 8235, 8236, 8237, 160 };
|
constexpr wchar_t unWantedChars[] = { L' ', L',', L'"', 165, 164, 8373, 36, 8353, 8361, 8362, 8358, 8377, 163, 8364, 8234, 8235, 8236, 8237, 160 };
|
||||||
input = CalculatorApp::Common::LocalizationSettings::GetInstance()->RemoveGroupSeparators(input);
|
input = CalculatorApp::ViewModel::Common::LocalizationSettings::GetInstance()->RemoveGroupSeparators(input);
|
||||||
return ref new String(Utils::RemoveUnwantedCharsFromString(input->Data(), unWantedChars).c_str());
|
return ref new String(Utils::RemoveUnwantedCharsFromString(input->Data(), unWantedChars).c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -13,10 +13,9 @@ namespace CalculatorUnitTests
|
||||||
class CopyPasteManagerTest;
|
class CopyPasteManagerTest;
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace CalculatorApp
|
namespace CalculatorApp::ViewModel::Common
|
||||||
{
|
{
|
||||||
public
|
public value struct CopyPasteMaxOperandLengthAndValue
|
||||||
value struct CopyPasteMaxOperandLengthAndValue
|
|
||||||
{
|
{
|
||||||
unsigned int maxLength;
|
unsigned int maxLength;
|
||||||
unsigned long long maxValue;
|
unsigned long long maxValue;
|
||||||
|
@ -26,9 +25,11 @@ public
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
static void CopyToClipboard(Platform::String ^ stringToCopy);
|
static void CopyToClipboard(Platform::String ^ stringToCopy);
|
||||||
static Windows::Foundation::IAsyncOperation<
|
static Windows::Foundation::IAsyncOperation<Platform::String ^> ^ GetStringToPaste(
|
||||||
Platform::String
|
CalculatorApp::ViewModel::Common::ViewMode mode,
|
||||||
^> ^ GetStringToPaste(CalculatorApp::Common::ViewMode mode, CalculatorApp::Common::CategoryGroupType modeType, CalculatorApp::Common::NumberBase programmerNumberBase, CalculatorApp::Common::BitLength bitLengthType);
|
CalculatorApp::ViewModel::Common::CategoryGroupType modeType,
|
||||||
|
CalculatorApp::ViewModel::Common::NumberBase programmerNumberBase,
|
||||||
|
CalculatorApp::ViewModel::Common::BitLength bitLengthType);
|
||||||
static bool HasStringToPaste();
|
static bool HasStringToPaste();
|
||||||
static bool IsErrorMessage(Platform::String ^ message);
|
static bool IsErrorMessage(Platform::String ^ message);
|
||||||
static property unsigned int MaxPasteableLength
|
static property unsigned int MaxPasteableLength
|
||||||
|
@ -87,39 +88,39 @@ public
|
||||||
static Platform::String
|
static Platform::String
|
||||||
^ ValidatePasteExpression(
|
^ ValidatePasteExpression(
|
||||||
Platform::String ^ pastedText,
|
Platform::String ^ pastedText,
|
||||||
CalculatorApp::Common::ViewMode mode,
|
CalculatorApp::ViewModel::Common::ViewMode mode,
|
||||||
CalculatorApp::Common::NumberBase programmerNumberBase,
|
CalculatorApp::ViewModel::Common::NumberBase programmerNumberBase,
|
||||||
CalculatorApp::Common::BitLength bitLengthType);
|
CalculatorApp::ViewModel::Common::BitLength bitLengthType);
|
||||||
static Platform::String
|
static Platform::String
|
||||||
^ ValidatePasteExpression(
|
^ ValidatePasteExpression(
|
||||||
Platform::String ^ pastedText,
|
Platform::String ^ pastedText,
|
||||||
CalculatorApp::Common::ViewMode mode,
|
CalculatorApp::ViewModel::Common::ViewMode mode,
|
||||||
CalculatorApp::Common::CategoryGroupType modeType,
|
CalculatorApp::ViewModel::Common::CategoryGroupType modeType,
|
||||||
CalculatorApp::Common::NumberBase programmerNumberBase,
|
CalculatorApp::ViewModel::Common::NumberBase programmerNumberBase,
|
||||||
CalculatorApp::Common::BitLength bitLengthType);
|
CalculatorApp::ViewModel::Common::BitLength bitLengthType);
|
||||||
static CopyPasteMaxOperandLengthAndValue GetMaxOperandLengthAndValue(
|
static CopyPasteMaxOperandLengthAndValue GetMaxOperandLengthAndValue(
|
||||||
CalculatorApp::Common::ViewMode mode,
|
CalculatorApp::ViewModel::Common::ViewMode mode,
|
||||||
CalculatorApp::Common::CategoryGroupType modeType,
|
CalculatorApp::ViewModel::Common::CategoryGroupType modeType,
|
||||||
CalculatorApp::Common::NumberBase programmerNumberBase,
|
CalculatorApp::ViewModel::Common::NumberBase programmerNumberBase,
|
||||||
CalculatorApp::Common::BitLength bitLengthType);
|
CalculatorApp::ViewModel::Common::BitLength bitLengthType);
|
||||||
static Windows::Foundation::Collections::IVector<
|
static Windows::Foundation::Collections::IVector<
|
||||||
Platform::String ^> ^ ExtractOperands(Platform::String ^ pasteExpression, CalculatorApp::Common::ViewMode mode);
|
Platform::String ^> ^ ExtractOperands(Platform::String ^ pasteExpression, CalculatorApp::ViewModel::Common::ViewMode mode);
|
||||||
static bool ExpressionRegExMatch(
|
static bool ExpressionRegExMatch(
|
||||||
Windows::Foundation::Collections::IVector<Platform::String ^> ^ operands,
|
Windows::Foundation::Collections::IVector<Platform::String ^> ^ operands,
|
||||||
CalculatorApp::Common::ViewMode mode,
|
CalculatorApp::ViewModel::Common::ViewMode mode,
|
||||||
CalculatorApp::Common::CategoryGroupType modeType,
|
CalculatorApp::ViewModel::Common::CategoryGroupType modeType,
|
||||||
CalculatorApp::Common::NumberBase programmerNumberBase,
|
CalculatorApp::ViewModel::Common::NumberBase programmerNumberBase,
|
||||||
CalculatorApp::Common::BitLength bitLengthType);
|
CalculatorApp::ViewModel::Common::BitLength bitLengthType);
|
||||||
static Platform::String ^ SanitizeOperand(Platform::String ^ operand);
|
static Platform::String ^ SanitizeOperand(Platform::String ^ operand);
|
||||||
static Platform::String ^ RemoveUnwantedCharsFromString(Platform::String ^ input);
|
static Platform::String ^ RemoveUnwantedCharsFromString(Platform::String ^ input);
|
||||||
static Platform::IBox<unsigned long long int> ^ TryOperandToULL(Platform::String ^ operand, CalculatorApp::Common::NumberBase numberBase);
|
static Platform::IBox<unsigned long long int> ^ TryOperandToULL(Platform::String ^ operand, CalculatorApp::ViewModel::Common::NumberBase numberBase);
|
||||||
static ULONG32 StandardScientificOperandLength(Platform::String ^ operand);
|
static ULONG32 StandardScientificOperandLength(Platform::String ^ operand);
|
||||||
static ULONG32 OperandLength(
|
static ULONG32 OperandLength(
|
||||||
Platform::String ^ operand,
|
Platform::String ^ operand,
|
||||||
CalculatorApp::Common::ViewMode mode,
|
CalculatorApp::ViewModel::Common::ViewMode mode,
|
||||||
CalculatorApp::Common::CategoryGroupType modeType,
|
CalculatorApp::ViewModel::Common::CategoryGroupType modeType,
|
||||||
CalculatorApp::Common::NumberBase programmerNumberBase);
|
CalculatorApp::ViewModel::Common::NumberBase programmerNumberBase);
|
||||||
static ULONG32 ProgrammerOperandLength(Platform::String ^ operand, CalculatorApp::Common::NumberBase numberBase);
|
static ULONG32 ProgrammerOperandLength(Platform::String ^ operand, CalculatorApp::ViewModel::Common::NumberBase numberBase);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
static constexpr size_t MaxStandardOperandLengthValue = 16;
|
static constexpr size_t MaxStandardOperandLengthValue = 16;
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
using namespace Platform;
|
using namespace Platform;
|
||||||
using namespace Windows::Foundation;
|
using namespace Windows::Foundation;
|
||||||
using namespace Windows::Globalization;
|
using namespace Windows::Globalization;
|
||||||
using namespace CalculatorApp::Common::DateCalculation;
|
using namespace CalculatorApp::ViewModel::Common::DateCalculation;
|
||||||
|
|
||||||
bool operator==(const DateDifference& l, const DateDifference& r)
|
bool operator==(const DateDifference& l, const DateDifference& r)
|
||||||
{
|
{
|
||||||
|
|
|
@ -13,7 +13,7 @@ const int c_unitsOfDate = 4; // Units Year,Month,Week,Day
|
||||||
const int c_unitsGreaterThanDays = 3; // Units Greater than Days (Year/Month/Week) 3
|
const int c_unitsGreaterThanDays = 3; // Units Greater than Days (Year/Month/Week) 3
|
||||||
const int c_daysInWeek = 7;
|
const int c_daysInWeek = 7;
|
||||||
|
|
||||||
namespace CalculatorApp
|
namespace CalculatorApp::ViewModel
|
||||||
{
|
{
|
||||||
namespace Common
|
namespace Common
|
||||||
{
|
{
|
||||||
|
@ -68,4 +68,4 @@ namespace CalculatorApp
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool operator==(const CalculatorApp::Common::DateCalculation::DateDifference& l, const CalculatorApp::Common::DateCalculation::DateDifference& r);
|
bool operator==(const CalculatorApp::ViewModel::Common::DateCalculation::DateDifference& l, const CalculatorApp::ViewModel::Common::DateCalculation::DateDifference& r);
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
namespace CalculatorApp
|
namespace CalculatorApp::ViewModel
|
||||||
{
|
{
|
||||||
namespace Common
|
namespace Common
|
||||||
{
|
{
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
|
|
||||||
#include "Utils.h"
|
#include "Utils.h"
|
||||||
|
|
||||||
namespace CalculatorApp::Common
|
namespace CalculatorApp::ViewModel::Common
|
||||||
{
|
{
|
||||||
public
|
public
|
||||||
enum class TokenType
|
enum class TokenType
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
#include "EngineResourceProvider.h"
|
#include "EngineResourceProvider.h"
|
||||||
#include "Common/LocalizationSettings.h"
|
#include "Common/LocalizationSettings.h"
|
||||||
|
|
||||||
using namespace CalculatorApp::Common;
|
using namespace CalculatorApp::ViewModel::Common;
|
||||||
using namespace Platform;
|
using namespace Platform;
|
||||||
using namespace Windows::ApplicationModel::Resources;
|
using namespace Windows::ApplicationModel::Resources;
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
|
|
||||||
#include "CalcManager/CalculatorResource.h"
|
#include "CalcManager/CalculatorResource.h"
|
||||||
|
|
||||||
namespace CalculatorApp
|
namespace CalculatorApp::ViewModel::Common
|
||||||
{
|
{
|
||||||
class EngineResourceProvider : public CalculationManager::IResourceProvider
|
class EngineResourceProvider : public CalculationManager::IResourceProvider
|
||||||
{
|
{
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
#include "pch.h"
|
#include "pch.h"
|
||||||
#include "ExpressionCommandDeserializer.h"
|
#include "ExpressionCommandDeserializer.h"
|
||||||
|
|
||||||
using namespace CalculatorApp::Common;
|
using namespace CalculatorApp::ViewModel::Common;
|
||||||
using namespace Windows::Storage::Streams;
|
using namespace Windows::Storage::Streams;
|
||||||
|
|
||||||
CommandDeserializer::CommandDeserializer(_In_ DataReader ^ dataReader)
|
CommandDeserializer::CommandDeserializer(_In_ DataReader ^ dataReader)
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
|
|
||||||
#include "CalcManager/ExpressionCommand.h"
|
#include "CalcManager/ExpressionCommand.h"
|
||||||
|
|
||||||
namespace CalculatorApp
|
namespace CalculatorApp::ViewModel
|
||||||
{
|
{
|
||||||
namespace Common
|
namespace Common
|
||||||
{
|
{
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
#include "pch.h"
|
#include "pch.h"
|
||||||
#include "Common/ExpressionCommandSerializer.h"
|
#include "Common/ExpressionCommandSerializer.h"
|
||||||
|
|
||||||
using namespace CalculatorApp::Common;
|
using namespace CalculatorApp::ViewModel::Common;
|
||||||
using namespace Windows::Storage::Streams;
|
using namespace Windows::Storage::Streams;
|
||||||
|
|
||||||
SerializeCommandVisitor::SerializeCommandVisitor(_In_ DataWriter ^ dataWriter)
|
SerializeCommandVisitor::SerializeCommandVisitor(_In_ DataWriter ^ dataWriter)
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
|
|
||||||
#include "CalcManager/ExpressionCommand.h"
|
#include "CalcManager/ExpressionCommand.h"
|
||||||
|
|
||||||
namespace CalculatorApp
|
namespace CalculatorApp::ViewModel
|
||||||
{
|
{
|
||||||
namespace Common
|
namespace Common
|
||||||
{
|
{
|
||||||
|
|
|
@ -6,8 +6,9 @@
|
||||||
#include "LocalizationSettings.h"
|
#include "LocalizationSettings.h"
|
||||||
#include "AppResourceProvider.h"
|
#include "AppResourceProvider.h"
|
||||||
|
|
||||||
using namespace CalculatorApp::Common;
|
using namespace CalculatorApp::ViewModel::Common;
|
||||||
using namespace CalculatorApp::Common::LocalizationServiceProperties;
|
using namespace CalculatorApp::ViewModel::Common::LocalizationServiceProperties;
|
||||||
|
using namespace CalculatorApp::ViewModel;
|
||||||
using namespace Concurrency;
|
using namespace Concurrency;
|
||||||
using namespace Platform;
|
using namespace Platform;
|
||||||
using namespace Platform::Collections;
|
using namespace Platform::Collections;
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
|
|
||||||
#include "Utils.h"
|
#include "Utils.h"
|
||||||
|
|
||||||
namespace CalculatorApp
|
namespace CalculatorApp::ViewModel
|
||||||
{
|
{
|
||||||
namespace Common
|
namespace Common
|
||||||
{
|
{
|
||||||
|
@ -98,6 +98,5 @@ namespace CalculatorApp
|
||||||
double m_uiCaptionFontScaleFactorOverride;
|
double m_uiCaptionFontScaleFactorOverride;
|
||||||
std::locale m_locale;
|
std::locale m_locale;
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
|
|
||||||
#include <iterator>
|
#include <iterator>
|
||||||
|
|
||||||
namespace CalculatorApp
|
namespace CalculatorApp::ViewModel
|
||||||
{
|
{
|
||||||
namespace Common
|
namespace Common
|
||||||
{
|
{
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
|
|
||||||
#include "AppResourceProvider.h"
|
#include "AppResourceProvider.h"
|
||||||
|
|
||||||
namespace CalculatorApp
|
namespace CalculatorApp::ViewModel
|
||||||
{
|
{
|
||||||
namespace Common
|
namespace Common
|
||||||
{
|
{
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
namespace CalculatorApp
|
namespace CalculatorApp::ViewModel
|
||||||
{
|
{
|
||||||
namespace Common
|
namespace Common
|
||||||
{
|
{
|
||||||
|
|
|
@ -8,7 +8,8 @@
|
||||||
#include <initializer_list>
|
#include <initializer_list>
|
||||||
|
|
||||||
using namespace CalculatorApp;
|
using namespace CalculatorApp;
|
||||||
using namespace CalculatorApp::Common;
|
using namespace CalculatorApp::ViewModel::Common;
|
||||||
|
using namespace CalculatorApp::ViewModel;
|
||||||
using namespace Concurrency;
|
using namespace Concurrency;
|
||||||
using namespace Platform;
|
using namespace Platform;
|
||||||
using namespace Platform::Collections;
|
using namespace Platform::Collections;
|
||||||
|
|
|
@ -17,7 +17,7 @@
|
||||||
#include "Utils.h"
|
#include "Utils.h"
|
||||||
#include "MyVirtualKey.h"
|
#include "MyVirtualKey.h"
|
||||||
|
|
||||||
namespace CalculatorApp
|
namespace CalculatorApp::ViewModel
|
||||||
{
|
{
|
||||||
namespace Common
|
namespace Common
|
||||||
{
|
{
|
||||||
|
|
|
@ -5,6 +5,8 @@
|
||||||
#include "NetworkManager.h"
|
#include "NetworkManager.h"
|
||||||
|
|
||||||
using namespace CalculatorApp;
|
using namespace CalculatorApp;
|
||||||
|
using namespace CalculatorApp::ViewModel;
|
||||||
|
using namespace CalculatorApp::ViewModel::Common;
|
||||||
using namespace Platform;
|
using namespace Platform;
|
||||||
using namespace Windows::Networking::Connectivity;
|
using namespace Windows::Networking::Connectivity;
|
||||||
|
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
namespace CalculatorApp
|
namespace CalculatorApp::ViewModel::Common
|
||||||
{
|
{
|
||||||
public
|
public
|
||||||
enum class NetworkAccessBehavior
|
enum class NetworkAccessBehavior
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
// Licensed under the MIT License.
|
// Licensed under the MIT License.
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
namespace CalculatorApp::Common
|
namespace CalculatorApp::ViewModel::Common
|
||||||
{
|
{
|
||||||
public
|
public
|
||||||
enum class NumberBase
|
enum class NumberBase
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
namespace CalculatorApp
|
namespace CalculatorApp::ViewModel
|
||||||
{
|
{
|
||||||
namespace Common
|
namespace Common
|
||||||
{
|
{
|
||||||
|
|
|
@ -7,7 +7,8 @@
|
||||||
#include "CalculatorButtonUser.h"
|
#include "CalculatorButtonUser.h"
|
||||||
|
|
||||||
using namespace CalculatorApp;
|
using namespace CalculatorApp;
|
||||||
using namespace CalculatorApp::Common;
|
using namespace CalculatorApp::ViewModel::Common;
|
||||||
|
using namespace CalculatorApp::ViewModel;
|
||||||
using namespace TraceLogging;
|
using namespace TraceLogging;
|
||||||
using namespace Concurrency;
|
using namespace Concurrency;
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
|
@ -8,15 +8,15 @@
|
||||||
|
|
||||||
// A trace logging provider can only be instantiated and registered once per module.
|
// A trace logging provider can only be instantiated and registered once per module.
|
||||||
// This class implements a singleton model ensure that only one instance is created.
|
// This class implements a singleton model ensure that only one instance is created.
|
||||||
namespace CalculatorApp
|
namespace CalculatorApp::ViewModel::Common
|
||||||
{
|
{
|
||||||
struct ButtonLog
|
struct ButtonLog
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
int count;
|
int count;
|
||||||
CalculatorApp::NumbersAndOperatorsEnum button;
|
CalculatorApp::ViewModel::Common::NumbersAndOperatorsEnum button;
|
||||||
CalculatorApp::Common::ViewMode mode;
|
CalculatorApp::ViewModel::Common::ViewMode mode;
|
||||||
ButtonLog(CalculatorApp::NumbersAndOperatorsEnum btn, CalculatorApp::Common::ViewMode vMode)
|
ButtonLog(CalculatorApp::ViewModel::Common::NumbersAndOperatorsEnum btn, CalculatorApp::ViewModel::Common::ViewMode vMode)
|
||||||
{
|
{
|
||||||
button = btn;
|
button = btn;
|
||||||
mode = vMode;
|
mode = vMode;
|
||||||
|
@ -62,20 +62,20 @@ namespace CalculatorApp
|
||||||
public:
|
public:
|
||||||
static TraceLogger ^ GetInstance();
|
static TraceLogger ^ GetInstance();
|
||||||
|
|
||||||
void LogModeChange(CalculatorApp::Common::ViewMode mode);
|
void LogModeChange(CalculatorApp::ViewModel::Common::ViewMode mode);
|
||||||
void LogHistoryItemLoad(CalculatorApp::Common::ViewMode mode, int historyListSize, int loadedIndex);
|
void LogHistoryItemLoad(CalculatorApp::ViewModel::Common::ViewMode mode, int historyListSize, int loadedIndex);
|
||||||
void LogMemoryItemLoad(CalculatorApp::Common::ViewMode mode, int memoryListSize, int loadedIndex);
|
void LogMemoryItemLoad(CalculatorApp::ViewModel::Common::ViewMode mode, int memoryListSize, int loadedIndex);
|
||||||
void UpdateButtonUsage(CalculatorApp::NumbersAndOperatorsEnum button, CalculatorApp::Common::ViewMode mode);
|
void UpdateButtonUsage(CalculatorApp::ViewModel::Common::NumbersAndOperatorsEnum button, CalculatorApp::ViewModel::Common::ViewMode mode);
|
||||||
void LogButtonUsage();
|
void LogButtonUsage();
|
||||||
void LogDateCalculationModeUsed(bool AddSubtractMode);
|
void LogDateCalculationModeUsed(bool AddSubtractMode);
|
||||||
void UpdateWindowCount(uint64 windowCount);
|
void UpdateWindowCount(uint64 windowCount);
|
||||||
void DecreaseWindowCount();
|
void DecreaseWindowCount();
|
||||||
bool IsWindowIdInLog(int windowId);
|
bool IsWindowIdInLog(int windowId);
|
||||||
void LogVisualStateChanged(CalculatorApp::Common::ViewMode mode, Platform::String ^ state, bool isAlwaysOnTop);
|
void LogVisualStateChanged(CalculatorApp::ViewModel::Common::ViewMode mode, Platform::String ^ state, bool isAlwaysOnTop);
|
||||||
void LogWindowCreated(CalculatorApp::Common::ViewMode mode, int windowId);
|
void LogWindowCreated(CalculatorApp::ViewModel::Common::ViewMode mode, int windowId);
|
||||||
void LogConverterInputReceived(CalculatorApp::Common::ViewMode mode);
|
void LogConverterInputReceived(CalculatorApp::ViewModel::Common::ViewMode mode);
|
||||||
void LogNavBarOpened();
|
void LogNavBarOpened();
|
||||||
void LogError(CalculatorApp::Common::ViewMode mode, Platform::String ^ functionName, Platform::String ^ errorString);
|
void LogError(CalculatorApp::ViewModel::Common::ViewMode mode, Platform::String ^ functionName, Platform::String ^ errorString);
|
||||||
void LogShowHideButtonClicked(bool isHideButton);
|
void LogShowHideButtonClicked(bool isHideButton);
|
||||||
void LogGraphButtonClicked(GraphButton buttonName, GraphButtonValue buttonValue);
|
void LogGraphButtonClicked(GraphButton buttonName, GraphButtonValue buttonValue);
|
||||||
void LogGraphLineStyleChanged(LineStyleType style);
|
void LogGraphLineStyleChanged(LineStyleType style);
|
||||||
|
@ -83,12 +83,12 @@ namespace CalculatorApp
|
||||||
void LogVariableSettingsChanged(Platform::String ^ setting);
|
void LogVariableSettingsChanged(Platform::String ^ setting);
|
||||||
void LogGraphSettingsChanged(GraphSettingsType settingsType, Platform::String ^ settingValue);
|
void LogGraphSettingsChanged(GraphSettingsType settingsType, Platform::String ^ settingValue);
|
||||||
void LogGraphTheme(Platform::String ^ graphTheme);
|
void LogGraphTheme(Platform::String ^ graphTheme);
|
||||||
// CSHARP_MIGRATION: TODO:
|
|
||||||
void LogPlatformException(CalculatorApp::Common::ViewMode mode, Platform::String ^ functionName, Platform::Exception ^ e);
|
|
||||||
|
|
||||||
internal:
|
internal:
|
||||||
void LogStandardException(CalculatorApp::Common::ViewMode mode, std::wstring_view functionName, _In_ const std::exception& e);
|
// CSHARP_MIGRATION: TODO:
|
||||||
void LogInputPasted(CalculatorApp::Common::ViewMode mode);
|
void LogPlatformException(CalculatorApp::ViewModel::Common::ViewMode mode, Platform::String ^ functionName, Platform::Exception ^ e);
|
||||||
|
void LogStandardException(CalculatorApp::ViewModel::Common::ViewMode mode, std::wstring_view functionName, _In_ const std::exception& e);
|
||||||
|
void LogInputPasted(CalculatorApp::ViewModel::Common::ViewMode mode);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
// Create an instance of TraceLogger
|
// Create an instance of TraceLogger
|
||||||
|
|
|
@ -13,7 +13,7 @@
|
||||||
#include "CalcManager/NumberFormattingUtils.h"
|
#include "CalcManager/NumberFormattingUtils.h"
|
||||||
|
|
||||||
using namespace CalculatorApp;
|
using namespace CalculatorApp;
|
||||||
using namespace CalculatorApp::Common;
|
using namespace CalculatorApp::ViewModel::Common;
|
||||||
using namespace concurrency;
|
using namespace concurrency;
|
||||||
using namespace Graphing::Renderer;
|
using namespace Graphing::Renderer;
|
||||||
using namespace Platform;
|
using namespace Platform;
|
||||||
|
@ -179,7 +179,7 @@ bool operator!=(const Color& color1, const Color& color2)
|
||||||
return !(color1 == color2);
|
return !(color1 == color2);
|
||||||
}
|
}
|
||||||
|
|
||||||
String^ CalculatorApp::Utilities::EscapeHtmlSpecialCharacters(String^ originalString)
|
String^ CalculatorApp::ViewModel::Common::Utilities::EscapeHtmlSpecialCharacters(String^ originalString)
|
||||||
{
|
{
|
||||||
// Construct a default special characters if not provided.
|
// Construct a default special characters if not provided.
|
||||||
const std::vector<wchar_t> specialCharacters {L'&', L'\"', L'\'', L'<', L'>'};
|
const std::vector<wchar_t> specialCharacters {L'&', L'\"', L'\'', L'<', L'>'};
|
||||||
|
@ -236,14 +236,14 @@ String^ CalculatorApp::Utilities::EscapeHtmlSpecialCharacters(String^ originalSt
|
||||||
return replaceCharacters ? replacementString : originalString;
|
return replaceCharacters ? replacementString : originalString;
|
||||||
}
|
}
|
||||||
|
|
||||||
Platform::String^ CalculatorApp::Utilities::TrimTrailingZeros(Platform::String^ input)
|
Platform::String^ CalculatorApp::ViewModel::Common::Utilities::TrimTrailingZeros(Platform::String^ input)
|
||||||
{
|
{
|
||||||
std::wstring tmp(input->Data());
|
std::wstring tmp(input->Data());
|
||||||
CalcManager::NumberFormattingUtils::TrimTrailingZeros(tmp);
|
CalcManager::NumberFormattingUtils::TrimTrailingZeros(tmp);
|
||||||
return ref new Platform::String(tmp.c_str());
|
return ref new Platform::String(tmp.c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CalculatorApp::Utilities::AreColorsEqual(Windows::UI::Color color1, Windows::UI::Color color2)
|
bool CalculatorApp::ViewModel::Common::Utilities::AreColorsEqual(Windows::UI::Color color1, Windows::UI::Color color2)
|
||||||
{
|
{
|
||||||
return Utils::AreColorsEqual(color1, color2);
|
return Utils::AreColorsEqual(color1, color2);
|
||||||
}
|
}
|
||||||
|
@ -251,7 +251,7 @@ bool CalculatorApp::Utilities::AreColorsEqual(Windows::UI::Color color1, Windows
|
||||||
// This method calculates the luminance ratio between White and the given background color.
|
// This method calculates the luminance ratio between White and the given background color.
|
||||||
// The luminance is calculate using the RGB values and does not use the A value.
|
// The luminance is calculate using the RGB values and does not use the A value.
|
||||||
// White or Black is returned
|
// White or Black is returned
|
||||||
SolidColorBrush ^ CalculatorApp::Utilities::GetContrastColor(Color backgroundColor)
|
SolidColorBrush ^ CalculatorApp::ViewModel::Common::Utilities::GetContrastColor(Color backgroundColor)
|
||||||
{
|
{
|
||||||
auto luminance = 0.2126 * backgroundColor.R + 0.7152 * backgroundColor.G + 0.0722 * backgroundColor.B;
|
auto luminance = 0.2126 * backgroundColor.R + 0.7152 * backgroundColor.G + 0.0722 * backgroundColor.B;
|
||||||
|
|
||||||
|
@ -263,7 +263,7 @@ SolidColorBrush ^ CalculatorApp::Utilities::GetContrastColor(Color backgroundCol
|
||||||
return static_cast<SolidColorBrush ^>(Application::Current->Resources->Lookup(L"BlackBrush"));
|
return static_cast<SolidColorBrush ^>(Application::Current->Resources->Lookup(L"BlackBrush"));
|
||||||
}
|
}
|
||||||
|
|
||||||
int CalculatorApp::Utilities::GetWindowId()
|
int CalculatorApp::ViewModel::Common::Utilities::GetWindowId()
|
||||||
{
|
{
|
||||||
return Utils::GetWindowId();
|
return Utils::GetWindowId();
|
||||||
}
|
}
|
||||||
|
|
|
@ -174,8 +174,8 @@ public:
|
||||||
{ \
|
{ \
|
||||||
if (!donotuse_##p) \
|
if (!donotuse_##p) \
|
||||||
{ \
|
{ \
|
||||||
donotuse_##p = ref new CalculatorApp::Common::DelegateCommand( \
|
donotuse_##p = ref new CalculatorApp::ViewModel::Common::DelegateCommand( \
|
||||||
CalculatorApp::Common::MakeDelegateCommandHandler(this, &m) \
|
CalculatorApp::ViewModel::Common::MakeDelegateCommandHandler(this, &m) \
|
||||||
); \
|
); \
|
||||||
} \
|
} \
|
||||||
return donotuse_##p; \
|
return donotuse_##p; \
|
||||||
|
@ -706,9 +706,10 @@ namespace CalculatorApp
|
||||||
return to;
|
return to;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
namespace ViewModel::Common
|
||||||
|
{
|
||||||
// CSHARP_MIGRATION: TODO: Review below utils
|
// CSHARP_MIGRATION: TODO: Review below utils
|
||||||
public
|
public ref class Utilities sealed
|
||||||
ref class Utilities sealed
|
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
static Platform::String ^ EscapeHtmlSpecialCharacters(Platform::String ^ originalString);
|
static Platform::String ^ EscapeHtmlSpecialCharacters(Platform::String ^ originalString);
|
||||||
|
@ -717,6 +718,7 @@ public
|
||||||
static Windows::UI::Xaml::Media::SolidColorBrush ^ GetContrastColor(Windows::UI::Color backgroundColor);
|
static Windows::UI::Xaml::Media::SolidColorBrush ^ GetContrastColor(Windows::UI::Color backgroundColor);
|
||||||
static int GetWindowId();
|
static int GetWindowId();
|
||||||
};
|
};
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// There's no standard definition of equality for Windows::UI::Color structs.
|
// There's no standard definition of equality for Windows::UI::Color structs.
|
||||||
|
|
|
@ -11,11 +11,11 @@
|
||||||
#include "UnitConverterDataConstants.h"
|
#include "UnitConverterDataConstants.h"
|
||||||
|
|
||||||
using namespace CalculatorApp;
|
using namespace CalculatorApp;
|
||||||
using namespace CalculatorApp::Common;
|
using namespace CalculatorApp::ViewModel::Common;
|
||||||
using namespace CalculatorApp::Common::LocalizationServiceProperties;
|
using namespace CalculatorApp::ViewModel::Common::LocalizationServiceProperties;
|
||||||
using namespace CalculatorApp::DataLoaders;
|
using namespace CalculatorApp::ViewModel::DataLoaders;
|
||||||
using namespace CalculatorApp::ViewModel;
|
using namespace CalculatorApp::ViewModel;
|
||||||
using namespace CalculatorApp::ViewModel::CurrencyDataLoaderConstants;
|
using namespace CalculatorApp::ViewModel::DataLoaders::CurrencyDataLoaderConstants;
|
||||||
using namespace concurrency;
|
using namespace concurrency;
|
||||||
using namespace Platform;
|
using namespace Platform;
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
@ -69,7 +69,7 @@ static constexpr auto DEFAULT_TO_CURRENCY = L"EUR";
|
||||||
|
|
||||||
namespace CalculatorApp
|
namespace CalculatorApp
|
||||||
{
|
{
|
||||||
namespace ViewModel
|
namespace ViewModel::DataLoaders
|
||||||
{
|
{
|
||||||
namespace UnitConverterResourceKeys
|
namespace UnitConverterResourceKeys
|
||||||
{
|
{
|
||||||
|
|
|
@ -9,7 +9,7 @@
|
||||||
|
|
||||||
namespace CalculatorApp
|
namespace CalculatorApp
|
||||||
{
|
{
|
||||||
namespace ViewModel
|
namespace ViewModel::DataLoaders
|
||||||
{
|
{
|
||||||
public
|
public
|
||||||
enum class CurrencyLoadStatus
|
enum class CurrencyLoadStatus
|
||||||
|
@ -54,7 +54,9 @@ namespace CalculatorApp
|
||||||
class CurrencyDataLoader : public UCM::IConverterDataLoader, public UCM::ICurrencyConverterDataLoader
|
class CurrencyDataLoader : public UCM::IConverterDataLoader, public UCM::ICurrencyConverterDataLoader
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
CurrencyDataLoader(_In_ std::unique_ptr<CalculatorApp::DataLoaders::ICurrencyHttpClient> client, const wchar_t* overrideLanguage = nullptr);
|
CurrencyDataLoader(
|
||||||
|
_In_ std::unique_ptr<CalculatorApp::ViewModel::DataLoaders::ICurrencyHttpClient> client,
|
||||||
|
const wchar_t* overrideLanguage = nullptr);
|
||||||
~CurrencyDataLoader();
|
~CurrencyDataLoader();
|
||||||
|
|
||||||
bool LoadFinished();
|
bool LoadFinished();
|
||||||
|
@ -82,7 +84,7 @@ namespace CalculatorApp
|
||||||
std::future<bool> TryLoadDataFromWebOverrideAsync() override;
|
std::future<bool> TryLoadDataFromWebOverrideAsync() override;
|
||||||
// ICurrencyConverterDataLoader
|
// ICurrencyConverterDataLoader
|
||||||
|
|
||||||
void OnNetworkBehaviorChanged(CalculatorApp::NetworkAccessBehavior newBehavior);
|
void OnNetworkBehaviorChanged(CalculatorApp::ViewModel::Common::NetworkAccessBehavior newBehavior);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void ResetLoadStatus();
|
void ResetLoadStatus();
|
||||||
|
@ -112,7 +114,7 @@ namespace CalculatorApp
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Platform::String ^ m_responseLanguage;
|
Platform::String ^ m_responseLanguage;
|
||||||
std::unique_ptr<CalculatorApp::DataLoaders::ICurrencyHttpClient> m_client;
|
std::unique_ptr<CalculatorApp::ViewModel::DataLoaders::ICurrencyHttpClient> m_client;
|
||||||
|
|
||||||
bool m_isRtlLanguage;
|
bool m_isRtlLanguage;
|
||||||
|
|
||||||
|
@ -130,8 +132,8 @@ namespace CalculatorApp
|
||||||
|
|
||||||
CurrencyLoadStatus m_loadStatus;
|
CurrencyLoadStatus m_loadStatus;
|
||||||
|
|
||||||
CalculatorApp::NetworkManager ^ m_networkManager;
|
CalculatorApp::ViewModel::Common::NetworkManager ^ m_networkManager;
|
||||||
CalculatorApp::NetworkAccessBehavior m_networkAccessBehavior;
|
CalculatorApp::ViewModel::Common::NetworkAccessBehavior m_networkAccessBehavior;
|
||||||
Windows::Foundation::EventRegistrationToken m_networkBehaviorToken;
|
Windows::Foundation::EventRegistrationToken m_networkBehaviorToken;
|
||||||
bool m_meteredOverrideSet;
|
bool m_meteredOverrideSet;
|
||||||
};
|
};
|
||||||
|
|
|
@ -10,7 +10,7 @@
|
||||||
#include "DataLoaderConstants.h"
|
#include "DataLoaderConstants.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
using namespace CalculatorApp::DataLoaders;
|
using namespace CalculatorApp::ViewModel::DataLoaders;
|
||||||
using namespace Platform;
|
using namespace Platform;
|
||||||
using namespace std;
|
using namespace std;
|
||||||
using namespace Windows::Foundation;
|
using namespace Windows::Foundation;
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
|
|
||||||
namespace CalculatorApp
|
namespace CalculatorApp
|
||||||
{
|
{
|
||||||
namespace DataLoaders
|
namespace ViewModel::DataLoaders
|
||||||
{
|
{
|
||||||
class CurrencyHttpClient : public ICurrencyHttpClient
|
class CurrencyHttpClient : public ICurrencyHttpClient
|
||||||
{
|
{
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
|
|
||||||
namespace CalculatorApp
|
namespace CalculatorApp
|
||||||
{
|
{
|
||||||
namespace DataLoaders
|
namespace ViewModel::DataLoaders
|
||||||
{
|
{
|
||||||
static constexpr auto sc_MetadataUriLocalizeFor = L"https://go.microsoft.com/fwlink/?linkid=2091028&localizeFor=";
|
static constexpr auto sc_MetadataUriLocalizeFor = L"https://go.microsoft.com/fwlink/?linkid=2091028&localizeFor=";
|
||||||
static constexpr auto sc_RatiosUriRelativeTo = L"https://go.microsoft.com/fwlink/?linkid=2091307&localCurrency=";
|
static constexpr auto sc_RatiosUriRelativeTo = L"https://go.microsoft.com/fwlink/?linkid=2091307&localCurrency=";
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
|
|
||||||
namespace CalculatorApp
|
namespace CalculatorApp
|
||||||
{
|
{
|
||||||
namespace DataLoaders
|
namespace ViewModel::DataLoaders
|
||||||
{
|
{
|
||||||
class ICurrencyHttpClient
|
class ICurrencyHttpClient
|
||||||
{
|
{
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
|
|
||||||
namespace CalculatorApp
|
namespace CalculatorApp
|
||||||
{
|
{
|
||||||
namespace ViewModel
|
namespace ViewModel::Common
|
||||||
{
|
{
|
||||||
private
|
private
|
||||||
enum UnitConverterUnits
|
enum UnitConverterUnits
|
||||||
|
|
|
@ -7,8 +7,8 @@
|
||||||
#include "UnitConverterDataConstants.h"
|
#include "UnitConverterDataConstants.h"
|
||||||
#include "CurrencyDataLoader.h"
|
#include "CurrencyDataLoader.h"
|
||||||
|
|
||||||
using namespace CalculatorApp::Common;
|
using namespace CalculatorApp::ViewModel::Common;
|
||||||
using namespace CalculatorApp::DataLoaders;
|
using namespace CalculatorApp::ViewModel::DataLoaders;
|
||||||
using namespace CalculatorApp::ViewModel;
|
using namespace CalculatorApp::ViewModel;
|
||||||
using namespace Platform;
|
using namespace Platform;
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
|
|
||||||
namespace CalculatorApp
|
namespace CalculatorApp
|
||||||
{
|
{
|
||||||
namespace ViewModel
|
namespace ViewModel::Common
|
||||||
{
|
{
|
||||||
struct OrderedUnit : UnitConversionManager::Unit
|
struct OrderedUnit : UnitConversionManager::Unit
|
||||||
{
|
{
|
||||||
|
@ -34,7 +34,7 @@ namespace CalculatorApp
|
||||||
|
|
||||||
struct UnitData
|
struct UnitData
|
||||||
{
|
{
|
||||||
CalculatorApp::Common::ViewMode categoryId;
|
CalculatorApp::ViewModel::Common::ViewMode categoryId;
|
||||||
int unitId;
|
int unitId;
|
||||||
double factor;
|
double factor;
|
||||||
};
|
};
|
||||||
|
@ -45,7 +45,7 @@ namespace CalculatorApp
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
ExplicitUnitConversionData(
|
ExplicitUnitConversionData(
|
||||||
CalculatorApp::Common::ViewMode categoryId,
|
CalculatorApp::ViewModel::Common::ViewMode categoryId,
|
||||||
int parentUnitId,
|
int parentUnitId,
|
||||||
int unitId,
|
int unitId,
|
||||||
double ratio,
|
double ratio,
|
||||||
|
@ -58,7 +58,7 @@ namespace CalculatorApp
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
CalculatorApp::Common::ViewMode categoryId;
|
CalculatorApp::ViewModel::Common::ViewMode categoryId;
|
||||||
int parentUnitId;
|
int parentUnitId;
|
||||||
int unitId;
|
int unitId;
|
||||||
};
|
};
|
||||||
|
@ -79,10 +79,9 @@ namespace CalculatorApp
|
||||||
// IConverterDataLoader
|
// IConverterDataLoader
|
||||||
|
|
||||||
void GetCategories(_In_ std::shared_ptr<std::vector<UnitConversionManager::Category>> categoriesList);
|
void GetCategories(_In_ std::shared_ptr<std::vector<UnitConversionManager::Category>> categoriesList);
|
||||||
void GetUnits(_In_ std::unordered_map<CalculatorApp::Common::ViewMode, std::vector<CalculatorApp::ViewModel::OrderedUnit>>& unitMap);
|
void GetUnits(_In_ std::unordered_map<CalculatorApp::ViewModel::Common::ViewMode, std::vector<CalculatorApp::ViewModel::Common::OrderedUnit>>& unitMap);
|
||||||
void GetConversionData(_In_ std::unordered_map<CalculatorApp::Common::ViewMode, std::unordered_map<int, double>>& categoryToUnitConversionMap);
|
void GetConversionData(_In_ std::unordered_map<CalculatorApp::ViewModel::Common::ViewMode, std::unordered_map<int, double>>& categoryToUnitConversionMap);
|
||||||
void
|
void GetExplicitConversionData(_In_ std::unordered_map<int, std::unordered_map<int, UnitConversionManager::ConversionData>>& unitToUnitConversionList);
|
||||||
GetExplicitConversionData(_In_ std::unordered_map<int, std::unordered_map<int, UnitConversionManager::ConversionData>>& unitToUnitConversionList);
|
|
||||||
|
|
||||||
std::wstring GetLocalizedStringName(_In_ Platform::String ^ stringId);
|
std::wstring GetLocalizedStringName(_In_ Platform::String ^ stringId);
|
||||||
|
|
||||||
|
|
|
@ -10,8 +10,8 @@
|
||||||
#include "Common/CopyPasteManager.h"
|
#include "Common/CopyPasteManager.h"
|
||||||
|
|
||||||
using namespace CalculatorApp;
|
using namespace CalculatorApp;
|
||||||
using namespace CalculatorApp::Common;
|
using namespace CalculatorApp::ViewModel::Common;
|
||||||
using namespace CalculatorApp::Common::DateCalculation;
|
using namespace CalculatorApp::ViewModel::Common::DateCalculation;
|
||||||
using namespace CalculatorApp::ViewModel;
|
using namespace CalculatorApp::ViewModel;
|
||||||
using namespace Platform;
|
using namespace Platform;
|
||||||
using namespace Platform::Collections;
|
using namespace Platform::Collections;
|
||||||
|
|
|
@ -125,26 +125,26 @@ namespace CalculatorApp
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
property CalculatorApp::Common::DateCalculation::DateDifference DateDiffResult
|
property CalculatorApp::ViewModel::Common::DateCalculation::DateDifference DateDiffResult
|
||||||
{
|
{
|
||||||
CalculatorApp::Common::DateCalculation::DateDifference get()
|
CalculatorApp::ViewModel::Common::DateCalculation::DateDifference get()
|
||||||
{
|
{
|
||||||
return m_dateDiffResult;
|
return m_dateDiffResult;
|
||||||
}
|
}
|
||||||
void set(CalculatorApp::Common::DateCalculation::DateDifference value)
|
void set(CalculatorApp::ViewModel::Common::DateCalculation::DateDifference value)
|
||||||
{
|
{
|
||||||
m_dateDiffResult = value;
|
m_dateDiffResult = value;
|
||||||
UpdateDisplayResult();
|
UpdateDisplayResult();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
property CalculatorApp::Common::DateCalculation::DateDifference DateDiffResultInDays
|
property CalculatorApp::ViewModel::Common::DateCalculation::DateDifference DateDiffResultInDays
|
||||||
{
|
{
|
||||||
CalculatorApp::Common::DateCalculation::DateDifference get()
|
CalculatorApp::ViewModel::Common::DateCalculation::DateDifference get()
|
||||||
{
|
{
|
||||||
return m_dateDiffResultInDays;
|
return m_dateDiffResultInDays;
|
||||||
}
|
}
|
||||||
void set(CalculatorApp::Common::DateCalculation::DateDifference value)
|
void set(CalculatorApp::ViewModel::Common::DateCalculation::DateDifference value)
|
||||||
{
|
{
|
||||||
m_dateDiffResultInDays = value;
|
m_dateDiffResultInDays = value;
|
||||||
UpdateDisplayResult();
|
UpdateDisplayResult();
|
||||||
|
@ -172,13 +172,13 @@ namespace CalculatorApp
|
||||||
Windows::Foundation::DateTime m_toDate;
|
Windows::Foundation::DateTime m_toDate;
|
||||||
Windows::Foundation::DateTime m_startDate;
|
Windows::Foundation::DateTime m_startDate;
|
||||||
Windows::Foundation::DateTime m_dateResult;
|
Windows::Foundation::DateTime m_dateResult;
|
||||||
CalculatorApp::Common::DateCalculation::DateDifference m_dateDiffResult;
|
CalculatorApp::ViewModel::Common::DateCalculation::DateDifference m_dateDiffResult;
|
||||||
CalculatorApp::Common::DateCalculation::DateDifference m_dateDiffResultInDays;
|
CalculatorApp::ViewModel::Common::DateCalculation::DateDifference m_dateDiffResultInDays;
|
||||||
|
|
||||||
// Private members
|
// Private members
|
||||||
CalculatorApp::Common::DateCalculation::DateCalculationEngine ^ m_dateCalcEngine;
|
CalculatorApp::ViewModel::Common::DateCalculation::DateCalculationEngine ^ m_dateCalcEngine;
|
||||||
CalculatorApp::Common::DateCalculation::DateUnit m_daysOutputFormat;
|
CalculatorApp::ViewModel::Common::DateCalculation::DateUnit m_daysOutputFormat;
|
||||||
CalculatorApp::Common::DateCalculation::DateUnit m_allDateUnitsOutputFormat;
|
CalculatorApp::ViewModel::Common::DateCalculation::DateUnit m_allDateUnitsOutputFormat;
|
||||||
Windows::Globalization::DateTimeFormatting::DateTimeFormatter ^ m_dateTimeFormatter;
|
Windows::Globalization::DateTimeFormatting::DateTimeFormatter ^ m_dateTimeFormatter;
|
||||||
std::wstring m_listSeparator;
|
std::wstring m_listSeparator;
|
||||||
};
|
};
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
#include "CalcViewModel\Common\LocalizationSettings.h"
|
#include "CalcViewModel\Common\LocalizationSettings.h"
|
||||||
#include "CalcViewModel\GraphingCalculatorEnums.h"
|
#include "CalcViewModel\GraphingCalculatorEnums.h"
|
||||||
|
|
||||||
using namespace CalculatorApp::Common;
|
using namespace CalculatorApp::ViewModel::Common;
|
||||||
using namespace Graphing;
|
using namespace Graphing;
|
||||||
using namespace Platform;
|
using namespace Platform;
|
||||||
using namespace Platform::Collections;
|
using namespace Platform::Collections;
|
||||||
|
|
|
@ -6,6 +6,7 @@
|
||||||
#include <CalcManager\NumberFormattingUtils.h>
|
#include <CalcManager\NumberFormattingUtils.h>
|
||||||
|
|
||||||
using namespace CalculatorApp::ViewModel;
|
using namespace CalculatorApp::ViewModel;
|
||||||
|
using namespace CalculatorApp::ViewModel::Common;
|
||||||
using namespace CalcManager::NumberFormattingUtils;
|
using namespace CalcManager::NumberFormattingUtils;
|
||||||
using namespace GraphControl;
|
using namespace GraphControl;
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
@ -102,7 +103,7 @@ void GraphingSettingsViewModel::UpdateDisplayRange()
|
||||||
|
|
||||||
m_Graph->SetDisplayRanges(m_XMinValue, m_XMaxValue, m_YMinValue, m_YMaxValue);
|
m_Graph->SetDisplayRanges(m_XMinValue, m_XMaxValue, m_YMinValue, m_YMaxValue);
|
||||||
|
|
||||||
TraceLogger::GetInstance()->LogGraphSettingsChanged(GraphSettingsType::Grid, L"");
|
CalculatorApp::ViewModel::Common::TraceLogger::GetInstance()->LogGraphSettingsChanged(GraphSettingsType::Grid, L"");
|
||||||
}
|
}
|
||||||
|
|
||||||
bool GraphingSettingsViewModel::HasError()
|
bool GraphingSettingsViewModel::HasError()
|
||||||
|
|
|
@ -232,7 +232,7 @@ namespace CalculatorApp::ViewModel
|
||||||
RaisePropertyChanged(L"TrigModeDegrees");
|
RaisePropertyChanged(L"TrigModeDegrees");
|
||||||
RaisePropertyChanged(L"TrigModeGradians");
|
RaisePropertyChanged(L"TrigModeGradians");
|
||||||
|
|
||||||
TraceLogger::GetInstance()->LogGraphSettingsChanged(GraphSettingsType::TrigUnits, L"Radians");
|
CalculatorApp::ViewModel::Common::TraceLogger::GetInstance()->LogGraphSettingsChanged(CalculatorApp::ViewModel::Common::GraphSettingsType::TrigUnits, L"Radians");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -253,7 +253,7 @@ namespace CalculatorApp::ViewModel
|
||||||
RaisePropertyChanged(L"TrigModeRadians");
|
RaisePropertyChanged(L"TrigModeRadians");
|
||||||
RaisePropertyChanged(L"TrigModeGradians");
|
RaisePropertyChanged(L"TrigModeGradians");
|
||||||
|
|
||||||
TraceLogger::GetInstance()->LogGraphSettingsChanged(GraphSettingsType::TrigUnits, L"Degrees");
|
CalculatorApp::ViewModel::Common::TraceLogger::GetInstance()->LogGraphSettingsChanged(CalculatorApp::ViewModel::Common::GraphSettingsType::TrigUnits, L"Degrees");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -274,7 +274,7 @@ namespace CalculatorApp::ViewModel
|
||||||
RaisePropertyChanged(L"TrigModeDegrees");
|
RaisePropertyChanged(L"TrigModeDegrees");
|
||||||
RaisePropertyChanged(L"TrigModeRadians");
|
RaisePropertyChanged(L"TrigModeRadians");
|
||||||
|
|
||||||
TraceLogger::GetInstance()->LogGraphSettingsChanged(GraphSettingsType::TrigUnits, L"Gradians");
|
CalculatorApp::ViewModel::Common::TraceLogger::GetInstance()->LogGraphSettingsChanged(CalculatorApp::ViewModel::Common::GraphSettingsType::TrigUnits, L"Gradians");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -127,8 +127,8 @@ public
|
||||||
{
|
{
|
||||||
Platform::String ^ get()
|
Platform::String ^ get()
|
||||||
{
|
{
|
||||||
return CalculatorApp::Common::LocalizationStringUtil::GetLocalizedString(
|
return CalculatorApp::ViewModel::Common::LocalizationStringUtil::GetLocalizedString(
|
||||||
CalculatorApp::AppResourceProvider::GetInstance()->GetResourceString(L"VariableListViewItem"), Name);
|
CalculatorApp::ViewModel::Common::AppResourceProvider::GetInstance()->GetResourceString(L"VariableListViewItem"), Name);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
#include "HistoryItemViewModel.h"
|
#include "HistoryItemViewModel.h"
|
||||||
#include "Common/LocalizationService.h"
|
#include "Common/LocalizationService.h"
|
||||||
|
|
||||||
using namespace CalculatorApp::Common;
|
using namespace CalculatorApp::ViewModel::Common;
|
||||||
using namespace CalculatorApp::ViewModel;
|
using namespace CalculatorApp::ViewModel;
|
||||||
using namespace std;
|
using namespace std;
|
||||||
using namespace Platform;
|
using namespace Platform;
|
||||||
|
|
|
@ -9,8 +9,8 @@
|
||||||
#include "StandardCalculatorViewModel.h"
|
#include "StandardCalculatorViewModel.h"
|
||||||
|
|
||||||
using namespace CalculatorApp;
|
using namespace CalculatorApp;
|
||||||
using namespace CalculatorApp::Common;
|
using namespace CalculatorApp::ViewModel::Common;
|
||||||
using namespace CalculatorApp::Common::Automation;
|
using namespace CalculatorApp::ViewModel::Common::Automation;
|
||||||
using namespace CalculatorApp::ViewModel;
|
using namespace CalculatorApp::ViewModel;
|
||||||
using namespace Platform;
|
using namespace Platform;
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
|
@ -28,7 +28,7 @@ namespace CalculatorApp
|
||||||
OBSERVABLE_OBJECT();
|
OBSERVABLE_OBJECT();
|
||||||
OBSERVABLE_PROPERTY_R(Windows::Foundation::Collections::IObservableVector<HistoryItemViewModel ^> ^, Items);
|
OBSERVABLE_PROPERTY_R(Windows::Foundation::Collections::IObservableVector<HistoryItemViewModel ^> ^, Items);
|
||||||
OBSERVABLE_PROPERTY_RW(bool, AreHistoryShortcutsEnabled);
|
OBSERVABLE_PROPERTY_RW(bool, AreHistoryShortcutsEnabled);
|
||||||
OBSERVABLE_PROPERTY_R(CalculatorApp::Common::Automation::NarratorAnnouncement ^, HistoryAnnouncement);
|
OBSERVABLE_PROPERTY_R(CalculatorApp::ViewModel::Common::Automation::NarratorAnnouncement ^, HistoryAnnouncement);
|
||||||
property int ItemsCount
|
property int ItemsCount
|
||||||
{
|
{
|
||||||
int get()
|
int get()
|
||||||
|
@ -49,16 +49,16 @@ namespace CalculatorApp
|
||||||
event HistoryItemClickedHandler ^ HistoryItemClicked;
|
event HistoryItemClickedHandler ^ HistoryItemClicked;
|
||||||
void ShowItem(_In_ CalculatorApp::ViewModel::HistoryItemViewModel ^ e);
|
void ShowItem(_In_ CalculatorApp::ViewModel::HistoryItemViewModel ^ e);
|
||||||
void DeleteItem(_In_ CalculatorApp::ViewModel::HistoryItemViewModel ^ e);
|
void DeleteItem(_In_ CalculatorApp::ViewModel::HistoryItemViewModel ^ e);
|
||||||
void ReloadHistory(_In_ CalculatorApp::Common::ViewMode currentMode);
|
void ReloadHistory(_In_ CalculatorApp::ViewModel::Common::ViewMode currentMode);
|
||||||
|
|
||||||
internal : HistoryViewModel(_In_ CalculationManager::CalculatorManager* calculatorManager);
|
internal : HistoryViewModel(_In_ CalculationManager::CalculatorManager* calculatorManager);
|
||||||
void SetCalculatorDisplay(CalculatorDisplay& calculatorDisplay);
|
void SetCalculatorDisplay(Common::CalculatorDisplay& calculatorDisplay);
|
||||||
unsigned long long GetMaxItemSize();
|
unsigned long long GetMaxItemSize();
|
||||||
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
CalculationManager::CalculatorManager* const m_calculatorManager;
|
CalculationManager::CalculatorManager* const m_calculatorManager;
|
||||||
CalculatorDisplay m_calculatorDisplay;
|
Common::CalculatorDisplay m_calculatorDisplay;
|
||||||
CalculationManager::CalculatorMode m_currentMode;
|
CalculationManager::CalculatorMode m_currentMode;
|
||||||
Platform::String ^ m_localizedHistoryCleared;
|
Platform::String ^ m_localizedHistoryCleared;
|
||||||
Platform::String ^ m_localizedHistorySlotCleared;
|
Platform::String ^ m_localizedHistorySlotCleared;
|
||||||
|
|
|
@ -6,8 +6,8 @@
|
||||||
#include "StandardCalculatorViewModel.h"
|
#include "StandardCalculatorViewModel.h"
|
||||||
|
|
||||||
using namespace CalculatorApp;
|
using namespace CalculatorApp;
|
||||||
using namespace CalculatorApp::Common;
|
using namespace CalculatorApp::ViewModel::Common;
|
||||||
using namespace CalculatorApp::Common::Automation;
|
using namespace CalculatorApp::ViewModel::Common::Automation;
|
||||||
using namespace CalculatorApp::ViewModel;
|
using namespace CalculatorApp::ViewModel;
|
||||||
using namespace Platform;
|
using namespace Platform;
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
|
@ -10,8 +10,8 @@
|
||||||
#include "Common/TraceLogger.h"
|
#include "Common/TraceLogger.h"
|
||||||
|
|
||||||
using namespace CalculatorApp;
|
using namespace CalculatorApp;
|
||||||
using namespace CalculatorApp::Common;
|
using namespace CalculatorApp::ViewModel::Common;
|
||||||
using namespace CalculatorApp::Common::Automation;
|
using namespace CalculatorApp::ViewModel::Common::Automation;
|
||||||
using namespace CalculatorApp::ViewModel;
|
using namespace CalculatorApp::ViewModel;
|
||||||
using namespace CalculationManager;
|
using namespace CalculationManager;
|
||||||
using namespace concurrency;
|
using namespace concurrency;
|
||||||
|
@ -1718,7 +1718,7 @@ ViewMode StandardCalculatorViewModel::GetCalculatorMode()
|
||||||
return ViewMode::Programmer;
|
return ViewMode::Programmer;
|
||||||
}
|
}
|
||||||
|
|
||||||
void StandardCalculatorViewModel::ValueBitLength::set(CalculatorApp::Common::BitLength value)
|
void StandardCalculatorViewModel::ValueBitLength::set(CalculatorApp::ViewModel::Common::BitLength value)
|
||||||
{
|
{
|
||||||
if (m_valueBitLength != value)
|
if (m_valueBitLength != value)
|
||||||
{
|
{
|
||||||
|
|
|
@ -29,7 +29,7 @@ namespace CalculatorApp
|
||||||
|
|
||||||
public value struct ButtonInfo
|
public value struct ButtonInfo
|
||||||
{
|
{
|
||||||
NumbersAndOperatorsEnum buttonId;
|
CalculatorApp::ViewModel::Common::NumbersAndOperatorsEnum buttonId;
|
||||||
bool canSendNegate;
|
bool canSendNegate;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -73,12 +73,12 @@ namespace CalculatorApp
|
||||||
OBSERVABLE_PROPERTY_R(Platform::String ^, CalculationResultAutomationName);
|
OBSERVABLE_PROPERTY_R(Platform::String ^, CalculationResultAutomationName);
|
||||||
OBSERVABLE_PROPERTY_R(Platform::String ^, CalculationExpressionAutomationName);
|
OBSERVABLE_PROPERTY_R(Platform::String ^, CalculationExpressionAutomationName);
|
||||||
OBSERVABLE_PROPERTY_R(bool, IsShiftProgrammerChecked);
|
OBSERVABLE_PROPERTY_R(bool, IsShiftProgrammerChecked);
|
||||||
OBSERVABLE_PROPERTY_R(CalculatorApp::Common::NumberBase, CurrentRadixType);
|
OBSERVABLE_PROPERTY_R(CalculatorApp::ViewModel::Common::NumberBase, CurrentRadixType);
|
||||||
OBSERVABLE_PROPERTY_R(bool, AreTokensUpdated);
|
OBSERVABLE_PROPERTY_R(bool, AreTokensUpdated);
|
||||||
OBSERVABLE_PROPERTY_R(bool, AreAlwaysOnTopResultsUpdated);
|
OBSERVABLE_PROPERTY_R(bool, AreAlwaysOnTopResultsUpdated);
|
||||||
OBSERVABLE_PROPERTY_R(bool, AreProgrammerRadixOperatorsVisible);
|
OBSERVABLE_PROPERTY_R(bool, AreProgrammerRadixOperatorsVisible);
|
||||||
OBSERVABLE_PROPERTY_R(bool, IsInputEmpty);
|
OBSERVABLE_PROPERTY_R(bool, IsInputEmpty);
|
||||||
OBSERVABLE_PROPERTY_R(CalculatorApp::Common::Automation::NarratorAnnouncement ^, Announcement);
|
OBSERVABLE_PROPERTY_R(CalculatorApp::ViewModel::Common::Automation::NarratorAnnouncement ^, Announcement);
|
||||||
OBSERVABLE_PROPERTY_R(unsigned int, OpenParenthesisCount);
|
OBSERVABLE_PROPERTY_R(unsigned int, OpenParenthesisCount);
|
||||||
|
|
||||||
COMMAND_FOR_METHOD(CopyCommand, StandardCalculatorViewModel::OnCopyCommand);
|
COMMAND_FOR_METHOD(CopyCommand, StandardCalculatorViewModel::OnCopyCommand);
|
||||||
|
@ -111,13 +111,13 @@ namespace CalculatorApp
|
||||||
static property Platform::String
|
static property Platform::String
|
||||||
^ IsBitFlipCheckedPropertyName { Platform::String ^ get() { return Platform::StringReference(L"IsBitFlipChecked"); } }
|
^ IsBitFlipCheckedPropertyName { Platform::String ^ get() { return Platform::StringReference(L"IsBitFlipChecked"); } }
|
||||||
|
|
||||||
property CalculatorApp::Common::BitLength ValueBitLength
|
property CalculatorApp::ViewModel::Common::BitLength ValueBitLength
|
||||||
{
|
{
|
||||||
CalculatorApp::Common::BitLength get()
|
CalculatorApp::ViewModel::Common::BitLength get()
|
||||||
{
|
{
|
||||||
return m_valueBitLength;
|
return m_valueBitLength;
|
||||||
}
|
}
|
||||||
void set(CalculatorApp::Common::BitLength value);
|
void set(CalculatorApp::ViewModel::Common::BitLength value);
|
||||||
}
|
}
|
||||||
|
|
||||||
property bool IsStandard
|
property bool IsStandard
|
||||||
|
@ -253,10 +253,10 @@ namespace CalculatorApp
|
||||||
void OnMemorySubtract(Platform::Object ^ memoryItemPosition);
|
void OnMemorySubtract(Platform::Object ^ memoryItemPosition);
|
||||||
void OnMemoryClear(_In_ Platform::Object ^ memoryItemPosition);
|
void OnMemoryClear(_In_ Platform::Object ^ memoryItemPosition);
|
||||||
void SelectHistoryItem(HistoryItemViewModel ^ item);
|
void SelectHistoryItem(HistoryItemViewModel ^ item);
|
||||||
void SwitchProgrammerModeBase(CalculatorApp::Common::NumberBase calculatorBase);
|
void SwitchProgrammerModeBase(CalculatorApp::ViewModel::Common::NumberBase calculatorBase);
|
||||||
void SetBitshiftRadioButtonCheckedAnnouncement(Platform::String ^ announcement);
|
void SetBitshiftRadioButtonCheckedAnnouncement(Platform::String ^ announcement);
|
||||||
void SetOpenParenthesisCountNarratorAnnouncement();
|
void SetOpenParenthesisCountNarratorAnnouncement();
|
||||||
void SwitchAngleType(NumbersAndOperatorsEnum num);
|
void SwitchAngleType(CalculatorApp::ViewModel::Common::NumbersAndOperatorsEnum num);
|
||||||
void FtoEButtonToggled();
|
void FtoEButtonToggled();
|
||||||
|
|
||||||
internal:
|
internal:
|
||||||
|
@ -277,7 +277,7 @@ namespace CalculatorApp
|
||||||
|
|
||||||
Platform::String ^ GetLocalizedStringFormat(Platform::String ^ format, Platform::String ^ displayValue);
|
Platform::String ^ GetLocalizedStringFormat(Platform::String ^ format, Platform::String ^ displayValue);
|
||||||
void OnPropertyChanged(Platform::String ^ propertyname);
|
void OnPropertyChanged(Platform::String ^ propertyname);
|
||||||
void SetCalculatorType(CalculatorApp::Common::ViewMode targetState);
|
void SetCalculatorType(CalculatorApp::ViewModel::Common::ViewMode targetState);
|
||||||
|
|
||||||
Platform::String ^ GetRawDisplayValue();
|
Platform::String ^ GetRawDisplayValue();
|
||||||
void Recalculate(bool fromHistory = false);
|
void Recalculate(bool fromHistory = false);
|
||||||
|
@ -290,7 +290,7 @@ namespace CalculatorApp
|
||||||
{
|
{
|
||||||
m_standardCalculatorManager.UpdateMaxIntDigits();
|
m_standardCalculatorManager.UpdateMaxIntDigits();
|
||||||
}
|
}
|
||||||
NumbersAndOperatorsEnum GetCurrentAngleType()
|
CalculatorApp::ViewModel::Common::NumbersAndOperatorsEnum GetCurrentAngleType()
|
||||||
{
|
{
|
||||||
return m_CurrentAngleType;
|
return m_CurrentAngleType;
|
||||||
}
|
}
|
||||||
|
@ -307,12 +307,12 @@ namespace CalculatorApp
|
||||||
_Inout_ std::shared_ptr<std::vector<std::pair<std::wstring, int>>> const& tokens,
|
_Inout_ std::shared_ptr<std::vector<std::pair<std::wstring, int>>> const& tokens,
|
||||||
_Inout_ std::shared_ptr<std::vector<std::shared_ptr<IExpressionCommand>>> const& commands);
|
_Inout_ std::shared_ptr<std::vector<std::shared_ptr<IExpressionCommand>>> const& commands);
|
||||||
void SetTokens(_Inout_ std::shared_ptr<std::vector<std::pair<std::wstring, int>>> const& tokens);
|
void SetTokens(_Inout_ std::shared_ptr<std::vector<std::pair<std::wstring, int>>> const& tokens);
|
||||||
NumbersAndOperatorsEnum ConvertIntegerToNumbersAndOperatorsEnum(unsigned int parameter);
|
CalculatorApp::ViewModel::Common::NumbersAndOperatorsEnum ConvertIntegerToNumbersAndOperatorsEnum(unsigned int parameter);
|
||||||
static RadixType GetRadixTypeFromNumberBase(CalculatorApp::Common::NumberBase base);
|
static RadixType GetRadixTypeFromNumberBase(CalculatorApp::ViewModel::Common::NumberBase base);
|
||||||
NumbersAndOperatorsEnum m_CurrentAngleType;
|
CalculatorApp::ViewModel::Common::NumbersAndOperatorsEnum m_CurrentAngleType;
|
||||||
wchar_t m_decimalSeparator;
|
wchar_t m_decimalSeparator;
|
||||||
CalculatorDisplay m_calculatorDisplay;
|
CalculatorApp::ViewModel::Common::CalculatorDisplay m_calculatorDisplay;
|
||||||
CalculatorApp::EngineResourceProvider m_resourceProvider;
|
CalculatorApp::ViewModel::Common::EngineResourceProvider m_resourceProvider;
|
||||||
CalculationManager::CalculatorManager m_standardCalculatorManager;
|
CalculationManager::CalculatorManager m_standardCalculatorManager;
|
||||||
Platform::String ^ m_expressionAutomationNameFormat;
|
Platform::String ^ m_expressionAutomationNameFormat;
|
||||||
Platform::String ^ m_localizedCalculationResultAutomationFormat;
|
Platform::String ^ m_localizedCalculationResultAutomationFormat;
|
||||||
|
@ -339,18 +339,18 @@ namespace CalculatorApp
|
||||||
bool m_isRtlLanguage;
|
bool m_isRtlLanguage;
|
||||||
bool m_operandUpdated;
|
bool m_operandUpdated;
|
||||||
bool m_isLastOperationHistoryLoad;
|
bool m_isLastOperationHistoryLoad;
|
||||||
CalculatorApp::Common::BitLength m_valueBitLength;
|
CalculatorApp::ViewModel::Common::BitLength m_valueBitLength;
|
||||||
Platform::String ^ m_selectedExpressionLastData;
|
Platform::String ^ m_selectedExpressionLastData;
|
||||||
Common::DisplayExpressionToken ^ m_selectedExpressionToken;
|
Common::DisplayExpressionToken ^ m_selectedExpressionToken;
|
||||||
|
|
||||||
Platform::String ^ LocalizeDisplayValue(_In_ std::wstring const& displayValue);
|
Platform::String ^ LocalizeDisplayValue(_In_ std::wstring const& displayValue);
|
||||||
Platform::String
|
Platform::String
|
||||||
^ CalculateNarratorDisplayValue(_In_ std::wstring const& displayValue, _In_ Platform::String ^ localizedDisplayValue);
|
^ CalculateNarratorDisplayValue(_In_ std::wstring const& displayValue, _In_ Platform::String ^ localizedDisplayValue);
|
||||||
CalculatorApp::Common::Automation::NarratorAnnouncement ^ GetDisplayUpdatedNarratorAnnouncement();
|
CalculatorApp::ViewModel::Common::Automation::NarratorAnnouncement ^ GetDisplayUpdatedNarratorAnnouncement();
|
||||||
Platform::String ^ GetCalculatorExpressionAutomationName();
|
Platform::String ^ GetCalculatorExpressionAutomationName();
|
||||||
Platform::String ^ GetNarratorStringReadRawNumbers(_In_ Platform::String ^ localizedDisplayValue);
|
Platform::String ^ GetNarratorStringReadRawNumbers(_In_ Platform::String ^ localizedDisplayValue);
|
||||||
|
|
||||||
CalculationManager::Command ConvertToOperatorsEnum(NumbersAndOperatorsEnum operation);
|
CalculationManager::Command ConvertToOperatorsEnum(CalculatorApp::ViewModel::Common::NumbersAndOperatorsEnum operation);
|
||||||
void DisableButtons(CalculationManager::CommandType selectedExpressionCommandType);
|
void DisableButtons(CalculationManager::CommandType selectedExpressionCommandType);
|
||||||
|
|
||||||
Platform::String ^ m_feedbackForButtonPress;
|
Platform::String ^ m_feedbackForButtonPress;
|
||||||
|
@ -371,9 +371,9 @@ namespace CalculatorApp
|
||||||
|
|
||||||
void SaveEditedCommand(_In_ unsigned int index, _In_ CalculationManager::Command command);
|
void SaveEditedCommand(_In_ unsigned int index, _In_ CalculationManager::Command command);
|
||||||
|
|
||||||
CalculatorApp::Common::ViewMode GetCalculatorMode();
|
CalculatorApp::ViewModel::Common::ViewMode GetCalculatorMode();
|
||||||
|
|
||||||
friend class CalculatorDisplay;
|
friend class CalculatorApp::ViewModel::Common::CalculatorDisplay;
|
||||||
friend class CalculatorUnitTests::MultiWindowUnitTests;
|
friend class CalculatorUnitTests::MultiWindowUnitTests;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,9 +15,10 @@
|
||||||
#include "DataLoaders/UnitConverterDataLoader.h"
|
#include "DataLoaders/UnitConverterDataLoader.h"
|
||||||
|
|
||||||
using namespace CalculatorApp;
|
using namespace CalculatorApp;
|
||||||
using namespace CalculatorApp::Common;
|
|
||||||
using namespace CalculatorApp::Common::Automation;
|
|
||||||
using namespace CalculatorApp::ViewModel;
|
using namespace CalculatorApp::ViewModel;
|
||||||
|
using namespace CalculatorApp::ViewModel::Common;
|
||||||
|
using namespace CalculatorApp::ViewModel::Common::Automation;
|
||||||
|
using namespace CalculatorApp::ViewModel::DataLoaders;
|
||||||
using namespace concurrency;
|
using namespace concurrency;
|
||||||
using namespace Platform;
|
using namespace Platform;
|
||||||
using namespace Platform::Collections;
|
using namespace Platform::Collections;
|
||||||
|
@ -75,7 +76,7 @@ namespace
|
||||||
StringReference SupplementaryVisibilityPropertyName(L"SupplementaryVisibility");
|
StringReference SupplementaryVisibilityPropertyName(L"SupplementaryVisibility");
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace CalculatorApp::ViewModel::UnitConverterResourceKeys
|
namespace CalculatorApp::ViewModel::DataLoaders::UnitConverterResourceKeys
|
||||||
{
|
{
|
||||||
StringReference ValueFromFormat(L"Format_ValueFrom");
|
StringReference ValueFromFormat(L"Format_ValueFrom");
|
||||||
StringReference ValueFromDecimalFormat(L"Format_ValueFrom_Decimal");
|
StringReference ValueFromDecimalFormat(L"Format_ValueFrom_Decimal");
|
||||||
|
|
|
@ -163,7 +163,7 @@ namespace CalculatorApp
|
||||||
OBSERVABLE_OBJECT_CALLBACK(OnPropertyChanged);
|
OBSERVABLE_OBJECT_CALLBACK(OnPropertyChanged);
|
||||||
|
|
||||||
OBSERVABLE_PROPERTY_R(Windows::Foundation::Collections::IObservableVector<Category ^> ^, Categories);
|
OBSERVABLE_PROPERTY_R(Windows::Foundation::Collections::IObservableVector<Category ^> ^, Categories);
|
||||||
OBSERVABLE_PROPERTY_RW(CalculatorApp::Common::ViewMode, Mode);
|
OBSERVABLE_PROPERTY_RW(CalculatorApp::ViewModel::Common::ViewMode, Mode);
|
||||||
OBSERVABLE_PROPERTY_R(Windows::Foundation::Collections::IObservableVector<Unit ^> ^, Units);
|
OBSERVABLE_PROPERTY_R(Windows::Foundation::Collections::IObservableVector<Unit ^> ^, Units);
|
||||||
OBSERVABLE_PROPERTY_RW(Platform::String ^, CurrencySymbol1);
|
OBSERVABLE_PROPERTY_RW(Platform::String ^, CurrencySymbol1);
|
||||||
OBSERVABLE_PROPERTY_RW(Unit ^, Unit1);
|
OBSERVABLE_PROPERTY_RW(Unit ^, Unit1);
|
||||||
|
@ -178,7 +178,7 @@ namespace CalculatorApp
|
||||||
OBSERVABLE_PROPERTY_RW(Platform::String ^, Value2AutomationName);
|
OBSERVABLE_PROPERTY_RW(Platform::String ^, Value2AutomationName);
|
||||||
OBSERVABLE_PROPERTY_RW(Platform::String ^, Unit1AutomationName);
|
OBSERVABLE_PROPERTY_RW(Platform::String ^, Unit1AutomationName);
|
||||||
OBSERVABLE_PROPERTY_RW(Platform::String ^, Unit2AutomationName);
|
OBSERVABLE_PROPERTY_RW(Platform::String ^, Unit2AutomationName);
|
||||||
OBSERVABLE_PROPERTY_RW(CalculatorApp::Common::Automation::NarratorAnnouncement ^, Announcement);
|
OBSERVABLE_PROPERTY_RW(CalculatorApp::ViewModel::Common::Automation::NarratorAnnouncement ^, Announcement);
|
||||||
OBSERVABLE_PROPERTY_RW(bool, IsDecimalEnabled);
|
OBSERVABLE_PROPERTY_RW(bool, IsDecimalEnabled);
|
||||||
OBSERVABLE_PROPERTY_RW(bool, IsDropDownOpen);
|
OBSERVABLE_PROPERTY_RW(bool, IsDropDownOpen);
|
||||||
OBSERVABLE_PROPERTY_RW(bool, IsDropDownEnabled);
|
OBSERVABLE_PROPERTY_RW(bool, IsDropDownEnabled);
|
||||||
|
@ -187,7 +187,7 @@ namespace CalculatorApp
|
||||||
OBSERVABLE_PROPERTY_RW(Platform::String ^, CurrencyRatioEquality);
|
OBSERVABLE_PROPERTY_RW(Platform::String ^, CurrencyRatioEquality);
|
||||||
OBSERVABLE_PROPERTY_RW(Platform::String ^, CurrencyRatioEqualityAutomationName);
|
OBSERVABLE_PROPERTY_RW(Platform::String ^, CurrencyRatioEqualityAutomationName);
|
||||||
OBSERVABLE_PROPERTY_RW(Platform::String ^, CurrencyTimestamp);
|
OBSERVABLE_PROPERTY_RW(Platform::String ^, CurrencyTimestamp);
|
||||||
OBSERVABLE_NAMED_PROPERTY_RW(CalculatorApp::NetworkAccessBehavior, NetworkBehavior);
|
OBSERVABLE_NAMED_PROPERTY_RW(CalculatorApp::ViewModel::Common::NetworkAccessBehavior, NetworkBehavior);
|
||||||
OBSERVABLE_NAMED_PROPERTY_RW(bool, CurrencyDataLoadFailed);
|
OBSERVABLE_NAMED_PROPERTY_RW(bool, CurrencyDataLoadFailed);
|
||||||
OBSERVABLE_NAMED_PROPERTY_RW(bool, CurrencyDataIsWeekOld);
|
OBSERVABLE_NAMED_PROPERTY_RW(bool, CurrencyDataIsWeekOld);
|
||||||
|
|
||||||
|
@ -205,7 +205,7 @@ namespace CalculatorApp
|
||||||
if (value != nullptr)
|
if (value != nullptr)
|
||||||
{
|
{
|
||||||
auto currentCategory = value->GetModelCategory();
|
auto currentCategory = value->GetModelCategory();
|
||||||
IsCurrencyCurrentCategory = currentCategory.id == CalculatorApp::Common::NavCategory::Serialize(CalculatorApp::Common::ViewMode::Currency);
|
IsCurrencyCurrentCategory = currentCategory.id == CalculatorApp::ViewModel::Common::NavCategory::Serialize(CalculatorApp::ViewModel::Common::ViewMode::Currency);
|
||||||
}
|
}
|
||||||
RaisePropertyChanged("CurrentCategory");
|
RaisePropertyChanged("CurrentCategory");
|
||||||
}
|
}
|
||||||
|
@ -243,7 +243,7 @@ namespace CalculatorApp
|
||||||
|
|
||||||
internal : void ResetView();
|
internal : void ResetView();
|
||||||
void PopulateData();
|
void PopulateData();
|
||||||
NumbersAndOperatorsEnum MapCharacterToButtonId(const wchar_t ch, bool& canSendNegate);
|
CalculatorApp::ViewModel::Common::NumbersAndOperatorsEnum MapCharacterToButtonId(const wchar_t ch, bool& canSendNegate);
|
||||||
void DisplayPasteError();
|
void DisplayPasteError();
|
||||||
|
|
||||||
void OnCopyCommand(Platform::Object ^ parameter);
|
void OnCopyCommand(Platform::Object ^ parameter);
|
||||||
|
@ -277,7 +277,7 @@ namespace CalculatorApp
|
||||||
|
|
||||||
void OnCurrencyDataLoadFinished(bool didLoad);
|
void OnCurrencyDataLoadFinished(bool didLoad);
|
||||||
void OnCurrencyTimestampUpdated(_In_ const std::wstring& timestamp, bool isWeekOld);
|
void OnCurrencyTimestampUpdated(_In_ const std::wstring& timestamp, bool isWeekOld);
|
||||||
void OnNetworkBehaviorChanged(_In_ CalculatorApp::NetworkAccessBehavior newBehavior);
|
void OnNetworkBehaviorChanged(_In_ CalculatorApp::ViewModel::Common::NetworkAccessBehavior newBehavior);
|
||||||
|
|
||||||
const std::wstring& GetValueFromUnlocalized() const
|
const std::wstring& GetValueFromUnlocalized() const
|
||||||
{
|
{
|
||||||
|
@ -303,7 +303,7 @@ namespace CalculatorApp
|
||||||
void OnCategoryChanged(Platform::Object ^ unused);
|
void OnCategoryChanged(Platform::Object ^ unused);
|
||||||
void OnUnitChanged(Platform::Object ^ unused);
|
void OnUnitChanged(Platform::Object ^ unused);
|
||||||
void OnSwitchActive(Platform::Object ^ unused);
|
void OnSwitchActive(Platform::Object ^ unused);
|
||||||
UnitConversionManager::Command CommandFromButtonId(CalculatorApp::NumbersAndOperatorsEnum button);
|
UnitConversionManager::Command CommandFromButtonId(CalculatorApp::ViewModel::Common::NumbersAndOperatorsEnum button);
|
||||||
void SupplementaryResultsTimerTick(Windows::System::Threading::ThreadPoolTimer ^ timer);
|
void SupplementaryResultsTimerTick(Windows::System::Threading::ThreadPoolTimer ^ timer);
|
||||||
void SupplementaryResultsTimerCancel(Windows::System::Threading::ThreadPoolTimer ^ timer);
|
void SupplementaryResultsTimerCancel(Windows::System::Threading::ThreadPoolTimer ^ timer);
|
||||||
void RefreshSupplementaryResults();
|
void RefreshSupplementaryResults();
|
||||||
|
@ -470,7 +470,7 @@ namespace CalculatorApp
|
||||||
|
|
||||||
void NetworkBehaviorChanged(_In_ int newBehavior) override
|
void NetworkBehaviorChanged(_In_ int newBehavior) override
|
||||||
{
|
{
|
||||||
m_viewModel->OnNetworkBehaviorChanged(static_cast<CalculatorApp::NetworkAccessBehavior>(newBehavior));
|
m_viewModel->OnNetworkBehaviorChanged(static_cast<CalculatorApp::ViewModel::Common::NetworkAccessBehavior>(newBehavior));
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
|
@ -1,19 +0,0 @@
|
||||||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
|
||||||
// Licensed under the MIT License.
|
|
||||||
|
|
||||||
#include "pch.h"
|
|
||||||
#include "ViewState.h"
|
|
||||||
|
|
||||||
namespace CalculatorApp
|
|
||||||
{
|
|
||||||
namespace ViewState
|
|
||||||
{
|
|
||||||
Platform::StringReference Snap(L"Snap");
|
|
||||||
Platform::StringReference DockedView(L"DockedView");
|
|
||||||
|
|
||||||
bool IsValidViewState(Platform::String ^ viewState)
|
|
||||||
{
|
|
||||||
return viewState->Equals(ViewState::Snap) || viewState->Equals(ViewState::DockedView);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,15 +0,0 @@
|
||||||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
|
||||||
// Licensed under the MIT License.
|
|
||||||
|
|
||||||
#pragma once
|
|
||||||
|
|
||||||
namespace CalculatorApp
|
|
||||||
{
|
|
||||||
namespace ViewState
|
|
||||||
{
|
|
||||||
extern Platform::StringReference Snap;
|
|
||||||
extern Platform::StringReference DockedView;
|
|
||||||
|
|
||||||
bool IsValidViewState(Platform::String ^ viewState);
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -49,7 +49,7 @@
|
||||||
// Once the app switches to min version RS3, the namespaces can be removed.
|
// Once the app switches to min version RS3, the namespaces can be removed.
|
||||||
// TODO - MSFT 12735088
|
// TODO - MSFT 12735088
|
||||||
namespace StandardPeers = Windows::UI::Xaml::Automation::Peers;
|
namespace StandardPeers = Windows::UI::Xaml::Automation::Peers;
|
||||||
namespace CalculatorApp::Common::Automation
|
namespace CalculatorApp::ViewModel::Common::Automation
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
namespace CustomPeers = CalculatorApp::Common::Automation;
|
namespace CustomPeers = CalculatorApp::ViewModel::Common::Automation;
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
// 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.Common;
|
using CalculatorApp.ViewModel.Common;
|
||||||
using System;
|
using System;
|
||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
using Windows.ApplicationModel;
|
using Windows.ApplicationModel;
|
||||||
|
|
|
@ -6,8 +6,8 @@
|
||||||
// Declaration of the App class.
|
// Declaration of the App class.
|
||||||
//
|
//
|
||||||
|
|
||||||
using CalculatorApp.Common;
|
using CalculatorApp.ViewModel.Common;
|
||||||
using CalculatorApp.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;
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
// Licensed under the MIT License.
|
// Licensed under the MIT License.
|
||||||
|
|
||||||
using CalculatorApp.ViewModel;
|
using CalculatorApp.ViewModel;
|
||||||
|
using CalculatorApp.ViewModel.Common;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Collections.ObjectModel;
|
using System.Collections.ObjectModel;
|
||||||
|
|
|
@ -7,7 +7,7 @@ using System.Threading.Tasks;
|
||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
using CalculatorApp;
|
using CalculatorApp;
|
||||||
using CalculatorApp.Controls;
|
using CalculatorApp.Controls;
|
||||||
using CalculatorApp.Common;
|
using CalculatorApp.ViewModel.Common;
|
||||||
|
|
||||||
using Windows.Devices.Input;
|
using Windows.Devices.Input;
|
||||||
using Windows.Foundation;
|
using Windows.Foundation;
|
||||||
|
|
|
@ -6,8 +6,8 @@ using System.Collections.Generic;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
using CalculatorApp;
|
using CalculatorApp;
|
||||||
using CalculatorApp.Common;
|
|
||||||
using CalculatorApp.Controls;
|
using CalculatorApp.Controls;
|
||||||
|
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;
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
// 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.Common;
|
using CalculatorApp.ViewModel.Common;
|
||||||
using System;
|
using System;
|
||||||
using Windows.UI.Text;
|
using Windows.UI.Text;
|
||||||
using Windows.UI.Xaml;
|
using Windows.UI.Xaml;
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
// 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 Windows.System;
|
using Windows.System;
|
||||||
using Windows.UI.Xaml;
|
using Windows.UI.Xaml;
|
||||||
using Windows.UI.Xaml.Input;
|
using Windows.UI.Xaml.Input;
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
// 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.Common;
|
using CalculatorApp.ViewModel.Common;
|
||||||
|
|
||||||
namespace CalculatorApp
|
namespace CalculatorApp
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
// 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.Common;
|
using CalculatorApp.ViewModel.Common;
|
||||||
using System;
|
using System;
|
||||||
using Windows.UI.Xaml;
|
using Windows.UI.Xaml;
|
||||||
|
|
||||||
|
@ -17,7 +17,7 @@ namespace CalculatorApp
|
||||||
DisplayExpressionToken token = (item as DisplayExpressionToken);
|
DisplayExpressionToken token = (item as DisplayExpressionToken);
|
||||||
if (token != null)
|
if (token != null)
|
||||||
{
|
{
|
||||||
Common.TokenType type = token.Type;
|
CalculatorApp.ViewModel.Common.TokenType type = token.Type;
|
||||||
|
|
||||||
switch (type)
|
switch (type)
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
// 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.Common;
|
using CalculatorApp.ViewModel.Common;
|
||||||
using System;
|
using System;
|
||||||
|
|
||||||
namespace CalculatorApp
|
namespace CalculatorApp
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
using GraphControl;
|
using CalculatorApp.ViewModel.Common;
|
||||||
|
using GraphControl;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
@ -231,7 +232,7 @@ namespace CalculatorApp
|
||||||
SelectedColor = brush.Color;
|
SelectedColor = brush.Color;
|
||||||
}
|
}
|
||||||
|
|
||||||
TraceLogger.GetInstance().LogGraphLineStyleChanged(LineStyleType.Color);
|
CalculatorApp.ViewModel.Common.TraceLogger.GetInstance().LogGraphLineStyleChanged(LineStyleType.Color);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -276,7 +277,7 @@ namespace CalculatorApp
|
||||||
if (oldStyle != newStyle)
|
if (oldStyle != newStyle)
|
||||||
{
|
{
|
||||||
SelectStyle(newStyle);
|
SelectStyle(newStyle);
|
||||||
TraceLogger.GetInstance().LogGraphLineStyleChanged(LineStyleType.Pattern);
|
CalculatorApp.ViewModel.Common.TraceLogger.GetInstance().LogGraphLineStyleChanged(LineStyleType.Pattern);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
// Licensed under the MIT License.
|
// Licensed under the MIT License.
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
using CalculatorApp.Common;
|
using CalculatorApp.ViewModel.Common;
|
||||||
|
|
||||||
namespace CalculatorApp.Utils
|
namespace CalculatorApp.Utils
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
<UserControl x:Class="CalculatorApp.Calculator"
|
<UserControl x:Class="CalculatorApp.Calculator"
|
||||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
xmlns:automation="using:CalculatorApp.Common.Automation"
|
xmlns:automation="using:CalculatorApp.ViewModel.Common.Automation"
|
||||||
xmlns:common="using:CalculatorApp.Common"
|
xmlns:common="using:CalculatorApp.ViewModel.Common"
|
||||||
xmlns:controls="using:CalculatorApp.Controls"
|
xmlns:controls="using:CalculatorApp.Controls"
|
||||||
xmlns:converters="using:CalculatorApp.Converters"
|
xmlns:converters="using:CalculatorApp.Converters"
|
||||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||||
|
|
|
@ -6,11 +6,11 @@ using System.Collections.Generic;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
using CalculatorApp;
|
using CalculatorApp;
|
||||||
using CalculatorApp.Common;
|
|
||||||
using CalculatorApp.Converters;
|
using CalculatorApp.Converters;
|
||||||
using CalculatorApp.Controls;
|
using CalculatorApp.Controls;
|
||||||
using CalculatorApp.Utils;
|
using CalculatorApp.Utils;
|
||||||
using CalculatorApp.ViewModel;
|
using CalculatorApp.ViewModel;
|
||||||
|
using CalculatorApp.ViewModel.Common;
|
||||||
|
|
||||||
using Windows.Foundation;
|
using Windows.Foundation;
|
||||||
using Windows.Foundation.Collections;
|
using Windows.Foundation.Collections;
|
||||||
|
|
|
@ -13,9 +13,9 @@ using System.Collections.Generic;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
using CalculatorApp;
|
using CalculatorApp;
|
||||||
using CalculatorApp.Common;
|
|
||||||
using CalculatorApp.Controls;
|
using CalculatorApp.Controls;
|
||||||
using CalculatorApp.ViewModel;
|
using CalculatorApp.ViewModel;
|
||||||
|
using CalculatorApp.ViewModel.Common;
|
||||||
|
|
||||||
using Windows.UI.Xaml;
|
using Windows.UI.Xaml;
|
||||||
using Windows.UI.Xaml.Automation;
|
using Windows.UI.Xaml.Automation;
|
||||||
|
|
|
@ -6,9 +6,9 @@ using System.Collections.Generic;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
using CalculatorApp;
|
using CalculatorApp;
|
||||||
using CalculatorApp.Common;
|
|
||||||
using CalculatorApp.Controls;
|
using CalculatorApp.Controls;
|
||||||
using CalculatorApp.ViewModel;
|
using CalculatorApp.ViewModel;
|
||||||
|
using CalculatorApp.ViewModel.Common;
|
||||||
using Windows.Devices.Input;
|
using Windows.Devices.Input;
|
||||||
|
|
||||||
using Windows.Foundation;
|
using Windows.Foundation;
|
||||||
|
|
|
@ -8,6 +8,7 @@ using System.Diagnostics;
|
||||||
|
|
||||||
using CalculatorApp;
|
using CalculatorApp;
|
||||||
using CalculatorApp.ViewModel;
|
using CalculatorApp.ViewModel;
|
||||||
|
using CalculatorApp.ViewModel.Common;
|
||||||
|
|
||||||
using Windows.UI.Xaml;
|
using Windows.UI.Xaml;
|
||||||
using Windows.UI.Xaml.Controls;
|
using Windows.UI.Xaml.Controls;
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
xmlns:Controls="using:CalculatorApp.Controls"
|
xmlns:Controls="using:CalculatorApp.Controls"
|
||||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||||
xmlns:local="using:CalculatorApp"
|
xmlns:local="using:CalculatorApp.ViewModel.Common"
|
||||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||||
x:Name="ControlRoot"
|
x:Name="ControlRoot"
|
||||||
d:DesignHeight="315"
|
d:DesignHeight="315"
|
||||||
|
|
|
@ -13,6 +13,7 @@ using System.Diagnostics;
|
||||||
using CalculatorApp;
|
using CalculatorApp;
|
||||||
using CalculatorApp.Utils;
|
using CalculatorApp.Utils;
|
||||||
using CalculatorApp.ViewModel;
|
using CalculatorApp.ViewModel;
|
||||||
|
using CalculatorApp.ViewModel.Common;
|
||||||
|
|
||||||
using Windows.Foundation;
|
using Windows.Foundation;
|
||||||
using Windows.Foundation.Collections;
|
using Windows.Foundation.Collections;
|
||||||
|
|
|
@ -13,6 +13,7 @@ using System.Diagnostics;
|
||||||
using CalculatorApp;
|
using CalculatorApp;
|
||||||
using CalculatorApp.Common;
|
using CalculatorApp.Common;
|
||||||
using CalculatorApp.ViewModel;
|
using CalculatorApp.ViewModel;
|
||||||
|
using CalculatorApp.ViewModel.Common;
|
||||||
|
|
||||||
using Windows.Foundation;
|
using Windows.Foundation;
|
||||||
using Windows.Foundation.Collections;
|
using Windows.Foundation.Collections;
|
||||||
|
@ -36,7 +37,7 @@ namespace CalculatorApp
|
||||||
{
|
{
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
|
|
||||||
ExpButton.SetValue(Common.KeyboardShortcutManager.VirtualKeyProperty, Common.MyVirtualKey.E);
|
ExpButton.SetValue(KeyboardShortcutManager.VirtualKeyProperty, MyVirtualKey.E);
|
||||||
}
|
}
|
||||||
|
|
||||||
public StandardCalculatorViewModel Model
|
public StandardCalculatorViewModel Model
|
||||||
|
|
|
@ -13,8 +13,8 @@ using System.Collections.Generic;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
using CalculatorApp;
|
using CalculatorApp;
|
||||||
using CalculatorApp.Common;
|
|
||||||
using CalculatorApp.ViewModel;
|
using CalculatorApp.ViewModel;
|
||||||
|
using CalculatorApp.ViewModel.Common;
|
||||||
|
|
||||||
using Windows.Foundation;
|
using Windows.Foundation;
|
||||||
using Windows.Foundation.Collections;
|
using Windows.Foundation.Collections;
|
||||||
|
|
|
@ -8,7 +8,8 @@ using System.Threading.Tasks;
|
||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
using CalculatorApp;
|
using CalculatorApp;
|
||||||
using CalculatorApp.Common;
|
using CalculatorApp.Common;
|
||||||
using CalculatorApp.Common.Automation;
|
using CalculatorApp.ViewModel.Common;
|
||||||
|
using CalculatorApp.ViewModel.Common.Automation;
|
||||||
using GraphControl;
|
using GraphControl;
|
||||||
using CalculatorApp.ViewModel;
|
using CalculatorApp.ViewModel;
|
||||||
using CalculatorApp.Controls;
|
using CalculatorApp.Controls;
|
||||||
|
@ -415,7 +416,7 @@ namespace CalculatorApp
|
||||||
var eq = GetViewModelFromEquationTextBox(sender);
|
var eq = GetViewModelFromEquationTextBox(sender);
|
||||||
eq.IsLineEnabled = !eq.IsLineEnabled;
|
eq.IsLineEnabled = !eq.IsLineEnabled;
|
||||||
|
|
||||||
TraceLogger.GetInstance().LogShowHideButtonClicked(eq.IsLineEnabled ? false : true);
|
CalculatorApp.ViewModel.Common.TraceLogger.GetInstance().LogShowHideButtonClicked(eq.IsLineEnabled ? false : true);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void EquationTextBox_Loaded(object sender, RoutedEventArgs e)
|
private void EquationTextBox_Loaded(object sender, RoutedEventArgs e)
|
||||||
|
@ -510,20 +511,20 @@ namespace CalculatorApp
|
||||||
{
|
{
|
||||||
val = validateDouble(sender.Text, variableViewModel.Value);
|
val = validateDouble(sender.Text, variableViewModel.Value);
|
||||||
variableViewModel.Value = val;
|
variableViewModel.Value = val;
|
||||||
TraceLogger.GetInstance().LogVariableChanged("ValueTextBox", variableViewModel.Name);
|
CalculatorApp.ViewModel.Common.TraceLogger.GetInstance().LogVariableChanged("ValueTextBox", variableViewModel.Name);
|
||||||
}
|
}
|
||||||
else if (sender.Name == "MinTextBox")
|
else if (sender.Name == "MinTextBox")
|
||||||
{
|
{
|
||||||
val = validateDouble(sender.Text, variableViewModel.Min);
|
val = validateDouble(sender.Text, variableViewModel.Min);
|
||||||
|
|
||||||
variableViewModel.Min = val;
|
variableViewModel.Min = val;
|
||||||
TraceLogger.GetInstance().LogVariableSettingsChanged("MinTextBox");
|
CalculatorApp.ViewModel.Common.TraceLogger.GetInstance().LogVariableSettingsChanged("MinTextBox");
|
||||||
}
|
}
|
||||||
else if (sender.Name == "MaxTextBox")
|
else if (sender.Name == "MaxTextBox")
|
||||||
{
|
{
|
||||||
val = validateDouble(sender.Text, variableViewModel.Max);
|
val = validateDouble(sender.Text, variableViewModel.Max);
|
||||||
variableViewModel.Max = val;
|
variableViewModel.Max = val;
|
||||||
TraceLogger.GetInstance().LogVariableSettingsChanged("MaxTextBox");
|
CalculatorApp.ViewModel.Common.TraceLogger.GetInstance().LogVariableSettingsChanged("MaxTextBox");
|
||||||
}
|
}
|
||||||
else if (sender.Name == "StepTextBox")
|
else if (sender.Name == "StepTextBox")
|
||||||
{
|
{
|
||||||
|
@ -536,7 +537,7 @@ namespace CalculatorApp
|
||||||
}
|
}
|
||||||
|
|
||||||
variableViewModel.Step = val;
|
variableViewModel.Step = val;
|
||||||
TraceLogger.GetInstance().LogVariableSettingsChanged("StepTextBox");
|
CalculatorApp.ViewModel.Common.TraceLogger.GetInstance().LogVariableSettingsChanged("StepTextBox");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -597,7 +598,7 @@ 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) => {
|
||||||
TraceLogger.GetInstance().LogVariableChanged("Slider", name);
|
CalculatorApp.ViewModel.Common.TraceLogger.GetInstance().LogVariableChanged("Slider", name);
|
||||||
variableSliders.Remove(name);
|
variableSliders.Remove(name);
|
||||||
});
|
});
|
||||||
delayer.Start();
|
delayer.Start();
|
||||||
|
|
|
@ -7,7 +7,8 @@ using System.Threading.Tasks;
|
||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
using CalculatorApp;
|
using CalculatorApp;
|
||||||
using CalculatorApp.Common;
|
using CalculatorApp.Common;
|
||||||
using CalculatorApp.Common.Automation;
|
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;
|
||||||
|
@ -91,13 +92,13 @@ namespace CalculatorApp
|
||||||
if (isMatchAppLocalSetting)
|
if (isMatchAppLocalSetting)
|
||||||
{
|
{
|
||||||
IsMatchAppTheme = true;
|
IsMatchAppTheme = true;
|
||||||
TraceLogger.GetInstance().LogGraphTheme("IsMatchAppTheme");
|
CalculatorApp.ViewModel.Common.TraceLogger.GetInstance().LogGraphTheme("IsMatchAppTheme");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
IsMatchAppTheme = false;
|
IsMatchAppTheme = false;
|
||||||
TraceLogger.GetInstance().LogGraphTheme("IsAlwaysLightTheme");
|
CalculatorApp.ViewModel.Common.TraceLogger.GetInstance().LogGraphTheme("IsAlwaysLightTheme");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -332,13 +333,13 @@ namespace CalculatorApp
|
||||||
private void OnZoomInCommand(object parameter)
|
private void OnZoomInCommand(object parameter)
|
||||||
{
|
{
|
||||||
GraphingControl.ZoomFromCenter(zoomInScale);
|
GraphingControl.ZoomFromCenter(zoomInScale);
|
||||||
TraceLogger.GetInstance().LogGraphButtonClicked(GraphButton.ZoomIn, GraphButtonValue.None);
|
CalculatorApp.ViewModel.Common.TraceLogger.GetInstance().LogGraphButtonClicked(GraphButton.ZoomIn, GraphButtonValue.None);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OnZoomOutCommand(object parameter)
|
private void OnZoomOutCommand(object parameter)
|
||||||
{
|
{
|
||||||
GraphingControl.ZoomFromCenter(zoomOutScale);
|
GraphingControl.ZoomFromCenter(zoomOutScale);
|
||||||
TraceLogger.GetInstance().LogGraphButtonClicked(GraphButton.ZoomOut, GraphButtonValue.None);
|
CalculatorApp.ViewModel.Common.TraceLogger.GetInstance().LogGraphButtonClicked(GraphButton.ZoomOut, GraphButtonValue.None);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OnShareClick(object sender, RoutedEventArgs e)
|
private void OnShareClick(object sender, RoutedEventArgs e)
|
||||||
|
@ -347,7 +348,7 @@ namespace CalculatorApp
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
DataTransferManager.ShowShareUI();
|
DataTransferManager.ShowShareUI();
|
||||||
TraceLogger.GetInstance().LogGraphButtonClicked(GraphButton.Share, GraphButtonValue.None);
|
CalculatorApp.ViewModel.Common.TraceLogger.GetInstance().LogGraphButtonClicked(GraphButton.Share, GraphButtonValue.None);
|
||||||
}
|
}
|
||||||
catch (System.Runtime.InteropServices.COMException ex)
|
catch (System.Runtime.InteropServices.COMException ex)
|
||||||
{
|
{
|
||||||
|
@ -640,7 +641,7 @@ namespace CalculatorApp
|
||||||
KeyboardShortcutManager.IgnoreEscape(false);
|
KeyboardShortcutManager.IgnoreEscape(false);
|
||||||
|
|
||||||
TracePointer.Visibility = Visibility.Visible;
|
TracePointer.Visibility = Visibility.Visible;
|
||||||
TraceLogger.GetInstance().LogGraphButtonClicked(GraphButton.ActiveTracingChecked, GraphButtonValue.None);
|
CalculatorApp.ViewModel.Common.TraceLogger.GetInstance().LogGraphButtonClicked(GraphButton.ActiveTracingChecked, GraphButtonValue.None);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void ActiveTracing_Unchecked(object sender, RoutedEventArgs e)
|
private void ActiveTracing_Unchecked(object sender, RoutedEventArgs e)
|
||||||
|
@ -650,7 +651,7 @@ namespace CalculatorApp
|
||||||
KeyboardShortcutManager.HonorEscape();
|
KeyboardShortcutManager.HonorEscape();
|
||||||
|
|
||||||
TracePointer.Visibility = Visibility.Collapsed;
|
TracePointer.Visibility = Visibility.Collapsed;
|
||||||
TraceLogger.GetInstance().LogGraphButtonClicked(GraphButton.ActiveTracingUnchecked, GraphButtonValue.None);
|
CalculatorApp.ViewModel.Common.TraceLogger.GetInstance().LogGraphButtonClicked(GraphButton.ActiveTracingUnchecked, GraphButtonValue.None);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void ActiveTracing_KeyUp(CoreWindow sender, KeyEventArgs args)
|
private void ActiveTracing_KeyUp(CoreWindow sender, KeyEventArgs args)
|
||||||
|
@ -677,7 +678,7 @@ namespace CalculatorApp
|
||||||
private void GraphSettingsButton_Click(object sender, RoutedEventArgs e)
|
private void GraphSettingsButton_Click(object sender, RoutedEventArgs e)
|
||||||
{
|
{
|
||||||
DisplayGraphSettings();
|
DisplayGraphSettings();
|
||||||
TraceLogger.GetInstance().LogGraphButtonClicked(GraphButton.GraphSettings, GraphButtonValue.None);
|
CalculatorApp.ViewModel.Common.TraceLogger.GetInstance().LogGraphButtonClicked(GraphButton.GraphSettings, GraphButtonValue.None);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void SwitchModeToggleButton_Toggled(object sender, RoutedEventArgs e)
|
private void SwitchModeToggleButton_Toggled(object sender, RoutedEventArgs e)
|
||||||
|
@ -860,7 +861,7 @@ namespace CalculatorApp
|
||||||
|
|
||||||
private void OnVisualStateChanged(object sender, VisualStateChangedEventArgs e)
|
private void OnVisualStateChanged(object sender, VisualStateChangedEventArgs e)
|
||||||
{
|
{
|
||||||
TraceLogger.GetInstance().LogVisualStateChanged(ViewMode.Graphing, e.NewState.Name, false);
|
CalculatorApp.ViewModel.Common.TraceLogger.GetInstance().LogVisualStateChanged(ViewMode.Graphing, e.NewState.Name, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void GraphViewButton_Click(object sender, RoutedEventArgs e)
|
private void GraphViewButton_Click(object sender, RoutedEventArgs e)
|
||||||
|
@ -881,7 +882,7 @@ namespace CalculatorApp
|
||||||
var announcement = CalculatorAnnouncement.GetGraphViewBestFitChangedAnnouncement(announcementText);
|
var announcement = CalculatorAnnouncement.GetGraphViewBestFitChangedAnnouncement(announcementText);
|
||||||
narratorNotifier.Announce(announcement);
|
narratorNotifier.Announce(announcement);
|
||||||
|
|
||||||
TraceLogger.GetInstance().LogGraphButtonClicked(
|
CalculatorApp.ViewModel.Common.TraceLogger.GetInstance().LogGraphButtonClicked(
|
||||||
GraphButton.GraphView, IsManualAdjustment ? GraphButtonValue.ManualAdjustment : GraphButtonValue.AutomaticBestFit);
|
GraphButton.GraphView, IsManualAdjustment ? GraphButtonValue.ManualAdjustment : GraphButtonValue.AutomaticBestFit);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -6,7 +6,7 @@ using System.Collections.Generic;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
using CalculatorApp;
|
using CalculatorApp;
|
||||||
using CalculatorApp.Common;
|
using CalculatorApp.ViewModel.Common;
|
||||||
|
|
||||||
using Windows.Foundation;
|
using Windows.Foundation;
|
||||||
using Windows.Foundation.Collections;
|
using Windows.Foundation.Collections;
|
||||||
|
@ -131,7 +131,7 @@ namespace CalculatorApp
|
||||||
if (mathRichEdit != null && sender != null)
|
if (mathRichEdit != null && sender != null)
|
||||||
{
|
{
|
||||||
var id = button.ButtonId;
|
var id = button.ButtonId;
|
||||||
TraceLogger.GetInstance().UpdateButtonUsage(id, CalculatorApp.Common.ViewMode.Graphing);
|
TraceLogger.GetInstance().UpdateButtonUsage(id, CalculatorApp.ViewModel.Common.ViewMode.Graphing);
|
||||||
Tuple<string, int, int> output = GraphingNumPad.GetButtonOutput(id);
|
Tuple<string, int, int> output = GraphingNumPad.GetButtonOutput(id);
|
||||||
mathRichEdit.InsertText(output.Item1, output.Item2, output.Item3);
|
mathRichEdit.InsertText(output.Item1, output.Item2, output.Item3);
|
||||||
}
|
}
|
||||||
|
@ -143,7 +143,7 @@ namespace CalculatorApp
|
||||||
if (mathRichEdit != null)
|
if (mathRichEdit != null)
|
||||||
{
|
{
|
||||||
mathRichEdit.SubmitEquation(CalculatorApp.Controls.EquationSubmissionSource.ENTER_KEY);
|
mathRichEdit.SubmitEquation(CalculatorApp.Controls.EquationSubmissionSource.ENTER_KEY);
|
||||||
TraceLogger.GetInstance().UpdateButtonUsage(NumbersAndOperatorsEnum.Submit, CalculatorApp.Common.ViewMode.Graphing);
|
TraceLogger.GetInstance().UpdateButtonUsage(NumbersAndOperatorsEnum.Submit, CalculatorApp.ViewModel.Common.ViewMode.Graphing);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -161,7 +161,7 @@ namespace CalculatorApp
|
||||||
mathRichEdit.SubmitEquation(CalculatorApp.Controls.EquationSubmissionSource.PROGRAMMATIC);
|
mathRichEdit.SubmitEquation(CalculatorApp.Controls.EquationSubmissionSource.PROGRAMMATIC);
|
||||||
}
|
}
|
||||||
|
|
||||||
TraceLogger.GetInstance().UpdateButtonUsage(NumbersAndOperatorsEnum.Clear, CalculatorApp.Common.ViewMode.Graphing);
|
TraceLogger.GetInstance().UpdateButtonUsage(NumbersAndOperatorsEnum.Clear, CalculatorApp.ViewModel.Common.ViewMode.Graphing);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -171,7 +171,7 @@ namespace CalculatorApp
|
||||||
if (mathRichEdit != null)
|
if (mathRichEdit != null)
|
||||||
{
|
{
|
||||||
mathRichEdit.BackSpace();
|
mathRichEdit.BackSpace();
|
||||||
TraceLogger.GetInstance().UpdateButtonUsage(NumbersAndOperatorsEnum.Backspace, CalculatorApp.Common.ViewMode.Graphing);
|
TraceLogger.GetInstance().UpdateButtonUsage(NumbersAndOperatorsEnum.Backspace, CalculatorApp.ViewModel.Common.ViewMode.Graphing);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -12,6 +12,7 @@ using System.Diagnostics;
|
||||||
using GraphControl;
|
using GraphControl;
|
||||||
using CalculatorApp;
|
using CalculatorApp;
|
||||||
using CalculatorApp.ViewModel;
|
using CalculatorApp.ViewModel;
|
||||||
|
using CalculatorApp.ViewModel.Common;
|
||||||
|
|
||||||
using Windows.Foundation;
|
using Windows.Foundation;
|
||||||
using Windows.Foundation.Collections;
|
using Windows.Foundation.Collections;
|
||||||
|
@ -130,7 +131,7 @@ namespace CalculatorApp
|
||||||
ApplicationDataContainer localSettings = ApplicationData.Current.LocalSettings;
|
ApplicationDataContainer localSettings = ApplicationData.Current.LocalSettings;
|
||||||
localSettings.Values.Add("IsGraphThemeMatchApp", isMatchAppTheme);
|
localSettings.Values.Add("IsGraphThemeMatchApp", isMatchAppTheme);
|
||||||
GraphThemeSettingChanged?.Invoke(this, isMatchAppTheme);
|
GraphThemeSettingChanged?.Invoke(this, isMatchAppTheme);
|
||||||
TraceLogger.GetInstance().LogGraphSettingsChanged(GraphSettingsType.Theme, propertyName);
|
CalculatorApp.ViewModel.Common.TraceLogger.GetInstance().LogGraphSettingsChanged(GraphSettingsType.Theme, propertyName);
|
||||||
}
|
}
|
||||||
|
|
||||||
private bool m_IsMatchAppTheme;
|
private bool m_IsMatchAppTheme;
|
||||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue