private void ConvertDeviceGPXInArchiveToGPXFile(GPS gps = null) { if (gps == null) { foreach (var item in DeviceGPXCollection) { //if(item.GPX=="") //{ // item.GPX = DeviceWaypointGPXes.getXML(item.RowID); //} var gpxFile = Entities.GPXFileViewModel.ConvertToGPXFile(item); AddToDictionary(gpxFile.GPS, gpxFile); } } else { List<GPXFile> gpxFiles = new List<GPXFile>(); if (ArchivedGPXFiles.Keys.Contains(gps) && ArchivedGPXFiles[gps].Count > 0) { gpxFiles = ArchivedGPXFiles[gps]; } foreach (var item in DeviceGPXCollection.Where(t => t.GPS.DeviceID == gps.DeviceID)) { if (item.GPX == "") { item.GPX = DeviceWaypointGPXes.getXML(item.RowID); } var gpxFile = Entities.GPXFileViewModel.ConvertToGPXFile(item); if (!gpxFiles.Contains(gpxFile)) { AddToDictionary(gpxFile.GPS, gpxFile); } } } }
private void DeviceWptGPXCollection_CollectionChanged(object sender, NotifyCollectionChangedEventArgs e) { _success = false; switch (e.Action) { case NotifyCollectionChangedAction.Add: { int newIndex = e.NewStartingIndex; DeviceGPX newWPTGPX = DeviceGPXCollection[newIndex]; if (DeviceWaypointGPXes.Add(newWPTGPX)) { CurrentEntity = newWPTGPX; _success = true; } } break; case NotifyCollectionChangedAction.Remove: { List <DeviceGPX> tempListOfRemovedItems = e.OldItems.OfType <DeviceGPX>().ToList(); DeviceWaypointGPXes.Delete(tempListOfRemovedItems[0].RowID); } break; case NotifyCollectionChangedAction.Replace: { List <DeviceGPX> tempList = e.NewItems.OfType <DeviceGPX>().ToList(); _success = DeviceWaypointGPXes.Update(tempList[0]); // As the IDs are unique, only one row will be effected hence first index only } break; } }
public DeviceGPX GetDeviceGPX(int id) { var gpx = DeviceGPXCollection.Where(t => t.RowID == id).FirstOrDefault(); if (gpx.GPX == "") { gpx.GPX = DeviceWaypointGPXes.getXML(id); } return gpx; }
public DeviceGPX GetDeviceGPX(GPS gps, DateTime month_year) { var gpx = DeviceGPXCollection .Where(t => t.GPS.DeviceID == gps.DeviceID) .FirstOrDefault(); if (gpx.GPX == "") { gpx.GPX = DeviceWaypointGPXes.getXML(gpx.RowID); } return gpx; }
public DeviceGPX GetDeviceGPX(GPS gps, string fileName) { var gpx = DeviceGPXCollection .Where(t => t.GPS.DeviceID == gps.DeviceID) .Where(t => t.Filename == Path.GetFileName(fileName)) .FirstOrDefault(); if (gpx.GPX == "") { gpx.GPX = DeviceWaypointGPXes.getXML(gpx.RowID); } return gpx; }
public DeviceGPX GetDeviceGPX(DeviceGPX deviceGPX) { var gpx = DeviceGPXCollection .Where(t => t.GPS.DeviceID == deviceGPX.GPS.DeviceID) .Where(t => t.Filename == deviceGPX.Filename) .FirstOrDefault(); if (gpx.GPX == "") { gpx.GPX = DeviceWaypointGPXes.getXML(gpx.RowID); } return gpx; }
public List<DeviceGPX> GetAllDeviceWaypointGPX(GPS gps) { var gpxes = DeviceGPXCollection.Where(t => t.GPS.DeviceID == gps.DeviceID).ToList(); foreach (var gpx in gpxes) { if (gpx.GPX == "") { gpx.GPX = DeviceWaypointGPXes.getXML(gpx.RowID); } } return gpxes; }
public List<DeviceGPX> GetAllDeviceWaypointGPX() { var gpxes = DeviceGPXCollection.ToList(); foreach (var gpx in gpxes) { if (gpx.GPX == "") { gpx.GPX = DeviceWaypointGPXes.getXML(gpx.RowID); } } return gpxes; }
public bool ClearRepository() { return DeviceWaypointGPXes.ClearTable(); }