public void ShowNotification(string channelId, string channelName, string user, string message, bool isIncoming) { if (MainWindow.Form.InvokeRequired) { MainWindow.Form.Invoke((Action)(delegate { ShowNotification(channelId, channelName, user, message, isIncoming); })); return; } if (!_channels.ContainsKey(channelId)) { var newNotification = new Notification(channelId, channelName, 20, FormAnimator.AnimationMethod.Slide, FormAnimator.AnimationDirection.Up); newNotification.Closed += ChannelClosed; newNotification.OnQuickReply += ChannelQuickReply; newNotification.Show(); _channels.Add(channelId, newNotification); } Notification toastNotification = _channels[channelId]; toastNotification.AddMessage(user, message, isIncoming); }
public static Try <Notification, Usuario> GetUserByLogin(string login) { var notification = new Notification(NotificationDelimiter.WebDelimiter); if (string.IsNullOrEmpty(login)) { notification.AddError("O login informado é inválido!"); } var usuario = SimulacaoDB.Where(u => u.Login == login); if (!usuario.Any()) { notification.AddMessage(NotificationType.Warning, "Nenhum usuário encontrado com o login informado."); } if (notification.HasAnyMessage) { return(notification); } return(usuario.First()); }