mirror of
https://github.com/Microsoft/calculator.git
synced 2025-08-22 22:23:29 -07:00
Log DateTime mode usage telemetry
This commit is contained in:
parent
f5fa7c3d4e
commit
d9685856b6
3 changed files with 19 additions and 0 deletions
|
@ -76,6 +76,7 @@ namespace CalculatorApp
|
||||||
constexpr auto EVENT_NAME_CORE_WINDOW_WAS_NULL = L"CoreWindowWasNull";
|
constexpr auto EVENT_NAME_CORE_WINDOW_WAS_NULL = L"CoreWindowWasNull";
|
||||||
|
|
||||||
constexpr auto EVENT_NAME_MODE_CHANGED = L"ModeChanged";
|
constexpr auto EVENT_NAME_MODE_CHANGED = L"ModeChanged";
|
||||||
|
constexpr auto EVENT_NAME_DATE_CALCULATION_MODE_USED = L"DateCalculationModeUsed";
|
||||||
|
|
||||||
constexpr auto EVENT_NAME_EXCEPTION = L"Exception";
|
constexpr auto EVENT_NAME_EXCEPTION = L"Exception";
|
||||||
|
|
||||||
|
@ -919,6 +920,15 @@ namespace CalculatorApp
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void TraceLogger::LogDateCalculationModeUsed(bool AddSubtractMode)
|
||||||
|
{
|
||||||
|
LoggingFields fields{};
|
||||||
|
fields.AddBoolean(L"CalculationType", AddSubtractMode);
|
||||||
|
// cast mode to an int for telemetry
|
||||||
|
fields.AddInt32(L"CalcMode", NavCategory::Serialize(ViewMode::Date));
|
||||||
|
LogLevel2Event(EVENT_NAME_DATE_CALCULATION_MODE_USED, fields);
|
||||||
|
}
|
||||||
|
|
||||||
void TraceLogger::LogDateDifferenceModeUsed(int windowId)
|
void TraceLogger::LogDateDifferenceModeUsed(int windowId)
|
||||||
{
|
{
|
||||||
if (!m_dateDiffUsageLoggedInSession)
|
if (!m_dateDiffUsageLoggedInSession)
|
||||||
|
|
|
@ -77,6 +77,7 @@ namespace CalculatorApp
|
||||||
void LogRadixButtonUsed(int windowId);
|
void LogRadixButtonUsed(int windowId);
|
||||||
void LogAngleButtonUsed(int windowId);
|
void LogAngleButtonUsed(int windowId);
|
||||||
void LogHypButtonUsed(int windowId);
|
void LogHypButtonUsed(int windowId);
|
||||||
|
void LogDateCalculationModeUsed(bool AddSubtractMode);
|
||||||
void LogNewWindowCreationBegin(int windowId);
|
void LogNewWindowCreationBegin(int windowId);
|
||||||
void LogNewWindowCreationEnd(int windowId);
|
void LogNewWindowCreationEnd(int windowId);
|
||||||
void LogError(std::wstring_view errorString);
|
void LogError(std::wstring_view errorString);
|
||||||
|
|
|
@ -104,6 +104,7 @@ void DateCalculator::FromDate_DateChanged(_In_ CalendarDatePicker ^ sender, _In_
|
||||||
auto dateCalcViewModel = safe_cast<DateCalculatorViewModel ^>(this->DataContext);
|
auto dateCalcViewModel = safe_cast<DateCalculatorViewModel ^>(this->DataContext);
|
||||||
dateCalcViewModel->FromDate = e->NewDate->Value;
|
dateCalcViewModel->FromDate = e->NewDate->Value;
|
||||||
TraceLogger::GetInstance().LogDateDifferenceModeUsed(ApplicationView::GetApplicationViewIdForWindow(CoreWindow::GetForCurrentThread()));
|
TraceLogger::GetInstance().LogDateDifferenceModeUsed(ApplicationView::GetApplicationViewIdForWindow(CoreWindow::GetForCurrentThread()));
|
||||||
|
TraceLogger::GetInstance().LogDateCalculationModeUsed(false /* AddSubtractMode */);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -118,6 +119,7 @@ void DateCalculator::ToDate_DateChanged(_In_ CalendarDatePicker ^ sender, _In_ C
|
||||||
auto dateCalcViewModel = safe_cast<DateCalculatorViewModel ^>(this->DataContext);
|
auto dateCalcViewModel = safe_cast<DateCalculatorViewModel ^>(this->DataContext);
|
||||||
dateCalcViewModel->ToDate = e->NewDate->Value;
|
dateCalcViewModel->ToDate = e->NewDate->Value;
|
||||||
TraceLogger::GetInstance().LogDateDifferenceModeUsed(ApplicationView::GetApplicationViewIdForWindow(CoreWindow::GetForCurrentThread()));
|
TraceLogger::GetInstance().LogDateDifferenceModeUsed(ApplicationView::GetApplicationViewIdForWindow(CoreWindow::GetForCurrentThread()));
|
||||||
|
TraceLogger::GetInstance().LogDateCalculationModeUsed(false /* AddSubtractMode */);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -133,6 +135,7 @@ void DateCalculator::AddSubtract_DateChanged(_In_ CalendarDatePicker ^ sender, _
|
||||||
dateCalcViewModel->StartDate = e->NewDate->Value;
|
dateCalcViewModel->StartDate = e->NewDate->Value;
|
||||||
TraceLogger::GetInstance().LogDateAddSubtractModeUsed(
|
TraceLogger::GetInstance().LogDateAddSubtractModeUsed(
|
||||||
ApplicationView::GetApplicationViewIdForWindow(CoreWindow::GetForCurrentThread()), dateCalcViewModel->IsAddMode);
|
ApplicationView::GetApplicationViewIdForWindow(CoreWindow::GetForCurrentThread()), dateCalcViewModel->IsAddMode);
|
||||||
|
TraceLogger::GetInstance().LogDateCalculationModeUsed(true /* AddSubtractMode */);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -145,6 +148,11 @@ void CalculatorApp::DateCalculator::OffsetValue_Changed(_In_ Platform::Object ^
|
||||||
auto dateCalcViewModel = safe_cast<DateCalculatorViewModel ^>(this->DataContext);
|
auto dateCalcViewModel = safe_cast<DateCalculatorViewModel ^>(this->DataContext);
|
||||||
TraceLogger::GetInstance().LogDateAddSubtractModeUsed(
|
TraceLogger::GetInstance().LogDateAddSubtractModeUsed(
|
||||||
ApplicationView::GetApplicationViewIdForWindow(CoreWindow::GetForCurrentThread()), dateCalcViewModel->IsAddMode);
|
ApplicationView::GetApplicationViewIdForWindow(CoreWindow::GetForCurrentThread()), dateCalcViewModel->IsAddMode);
|
||||||
|
// do not log telemetry for no-ops and initialization of combo boxes
|
||||||
|
if (dateCalcViewModel->DaysOffset != 0 || dateCalcViewModel->MonthsOffset != 0 || dateCalcViewModel->YearsOffset != 0)
|
||||||
|
{
|
||||||
|
TraceLogger::GetInstance().LogDateCalculationModeUsed(true /* AddSubtractMode */);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void DateCalculator::OnCopyMenuItemClicked(_In_ Object ^ sender, _In_ RoutedEventArgs ^ e)
|
void DateCalculator::OnCopyMenuItemClicked(_In_ Object ^ sender, _In_ RoutedEventArgs ^ e)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue