/// <summary> /// Executes the given method with a return value. /// </summary> /// <remarks> /// This method is used to execute all method calls that return a value that /// 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(GenereicVoidMethodDelegate)"/> protected static object ExecuteMethod(GenereicReturnMethodDelegate p_gmdMethod) { try { return(p_gmdMethod()); } catch (Exception e) { m_strLastError = e.Message; if (e.InnerException != null) { m_strLastError += "\n" + e.InnerException.Message; } } return(null); }
/// <summary> /// Executes the given method with a return value. /// </summary> /// <remarks> /// This method is used to execute all method calls that return a value that /// 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(GenereicVoidMethodDelegate)"/> protected static object ExecuteMethod(GenereicReturnMethodDelegate p_gmdMethod) { try { return p_gmdMethod(); } catch (Exception e) { m_strLastError = e.Message; if (e.InnerException != null) { m_strLastError += "\n" + e.InnerException.Message; } } return null; }
/// <summary> /// Executes the given method with a return value. /// </summary> /// <remarks> /// This method is used to execute all method calls that return a value that /// 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(GenereicVoidMethodDelegate p_gmdMethod)"/> private static object ExecuteMethod(GenereicReturnMethodDelegate p_gmdMethod) { try { return p_gmdMethod(); } catch (Exception e) { string strError = e.Message; if (e.InnerException != null) strError += "\n" + e.InnerException.Message; Warn(strError); } return null; }