public LocalRepository()
     : base("Local")
 {
     m_catalogs = new Dictionary<Vehicle, TrackCatalogCollection>();
     m_folderManager = new TrackFolderManager(this);
     m_importHelper = new TrackImportHelper(this);
 }
 public void GetFolderTest()
 {
     LocalRepository repo = new LocalRepository();
     repo.Open(PersonalTest.StorageRoot, null);
     TrackFolderManager manager = new TrackFolderManager(repo);
     Vehicle vehicle = new Vehicle() {
         VehicleId = "v121212121212"
     };
     string trackFile = "all_2012_03_11_20_37_31";
     string folder = manager.GetFolder(vehicle, trackFile, true);
     Assert.AreEqual(folder, vehicle.VehicleId + @"\2012\03\11");
 }
        private void DoOpen(object data)
        {
            DateTime dateFrom = SearchFrom;
            DateTime dateTo = SearchTo;

            switch (SearchMode) {
            /*
            case ViewModel.SearchMode.Today:
                dateFrom = DateTime.Today;
                dateTo = dateFrom + TimeSpan.FromMinutes(23 * 60 + 59);
                break;

            case ViewModel.SearchMode.TwoDays:
                dateFrom = DateTime.Today - TimeSpan.FromDays(1);
                dateTo = dateFrom + TimeSpan.FromMinutes(47 * 60 + 59);
                break;
            */
            case ViewModel.SearchMode.Recent:
                dateFrom = new TrackFolderManager(Repository).GetRecentDay(SelectedVehicle);
                dateTo = dateFrom + TimeSpan.FromMinutes(23 * 60 + 59);
                break;

            case ViewModel.SearchMode.RecentTwo:
                dateFrom = new TrackFolderManager(Repository).GetRecentDay(SelectedVehicle) - TimeSpan.FromDays(1);;
                dateTo = dateFrom + TimeSpan.FromMinutes(47 * 60 + 59);
                break;

            case ViewModel.SearchMode.Range:
            default:
                break;
            }

            SearchFrom = dateFrom;
            SearchTo = dateTo;

            Repository.Find(SelectedVehicle, dateFrom, dateTo, () => {
                ResetTrackGroup(Repository.GetTracks());
            });
        }