示例#1
0
 private void atualizaPainel(Topico t)
 {
     this.Invoke(new MethodInvoker(() =>
     {
         foreach (Control item in t.painel.Controls)
         {
             if (item.Name == "labelHora")
             {
                 item.Text = "Last message: " + t.lastMessage.ToString("HH:mm:ss");
             }
         }
         t.painel.BackColor = Color.Green;
         t.painel.Refresh();
         Thread.Sleep(150);
         t.painel.BackColor = Color.LightBlue;
     }));
 }
示例#2
0
        private string montaJSON(Topico t)
        {
            int    count = 0;
            string s     = @"{""version"":""1.1"", ""host"":""" + t.host + @""", ""short_message"":""" + t.shortMessage + @""",";

            foreach (var item in t.variaveis)
            {
                count++;
                s = s + @"""" + item.Key + @""":" + item.Value.ToString();
                if (count < t.variaveis.Count)
                {
                    s = s + ",";
                }
            }
            s = s + "}";
            return(s);
        }