コード例 #1
0
 private void DownloadButtonClicked(object sender, EventArgs e)
 {
     if (!MainWindow.isActiveDownloadOperation)
     {
         MainWindow.isActiveDownloadOperation = true;
         //to do
         DisableActions();
         string              password      = new DatabaseService().GetSettings().getPassword();
         PlanControl         planControl   = (PlanControl)sender;
         Backup              lastBackup    = databaseService.GetLastBackup(Int32.Parse(planControl.LabelPlanId.Text));
         Cloud               cloud         = databaseService.GetCloudByName(planControl.LabelCloudName.Text);
         FolderBrowserDialog folderBrowser = new FolderBrowserDialog();
         DialogResult        dialogResult  = folderBrowser.ShowDialog();
         if (dialogResult == DialogResult.OK)
         {
             MainWindow.instance.LabelMainPlanName.Text = "Plan: " + planControl.LabelBackupName.Text;
             DownloadBackupAction downloadBackupAction = new DownloadBackupAction(cloud, lastBackup.targetPath, planControl.LabelStatus, planControl.ProgressBarArchiving, folderBrowser.SelectedPath, DownloadCompleteEvent, password, false);
             downloadBackupAction.StartDownloadBackupAction();
         }
         else
         {
             MainWindow.instance.ResetDownloadAction();
             MainWindow.isActiveDownloadOperation = false;
         }
     }
 }
コード例 #2
0
        public void EventRestore(object sender, EventArgs e)
        {
            DialogResult result = MessageBox.Show("Are you sure you want to restore this backup? Your current folder will be replaced by this one.", "Restore backup", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Exclamation);

            if (DialogResult.Yes == result)
            {
                if (selectedItem != null && !MainWindow.isActiveDownloadOperation)
                {
                    string     password   = new DatabaseService().GetSettings().getPassword();
                    Backup     backup     = databaseService.GetBackup((int)selectedItem.Tag);
                    BackupPlan backupPlan = databaseService.GetBackupPlan(backup.backupPlanId);
                    Cloud      cloud      = databaseService.GetCloud(backup.cloudId);
                    mainInstance.ResetDownloadAction();
                    DownloadBackupAction downloadBackupAction = new DownloadBackupAction(cloud, backup.targetPath, labelStatus, progressBar, backupPlan.path, DownloadCompleteEvent, password, true);
                    downloadBackupAction.StartDownloadBackupAction();
                }
            }
        }
コード例 #3
0
 private void ButtonManualDownload_Click(object sender, EventArgs e)
 {
     if (isInPlanFolder && listViewCloudFiles.SelectedItems.Count == 1 && !listViewCloudFiles.SelectedItems[0].Text.Equals(".."))
     {
         FolderBrowserDialog folderBrowser = new FolderBrowserDialog();
         DialogResult        dialogResult  = folderBrowser.ShowDialog();
         if (dialogResult == DialogResult.OK)
         {
             mainWindowInstance.RestrictDownloadAction();
             DownloadBackupAction downloadBackupAction = new DownloadBackupAction(currentCLoud, listViewCloudFiles.SelectedItems[0].Tag.ToString(), labelStatus, progressBar, folderBrowser.SelectedPath, DownloadCompleteEvent, MyUtils.Encript(textBoxPassword.Text), false);
             downloadBackupAction.StartDownloadBackupAction();
         }
     }
     else
     {
         MessageBox.Show("Please select backup folder then click Download!");
     }
 }
コード例 #4
0
        private void RestoreButtonClicked(object sender, EventArgs e)
        {
            DialogResult dialog = MessageBox.Show("Are you sure you want to restore files from last backup?You will lose your current work.", "Restore Backup Plan", MessageBoxButtons.YesNo);

            if (dialog == DialogResult.Yes)
            {
                if (!MainWindow.isActiveDownloadOperation)
                {
                    MainWindow.isActiveDownloadOperation = true;
                    DisableActions();
                    string      password    = new DatabaseService().GetSettings().getPassword();
                    PlanControl planControl = (PlanControl)sender;
                    Cloud       cloud       = databaseService.GetCloudByName(planControl.LabelCloudName.Text);
                    Backup      lastBackup  = databaseService.GetLastBackup(Int32.Parse(planControl.LabelPlanId.Text));
                    MainWindow.instance.LabelMainPlanName.Text = "Plan: " + planControl.LabelBackupName.Text;
                    DownloadBackupAction downloadBackupAction = new DownloadBackupAction(cloud, lastBackup.targetPath, planControl.LabelStatus, planControl.ProgressBarArchiving, planControl.LabelFolderPath.Text, DownloadCompleteEvent, password, true);
                    downloadBackupAction.StartDownloadBackupAction();
                }
            }
        }
コード例 #5
0
        public void EventDownload(object sender, EventArgs e)
        {
            if (selectedItem != null && !MainWindow.isActiveDownloadOperation)
            {
                string password = new DatabaseService().GetSettings().getPassword();

                Backup backup = databaseService.GetBackup((int)selectedItem.Tag);
                Cloud  cloud  = databaseService.GetCloud(backup.cloudId);
                FolderBrowserDialog folderBrowser = new FolderBrowserDialog();
                DialogResult        dialogResult  = folderBrowser.ShowDialog();
                if (dialogResult == DialogResult.OK)
                {
                    mainInstance.RestrictDownloadAction();
                    DownloadBackupAction downloadBackupAction = new DownloadBackupAction(cloud, backup.targetPath, labelStatus, progressBar, folderBrowser.SelectedPath + "//" + Path.GetFileName(backup.targetPath), DownloadCompleteEvent, password, false);
                    downloadBackupAction.StartDownloadBackupAction();
                }
                else
                {
                    mainInstance.ResetDownloadAction();
                }
            }
        }