Updated Calculator diagnostic data collection per the specification (#572)
- Removed unneeded diagnostic events and code - Added and consolidated events into the events defined in the spec
This commit is contained in:
		
				
					committed by
					
						 Matt Cooley
						Matt Cooley
					
				
			
			
				
	
			
			
			
						parent
						
							2ff7bb4089
						
					
				
				
					commit
					a6384269bc
				
			| @@ -48,10 +48,10 @@ We also welcome [issues submitted on GitHub](https://github.com/Microsoft/calcul | |||||||
| ## Roadmap | ## Roadmap | ||||||
| For information regarding Windows Calculator plans and release schedule, please see the [Windows Calculator Roadmap](docs/Roadmap.md). | For information regarding Windows Calculator plans and release schedule, please see the [Windows Calculator Roadmap](docs/Roadmap.md). | ||||||
|  |  | ||||||
| ## Data / Telemetry | ## Diagnostic Data | ||||||
| This project collects usage data and sends it to Microsoft to help improve our products and services. | This project collects usage data and sends it to Microsoft to help improve our products and services. | ||||||
| Read our [privacy statement](https://go.microsoft.com/fwlink/?LinkId=521839) to learn more. | Read our [privacy statement](https://go.microsoft.com/fwlink/?LinkId=521839) to learn more. | ||||||
| Telemetry is disabled in development builds by default, and can be enabled with the `SEND_TELEMETRY` | Diagnostic data is disabled in development builds by default, and can be enabled with the `SEND_DIAGNOSTICS` | ||||||
| build flag. | build flag. | ||||||
|  |  | ||||||
| ## Currency Converter | ## Currency Converter | ||||||
|   | |||||||
| @@ -82,7 +82,7 @@ void ApplicationViewModel::Initialize(ViewMode mode) | |||||||
|     } |     } | ||||||
|     catch (const std::exception& e) |     catch (const std::exception& e) | ||||||
|     { |     { | ||||||
|         TraceLogger::GetInstance().LogStandardException(__FUNCTIONW__, e); |         TraceLogger::GetInstance().LogStandardException(mode, __FUNCTIONW__, e); | ||||||
|         if (!TryRecoverFromNavigationModeFailure()) |         if (!TryRecoverFromNavigationModeFailure()) | ||||||
|         { |         { | ||||||
|             // Could not navigate to standard mode either. |             // Could not navigate to standard mode either. | ||||||
| @@ -92,7 +92,7 @@ void ApplicationViewModel::Initialize(ViewMode mode) | |||||||
|     } |     } | ||||||
|     catch (Exception ^ e) |     catch (Exception ^ e) | ||||||
|     { |     { | ||||||
|         TraceLogger::GetInstance().LogPlatformException(__FUNCTIONW__, e); |         TraceLogger::GetInstance().LogPlatformException(mode, __FUNCTIONW__, e); | ||||||
|         if (!TryRecoverFromNavigationModeFailure()) |         if (!TryRecoverFromNavigationModeFailure()) | ||||||
|         { |         { | ||||||
|             // Could not navigate to standard mode either. |             // Could not navigate to standard mode either. | ||||||
| @@ -121,10 +121,8 @@ bool ApplicationViewModel::TryRecoverFromNavigationModeFailure() | |||||||
| void ApplicationViewModel::OnModeChanged() | void ApplicationViewModel::OnModeChanged() | ||||||
| { | { | ||||||
|     assert(NavCategory::IsValidViewMode(m_mode)); |     assert(NavCategory::IsValidViewMode(m_mode)); | ||||||
|     TraceLogger::GetInstance().LogModeChangeBegin(m_PreviousMode, m_mode, ApplicationView::GetApplicationViewIdForWindow(CoreWindow::GetForCurrentThread())); |  | ||||||
|     if (NavCategory::IsCalculatorViewMode(m_mode)) |     if (NavCategory::IsCalculatorViewMode(m_mode)) | ||||||
|     { |     { | ||||||
|         TraceLogger::GetInstance().LogCalculatorModeViewed(m_mode, ApplicationView::GetApplicationViewIdForWindow(CoreWindow::GetForCurrentThread())); |  | ||||||
|         if (!m_CalculatorViewModel) |         if (!m_CalculatorViewModel) | ||||||
|         { |         { | ||||||
|             m_CalculatorViewModel = ref new StandardCalculatorViewModel(); |             m_CalculatorViewModel = ref new StandardCalculatorViewModel(); | ||||||
| @@ -133,7 +131,6 @@ void ApplicationViewModel::OnModeChanged() | |||||||
|     } |     } | ||||||
|     else if (NavCategory::IsDateCalculatorViewMode(m_mode)) |     else if (NavCategory::IsDateCalculatorViewMode(m_mode)) | ||||||
|     { |     { | ||||||
|         TraceLogger::GetInstance().LogDateCalculatorModeViewed(m_mode, ApplicationView::GetApplicationViewIdForWindow(CoreWindow::GetForCurrentThread())); |  | ||||||
|         if (!m_DateCalcViewModel) |         if (!m_DateCalcViewModel) | ||||||
|         { |         { | ||||||
|             m_DateCalcViewModel = ref new DateCalculatorViewModel(); |             m_DateCalcViewModel = ref new DateCalculatorViewModel(); | ||||||
| @@ -141,7 +138,6 @@ void ApplicationViewModel::OnModeChanged() | |||||||
|     } |     } | ||||||
|     else if (NavCategory::IsConverterViewMode(m_mode)) |     else if (NavCategory::IsConverterViewMode(m_mode)) | ||||||
|     { |     { | ||||||
|         TraceLogger::GetInstance().LogConverterModeViewed(m_mode, ApplicationView::GetApplicationViewIdForWindow(CoreWindow::GetForCurrentThread())); |  | ||||||
|         if (!m_ConverterViewModel) |         if (!m_ConverterViewModel) | ||||||
|         { |         { | ||||||
|             auto dataLoader = make_shared<UnitConverterDataLoader>(ref new GeographicRegion()); |             auto dataLoader = make_shared<UnitConverterDataLoader>(ref new GeographicRegion()); | ||||||
| @@ -155,13 +151,21 @@ void ApplicationViewModel::OnModeChanged() | |||||||
|     auto resProvider = AppResourceProvider::GetInstance(); |     auto resProvider = AppResourceProvider::GetInstance(); | ||||||
|     CategoryName = resProvider.GetResourceString(NavCategory::GetNameResourceKey(m_mode)); |     CategoryName = resProvider.GetResourceString(NavCategory::GetNameResourceKey(m_mode)); | ||||||
|  |  | ||||||
|     // This is the only place where a ViewMode enum should be cast to an int. |     // Cast mode to an int in order to save it to app data. | ||||||
|     // |  | ||||||
|     // Save the changed mode, so that the new window launches in this mode. |     // Save the changed mode, so that the new window launches in this mode. | ||||||
|     // Don't save until after we have adjusted to the new mode, so we don't save a mode that fails to load. |     // Don't save until after we have adjusted to the new mode, so we don't save a mode that fails to load. | ||||||
|     ApplicationData::Current->LocalSettings->Values->Insert(ModePropertyName, NavCategory::Serialize(m_mode)); |     ApplicationData::Current->LocalSettings->Values->Insert(ModePropertyName, NavCategory::Serialize(m_mode)); | ||||||
|  |  | ||||||
|     TraceLogger::GetInstance().LogModeChangeEnd(m_mode, ApplicationView::GetApplicationViewIdForWindow(CoreWindow::GetForCurrentThread())); |     // Log ModeChange event when not first launch, log WindowCreated on first launch | ||||||
|  |     if (NavCategory::IsValidViewMode(m_PreviousMode)) | ||||||
|  |     { | ||||||
|  |         TraceLogger::GetInstance().LogModeChange(m_mode); | ||||||
|  |     } | ||||||
|  |     else | ||||||
|  |     { | ||||||
|  |         TraceLogger::GetInstance().LogWindowCreated(m_mode); | ||||||
|  |     } | ||||||
|  |  | ||||||
|     RaisePropertyChanged(ClearMemoryVisibilityPropertyName); |     RaisePropertyChanged(ClearMemoryVisibilityPropertyName); | ||||||
| } | } | ||||||
|  |  | ||||||
|   | |||||||
| @@ -308,7 +308,7 @@ | |||||||
|   </ItemDefinitionGroup> |   </ItemDefinitionGroup> | ||||||
|   <ItemDefinitionGroup Condition="'$(IsStoreBuild)' == 'True'"> |   <ItemDefinitionGroup Condition="'$(IsStoreBuild)' == 'True'"> | ||||||
|     <ClCompile> |     <ClCompile> | ||||||
|       <AdditionalOptions>/DSEND_TELEMETRY %(AdditionalOptions)</AdditionalOptions> |       <AdditionalOptions>/DSEND_DIAGNOSTICS %(AdditionalOptions)</AdditionalOptions> | ||||||
|     </ClCompile> |     </ClCompile> | ||||||
|   </ItemDefinitionGroup> |   </ItemDefinitionGroup> | ||||||
|   <ItemGroup> |   <ItemGroup> | ||||||
|   | |||||||
| @@ -161,55 +161,14 @@ public | |||||||
|         BINPOS62 = (int)CM::Command::CommandBINPOS62, |         BINPOS62 = (int)CM::Command::CommandBINPOS62, | ||||||
|         BINPOS63 = (int)CM::Command::CommandBINPOS63, |         BINPOS63 = (int)CM::Command::CommandBINPOS63, | ||||||
|         BINEND = (int)CM::Command::CommandBINEDITEND, |         BINEND = (int)CM::Command::CommandBINEDITEND, | ||||||
|         Hyp = (int)CM::Command::CommandHYP |         Hyp = (int)CM::Command::CommandHYP, | ||||||
|     }; |  | ||||||
|  |  | ||||||
|     // This contains list of functions whose usage we are tracelogging |         // Enum values below are used for Tracelogging and do not map to the Calculator engine | ||||||
| public |         MemoryAdd = (int)CM::Command::CommandMPLUS, | ||||||
|     enum class FunctionLogEnum |         MemorySubtract = (int)CM::Command::CommandMMINUS, | ||||||
|     { |         MemoryRecall = (int)CM::Command::CommandRECALL, | ||||||
|         Invert = (int)CM::Command::CommandREC, |         MemoryClear = (int)CM::Command::CommandMCLEAR, | ||||||
|         Sqrt = (int)CM::Command::CommandSQRT, |         BitflipButton = 1000, | ||||||
|         Percent = (int)CM::Command::CommandPERCENT, |         FullKeypadButton = 1001 | ||||||
|         Negate = (int)CM::Command::CommandSIGN, |  | ||||||
|         Degrees = (int)CM::Command::CommandDegrees, |  | ||||||
|         Pi = (int)CM::Command::CommandPI, |  | ||||||
|         Sin = (int)CM::Command::CommandSIN, |  | ||||||
|         Cos = (int)CM::Command::CommandCOS, |  | ||||||
|         Tan = (int)CM::Command::CommandTAN, |  | ||||||
|         Factorial = (int)CM::Command::CommandFAC, |  | ||||||
|         XPower2 = (int)CM::Command::CommandSQR, |  | ||||||
|         Mod = (int)CM::Command::CommandMOD, |  | ||||||
|         FToE = (int)CM::Command::CommandFE, |  | ||||||
|         LogBaseE = (int)CM::Command::CommandLN, |  | ||||||
|         InvSin = (int)CM::Command::CommandASIN, |  | ||||||
|         InvCos = (int)CM::Command::CommandACOS, |  | ||||||
|         InvTan = (int)CM::Command::CommandATAN, |  | ||||||
|         LogBase10 = (int)CM::Command::CommandLOG, |  | ||||||
|         XPowerY = (int)CM::Command::CommandPWR, |  | ||||||
|         YRootX = (int)CM::Command::CommandROOT, |  | ||||||
|         TenPowerX = (int)CM::Command::CommandPOW10, |  | ||||||
|         EPowerX = (int)CM::Command::CommandPOWE, |  | ||||||
|         Exp = (int)CM::Command::CommandEXP, |  | ||||||
|         DecButton = (int)CM::Command::CommandDec, |  | ||||||
|         OctButton = (int)CM::Command::CommandOct, |  | ||||||
|         HexButton = (int)CM::Command::CommandHex, |  | ||||||
|         BinButton = (int)CM::Command::CommandBin, |  | ||||||
|         And = (int)CM::Command::CommandAnd, |  | ||||||
|         Ror = (int)CM::Command::CommandROR, |  | ||||||
|         Rol = (int)CM::Command::CommandROL, |  | ||||||
|         Or = (int)CM::Command::CommandOR, |  | ||||||
|         Lsh = (int)CM::Command::CommandLSHF, |  | ||||||
|         Rsh = (int)CM::Command::CommandRSHF, |  | ||||||
|         Xor = (int)CM::Command::CommandXor, |  | ||||||
|         Not = (int)CM::Command::CommandNot, |  | ||||||
|         Sinh = (int)CM::Command::CommandSINH, |  | ||||||
|         Cosh = (int)CM::Command::CommandCOSH, |  | ||||||
|         Tanh = (int)CM::Command::CommandTANH, |  | ||||||
|         InvSinh = (int)CM::Command::CommandASINH, |  | ||||||
|         InvCosh = (int)CM::Command::CommandACOSH, |  | ||||||
|         InvTanh = (int)CM::Command::CommandATANH, |  | ||||||
|         Cube = (int)CM::Command::CommandCUB, |  | ||||||
|         DMS = (int)CM::Command::CommandDMS, |  | ||||||
|     }; |     }; | ||||||
| } | } | ||||||
|   | |||||||
| @@ -109,7 +109,7 @@ String ^ CopyPasteManager::ValidatePasteExpression(String ^ pastedText, ViewMode | |||||||
|     if (pastedText->Length() > MaxPasteableLength) |     if (pastedText->Length() > MaxPasteableLength) | ||||||
|     { |     { | ||||||
|         // return NoOp to indicate don't paste anything. |         // return NoOp to indicate don't paste anything. | ||||||
|         TraceLogger::GetInstance().LogInvalidPastedInputOccurred(L"PastedExpressionSizeGreaterThanMaxAllowed", mode, programmerNumberBase, bitLengthType); |         TraceLogger::GetInstance().LogError(mode, L"CopyPasteManager::ValidatePasteExpression", L"PastedExpressionSizeGreaterThanMaxAllowed"); | ||||||
|         return StringReference(PasteErrorString); |         return StringReference(PasteErrorString); | ||||||
|     } |     } | ||||||
|  |  | ||||||
| @@ -129,7 +129,7 @@ String ^ CopyPasteManager::ValidatePasteExpression(String ^ pastedText, ViewMode | |||||||
|  |  | ||||||
|     // Extract operands from the expression to make regex comparison easy and quick. For whole expression it was taking too much of time. |     // Extract operands from the expression to make regex comparison easy and quick. For whole expression it was taking too much of time. | ||||||
|     // Operands vector will have the list of operands in the pasteExpression |     // Operands vector will have the list of operands in the pasteExpression | ||||||
|     vector<wstring> operands = ExtractOperands(pasteExpression, mode, programmerNumberBase, bitLengthType); |     vector<wstring> operands = ExtractOperands(pasteExpression, mode); | ||||||
|     if (operands.empty()) |     if (operands.empty()) | ||||||
|     { |     { | ||||||
|         // return NoOp to indicate don't paste anything. |         // return NoOp to indicate don't paste anything. | ||||||
| @@ -144,14 +144,14 @@ String ^ CopyPasteManager::ValidatePasteExpression(String ^ pastedText, ViewMode | |||||||
|     // validate each operand with patterns for different modes |     // validate each operand with patterns for different modes | ||||||
|     if (!ExpressionRegExMatch(operands, mode, modeType, programmerNumberBase, bitLengthType)) |     if (!ExpressionRegExMatch(operands, mode, modeType, programmerNumberBase, bitLengthType)) | ||||||
|     { |     { | ||||||
|         TraceLogger::GetInstance().LogInvalidPastedInputOccurred(L"InvalidExpressionForPresentMode", mode, programmerNumberBase, bitLengthType); |         TraceLogger::GetInstance().LogError(mode, L"CopyPasteManager::ValidatePasteExpression", L"InvalidExpressionForPresentMode"); | ||||||
|         return StringReference(PasteErrorString); |         return StringReference(PasteErrorString); | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     return ref new String(pastedText->Data()); |     return ref new String(pastedText->Data()); | ||||||
| } | } | ||||||
|  |  | ||||||
| vector<wstring> CopyPasteManager::ExtractOperands(const wstring& pasteExpression, ViewMode mode, int programmerNumberBase, int bitLengthType) | vector<wstring> CopyPasteManager::ExtractOperands(const wstring& pasteExpression, ViewMode mode) | ||||||
| { | { | ||||||
|     vector<wstring> operands{}; |     vector<wstring> operands{}; | ||||||
|     size_t lastIndex = 0; |     size_t lastIndex = 0; | ||||||
| @@ -173,7 +173,7 @@ vector<wstring> CopyPasteManager::ExtractOperands(const wstring& pasteExpression | |||||||
|  |  | ||||||
|         if (operands.size() >= MaxOperandCount) |         if (operands.size() >= MaxOperandCount) | ||||||
|         { |         { | ||||||
|             TraceLogger::GetInstance().LogInvalidPastedInputOccurred(L"OperandCountGreaterThanMaxCount", mode, programmerNumberBase, bitLengthType); |             TraceLogger::GetInstance().LogError(mode, L"CopyPasteManager::ExtractOperands", L"OperandCountGreaterThanMaxCount"); | ||||||
|             operands.clear(); |             operands.clear(); | ||||||
|             return operands; |             return operands; | ||||||
|         } |         } | ||||||
| @@ -187,7 +187,7 @@ vector<wstring> CopyPasteManager::ExtractOperands(const wstring& pasteExpression | |||||||
|                 // to disallow pasting of 1e+12345 as 1e+1234, max exponent that can be pasted is 9999. |                 // to disallow pasting of 1e+12345 as 1e+1234, max exponent that can be pasted is 9999. | ||||||
|                 if (expLength > MaxExponentLength) |                 if (expLength > MaxExponentLength) | ||||||
|                 { |                 { | ||||||
|                     TraceLogger::GetInstance().LogInvalidPastedInputOccurred(L"ExponentLengthGreaterThanMaxLength", mode, programmerNumberBase, bitLengthType); |                     TraceLogger::GetInstance().LogError(mode, L"CopyPasteManager::ExtractOperands", L"ExponentLengthGreaterThanMaxLength"); | ||||||
|                     operands.clear(); |                     operands.clear(); | ||||||
|                     return operands; |                     return operands; | ||||||
|                 } |                 } | ||||||
|   | |||||||
| @@ -51,7 +51,7 @@ namespace CalculatorApp | |||||||
|                 int bitLengthType); |                 int bitLengthType); | ||||||
|  |  | ||||||
|         static std::vector<std::wstring> |         static std::vector<std::wstring> | ||||||
|         ExtractOperands(const std::wstring& pasteExpression, CalculatorApp::Common::ViewMode mode, int programmerNumberBase = -1, int bitLengthType = -1); |         ExtractOperands(const std::wstring& pasteExpression, CalculatorApp::Common::ViewMode mode); | ||||||
|         static bool ExpressionRegExMatch( |         static bool ExpressionRegExMatch( | ||||||
|             std::vector<std::wstring> operands, |             std::vector<std::wstring> operands, | ||||||
|             CalculatorApp::Common::ViewMode mode, |             CalculatorApp::Common::ViewMode mode, | ||||||
|   | |||||||
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							| @@ -6,6 +6,7 @@ | |||||||
| #include "CalcManager/Command.h" | #include "CalcManager/Command.h" | ||||||
| #include "TraceActivity.h" | #include "TraceActivity.h" | ||||||
| #include "NavCategory.h" | #include "NavCategory.h" | ||||||
|  | #include "CalculatorButtonUser.h" | ||||||
|  |  | ||||||
| static const int maxFunctionSize = (int)CalculationManager::Command::CommandBINEDITEND; | static const int maxFunctionSize = (int)CalculationManager::Command::CommandBINEDITEND; | ||||||
|  |  | ||||||
| @@ -13,19 +14,17 @@ static const int maxFunctionSize = (int)CalculationManager::Command::CommandBINE | |||||||
| // This class implements a singleton model ensure that only one instance is created. | // This class implements a singleton model ensure that only one instance is created. | ||||||
| namespace CalculatorApp | namespace CalculatorApp | ||||||
| { | { | ||||||
|     struct FuncLog |     struct ButtonLog | ||||||
|     { |     { | ||||||
|     public: |     public: | ||||||
|         int count; |         int count; | ||||||
|         std::wstring funcName; |         CalculatorApp::NumbersAndOperatorsEnum button; | ||||||
|         FuncLog() |         CalculatorApp::Common::ViewMode mode; | ||||||
|  |         ButtonLog(CalculatorApp::NumbersAndOperatorsEnum btn, CalculatorApp::Common::ViewMode vMode) | ||||||
|         { |         { | ||||||
|             count = 0; |             button = btn; | ||||||
|         } |             mode = vMode; | ||||||
|         FuncLog(std::wstring fName) |             count = 1; | ||||||
|         { |  | ||||||
|             funcName = fName; |  | ||||||
|             count = 0; |  | ||||||
|         } |         } | ||||||
|     }; |     }; | ||||||
|  |  | ||||||
| @@ -38,123 +37,45 @@ namespace CalculatorApp | |||||||
|         static TraceLogger& GetInstance(); |         static TraceLogger& GetInstance(); | ||||||
|         bool GetTraceLoggingProviderEnabled() const; |         bool GetTraceLoggingProviderEnabled() const; | ||||||
|  |  | ||||||
|         void LogAppLaunchStart(); |         void LogModeChange(CalculatorApp::Common::ViewMode mode) const; | ||||||
|         void LogAppLaunchComplete(); |         void LogHistoryItemLoad(CalculatorApp::Common::ViewMode mode, int historyListSize, int loadedIndex) const; | ||||||
|         void LogAppResumeComplete(); |         void LogMemoryItemLoad(CalculatorApp::Common::ViewMode mode, int memoryListSize, int loadedIndex) const; | ||||||
|         void LogOnAppLaunch(std::wstring_view previousExecutionState) const; |         void UpdateButtonUsage(CalculatorApp::NumbersAndOperatorsEnum button, CalculatorApp::Common::ViewMode mode); | ||||||
|         void LogMemoryClearAll(int); |         void LogButtonUsage(); | ||||||
|         void LogBitFlipPaneClicked() const; |         void LogDateCalculationModeUsed(bool AddSubtractMode); | ||||||
|         void LogBitFlipUsed() const; |         void UpdateWindowCount(size_t windowCount = 0); | ||||||
|         void LogHistoryBodyOpened() const; |  | ||||||
|         void LogHistoryItemLoadBegin() const; |  | ||||||
|         void LogHistoryItemLoadEnd(unsigned int) const; |  | ||||||
|         void LogHistoryFlyoutOpenBegin(unsigned int) const; |  | ||||||
|         void LogHistoryFlyoutOpenEnd(int) const; |  | ||||||
|         void LogCalculatorModeViewed(CalculatorApp::Common::ViewMode, int); |  | ||||||
|         void LogDateCalculatorModeViewed(CalculatorApp::Common::ViewMode, int); |  | ||||||
|         void LogConverterModeViewed(CalculatorApp::Common::ViewMode, int); |  | ||||||
|         void LogModeChangeBegin(CalculatorApp::Common::ViewMode, CalculatorApp::Common::ViewMode, int); |  | ||||||
|         void LogModeChangeEnd(CalculatorApp::Common::ViewMode, int) const; |  | ||||||
|         void LogClearHistory() const; |  | ||||||
|         void InsertIntoMemoryMap(int, bool, bool, bool); |  | ||||||
|         void UpdateMemoryMap(int, int, bool, bool, bool); |  | ||||||
|         void DeleteFromMemoryMap(int, int); |  | ||||||
|         void LogMemoryUsed(int, unsigned int, bool, bool, bool, unsigned int) const; |  | ||||||
|         void LogMultipleMemoryUsed(unsigned int, unsigned int) const; |  | ||||||
|         void LogSingleMemoryUsed(unsigned int) const; |  | ||||||
|         void LogSharedMemoryUsed(std::wstring_view, std::wstring_view, unsigned int) const; |  | ||||||
|         void LogMemoryBodyOpened() const; |  | ||||||
|         void LogMemoryFlyoutOpenBegin(unsigned int) const; |  | ||||||
|         void LogDebug(std::wstring_view debugData); |  | ||||||
|         void LogMemoryFlyoutOpenEnd(unsigned int) const; |  | ||||||
|         void LogInvalidPastedInputOccurred(std::wstring_view reason, CalculatorApp::Common::ViewMode mode, int ProgrammerNumberBase, int bitLengthType); |  | ||||||
|         void LogValidInputPasted(CalculatorApp::Common::ViewMode mode) const; |  | ||||||
|         void UpdateFunctionUsage(int func); |  | ||||||
|         void LogFunctionUsage(int); |  | ||||||
|         void InitFunctionLogArray(); |  | ||||||
|         void LogBitLengthButtonUsed(int windowId); |  | ||||||
|         void LogRadixButtonUsed(int windowId); |  | ||||||
|         void LogAngleButtonUsed(int windowId); |  | ||||||
|         void LogHypButtonUsed(int windowId); |  | ||||||
|         void LogNewWindowCreationBegin(int windowId); |  | ||||||
|         void LogNewWindowCreationEnd(int windowId); |  | ||||||
|         void LogError(std::wstring_view errorString); |  | ||||||
|         void LogPrelaunchedAppActivatedByUser(); |  | ||||||
|         void LogAppPrelaunchedBySystem(); |  | ||||||
|         void UpdateWindowCount(size_t windowCount); |  | ||||||
|         bool UpdateWindowIdLog(int windowId); |         bool UpdateWindowIdLog(int windowId); | ||||||
|         void LogMaxWindowCount(); |         void LogVisualStateChanged(CalculatorApp::Common::ViewMode mode, std::wstring_view state) const; | ||||||
|         void LogWindowActivated() const; |         void LogWindowCreated(CalculatorApp::Common::ViewMode mode) const; | ||||||
|         void LogWindowLaunched() const; |         void LogConverterInputReceived(CalculatorApp::Common::ViewMode mode) const; | ||||||
|         void LogUserRequestedRefreshFailed() const; |  | ||||||
|         void LogConversionResult(std::wstring_view fromValue, std::wstring_view fromUnit, std::wstring_view toValue, std::wstring_view toUnit) const; |  | ||||||
|         void LogAboutFlyoutOpened() const; |  | ||||||
|         void LogNavBarOpened() const; |         void LogNavBarOpened() const; | ||||||
|         void LogViewClosingTelemetry(int); |  | ||||||
|         void LogCoreWindowWasNull() const; |  | ||||||
|  |  | ||||||
|         // Trace methods for Date Calculator usage |         void LogError(CalculatorApp::Common::ViewMode mode, std::wstring_view functionName, std::wstring_view errorString); | ||||||
|         void LogDateDifferenceModeUsed(int windowId); |         void LogStandardException(CalculatorApp::Common::ViewMode mode, std::wstring_view functionName, _In_ const std::exception& e) const; | ||||||
|         void LogDateAddSubtractModeUsed(int windowId, bool isAddMode); |         void LogWinRTException(CalculatorApp::Common::ViewMode mode, std::wstring_view functionName, _In_ winrt::hresult_error const& e) const; | ||||||
|         void |         void LogPlatformException(CalculatorApp::Common::ViewMode mode, std::wstring_view functionName, _In_ Platform::Exception ^ e) const; | ||||||
|         LogDateClippedTimeDifferenceFound(winrt::Windows::Globalization::Calendar const& today, winrt::Windows::Foundation::DateTime const& clippedTime) const; |  | ||||||
|  |  | ||||||
|         void LogStandardException(std::wstring_view functionName, _In_ const std::exception& e) const; |  | ||||||
|         void LogWinRTException(std::wstring_view functionName, _In_ winrt::hresult_error const& e) const; |  | ||||||
|         void LogPlatformException(std::wstring_view functionName, _In_ Platform::Exception ^ e) const; |  | ||||||
|  |  | ||||||
|     private: |     private: | ||||||
|         // Create an instance of TraceLogger |         // Create an instance of TraceLogger | ||||||
|         TraceLogger(); |         TraceLogger(); | ||||||
|  |  | ||||||
|         // Any new Log method should |         // As mentioned in Microsoft's Privacy Statement(https://privacy.microsoft.com/en-US/privacystatement#maindiagnosticsmodule), | ||||||
|         // a) decide the level of logging. This will help us in limiting recording of events only up to a certain level. See this link for guidance |         // sampling is involved in Microsoft's diagnostic data collection process. | ||||||
|         // https://msdn.microsoft.com/en-us/library/windows/desktop/aa363742(v=vs.85).aspx We're using Verbose level for events that are called frequently and |         // These keywords provide additional input into how frequently an event might be sampled. | ||||||
|         // needed only for debugging or capturing perf for specific scenarios b) should decide whether or not to log to  telemetry and pass |         // The lower the level of the keyword, the higher the possibility that the corresponding event may be sampled. | ||||||
|         // TraceLoggingKeyword(MICROSOFT_KEYWORD_TELEMETRY) accordingly c) Should accept a variable number of additional data arguments if needed |         void LogLevel1Event(std::wstring_view eventName, winrt::Windows::Foundation::Diagnostics::LoggingFields fields) const; | ||||||
|         void LogTelemetryEvent(std::wstring_view eventName, winrt::Windows::Foundation::Diagnostics::LoggingFields fields) const; |         void LogLevel2Event(std::wstring_view eventName, winrt::Windows::Foundation::Diagnostics::LoggingFields fields) const; | ||||||
|         void LogMeasureEvent(std::wstring_view eventName, winrt::Windows::Foundation::Diagnostics::LoggingFields fields) const; |         void LogLevel3Event(std::wstring_view eventName, winrt::Windows::Foundation::Diagnostics::LoggingFields fields) const; | ||||||
|         void LogCriticalDataEvent(std::wstring_view eventName, winrt::Windows::Foundation::Diagnostics::LoggingFields fields) const; |  | ||||||
|         void LogPerformanceEvent(std::wstring_view eventName, winrt::Windows::Foundation::Diagnostics::LoggingFields fields) const; |  | ||||||
|         void LogInfoEvent(std::wstring_view eventName, winrt::Windows::Foundation::Diagnostics::LoggingFields fields) const; |  | ||||||
|  |  | ||||||
|         std::unique_ptr<TraceActivity> CreateTraceActivity(std::wstring_view activityName, winrt::Windows::Foundation::Diagnostics::LoggingFields fields) const; |         std::unique_ptr<TraceActivity> CreateTraceActivity(std::wstring_view activityName, winrt::Windows::Foundation::Diagnostics::LoggingFields fields) const; | ||||||
|  |  | ||||||
|         winrt::Windows::Foundation::Diagnostics::LoggingChannel g_calculatorProvider; |         winrt::Windows::Foundation::Diagnostics::LoggingChannel g_calculatorProvider; | ||||||
|  |  | ||||||
|         bool isSizeChangeLogged = false; |         std::vector<ButtonLog> buttonLog; | ||||||
|         bool isHideIfShownLogged = false; |  | ||||||
|         bool isSizeChangedFirstTime = true; // to track the first size changed event which is fired on the launch of app |  | ||||||
|         bool isAutoConversionBeginLoggedInSession = false; |  | ||||||
|         bool isAutoConversionEndLoggedInSession = false; |  | ||||||
|         bool angleButtonLoggedInSession = false; |  | ||||||
|         bool radixButtonLoggedInSession = false; |  | ||||||
|         bool bitLengthButtonLoggedInSession = false; |  | ||||||
|         GUID sessionGuid; |  | ||||||
|         CalculatorApp::Common::ViewMode currentMode = CalculatorApp::Common::ViewMode::None; |  | ||||||
|         std::vector<FuncLog> funcLog; |  | ||||||
|         int functionCount = 0; |  | ||||||
|         bool isHypButtonLogged = false; |  | ||||||
|         bool isAngleButtonInitialized = false; |  | ||||||
|         unsigned int findIndex[maxFunctionSize] = { 0 }; |  | ||||||
|         bool GetIndex(int& index); |  | ||||||
|         std::wstring GetProgrammerType(int index); |  | ||||||
|         size_t maxWindowCount = 0; |  | ||||||
|         bool isAppLaunchBeginLogged = false; |  | ||||||
|         bool isAppLaunchEndLogged = false; |  | ||||||
|         std::map<int, int> bitLengthButtonUsage; |  | ||||||
|         std::map<int, int> angleButtonUsage; |  | ||||||
|         std::map<int, int> radixButtonUsage; |  | ||||||
|         std::map<int, bool> windowIdLog; |         std::map<int, bool> windowIdLog; | ||||||
|  |  | ||||||
|         // Private variables for Date Calculator usage |         GUID sessionGuid; | ||||||
|         bool m_dateDiffUsageLoggedInSession = false; |         size_t currentWindowCount = 0; | ||||||
|         bool m_dateAddUsageLoggedInSession = false; |  | ||||||
|         bool m_dateSubtractUsageLoggedInSession = false; |  | ||||||
|         std::map<int, int> m_dateAddModeUsage; |  | ||||||
|         std::map<int, int> m_dateSubtractModeUsage; |  | ||||||
|  |  | ||||||
|         size_t windowLaunchCount = 0; |  | ||||||
|  |  | ||||||
|         winrt::Windows::Foundation::Diagnostics::LoggingActivity m_appLaunchActivity; |         winrt::Windows::Foundation::Diagnostics::LoggingActivity m_appLaunchActivity; | ||||||
|     }; |     }; | ||||||
|   | |||||||
| @@ -335,12 +335,12 @@ future<bool> CurrencyDataLoader::TryLoadDataFromCacheAsync() | |||||||
|     } |     } | ||||||
|     catch (Exception ^ ex) |     catch (Exception ^ ex) | ||||||
|     { |     { | ||||||
|         TraceLogger::GetInstance().LogPlatformException(__FUNCTIONW__, ex); |         TraceLogger::GetInstance().LogPlatformException(ViewMode::Currency, __FUNCTIONW__, ex); | ||||||
|         co_return false; |         co_return false; | ||||||
|     } |     } | ||||||
|     catch (const exception& e) |     catch (const exception& e) | ||||||
|     { |     { | ||||||
|         TraceLogger::GetInstance().LogStandardException(__FUNCTIONW__, e); |         TraceLogger::GetInstance().LogStandardException(ViewMode::Currency, __FUNCTIONW__, e); | ||||||
|         co_return false; |         co_return false; | ||||||
|     } |     } | ||||||
|     catch (...) |     catch (...) | ||||||
| @@ -445,12 +445,12 @@ future<bool> CurrencyDataLoader::TryLoadDataFromWebAsync() | |||||||
|     } |     } | ||||||
|     catch (Exception ^ ex) |     catch (Exception ^ ex) | ||||||
|     { |     { | ||||||
|         TraceLogger::GetInstance().LogPlatformException(__FUNCTIONW__, ex); |         TraceLogger::GetInstance().LogPlatformException(ViewMode::Currency, __FUNCTIONW__, ex); | ||||||
|         co_return false; |         co_return false; | ||||||
|     } |     } | ||||||
|     catch (const exception& e) |     catch (const exception& e) | ||||||
|     { |     { | ||||||
|         TraceLogger::GetInstance().LogStandardException(__FUNCTIONW__, e); |         TraceLogger::GetInstance().LogStandardException(ViewMode::Currency, __FUNCTIONW__, e); | ||||||
|         co_return false; |         co_return false; | ||||||
|     } |     } | ||||||
|     catch (...) |     catch (...) | ||||||
| @@ -466,7 +466,7 @@ future<bool> CurrencyDataLoader::TryLoadDataFromWebOverrideAsync() | |||||||
|     if (!didLoad) |     if (!didLoad) | ||||||
|     { |     { | ||||||
|         m_loadStatus = CurrencyLoadStatus::FailedToLoad; |         m_loadStatus = CurrencyLoadStatus::FailedToLoad; | ||||||
|         TraceLogger::GetInstance().LogUserRequestedRefreshFailed(); |         TraceLogger::GetInstance().LogError(ViewMode::Currency, L"CurrencyDataLoader::TryLoadDataFromWebOverrideAsync", L"UserRequestedRefreshFailed"); | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     co_return didLoad; |     co_return didLoad; | ||||||
|   | |||||||
| @@ -88,9 +88,6 @@ DateCalculatorViewModel::DateCalculatorViewModel() | |||||||
|     if (calendar->DayOfWeek != trueDayOfWeek) |     if (calendar->DayOfWeek != trueDayOfWeek) | ||||||
|     { |     { | ||||||
|         calendar->SetDateTime(today); |         calendar->SetDateTime(today); | ||||||
|         TraceLogger::GetInstance().LogDateClippedTimeDifferenceFound( |  | ||||||
|             from_cx<winrt::Windows::Globalization::Calendar>(calendar), |  | ||||||
|             winrt::Windows::Foundation::DateTime{ winrt::Windows::Foundation::TimeSpan{ clippedTime.UniversalTime } }); |  | ||||||
|     } |     } | ||||||
| } | } | ||||||
|  |  | ||||||
|   | |||||||
| @@ -118,6 +118,9 @@ void HistoryViewModel::SetCalculatorDisplay(CalculatorDisplay& calculatorDisplay | |||||||
|  |  | ||||||
| void HistoryViewModel::ShowItem(_In_ HistoryItemViewModel ^ e) | void HistoryViewModel::ShowItem(_In_ HistoryItemViewModel ^ e) | ||||||
| { | { | ||||||
|  |     unsigned int index; | ||||||
|  |     Items->IndexOf(e, &index); | ||||||
|  |     TraceLogger::GetInstance().LogHistoryItemLoad((ViewMode)m_currentMode, ItemSize, (int)(index)); | ||||||
|     HistoryItemClicked(e); |     HistoryItemClicked(e); | ||||||
| } | } | ||||||
|  |  | ||||||
| @@ -149,7 +152,6 @@ void HistoryViewModel::OnHideCommand(_In_ Platform::Object ^ e) | |||||||
|  |  | ||||||
| void HistoryViewModel::OnClearCommand(_In_ Platform::Object ^ e) | void HistoryViewModel::OnClearCommand(_In_ Platform::Object ^ e) | ||||||
| { | { | ||||||
|     TraceLogger::GetInstance().LogClearHistory(); |  | ||||||
|     if (AreHistoryShortcutsEnabled == true) |     if (AreHistoryShortcutsEnabled == true) | ||||||
|     { |     { | ||||||
|         m_calculatorManager->ClearHistory(); |         m_calculatorManager->ClearHistory(); | ||||||
|   | |||||||
| @@ -37,6 +37,7 @@ namespace | |||||||
|     StringReference IsProgrammerPropertyName(L"IsProgrammer"); |     StringReference IsProgrammerPropertyName(L"IsProgrammer"); | ||||||
|     StringReference DisplayValuePropertyName(L"DisplayValue"); |     StringReference DisplayValuePropertyName(L"DisplayValue"); | ||||||
|     StringReference CalculationResultAutomationNamePropertyName(L"CalculationResultAutomationName"); |     StringReference CalculationResultAutomationNamePropertyName(L"CalculationResultAutomationName"); | ||||||
|  |     StringReference IsBitFlipCheckedPropertyName(L"IsBitFlipChecked"); | ||||||
| } | } | ||||||
|  |  | ||||||
| namespace CalculatorResourceKeys | namespace CalculatorResourceKeys | ||||||
| @@ -599,8 +600,6 @@ void StandardCalculatorViewModel::OnButtonPressed(Object ^ parameter) | |||||||
|     NumbersAndOperatorsEnum numOpEnum = CalculatorButtonPressedEventArgs::GetOperationFromCommandParameter(parameter); |     NumbersAndOperatorsEnum numOpEnum = CalculatorButtonPressedEventArgs::GetOperationFromCommandParameter(parameter); | ||||||
|     Command cmdenum = ConvertToOperatorsEnum(numOpEnum); |     Command cmdenum = ConvertToOperatorsEnum(numOpEnum); | ||||||
|  |  | ||||||
|     TraceLogger::GetInstance().UpdateFunctionUsage((int)numOpEnum); |  | ||||||
|  |  | ||||||
|     if (IsInError) |     if (IsInError) | ||||||
|     { |     { | ||||||
|         m_standardCalculatorManager.SendCommand(Command::CommandCLEAR); |         m_standardCalculatorManager.SendCommand(Command::CommandCLEAR); | ||||||
| @@ -668,6 +667,7 @@ void StandardCalculatorViewModel::OnButtonPressed(Object ^ parameter) | |||||||
|                 m_isLastOperationHistoryLoad = false; |                 m_isLastOperationHistoryLoad = false; | ||||||
|             } |             } | ||||||
|  |  | ||||||
|  |             TraceLogger::GetInstance().UpdateButtonUsage(numOpEnum, GetCalculatorMode()); | ||||||
|             m_standardCalculatorManager.SendCommand(cmdenum); |             m_standardCalculatorManager.SendCommand(cmdenum); | ||||||
|         } |         } | ||||||
|     } |     } | ||||||
| @@ -748,7 +748,7 @@ void StandardCalculatorViewModel::OnPasteCommand(Object ^ parameter) | |||||||
|  |  | ||||||
|     // Ensure that the paste happens on the UI thread |     // Ensure that the paste happens on the UI thread | ||||||
|     CopyPasteManager::GetStringToPaste(mode, NavCategory::GetGroupType(mode), NumberBase, bitLengthType) |     CopyPasteManager::GetStringToPaste(mode, NavCategory::GetGroupType(mode), NumberBase, bitLengthType) | ||||||
|         .then([this, mode](String ^ pastedString) { OnPaste(pastedString, mode); }, concurrency::task_continuation_context::use_current()); |         .then([this, mode](String ^ pastedString) { OnPaste(pastedString); }, concurrency::task_continuation_context::use_current()); | ||||||
| } | } | ||||||
|  |  | ||||||
| CalculationManager::Command StandardCalculatorViewModel::ConvertToOperatorsEnum(NumbersAndOperatorsEnum operation) | CalculationManager::Command StandardCalculatorViewModel::ConvertToOperatorsEnum(NumbersAndOperatorsEnum operation) | ||||||
| @@ -756,7 +756,7 @@ CalculationManager::Command StandardCalculatorViewModel::ConvertToOperatorsEnum( | |||||||
|     return safe_cast<Command>(operation); |     return safe_cast<Command>(operation); | ||||||
| } | } | ||||||
|  |  | ||||||
| void StandardCalculatorViewModel::OnPaste(String ^ pastedString, ViewMode mode) | void StandardCalculatorViewModel::OnPaste(String ^ pastedString) | ||||||
| { | { | ||||||
|     // If pastedString is invalid("NoOp") then display pasteError else process the string |     // If pastedString is invalid("NoOp") then display pasteError else process the string | ||||||
|     if (pastedString == StringReference(CopyPasteManager::PasteErrorString)) |     if (pastedString == StringReference(CopyPasteManager::PasteErrorString)) | ||||||
| @@ -765,7 +765,6 @@ void StandardCalculatorViewModel::OnPaste(String ^ pastedString, ViewMode mode) | |||||||
|         return; |         return; | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     TraceLogger::GetInstance().LogValidInputPasted(mode); |  | ||||||
|     bool isFirstLegalChar = true; |     bool isFirstLegalChar = true; | ||||||
|     m_standardCalculatorManager.SendCommand(Command::CommandCENTR); |     m_standardCalculatorManager.SendCommand(Command::CommandCENTR); | ||||||
|     bool sendNegate = false; |     bool sendNegate = false; | ||||||
| @@ -884,7 +883,7 @@ void StandardCalculatorViewModel::OnPaste(String ^ pastedString, ViewMode mode) | |||||||
|         // Handle exponent and exponent sign (...e+... or ...e-... or ...e...) |         // Handle exponent and exponent sign (...e+... or ...e-... or ...e...) | ||||||
|         if (mappedNumOp == NumbersAndOperatorsEnum::Exp) |         if (mappedNumOp == NumbersAndOperatorsEnum::Exp) | ||||||
|         { |         { | ||||||
|             //Check the following item |             // Check the following item | ||||||
|             switch (MapCharacterToButtonId(*(it + 1), canSendNegate)) |             switch (MapCharacterToButtonId(*(it + 1), canSendNegate)) | ||||||
|             { |             { | ||||||
|             case NumbersAndOperatorsEnum::Subtract: |             case NumbersAndOperatorsEnum::Subtract: | ||||||
| @@ -896,7 +895,7 @@ void StandardCalculatorViewModel::OnPaste(String ^ pastedString, ViewMode mode) | |||||||
|             break; |             break; | ||||||
|             case NumbersAndOperatorsEnum::Add: |             case NumbersAndOperatorsEnum::Add: | ||||||
|             { |             { | ||||||
|                 //Nothing to do, skip to the next item |                 // Nothing to do, skip to the next item | ||||||
|                 ++it; |                 ++it; | ||||||
|             } |             } | ||||||
|             break; |             break; | ||||||
| @@ -911,8 +910,7 @@ void StandardCalculatorViewModel::OnClearMemoryCommand(Object ^ parameter) | |||||||
| { | { | ||||||
|     m_standardCalculatorManager.MemorizedNumberClearAll(); |     m_standardCalculatorManager.MemorizedNumberClearAll(); | ||||||
|  |  | ||||||
|     int windowId = Utils::GetWindowId(); |     TraceLogger::GetInstance().UpdateButtonUsage(NumbersAndOperatorsEnum::MemoryClear, GetCalculatorMode()); | ||||||
|     TraceLogger::GetInstance().LogMemoryClearAll(windowId); |  | ||||||
|  |  | ||||||
|     String ^ announcement = LocalizationStringUtil::GetLocalizedNarratorAnnouncement(CalculatorResourceKeys::MemoryCleared, m_localizedMemoryCleared); |     String ^ announcement = LocalizationStringUtil::GetLocalizedNarratorAnnouncement(CalculatorResourceKeys::MemoryCleared, m_localizedMemoryCleared); | ||||||
|     Announcement = CalculatorAnnouncement::GetMemoryClearedAnnouncement(announcement); |     Announcement = CalculatorAnnouncement::GetMemoryClearedAnnouncement(announcement); | ||||||
| @@ -1046,8 +1044,7 @@ void StandardCalculatorViewModel::OnMemoryButtonPressed() | |||||||
| { | { | ||||||
|     m_standardCalculatorManager.MemorizeNumber(); |     m_standardCalculatorManager.MemorizeNumber(); | ||||||
|  |  | ||||||
|     int windowId = Utils::GetWindowId(); |     TraceLogger::GetInstance().UpdateButtonUsage(NumbersAndOperatorsEnum::Memory, GetCalculatorMode()); | ||||||
|     TraceLogger::GetInstance().InsertIntoMemoryMap(windowId, IsStandard, IsScientific, IsProgrammer); |  | ||||||
|  |  | ||||||
|     String ^ announcement = LocalizationStringUtil::GetLocalizedNarratorAnnouncement( |     String ^ announcement = LocalizationStringUtil::GetLocalizedNarratorAnnouncement( | ||||||
|         CalculatorResourceKeys::MemorySave, m_localizedMemorySavedAutomationFormat, m_DisplayValue->Data()); |         CalculatorResourceKeys::MemorySave, m_localizedMemorySavedAutomationFormat, m_DisplayValue->Data()); | ||||||
| @@ -1079,49 +1076,31 @@ void StandardCalculatorViewModel::OnMemoryItemPressed(Object ^ memoryItemPositio | |||||||
|         auto boxedPosition = safe_cast<Box<int> ^>(memoryItemPosition); |         auto boxedPosition = safe_cast<Box<int> ^>(memoryItemPosition); | ||||||
|         m_standardCalculatorManager.MemorizedNumberLoad(boxedPosition->Value); |         m_standardCalculatorManager.MemorizedNumberLoad(boxedPosition->Value); | ||||||
|         HideMemoryClicked(); |         HideMemoryClicked(); | ||||||
|         int windowId = Utils::GetWindowId(); |  | ||||||
|         TraceLogger::GetInstance().LogMemoryUsed(windowId, boxedPosition->Value, IsStandard, IsScientific, IsProgrammer, MemorizedNumbers->Size); |         auto mode = IsStandard ? ViewMode::Standard : IsScientific ? ViewMode::Scientific : ViewMode::Programmer; | ||||||
|  |         TraceLogger::GetInstance().LogMemoryItemLoad(mode, MemorizedNumbers->Size, boxedPosition->Value); | ||||||
|     } |     } | ||||||
| } | } | ||||||
|  |  | ||||||
| void StandardCalculatorViewModel::OnMemoryAdd(Object ^ memoryItemPosition) | void StandardCalculatorViewModel::OnMemoryAdd(Object ^ memoryItemPosition) | ||||||
| { | { | ||||||
|     // M+ will add display to memorylist if memory list is empty. |     // M+ will add display to memorylist if memory list is empty. | ||||||
|     int windowId = Utils::GetWindowId(); |  | ||||||
|  |  | ||||||
|     if (MemorizedNumbers) |     if (MemorizedNumbers) | ||||||
|     { |     { | ||||||
|         auto boxedPosition = safe_cast<Box<int> ^>(memoryItemPosition); |         auto boxedPosition = safe_cast<Box<int> ^>(memoryItemPosition); | ||||||
|         if (MemorizedNumbers->Size > 0) |         TraceLogger::GetInstance().UpdateButtonUsage(NumbersAndOperatorsEnum::MemoryAdd, GetCalculatorMode()); | ||||||
|         { |  | ||||||
|             TraceLogger::GetInstance().LogMemoryUsed(windowId, boxedPosition->Value, IsStandard, IsScientific, IsProgrammer, MemorizedNumbers->Size); |  | ||||||
|             TraceLogger::GetInstance().UpdateMemoryMap(windowId, boxedPosition->Value, IsStandard, IsScientific, IsProgrammer); |  | ||||||
|         } |  | ||||||
|         else |  | ||||||
|         { |  | ||||||
|             TraceLogger::GetInstance().InsertIntoMemoryMap(windowId, IsStandard, IsScientific, IsProgrammer); |  | ||||||
|         } |  | ||||||
|         m_standardCalculatorManager.MemorizedNumberAdd(boxedPosition->Value); |         m_standardCalculatorManager.MemorizedNumberAdd(boxedPosition->Value); | ||||||
|     } |     } | ||||||
| } | } | ||||||
|  |  | ||||||
| void StandardCalculatorViewModel::OnMemorySubtract(Object ^ memoryItemPosition) | void StandardCalculatorViewModel::OnMemorySubtract(Object ^ memoryItemPosition) | ||||||
| { | { | ||||||
|     int windowId = Utils::GetWindowId(); |  | ||||||
|  |  | ||||||
|     // M- will add negative of displayed number to memorylist if memory list is empty. |     // M- will add negative of displayed number to memorylist if memory list is empty. | ||||||
|     if (MemorizedNumbers) |     if (MemorizedNumbers) | ||||||
|     { |     { | ||||||
|         auto boxedPosition = safe_cast<Box<int> ^>(memoryItemPosition); |         auto boxedPosition = safe_cast<Box<int> ^>(memoryItemPosition); | ||||||
|         if (MemorizedNumbers->Size > 0) |         TraceLogger::GetInstance().UpdateButtonUsage(NumbersAndOperatorsEnum::MemorySubtract, GetCalculatorMode()); | ||||||
|         { |  | ||||||
|             TraceLogger::GetInstance().LogMemoryUsed(windowId, boxedPosition->Value, IsStandard, IsScientific, IsProgrammer, MemorizedNumbers->Size); |  | ||||||
|             TraceLogger::GetInstance().UpdateMemoryMap(windowId, boxedPosition->Value, IsStandard, IsScientific, IsProgrammer); |  | ||||||
|         } |  | ||||||
|         else |  | ||||||
|         { |  | ||||||
|             TraceLogger::GetInstance().InsertIntoMemoryMap(windowId, IsStandard, IsScientific, IsProgrammer); |  | ||||||
|         } |  | ||||||
|         m_standardCalculatorManager.MemorizedNumberSubtract(boxedPosition->Value); |         m_standardCalculatorManager.MemorizedNumberSubtract(boxedPosition->Value); | ||||||
|     } |     } | ||||||
| } | } | ||||||
| @@ -1130,7 +1109,6 @@ void StandardCalculatorViewModel::OnMemoryClear(_In_ Object ^ memoryItemPosition | |||||||
| { | { | ||||||
|     if (MemorizedNumbers && MemorizedNumbers->Size > 0) |     if (MemorizedNumbers && MemorizedNumbers->Size > 0) | ||||||
|     { |     { | ||||||
|         int windowId = Utils::GetWindowId(); |  | ||||||
|         auto boxedPosition = safe_cast<Box<int> ^>(memoryItemPosition); |         auto boxedPosition = safe_cast<Box<int> ^>(memoryItemPosition); | ||||||
|  |  | ||||||
|         if (boxedPosition->Value >= 0) |         if (boxedPosition->Value >= 0) | ||||||
| @@ -1148,9 +1126,7 @@ void StandardCalculatorViewModel::OnMemoryClear(_In_ Object ^ memoryItemPosition | |||||||
|             { |             { | ||||||
|                 IsMemoryEmpty = true; |                 IsMemoryEmpty = true; | ||||||
|             } |             } | ||||||
|  |             TraceLogger::GetInstance().UpdateButtonUsage(NumbersAndOperatorsEnum::MemoryClear, GetCalculatorMode()); | ||||||
|             TraceLogger::GetInstance().LogMemoryUsed(windowId, boxedPosition->Value, IsStandard, IsScientific, IsProgrammer, MemorizedNumbers->Size); |  | ||||||
|             TraceLogger::GetInstance().DeleteFromMemoryMap(windowId, boxedPosition->Value); |  | ||||||
|  |  | ||||||
|             wstring localizedIndex = to_wstring(boxedPosition->Value + 1); |             wstring localizedIndex = to_wstring(boxedPosition->Value + 1); | ||||||
|             LocalizationSettings::GetInstance().LocalizeDisplayValue(&localizedIndex); |             LocalizationSettings::GetInstance().LocalizeDisplayValue(&localizedIndex); | ||||||
| @@ -1191,6 +1167,11 @@ void StandardCalculatorViewModel::OnPropertyChanged(String ^ propertyname) | |||||||
|         RaisePropertyChanged(CalculationResultAutomationNamePropertyName); |         RaisePropertyChanged(CalculationResultAutomationNamePropertyName); | ||||||
|         Announcement = GetDisplayUpdatedNarratorAnnouncement(); |         Announcement = GetDisplayUpdatedNarratorAnnouncement(); | ||||||
|     } |     } | ||||||
|  |     else if (propertyname == IsBitFlipCheckedPropertyName) | ||||||
|  |     { | ||||||
|  |         TraceLogger::GetInstance().UpdateButtonUsage( | ||||||
|  |             IsBitFlipChecked ? NumbersAndOperatorsEnum::BitflipButton : NumbersAndOperatorsEnum::FullKeypadButton, ViewMode::Programmer); | ||||||
|  |     } | ||||||
| } | } | ||||||
|  |  | ||||||
| void StandardCalculatorViewModel::SetCalculatorType(ViewMode targetState) | void StandardCalculatorViewModel::SetCalculatorType(ViewMode targetState) | ||||||
| @@ -1223,7 +1204,7 @@ void StandardCalculatorViewModel::SetCalculatorType(ViewMode targetState) | |||||||
|     } |     } | ||||||
| } | } | ||||||
|  |  | ||||||
| String^ StandardCalculatorViewModel::GetRawDisplayValue() | String ^ StandardCalculatorViewModel::GetRawDisplayValue() | ||||||
| { | { | ||||||
|     if (IsInError) |     if (IsInError) | ||||||
|     { |     { | ||||||
| @@ -1884,3 +1865,16 @@ NarratorAnnouncement ^ StandardCalculatorViewModel::GetDisplayUpdatedNarratorAnn | |||||||
|  |  | ||||||
|     return CalculatorAnnouncement::GetDisplayUpdatedAnnouncement(announcement); |     return CalculatorAnnouncement::GetDisplayUpdatedAnnouncement(announcement); | ||||||
| } | } | ||||||
|  |  | ||||||
|  | ViewMode StandardCalculatorViewModel::GetCalculatorMode() | ||||||
|  | { | ||||||
|  |     if (IsStandard) | ||||||
|  |     { | ||||||
|  |         return ViewMode::Standard; | ||||||
|  |     } | ||||||
|  |     else if (IsScientific) | ||||||
|  |     { | ||||||
|  |         return ViewMode::Scientific; | ||||||
|  |     } | ||||||
|  |     return ViewMode::Programmer; | ||||||
|  | } | ||||||
|   | |||||||
| @@ -317,7 +317,7 @@ namespace CalculatorApp | |||||||
|                 } |                 } | ||||||
|             } |             } | ||||||
|  |  | ||||||
|             internal : void OnPaste(Platform::String ^ pastedString, CalculatorApp::Common::ViewMode mode); |             internal : void OnPaste(Platform::String ^ pastedString); | ||||||
|             void OnCopyCommand(Platform::Object ^ parameter); |             void OnCopyCommand(Platform::Object ^ parameter); | ||||||
|             void OnPasteCommand(Platform::Object ^ parameter); |             void OnPasteCommand(Platform::Object ^ parameter); | ||||||
|  |  | ||||||
| @@ -348,7 +348,6 @@ namespace CalculatorApp | |||||||
|             void OnBinaryOperatorReceived(); |             void OnBinaryOperatorReceived(); | ||||||
|             void OnMemoryItemChanged(unsigned int indexOfMemory); |             void OnMemoryItemChanged(unsigned int indexOfMemory); | ||||||
|  |  | ||||||
|  |  | ||||||
|             Platform::String ^ GetLocalizedStringFormat(Platform::String ^ format, Platform::String ^ displayValue); |             Platform::String ^ GetLocalizedStringFormat(Platform::String ^ format, Platform::String ^ displayValue); | ||||||
|             void OnPropertyChanged(Platform::String ^ propertyname); |             void OnPropertyChanged(Platform::String ^ propertyname); | ||||||
|             void SetCalculatorType(CalculatorApp::Common::ViewMode targetState); |             void SetCalculatorType(CalculatorApp::Common::ViewMode targetState); | ||||||
| @@ -451,6 +450,8 @@ namespace CalculatorApp | |||||||
|             bool IsViewPinned(); |             bool IsViewPinned(); | ||||||
|             void SetViewPinnedState(bool pinned); |             void SetViewPinnedState(bool pinned); | ||||||
|  |  | ||||||
|  |             CalculatorApp::Common::ViewMode GetCalculatorMode(); | ||||||
|  |  | ||||||
|             friend class CalculatorDisplay; |             friend class CalculatorDisplay; | ||||||
|             friend class CalculatorFunctionalTests::HistoryTests; |             friend class CalculatorFunctionalTests::HistoryTests; | ||||||
|             friend class CalculatorUnitTests::MultiWindowUnitTests; |             friend class CalculatorUnitTests::MultiWindowUnitTests; | ||||||
|   | |||||||
| @@ -502,6 +502,8 @@ void UnitConverterViewModel::OnButtonPressed(Platform::Object ^ parameter) | |||||||
|     } |     } | ||||||
|  |  | ||||||
|     m_model->SendCommand(command); |     m_model->SendCommand(command); | ||||||
|  |  | ||||||
|  |     TraceLogger::GetInstance().LogConverterInputReceived(Mode); | ||||||
| } | } | ||||||
|  |  | ||||||
| void UnitConverterViewModel::OnCopyCommand(Platform::Object ^ parameter) | void UnitConverterViewModel::OnCopyCommand(Platform::Object ^ parameter) | ||||||
| @@ -523,7 +525,7 @@ void UnitConverterViewModel::OnPasteCommand(Platform::Object ^ parameter) | |||||||
|     // EventWriteClipboardPaste_Start(); |     // EventWriteClipboardPaste_Start(); | ||||||
|     // Any converter ViewMode is fine here. |     // Any converter ViewMode is fine here. | ||||||
|     CopyPasteManager::GetStringToPaste(m_Mode, NavCategory::GetGroupType(m_Mode)) |     CopyPasteManager::GetStringToPaste(m_Mode, NavCategory::GetGroupType(m_Mode)) | ||||||
|         .then([this](String ^ pastedString) { OnPaste(pastedString, m_Mode); }, concurrency::task_continuation_context::use_current()); |         .then([this](String ^ pastedString) { OnPaste(pastedString); }, concurrency::task_continuation_context::use_current()); | ||||||
| } | } | ||||||
|  |  | ||||||
| void UnitConverterViewModel::InitializeView() | void UnitConverterViewModel::InitializeView() | ||||||
| @@ -882,7 +884,7 @@ NumbersAndOperatorsEnum UnitConverterViewModel::MapCharacterToButtonId(const wch | |||||||
|     return mappedValue; |     return mappedValue; | ||||||
| } | } | ||||||
|  |  | ||||||
| void UnitConverterViewModel::OnPaste(String ^ stringToPaste, ViewMode mode) | void UnitConverterViewModel::OnPaste(String ^ stringToPaste) | ||||||
| { | { | ||||||
|     // If pastedString is invalid("NoOp") then display pasteError else process the string |     // If pastedString is invalid("NoOp") then display pasteError else process the string | ||||||
|     if (stringToPaste == StringReference(CopyPasteManager::PasteErrorString)) |     if (stringToPaste == StringReference(CopyPasteManager::PasteErrorString)) | ||||||
| @@ -891,7 +893,6 @@ void UnitConverterViewModel::OnPaste(String ^ stringToPaste, ViewMode mode) | |||||||
|         return; |         return; | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     TraceLogger::GetInstance().LogValidInputPasted(mode); |  | ||||||
|     bool isFirstLegalChar = true; |     bool isFirstLegalChar = true; | ||||||
|     bool sendNegate = false; |     bool sendNegate = false; | ||||||
|     wstring accumulation = L""; |     wstring accumulation = L""; | ||||||
| @@ -1014,7 +1015,6 @@ void UnitConverterViewModel::StartConversionResultTimer() | |||||||
|         { |         { | ||||||
|             String ^ valueFrom = m_Value1Active ? m_Value1 : m_Value2; |             String ^ valueFrom = m_Value1Active ? m_Value1 : m_Value2; | ||||||
|             String ^ valueTo = m_Value1Active ? m_Value2 : m_Value1; |             String ^ valueTo = m_Value1Active ? m_Value2 : m_Value1; | ||||||
|             TraceLogger::GetInstance().LogConversionResult(valueFrom->Data(), UnitFrom->ToString()->Data(), valueTo->Data(), UnitTo->ToString()->Data()); |  | ||||||
|         } |         } | ||||||
|     }); |     }); | ||||||
| } | } | ||||||
|   | |||||||
| @@ -204,7 +204,7 @@ namespace CalculatorApp | |||||||
|             NumbersAndOperatorsEnum MapCharacterToButtonId(const wchar_t ch, bool& canSendNegate); |             NumbersAndOperatorsEnum MapCharacterToButtonId(const wchar_t ch, bool& canSendNegate); | ||||||
|             void DisplayPasteError(); |             void DisplayPasteError(); | ||||||
|             void OnValueActivated(IActivatable ^ control); |             void OnValueActivated(IActivatable ^ control); | ||||||
|             void OnPaste(Platform::String ^ stringToPaste, CalculatorApp::Common::ViewMode mode); |             void OnPaste(Platform::String ^ stringToPaste); | ||||||
|  |  | ||||||
|             void OnCopyCommand(Platform::Object ^ parameter); |             void OnCopyCommand(Platform::Object ^ parameter); | ||||||
|             void OnPasteCommand(Platform::Object ^ parameter); |             void OnPasteCommand(Platform::Object ^ parameter); | ||||||
|   | |||||||
| @@ -4,7 +4,6 @@ | |||||||
|              xmlns:d="http://schemas.microsoft.com/expression/blend/2008" |              xmlns:d="http://schemas.microsoft.com/expression/blend/2008" | ||||||
|              xmlns:local="using:CalculatorApp.Common" |              xmlns:local="using:CalculatorApp.Common" | ||||||
|              xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" |              xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" | ||||||
|              Loaded="UserControl_Loaded" |  | ||||||
|              mc:Ignorable="d"> |              mc:Ignorable="d"> | ||||||
|     <UserControl.Transitions> |     <UserControl.Transitions> | ||||||
|         <TransitionCollection> |         <TransitionCollection> | ||||||
|   | |||||||
| @@ -61,8 +61,3 @@ void AboutFlyout::SetDefaultFocus() | |||||||
| { | { | ||||||
|     AboutFlyoutEULA->Focus(::FocusState::Programmatic); |     AboutFlyoutEULA->Focus(::FocusState::Programmatic); | ||||||
| } | } | ||||||
|  |  | ||||||
| void CalculatorApp::AboutFlyout::UserControl_Loaded(Platform::Object ^ sender, Windows::UI::Xaml::RoutedEventArgs ^ e) |  | ||||||
| { |  | ||||||
|     TraceLogger::GetInstance().LogAboutFlyoutOpened(); |  | ||||||
| } |  | ||||||
|   | |||||||
| @@ -1,4 +1,4 @@ | |||||||
| // Copyright (c) Microsoft Corporation. All rights reserved. | // Copyright (c) Microsoft Corporation. All rights reserved. | ||||||
| // Licensed under the MIT License. | // Licensed under the MIT License. | ||||||
|  |  | ||||||
| #pragma once | #pragma once | ||||||
| @@ -18,6 +18,5 @@ public | |||||||
|     private: |     private: | ||||||
|         void FeedbackButton_Click(_In_ Platform::Object ^ sender, _In_ Windows::UI::Xaml::RoutedEventArgs ^ e); |         void FeedbackButton_Click(_In_ Platform::Object ^ sender, _In_ Windows::UI::Xaml::RoutedEventArgs ^ e); | ||||||
|         void SetVersionString(); |         void SetVersionString(); | ||||||
|         void UserControl_Loaded(Platform::Object ^ sender, Windows::UI::Xaml::RoutedEventArgs ^ e); |  | ||||||
|     }; |     }; | ||||||
| } /* namespace CalculatorApp */ | } /* namespace CalculatorApp */ | ||||||
|   | |||||||
| @@ -60,7 +60,6 @@ namespace CalculatorApp | |||||||
| /// </summary> | /// </summary> | ||||||
| App::App() | App::App() | ||||||
| { | { | ||||||
|     TraceLogger::GetInstance().LogAppLaunchStart(); |  | ||||||
|     InitializeComponent(); |     InitializeComponent(); | ||||||
|  |  | ||||||
|     m_preLaunched = false; |     m_preLaunched = false; | ||||||
| @@ -71,6 +70,8 @@ App::App() | |||||||
|     // Currently this is bugged so the property is only respected from code-behind. |     // Currently this is bugged so the property is only respected from code-behind. | ||||||
|     this->HighContrastAdjustment = ApplicationHighContrastAdjustment::None; |     this->HighContrastAdjustment = ApplicationHighContrastAdjustment::None; | ||||||
|  |  | ||||||
|  |     this->Suspending += ref new SuspendingEventHandler(this, &App::OnSuspending); | ||||||
|  |  | ||||||
| #if _DEBUG | #if _DEBUG | ||||||
|     this->DebugSettings->IsBindingTracingEnabled = true; |     this->DebugSettings->IsBindingTracingEnabled = true; | ||||||
|     this->DebugSettings->BindingFailed += ref new BindingFailedEventHandler([](_In_ Object ^ /*sender*/, _In_ BindingFailedEventArgs ^ e) { |     this->DebugSettings->BindingFailed += ref new BindingFailedEventHandler([](_In_ Object ^ /*sender*/, _In_ BindingFailedEventArgs ^ e) { | ||||||
| @@ -219,21 +220,16 @@ Frame ^ App::CreateFrame() | |||||||
| /// <param name="e">Details about the launch request and process.</param> | /// <param name="e">Details about the launch request and process.</param> | ||||||
| void App::OnLaunched(LaunchActivatedEventArgs ^ args) | void App::OnLaunched(LaunchActivatedEventArgs ^ args) | ||||||
| { | { | ||||||
|     TraceLogger::GetInstance().LogWindowLaunched(); |  | ||||||
|     if (args->PrelaunchActivated) |     if (args->PrelaunchActivated) | ||||||
|     { |     { | ||||||
|         // If the app got pre-launch activated, then save that state in a flag |         // If the app got pre-launch activated, then save that state in a flag | ||||||
|         m_preLaunched = true; |         m_preLaunched = true; | ||||||
|         TraceLogger::GetInstance().LogAppPrelaunchedBySystem(); |  | ||||||
|     } |     } | ||||||
|     OnAppLaunch(args, args->Arguments); |     OnAppLaunch(args, args->Arguments); | ||||||
| } | } | ||||||
|  |  | ||||||
| void App::OnAppLaunch(IActivatedEventArgs ^ args, String ^ argument) | void App::OnAppLaunch(IActivatedEventArgs ^ args, String ^ argument) | ||||||
| { | { | ||||||
|     auto previousExecutionState = args->PreviousExecutionState; |  | ||||||
|  |  | ||||||
|     TraceLogger::GetInstance().LogOnAppLaunch(previousExecutionState.ToString()->Data()); |  | ||||||
|  |  | ||||||
|     // Uncomment the following lines to display frame-rate and per-frame CPU usage info. |     // Uncomment the following lines to display frame-rate and per-frame CPU usage info. | ||||||
|     //#if _DEBUG |     //#if _DEBUG | ||||||
| @@ -307,7 +303,6 @@ void App::OnAppLaunch(IActivatedEventArgs ^ args, String ^ argument) | |||||||
|     else |     else | ||||||
|     { |     { | ||||||
|         // For first launch, LaunchStart is logged in constructor, this is for subsequent launches. |         // For first launch, LaunchStart is logged in constructor, this is for subsequent launches. | ||||||
|         TraceLogger::GetInstance().LogAppLaunchStart(); |  | ||||||
|  |  | ||||||
|         // !Phone check is required because even in continuum mode user interaction mode is Mouse not Touch |         // !Phone check is required because even in continuum mode user interaction mode is Mouse not Touch | ||||||
|         if ((UIViewSettings::GetForCurrentView()->UserInteractionMode == UserInteractionMode::Mouse) |         if ((UIViewSettings::GetForCurrentView()->UserInteractionMode == UserInteractionMode::Mouse) | ||||||
| @@ -319,7 +314,6 @@ void App::OnAppLaunch(IActivatedEventArgs ^ args, String ^ argument) | |||||||
|                 auto newCoreAppView = CoreApplication::CreateNewView(); |                 auto newCoreAppView = CoreApplication::CreateNewView(); | ||||||
|                 newCoreAppView->Dispatcher->RunAsync( |                 newCoreAppView->Dispatcher->RunAsync( | ||||||
|                     CoreDispatcherPriority::Normal, ref new DispatchedHandler([args, argument, minWindowSize, weak]() { |                     CoreDispatcherPriority::Normal, ref new DispatchedHandler([args, argument, minWindowSize, weak]() { | ||||||
|                         TraceLogger::GetInstance().LogNewWindowCreationBegin(ApplicationView::GetApplicationViewIdForWindow(CoreWindow::GetForCurrentThread())); |  | ||||||
|                         auto that = weak.Resolve<App>(); |                         auto that = weak.Resolve<App>(); | ||||||
|                         if (that != nullptr) |                         if (that != nullptr) | ||||||
|                         { |                         { | ||||||
| @@ -372,13 +366,10 @@ void App::OnAppLaunch(IActivatedEventArgs ^ args, String ^ argument) | |||||||
|                                 } |                                 } | ||||||
|                             } |                             } | ||||||
|                         } |                         } | ||||||
|                         TraceLogger::GetInstance().LogNewWindowCreationEnd(ApplicationView::GetApplicationViewIdForWindow(CoreWindow::GetForCurrentThread())); |  | ||||||
|                     })); |                     })); | ||||||
|             } |             } | ||||||
|             else |             else | ||||||
|             { |             { | ||||||
|                 TraceLogger::GetInstance().LogNewWindowCreationBegin(ApplicationView::GetApplicationViewIdForWindow(CoreWindow::GetForCurrentThread())); |  | ||||||
|  |  | ||||||
|                 ActivationViewSwitcher ^ activationViewSwitcher; |                 ActivationViewSwitcher ^ activationViewSwitcher; | ||||||
|                 auto activateEventArgs = dynamic_cast<IViewSwitcherProvider ^>(args); |                 auto activateEventArgs = dynamic_cast<IViewSwitcherProvider ^>(args); | ||||||
|                 if (activateEventArgs != nullptr) |                 if (activateEventArgs != nullptr) | ||||||
| @@ -390,12 +381,10 @@ void App::OnAppLaunch(IActivatedEventArgs ^ args, String ^ argument) | |||||||
|                 { |                 { | ||||||
|                     activationViewSwitcher->ShowAsStandaloneAsync( |                     activationViewSwitcher->ShowAsStandaloneAsync( | ||||||
|                         ApplicationView::GetApplicationViewIdForWindow(CoreWindow::GetForCurrentThread()), ViewSizePreference::Default); |                         ApplicationView::GetApplicationViewIdForWindow(CoreWindow::GetForCurrentThread()), ViewSizePreference::Default); | ||||||
|                     TraceLogger::GetInstance().LogNewWindowCreationEnd(ApplicationView::GetApplicationViewIdForWindow(CoreWindow::GetForCurrentThread())); |  | ||||||
|                     TraceLogger::GetInstance().LogPrelaunchedAppActivatedByUser(); |  | ||||||
|                 } |                 } | ||||||
|                 else |                 else | ||||||
|                 { |                 { | ||||||
|                     TraceLogger::GetInstance().LogError(L"Null_ActivationViewSwitcher"); |                     TraceLogger::GetInstance().LogError(ViewMode::None, L"App::OnAppLaunch", L"Null_ActivationViewSwitcher"); | ||||||
|                 } |                 } | ||||||
|             } |             } | ||||||
|             // Set the preLaunched flag to false |             // Set the preLaunched flag to false | ||||||
| @@ -460,13 +449,17 @@ void App::OnActivated(IActivatedEventArgs ^ args) | |||||||
| { | { | ||||||
|     if (args->Kind == ActivationKind::Protocol) |     if (args->Kind == ActivationKind::Protocol) | ||||||
|     { |     { | ||||||
|         TraceLogger::GetInstance().LogWindowActivated(); |  | ||||||
|         // We currently don't pass the uri as an argument, |         // We currently don't pass the uri as an argument, | ||||||
|         // and handle any protocol launch as a normal app launch. |         // and handle any protocol launch as a normal app launch. | ||||||
|         OnAppLaunch(args, nullptr); |         OnAppLaunch(args, nullptr); | ||||||
|     } |     } | ||||||
| } | } | ||||||
|  |  | ||||||
|  | void CalculatorApp::App::OnSuspending(Object ^ sender, SuspendingEventArgs ^ args) | ||||||
|  | { | ||||||
|  |     TraceLogger::GetInstance().LogButtonUsage(); | ||||||
|  | } | ||||||
|  |  | ||||||
| void App::DismissedEventHandler(SplashScreen ^ sender, Object ^ e) | void App::DismissedEventHandler(SplashScreen ^ sender, Object ^ e) | ||||||
| { | { | ||||||
|     SetupJumpList(); |     SetupJumpList(); | ||||||
| @@ -477,3 +470,5 @@ float App::GetAppWindowHeight() | |||||||
|     CoreWindow ^ window = CoreWindow::GetForCurrentThread(); |     CoreWindow ^ window = CoreWindow::GetForCurrentThread(); | ||||||
|     return window->Bounds.Height; |     return window->Bounds.Height; | ||||||
| } | } | ||||||
|  |  | ||||||
|  |  | ||||||
|   | |||||||
| @@ -1,4 +1,4 @@ | |||||||
| // Copyright (c) Microsoft Corporation. All rights reserved. | // Copyright (c) Microsoft Corporation. All rights reserved. | ||||||
| // Licensed under the MIT License. | // Licensed under the MIT License. | ||||||
|  |  | ||||||
| // | // | ||||||
| @@ -42,6 +42,8 @@ namespace CalculatorApp | |||||||
|         void OnAppLaunch(Windows::ApplicationModel::Activation::IActivatedEventArgs ^ args, Platform::String ^ argument); |         void OnAppLaunch(Windows::ApplicationModel::Activation::IActivatedEventArgs ^ args, Platform::String ^ argument); | ||||||
|         void DismissedEventHandler(Windows::ApplicationModel::Activation::SplashScreen ^ sender, Platform::Object ^ e); |         void DismissedEventHandler(Windows::ApplicationModel::Activation::SplashScreen ^ sender, Platform::Object ^ e); | ||||||
|         void RegisterDependencyProperties(); |         void RegisterDependencyProperties(); | ||||||
|  |         void OnSuspending(Platform::Object ^ sender, Windows::ApplicationModel::SuspendingEventArgs ^ args); | ||||||
|  |  | ||||||
|  |  | ||||||
|         class SafeFrameWindowCreation final |         class SafeFrameWindowCreation final | ||||||
|         { |         { | ||||||
|   | |||||||
| @@ -216,7 +216,7 @@ | |||||||
|   </ItemDefinitionGroup> |   </ItemDefinitionGroup> | ||||||
|   <ItemDefinitionGroup Condition="'$(IsStoreBuild)' == 'True'"> |   <ItemDefinitionGroup Condition="'$(IsStoreBuild)' == 'True'"> | ||||||
|     <ClCompile> |     <ClCompile> | ||||||
|       <AdditionalOptions>/DSEND_TELEMETRY %(AdditionalOptions)</AdditionalOptions> |       <AdditionalOptions>/DSEND_DIAGNOSTICS %(AdditionalOptions)</AdditionalOptions> | ||||||
|     </ClCompile> |     </ClCompile> | ||||||
|   </ItemDefinitionGroup> |   </ItemDefinitionGroup> | ||||||
|   <PropertyGroup> |   <PropertyGroup> | ||||||
|   | |||||||
| @@ -15,18 +15,18 @@ using namespace winrt::Windows::UI::ViewManagement; | |||||||
|  |  | ||||||
| namespace CalculatorApp | namespace CalculatorApp | ||||||
| { | { | ||||||
| #ifdef SEND_TELEMETRY | #ifdef SEND_DIAGNOSTICS | ||||||
|     // c.f. WINEVENT_KEYWORD_RESERVED_63-56 0xFF00000000000000 // Bits 63-56 - channel keywords |     // c.f. WINEVENT_KEYWORD_RESERVED_63-56 0xFF00000000000000 // Bits 63-56 - channel keywords | ||||||
|     // c.f. WINEVENT_KEYWORD_*              0x00FF000000000000 // Bits 55-48 - system-reserved keywords |     // c.f. WINEVENT_KEYWORD_*              0x00FF000000000000 // Bits 55-48 - system-reserved keywords | ||||||
|     constexpr int64_t MICROSOFT_KEYWORD_CRITICAL_DATA = 0x0000800000000000; // Bit 47 |     constexpr int64_t MICROSOFT_KEYWORD_LEVEL_1 = 0x0000800000000000; // Bit 47 | ||||||
|     constexpr int64_t MICROSOFT_KEYWORD_MEASURES = 0x0000400000000000;      // Bit 46 |     constexpr int64_t MICROSOFT_KEYWORD_LEVEL_2 = 0x0000400000000000;      // Bit 46 | ||||||
|     constexpr int64_t MICROSOFT_KEYWORD_TELEMETRY = 0x0000200000000000;     // Bit 45 |     constexpr int64_t MICROSOFT_KEYWORD_LEVEL_3 = 0x0000200000000000;     // Bit 45 | ||||||
|     constexpr int64_t MICROSOFT_KEYWORD_RESERVED_44 = 0x0000100000000000;   // Bit 44 (reserved for future assignment) |     constexpr int64_t MICROSOFT_KEYWORD_RESERVED_44 = 0x0000100000000000;   // Bit 44 (reserved for future assignment) | ||||||
| #else | #else | ||||||
|     // define all Keyword options as 0 when we do not want to upload app telemetry |     // define all Keyword options as 0 when we do not want to upload app diagnostics | ||||||
|     constexpr int64_t MICROSOFT_KEYWORD_CRITICAL_DATA = 0; |     constexpr int64_t MICROSOFT_KEYWORD_LEVEL_1 = 0; | ||||||
|     constexpr int64_t MICROSOFT_KEYWORD_MEASURES = 0; |     constexpr int64_t MICROSOFT_KEYWORD_LEVEL_2 = 0; | ||||||
|     constexpr int64_t MICROSOFT_KEYWORD_TELEMETRY = 0; |     constexpr int64_t MICROSOFT_KEYWORD_LEVEL_3 = 0; | ||||||
|     constexpr int64_t MICROSOFT_KEYWORD_RESERVED_44 = 0; |     constexpr int64_t MICROSOFT_KEYWORD_RESERVED_44 = 0; | ||||||
| #endif | #endif | ||||||
|  |  | ||||||
| @@ -35,7 +35,7 @@ namespace CalculatorApp | |||||||
|     AppLifecycleLogger::AppLifecycleLogger() |     AppLifecycleLogger::AppLifecycleLogger() | ||||||
|         : m_appLifecycleProvider( |         : m_appLifecycleProvider( | ||||||
|             L"Microsoft.Windows.AppLifeCycle", |             L"Microsoft.Windows.AppLifeCycle", | ||||||
|             LoggingChannelOptions(GUID{ 0x4f50731a, 0x89cf, 0x4782, 0xb3, 0xe0, 0xdc, 0xe8, 0xc9, 0x4, 0x76, 0xba }), // Microsoft Telemetry group |             LoggingChannelOptions(GUID{ 0x4f50731a, 0x89cf, 0x4782, 0xb3, 0xe0, 0xdc, 0xe8, 0xc9, 0x4, 0x76, 0xba }), | ||||||
|             GUID{ 0xef00584a, 0x2655, 0x462c, 0xbc, 0x24, 0xe7, 0xde, 0x63, 0xe, 0x7f, 0xbf }) // Unique provider ID {EF00584A-2655-462C-BC24-E7DE630E7FBF} |             GUID{ 0xef00584a, 0x2655, 0x462c, 0xbc, 0x24, 0xe7, 0xde, 0x63, 0xe, 0x7f, 0xbf }) // Unique provider ID {EF00584A-2655-462C-BC24-E7DE630E7FBF} | ||||||
|     { |     { | ||||||
|     } |     } | ||||||
| @@ -59,7 +59,7 @@ namespace CalculatorApp | |||||||
|     void AppLifecycleLogger::LogAppLifecycleEvent(hstring const& eventName, LoggingFields const& fields) const |     void AppLifecycleLogger::LogAppLifecycleEvent(hstring const& eventName, LoggingFields const& fields) const | ||||||
|     { |     { | ||||||
|         m_appLifecycleProvider.LogEvent( |         m_appLifecycleProvider.LogEvent( | ||||||
|             eventName, fields, LoggingLevel::Information, LoggingOptions(MICROSOFT_KEYWORD_TELEMETRY | WINEVENT_KEYWORD_RESPONSE_TIME)); |             eventName, fields, LoggingLevel::Information, LoggingOptions(MICROSOFT_KEYWORD_LEVEL_3 | WINEVENT_KEYWORD_RESPONSE_TIME)); | ||||||
|     } |     } | ||||||
| #pragma endregion | #pragma endregion | ||||||
|  |  | ||||||
|   | |||||||
| @@ -31,8 +31,8 @@ namespace CalculatorApp | |||||||
|         // Any new Log method should |         // Any new Log method should | ||||||
|         // a) Decide the level of logging. This will help us in limiting recording of events only up to a certain level. See this link for guidance |         // a) Decide the level of logging. This will help us in limiting recording of events only up to a certain level. See this link for guidance | ||||||
|         // https://msdn.microsoft.com/en-us/library/windows/desktop/aa363742(v=vs.85).aspx We're using Verbose level for events that are called frequently and |         // https://msdn.microsoft.com/en-us/library/windows/desktop/aa363742(v=vs.85).aspx We're using Verbose level for events that are called frequently and | ||||||
|         // needed only for debugging or capturing perf for specific scenarios b) Should decide whether or not to log to  telemetry and pass |         // needed only for debugging or capturing perf for specific scenarios b) Should decide whether or not to log to diagnostics and pass | ||||||
|         // TraceLoggingKeyword(MICROSOFT_KEYWORD_TELEMETRY) accordingly c) Should accept a variable number of additional data arguments if needed |         // TraceLoggingKeyword(MICROSOFT_KEYWORD_LEVEL_3) accordingly c) Should accept a variable number of additional data arguments if needed | ||||||
|         void LogAppLifecycleEvent(winrt::hstring const& eventName, winrt::Windows::Foundation::Diagnostics::LoggingFields const& fields) const; |         void LogAppLifecycleEvent(winrt::hstring const& eventName, winrt::Windows::Foundation::Diagnostics::LoggingFields const& fields) const; | ||||||
|         void PopulateAppInfo(winrt::Windows::Foundation::Diagnostics::LoggingFields& fields) const; |         void PopulateAppInfo(winrt::Windows::Foundation::Diagnostics::LoggingFields& fields) const; | ||||||
|  |  | ||||||
|   | |||||||
| @@ -35,7 +35,6 @@ | |||||||
|         </DataTemplate> |         </DataTemplate> | ||||||
|  |  | ||||||
|         <!-- TextBox Styles --> |         <!-- TextBox Styles --> | ||||||
|                 |  | ||||||
|         <Style TargetType="controls:OverflowTextBlock"> |         <Style TargetType="controls:OverflowTextBlock"> | ||||||
|             <Setter Property="HorizontalAlignment" Value="Stretch"/> |             <Setter Property="HorizontalAlignment" Value="Stretch"/> | ||||||
|             <Setter Property="Template"> |             <Setter Property="Template"> | ||||||
| @@ -319,7 +318,7 @@ | |||||||
|                 </VisualState> |                 </VisualState> | ||||||
|             </VisualStateGroup> |             </VisualStateGroup> | ||||||
|             <!-- Layout specific --> |             <!-- Layout specific --> | ||||||
|             <VisualStateGroup> |             <VisualStateGroup CurrentStateChanged="OnVisualStateChanged"> | ||||||
|                 <VisualState x:Name="Portrait768x1366"> |                 <VisualState x:Name="Portrait768x1366"> | ||||||
|                     <VisualState.StateTriggers> |                     <VisualState.StateTriggers> | ||||||
|                         <AdaptiveTrigger MinWindowHeight="1366" MinWindowWidth="768"/> |                         <AdaptiveTrigger MinWindowHeight="1366" MinWindowWidth="768"/> | ||||||
| @@ -944,7 +943,6 @@ | |||||||
|             </Border.Resources> |             </Border.Resources> | ||||||
|  |  | ||||||
|             <Pivot x:Name="DockPivot" |             <Pivot x:Name="DockPivot" | ||||||
|                    SelectionChanged="DockPivot_SelectionChanged" |  | ||||||
|                    TabIndex="5" |                    TabIndex="5" | ||||||
|                    Tapped="DockPanelTapped" |                    Tapped="DockPanelTapped" | ||||||
|                    Template="{StaticResource DockPanelTemplate}"> |                    Template="{StaticResource DockPanelTemplate}"> | ||||||
|   | |||||||
| @@ -450,13 +450,11 @@ void Calculator::OnHistoryItemClicked(_In_ HistoryItemViewModel ^ e) | |||||||
|     unsigned int tokenSize; |     unsigned int tokenSize; | ||||||
|     assert(e->GetTokens() != nullptr); |     assert(e->GetTokens() != nullptr); | ||||||
|     e->GetTokens()->GetSize(&tokenSize); |     e->GetTokens()->GetSize(&tokenSize); | ||||||
|     TraceLogger::GetInstance().LogHistoryItemLoadBegin(); |  | ||||||
|     Model->SetHistoryExpressionDisplay(e->GetTokens(), e->GetCommands()); |     Model->SetHistoryExpressionDisplay(e->GetTokens(), e->GetCommands()); | ||||||
|     Model->SetExpressionDisplay(e->GetTokens(), e->GetCommands()); |     Model->SetExpressionDisplay(e->GetTokens(), e->GetCommands()); | ||||||
|     Model->SetPrimaryDisplay(e->Result->Data(), false); |     Model->SetPrimaryDisplay(e->Result->Data(), false); | ||||||
|     Model->IsFToEEnabled = false; |     Model->IsFToEEnabled = false; | ||||||
|  |  | ||||||
|     TraceLogger::GetInstance().LogHistoryItemLoadEnd(tokenSize); |  | ||||||
|     CloseHistoryFlyout(); |     CloseHistoryFlyout(); | ||||||
|     this->Focus(::FocusState::Programmatic); |     this->Focus(::FocusState::Programmatic); | ||||||
| } | } | ||||||
| @@ -468,8 +466,6 @@ void Calculator::HistoryFlyout_Opened(_In_ Object ^ sender, _In_ Object ^ args) | |||||||
|     m_IsLastFlyoutHistory = true; |     m_IsLastFlyoutHistory = true; | ||||||
|     EnableControls(false); |     EnableControls(false); | ||||||
|     AutomationProperties::SetName(HistoryButton, m_closeHistoryFlyoutAutomationName); |     AutomationProperties::SetName(HistoryButton, m_closeHistoryFlyoutAutomationName); | ||||||
|     TraceLogger::GetInstance().LogHistoryFlyoutOpenEnd(Model->HistoryVM->ItemSize); |  | ||||||
|     TraceLogger::GetInstance().LogHistoryBodyOpened(); |  | ||||||
| } | } | ||||||
|  |  | ||||||
| void Calculator::HistoryFlyout_Closing(_In_ FlyoutBase ^ sender, _In_ FlyoutBaseClosingEventArgs ^ args) | void Calculator::HistoryFlyout_Closing(_In_ FlyoutBase ^ sender, _In_ FlyoutBaseClosingEventArgs ^ args) | ||||||
| @@ -526,7 +522,6 @@ void Calculator::ToggleHistoryFlyout(Object ^ /*parameter*/) | |||||||
|         } |         } | ||||||
|         else |         else | ||||||
|         { |         { | ||||||
|             TraceLogger::GetInstance().LogHistoryFlyoutOpenBegin(Model->HistoryVM->ItemSize); |  | ||||||
|             HistoryFlyout->Content = m_historyList; |             HistoryFlyout->Content = m_historyList; | ||||||
|             m_historyList->RowHeight = NumpadPanel->ActualHeight; |             m_historyList->RowHeight = NumpadPanel->ActualHeight; | ||||||
|             FlyoutBase::ShowAttachedFlyout(HistoryButton); |             FlyoutBase::ShowAttachedFlyout(HistoryButton); | ||||||
| @@ -545,7 +540,6 @@ void Calculator::ToggleMemoryFlyout() | |||||||
|         } |         } | ||||||
|         else |         else | ||||||
|         { |         { | ||||||
|             TraceLogger::GetInstance().LogMemoryFlyoutOpenBegin(Model->MemorizedNumbers->Size); |  | ||||||
|             MemoryFlyout->Content = GetMemory(); |             MemoryFlyout->Content = GetMemory(); | ||||||
|             m_memory->RowHeight = NumpadPanel->ActualHeight; |             m_memory->RowHeight = NumpadPanel->ActualHeight; | ||||||
|             FlyoutBase::ShowAttachedFlyout(MemoryButton); |             FlyoutBase::ShowAttachedFlyout(MemoryButton); | ||||||
| @@ -555,13 +549,11 @@ void Calculator::ToggleMemoryFlyout() | |||||||
|  |  | ||||||
| void Calculator::OnMemoryFlyoutOpened(_In_ Object ^ sender, _In_ Object ^ args) | void Calculator::OnMemoryFlyoutOpened(_In_ Object ^ sender, _In_ Object ^ args) | ||||||
| { | { | ||||||
|     TraceLogger::GetInstance().LogMemoryFlyoutOpenEnd(Model->MemorizedNumbers->Size); |  | ||||||
|     m_IsLastFlyoutMemory = true; |     m_IsLastFlyoutMemory = true; | ||||||
|     m_IsLastFlyoutHistory = false; |     m_IsLastFlyoutHistory = false; | ||||||
|     m_fIsMemoryFlyoutOpen = true; |     m_fIsMemoryFlyoutOpen = true; | ||||||
|     AutomationProperties::SetName(MemoryButton, m_closeMemoryFlyoutAutomationName); |     AutomationProperties::SetName(MemoryButton, m_closeMemoryFlyoutAutomationName); | ||||||
|     EnableControls(false); |     EnableControls(false); | ||||||
|     TraceLogger::GetInstance().LogMemoryBodyOpened(); |  | ||||||
| } | } | ||||||
|  |  | ||||||
| void Calculator::OnMemoryFlyoutClosing(_In_ FlyoutBase ^ sender, _In_ FlyoutBaseClosingEventArgs ^ args) | void Calculator::OnMemoryFlyoutClosing(_In_ FlyoutBase ^ sender, _In_ FlyoutBaseClosingEventArgs ^ args) | ||||||
| @@ -700,14 +692,9 @@ void Calculator::OnMemoryAccessKeyInvoked(_In_ UIElement ^ sender, _In_ AccessKe | |||||||
|     DockPivot->SelectedItem = MemoryPivotItem; |     DockPivot->SelectedItem = MemoryPivotItem; | ||||||
| } | } | ||||||
|  |  | ||||||
| void CalculatorApp::Calculator::DockPivot_SelectionChanged(Platform::Object ^ sender, Windows::UI::Xaml::Controls::SelectionChangedEventArgs ^ e) | void CalculatorApp::Calculator::OnVisualStateChanged(Platform::Object ^ sender, Windows::UI::Xaml::VisualStateChangedEventArgs ^ e) | ||||||
| { | { | ||||||
|     if (DockPivot->SelectedIndex == 0) |     auto mode = IsStandard ? ViewMode::Standard : IsScientific ? ViewMode::Scientific : ViewMode::Programmer; | ||||||
|     { |     auto state = std::wstring(e->NewState->Name->Begin()); | ||||||
|         TraceLogger::GetInstance().LogHistoryBodyOpened(); |     TraceLogger::GetInstance().LogVisualStateChanged(mode, state); | ||||||
|     } |  | ||||||
|     else |  | ||||||
|     { |  | ||||||
|         TraceLogger::GetInstance().LogMemoryBodyOpened(); |  | ||||||
|     } |  | ||||||
| } | } | ||||||
|   | |||||||
| @@ -138,6 +138,6 @@ public | |||||||
|         void OnErrorLayoutCompleted(_In_ Platform::Object ^ sender, _In_ Platform::Object ^ e); |         void OnErrorLayoutCompleted(_In_ Platform::Object ^ sender, _In_ Platform::Object ^ e); | ||||||
|         void OnHistoryAccessKeyInvoked(_In_ Windows::UI::Xaml::UIElement ^ sender, _In_ Windows::UI::Xaml::Input::AccessKeyInvokedEventArgs ^ args); |         void OnHistoryAccessKeyInvoked(_In_ Windows::UI::Xaml::UIElement ^ sender, _In_ Windows::UI::Xaml::Input::AccessKeyInvokedEventArgs ^ args); | ||||||
|         void OnMemoryAccessKeyInvoked(_In_ Windows::UI::Xaml::UIElement ^ sender, _In_ Windows::UI::Xaml::Input::AccessKeyInvokedEventArgs ^ args); |         void OnMemoryAccessKeyInvoked(_In_ Windows::UI::Xaml::UIElement ^ sender, _In_ Windows::UI::Xaml::Input::AccessKeyInvokedEventArgs ^ args); | ||||||
|         void DockPivot_SelectionChanged(Platform::Object ^ sender, Windows::UI::Xaml::Controls::SelectionChangedEventArgs ^ e); |         void OnVisualStateChanged(Platform::Object ^ sender, Windows::UI::Xaml::VisualStateChangedEventArgs ^ e); | ||||||
|     }; |     }; | ||||||
| } | } | ||||||
|   | |||||||
| @@ -170,8 +170,6 @@ void CalculatorProgrammerBitFlipPanel::OnBitToggled(_In_ Object ^ sender, _In_ R | |||||||
|     // which continuously alters the Display Value and the state of the Bit Flip buttons. |     // which continuously alters the Display Value and the state of the Bit Flip buttons. | ||||||
|     if ((Model->IsBitFlipChecked) && Model->IsProgrammer) |     if ((Model->IsBitFlipChecked) && Model->IsProgrammer) | ||||||
|     { |     { | ||||||
|         TraceLogger::GetInstance().LogBitFlipUsed(); |  | ||||||
|  |  | ||||||
|         auto flipButton = static_cast<FlipButtons ^>(sender); |         auto flipButton = static_cast<FlipButtons ^>(sender); | ||||||
|         Model->ButtonPressed->Execute(flipButton->ButtonId); |         Model->ButtonPressed->Execute(flipButton->ButtonId); | ||||||
|     } |     } | ||||||
|   | |||||||
| @@ -70,7 +70,6 @@ | |||||||
|                          Grid.Column="1" |                          Grid.Column="1" | ||||||
|                          Style="{StaticResource ProgKeypadRadioButtonStyle}" |                          Style="{StaticResource ProgKeypadRadioButtonStyle}" | ||||||
|                          AutomationProperties.AutomationId="bitFlip" |                          AutomationProperties.AutomationId="bitFlip" | ||||||
|                          Checked="ShowBitFlip" |  | ||||||
|                          Content="" |                          Content="" | ||||||
|                          IsChecked="{x:Bind Model.IsBitFlipChecked, Mode=TwoWay}"/> |                          IsChecked="{x:Bind Model.IsBitFlipChecked, Mode=TwoWay}"/> | ||||||
|         </Grid> |         </Grid> | ||||||
|   | |||||||
| @@ -6,6 +6,7 @@ | |||||||
| #include "CalcViewModel/Common/TraceLogger.h" | #include "CalcViewModel/Common/TraceLogger.h" | ||||||
|  |  | ||||||
| using namespace CalculatorApp; | using namespace CalculatorApp; | ||||||
|  | using namespace CalculatorApp::Common; | ||||||
| using namespace CalculatorApp::ViewModel; | using namespace CalculatorApp::ViewModel; | ||||||
| using namespace Platform; | using namespace Platform; | ||||||
| using namespace Windows::Foundation; | using namespace Windows::Foundation; | ||||||
| @@ -26,14 +27,8 @@ CalculatorProgrammerDisplayPanel::CalculatorProgrammerDisplayPanel() | |||||||
|     InitializeComponent(); |     InitializeComponent(); | ||||||
| } | } | ||||||
|  |  | ||||||
| void CalculatorProgrammerDisplayPanel::ShowBitFlip(Object ^ sender, RoutedEventArgs ^ e) |  | ||||||
| { |  | ||||||
|     TraceLogger::GetInstance().LogBitFlipPaneClicked(); |  | ||||||
| } |  | ||||||
|  |  | ||||||
| void CalculatorProgrammerDisplayPanel::OnBitLengthButtonPressed(Object ^ parameter) | void CalculatorProgrammerDisplayPanel::OnBitLengthButtonPressed(Object ^ parameter) | ||||||
| { | { | ||||||
|     TraceLogger::GetInstance().LogBitLengthButtonUsed(ApplicationView::GetApplicationViewIdForWindow(CoreWindow::GetForCurrentThread())); |  | ||||||
|     String ^ buttonId = parameter->ToString(); |     String ^ buttonId = parameter->ToString(); | ||||||
|  |  | ||||||
|     QwordButton->Visibility = ::Visibility::Collapsed; |     QwordButton->Visibility = ::Visibility::Collapsed; | ||||||
|   | |||||||
| @@ -38,7 +38,7 @@ CalculatorProgrammerOperators::CalculatorProgrammerOperators() | |||||||
|  |  | ||||||
| void CalculatorProgrammerOperators::HexButtonChecked(_In_ Object ^ sender, _In_ RoutedEventArgs ^ e) | void CalculatorProgrammerOperators::HexButtonChecked(_In_ Object ^ sender, _In_ RoutedEventArgs ^ e) | ||||||
| { | { | ||||||
|     TraceLogger::GetInstance().LogRadixButtonUsed(ApplicationView::GetApplicationViewIdForWindow(CoreWindow::GetForCurrentThread())); |     TraceLogger::GetInstance().UpdateButtonUsage(NumbersAndOperatorsEnum::HexButton, ViewMode::Programmer); | ||||||
|     if (Model) |     if (Model) | ||||||
|     { |     { | ||||||
|         Model->SwitchProgrammerModeBase(RADIX_TYPE::HEX_RADIX); |         Model->SwitchProgrammerModeBase(RADIX_TYPE::HEX_RADIX); | ||||||
| @@ -47,7 +47,7 @@ void CalculatorProgrammerOperators::HexButtonChecked(_In_ Object ^ sender, _In_ | |||||||
|  |  | ||||||
| void CalculatorProgrammerOperators::DecButtonChecked(_In_ Object ^ sender, _In_ RoutedEventArgs ^ e) | void CalculatorProgrammerOperators::DecButtonChecked(_In_ Object ^ sender, _In_ RoutedEventArgs ^ e) | ||||||
| { | { | ||||||
|     TraceLogger::GetInstance().LogRadixButtonUsed(ApplicationView::GetApplicationViewIdForWindow(CoreWindow::GetForCurrentThread())); |     TraceLogger::GetInstance().UpdateButtonUsage(NumbersAndOperatorsEnum::DecButton, ViewMode::Programmer); | ||||||
|     if (Model) |     if (Model) | ||||||
|     { |     { | ||||||
|         Model->SwitchProgrammerModeBase(RADIX_TYPE::DEC_RADIX); |         Model->SwitchProgrammerModeBase(RADIX_TYPE::DEC_RADIX); | ||||||
| @@ -56,7 +56,7 @@ void CalculatorProgrammerOperators::DecButtonChecked(_In_ Object ^ sender, _In_ | |||||||
|  |  | ||||||
| void CalculatorProgrammerOperators::OctButtonChecked(_In_ Object ^ sender, _In_ RoutedEventArgs ^ e) | void CalculatorProgrammerOperators::OctButtonChecked(_In_ Object ^ sender, _In_ RoutedEventArgs ^ e) | ||||||
| { | { | ||||||
|     TraceLogger::GetInstance().LogRadixButtonUsed(ApplicationView::GetApplicationViewIdForWindow(CoreWindow::GetForCurrentThread())); |     TraceLogger::GetInstance().UpdateButtonUsage(NumbersAndOperatorsEnum::OctButton, ViewMode::Programmer); | ||||||
|     if (Model) |     if (Model) | ||||||
|     { |     { | ||||||
|         Model->SwitchProgrammerModeBase(RADIX_TYPE::OCT_RADIX); |         Model->SwitchProgrammerModeBase(RADIX_TYPE::OCT_RADIX); | ||||||
| @@ -65,7 +65,7 @@ void CalculatorProgrammerOperators::OctButtonChecked(_In_ Object ^ sender, _In_ | |||||||
|  |  | ||||||
| void CalculatorProgrammerOperators::BinButtonChecked(_In_ Object ^ sender, _In_ RoutedEventArgs ^ e) | void CalculatorProgrammerOperators::BinButtonChecked(_In_ Object ^ sender, _In_ RoutedEventArgs ^ e) | ||||||
| { | { | ||||||
|     TraceLogger::GetInstance().LogRadixButtonUsed(ApplicationView::GetApplicationViewIdForWindow(CoreWindow::GetForCurrentThread())); |     TraceLogger::GetInstance().UpdateButtonUsage(NumbersAndOperatorsEnum::BinButton, ViewMode::Programmer); | ||||||
|     if (Model) |     if (Model) | ||||||
|     { |     { | ||||||
|         Model->SwitchProgrammerModeBase(RADIX_TYPE::BIN_RADIX); |         Model->SwitchProgrammerModeBase(RADIX_TYPE::BIN_RADIX); | ||||||
|   | |||||||
| @@ -37,7 +37,6 @@ CalculatorScientificAngleButtons::CalculatorScientificAngleButtons() | |||||||
|  |  | ||||||
| void CalculatorScientificAngleButtons::HypButton_Toggled(_In_ Object ^ sender, _In_ RoutedEventArgs ^ e) | void CalculatorScientificAngleButtons::HypButton_Toggled(_In_ Object ^ sender, _In_ RoutedEventArgs ^ e) | ||||||
| { | { | ||||||
|     TraceLogger::GetInstance().LogHypButtonUsed(ApplicationView::GetApplicationViewIdForWindow(CoreWindow::GetForCurrentThread())); |  | ||||||
| } | } | ||||||
|  |  | ||||||
| void CalculatorScientificAngleButtons::FToEButton_Toggled(_In_ Object ^ sender, _In_ RoutedEventArgs ^ e) | void CalculatorScientificAngleButtons::FToEButton_Toggled(_In_ Object ^ sender, _In_ RoutedEventArgs ^ e) | ||||||
| @@ -48,7 +47,6 @@ void CalculatorScientificAngleButtons::FToEButton_Toggled(_In_ Object ^ sender, | |||||||
|  |  | ||||||
| void CalculatorApp::CalculatorScientificAngleButtons::OnAngleButtonPressed(_In_ Object ^ commandParameter) | void CalculatorApp::CalculatorScientificAngleButtons::OnAngleButtonPressed(_In_ Object ^ commandParameter) | ||||||
| { | { | ||||||
|     TraceLogger::GetInstance().LogAngleButtonUsed(ApplicationView::GetApplicationViewIdForWindow(CoreWindow::GetForCurrentThread())); |  | ||||||
|     String ^ buttonId = static_cast<String ^>(commandParameter); |     String ^ buttonId = static_cast<String ^>(commandParameter); | ||||||
|  |  | ||||||
|     DegreeButton->Visibility = ::Visibility::Collapsed; |     DegreeButton->Visibility = ::Visibility::Collapsed; | ||||||
|   | |||||||
| @@ -358,7 +358,7 @@ | |||||||
|         </Grid.RowDefinitions> |         </Grid.RowDefinitions> | ||||||
|  |  | ||||||
|         <VisualStateManager.VisualStateGroups> |         <VisualStateManager.VisualStateGroups> | ||||||
|             <VisualStateGroup> |             <VisualStateGroup CurrentStateChanged="OnVisualStateChanged"> | ||||||
|                 <VisualState x:Name="LeftAlignedLayout"> |                 <VisualState x:Name="LeftAlignedLayout"> | ||||||
|                     <VisualState.StateTriggers> |                     <VisualState.StateTriggers> | ||||||
|                         <AdaptiveTrigger MinWindowWidth="480"/> |                         <AdaptiveTrigger MinWindowWidth="480"/> | ||||||
|   | |||||||
| @@ -103,7 +103,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().LogDateCalculationModeUsed(false /* AddSubtractMode */); | ||||||
|     } |     } | ||||||
|     else |     else | ||||||
|     { |     { | ||||||
| @@ -117,7 +117,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().LogDateCalculationModeUsed(false /* AddSubtractMode */); | ||||||
|     } |     } | ||||||
|     else |     else | ||||||
|     { |     { | ||||||
| @@ -131,8 +131,7 @@ void DateCalculator::AddSubtract_DateChanged(_In_ CalendarDatePicker ^ sender, _ | |||||||
|     { |     { | ||||||
|         auto dateCalcViewModel = safe_cast<DateCalculatorViewModel ^>(this->DataContext); |         auto dateCalcViewModel = safe_cast<DateCalculatorViewModel ^>(this->DataContext); | ||||||
|         dateCalcViewModel->StartDate = e->NewDate->Value; |         dateCalcViewModel->StartDate = e->NewDate->Value; | ||||||
|         TraceLogger::GetInstance().LogDateAddSubtractModeUsed( |         TraceLogger::GetInstance().LogDateCalculationModeUsed(true /* AddSubtractMode */); | ||||||
|             ApplicationView::GetApplicationViewIdForWindow(CoreWindow::GetForCurrentThread()), dateCalcViewModel->IsAddMode); |  | ||||||
|     } |     } | ||||||
|     else |     else | ||||||
|     { |     { | ||||||
| @@ -143,8 +142,11 @@ void DateCalculator::AddSubtract_DateChanged(_In_ CalendarDatePicker ^ sender, _ | |||||||
| void CalculatorApp::DateCalculator::OffsetValue_Changed(_In_ Platform::Object ^ sender, _In_ SelectionChangedEventArgs ^ e) | void CalculatorApp::DateCalculator::OffsetValue_Changed(_In_ Platform::Object ^ sender, _In_ SelectionChangedEventArgs ^ e) | ||||||
| { | { | ||||||
|     auto dateCalcViewModel = safe_cast<DateCalculatorViewModel ^>(this->DataContext); |     auto dateCalcViewModel = safe_cast<DateCalculatorViewModel ^>(this->DataContext); | ||||||
|     TraceLogger::GetInstance().LogDateAddSubtractModeUsed( |     // do not log diagnostics for no-ops and initialization of combo boxes | ||||||
|         ApplicationView::GetApplicationViewIdForWindow(CoreWindow::GetForCurrentThread()), dateCalcViewModel->IsAddMode); |     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) | ||||||
| @@ -232,3 +234,9 @@ void DateCalculator::AddSubtractOption_Checked(_In_ Object ^ sender, _In_ Routed | |||||||
| { | { | ||||||
|     RaiseLiveRegionChangedAutomationEvent(/* DateDiff mode */ false); |     RaiseLiveRegionChangedAutomationEvent(/* DateDiff mode */ false); | ||||||
| } | } | ||||||
|  |  | ||||||
|  | void CalculatorApp::DateCalculator::OnVisualStateChanged(Platform::Object ^ sender, Windows::UI::Xaml::VisualStateChangedEventArgs ^ e) | ||||||
|  | { | ||||||
|  |     auto state = std::wstring(e->NewState->Name->Begin()); | ||||||
|  |     TraceLogger::GetInstance().LogVisualStateChanged(ViewMode::Date, state); | ||||||
|  | } | ||||||
|   | |||||||
| @@ -48,7 +48,9 @@ namespace CalculatorApp | |||||||
|         void OffsetDropDownClosed(_In_ Platform::Object ^ sender, _In_ Platform::Object ^ e); |         void OffsetDropDownClosed(_In_ Platform::Object ^ sender, _In_ Platform::Object ^ e); | ||||||
|         void CalendarFlyoutClosed(_In_ Platform::Object ^ sender, _In_ Platform::Object ^ e); |         void CalendarFlyoutClosed(_In_ Platform::Object ^ sender, _In_ Platform::Object ^ e); | ||||||
|         void RaiseLiveRegionChangedAutomationEvent(_In_ bool isDateDiffMode); |         void RaiseLiveRegionChangedAutomationEvent(_In_ bool isDateDiffMode); | ||||||
|  |         void OnVisualStateChanged(Platform::Object ^ sender, Windows::UI::Xaml::VisualStateChangedEventArgs ^ e); | ||||||
|  |  | ||||||
|         Windows::Foundation::EventRegistrationToken m_dateCalcOptionChangedEventToken; |         Windows::Foundation::EventRegistrationToken m_dateCalcOptionChangedEventToken; | ||||||
|  |  | ||||||
|     }; |     }; | ||||||
| } | } | ||||||
|   | |||||||
| @@ -253,7 +253,6 @@ void MainPage::OnPageLoaded(_In_ Object ^, _In_ RoutedEventArgs ^ args) | |||||||
|         CoreDispatcherPriority::Normal, ref new DispatchedHandler([]() { |         CoreDispatcherPriority::Normal, ref new DispatchedHandler([]() { | ||||||
|             if (TraceLogger::GetInstance().UpdateWindowIdLog(ApplicationView::GetApplicationViewIdForWindow(CoreWindow::GetForCurrentThread()))) |             if (TraceLogger::GetInstance().UpdateWindowIdLog(ApplicationView::GetApplicationViewIdForWindow(CoreWindow::GetForCurrentThread()))) | ||||||
|             { |             { | ||||||
|                 TraceLogger::GetInstance().LogAppLaunchComplete(); |  | ||||||
|                 AppLifecycleLogger::GetInstance().LaunchUIResponsive(); |                 AppLifecycleLogger::GetInstance().LaunchUIResponsive(); | ||||||
|                 AppLifecycleLogger::GetInstance().LaunchVisibleComplete(); |                 AppLifecycleLogger::GetInstance().LaunchVisibleComplete(); | ||||||
|             } |             } | ||||||
|   | |||||||
| @@ -341,7 +341,7 @@ | |||||||
|                     </VisualState.Setters> |                     </VisualState.Setters> | ||||||
|                 </VisualState> |                 </VisualState> | ||||||
|             </VisualStateGroup> |             </VisualStateGroup> | ||||||
|             <VisualStateGroup x:Name="Sizing"> |             <VisualStateGroup x:Name="Sizing" CurrentStateChanged="OnVisualStateChanged"> | ||||||
|                 <VisualState x:Name="Wide"> |                 <VisualState x:Name="Wide"> | ||||||
|                     <VisualState.StateTriggers> |                     <VisualState.StateTriggers> | ||||||
|                         <AdaptiveTrigger MinWindowHeight="768" MinWindowWidth="1280"/> |                         <AdaptiveTrigger MinWindowHeight="768" MinWindowWidth="1280"/> | ||||||
|   | |||||||
| @@ -6,6 +6,7 @@ | |||||||
|  |  | ||||||
| #include "pch.h" | #include "pch.h" | ||||||
| #include "UnitConverter.xaml.h" | #include "UnitConverter.xaml.h" | ||||||
|  | #include "CalcViewModel/Common/TraceLogger.h" | ||||||
| #include "CalcViewModel/UnitConverterViewModel.h" | #include "CalcViewModel/UnitConverterViewModel.h" | ||||||
| #include "Controls/CalculationResult.h" | #include "Controls/CalculationResult.h" | ||||||
| #include "Controls/CalculatorButton.h" | #include "Controls/CalculatorButton.h" | ||||||
| @@ -245,7 +246,7 @@ void UnitConverter::OnCopyMenuItemClicked(_In_ Object ^ sender, _In_ RoutedEvent | |||||||
| void UnitConverter::OnPasteMenuItemClicked(_In_ Object ^ sender, _In_ RoutedEventArgs ^ e) | void UnitConverter::OnPasteMenuItemClicked(_In_ Object ^ sender, _In_ RoutedEventArgs ^ e) | ||||||
| { | { | ||||||
|     CopyPasteManager::GetStringToPaste(Model->Mode, CategoryGroupType::Converter).then([this](String ^ pastedString) { |     CopyPasteManager::GetStringToPaste(Model->Mode, CategoryGroupType::Converter).then([this](String ^ pastedString) { | ||||||
|         Model->OnPaste(pastedString, Model->Mode); |         Model->OnPaste(pastedString); | ||||||
|     }); |     }); | ||||||
| } | } | ||||||
|  |  | ||||||
| @@ -368,3 +369,10 @@ void CalculatorApp::UnitConverter::SupplementaryResultsPanelInGrid_SizeChanged(P | |||||||
|     // We add 0.01 to be sure to not create an infinite loop with SizeChanged events cascading due to float approximation |     // We add 0.01 to be sure to not create an infinite loop with SizeChanged events cascading due to float approximation | ||||||
|     RowDltrUnits->MinHeight = max(48.0, e->NewSize.Height + 0.01); |     RowDltrUnits->MinHeight = max(48.0, e->NewSize.Height + 0.01); | ||||||
| } | } | ||||||
|  |  | ||||||
|  | void CalculatorApp::UnitConverter::OnVisualStateChanged(Platform::Object ^ sender, Windows::UI::Xaml::VisualStateChangedEventArgs ^ e) | ||||||
|  | { | ||||||
|  |     auto mode = NavCategory::Deserialize(Model->CurrentCategory->GetModelCategory().id); | ||||||
|  |     auto state = std::wstring(e->NewState->Name->Begin()); | ||||||
|  |     TraceLogger::GetInstance().LogVisualStateChanged(mode, state); | ||||||
|  | } | ||||||
|   | |||||||
| @@ -89,5 +89,6 @@ namespace CalculatorApp | |||||||
|  |  | ||||||
|         bool m_isAnimationEnabled; |         bool m_isAnimationEnabled; | ||||||
|         void SupplementaryResultsPanelInGrid_SizeChanged(Platform::Object ^ sender, Windows::UI::Xaml::SizeChangedEventArgs ^ e); |         void SupplementaryResultsPanelInGrid_SizeChanged(Platform::Object ^ sender, Windows::UI::Xaml::SizeChangedEventArgs ^ e); | ||||||
|  |         void OnVisualStateChanged(Platform::Object ^ sender, Windows::UI::Xaml::VisualStateChangedEventArgs ^ e); | ||||||
|     }; |     }; | ||||||
| } | } | ||||||
|   | |||||||
| @@ -118,7 +118,7 @@ namespace CalculatorApp | |||||||
|  |  | ||||||
|     void WindowFrameService::OnConsolidated(_In_ ApplicationView ^ sender, _In_ ApplicationViewConsolidatedEventArgs ^ e) |     void WindowFrameService::OnConsolidated(_In_ ApplicationView ^ sender, _In_ ApplicationViewConsolidatedEventArgs ^ e) | ||||||
|     { |     { | ||||||
|         LogOnViewClosed(CoreWindow::GetForCurrentThread()); |         TraceLogger::GetInstance().UpdateWindowCount(); | ||||||
|         auto parent = m_parent.Resolve<App>(); |         auto parent = m_parent.Resolve<App>(); | ||||||
|         if (parent != nullptr) |         if (parent != nullptr) | ||||||
|         { |         { | ||||||
| @@ -128,7 +128,6 @@ namespace CalculatorApp | |||||||
|  |  | ||||||
|     void WindowFrameService::OnClosed(_In_ CoreWindow ^ sender, _In_ CoreWindowEventArgs ^ args) |     void WindowFrameService::OnClosed(_In_ CoreWindow ^ sender, _In_ CoreWindowEventArgs ^ args) | ||||||
|     { |     { | ||||||
|         LogOnViewClosed(sender); |  | ||||||
|         auto parent = m_parent.Resolve<App>(); |         auto parent = m_parent.Resolve<App>(); | ||||||
|         if (parent != nullptr) |         if (parent != nullptr) | ||||||
|         { |         { | ||||||
| @@ -136,18 +135,6 @@ namespace CalculatorApp | |||||||
|         } |         } | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     void WindowFrameService::LogOnViewClosed(_In_ CoreWindow ^ coreWindow) |  | ||||||
|     { |  | ||||||
|         if (coreWindow) |  | ||||||
|         { |  | ||||||
|             TraceLogger::GetInstance().LogViewClosingTelemetry(ApplicationView::GetApplicationViewIdForWindow(coreWindow)); |  | ||||||
|         } |  | ||||||
|         else |  | ||||||
|         { |  | ||||||
|             TraceLogger::GetInstance().LogCoreWindowWasNull(); |  | ||||||
|         } |  | ||||||
|     } |  | ||||||
|  |  | ||||||
|     void WindowFrameService::RegisterRuntimeWindowService(TypeName serviceId, _In_opt_ Object ^ service) |     void WindowFrameService::RegisterRuntimeWindowService(TypeName serviceId, _In_opt_ Object ^ service) | ||||||
|     { |     { | ||||||
|         if (TryResolveRuntimeWindowService(serviceId)) |         if (TryResolveRuntimeWindowService(serviceId)) | ||||||
|   | |||||||
| @@ -1,4 +1,4 @@ | |||||||
| // Copyright (c) Microsoft Corporation. All rights reserved. | // Copyright (c) Microsoft Corporation. All rights reserved. | ||||||
| // Licensed under the MIT License. | // Licensed under the MIT License. | ||||||
|  |  | ||||||
| #pragma once | #pragma once | ||||||
| @@ -47,8 +47,6 @@ public | |||||||
|         OnConsolidated(_In_ Windows::UI::ViewManagement::ApplicationView ^ sender, _In_ Windows::UI::ViewManagement::ApplicationViewConsolidatedEventArgs ^ e); |         OnConsolidated(_In_ Windows::UI::ViewManagement::ApplicationView ^ sender, _In_ Windows::UI::ViewManagement::ApplicationViewConsolidatedEventArgs ^ e); | ||||||
|         void OnClosed(_In_ Windows::UI::Core::CoreWindow ^ sender, _In_ Windows::UI::Core::CoreWindowEventArgs ^ args); |         void OnClosed(_In_ Windows::UI::Core::CoreWindow ^ sender, _In_ Windows::UI::Core::CoreWindowEventArgs ^ args); | ||||||
|  |  | ||||||
|         void LogOnViewClosed(_In_ Windows::UI::Core::CoreWindow ^ coreWindow); |  | ||||||
|  |  | ||||||
|     private: |     private: | ||||||
|         Platform::Agile<Windows::UI::Core::CoreWindow ^> m_currentWindow; |         Platform::Agile<Windows::UI::Core::CoreWindow ^> m_currentWindow; | ||||||
|         Platform::Agile<Windows::UI::Core::CoreDispatcher ^> m_coreDispatcher; |         Platform::Agile<Windows::UI::Core::CoreDispatcher ^> m_coreDispatcher; | ||||||
|   | |||||||
| @@ -576,7 +576,7 @@ namespace CalculatorUnitTests | |||||||
|         for (String ^ &input : inputs) |         for (String ^ &input : inputs) | ||||||
|         { |         { | ||||||
|             // paste number in standard mode and then validate the pastability of displayed number for other modes |             // paste number in standard mode and then validate the pastability of displayed number for other modes | ||||||
|             scvm->OnPaste(input, ViewMode::Standard); |             scvm->OnPaste(input); | ||||||
|             VERIFY_ARE_EQUAL(ValidateStandardPasteExpression(scvm->DisplayValue), scvm->DisplayValue); |             VERIFY_ARE_EQUAL(ValidateStandardPasteExpression(scvm->DisplayValue), scvm->DisplayValue); | ||||||
|             VERIFY_ARE_EQUAL(ValidateScientificPasteExpression(scvm->DisplayValue), scvm->DisplayValue); |             VERIFY_ARE_EQUAL(ValidateScientificPasteExpression(scvm->DisplayValue), scvm->DisplayValue); | ||||||
|             VERIFY_ARE_EQUAL(ValidateProgrammerHexQwordPasteExpression(scvm->DisplayValue), scvm->DisplayValue); |             VERIFY_ARE_EQUAL(ValidateProgrammerHexQwordPasteExpression(scvm->DisplayValue), scvm->DisplayValue); | ||||||
|   | |||||||
| @@ -387,26 +387,26 @@ namespace CalculatorUnitTests | |||||||
|         { |         { | ||||||
|             m_viewModel->IsScientific = false; |             m_viewModel->IsScientific = false; | ||||||
|  |  | ||||||
|             m_viewModel->OnPaste("-0.99", ViewMode::Standard); |             m_viewModel->OnPaste("-0.99"); | ||||||
|             ValidateViewModelValueAndExpression("-0" + m_decimalSeparator + "99", ""); |             ValidateViewModelValueAndExpression("-0" + m_decimalSeparator + "99", ""); | ||||||
|  |  | ||||||
|             m_viewModel->OnPaste("1+1=", ViewMode::Standard); |             m_viewModel->OnPaste("1+1="); | ||||||
|             ValidateViewModelValueAndExpression("2", ""); |             ValidateViewModelValueAndExpression("2", ""); | ||||||
|  |  | ||||||
|             // This result is not obvious: it's the result of the previous operation |             // This result is not obvious: it's the result of the previous operation | ||||||
|             m_viewModel->OnPaste("0=", ViewMode::Standard); |             m_viewModel->OnPaste("0="); | ||||||
|             ValidateViewModelValueAndExpression("1", ""); |             ValidateViewModelValueAndExpression("1", ""); | ||||||
|  |  | ||||||
|             // Negative value |             // Negative value | ||||||
|             m_viewModel->OnPaste("-1", ViewMode::Standard); |             m_viewModel->OnPaste("-1"); | ||||||
|             ValidateViewModelValueAndExpression("-1", ""); |             ValidateViewModelValueAndExpression("-1", ""); | ||||||
|  |  | ||||||
|             // Negated expression |             // Negated expression | ||||||
|             m_viewModel->OnPaste("-(1+1)", ViewMode::Standard); |             m_viewModel->OnPaste("-(1+1)"); | ||||||
|             ValidateViewModelValueAndSecondaryExpression("-2", "negate(1 + 1)"); |             ValidateViewModelValueAndSecondaryExpression("-2", "negate(1 + 1)"); | ||||||
|  |  | ||||||
|             // More complicated Negated expression |             // More complicated Negated expression | ||||||
|             m_viewModel->OnPaste("-(-(-1))", ViewMode::Standard); |             m_viewModel->OnPaste("-(-(-1))"); | ||||||
|             ValidateViewModelValueAndSecondaryExpression("-1", "negate(0 - (0 - 1))"); |             ValidateViewModelValueAndSecondaryExpression("-1", "negate(0 - (0 - 1))"); | ||||||
|  |  | ||||||
|             // Switch to scientific mode |             // Switch to scientific mode | ||||||
| @@ -415,24 +415,24 @@ namespace CalculatorUnitTests | |||||||
|             VERIFY_IS_FALSE(m_viewModel->IsFToEChecked); |             VERIFY_IS_FALSE(m_viewModel->IsFToEChecked); | ||||||
|  |  | ||||||
|             //// Positive exponent |             //// Positive exponent | ||||||
|             m_viewModel->OnPaste("1.23e+10", ViewMode::Scientific); |             m_viewModel->OnPaste("1.23e+10"); | ||||||
|             ValidateViewModelValueAndExpression("1" + m_decimalSeparator + "23e+10", ""); |             ValidateViewModelValueAndExpression("1" + m_decimalSeparator + "23e+10", ""); | ||||||
|  |  | ||||||
|             m_viewModel->OnPaste("1.23e10", ViewMode::Scientific); |             m_viewModel->OnPaste("1.23e10"); | ||||||
|             ValidateViewModelValueAndExpression("1" + m_decimalSeparator + "23e+10", ""); |             ValidateViewModelValueAndExpression("1" + m_decimalSeparator + "23e+10", ""); | ||||||
|  |  | ||||||
|             m_viewModel->OnPaste("135e10", ViewMode::Scientific); |             m_viewModel->OnPaste("135e10"); | ||||||
|             ValidateViewModelValueAndExpression("135" + m_decimalSeparator + "e+10", ""); |             ValidateViewModelValueAndExpression("135" + m_decimalSeparator + "e+10", ""); | ||||||
|  |  | ||||||
|             //// Negative exponent |             //// Negative exponent | ||||||
|             m_viewModel->OnPaste("1.23e-10", ViewMode::Scientific); |             m_viewModel->OnPaste("1.23e-10"); | ||||||
|             ValidateViewModelValueAndExpression("1" + m_decimalSeparator + "23e-10", ""); |             ValidateViewModelValueAndExpression("1" + m_decimalSeparator + "23e-10", ""); | ||||||
|  |  | ||||||
|             //// Uppercase E (for exponent) |             //// Uppercase E (for exponent) | ||||||
|             m_viewModel->OnPaste("1.23E-10", ViewMode::Scientific); |             m_viewModel->OnPaste("1.23E-10"); | ||||||
|             ValidateViewModelValueAndExpression("1" + m_decimalSeparator + "23e-10", ""); |             ValidateViewModelValueAndExpression("1" + m_decimalSeparator + "23e-10", ""); | ||||||
|  |  | ||||||
|             m_viewModel->OnPaste("135E10", ViewMode::Scientific); |             m_viewModel->OnPaste("135E10"); | ||||||
|             ValidateViewModelValueAndExpression("135" + m_decimalSeparator + "e+10", ""); |             ValidateViewModelValueAndExpression("135" + m_decimalSeparator + "e+10", ""); | ||||||
|         } |         } | ||||||
|  |  | ||||||
|   | |||||||
| @@ -852,69 +852,68 @@ TEST_METHOD(TestOnPaste) | |||||||
|  |  | ||||||
|     // Call count is being set to 1 because we send 'CE' command as the first call in OnPaste method of the ViewModel |     // Call count is being set to 1 because we send 'CE' command as the first call in OnPaste method of the ViewModel | ||||||
|     UINT callCount = 1; |     UINT callCount = 1; | ||||||
|     ViewMode mode = ViewMode::Volume; // Some temp mode for UnitConverter |  | ||||||
|  |  | ||||||
|     // Paste an invalid character - verify that call count doesn't increment |     // Paste an invalid character - verify that call count doesn't increment | ||||||
|     vm.OnPaste("z", mode); |     vm.OnPaste("z"); | ||||||
|     VERIFY_ARE_EQUAL(callCount, mock->m_sendCommandCallCount); |     VERIFY_ARE_EQUAL(callCount, mock->m_sendCommandCallCount); | ||||||
|  |  | ||||||
|     // Test all valid characters. Verify that two commands are sent for each character |     // Test all valid characters. Verify that two commands are sent for each character | ||||||
|     vm.OnPaste("0", mode); |     vm.OnPaste("0"); | ||||||
|     callCount += 2; |     callCount += 2; | ||||||
|     VERIFY_ARE_EQUAL(callCount, mock->m_sendCommandCallCount); |     VERIFY_ARE_EQUAL(callCount, mock->m_sendCommandCallCount); | ||||||
|     VERIFY_IS_TRUE(UCM::Command::Zero == mock->m_lastCommand); |     VERIFY_IS_TRUE(UCM::Command::Zero == mock->m_lastCommand); | ||||||
|  |  | ||||||
|     vm.OnPaste("1", mode); |     vm.OnPaste("1"); | ||||||
|     callCount += 2; |     callCount += 2; | ||||||
|     VERIFY_ARE_EQUAL(callCount, mock->m_sendCommandCallCount); |     VERIFY_ARE_EQUAL(callCount, mock->m_sendCommandCallCount); | ||||||
|     VERIFY_IS_TRUE(UCM::Command::One == mock->m_lastCommand); |     VERIFY_IS_TRUE(UCM::Command::One == mock->m_lastCommand); | ||||||
|  |  | ||||||
|     vm.OnPaste("2", mode); |     vm.OnPaste("2"); | ||||||
|     callCount += 2; |     callCount += 2; | ||||||
|     VERIFY_ARE_EQUAL(callCount, mock->m_sendCommandCallCount); |     VERIFY_ARE_EQUAL(callCount, mock->m_sendCommandCallCount); | ||||||
|     VERIFY_IS_TRUE(UCM::Command::Two == mock->m_lastCommand); |     VERIFY_IS_TRUE(UCM::Command::Two == mock->m_lastCommand); | ||||||
|  |  | ||||||
|     vm.OnPaste("3", mode); |     vm.OnPaste("3"); | ||||||
|     callCount += 2; |     callCount += 2; | ||||||
|     VERIFY_ARE_EQUAL(callCount, mock->m_sendCommandCallCount); |     VERIFY_ARE_EQUAL(callCount, mock->m_sendCommandCallCount); | ||||||
|     VERIFY_IS_TRUE(UCM::Command::Three == mock->m_lastCommand); |     VERIFY_IS_TRUE(UCM::Command::Three == mock->m_lastCommand); | ||||||
|  |  | ||||||
|     vm.OnPaste("4", mode); |     vm.OnPaste("4"); | ||||||
|     callCount += 2; |     callCount += 2; | ||||||
|     VERIFY_ARE_EQUAL(callCount, mock->m_sendCommandCallCount); |     VERIFY_ARE_EQUAL(callCount, mock->m_sendCommandCallCount); | ||||||
|     VERIFY_IS_TRUE(UCM::Command::Four == mock->m_lastCommand); |     VERIFY_IS_TRUE(UCM::Command::Four == mock->m_lastCommand); | ||||||
|  |  | ||||||
|     vm.OnPaste("5", mode); |     vm.OnPaste("5"); | ||||||
|     callCount += 2; |     callCount += 2; | ||||||
|     VERIFY_ARE_EQUAL(callCount, mock->m_sendCommandCallCount); |     VERIFY_ARE_EQUAL(callCount, mock->m_sendCommandCallCount); | ||||||
|     VERIFY_IS_TRUE(UCM::Command::Five == mock->m_lastCommand); |     VERIFY_IS_TRUE(UCM::Command::Five == mock->m_lastCommand); | ||||||
|  |  | ||||||
|     vm.OnPaste("6", mode); |     vm.OnPaste("6"); | ||||||
|     callCount += 2; |     callCount += 2; | ||||||
|     VERIFY_ARE_EQUAL(callCount, mock->m_sendCommandCallCount); |     VERIFY_ARE_EQUAL(callCount, mock->m_sendCommandCallCount); | ||||||
|     VERIFY_IS_TRUE(UCM::Command::Six == mock->m_lastCommand); |     VERIFY_IS_TRUE(UCM::Command::Six == mock->m_lastCommand); | ||||||
|  |  | ||||||
|     vm.OnPaste("7", mode); |     vm.OnPaste("7"); | ||||||
|     callCount += 2; |     callCount += 2; | ||||||
|     VERIFY_ARE_EQUAL(callCount, mock->m_sendCommandCallCount); |     VERIFY_ARE_EQUAL(callCount, mock->m_sendCommandCallCount); | ||||||
|     VERIFY_IS_TRUE(UCM::Command::Seven == mock->m_lastCommand); |     VERIFY_IS_TRUE(UCM::Command::Seven == mock->m_lastCommand); | ||||||
|  |  | ||||||
|     vm.OnPaste("8", mode); |     vm.OnPaste("8"); | ||||||
|     callCount += 2; |     callCount += 2; | ||||||
|     VERIFY_ARE_EQUAL(callCount, mock->m_sendCommandCallCount); |     VERIFY_ARE_EQUAL(callCount, mock->m_sendCommandCallCount); | ||||||
|     VERIFY_IS_TRUE(UCM::Command::Eight == mock->m_lastCommand); |     VERIFY_IS_TRUE(UCM::Command::Eight == mock->m_lastCommand); | ||||||
|  |  | ||||||
|     vm.OnPaste("9", mode); |     vm.OnPaste("9"); | ||||||
|     callCount += 2; |     callCount += 2; | ||||||
|     VERIFY_ARE_EQUAL(callCount, mock->m_sendCommandCallCount); |     VERIFY_ARE_EQUAL(callCount, mock->m_sendCommandCallCount); | ||||||
|     VERIFY_IS_TRUE(UCM::Command::Nine == mock->m_lastCommand); |     VERIFY_IS_TRUE(UCM::Command::Nine == mock->m_lastCommand); | ||||||
|  |  | ||||||
|     vm.OnPaste(".", mode); |     vm.OnPaste("."); | ||||||
|     callCount += 2; |     callCount += 2; | ||||||
|     VERIFY_ARE_EQUAL(callCount, mock->m_sendCommandCallCount); |     VERIFY_ARE_EQUAL(callCount, mock->m_sendCommandCallCount); | ||||||
|     VERIFY_IS_TRUE(UCM::Command::Decimal == mock->m_lastCommand); |     VERIFY_IS_TRUE(UCM::Command::Decimal == mock->m_lastCommand); | ||||||
|  |  | ||||||
|     vm.OnPaste("-", mode); |     vm.OnPaste("-"); | ||||||
|     // Call count should increment by one (the Clear command) since negate isn't |     // Call count should increment by one (the Clear command) since negate isn't | ||||||
|     // sent by itself, only after another legal character |     // sent by itself, only after another legal character | ||||||
|     ++callCount; |     ++callCount; | ||||||
| @@ -922,7 +921,7 @@ TEST_METHOD(TestOnPaste) | |||||||
|  |  | ||||||
|     // Send an invalid character |     // Send an invalid character | ||||||
|  |  | ||||||
|     vm.OnPaste("a", mode); |     vm.OnPaste("a"); | ||||||
|     // Count should remain the same |     // Count should remain the same | ||||||
|     VERIFY_ARE_EQUAL(callCount, mock->m_sendCommandCallCount); |     VERIFY_ARE_EQUAL(callCount, mock->m_sendCommandCallCount); | ||||||
|     // Last command should remain the same |     // Last command should remain the same | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user