void PopulateTrackIDCombo() { IObjectContainer dbTrack = Db4oFactory.OpenFile(m_strTrackingDBFileName); try{ GPSTrackID trackID = new GPSTrackID(); trackID.CreateTrackID(); // need dummy track id IQuery query = dbTrack.Query(); query.Constrain(typeof(GPSTrackID)); query.Descend("m_dtCreationDate").OrderAscending(); IObjectSet result = query.Execute(); // should be one for each track... foreach (object item in result) { trackID = (GPSTrackID)item; this.cbTrackIds.Items.Add(trackID.GetTrackID()); } } catch (Exception ex) { LogException(ex, "PopulateTrackIDCombo"); } finally { dbTrack.Close(); } }
void ExportLatestTrack() { String strTrackId = ""; IObjectContainer dbTrack = Db4oFactory.OpenFile(m_strTrackingDBFileName); try{ GPSTrackID trackID = new GPSTrackID(); trackID.CreateTrackID(); // need dummy track id IQuery query = dbTrack.Query(); query.Constrain(typeof(GPSTrackID)); query.Descend("m_dtCreationDate").OrderAscending(); IObjectSet result = query.Execute(); // should be one for each track... foreach (object item in result) { trackID = (GPSTrackID)item; } strTrackId = trackID.GetTrackID(); } catch (Exception ex) { LogException(ex, "Error: ExportClick "); } finally { dbTrack.Close(); } ExportSelectedTrack(strTrackId); }