public static IMessenger Error( this IMessenger value, string text, string title = null) { return value.AddMessage(text, value.Options.MessageTypes.Error, title); }
public static IMessenger Information( this IMessenger value, string text, string title = null) { return value.AddMessage(text, value.Options.MessageTypes.Information, title); }
/// <summary> /// Adds the given results to the error list /// </summary> public static void AddRange(this IErrorList errorList, string document, IEnumerable<System.ComponentModel.DataAnnotations.ValidationResult> results) { Guard.NotNull(() => errorList, errorList); if (results != null) { results.ForEach(r => errorList.AddMessage(r.ErrorMessage, document, ErrorCategory.Error)); } }
/// <summary> /// Lets the given ContextHandler wait one Tick. Does nothing if within the given Handler's Context. /// </summary> /// <param name="contextHandler"></param> public static void WaitOne(this IContextHandler contextHandler) { var obj = new Object(); if (!contextHandler.IsInContext) { lock (obj) { contextHandler.AddMessage(() => { lock (obj) { Monitor.PulseAll(obj); } }); Monitor.Wait(obj); } } }
/// <summary> /// Adds all the messages of a message container into another one. /// </summary> /// <param name="self">Extended instance. Will receive all messages from <paramref name="source"/>.</param> /// <param name="source">The message container to draw messages from.</param> public static void Slurp(this IMessageContainer self, IMessageContainer source) { if (self == null) throw new InstanceArgumentNullException(); if (source == null) return; source.Messages.ForEach(message => self.AddMessage(message)); }
/// <summary> /// To record a warning to the log. /// </summary> /// <param name="receiver">Logs receiver.</param> /// <param name="message">Text message.</param> /// <param name="args">Text message settings. Used if a message is the format string. For details, see <see cref="string.Format(string,object[])"/>.</param> public static void AddWarningLog(this ILogReceiver receiver, string message, params object[] args) { receiver.AddMessage(LogLevels.Warning, message, args); }
public static FileRevision WithMessage(this FileRevision @this, string message) { @this.AddMessage(message); return @this; }
public static void Write(this CloudQueue queue, string message) { queue.AddMessage(new CloudQueueMessage(RoleEnvironment.CurrentRoleInstance.Id + " " + message), TimeSpan.FromDays(1)); }