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); }
protected void RaiseAlert(PropertyDescriptor pd, eMessageGrade grade, string description) { pd.Designer.Dispatcher.Invoke(new Action(() => { pd.Grade = grade; pd.DescriptionState = description; //switch (grade) //{ // case eMessageGrade.Warn: // pd.ImageState = BitmapFrame.Create(new Uri( // "pack://application:,,,/YuLinTu.Resources;component/Images/16/Warning.png")); // break; // case eMessageGrade.Error: // case eMessageGrade.Exception: // pd.ImageState = BitmapFrame.Create(new Uri( // "pack://application:,,,/YuLinTu.Resources;component/Images/16/Error.png")); // break; // case eMessageGrade.Infomation: // default: // pd.ImageState = description.IsNullOrBlank() ? // BitmapFrame.Create(new Uri( // "pack://application:,,,/YuLinTu.Resources;component/Images/16/Success.png")) : // BitmapFrame.Create(new Uri( // "pack://application:,,,/YuLinTu.Resources;component/Images/16/Information.png")); // break; //} pd.PropertyGrid.RaiseAlert(new PropertyGridAlertEventArgs() { PropertyDescriptor = pd, Grade = grade, Description = description }); })); }
public TaskAlertEventArgs(eMessageGrade grade, object userState, string description) : this(userState, description) { Grade = grade; }