public static bool ReportAlert(this ITask source, eMessageGrade grade, object userState, string description) { TaskAlertEventArgs e = new TaskAlertEventArgs(grade, userState, description); source.ReportAlert(e); return(e.IsCancel); }
public static bool ReportException(this ITask source, Exception ex, string description) { TaskAlertEventArgs e = new TaskAlertEventArgs { Description = description, Grade = eMessageGrade.Exception, UserState = ex, }; source.ReportAlert(e); return(e.IsCancel); }
public static bool ReportWarn(this ITask source, string description, string catalog = null, TaskAlertMetadata meta = null) { TaskAlertEventArgs e = new TaskAlertEventArgs { Description = description, Grade = eMessageGrade.Warn, UserState = catalog.IsNullOrBlank() ? null : new TaskAlertUserStateCatalog() { Catalog = catalog }, Metadata = meta, }; source.ReportAlert(e); return(e.IsCancel); }
private void ReportUnhandledException(Exception ex) { string msg = ex.Message; TaskAlertEventArgs e = new TaskAlertEventArgs { Description = msg, Grade = eMessageGrade.Exception, UserState = ex, }; OnAlert(e); if (Alert != null) { Alert(this, e); } if (!AutoHandleException) { throw ex; } }
public void ReportAlert(TaskAlertEventArgs e) { TryStop(); OnAlert(e); if (Alert != null) { Alert(this, e); } //if (e.Grade < eMessageGrade.Exception) // return; //string msg = string.Format(LanguageAttribute.GetLanguage("lang670300"), e.UserState); //Tracker.WriteLine(new TrackerObject() //{ // Description = msg, // EventID = 670300, // Grade = e.Grade, // Source = this.GetType().FullName //}); }
protected virtual void OnAlert(TaskAlertEventArgs e) { }
protected virtual void OnAlert(TaskDelegateMetadata meta, TaskAlertEventArgs alert) { throw new NotImplementedException(); }