//Updates chat box (if open) with a new message private void Message(string Message) { try { this.Dispatcher.Invoke(() => { OpenChat(); System.Windows.Controls.ContentControl t = new System.Windows.Controls.ContentControl(); t.Content = Message + Environment.NewLine + DateTime.Now.ToString("HH:mm"); Style style = C.FindResource("BubbleLeftStyle") as Style; t.Style = style; C.chatPlace.Children.Add(t); C.title.Text = "Чат c " + Admin; }); } catch (Exception ex) { System.Windows.Forms.MessageBox.Show(ex.Message + " " + ex.TargetSite + " " + ex.Source + " " + ex.StackTrace); } }