Example #1
0
        private void informGUI(string obj, Socket socket)
        {
            App.Current.Dispatcher.Invoke(() =>
            {
                string[] unformatted = obj.Split(' ');

                var messages = new ObservableCollection <MessageVM>();
                var name     = unformatted[0];
                string msg   = name + ": ";

                while (!msg.Contains("\r\n"))
                {
                    for (int i = 1; i < unformatted.Length; i++)
                    {
                        msg += unformatted[i] + " ";
                    }
                }

                messages.Add(new MessageVM(msg, DateTime.Now));
                ChatMessages.Add(msg);

                if (!ChatMessages.Contains(name))
                {
                    User.Add(new UserVM(name, messages));
                }



                //}
            });
        }