Exemplo n.º 1
0
        public GrowlNotification(string heading, string message, GrowlNotificationStyle style)
        {
            this.Heading = heading;
            this.Message = message;

            switch (style)
            {
            case GrowlNotificationStyle.Success:
                this.Message = "success";
                break;

            case GrowlNotificationStyle.Warning:
                this.Message = "warning";
                break;

            case GrowlNotificationStyle.Danger:
                this.Message = "danger";
                break;

            default:
                throw new ArgumentOutOfRangeException(nameof(style), style, null);
            }
        }
Exemplo n.º 2
0
        public static T WithGrowlMessage <T>(this T response, string heading, string message, GrowlNotificationStyle style)
            where T : FormResponse <MyFormResponseMetadata>
        {
            response.Metadata = response.Metadata ?? new MyFormResponseMetadata();
            response.Metadata.FunctionsToRun = response.Metadata.FunctionsToRun ?? new List <ClientFunctionMetadata>();

            var growlFunction = new GrowlNotification(heading, message, style).GetClientFunctionMetadata();

            response.Metadata.FunctionsToRun.Add(growlFunction);

            return(response);
        }
Exemplo n.º 3
0
 public static T WithGrowlMessage <T>(this T response, string message, GrowlNotificationStyle style)
     where T : FormResponse <MyFormResponseMetadata>
 {
     return(response.WithGrowlMessage(null, message, style));
 }
Exemplo n.º 4
0
 public GrowlNotification(string message, GrowlNotificationStyle style) : this(null, message, style)
 {
 }