public static void PrintMessages() { var message = messenger.Fetch(); while (message != null) { if (message.Type == messageTypes.Error) { System.Console.ForegroundColor = System.ConsoleColor.Red; } else if (message.Type == messageTypes.Information) { System.Console.ForegroundColor = System.ConsoleColor.Blue; } else if (message.Type == messageTypes.Success) { System.Console.ForegroundColor = System.ConsoleColor.Green; } else if (message.Type == messageTypes.Warning) { System.Console.ForegroundColor = System.ConsoleColor.Yellow; } System.Console.WriteLine($"[{message.Type}] {message.Title}: {message.Text}"); System.Console.ResetColor(); message = messenger.Fetch(); } }
public IViewComponentResult Invoke() { var messages = new List <Message>(); while (messenger.Count() > 0) { messages.Add(messenger.Fetch()); } var options = new MotleyFlashViewComponentOptions(); if (ViewComponentContext.Arguments.ContainsKey(nameof(options.View))) { return(View(ViewComponentContext.Arguments[nameof(options.View)].ToString(), messages)); } else { return(View(messages)); } }