public void OnUserBroadcast(DateTime dateTime, string fromUser, string message) { _dispatcher.Invoke(new Action(delegate { if (message.Length > 50) { Ink2.Strokes.Add(StrokeToString.LoadFromBase64String(message).Last()); } } ) ); //_dispatcher.Invoke(new Action(() => AppendText(dateTime, fromUser, "says", message))); }
public void OnBroadcast(DateTime dateTime, bool result, string resultMessage, string sentMessage) { if (result) { // Ignore the result message (probably unnecessary information) // Just output what was sent //_dispatcher.Invoke(new Action(() => AppendText(dateTime, "You", "say", sentMessage))); _dispatcher.Invoke(new Action(delegate { if (sentMessage.Length > 50) { Ink2.Strokes.Add(StrokeToString.LoadFromBase64String(sentMessage).Last()); } } ) ); //Ink2.RaiseEvent(new RoutedEventArgs(InkCanvas.StrokeCollectedEvent, Ink2)); return; } // Display the error message _dispatcher.Invoke(new Action(() => AppendText(dateTime, resultMessage, Colors.Red))); }