Exemple #1
0
        //--------------------------------
        #region Backup/Restore

        private void OnBackup(object sender, RoutedEventArgs e)
        {
            string input  = Config.Backup.FolderContent;
            string output = Config.Backup.FolderBackup;

            if (!Helpers.DirectoryExistsSafe(input))
            {
                TriggerMessageBox.Show(this, MessageIcon.Warning, "Could not find the Content folder.", "Invalid Path");
                return;
            }
            if (!Helpers.IsPathValid(output))
            {
                TriggerMessageBox.Show(this, MessageIcon.Warning, "The Backup folder path is invalid.", "Invalid Path");
                return;
            }
            if (string.Compare(Path.GetFullPath(input), Path.GetFullPath(output), true) == 0)
            {
                TriggerMessageBox.Show(this, MessageIcon.Warning, "Backup paths cannot be the same folder.", "Invalid Path");
                return;
            }

            input  = Helpers.FixPathSafe(input);
            output = Helpers.FixPathSafe(output);
            Thread thread = new Thread(() => {
                Processing.BackupFiles(input, output);
            });

            Processing.StartProgressThread(this, "Backing Up...", Config.AutoCloseProgress, Config.CompressImages, Config.CompletionSound, thread);
        }