Ejemplo n.º 1
0
        public MainViewModel()
        {
            var configuration = Configuration.GetConfiguration("defaultconfig.json");

            Config.CollectionTarget       = configuration.CollectionConnectionString;
            Config.DeletedTarget          = configuration.DeletedConnectionString;
            collectionHistory             = new CollectionHistory();
            deletedHisotry                = new DeleteHisotry();
            deletedHisotry.DeletedHistory = new List <string>();
            MyFiles.Clear();
            history = new DirectoryHistory(FilePath);
            foreach (var logicalDrive in Directory.GetLogicalDrives())
            {
                DirectoriesAndFiles.Add(new DirectoryViewModel(logicalDrive));
            }

            history.HistoryChanged += History_HistoryChanged;

            CompressCollectionCommand = new DelegateCommand(CompressCollection);
            OpenCommand            = new DelegateCommand(Open);
            CompressCommand        = new DelegateCommand(Compress);
            DecompressCommand      = new DelegateCommand(Decompress);
            DeleteFileCommand      = new DelegateCommand(DeleteFile);
            AddToCollectionCommand = new DelegateCommand(AddToCollection);
            MoveBackCommand        = new DelegateCommand(MoveBack, CanMoveBack);
            MoveForwardCommand     = new DelegateCommand(MoveForward, CanMoveForward);
            MoveForwardCommand     = new DelegateCommand(MoveForward, CanMoveForward);
        }
Ejemplo n.º 2
0
        public DirectoryTabItemViewModel(ISynchronizationHelper synchronizationHelper)
        {
            _synchronizationHelper = synchronizationHelper;

            _backgroundWorker = new BackgroundWorker
            {
                WorkerSupportsCancellation = true,
                WorkerReportsProgress      = true
            };

            _backgroundWorker.RunWorkerCompleted += BackgroundWorker_RunWorkerCompleted;
            _backgroundWorker.DoWork             += BackgroundWorker_DoWork;
            _backgroundWorker.ProgressChanged    += BackgroundWorker_ProgressChanged;

            _history = new DirectoryHistory("Мой компьютер", "Мой компьютер");

            OpenCommand        = new DelegateCommand(Open);
            MoveBackCommand    = new DelegateCommand(OnMoveBack, OnCanMoveBack);
            MoveForwardCommand = new DelegateCommand(OnMoveForward, OnCanMoveForward);

            Name     = _history.Current.DirectoryPathName;
            FilePath = _history.Current.DirectoryPath;

            OpenDirectory();

            _history.HistoryChanged += History_HistoryChanged;
        }
Ejemplo n.º 3
0
        public DirectoryTabItemViewModel()
        {
            _history = new DirectoryHistory("Мой компьютер", "Мой компьютер");

            OpenCommand        = new DelegateCommand(Open);
            MoveBackCommand    = new DelegateCommand(OnMoveBack, OnCanMoveBack);
            MoveForwardCommand = new DelegateCommand(OnMoveForward, OnCanMoveForward);

            Name     = _history.Current.DirectoryPathName;
            FilePath = _history.Current.DirectoryPath;

            OpenDirectory();

            _history.HistoryChanged += History_HistoryChanged;
        }
        public DirectoryTabItemViewModel()
        {
            _history = new DirectoryHistory("My computer", "My computer");

            Name     = _history.Current.DirectoryName;
            FilePath = _history.Current.DirectoryPath;

            Open        = new DelegateCommand(OnOpen);
            MoveBack    = new DelegateCommand(OnMoveBack, OnCanMoveBack);
            MoveForward = new DelegateCommand(OnMoveForward, OnCanMoveForward);

            foreach (var drive in Environment.GetLogicalDrives())
            {
                DirectoriesAndFiles.Add(new DirectoryViewModel(drive));
            }
        }