Exemple #1
0
        /// <summary>
        /// Redirecting the user to the select source view page
        /// </summary>
        private void GoToSelectSource()
        {
            // Reset the state to the initial values
            if (DisplayViewModel.IsBackupDone && !DisplayViewModel.IsBackupRunning)
            {
                DisplayViewModel.ResetState();
            }

            // Injecting the SelectSourceViewModel
            ViewModelLocator.ApplicationViewModel.GoToView(_SelectSourceViewModel);
        }
Exemple #2
0
        /// <summary>
        /// The action when the user choose backup folder
        /// </summary>
        private void SelectDestFolder()
        {
            // Reset the state to the initial values
            if (DisplayViewModel.IsBackupDone && !DisplayViewModel.IsBackupRunning)
            {
                DisplayViewModel.ResetState();
            }

            string folder = _DialogService.SelectFolder("Choose folder to backup in hard drive", Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments));

            if (folder != null)
            {
                Details.DestFolder = folder;
                ViewModelLocator.CacheViewModel.Save();
            }
        }
Exemple #3
0
        /// <summary>
        /// Default Constructor
        /// </summary>
        public DetailsViewModel(IDialogService dialogService,
                                SelectSourceViewModel selectSourceViewModel,
                                DisplayViewModel displayViewModel)
        {
            _DialogService        = dialogService;
            DisplayViewModel      = displayViewModel;
            SelectSourceViewModel = selectSourceViewModel;


            SelectDestFolderCommand = new RelayCommand(SelectDestFolder, (parameter) => { return(!DisplayViewModel.IsBackupRunning); });
            GoToSelectSourceCommand = new RelayCommand(GoToSelectSource, (parameter) => { return(!DisplayViewModel.IsBackupRunning); });
            StartBackupCommand      = new RelayCommand(StartBackup);
            GoToDisplayCommand      = new RelayCommand(GoToDisplay);
            ShowBackupReportCommand = new RelayCommand(() =>
            {
                // WRONG: uses windows functionality in Core
                ProcessStartInfo info = new ProcessStartInfo(ReportFile.LogPath);
                Process.Start(info);
            });
        }
Exemple #4
0
        private void StartBackup()
        {
            if (!DisplayViewModel.IsBackupRunning)
            {
                _DialogService.ShowMessageBox("Make sure all the folders aren't in use of other softwares, so all the information will be transfered properly.");

                if (_DialogService.ShowYesNoMessageBox("Are you sure you want to start the backup?", "Question"))
                {
                    // Validate user input
                    if (Details.Validate(_DialogService))
                    {
                        // Run the back up
                        DisplayViewModel.RunBackup();

                        // Redirect the user to the display view page
                        GoToDisplay();
                    }
                }
            }
            else
            {
                _DialogService.ShowMessageBox("The buckup is already running!");
            }
        }