Nextrek
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
namespace SLP
{
public partial class App : Application
{
public App()
{
this.Startup += this.Application_Startup;
this.Exit += this.Application_Exit;
this.UnhandledException += this.Application_UnhandledException;
InitializeComponent();
}
private void Application_Startup(object sender, StartupEventArgs e)
{
this.RootVisual = new MainPage();
}
private void Application_Exit(object sender, EventArgs e)
{
}
private void Application_UnhandledException(object sender, ApplicationUnhandledExceptionEventArgs e)
{
// Se l'applicazione è in esecuzione all'esterno del debugger, segnalare l'eccezione mediante
// il meccanismo di eccezioni del browser. In IE verrà visualizzato un messaggio di avviso di colore giallo
// un'icona nella barra di stato e in Firefox verrà visualizzato un errore di script.
if (!System.Diagnostics.Debugger.IsAttached)
{
// NOTA: in questo modo sarà possibile continuare l'esecuzione di un'applicazione dopo la generazione di un'eccezione
// ma non gestita.
// Per le applicazioni di produzione la gestione degli errori deve essere sostituita da un meccanismo che
// segnala l'errore al sito Web e interrompe l'applicazione.
e.Handled = true;
Deployment.Current.Dispatcher.BeginInvoke(delegate { ReportErrorToDOM(e); });
}
}
private void ReportErrorToDOM(ApplicationUnhandledExceptionEventArgs e)
{
try
{
string errorMsg = e.ExceptionObject.Message + e.ExceptionObject.StackTrace;
errorMsg = errorMsg.Replace('"', '\'').Replace("\r\n", @"\n");
System.Windows.Browser.HtmlPage.Window.Eval("throw new Error(\"Unhandled Error in Silverlight Application " + errorMsg + "\");");
}
catch (Exception)
{
}
}
}
}
|
Revision |
Author |
Commited |
Message |
9
|
DRuega
|
Mon 06 May, 2013 21:54:02 +0000 |
|