public Setup2(frmMain Main) { geoCode = new GeoCode(); geoReader = geoCode.GetGeoCode(Main.school.GetGeoCodeAddress()); string sLine = ""; string jsonReturn = ""; int i = 0; while (sLine != null) { i++; sLine = geoReader.ReadLine(); if (sLine != null) { jsonReturn += sLine; Console.WriteLine("{0}:{1}", i, sLine); } } JArray array = new JArray(); GoogleGeoCodeResponse m = JsonConvert.DeserializeObject <GoogleGeoCodeResponse>(jsonReturn); Main.school.latitude = m.results[0].geometry.location.lat; Main.school.longitude = m.results[0].geometry.location.lng; parentForm = Main; this.Icon = Icon.ExtractAssociatedIcon(Application.ExecutablePath); InitializeComponent(); txtLat.Text = Main.school.latitude; txtLng.Text = Main.school.longitude; txtFilePath.Text = Main.school.ImageFile; if (!txtFilePath.Text.Equals("")) { radioButton2.Checked = true; radioButton1.Checked = false; pbImage.ImageLocation = txtFilePath.Text; } }
public Setup2(frmMain Main) { geoCode = new GeoCode(); geoReader = geoCode.GetGeoCode(Main.school.GetGeoCodeAddress()); string sLine = ""; string jsonReturn =""; int i = 0; while (sLine != null) { i++; sLine = geoReader.ReadLine(); if (sLine != null) { jsonReturn += sLine; Console.WriteLine("{0}:{1}", i, sLine); } } JArray array = new JArray(); GoogleGeoCodeResponse m = JsonConvert.DeserializeObject<GoogleGeoCodeResponse>(jsonReturn); Main.school.latitude = m.results[0].geometry.location.lat; Main.school.longitude = m.results[0].geometry.location.lng; parentForm = Main; this.Icon = Icon.ExtractAssociatedIcon(Application.ExecutablePath); InitializeComponent(); txtLat.Text = Main.school.latitude; txtLng.Text = Main.school.longitude; txtFilePath.Text = Main.school.ImageFile; if(!txtFilePath.Text.Equals("")) { radioButton2.Checked = true; radioButton1.Checked = false; pbImage.ImageLocation = txtFilePath.Text; } }