public static void LocalMessage(LocalMessageChannel channel, string provider, LocalMessageType messageType, string content, OutEnum outEnum, bool toConsole) { switch (outEnum) { case OutEnum.None: break; case OutEnum.Info: Out.ShowInfo(content); break; case OutEnum.Warn: Out.ShowWarn(content, delaySeconds: 4); break; case OutEnum.Error: Out.ShowError(content, delaySeconds: 4); break; case OutEnum.Success: Out.ShowSuccess(content); break; default: break; } if (toConsole) { switch (messageType) { case LocalMessageType.Info: Write.UserInfo(content); break; case LocalMessageType.Warn: Write.UserWarn(content); break; case LocalMessageType.Error: Write.UserError(content); break; default: break; } } Execute(new AddLocalMessageCommand(new LocalMessageData { Id = Guid.NewGuid(), Channel = channel.GetName(), Provider = provider, MessageType = messageType.GetName(), Content = content, Timestamp = DateTime.Now })); }
public static void LocalMessage(LocalMessageChannel channel, string provider, LocalMessageType messageType, string content, OutEnum outEnum, bool toConsole) { switch (outEnum) { case OutEnum.None: if (toConsole && _consoleAction.TryGetValue(messageType, out Action <string> action)) { action(content); } break; case OutEnum.Info: Out.ShowInfo(content, toConsole: toConsole); break; case OutEnum.Warn: Out.ShowWarn(content, autoHideSeconds: 4, toConsole: toConsole); break; case OutEnum.Error: Out.ShowError(content, autoHideSeconds: 4, toConsole: toConsole); break; case OutEnum.Success: Out.ShowSuccess(content, toConsole: toConsole); break; default: break; } Execute(new AddLocalMessageCommand(new LocalMessageData { Id = Guid.NewGuid(), Channel = channel.GetName(), Provider = provider, MessageType = messageType.GetName(), Content = content, Timestamp = DateTime.Now })); }