Permalink
Browse files

Improving statistics & crash reports.

  • Loading branch information...
1 parent 4503cd9 commit 7513140318abb1f30d853dd00ef8749a370f0700 @thesourcerer thesourcerer committed Apr 14, 2012
@@ -114,6 +114,13 @@ private MenuItem CreateMenuItem (string header)
private void OptionSelected (AlternativeRoutesPageViewModel.OptionSelectedEventArgs.Options selectedOption)
{
+
+ //Report statistics:
+ string optionString = selectedOption.ToString();
+ string optionName = optionString.Substring(optionString.LastIndexOf(".") + 1);
+ WebStats.ReportWebStatEventDetailsAsync("AlternativeRoutes", optionName);
+
+
ViewModel.NotifyOptionSelected(selectedOption, (currentItem == null) ? 0 : currentItem.ContextPointer);
if (selectedOption != AlternativeRoutesPageViewModel.OptionSelectedEventArgs.Options.Cancel)
{
View
@@ -125,7 +125,8 @@ private void RootFrame_NavigationFailed(object sender, NavigationFailedEventArgs
// Code to execute on Unhandled Exceptions
private void Application_UnhandledException(object sender, ApplicationUnhandledExceptionEventArgs e)
- {
+ {
+
if (System.Diagnostics.Debugger.IsAttached)
{
// An unhandled exception has occurred; break into the debugger
@@ -134,7 +135,19 @@ private void Application_UnhandledException(object sender, ApplicationUnhandledE
if (!(e.ExceptionObject is InvalidProgramException))
{
- MessageBoxResult result = MessageBox.Show("Waze crashed to to an unexpected exception. Please press OK to send an error report to the developers",
+ // We need to keep the UI Alive for Azure reporting to function (Library limitation)
+ e.Handled = true;
+
+ // Report Crash Event to Azure (Anonymous)
+ WebStats.ReportWebStatCrash(e.ExceptionObject.GetType().Name, e.ExceptionObject.ToString());
+
+ //Ask the user to report more info via email, so we can contact him if needed.
+ MessageBoxResult result = MessageBox.Show("Waze crashed to to an unexpected exception." + Environment.NewLine +
+ "Please press OK to send an error report to the developers." + Environment.NewLine +
+
+ // Since we are not terminating any more, let the user know it is best to restart the app.
+ "Notice: Waze may not function correctly untill restarted!",
+
"Unexpected error", MessageBoxButton.OKCancel);
if (result == MessageBoxResult.OK)
@@ -144,8 +157,10 @@ private void Application_UnhandledException(object sender, ApplicationUnhandledE
emailComposer.Subject = string.Format("Waze " + GamePage.get().GetAppVersion() + "Lang: " + LanguageResources.Instance.CurrentLanguage + " crashed due to {0} exception", e.ExceptionObject.GetType());
emailComposer.Body = e.ExceptionObject.ToString();
emailComposer.Show();
- Thread.Sleep(30000);
+ //Thread.Sleep(30000);
}
+
+
}
}
@@ -93,6 +93,8 @@ private void StartCountdownThread ()
private void DriveButton_Click(object sender, RoutedEventArgs e)
{
+
+
CloseDialog(NavigateResultControlViewModel.DialogClosingEventArgs.ClosingActions.Drive);
}
@@ -103,6 +105,11 @@ private void AlternativesButton_Click(object sender, RoutedEventArgs e)
private void CloseDialog (NavigateResultControlViewModel.DialogClosingEventArgs.ClosingActions action)
{
+ //Report statistics:
+ string actionString = action.ToString();
+ string actionName = actionString.Substring(actionString.LastIndexOf(".") + 1);
+ WebStats.ReportWebStatEventAsync(actionName);
+
lock (viewModel)
{
countdownThread = null;
@@ -32,6 +32,6 @@
//
// You can specify all the values or you can default the Revision and Build Numbers
// by using the '*' as shown below:
-[assembly: AssemblyVersion("0.9.9.3")]
-[assembly: AssemblyFileVersion("0.9.9.3")]
+[assembly: AssemblyVersion("0.9.9.4")]
+[assembly: AssemblyFileVersion("0.9.9.4")]
[assembly: NeutralResourcesLanguageAttribute("en-US")]
@@ -95,6 +95,9 @@ private void ButtonCheckIn_Click(object sender, RoutedEventArgs e)
private void DoCallBack(string callbackName)
{
+
+ WebStats.ReportWebStatEventDetailsAsync("Report", callbackName);
+
foreach (WazeMenuItem menuItem in miniMenuItems)
{
if (menuItem.text == callbackName || menuItem.text == LanguageResources.Instance.Translate(callbackName))
@@ -47,6 +47,7 @@ protected override void OnNavigatedTo(NavigationEventArgs e)
private void LogInButton_Click(object sender, RoutedEventArgs e)
{
+ WebStats.ReportWebStatEventAsync("Login");
this.pageContext.OnSignin(this.UsernameTexBox.Text, this.PasswordBox.Password);
}
}
@@ -73,6 +73,10 @@ public void ShowErrorMessage (string title, string message)
AddressResults = new ObservableCollection<SingleSearchResultsPivotPageContext.SearchResult>(addressResults),
LocalSearchResults = new ObservableCollection<SingleSearchResultsPivotPageContext.SearchResult>(localSearchResults),
};
+
+ //Report search results stats
+ WebStats.ReportWebStatEventDetailsAsync("Search Complete", "Address count: " + addressResults.Count() + " Local count: " + localSearchResults.Count());
+
NavigationService.Navigate<SingleSearchResultsPivotPage>(searchResultsPageContext);
}
@@ -160,6 +164,18 @@ private void SavedLocationsButton_Click(object sender, RoutedEventArgs e)
private void PerformSearch ()
{
+ #region Crash Test Easter Egg
+
+ // Easter egg to intentionally crash waze - for testing
+ if (SearchTextBox.Text.Contains("Crash Waze"))
+ {
+ throw new Exception("Waze Crash Test");
+ }
+
+ #endregion Crash Test Easter Egg
+
+ WebStats.ReportWebStatEventAsync("Search");
+
InProgressGrid.Visibility = System.Windows.Visibility.Visible;
SelectAction(ActionType.SingleSearch);
}
@@ -153,6 +153,11 @@ private void InputPopupDone (bool result)
private void OptionSelected(SingleSearchResultsPivotPageContext.SearchOption searchOption)
{
+ //Report statistics:
+ string optionString = searchOption.ToString();
+ string optionName = optionString.Substring(optionString.LastIndexOf(".") + 1);
+ WebStats.ReportWebStatEventDetailsAsync("SearchOption", optionName);
+
// Call the callback to start the operation
PageContext.OnSearchOptionSelected(selectedResult.ReferenceIndex, searchOption, InputTextBox.Text);
View
@@ -2977,11 +2977,7 @@ public static void NOPH_SetSystemLanguage (int i_langugae)
// And report stats
- // This should not run while running in the emulator
- if (!(Microsoft.Devices.Environment.DeviceType == Microsoft.Devices.DeviceType.Emulator))
- {
- WebStats.ReportWebStat();
- }
+ WebStats.ReportWebStatEventAsync("Open");
}
}
@@ -3240,6 +3236,9 @@ public static void NOPH_EditBoxCameraScreen_showEditBox(int __label, int __in_te
};
pageContext.OnListItemSelected += (listItem, menuItem) =>
{
+ // Report stats on Generic selection type (no PII transferred!).
+ WebStats.ReportWebStatEventDetailsAsync("Generic List Selection",title);
+
int offset = listItem.ReferenceIndex * 4;
int menuOffset = menuItem.ReferenceIndex * 4;
UIWorker.addUIEvent(in_action_callback, labels_addr + offset, values_addr + offset, menu_values_addr + menuOffset, context_addr, true);
@@ -3494,7 +3493,9 @@ public static void NOPH_SettingsDialog_showDialog (int all_settings_addr, int is
// Set the callback
viewModel.OnSettingsSaved += (sender, args) =>
- {
+ {
+ WebStats.ReportWebStatEventAsync("Save Settings");
+
// Save the settings
currentPtr = all_settings_addr;
for (int i = 0; i < (int)SettingsPageViewModel.Settings.SettingsMaxValue; i++)
Oops, something went wrong.

0 comments on commit 7513140

Please sign in to comment.