public DeviceRepositoryViewModel()
        {
            this.DriveManager = new DriveManager();
            m_repository = new DeviceRepository();

            SearchFrom = DateTime.Today;
            SearchTo = DateTime.Today + TimeSpan.FromHours(23) + TimeSpan.FromMinutes(59);
            SearchAll = true;
            AutoPlay = true;

            LoadCommand = new DelegateCommand<object>(DoLoad, CanLoad);
            SearchCommand = new DelegateCommand(DoSearch, CanSearch);
            SaveCommand = new DelegateCommand(DoSave, CanSave);

            if (PersonalDomain.Domain.EventAggregator != null) {
                PersonalDomain.Domain.EventAggregator.GetEvent<DeviceTrackActivatedEvent>().Subscribe((track) => {
                    track.IsChecked = true;
                    ActiveTrack = track;
                });

                PersonalDomain.Domain.EventAggregator.GetEvent<TrackPointChangedEvent>().Subscribe((point) => {
                    this.TrackPoint = point;
                });
            }
        }
Ejemplo n.º 2
0
        public void Save(DeviceRepository source, LocalRepository target, SaveOption options)
        {
            Debug.Assert(source != null);
            Debug.Assert(target != null);
            Debug.Assert(options != null);

            IEnumerable<Track> m_tracks = null;
            switch (options.Scope) {
            case SaveScope.All:
                m_tracks = source.Tracks;
                break;
            case SaveScope.Selection:
                m_tracks = source.Selection;
                break;
            case SaveScope.Range:
                m_tracks = source.Tracks.Where((t) =>
                    (t.StartTime >= options.StartDate) && (t.StartTime <= options.EndDate));
                break;
            }

            if (m_tracks != null) {
                List<string> files = new List<string>();
                foreach (Track track in m_tracks) {
                    files.Add(track.TrackFile);
                }
                new TrackImportHelper(target).Import(source.Vehicle, files, options.Convert, options.Overwrite);
            }
        }
 public void OpenTest()
 {
     DeviceRepository repo = new DeviceRepository();
     Vehicle vehicle = new Vehicle();
     string rootPath = PersonalTest.DeviceRoot;
     repo.Open(vehicle, rootPath, () => {
         string[] files = Directory.GetFiles(rootPath, "*.inc");
         Assert.AreEqual(files.Length, repo.TrackCount);
     });
 }
Ejemplo n.º 4
0
 public SaveViewModel(DeviceRepository repository, DateTime dateFrom, DateTime dateTo)
 {
     Repository = repository;
     Options = new SaveOption();
     Options.StartDate = dateFrom;
     Options.EndDate = dateTo;
     Options.Convert = false;
     Options.Overwrite = true;
     IsCancelable = true;
     CancelText = "취소";
     SubmitText = "저장";
 }
Ejemplo n.º 5
0
 public void SaveDevice(DeviceRepository source, SaveOption options)
 {
     new DeviceSaveHelper().Save(source, Repository, options);
 }
        public RepositoryViewModel()
        {
            CommandBindings = new CommandBindingCollection();

            this.DriveManager = new DriveManager();
            m_deviceRepository = new DeviceRepository();

            m_vehicles = new ListCollectionView(PersonalDomain.Domain.Vehicles);
            m_vehicles.CurrentChanged += new EventHandler(Vehicles_CurrentChanged);

            m_selectedTracks = new TrackCollection();
            m_playbackManager = new PlaybackManager(m_selectedTracks);

            SearchFrom = DateTime.Today;
            SearchTo = DateTime.Today + TimeSpan.FromMinutes(23 * 60 + 59);
            SearchAll = true;
            SearchMode = SearchMode.Recent;
            AutoPlay = true;
            AllPlay = true;

            OpenCommand = new DelegateCommand<object>(DoOpen, CanOpen);
            SearchCommand = new DelegateCommand<object>(DoSearch, CanSearch);
            PlaybackCommand = new DelegateCommand<object>(DoPlayback, CanPlayback);
            SaveCommand = new DelegateCommand(DoSave, CanSave);
            ArrangeCommand = new DelegateCommand(DoArrange, CanArrange);

            DeleteCommand = new RoutedUICommand("삭제", "삭제", typeof(RepositoryViewModel));
            CommandBinding binding = new CommandBinding(DeleteCommand, DoDelete, CanDelete);
            CommandManager.RegisterClassCommandBinding(typeof(RepositoryViewModel), binding);
            CommandBindings.Add(binding);

            RegisterGlobalEvents();
        }