mirror of
https://github.com/Microsoft/calculator.git
synced 2025-08-22 22:23:29 -07:00
Updated CalcViewModel and missing files (#10)
* Updated CalcViewModel and WinMeta * Added Calculator.rc * Resolved comment for InitializeLocalizationSettings
This commit is contained in:
parent
3c7bda7bbb
commit
36e108aafa
10 changed files with 289 additions and 120 deletions
|
@ -178,7 +178,7 @@ NarratorAnnouncement ^ CalculatorAnnouncement::GetGraphViewChangedAnnouncement(S
|
||||||
NarratorAnnouncement ^ CalculatorAnnouncement::GetFunctionRemovedAnnouncement(String ^ announcement)
|
NarratorAnnouncement ^ CalculatorAnnouncement::GetFunctionRemovedAnnouncement(String ^ announcement)
|
||||||
{
|
{
|
||||||
return ref new NarratorAnnouncement(
|
return ref new NarratorAnnouncement(
|
||||||
announcement, CalculatorActivityIds::FunctionRemoved, AutomationNotificationKind::ItemRemoved, AutomationNotificationProcessing::MostRecent);
|
announcement, CalculatorActivityIds::FunctionRemoved, AutomationNotificationKind::ItemRemoved, AutomationNotificationProcessing::ImportantMostRecent);
|
||||||
}
|
}
|
||||||
|
|
||||||
NarratorAnnouncement ^ CalculatorAnnouncement::GetGraphViewBestFitChangedAnnouncement(Platform::String ^ announcement)
|
NarratorAnnouncement ^ CalculatorAnnouncement::GetGraphViewBestFitChangedAnnouncement(Platform::String ^ announcement)
|
||||||
|
|
|
@ -15,115 +15,17 @@ namespace CalculatorApp
|
||||||
private:
|
private:
|
||||||
LocalizationSettings()
|
LocalizationSettings()
|
||||||
// Use DecimalFormatter as it respects the locale and the user setting
|
// Use DecimalFormatter as it respects the locale and the user setting
|
||||||
|
// CSHARP_MIGRATION: TODO:
|
||||||
//: LocalizationSettings(LocalizationService::GetInstance()->GetRegionalSettingsAwareDecimalFormatter())
|
//: LocalizationSettings(LocalizationService::GetInstance()->GetRegionalSettingsAwareDecimalFormatter())
|
||||||
{
|
{
|
||||||
LocalizationSettings(LocalizationService::GetInstance()->GetRegionalSettingsAwareDecimalFormatter());
|
InitializeLocalizationSettings(LocalizationService::GetInstance()->GetRegionalSettingsAwareDecimalFormatter());
|
||||||
}
|
}
|
||||||
|
|
||||||
public:
|
public:
|
||||||
// This is only public for unit testing purposes.
|
// This is only public for unit testing purposes.
|
||||||
LocalizationSettings(Windows::Globalization::NumberFormatting::DecimalFormatter ^ formatter)
|
LocalizationSettings(Windows::Globalization::NumberFormatting::DecimalFormatter ^ formatter)
|
||||||
{
|
{
|
||||||
formatter->FractionDigits = 0;
|
InitializeLocalizationSettings(formatter);
|
||||||
formatter->IsDecimalPointAlwaysDisplayed = false;
|
|
||||||
|
|
||||||
for (unsigned int i = 0; i < m_digitSymbols.size(); i++)
|
|
||||||
{
|
|
||||||
m_digitSymbols[i] = formatter->FormatUInt(i)->Data()[0];
|
|
||||||
}
|
|
||||||
|
|
||||||
wchar_t resolvedName[LOCALE_NAME_MAX_LENGTH];
|
|
||||||
int result = ResolveLocaleName(formatter->ResolvedLanguage->Data(), resolvedName, LOCALE_NAME_MAX_LENGTH);
|
|
||||||
if (result == 0)
|
|
||||||
{
|
|
||||||
throw std::runtime_error("Unexpected error resolving locale name");
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
m_resolvedName = ref new Platform::String(resolvedName);
|
|
||||||
wchar_t decimalString[LocaleSettingBufferSize] = L"";
|
|
||||||
result = GetLocaleInfoEx(m_resolvedName->Data(), LOCALE_SDECIMAL, decimalString, static_cast<int>(std::size(decimalString)));
|
|
||||||
if (result == 0)
|
|
||||||
{
|
|
||||||
throw std::runtime_error("Unexpected error while getting locale info");
|
|
||||||
}
|
|
||||||
|
|
||||||
wchar_t groupingSymbolString[LocaleSettingBufferSize] = L"";
|
|
||||||
result = GetLocaleInfoEx(m_resolvedName->Data(), LOCALE_STHOUSAND, groupingSymbolString, static_cast<int>(std::size(groupingSymbolString)));
|
|
||||||
if (result == 0)
|
|
||||||
{
|
|
||||||
throw std::runtime_error("Unexpected error while getting locale info");
|
|
||||||
}
|
|
||||||
|
|
||||||
wchar_t numberGroupingString[LocaleSettingBufferSize] = L"";
|
|
||||||
result = GetLocaleInfoEx(m_resolvedName->Data(), LOCALE_SGROUPING, numberGroupingString, static_cast<int>(std::size(numberGroupingString)));
|
|
||||||
if (result == 0)
|
|
||||||
{
|
|
||||||
throw std::runtime_error("Unexpected error while getting locale info");
|
|
||||||
}
|
|
||||||
|
|
||||||
// Get locale info for List Separator, eg. comma is used in many locales
|
|
||||||
wchar_t listSeparatorString[4] = L"";
|
|
||||||
result = ::GetLocaleInfoEx(
|
|
||||||
m_resolvedName->Data(),
|
|
||||||
LOCALE_SLIST,
|
|
||||||
listSeparatorString,
|
|
||||||
static_cast<int>(std::size(listSeparatorString))); // Max length of the expected return value is 4
|
|
||||||
if (result == 0)
|
|
||||||
{
|
|
||||||
throw std::runtime_error("Unexpected error while getting locale info");
|
|
||||||
}
|
|
||||||
|
|
||||||
int currencyTrailingDigits = 0;
|
|
||||||
result = GetLocaleInfoEx(
|
|
||||||
m_resolvedName->Data(),
|
|
||||||
LOCALE_ICURRDIGITS | LOCALE_RETURN_NUMBER,
|
|
||||||
(LPWSTR)¤cyTrailingDigits,
|
|
||||||
sizeof(currencyTrailingDigits) / sizeof(WCHAR));
|
|
||||||
if (result == 0)
|
|
||||||
{
|
|
||||||
throw std::runtime_error("Unexpected error while getting locale info");
|
|
||||||
}
|
|
||||||
|
|
||||||
// Currency symbol precedence is either 0 or 1.
|
|
||||||
// A value of 0 indicates the symbol follows the currency value.
|
|
||||||
int currencySymbolPrecedence = 1;
|
|
||||||
result = GetLocaleInfoEx(
|
|
||||||
m_resolvedName->Data(),
|
|
||||||
LOCALE_IPOSSYMPRECEDES | LOCALE_RETURN_NUMBER,
|
|
||||||
(LPWSTR)¤cySymbolPrecedence,
|
|
||||||
sizeof(currencySymbolPrecedence) / sizeof(WCHAR));
|
|
||||||
|
|
||||||
// As CalcEngine only supports the first character of the decimal separator,
|
|
||||||
// Only first character of the decimal separator string is supported.
|
|
||||||
m_decimalSeparator = decimalString[0];
|
|
||||||
m_numberGroupSeparator = groupingSymbolString[0];
|
|
||||||
m_numberGrouping = numberGroupingString;
|
|
||||||
m_listSeparator = listSeparatorString;
|
|
||||||
m_currencyTrailingDigits = currencyTrailingDigits;
|
|
||||||
m_currencySymbolPrecedence = currencySymbolPrecedence;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Get the system calendar type
|
|
||||||
// Note: This function returns 0 on failure.
|
|
||||||
// We'll ignore the failure in that case and the CalendarIdentifier would get set to GregorianCalendar.
|
|
||||||
CALID calId;
|
|
||||||
::GetLocaleInfoEx(m_resolvedName->Data(), LOCALE_ICALENDARTYPE | LOCALE_RETURN_NUMBER, reinterpret_cast<PWSTR>(&calId), sizeof(calId));
|
|
||||||
|
|
||||||
m_calendarIdentifier = GetCalendarIdentifierFromCalid(calId);
|
|
||||||
|
|
||||||
// Get FirstDayOfWeek Date and Time setting
|
|
||||||
wchar_t day[80] = L"";
|
|
||||||
::GetLocaleInfoEx(
|
|
||||||
m_resolvedName->Data(),
|
|
||||||
LOCALE_IFIRSTDAYOFWEEK, // The first day in a week
|
|
||||||
reinterpret_cast<PWSTR>(day), // Argument is of type PWSTR
|
|
||||||
static_cast<int>(std::size(day))); // Max return size are 80 characters
|
|
||||||
|
|
||||||
// The LOCALE_IFIRSTDAYOFWEEK integer value varies from 0, 1, .. 6 for Monday, Tuesday, ... Sunday
|
|
||||||
// DayOfWeek enum value varies from 0, 1, .. 6 for Sunday, Monday, ... Saturday
|
|
||||||
// Hence, DayOfWeek = (valueof(LOCALE_IFIRSTDAYOFWEEK) + 1) % 7
|
|
||||||
m_firstDayOfWeek = static_cast<Windows::Globalization::DayOfWeek>((_wtoi(day) + 1) % 7); // static cast int to DayOfWeek enum
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// A LocalizationSettings object is not copyable.
|
// A LocalizationSettings object is not copyable.
|
||||||
|
@ -300,6 +202,110 @@ namespace CalculatorApp
|
||||||
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
void InitializeLocalizationSettings(Windows::Globalization::NumberFormatting::DecimalFormatter ^ formatter)
|
||||||
|
{
|
||||||
|
formatter->FractionDigits = 0;
|
||||||
|
formatter->IsDecimalPointAlwaysDisplayed = false;
|
||||||
|
|
||||||
|
for (unsigned int i = 0; i < m_digitSymbols.size(); i++)
|
||||||
|
{
|
||||||
|
m_digitSymbols[i] = formatter->FormatUInt(i)->Data()[0];
|
||||||
|
}
|
||||||
|
|
||||||
|
wchar_t resolvedName[LOCALE_NAME_MAX_LENGTH];
|
||||||
|
int result = ResolveLocaleName(formatter->ResolvedLanguage->Data(), resolvedName, LOCALE_NAME_MAX_LENGTH);
|
||||||
|
if (result == 0)
|
||||||
|
{
|
||||||
|
throw std::runtime_error("Unexpected error resolving locale name");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
m_resolvedName = ref new Platform::String(resolvedName);
|
||||||
|
wchar_t decimalString[LocaleSettingBufferSize] = L"";
|
||||||
|
result = GetLocaleInfoEx(m_resolvedName->Data(), LOCALE_SDECIMAL, decimalString, static_cast<int>(std::size(decimalString)));
|
||||||
|
if (result == 0)
|
||||||
|
{
|
||||||
|
throw std::runtime_error("Unexpected error while getting locale info");
|
||||||
|
}
|
||||||
|
|
||||||
|
wchar_t groupingSymbolString[LocaleSettingBufferSize] = L"";
|
||||||
|
result = GetLocaleInfoEx(m_resolvedName->Data(), LOCALE_STHOUSAND, groupingSymbolString, static_cast<int>(std::size(groupingSymbolString)));
|
||||||
|
if (result == 0)
|
||||||
|
{
|
||||||
|
throw std::runtime_error("Unexpected error while getting locale info");
|
||||||
|
}
|
||||||
|
|
||||||
|
wchar_t numberGroupingString[LocaleSettingBufferSize] = L"";
|
||||||
|
result = GetLocaleInfoEx(m_resolvedName->Data(), LOCALE_SGROUPING, numberGroupingString, static_cast<int>(std::size(numberGroupingString)));
|
||||||
|
if (result == 0)
|
||||||
|
{
|
||||||
|
throw std::runtime_error("Unexpected error while getting locale info");
|
||||||
|
}
|
||||||
|
|
||||||
|
// Get locale info for List Separator, eg. comma is used in many locales
|
||||||
|
wchar_t listSeparatorString[4] = L"";
|
||||||
|
result = ::GetLocaleInfoEx(
|
||||||
|
m_resolvedName->Data(),
|
||||||
|
LOCALE_SLIST,
|
||||||
|
listSeparatorString,
|
||||||
|
static_cast<int>(std::size(listSeparatorString))); // Max length of the expected return value is 4
|
||||||
|
if (result == 0)
|
||||||
|
{
|
||||||
|
throw std::runtime_error("Unexpected error while getting locale info");
|
||||||
|
}
|
||||||
|
|
||||||
|
int currencyTrailingDigits = 0;
|
||||||
|
result = GetLocaleInfoEx(
|
||||||
|
m_resolvedName->Data(),
|
||||||
|
LOCALE_ICURRDIGITS | LOCALE_RETURN_NUMBER,
|
||||||
|
(LPWSTR)¤cyTrailingDigits,
|
||||||
|
sizeof(currencyTrailingDigits) / sizeof(WCHAR));
|
||||||
|
if (result == 0)
|
||||||
|
{
|
||||||
|
throw std::runtime_error("Unexpected error while getting locale info");
|
||||||
|
}
|
||||||
|
|
||||||
|
// Currency symbol precedence is either 0 or 1.
|
||||||
|
// A value of 0 indicates the symbol follows the currency value.
|
||||||
|
int currencySymbolPrecedence = 1;
|
||||||
|
result = GetLocaleInfoEx(
|
||||||
|
m_resolvedName->Data(),
|
||||||
|
LOCALE_IPOSSYMPRECEDES | LOCALE_RETURN_NUMBER,
|
||||||
|
(LPWSTR)¤cySymbolPrecedence,
|
||||||
|
sizeof(currencySymbolPrecedence) / sizeof(WCHAR));
|
||||||
|
|
||||||
|
// As CalcEngine only supports the first character of the decimal separator,
|
||||||
|
// Only first character of the decimal separator string is supported.
|
||||||
|
m_decimalSeparator = decimalString[0];
|
||||||
|
m_numberGroupSeparator = groupingSymbolString[0];
|
||||||
|
m_numberGrouping = numberGroupingString;
|
||||||
|
m_listSeparator = listSeparatorString;
|
||||||
|
m_currencyTrailingDigits = currencyTrailingDigits;
|
||||||
|
m_currencySymbolPrecedence = currencySymbolPrecedence;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Get the system calendar type
|
||||||
|
// Note: This function returns 0 on failure.
|
||||||
|
// We'll ignore the failure in that case and the CalendarIdentifier would get set to GregorianCalendar.
|
||||||
|
CALID calId;
|
||||||
|
::GetLocaleInfoEx(m_resolvedName->Data(), LOCALE_ICALENDARTYPE | LOCALE_RETURN_NUMBER, reinterpret_cast<PWSTR>(&calId), sizeof(calId));
|
||||||
|
|
||||||
|
m_calendarIdentifier = GetCalendarIdentifierFromCalid(calId);
|
||||||
|
|
||||||
|
// Get FirstDayOfWeek Date and Time setting
|
||||||
|
wchar_t day[80] = L"";
|
||||||
|
::GetLocaleInfoEx(
|
||||||
|
m_resolvedName->Data(),
|
||||||
|
LOCALE_IFIRSTDAYOFWEEK, // The first day in a week
|
||||||
|
reinterpret_cast<PWSTR>(day), // Argument is of type PWSTR
|
||||||
|
static_cast<int>(std::size(day))); // Max return size are 80 characters
|
||||||
|
|
||||||
|
// The LOCALE_IFIRSTDAYOFWEEK integer value varies from 0, 1, .. 6 for Monday, Tuesday, ... Sunday
|
||||||
|
// DayOfWeek enum value varies from 0, 1, .. 6 for Sunday, Monday, ... Saturday
|
||||||
|
// Hence, DayOfWeek = (valueof(LOCALE_IFIRSTDAYOFWEEK) + 1) % 7
|
||||||
|
m_firstDayOfWeek = static_cast<Windows::Globalization::DayOfWeek>((_wtoi(day) + 1) % 7); // static cast int to DayOfWeek enum
|
||||||
|
}
|
||||||
|
|
||||||
static Platform::String^ GetCalendarIdentifierFromCalid(CALID calId)
|
static Platform::String^ GetCalendarIdentifierFromCalid(CALID calId)
|
||||||
{
|
{
|
||||||
switch (calId)
|
switch (calId)
|
||||||
|
|
|
@ -449,18 +449,19 @@ ViewMode NavCategory::GetViewModeForVirtualKey(MyVirtualKey virtualKey)
|
||||||
return (iter != s_categoryManifest.end()) ? iter->viewMode : ViewMode::None;
|
return (iter != s_categoryManifest.end()) ? iter->viewMode : ViewMode::None;
|
||||||
}
|
}
|
||||||
|
|
||||||
vector<MyVirtualKey> NavCategory::GetCategoryAcceleratorKeys()
|
void NavCategory::GetCategoryAcceleratorKeys(IVector<MyVirtualKey> ^ accelerators)
|
||||||
{
|
{
|
||||||
vector<MyVirtualKey> accelerators{};
|
if (accelerators != nullptr)
|
||||||
for (auto category : s_categoryManifest)
|
|
||||||
{
|
{
|
||||||
if (category.virtualKey != MyVirtualKey::None)
|
accelerators->Clear();
|
||||||
|
for (auto category : s_categoryManifest)
|
||||||
{
|
{
|
||||||
accelerators.push_back(category.virtualKey);
|
if (category.virtualKey != MyVirtualKey::None)
|
||||||
|
{
|
||||||
|
accelerators->Append(category.virtualKey);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return accelerators;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
NavCategoryGroup::NavCategoryGroup(const NavCategoryGroupInitializer& groupInitializer)
|
NavCategoryGroup::NavCategoryGroup(const NavCategoryGroupInitializer& groupInitializer)
|
||||||
|
|
|
@ -151,6 +151,7 @@ namespace CalculatorApp
|
||||||
static int GetPosition(ViewMode mode);
|
static int GetPosition(ViewMode mode);
|
||||||
|
|
||||||
static ViewMode GetViewModeForVirtualKey(MyVirtualKey virtualKey);
|
static ViewMode GetViewModeForVirtualKey(MyVirtualKey virtualKey);
|
||||||
|
static void GetCategoryAcceleratorKeys(Windows::Foundation::Collections::IVector<MyVirtualKey> ^ resutls);
|
||||||
|
|
||||||
internal : NavCategory(
|
internal : NavCategory(
|
||||||
Platform::String ^ name,
|
Platform::String ^ name,
|
||||||
|
@ -172,8 +173,6 @@ namespace CalculatorApp
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
static std::vector<MyVirtualKey> GetCategoryAcceleratorKeys();
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
static bool IsModeInCategoryGroup(ViewMode mode, CategoryGroupType groupType);
|
static bool IsModeInCategoryGroup(ViewMode mode, CategoryGroupType groupType);
|
||||||
|
|
||||||
|
@ -191,7 +190,7 @@ namespace CalculatorApp
|
||||||
|
|
||||||
static Windows::Foundation::Collections::IObservableVector<NavCategoryGroup ^> ^ CreateMenuOptions();
|
static Windows::Foundation::Collections::IObservableVector<NavCategoryGroup ^> ^ CreateMenuOptions();
|
||||||
|
|
||||||
internal : static NavCategoryGroup ^ CreateCalculatorCategory();
|
static NavCategoryGroup ^ CreateCalculatorCategory();
|
||||||
static NavCategoryGroup ^ CreateConverterCategory();
|
static NavCategoryGroup ^ CreateConverterCategory();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
|
@ -49,10 +49,10 @@ 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);
|
||||||
|
|
||||||
internal : HistoryViewModel(_In_ CalculationManager::CalculatorManager* calculatorManager);
|
internal : HistoryViewModel(_In_ CalculationManager::CalculatorManager* calculatorManager);
|
||||||
void SetCalculatorDisplay(CalculatorDisplay& calculatorDisplay);
|
void SetCalculatorDisplay(CalculatorDisplay& calculatorDisplay);
|
||||||
void ReloadHistory(_In_ CalculatorApp::Common::ViewMode currentMode);
|
|
||||||
unsigned long long GetMaxItemSize();
|
unsigned long long GetMaxItemSize();
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -457,7 +457,7 @@ namespace CalculatorApp
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
m_secondaryWindows[frameService.GetViewId()] = frameService;
|
m_secondaryWindows[frameService.GetViewId()] = frameService;
|
||||||
TraceLogger.GetInstance().UpdateWindowCount(m_secondaryWindows.size());
|
TraceLogger.GetInstance().UpdateWindowCount(Convert.ToUInt64(m_secondaryWindows.Count));
|
||||||
}
|
}
|
||||||
finally
|
finally
|
||||||
{
|
{
|
||||||
|
|
|
@ -120,9 +120,6 @@
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<AppVersion Condition="'$(AppVersion)' == ''">0.0.0.0</AppVersion>
|
<AppVersion Condition="'$(AppVersion)' == ''">0.0.0.0</AppVersion>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<ItemGroup>
|
|
||||||
<ResourceCompile Include="Calculator.rc" PreprocessorDefinitions="%(PreprocessorDefinitions);APP_VERSION_MAJOR=$(AppVersion.Split(`.`)[0]);APP_VERSION_MINOR=$(AppVersion.Split(`.`)[1]);APP_VERSION_BUILD=$(AppVersion.Split(`.`)[2]);APP_VERSION_REVISION=$(AppVersion.Split(`.`)[3])" />
|
|
||||||
</ItemGroup>
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Compile Include="AboutFlyout.xaml.cs">
|
<Compile Include="AboutFlyout.xaml.cs">
|
||||||
<DependentUpon>AboutFlyout.xaml</DependentUpon>
|
<DependentUpon>AboutFlyout.xaml</DependentUpon>
|
||||||
|
@ -462,6 +459,7 @@
|
||||||
<Content Include="Assets\Standard.targetsize-32_contrast-white.png" />
|
<Content Include="Assets\Standard.targetsize-32_contrast-white.png" />
|
||||||
<Content Include="Assets\Standard.targetsize-64_contrast-black.png" />
|
<Content Include="Assets\Standard.targetsize-64_contrast-black.png" />
|
||||||
<Content Include="Assets\Standard.targetsize-64_contrast-white.png" />
|
<Content Include="Assets\Standard.targetsize-64_contrast-white.png" />
|
||||||
|
<Content Include="Calculator.rc" />
|
||||||
<Content Include="Properties\Default.rd.xml" />
|
<Content Include="Properties\Default.rd.xml" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
|
11
src/Calculator/Calculator.rc
Normal file
11
src/Calculator/Calculator.rc
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||||
|
// Licensed under the MIT License.
|
||||||
|
|
||||||
|
// CSHARP_MIGRATION: TODO:
|
||||||
|
#define APP_FILE_NAME "Calculator"
|
||||||
|
#define APP_FILE_IS_EXE
|
||||||
|
#define APP_PRODUCT_NAME "Microsoft Calculator"
|
||||||
|
#define APP_COMPANY_NAME "Microsoft Corporation"
|
||||||
|
#define APP_COPYRIGHT "\251 Microsoft Corporation. All rights reserved."
|
||||||
|
|
||||||
|
#include "../build/appversion.rc"
|
|
@ -348,7 +348,8 @@ namespace CalculatorApp
|
||||||
if (ex.HResult == unchecked(rpc_e_servercall_retrylater))
|
if (ex.HResult == unchecked(rpc_e_servercall_retrylater))
|
||||||
{
|
{
|
||||||
ShowShareError();
|
ShowShareError();
|
||||||
TraceLogger.GetInstance().LogPlatformException(ViewMode.Graphing, System.Reflection.MethodBase.GetCurrentMethod().Name, ex);
|
// CSHARP_MIGRATION: TODO:
|
||||||
|
//TraceLogger.GetInstance().LogPlatformException(ViewMode.Graphing, System.Reflection.MethodBase.GetCurrentMethod().Name, ex);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -495,8 +496,9 @@ namespace CalculatorApp
|
||||||
{
|
{
|
||||||
ShowShareError();
|
ShowShareError();
|
||||||
|
|
||||||
TraceLogger.GetInstance().LogPlatformException(ViewMode.Graphing,
|
// CSHARP_MIGRATION: TODO:
|
||||||
System.Reflection.MethodBase.GetCurrentMethod().Name, ex);
|
//TraceLogger.GetInstance().LogPlatformException(ViewMode.Graphing,
|
||||||
|
// System.Reflection.MethodBase.GetCurrentMethod().Name, ex);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
152
src/Calculator/WinMeta.cs
Normal file
152
src/Calculator/WinMeta.cs
Normal file
|
@ -0,0 +1,152 @@
|
||||||
|
// CSHARP_MIGRATION: TODO:
|
||||||
|
// this is a temporary solution to use the constants defined in winmeta.h file
|
||||||
|
|
||||||
|
namespace CalculatorApp
|
||||||
|
{
|
||||||
|
static class WinMeta
|
||||||
|
{
|
||||||
|
public const int WINEVENT_CHANNEL_CLASSIC_TRACE = 0x0;
|
||||||
|
public const int WINEVENT_CHANNEL_GLOBAL_SYSTEM = 0x8;
|
||||||
|
public const int WINEVENT_CHANNEL_GLOBAL_APPLICATION = 0x9;
|
||||||
|
public const int WINEVENT_CHANNEL_GLOBAL_SECURITY = 0xa;
|
||||||
|
public const int WINEVENT_CHANNEL_TRACELOGGING = 0xb;
|
||||||
|
public const int WINEVENT_CHANNEL_PROVIDERMETADATA = 0xc;
|
||||||
|
public const int WINEVENT_LEVEL_LOG_ALWAYS = 0x0;
|
||||||
|
public const int WINEVENT_LEVEL_CRITICAL = 0x1;
|
||||||
|
public const int WINEVENT_LEVEL_ERROR = 0x2;
|
||||||
|
public const int WINEVENT_LEVEL_WARNING = 0x3;
|
||||||
|
public const int WINEVENT_LEVEL_INFO = 0x4;
|
||||||
|
public const int WINEVENT_LEVEL_VERBOSE = 0x5;
|
||||||
|
public const int WINEVENT_LEVEL_RESERVED_6 = 0x6;
|
||||||
|
public const int WINEVENT_LEVEL_RESERVED_7 = 0x7;
|
||||||
|
public const int WINEVENT_LEVEL_RESERVED_8 = 0x8;
|
||||||
|
public const int WINEVENT_LEVEL_RESERVED_9 = 0x9;
|
||||||
|
public const int WINEVENT_LEVEL_RESERVED_10 = 0xa;
|
||||||
|
public const int WINEVENT_LEVEL_RESERVED_11 = 0xb;
|
||||||
|
public const int WINEVENT_LEVEL_RESERVED_12 = 0xc;
|
||||||
|
public const int WINEVENT_LEVEL_RESERVED_13 = 0xd;
|
||||||
|
public const int WINEVENT_LEVEL_RESERVED_14 = 0xe;
|
||||||
|
public const int WINEVENT_LEVEL_RESERVED_15 = 0xf;
|
||||||
|
public const int WINEVENT_OPCODE_INFO = 0x0;
|
||||||
|
public const int WINEVENT_OPCODE_START = 0x1;
|
||||||
|
public const int WINEVENT_OPCODE_STOP = 0x2;
|
||||||
|
public const int WINEVENT_OPCODE_DC_START = 0x3;
|
||||||
|
public const int WINEVENT_OPCODE_DC_STOP = 0x4;
|
||||||
|
public const int WINEVENT_OPCODE_EXTENSION = 0x5;
|
||||||
|
public const int WINEVENT_OPCODE_REPLY = 0x6;
|
||||||
|
public const int WINEVENT_OPCODE_RESUME = 0x7;
|
||||||
|
public const int WINEVENT_OPCODE_SUSPEND = 0x8;
|
||||||
|
public const int WINEVENT_OPCODE_SEND = 0x9;
|
||||||
|
public const int WINEVENT_OPCODE_RECEIVE = 0xf0;
|
||||||
|
public const int WINEVENT_OPCODE_RESERVED_241 = 0xf1;
|
||||||
|
public const int WINEVENT_OPCODE_RESERVED_242 = 0xf2;
|
||||||
|
public const int WINEVENT_OPCODE_RESERVED_243 = 0xf3;
|
||||||
|
public const int WINEVENT_OPCODE_RESERVED_244 = 0xf4;
|
||||||
|
public const int WINEVENT_OPCODE_RESERVED_245 = 0xf5;
|
||||||
|
public const int WINEVENT_OPCODE_RESERVED_246 = 0xf6;
|
||||||
|
public const int WINEVENT_OPCODE_RESERVED_247 = 0xf7;
|
||||||
|
public const int WINEVENT_OPCODE_RESERVED_248 = 0xf8;
|
||||||
|
public const int WINEVENT_OPCODE_RESERVED_249 = 0xf9;
|
||||||
|
public const int WINEVENT_OPCODE_RESERVED_250 = 0xfa;
|
||||||
|
public const int WINEVENT_OPCODE_RESERVED_251 = 0xfb;
|
||||||
|
public const int WINEVENT_OPCODE_RESERVED_252 = 0xfc;
|
||||||
|
public const int WINEVENT_OPCODE_RESERVED_253 = 0xfd;
|
||||||
|
public const int WINEVENT_OPCODE_RESERVED_254 = 0xfe;
|
||||||
|
public const int WINEVENT_OPCODE_RESERVED_255 = 0xff;
|
||||||
|
public const int WINEVENT_TASK_NONE = 0x0;
|
||||||
|
public const int WINEVT_KEYWORD_ANY = 0x0;
|
||||||
|
public const long WINEVENT_KEYWORD_RESPONSE_TIME = 0x1000000000000;
|
||||||
|
public const long WINEVENT_KEYWORD_RESERVED_49 = 0x2000000000000;
|
||||||
|
public const long WINEVENT_KEYWORD_WDI_DIAG = 0x4000000000000;
|
||||||
|
public const long WINEVENT_KEYWORD_SQM = 0x8000000000000;
|
||||||
|
public const long WINEVENT_KEYWORD_AUDIT_FAILURE = 0x10000000000000;
|
||||||
|
public const long WINEVENT_KEYWORD_AUDIT_SUCCESS = 0x20000000000000;
|
||||||
|
public const long WINEVENT_KEYWORD_CORRELATION_HINT = 0x40000000000000;
|
||||||
|
public const long WINEVENT_KEYWORD_EVENTLOG_CLASSIC = 0x80000000000000;
|
||||||
|
public const long WINEVENT_KEYWORD_RESERVED_56 = 0x100000000000000;
|
||||||
|
public const long WINEVENT_KEYWORD_RESERVED_57 = 0x200000000000000;
|
||||||
|
public const long WINEVENT_KEYWORD_RESERVED_58 = 0x400000000000000;
|
||||||
|
public const long WINEVENT_KEYWORD_RESERVED_59 = 0x800000000000000;
|
||||||
|
public const long WINEVENT_KEYWORD_RESERVED_60 = 0x1000000000000000;
|
||||||
|
public const long WINEVENT_KEYWORD_RESERVED_61 = 0x2000000000000000;
|
||||||
|
public const long WINEVENT_KEYWORD_RESERVED_62 = 0x4000000000000000;
|
||||||
|
public const ulong WINEVENT_KEYWORD_RESERVED_63 = 0x8000000000000000;
|
||||||
|
public const long MSG_category_Devices = 0x00000001L;
|
||||||
|
|
||||||
|
public const long MSG_category_Disk = 0x00000002L;
|
||||||
|
|
||||||
|
public const long MSG_category_Network = 0x00000007L;
|
||||||
|
|
||||||
|
public const long MSG_category_Printers = 0x00000003L;
|
||||||
|
|
||||||
|
public const long MSG_category_Services = 0x00000004L;
|
||||||
|
|
||||||
|
public const long MSG_category_Shell = 0x00000005L;
|
||||||
|
|
||||||
|
public const long MSG_category_SystemEvent = 0x00000006L;
|
||||||
|
|
||||||
|
public const long MSG_channel_Application = 0x00000100L;
|
||||||
|
|
||||||
|
public const long MSG_channel_ProviderMetadata = 0x90000003L;
|
||||||
|
|
||||||
|
public const long MSG_channel_Security = 0x00000101L;
|
||||||
|
|
||||||
|
public const long MSG_channel_System = 0x00000102L;
|
||||||
|
|
||||||
|
public const long MSG_channel_TraceClassic = 0x90000001L;
|
||||||
|
|
||||||
|
public const long MSG_channel_TraceLogging = 0x90000002L;
|
||||||
|
|
||||||
|
public const long MSG_keyword_AnyKeyword = 0x10000000L;
|
||||||
|
|
||||||
|
public const long MSG_keyword_AuditFailure = 0x10000035L;
|
||||||
|
|
||||||
|
public const long MSG_keyword_AuditSuccess = 0x10000036L;
|
||||||
|
|
||||||
|
public const long MSG_keyword_Classic = 0x10000038L;
|
||||||
|
|
||||||
|
public const long MSG_keyword_CorrelationHint = 0x10000037L;
|
||||||
|
|
||||||
|
public const long MSG_keyword_ResponseTime = 0x10000031L;
|
||||||
|
|
||||||
|
public const long MSG_keyword_SQM = 0x10000034L;
|
||||||
|
|
||||||
|
public const long MSG_keyword_WDIDiag = 0x10000033L;
|
||||||
|
|
||||||
|
public const long MSG_level_Critical = 0x50000001L;
|
||||||
|
|
||||||
|
public const long MSG_level_Error = 0x50000002L;
|
||||||
|
|
||||||
|
public const long MSG_level_Informational = 0x50000004L;
|
||||||
|
|
||||||
|
public const long MSG_level_LogAlways = 0x50000000L;
|
||||||
|
|
||||||
|
public const long MSG_level_Verbose = 0x50000005L;
|
||||||
|
|
||||||
|
public const long MSG_level_Warning = 0x50000003L;
|
||||||
|
|
||||||
|
public const long MSG_opcode_DCStart = 0x30030000L;
|
||||||
|
|
||||||
|
public const long MSG_opcode_DCStop = 0x30040000L;
|
||||||
|
|
||||||
|
public const long MSG_opcode_Extension = 0x30050000L;
|
||||||
|
|
||||||
|
public const long MSG_opcode_Info = 0x30000000L;
|
||||||
|
|
||||||
|
public const long MSG_opcode_Receive = 0x30F00000L;
|
||||||
|
|
||||||
|
public const long MSG_opcode_Reply = 0x30060000L;
|
||||||
|
|
||||||
|
public const long MSG_opcode_Resume = 0x30070000L;
|
||||||
|
|
||||||
|
public const long MSG_opcode_Send = 0x30090000L;
|
||||||
|
|
||||||
|
public const long MSG_opcode_Start = 0x30010000L;
|
||||||
|
|
||||||
|
public const long MSG_opcode_Stop = 0x30020000L;
|
||||||
|
|
||||||
|
public const long MSG_opcode_Suspend = 0x30080000L;
|
||||||
|
|
||||||
|
public const long MSG_task_None = 0x70000000L;
|
||||||
|
}
|
||||||
|
}
|
Loading…
Add table
Add a link
Reference in a new issue