/// <summary> /// 绑定分享位置 /// </summary> public void BindShareLocation(List <LocationModel> ls = null) { if (ls == null || ls.Count <= 0) { ls = LocationModel.GetLocation(); } string last = ""; if (File.Exists(basePath + "lastLocation.txt")) { last = File.ReadAllText(basePath + "lastLocation.txt"); } if (!string.IsNullOrWhiteSpace(last)) { ls.Insert(0, new LocationModel() { Alias = "最后位置", Longitude = last.Split(',')[0], Latitude = last.Split(',')[1], LocationName = "最后定位位置" }); } ; this.cmbLocation.DataSource = ls; this.cmbLocation.ValueMember = "Location"; this.cmbLocation.DisplayMember = "Alias"; }
/// <summary> /// 绑定分享位置 /// </summary> private void BindShareLocation(List <LocationModel> ls = null) { if (ls == null || ls.Count <= 0) { ls = LocationModel.GetLocation(); } this.comboBox1.DataSource = ls; this.comboBox1.ValueMember = "Location"; this.comboBox1.DisplayMember = "Alias"; }