/// <summary> /// Executes the given void method. /// </summary> /// <remarks> /// This method is used to execute all void method calls the script needs to make. /// This allows for centralized error handling. /// /// It should be noted that using delegates does engender a very slight performance hit, /// but given the nature of this application (more precisely, that this is a single-user /// application) there should not be any noticable difference. /// </remarks> /// <param name="p_gmdMethod">The method to execute.</param> /// <see cref="ExecuteMethod(GenereicReturnMethodDelegate)"/> protected static void ExecuteMethod(GenereicVoidMethodDelegate p_gmdMethod) { try { p_gmdMethod(); } catch (Exception e) { m_strLastError = e.Message; if (e.InnerException != null) { m_strLastError += "\n" + e.InnerException.Message; } } }
/// <summary> /// Executes the given void method. /// </summary> /// <remarks> /// This method is used to execute all void method calls the script needs to make. /// This allows for centralized error handling. /// /// It should be noted that using delegates does engender a very slight performance hit, /// but given the nature of this application (more precisely, that this is a single-user /// application) there should not be any noticable difference. /// </remarks> /// <param name="p_gmdMethod">The method to execute.</param> /// <see cref="ExecuteMethod(GenereicReturnMethodDelegate p_gmdMethod)"/> private static void ExecuteMethod(GenereicVoidMethodDelegate p_gmdMethod) { try { p_gmdMethod(); } catch (Exception e) { string strError = e.Message; if (e.InnerException != null) strError += "\n" + e.InnerException.Message; Warn(strError); } }