public static void Throw(String message, Exception inner, bool canReport = true)
{
Thread.CurrentThread.CurrentCulture = CultureInfo.CreateSpecificCulture("en-US");
Thread.CurrentThread.CurrentUICulture = new CultureInfo("en-US");
var handled = inner as HandledException;
var criticalHandled = handled != null && handled.IsCritical;
// Use the exception message if it is of type HandledException or a message wasn't passed through
// If it is a HandledException, only provide the option to report if the exception is critical
var dialog = new YesNoDialog("ERROR:\n" + (handled != null ? inner.Message : (message ?? inner.Message)),
(handled == null && canReport) || criticalHandled ? "Report" : "Close",
(handled == null && canReport) || criticalHandled ? "Close" : null)
{
ResponseCallback = result =>
{
// Log exception only if 'Report' was chosen, and the exception was critical
if (result && canReport)
BugSenseHandler.Instance.SendExceptionAsync(inner);
ClearExtras();
}
};
dialog.Show();
}