public override void ResponseReceived(byte[] parameter) { switch ((TextChatCommunication)parameter[0]) { case TextChatCommunication.ChatOpened: IsStarted = true; ChatStatusChanged?.Invoke(this, EventArgs.Empty); LogService.Receive((string)Application.Current.Resources["ChatOpened"]); break; case TextChatCommunication.ChatClosed: IsStarted = false; ChatStatusChanged?.Invoke(this, EventArgs.Empty); LogService.Warn((string)Application.Current.Resources["ChatClosed"]); break; case TextChatCommunication.ResponseMessage: NewMessageReceived?.Invoke(this, new ChatMessage { Content = Encoding.UTF8.GetString(parameter, 9, parameter.Length - 9), Timestamp = new DateTime(BitConverter.ToInt64(parameter, 1)).ToLocalTime() }); break; case TextChatCommunication.InitializationFailed: ChatInitalizationFailed?.Invoke(this, EventArgs.Empty); LogService.Error((string)Application.Current.Resources["ChatInitializationFailed"]); break; default: throw new ArgumentOutOfRangeException(); } }
private void OnChatStatusChanged(ChatStatusChanged seerEvent) => ChatStatusChanged?.Invoke(seerEvent);