diff options
| author | Luke <[email protected]> | 2017-11-21 17:50:07 -0800 |
|---|---|---|
| committer | Luke <[email protected]> | 2017-11-21 17:50:07 -0800 |
| commit | 1a3e88d788fb533d8cbea006e6fb46ff3b16dcec (patch) | |
| tree | 8f8d5bb04be9606b9644d60caeb55004036e24d1 /general/WinHEC 2017 Lab/Toaster Support App/App/CustomCapability/cpp/ServiceViewModel.h | |
| parent | ed1df9a8b80b154b71b79635e40af75f4f19001c (diff) | |
Adding WinHEC Lab Content
Diffstat (limited to 'general/WinHEC 2017 Lab/Toaster Support App/App/CustomCapability/cpp/ServiceViewModel.h')
| -rw-r--r-- | general/WinHEC 2017 Lab/Toaster Support App/App/CustomCapability/cpp/ServiceViewModel.h | 77 |
1 files changed, 77 insertions, 0 deletions
diff --git a/general/WinHEC 2017 Lab/Toaster Support App/App/CustomCapability/cpp/ServiceViewModel.h b/general/WinHEC 2017 Lab/Toaster Support App/App/CustomCapability/cpp/ServiceViewModel.h new file mode 100644 index 00000000..c2fcad0c --- /dev/null +++ b/general/WinHEC 2017 Lab/Toaster Support App/App/CustomCapability/cpp/ServiceViewModel.h @@ -0,0 +1,77 @@ +#pragma once + +#include "RpcClient.h" +#include <memory> + +namespace SDKTemplate +{ + [Windows::UI::Xaml::Data::Bindable] + public ref class ServiceViewModel sealed : Windows::UI::Xaml::Data::INotifyPropertyChanged + { + public: + ServiceViewModel(); + void StartMetering(int sampleRate); + void SetSamplePeriod(int rate); + void StopMetering(); + property Platform::String^ ExpectedRpcCallbackRate + { + Platform::String^ get(); + void set(Platform::String^ value); + } + property Platform::String^ ActualRpcCallbackRate + { + Platform::String^ get(); + void set(Platform::String^ value); + } + property Platform::String^ SampleMessage + { + Platform::String^ get(); + void set(Platform::String^ value); + } + property bool StartButtonEnabled + { + bool get(); + void set(bool value); + } + property bool StopButtonEnabled + { + bool get(); + void set(bool value); + } + property bool SliderEnabled + { + bool get(); + void set(bool value); + } + property double SliderValue + { + double get(); + void set(double value); + } + virtual event Windows::UI::Xaml::Data::PropertyChangedEventHandler^ PropertyChanged; + + private: + volatile bool meteringOn; + Windows::UI::Core::ICoreDispatcher^ dispatcher; + int samplePeriod; + ULARGE_INTEGER lastUpdateTime; + __int64 rpcDataCountOld = 0; + unsigned int sampleRefreshCount = 0; + std::unique_ptr<RpcClient> rpcclient; + bool stopMeteringRequested; + bool NotifyIfAnyError(__int64 errCode); + + // Variables backing UI bindings + Platform::String^ sampleMessage; + Platform::String^ expectedRpcCallbackRate; + Platform::String^ actualRpcCallbackRate; + bool startButtonEnabled; + bool stopButtonEnabled; + bool sliderEnabled; + double sliderValue; + + void NotifyPropertyChanged(Platform::String^ prop); + + Platform::Array<__int64>^ sampleArray; + }; +} |
