forked from microsoft/calculator
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMemoryItemViewModel.h
59 lines (49 loc) · 1.74 KB
/
MemoryItemViewModel.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
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
#pragma once
#include "Common/Utils.h"
namespace CalculatorApp
{
namespace ViewModel
{
ref class StandardCalculatorViewModel;
/// <summary>
/// Model representation of a single item in the Memory list
/// </summary>
[Windows::UI::Xaml::Data::Bindable]
public ref class MemoryItemViewModel sealed :
public Windows::UI::Xaml::Data::INotifyPropertyChanged,
Windows::UI::Xaml::Data::ICustomPropertyProvider
{
public:
MemoryItemViewModel(StandardCalculatorViewModel^ calcVM) : m_Position(-1), m_calcVM(calcVM) {}
OBSERVABLE_OBJECT();
OBSERVABLE_PROPERTY_RW(int, Position);
OBSERVABLE_PROPERTY_RW(Platform::String^, Value);
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 Value;
}
void Clear();
void MemoryAdd();
void MemorySubtract();
private:
StandardCalculatorViewModel^ m_calcVM;
};
}
}