[Export("tableView:didSelectRowAtIndexPath:")] //DismissKeyboard() would block it public virtual void RowSelected(UIKit.UITableView tableView, Foundation.NSIndexPath indexPath) { if (indexPath.Row != selectedPos) { locationList[selectedPos].isSelected = false; locationList[indexPath.Row].isSelected = true; selectedPos = indexPath.Row; CLLocationCoordinate2D location = new CLLocationCoordinate2D(locationList[indexPath.Row].latitude, locationList[indexPath.Row].longitude); MoveMap(location, false); AddCircle(location); } else { if (locationList[selectedPos].isSelected == false) { locationList[selectedPos].isSelected = true; CLLocationCoordinate2D location = new CLLocationCoordinate2D(locationList[indexPath.Row].latitude, locationList[indexPath.Row].longitude); MoveMap(location, false); AddCircle(location); } else { locationList[selectedPos].isSelected = false; if (!(circle is null)) { LocationHistoryMap.RemoveAnnotation(circle); } } } LocationHistoryList.ReloadData(); }
public void AddItem() { LocationItem item = new LocationItem(); CLLocationCoordinate2D location; if (!Constants.SafeLocationMode) { item.time = (long)Session.LocationTime; item.latitude = (double)Session.Latitude; item.longitude = (double)Session.Longitude; location = new CLLocationCoordinate2D((double)Session.Latitude, (double)Session.Longitude); } else { item.time = (long)Session.SafeLocationTime; item.latitude = (double)Session.SafeLatitude; item.longitude = (double)Session.SafeLongitude; location = new CLLocationCoordinate2D((double)Session.SafeLatitude, (double)Session.SafeLongitude); } item.inApp = true; if (selectedPos == 0 && locationList.Count > 0) { item.isSelected = true; locationList[selectedPos].isSelected = false; AddCircle(location); MoveMap(location, false); } else if (locationList.Count == 0) { item.isSelected = true; AddCircle(location); MoveMap(location, true); } else { item.isSelected = false; selectedPos++; } locationList.Insert(0, item); LocationHistoryList.ReloadData(); if (locationList.Count >= 2) { AddLine(new CLLocationCoordinate2D(locationList[1].latitude, locationList[1].longitude), location, 0, 255, 0); } }
void ReleaseDesignerOutlets() { if (BottomConstraint != null) { BottomConstraint.Dispose(); BottomConstraint = null; } if (LocationBack != null) { LocationBack.Dispose(); LocationBack = null; } if (LocationHistoryList != null) { LocationHistoryList.Dispose(); LocationHistoryList = null; } if (LocationHistoryMap != null) { LocationHistoryMap.Dispose(); LocationHistoryMap = null; } if (MapSatellite != null) { MapSatellite.Dispose(); MapSatellite = null; } if (MapStreet != null) { MapStreet.Dispose(); MapStreet = null; } if (RippleLocation != null) { RippleLocation.Dispose(); RippleLocation = null; } if (RoundBottom != null) { RoundBottom.Dispose(); RoundBottom = null; } if (Snackbar != null) { Snackbar.Dispose(); Snackbar = null; } if (SnackBottomConstraint != null) { SnackBottomConstraint.Dispose(); SnackBottomConstraint = null; } if (SnackTopConstraint != null) { SnackTopConstraint.Dispose(); SnackTopConstraint = null; } }
private void LoadList() { locationList = new List <LocationItem>(); if (lines != null) { LocationHistoryMap.RemoveOverlays(lines.ToArray()); } lines = new List <MKPolyline>(); //File.Delete(c.locationLogFile); if (File.Exists(c.locationLogFile)) { string[] fileLines = File.ReadAllLines(c.locationLogFile); for (int i = fileLines.Length - 1; i >= 0; i--) { string line = fileLines[i]; LocationItem item = new LocationItem(); int sep1Pos = line.IndexOf('|'); int sep2Pos = line.IndexOf('|', sep1Pos + 1); int sep3Pos = line.IndexOf('|', sep2Pos + 1); if (sep2Pos != -1) { item.time = long.Parse(line.Substring(0, sep1Pos)); item.latitude = double.Parse(line.Substring(sep1Pos + 1, sep2Pos - sep1Pos - 1), CultureInfo.InvariantCulture); item.longitude = double.Parse(line.Substring(sep2Pos + 1, sep3Pos - sep2Pos - 1), CultureInfo.InvariantCulture); string status = line.Substring(sep3Pos + 1); switch (status) { case "0": item.inApp = false; item.sent = false; break; case "1": item.inApp = true; item.sent = false; break; case "2": item.inApp = true; item.sent = true; break; } item.isSelected = false; locationList.Add(item); } } locationList[0].isSelected = true; selectedPos = 0; } else { c.Snack(LangEnglish.NoLocationRecords); } adapter = new LocationListAdapter(locationList); LocationHistoryList.Source = adapter; LocationHistoryList.ReloadData(); LocationHistoryList.Delegate = this; }