void comms_GotData(object sender, GotDataEventArgs e) { bool success; clearStore(); if (e.Data.Contains("color ")) { success = Parse(e.Data, false); if (success) { Status = "Configuration: Got color palette OK."; IsEnabled = true; updateAllButtons(); Text = "Color Palette"; } else { comms.Retry(); } } else { Status = "Configuration: color palette empty."; initColorStore(); updateAllButtons(); } }
private void comms_GotData(object sender, GotDataEventArgs e) { bool success = Parse(e.Data, false); if (success) { Status = "Configuration: Got Mode data OK."; } else { comms.Retry(); } updateAllButtons(); }
private void comms_GotData(object sender, GotDataEventArgs e) { float value; bool success = false; if (e.Data.Contains("Unknown")) { return; //Fail silently } string txt = e.Data.Split(':')[1].Split(' ')[1].Split('\r')[0]; txt = txt.Replace("%", ""); txt = txt.Replace("v", ""); if (txt.Contains("YES")) { storedParams.load(e.Index, 1); success = true; } else if (txt.Contains("NO")) { storedParams.load(e.Index, 0); success = true; } else if (float.TryParse(txt, out value)) { storedParams.load(e.Index, value); success = true; } if (success) { loadSetting(e.Index); } else { comms.Retry(); } }