public void setClockFormClockJson() { try { ClockInfo clockInfo = new ClockInfo(Variable.RECEIVETEXTCLOCK); if (clockInfo.State == "Standing") { lblClock.BackColor = Color.LightGray; Variable.STATE = "Standing"; } else if (clockInfo.State == "Running") { lblClock.BackColor = Color.White; Variable.STATE = "Running"; } else if (clockInfo.State == "Pausing") { lblClock.BackColor = Color.Yellow; Variable.STATE = "Pausing"; } else if (clockInfo.State == "Stopping") { lblClock.BackColor = Color.Red; Variable.STATE = "Stopping"; } if (clockInfo.Type == "H1") { lblSec.Text = "Hiệp 1"; Variable.SEC = 1; } else if (clockInfo.Type == "GL") { lblSec.Text = "Giải lao"; Variable.SEC = 0; } else if (clockInfo.Type == "H2") { lblSec.Text = "Hiệp 2"; Variable.SEC = 2; } if (clockInfo.TimeState == "Decrease ") { } else if (clockInfo.TimeState == "Increase") { } s = clockInfo.S; m = clockInfo.M; lblClock.Text = (m / 10).ToString() + (m % 10).ToString() + ":" + (s / 10).ToString() + (s % 10).ToString(); } catch (Exception) { } }
public string getClockJson(ClockInfo clock) { string clockJson = JsonConvert.SerializeObject(clock); clockJson = "{\"ClockInfo\":" + clockJson + "}"; return clockJson; }