Exemple #1
0
        public void ThreadWork()
        {
            while (true)
            {
                List <MessageModel> mess = Program.Messages(Program.chat_name);
                foreach (MessageModel result in mess)
                {
                    if (Program.last_message_id != result.messageId)
                    {
                        Messagebox.BeginInvoke(new MethodInvoker(() =>
                        {
                            if (Program.clear_chat)
                            {
                                Messagebox.Text    = "";
                                Program.clear_chat = false;
                            }
                            Messagebox.Text += result.username + ":" + result.message + "\n";
                        }));
                        Program.last_message_id = result.messageId;
                    }
                }

                Thread.Sleep(1000);
            }
        }