private void button1_Click(object sender, EventArgs e) { SendNoticeForm f = new SendNoticeForm(); DialogResult dr = f.ShowDialog(); if (dr == DialogResult.OK) { string msg = JsonConvert.SerializeObject(new { type = "notice", message = f.Message, timeout = f.Timeout }); ws.Send(msg); } }