-
Notifications
You must be signed in to change notification settings - Fork 7.9k
/
Copy pathSampleConfiguration.cpp
64 lines (57 loc) · 2.01 KB
/
SampleConfiguration.cpp
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
//*********************************************************
//
// Copyright (c) Microsoft. All rights reserved.
// This code is licensed under the MIT License (MIT).
// THIS CODE IS PROVIDED *AS IS* WITHOUT WARRANTY OF
// ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY
// IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR
// PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT.
//
//*********************************************************
#include "pch.h"
#include <winrt/SDKTemplate.h>
#include "MainPage.h"
#include "SampleConfiguration.h"
using namespace winrt;
using namespace Windows::Foundation::Collections;
using namespace Windows::Globalization;
using namespace SDKTemplate;
hstring implementation::MainPage::FEATURE_NAME()
{
return L"Globalization preferences C++/WinRT sample";
}
IVector<Scenario> implementation::MainPage::scenariosInner = winrt::single_threaded_observable_vector<Scenario>(
{
Scenario{ L"User preferences", xaml_typename<SDKTemplate::Scenario1_Prefs>() },
Scenario{ L"Language characteristics", xaml_typename<SDKTemplate::Scenario2_Lang>() },
Scenario{ L"Region characteristics", xaml_typename<SDKTemplate::Scenario3_Region>() },
Scenario{ L"Current input language", xaml_typename<SDKTemplate::Scenario4_Input>() },
});
hstring SDKTemplate::StringJoin(hstring const& delimiter, IVectorView<hstring> const& vector)
{
hstring result;
bool first = true;
for (hstring value : vector)
{
if (!first)
{
result = result + delimiter;
}
result = result + value;
}
return result;
}
hstring winrt::to_hstring(DayOfWeek value)
{
switch (value)
{
case DayOfWeek::Sunday: return L"Sunday";
case DayOfWeek::Monday: return L"Monday";
case DayOfWeek::Tuesday: return L"Tuesday";
case DayOfWeek::Wednesday: return L"Wednesday";
case DayOfWeek::Thursday: return L"Thursday";
case DayOfWeek::Friday: return L"Friday";
case DayOfWeek::Saturday: return L"Saturday";
}
return to_hstring(static_cast<int32_t>(value));
}