Beispiel #1
0
        public void AddItem(string message, string user, string room)
        {
            Dispatcher.Invoke(new Action(() =>
            {
                for (int i = 1; i < tbControl.Items.Count; i++)
                {
                    var tb = tbControl.ItemContainerGenerator.ContainerFromIndex(i) as TabItem;

                    if (tb == null)
                    {
                        continue;
                    }

                    ChatWindow window = tb.Content as ChatWindow;

                    if (window == null)
                    {
                        continue;
                    }

                    if (window.Room == room)
                    {
                        window.AddItem(message, user);
                    }
                }
            }));
        }