If the user selects a location for FW backups which is not in the default location this dialog asks if they want to change the default location.
Inheritance: System.Windows.Forms.Form
示例#1
0
        private void m_backUp_Click(object sender, EventArgs e)
        {
            if (!Path.IsPathRooted(DestinationFolder))
            {
                MessageBox.Show(this, FwCoreDlgs.ksBackupErrorRelativePath, FwCoreDlgs.ksErrorCreatingBackupDirCaption,
                                MessageBoxButtons.OK, MessageBoxIcon.Warning);
                m_destinationFolder.Select();
                DialogResult = DialogResult.None;
                return;
            }

            if (!Directory.Exists(DestinationFolder))
            {
                try
                {
                    Directory.CreateDirectory(DestinationFolder);
                }
                catch (Exception e1)
                {
                    MessageBox.Show(this, e1.Message, FwCoreDlgs.ksErrorCreatingBackupDirCaption,
                                    MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    m_destinationFolder.Select();
                    DialogResult = DialogResult.None;
                    return;
                }
            }

            if (!DestinationFolder.Equals(FwDirectoryFinder.DefaultBackupDirectory))
            {
                using (var dlgChangeDefaultBackupLocation = new ChangeDefaultBackupDir(m_helpTopicProvider))
                {
                    if (dlgChangeDefaultBackupLocation.ShowDialog(this) == DialogResult.Yes)
                    {
                        FwDirectoryFinder.DefaultBackupDirectory = DestinationFolder;
                    }
                }
            }

            if (m_presenter.FileNameProblems(this))
            {
                return;
            }

            try
            {
                using (new WaitCursor(this))
                    using (var progressDlg = new ProgressDialogWithTask(this))
                    {
                        BackupFilePath = m_presenter.BackupProject(progressDlg);
                    }
            }
            catch (FwBackupException be)
            {
                MessageBox.Show(this, string.Format(FwCoreDlgs.ksBackupErrorCreatingZipfile, be.ProjectName, be.Message),
                                FwCoreDlgs.ksBackupErrorCaption, MessageBoxButtons.OK, MessageBoxIcon.Warning);
                DialogResult = DialogResult.None;
            }
        }
示例#2
0
		private void m_backUp_Click(object sender, EventArgs e)
		{
			if (!Path.IsPathRooted(DestinationFolder))
			{
				MessageBox.Show(this, FwCoreDlgs.ksBackupErrorRelativePath, FwCoreDlgs.ksErrorCreatingBackupDirCaption,
					MessageBoxButtons.OK, MessageBoxIcon.Warning);
				m_destinationFolder.Select();
				DialogResult = DialogResult.None;
				return;
			}

			if (!Directory.Exists(DestinationFolder))
			{
				try
				{
					Directory.CreateDirectory(DestinationFolder);
				}
				catch (Exception e1)
				{
					MessageBox.Show(this, e1.Message, FwCoreDlgs.ksErrorCreatingBackupDirCaption,
						MessageBoxButtons.OK, MessageBoxIcon.Warning);
					m_destinationFolder.Select();
					DialogResult = DialogResult.None;
					return;
				}
			}

			if (!DestinationFolder.Equals(FwDirectoryFinder.DefaultBackupDirectory))
			{
				using (var dlgChangeDefaultBackupLocation = new ChangeDefaultBackupDir(m_helpTopicProvider))
				{
					if (dlgChangeDefaultBackupLocation.ShowDialog(this) == DialogResult.Yes)
						FwDirectoryFinder.DefaultBackupDirectory = DestinationFolder;
				}
			}

			if (m_presenter.FileNameProblems(this))
				return;

			try
			{
				using (new WaitCursor(this))
				using (var progressDlg = new ProgressDialogWithTask(this))
				{
					BackupFilePath = m_presenter.BackupProject(progressDlg);
				}
			}
			catch (FwBackupException be)
			{
				MessageBox.Show(this, string.Format(FwCoreDlgs.ksBackupErrorCreatingZipfile, be.ProjectName, be.Message),
					FwCoreDlgs.ksBackupErrorCaption, MessageBoxButtons.OK, MessageBoxIcon.Warning);
				DialogResult = DialogResult.None;
			}
		}