1: public class ShellApplication : SmartClientApplication<ShellWindow, ShellPresenter>
2: {
3: #region · Singleton Instance ·
4:
5: public static readonly ShellApplication Instance = new ShellApplication();
6:
7: #endregion
8:
9: #region · Constructors ·
10:
11: private ShellApplication() : base()
12: {
13: }
14:
15: #endregion
16:
17: #region · Protected Methods ·
18:
19: protected override IModuleEnumerator GetModuleEnumerator()
20: {
21: return new StaticModuleEnumerator().AddModule(typeof(ModuloConfiguracion));
22: }
23:
24: #endregion
25:
26: #region · Unhandled Exception ·
27:
28: public void OnUnhandledException(object sender, UnhandledExceptionEventArgs e)
29: {
30: Exception ex = e.ExceptionObject as Exception;
31:
32: if (ex != null)
33: {
34: // MessageBox.Show(this.BuildExceptionString(ex));
35: throw ex;
36: }
37: else
38: {
39: throw new Exception("An Exception has occured, unable to get details");
40: // MessageBox.Show("An Exception has occured, unable to get details");
41: }
42:
43: Environment.Exit(0);
44: }
45:
46: private string BuildExceptionString(Exception exception)
47: {
48: StringBuilder messageBuilder = new StringBuilder();
49:
50: messageBuilder.AppendFormat("{0}{1}{2}", exception.Message, Environment.NewLine, exception.StackTrace);
51:
52: while (exception.InnerException != null)
53: {
54: messageBuilder.Append(BuildInnerExceptionString(exception.InnerException));
55:
56: exception = exception.InnerException;
57: }
58:
59: return messageBuilder.ToString();
60: }
61:
62: private string BuildInnerExceptionString(Exception innerException)
63: {
64: StringBuilder messageBuilder = new StringBuilder();
65:
66: messageBuilder.AppendFormat("{0}{1}", Environment.NewLine, " InnerException ");
67: messageBuilder.AppendFormat("{0}{1}{2}{3}", Environment.NewLine, innerException.Message, Environment.NewLine, innerException.StackTrace);
68:
69: return messageBuilder.ToString();
70: }
71:
72: #endregion
73: }