forked from microsoft/calculator
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathHistoryItemViewModel.h
93 lines (75 loc) · 3.03 KB
/
HistoryItemViewModel.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
#pragma once
#include "CalcManager/CalculatorVector.h"
#include "CalcManager/ExpressionCommandInterface.h"
namespace CalculatorApp
{
namespace ViewModel
{
[Windows::UI::Xaml::Data::Bindable]
public ref class HistoryItemViewModel sealed : Windows::UI::Xaml::Data::ICustomPropertyProvider
{
internal:
HistoryItemViewModel(Platform::String^ expression,
Platform::String^ result,
_In_ std::shared_ptr<CalculatorVector <std::pair<std::wstring, int>>> const &spTokens,
_In_ std::shared_ptr<CalculatorVector<std::shared_ptr<IExpressionCommand>>> const &spCommands);
std::shared_ptr<CalculatorVector <std::pair<std::wstring, int>>> const& GetTokens()
{
return m_spTokens;
}
std::shared_ptr<CalculatorVector<std::shared_ptr<IExpressionCommand>>> const& GetCommands()
{
return m_spCommands;
}
public:
property Platform::String^ Expression
{
Platform::String^ get() { return m_expression; }
}
property Platform::String^ AccExpression
{
Platform::String^ get() { return m_accExpression; }
}
property Platform::String^ Result
{
Platform::String^ get() { return m_result; }
}
property Platform::String^ AccResult
{
Platform::String^ get() { return m_accResult; }
}
virtual Windows::UI::Xaml::Data::ICustomProperty^ GetCustomProperty(Platform::String^ name)
{
return nullptr;
}
virtual Windows::UI::Xaml::Data::ICustomProperty^ GetIndexedProperty(Platform::String^ name, Windows::UI::Xaml::Interop::TypeName type)
{
return nullptr;
}
virtual property Windows::UI::Xaml::Interop::TypeName Type
{
Windows::UI::Xaml::Interop::TypeName get()
{
return this->GetType();
}
}
virtual Platform::String^ GetStringRepresentation()
{
return m_accExpression + " " + m_accResult;
}
private:
static Platform::String^ GetAccessibleExpressionFromTokens(
_In_ std::shared_ptr<CalculatorVector <std::pair<std::wstring, int>>> const &spTokens,
_In_ Platform::String^ fallbackExpression);
private:
Platform::String^ m_expression;
Platform::String^ m_accExpression;
Platform::String^ m_accResult;
Platform::String^ m_result;
std::shared_ptr<CalculatorVector <std::pair<std::wstring, int>>> m_spTokens;
std::shared_ptr<CalculatorVector<std::shared_ptr<IExpressionCommand>>> m_spCommands;
};
}
}