/// <summary> /// On Data Received event handler /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void SimulatorListDataReceived(object sender, System.Diagnostics.DataReceivedEventArgs e) { string apilevel = ""; string version = ""; SimulatorsClass sim = null; if (e.Data != null) { if ((e.Data.ToLower().Contains("error")) || (_error != "")) { _error = _error + e.Data; } else if ((e.Data.Contains("Location:")) || (e.Data.Contains("Available"))) { // Do Nothing } else { version = e.Data.Substring(0, e.Data.LastIndexOf(" - ")); apilevel = version.Split('.')[0] + "." + version.Split('.')[1]; sim = _simulatorList.Find(i => i.APILevel == apilevel); if (sim == null) { sim = new SimulatorsClass(version, apilevel, true); sim.IsInstalled = IsSimulatorInstalled(version); _simulatorList.Add(sim); } else { //sim not the latest... mark it as false sim.LatestVersion = false; //create new sim SimulatorsClass sim2 = new SimulatorsClass(version, apilevel, true); sim2.IsInstalled = IsSimulatorInstalled(version); // insert before found sim. _simulatorList.Insert(_simulatorList.IndexOf(sim), sim2); } } } }