示例#1
0
        private void archiveToolStripMenuItem_Click(object sender, EventArgs e)
        {
            var vmpp = VM.Connection.Resolve(VM.protection_policy);
            if (vmpp.archive_frequency != vmpp_archive_frequency.never)
            {
                var selectedSnapshots = GetSelectedSnapshots();
                string text = "";
                if (selectedSnapshots.Count == 1)
                    text = string.Format(Messages.ARCHIVE_SNAPSHOT_NOW_TEXT_SINGLE, VM.Connection.Resolve(VM.protection_policy).archive_target_config_location);
                else
                    text = string.Format(Messages.ARCHIVE_SNAPSHOT_NOW_TEXT_MULTIPLE, VM.Connection.Resolve(VM.protection_policy).archive_target_config_location);

                if (new ThreeButtonDialog(
                       new ThreeButtonDialog.Details(SystemIcons.Information, text, Messages.ARCHIVE_VM_PROTECTION_TITLE),
                       ThreeButtonDialog.ButtonYes,
                       ThreeButtonDialog.ButtonNo).ShowDialog() == DialogResult.Yes)
                {
                    foreach (var snapshot in selectedSnapshots)
                    {
                        new ArchiveNowAction(snapshot).RunAsync();
                    }
                }
            }
            else
            {
                if (new ThreeButtonDialog(
                        new ThreeButtonDialog.Details(SystemIcons.Error, Messages.POLICY_DOES_NOT_HAVE_ARCHIVE, Messages.POLICY_DOES_NOT_HAVE_ARCHIVE_TITLE),
                        ThreeButtonDialog.ButtonYes,
                        ThreeButtonDialog.ButtonNo).ShowDialog() == DialogResult.Yes)
                {
                    var dialog = new PropertiesDialog(vmpp);
                    dialog.SelectNewPolicyArchivePage();
                    dialog.ShowDialog(this);
                }
            }
        }