} // ForceUiCulture private static void ForceUiCulture(string culture) { if (culture == null) { return; } culture = culture.Trim(); if (culture == string.Empty) { return; } try { Thread.CurrentThread.CurrentUICulture = new System.Globalization.CultureInfo(culture); } catch (Exception ex) { MyApplication.HandleException(null, Properties.InvariantTexts.ExceptionForceUiCulture, ex); } // try-catch } // ForceUiCulture
} // DoBackgroundWork protected override bool BackgroundWorkCompleted(System.ComponentModel.RunWorkerCompletedEventArgs result) { if (result.Error != null) { MyApplication.HandleException(null, Properties.Texts.MyAppCtxExceptionCaption, Properties.Texts.MyAppCtxExceptionMsg, result.Error); ExitCode = -1; return(false); } // if if (result.Cancelled) { ExitCode = -2; return(false); } // if var initResult = result.Result as InitializationResult; if ((initResult != null) && (!initResult.IsOk)) { if (initResult.InnerException == null) { DisplayMessage(initResult.Caption ?? Properties.Texts.MyAppCtxInitializationErrorCaption, initResult.Message, MessageBoxIcon.Exclamation, false); } else { DisplayException(initResult.Caption ?? Properties.Texts.MyAppCtxInitializationErrorCaption, initResult.Message, MessageBoxIcon.Error, false, false, initResult.InnerException); } // if-else ExitCode = -3; return(false); } // if DisplayProgress(Properties.Texts.MyAppCtxStarting, false); return(true); } // BackgroundWorkCompleted
} // HandleException internal static void HandleException(object sender, HandleExceptionEventArgs e) { MyApplication.HandleException(e.OwnerForm, e.Caption, e.Message, e.Exception); } // HandleException
} // HandleException internal static void HandleException(Form form, ExceptionEventData ex) { MyApplication.HandleException(form, ex.Caption, ex.Message, ex.Exception); } // HandleException
} // ShowEpgList #endregion #region Auxiliary methods: common private void ExceptionHandler(string message, Exception ex) { MyApplication.HandleException(this, message, ex); } // ExceptionHandler
protected override void ExceptionHandler(CommonBaseForm form, ExceptionEventData ex) { MyApplication.HandleException(form, ex); } // ExceptionHandler
} // DoDisplayMessage protected override void DoDisplayException(Form splashScreen, string caption, string message, MessageBoxIcon icon, Exception exception) { MyApplication.HandleException(splashScreen, caption, message ?? Properties.Texts.MyAppCtxExceptionMsg, icon, exception); } // DoDisplayException
} // Main static void Application_ThreadException(object sender, System.Threading.ThreadExceptionEventArgs e) { MyApplication.HandleException(null, e.Exception); } // Application_ThreadException