コード例 #1
0
ファイル: PageMessager.xaml.cs プロジェクト: sttrox/ChatLAN
        public PageMessager()
        {
            InitializeComponent();
            ClientCore clientCore = ClientCore.GetCore();

            clientCore.AddMessage += (sender, message) =>
                                     PanelMessage.Invoke(() =>
            {
                UserControl element;
                if (message.Name == ClientCore.NameUser)
                {
                    element = new ControlMessagRevers(message)
                    {
                        Foreground = new SolidColorBrush(Color.FromArgb(255, 255, 218, 187))
                    }
                }
                ;
                else
                {
                    element = new ControlMessag(message)
                    {
                        Foreground = Foreground = Brushes.LightBlue
                    }
                };
                element.Margin = new Thickness(5);

                PanelMessage.Children.Add(element);
            });
            new Thread(() => clientCore.ReceiveMessage()).Start();
        }