private void Form1_Load(object sender, EventArgs e) { try { string json = File.ReadAllText("config.txt"); var stations = JsonConvert.DeserializeObject <List <Station> >(json); foreach (var s in stations) { Station station = new Station(s.hostName, s.port, s.netpingIp); this.stations.Add(station); addTabPage(s.hostName, this.stations.Count); station.pingAsync(); } } catch (Exception ex) { } updateTabPage(0); }