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
parent
2ff7bb4089
commit
a6384269bc
@@ -4,7 +4,6 @@
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:local="using:CalculatorApp.Common"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
Loaded="UserControl_Loaded"
|
||||
mc:Ignorable="d">
|
||||
<UserControl.Transitions>
|
||||
<TransitionCollection>
|
||||
|
@@ -61,8 +61,3 @@ void AboutFlyout::SetDefaultFocus()
|
||||
{
|
||||
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.
|
||||
|
||||
#pragma once
|
||||
@@ -18,6 +18,5 @@ public
|
||||
private:
|
||||
void FeedbackButton_Click(_In_ Platform::Object ^ sender, _In_ Windows::UI::Xaml::RoutedEventArgs ^ e);
|
||||
void SetVersionString();
|
||||
void UserControl_Loaded(Platform::Object ^ sender, Windows::UI::Xaml::RoutedEventArgs ^ e);
|
||||
};
|
||||
} /* namespace CalculatorApp */
|
||||
|
@@ -60,7 +60,6 @@ namespace CalculatorApp
|
||||
/// </summary>
|
||||
App::App()
|
||||
{
|
||||
TraceLogger::GetInstance().LogAppLaunchStart();
|
||||
InitializeComponent();
|
||||
|
||||
m_preLaunched = false;
|
||||
@@ -71,6 +70,8 @@ App::App()
|
||||
// Currently this is bugged so the property is only respected from code-behind.
|
||||
this->HighContrastAdjustment = ApplicationHighContrastAdjustment::None;
|
||||
|
||||
this->Suspending += ref new SuspendingEventHandler(this, &App::OnSuspending);
|
||||
|
||||
#if _DEBUG
|
||||
this->DebugSettings->IsBindingTracingEnabled = true;
|
||||
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>
|
||||
void App::OnLaunched(LaunchActivatedEventArgs ^ args)
|
||||
{
|
||||
TraceLogger::GetInstance().LogWindowLaunched();
|
||||
if (args->PrelaunchActivated)
|
||||
{
|
||||
// If the app got pre-launch activated, then save that state in a flag
|
||||
m_preLaunched = true;
|
||||
TraceLogger::GetInstance().LogAppPrelaunchedBySystem();
|
||||
}
|
||||
OnAppLaunch(args, args->Arguments);
|
||||
}
|
||||
|
||||
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.
|
||||
//#if _DEBUG
|
||||
@@ -307,7 +303,6 @@ void App::OnAppLaunch(IActivatedEventArgs ^ args, String ^ argument)
|
||||
else
|
||||
{
|
||||
// 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
|
||||
if ((UIViewSettings::GetForCurrentView()->UserInteractionMode == UserInteractionMode::Mouse)
|
||||
@@ -319,7 +314,6 @@ void App::OnAppLaunch(IActivatedEventArgs ^ args, String ^ argument)
|
||||
auto newCoreAppView = CoreApplication::CreateNewView();
|
||||
newCoreAppView->Dispatcher->RunAsync(
|
||||
CoreDispatcherPriority::Normal, ref new DispatchedHandler([args, argument, minWindowSize, weak]() {
|
||||
TraceLogger::GetInstance().LogNewWindowCreationBegin(ApplicationView::GetApplicationViewIdForWindow(CoreWindow::GetForCurrentThread()));
|
||||
auto that = weak.Resolve<App>();
|
||||
if (that != nullptr)
|
||||
{
|
||||
@@ -372,13 +366,10 @@ void App::OnAppLaunch(IActivatedEventArgs ^ args, String ^ argument)
|
||||
}
|
||||
}
|
||||
}
|
||||
TraceLogger::GetInstance().LogNewWindowCreationEnd(ApplicationView::GetApplicationViewIdForWindow(CoreWindow::GetForCurrentThread()));
|
||||
}));
|
||||
}
|
||||
else
|
||||
{
|
||||
TraceLogger::GetInstance().LogNewWindowCreationBegin(ApplicationView::GetApplicationViewIdForWindow(CoreWindow::GetForCurrentThread()));
|
||||
|
||||
ActivationViewSwitcher ^ activationViewSwitcher;
|
||||
auto activateEventArgs = dynamic_cast<IViewSwitcherProvider ^>(args);
|
||||
if (activateEventArgs != nullptr)
|
||||
@@ -390,12 +381,10 @@ void App::OnAppLaunch(IActivatedEventArgs ^ args, String ^ argument)
|
||||
{
|
||||
activationViewSwitcher->ShowAsStandaloneAsync(
|
||||
ApplicationView::GetApplicationViewIdForWindow(CoreWindow::GetForCurrentThread()), ViewSizePreference::Default);
|
||||
TraceLogger::GetInstance().LogNewWindowCreationEnd(ApplicationView::GetApplicationViewIdForWindow(CoreWindow::GetForCurrentThread()));
|
||||
TraceLogger::GetInstance().LogPrelaunchedAppActivatedByUser();
|
||||
}
|
||||
else
|
||||
{
|
||||
TraceLogger::GetInstance().LogError(L"Null_ActivationViewSwitcher");
|
||||
TraceLogger::GetInstance().LogError(ViewMode::None, L"App::OnAppLaunch", L"Null_ActivationViewSwitcher");
|
||||
}
|
||||
}
|
||||
// Set the preLaunched flag to false
|
||||
@@ -460,13 +449,17 @@ void App::OnActivated(IActivatedEventArgs ^ args)
|
||||
{
|
||||
if (args->Kind == ActivationKind::Protocol)
|
||||
{
|
||||
TraceLogger::GetInstance().LogWindowActivated();
|
||||
// We currently don't pass the uri as an argument,
|
||||
// and handle any protocol launch as a normal app launch.
|
||||
OnAppLaunch(args, nullptr);
|
||||
}
|
||||
}
|
||||
|
||||
void CalculatorApp::App::OnSuspending(Object ^ sender, SuspendingEventArgs ^ args)
|
||||
{
|
||||
TraceLogger::GetInstance().LogButtonUsage();
|
||||
}
|
||||
|
||||
void App::DismissedEventHandler(SplashScreen ^ sender, Object ^ e)
|
||||
{
|
||||
SetupJumpList();
|
||||
@@ -477,3 +470,5 @@ float App::GetAppWindowHeight()
|
||||
CoreWindow ^ window = CoreWindow::GetForCurrentThread();
|
||||
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.
|
||||
|
||||
//
|
||||
@@ -42,6 +42,8 @@ namespace CalculatorApp
|
||||
void OnAppLaunch(Windows::ApplicationModel::Activation::IActivatedEventArgs ^ args, Platform::String ^ argument);
|
||||
void DismissedEventHandler(Windows::ApplicationModel::Activation::SplashScreen ^ sender, Platform::Object ^ e);
|
||||
void RegisterDependencyProperties();
|
||||
void OnSuspending(Platform::Object ^ sender, Windows::ApplicationModel::SuspendingEventArgs ^ args);
|
||||
|
||||
|
||||
class SafeFrameWindowCreation final
|
||||
{
|
||||
|
@@ -216,7 +216,7 @@
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(IsStoreBuild)' == 'True'">
|
||||
<ClCompile>
|
||||
<AdditionalOptions>/DSEND_TELEMETRY %(AdditionalOptions)</AdditionalOptions>
|
||||
<AdditionalOptions>/DSEND_DIAGNOSTICS %(AdditionalOptions)</AdditionalOptions>
|
||||
</ClCompile>
|
||||
</ItemDefinitionGroup>
|
||||
<PropertyGroup>
|
||||
@@ -849,4 +849,4 @@
|
||||
<Error Condition="!Exists('..\..\packages\Microsoft.WindowsCalculator.PGO.1.0.2\build\native\Microsoft.WindowsCalculator.PGO.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\..\packages\Microsoft.WindowsCalculator.PGO.1.0.2\build\native\Microsoft.WindowsCalculator.PGO.targets'))" />
|
||||
<Error Condition="!Exists('..\..\packages\Microsoft.UI.Xaml.2.1.190405004.2\build\native\Microsoft.UI.Xaml.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\..\packages\Microsoft.UI.Xaml.2.1.190405004.2\build\native\Microsoft.UI.Xaml.targets'))" />
|
||||
</Target>
|
||||
</Project>
|
||||
</Project>
|
||||
|
@@ -15,18 +15,18 @@ using namespace winrt::Windows::UI::ViewManagement;
|
||||
|
||||
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_* 0x00FF000000000000 // Bits 55-48 - system-reserved keywords
|
||||
constexpr int64_t MICROSOFT_KEYWORD_CRITICAL_DATA = 0x0000800000000000; // Bit 47
|
||||
constexpr int64_t MICROSOFT_KEYWORD_MEASURES = 0x0000400000000000; // Bit 46
|
||||
constexpr int64_t MICROSOFT_KEYWORD_TELEMETRY = 0x0000200000000000; // Bit 45
|
||||
constexpr int64_t MICROSOFT_KEYWORD_LEVEL_1 = 0x0000800000000000; // Bit 47
|
||||
constexpr int64_t MICROSOFT_KEYWORD_LEVEL_2 = 0x0000400000000000; // Bit 46
|
||||
constexpr int64_t MICROSOFT_KEYWORD_LEVEL_3 = 0x0000200000000000; // Bit 45
|
||||
constexpr int64_t MICROSOFT_KEYWORD_RESERVED_44 = 0x0000100000000000; // Bit 44 (reserved for future assignment)
|
||||
#else
|
||||
// define all Keyword options as 0 when we do not want to upload app telemetry
|
||||
constexpr int64_t MICROSOFT_KEYWORD_CRITICAL_DATA = 0;
|
||||
constexpr int64_t MICROSOFT_KEYWORD_MEASURES = 0;
|
||||
constexpr int64_t MICROSOFT_KEYWORD_TELEMETRY = 0;
|
||||
// define all Keyword options as 0 when we do not want to upload app diagnostics
|
||||
constexpr int64_t MICROSOFT_KEYWORD_LEVEL_1 = 0;
|
||||
constexpr int64_t MICROSOFT_KEYWORD_LEVEL_2 = 0;
|
||||
constexpr int64_t MICROSOFT_KEYWORD_LEVEL_3 = 0;
|
||||
constexpr int64_t MICROSOFT_KEYWORD_RESERVED_44 = 0;
|
||||
#endif
|
||||
|
||||
@@ -35,7 +35,7 @@ namespace CalculatorApp
|
||||
AppLifecycleLogger::AppLifecycleLogger()
|
||||
: m_appLifecycleProvider(
|
||||
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}
|
||||
{
|
||||
}
|
||||
@@ -59,7 +59,7 @@ namespace CalculatorApp
|
||||
void AppLifecycleLogger::LogAppLifecycleEvent(hstring const& eventName, LoggingFields const& fields) const
|
||||
{
|
||||
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
|
||||
|
||||
|
@@ -31,8 +31,8 @@ namespace CalculatorApp
|
||||
// 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
|
||||
// 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
|
||||
// TraceLoggingKeyword(MICROSOFT_KEYWORD_TELEMETRY) accordingly c) Should accept a variable number of additional data arguments if needed
|
||||
// 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_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 PopulateAppInfo(winrt::Windows::Foundation::Diagnostics::LoggingFields& fields) const;
|
||||
|
||||
|
@@ -35,7 +35,6 @@
|
||||
</DataTemplate>
|
||||
|
||||
<!-- TextBox Styles -->
|
||||
|
||||
<Style TargetType="controls:OverflowTextBlock">
|
||||
<Setter Property="HorizontalAlignment" Value="Stretch"/>
|
||||
<Setter Property="Template">
|
||||
@@ -319,7 +318,7 @@
|
||||
</VisualState>
|
||||
</VisualStateGroup>
|
||||
<!-- Layout specific -->
|
||||
<VisualStateGroup>
|
||||
<VisualStateGroup CurrentStateChanged="OnVisualStateChanged">
|
||||
<VisualState x:Name="Portrait768x1366">
|
||||
<VisualState.StateTriggers>
|
||||
<AdaptiveTrigger MinWindowHeight="1366" MinWindowWidth="768"/>
|
||||
@@ -944,7 +943,6 @@
|
||||
</Border.Resources>
|
||||
|
||||
<Pivot x:Name="DockPivot"
|
||||
SelectionChanged="DockPivot_SelectionChanged"
|
||||
TabIndex="5"
|
||||
Tapped="DockPanelTapped"
|
||||
Template="{StaticResource DockPanelTemplate}">
|
||||
|
@@ -450,13 +450,11 @@ void Calculator::OnHistoryItemClicked(_In_ HistoryItemViewModel ^ e)
|
||||
unsigned int tokenSize;
|
||||
assert(e->GetTokens() != nullptr);
|
||||
e->GetTokens()->GetSize(&tokenSize);
|
||||
TraceLogger::GetInstance().LogHistoryItemLoadBegin();
|
||||
Model->SetHistoryExpressionDisplay(e->GetTokens(), e->GetCommands());
|
||||
Model->SetExpressionDisplay(e->GetTokens(), e->GetCommands());
|
||||
Model->SetPrimaryDisplay(e->Result->Data(), false);
|
||||
Model->IsFToEEnabled = false;
|
||||
|
||||
TraceLogger::GetInstance().LogHistoryItemLoadEnd(tokenSize);
|
||||
CloseHistoryFlyout();
|
||||
this->Focus(::FocusState::Programmatic);
|
||||
}
|
||||
@@ -468,8 +466,6 @@ void Calculator::HistoryFlyout_Opened(_In_ Object ^ sender, _In_ Object ^ args)
|
||||
m_IsLastFlyoutHistory = true;
|
||||
EnableControls(false);
|
||||
AutomationProperties::SetName(HistoryButton, m_closeHistoryFlyoutAutomationName);
|
||||
TraceLogger::GetInstance().LogHistoryFlyoutOpenEnd(Model->HistoryVM->ItemSize);
|
||||
TraceLogger::GetInstance().LogHistoryBodyOpened();
|
||||
}
|
||||
|
||||
void Calculator::HistoryFlyout_Closing(_In_ FlyoutBase ^ sender, _In_ FlyoutBaseClosingEventArgs ^ args)
|
||||
@@ -526,7 +522,6 @@ void Calculator::ToggleHistoryFlyout(Object ^ /*parameter*/)
|
||||
}
|
||||
else
|
||||
{
|
||||
TraceLogger::GetInstance().LogHistoryFlyoutOpenBegin(Model->HistoryVM->ItemSize);
|
||||
HistoryFlyout->Content = m_historyList;
|
||||
m_historyList->RowHeight = NumpadPanel->ActualHeight;
|
||||
FlyoutBase::ShowAttachedFlyout(HistoryButton);
|
||||
@@ -545,7 +540,6 @@ void Calculator::ToggleMemoryFlyout()
|
||||
}
|
||||
else
|
||||
{
|
||||
TraceLogger::GetInstance().LogMemoryFlyoutOpenBegin(Model->MemorizedNumbers->Size);
|
||||
MemoryFlyout->Content = GetMemory();
|
||||
m_memory->RowHeight = NumpadPanel->ActualHeight;
|
||||
FlyoutBase::ShowAttachedFlyout(MemoryButton);
|
||||
@@ -555,13 +549,11 @@ void Calculator::ToggleMemoryFlyout()
|
||||
|
||||
void Calculator::OnMemoryFlyoutOpened(_In_ Object ^ sender, _In_ Object ^ args)
|
||||
{
|
||||
TraceLogger::GetInstance().LogMemoryFlyoutOpenEnd(Model->MemorizedNumbers->Size);
|
||||
m_IsLastFlyoutMemory = true;
|
||||
m_IsLastFlyoutHistory = false;
|
||||
m_fIsMemoryFlyoutOpen = true;
|
||||
AutomationProperties::SetName(MemoryButton, m_closeMemoryFlyoutAutomationName);
|
||||
EnableControls(false);
|
||||
TraceLogger::GetInstance().LogMemoryBodyOpened();
|
||||
}
|
||||
|
||||
void Calculator::OnMemoryFlyoutClosing(_In_ FlyoutBase ^ sender, _In_ FlyoutBaseClosingEventArgs ^ args)
|
||||
@@ -700,14 +692,9 @@ void Calculator::OnMemoryAccessKeyInvoked(_In_ UIElement ^ sender, _In_ AccessKe
|
||||
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)
|
||||
{
|
||||
TraceLogger::GetInstance().LogHistoryBodyOpened();
|
||||
}
|
||||
else
|
||||
{
|
||||
TraceLogger::GetInstance().LogMemoryBodyOpened();
|
||||
}
|
||||
auto mode = IsStandard ? ViewMode::Standard : IsScientific ? ViewMode::Scientific : ViewMode::Programmer;
|
||||
auto state = std::wstring(e->NewState->Name->Begin());
|
||||
TraceLogger::GetInstance().LogVisualStateChanged(mode, state);
|
||||
}
|
||||
|
@@ -138,6 +138,6 @@ public
|
||||
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 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.
|
||||
if ((Model->IsBitFlipChecked) && Model->IsProgrammer)
|
||||
{
|
||||
TraceLogger::GetInstance().LogBitFlipUsed();
|
||||
|
||||
auto flipButton = static_cast<FlipButtons ^>(sender);
|
||||
Model->ButtonPressed->Execute(flipButton->ButtonId);
|
||||
}
|
||||
|
@@ -70,7 +70,6 @@
|
||||
Grid.Column="1"
|
||||
Style="{StaticResource ProgKeypadRadioButtonStyle}"
|
||||
AutomationProperties.AutomationId="bitFlip"
|
||||
Checked="ShowBitFlip"
|
||||
Content=""
|
||||
IsChecked="{x:Bind Model.IsBitFlipChecked, Mode=TwoWay}"/>
|
||||
</Grid>
|
||||
|
@@ -6,6 +6,7 @@
|
||||
#include "CalcViewModel/Common/TraceLogger.h"
|
||||
|
||||
using namespace CalculatorApp;
|
||||
using namespace CalculatorApp::Common;
|
||||
using namespace CalculatorApp::ViewModel;
|
||||
using namespace Platform;
|
||||
using namespace Windows::Foundation;
|
||||
@@ -26,14 +27,8 @@ CalculatorProgrammerDisplayPanel::CalculatorProgrammerDisplayPanel()
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
void CalculatorProgrammerDisplayPanel::ShowBitFlip(Object ^ sender, RoutedEventArgs ^ e)
|
||||
{
|
||||
TraceLogger::GetInstance().LogBitFlipPaneClicked();
|
||||
}
|
||||
|
||||
void CalculatorProgrammerDisplayPanel::OnBitLengthButtonPressed(Object ^ parameter)
|
||||
{
|
||||
TraceLogger::GetInstance().LogBitLengthButtonUsed(ApplicationView::GetApplicationViewIdForWindow(CoreWindow::GetForCurrentThread()));
|
||||
String ^ buttonId = parameter->ToString();
|
||||
|
||||
QwordButton->Visibility = ::Visibility::Collapsed;
|
||||
|
@@ -38,7 +38,7 @@ CalculatorProgrammerOperators::CalculatorProgrammerOperators()
|
||||
|
||||
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)
|
||||
{
|
||||
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)
|
||||
{
|
||||
TraceLogger::GetInstance().LogRadixButtonUsed(ApplicationView::GetApplicationViewIdForWindow(CoreWindow::GetForCurrentThread()));
|
||||
TraceLogger::GetInstance().UpdateButtonUsage(NumbersAndOperatorsEnum::DecButton, ViewMode::Programmer);
|
||||
if (Model)
|
||||
{
|
||||
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)
|
||||
{
|
||||
TraceLogger::GetInstance().LogRadixButtonUsed(ApplicationView::GetApplicationViewIdForWindow(CoreWindow::GetForCurrentThread()));
|
||||
TraceLogger::GetInstance().UpdateButtonUsage(NumbersAndOperatorsEnum::OctButton, ViewMode::Programmer);
|
||||
if (Model)
|
||||
{
|
||||
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)
|
||||
{
|
||||
TraceLogger::GetInstance().LogRadixButtonUsed(ApplicationView::GetApplicationViewIdForWindow(CoreWindow::GetForCurrentThread()));
|
||||
TraceLogger::GetInstance().UpdateButtonUsage(NumbersAndOperatorsEnum::BinButton, ViewMode::Programmer);
|
||||
if (Model)
|
||||
{
|
||||
Model->SwitchProgrammerModeBase(RADIX_TYPE::BIN_RADIX);
|
||||
|
@@ -37,7 +37,6 @@ CalculatorScientificAngleButtons::CalculatorScientificAngleButtons()
|
||||
|
||||
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)
|
||||
@@ -48,7 +47,6 @@ void CalculatorScientificAngleButtons::FToEButton_Toggled(_In_ Object ^ sender,
|
||||
|
||||
void CalculatorApp::CalculatorScientificAngleButtons::OnAngleButtonPressed(_In_ Object ^ commandParameter)
|
||||
{
|
||||
TraceLogger::GetInstance().LogAngleButtonUsed(ApplicationView::GetApplicationViewIdForWindow(CoreWindow::GetForCurrentThread()));
|
||||
String ^ buttonId = static_cast<String ^>(commandParameter);
|
||||
|
||||
DegreeButton->Visibility = ::Visibility::Collapsed;
|
||||
|
@@ -358,7 +358,7 @@
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<VisualStateManager.VisualStateGroups>
|
||||
<VisualStateGroup>
|
||||
<VisualStateGroup CurrentStateChanged="OnVisualStateChanged">
|
||||
<VisualState x:Name="LeftAlignedLayout">
|
||||
<VisualState.StateTriggers>
|
||||
<AdaptiveTrigger MinWindowWidth="480"/>
|
||||
|
@@ -103,7 +103,7 @@ void DateCalculator::FromDate_DateChanged(_In_ CalendarDatePicker ^ sender, _In_
|
||||
{
|
||||
auto dateCalcViewModel = safe_cast<DateCalculatorViewModel ^>(this->DataContext);
|
||||
dateCalcViewModel->FromDate = e->NewDate->Value;
|
||||
TraceLogger::GetInstance().LogDateDifferenceModeUsed(ApplicationView::GetApplicationViewIdForWindow(CoreWindow::GetForCurrentThread()));
|
||||
TraceLogger::GetInstance().LogDateCalculationModeUsed(false /* AddSubtractMode */);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -117,7 +117,7 @@ void DateCalculator::ToDate_DateChanged(_In_ CalendarDatePicker ^ sender, _In_ C
|
||||
{
|
||||
auto dateCalcViewModel = safe_cast<DateCalculatorViewModel ^>(this->DataContext);
|
||||
dateCalcViewModel->ToDate = e->NewDate->Value;
|
||||
TraceLogger::GetInstance().LogDateDifferenceModeUsed(ApplicationView::GetApplicationViewIdForWindow(CoreWindow::GetForCurrentThread()));
|
||||
TraceLogger::GetInstance().LogDateCalculationModeUsed(false /* AddSubtractMode */);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -131,8 +131,7 @@ void DateCalculator::AddSubtract_DateChanged(_In_ CalendarDatePicker ^ sender, _
|
||||
{
|
||||
auto dateCalcViewModel = safe_cast<DateCalculatorViewModel ^>(this->DataContext);
|
||||
dateCalcViewModel->StartDate = e->NewDate->Value;
|
||||
TraceLogger::GetInstance().LogDateAddSubtractModeUsed(
|
||||
ApplicationView::GetApplicationViewIdForWindow(CoreWindow::GetForCurrentThread()), dateCalcViewModel->IsAddMode);
|
||||
TraceLogger::GetInstance().LogDateCalculationModeUsed(true /* AddSubtractMode */);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -143,8 +142,11 @@ void DateCalculator::AddSubtract_DateChanged(_In_ CalendarDatePicker ^ sender, _
|
||||
void CalculatorApp::DateCalculator::OffsetValue_Changed(_In_ Platform::Object ^ sender, _In_ SelectionChangedEventArgs ^ e)
|
||||
{
|
||||
auto dateCalcViewModel = safe_cast<DateCalculatorViewModel ^>(this->DataContext);
|
||||
TraceLogger::GetInstance().LogDateAddSubtractModeUsed(
|
||||
ApplicationView::GetApplicationViewIdForWindow(CoreWindow::GetForCurrentThread()), dateCalcViewModel->IsAddMode);
|
||||
// do not log diagnostics for no-ops and initialization of combo boxes
|
||||
if (dateCalcViewModel->DaysOffset != 0 || dateCalcViewModel->MonthsOffset != 0 || dateCalcViewModel->YearsOffset != 0)
|
||||
{
|
||||
TraceLogger::GetInstance().LogDateCalculationModeUsed(true /* AddSubtractMode */);
|
||||
}
|
||||
}
|
||||
|
||||
void DateCalculator::OnCopyMenuItemClicked(_In_ Object ^ sender, _In_ RoutedEventArgs ^ e)
|
||||
@@ -232,3 +234,9 @@ void DateCalculator::AddSubtractOption_Checked(_In_ Object ^ sender, _In_ Routed
|
||||
{
|
||||
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 CalendarFlyoutClosed(_In_ Platform::Object ^ sender, _In_ Platform::Object ^ e);
|
||||
void RaiseLiveRegionChangedAutomationEvent(_In_ bool isDateDiffMode);
|
||||
void OnVisualStateChanged(Platform::Object ^ sender, Windows::UI::Xaml::VisualStateChangedEventArgs ^ e);
|
||||
|
||||
Windows::Foundation::EventRegistrationToken m_dateCalcOptionChangedEventToken;
|
||||
|
||||
};
|
||||
}
|
||||
|
@@ -253,7 +253,6 @@ void MainPage::OnPageLoaded(_In_ Object ^, _In_ RoutedEventArgs ^ args)
|
||||
CoreDispatcherPriority::Normal, ref new DispatchedHandler([]() {
|
||||
if (TraceLogger::GetInstance().UpdateWindowIdLog(ApplicationView::GetApplicationViewIdForWindow(CoreWindow::GetForCurrentThread())))
|
||||
{
|
||||
TraceLogger::GetInstance().LogAppLaunchComplete();
|
||||
AppLifecycleLogger::GetInstance().LaunchUIResponsive();
|
||||
AppLifecycleLogger::GetInstance().LaunchVisibleComplete();
|
||||
}
|
||||
|
@@ -341,7 +341,7 @@
|
||||
</VisualState.Setters>
|
||||
</VisualState>
|
||||
</VisualStateGroup>
|
||||
<VisualStateGroup x:Name="Sizing">
|
||||
<VisualStateGroup x:Name="Sizing" CurrentStateChanged="OnVisualStateChanged">
|
||||
<VisualState x:Name="Wide">
|
||||
<VisualState.StateTriggers>
|
||||
<AdaptiveTrigger MinWindowHeight="768" MinWindowWidth="1280"/>
|
||||
|
@@ -6,6 +6,7 @@
|
||||
|
||||
#include "pch.h"
|
||||
#include "UnitConverter.xaml.h"
|
||||
#include "CalcViewModel/Common/TraceLogger.h"
|
||||
#include "CalcViewModel/UnitConverterViewModel.h"
|
||||
#include "Controls/CalculationResult.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)
|
||||
{
|
||||
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
|
||||
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;
|
||||
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)
|
||||
{
|
||||
LogOnViewClosed(CoreWindow::GetForCurrentThread());
|
||||
TraceLogger::GetInstance().UpdateWindowCount();
|
||||
auto parent = m_parent.Resolve<App>();
|
||||
if (parent != nullptr)
|
||||
{
|
||||
@@ -128,7 +128,6 @@ namespace CalculatorApp
|
||||
|
||||
void WindowFrameService::OnClosed(_In_ CoreWindow ^ sender, _In_ CoreWindowEventArgs ^ args)
|
||||
{
|
||||
LogOnViewClosed(sender);
|
||||
auto parent = m_parent.Resolve<App>();
|
||||
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)
|
||||
{
|
||||
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.
|
||||
|
||||
#pragma once
|
||||
@@ -47,8 +47,6 @@ public
|
||||
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 LogOnViewClosed(_In_ Windows::UI::Core::CoreWindow ^ coreWindow);
|
||||
|
||||
private:
|
||||
Platform::Agile<Windows::UI::Core::CoreWindow ^> m_currentWindow;
|
||||
Platform::Agile<Windows::UI::Core::CoreDispatcher ^> m_coreDispatcher;
|
||||
|
Reference in New Issue
Block a user