Ejemplo n.º 1
0
        private void SetRunResult(BackupPlan.BackupPlan plan, bool result)
        {
            var subitem = LookupItem(plan).SubItems[3];

            subitem.Text      = result ? "Success" : "Failure";
            subitem.ForeColor = result ? System.Drawing.Color.DarkGreen : System.Drawing.Color.DarkRed;
        }
Ejemplo n.º 2
0
 private void UpdateItem(ListViewItem item)
 {
     BackupPlan.BackupPlan plan = (BackupPlan.BackupPlan)item.Tag;
     item.Text             = plan.Name;
     item.SubItems[0].Text = plan.FolderToBackup;
     item.SubItems[1].Text = plan.DestinationFolder;
     item.SubItems[2].Text = "Never Run Since Edit";
 }
Ejemplo n.º 3
0
 private ListViewItem LookupItem(BackupPlan.BackupPlan plan)
 {
     foreach (ListViewItem item in planListView_.Items)
     {
         if (item.Tag as BackupPlan.BackupPlan == plan)
         {
             return(item);
         }
     }
     return(null);
 }
Ejemplo n.º 4
0
        private void AddPlanTButtonClick(object sender, EventArgs e)
        {
            var dlg = new PlanEditor {
                Text     = "Add New Backup Plan",
                PlanName = "Untitled Plan"
            };

            if (dlg.ShowDialog(this) == DialogResult.OK)
            {
                var plan = new BackupPlan.BackupPlan(dlg.PlanName, dlg.SourceFolder, dlg.DestinationFolder, null, AddLogEntry);
                AddPlan(plan);
            }
        }
Ejemplo n.º 5
0
        static public BackupPlan ImportFromIndexFile(KeyData key, string indexFileName, LogCallback callback)
        {
            BackupPlan result = new BackupPlan()
            {
                Key               = key,
                Callback          = callback,
                DestinationFolder = Path.GetDirectoryName(indexFileName),
                IndexName         = Path.GetFileNameWithoutExtension(indexFileName)
            };
            var tree = result.LoadIndex(indexFileName);

            result.FolderToBackup = tree.BaseFolder;
            result.Name           = tree.Name;
            return(result);
        }
Ejemplo n.º 6
0
        private void EditPlanButtonClick(object sender, EventArgs e)
        {
            BackupPlan.BackupPlan plan = (BackupPlan.BackupPlan)planListView_.SelectedItems[0].Tag;
            var dlg = new PlanEditor {
                Text              = "Edit Backup Plan",
                PlanName          = plan.Name,
                EnableSource      = false,
                EnableDestination = false,
                SourceFolder      = plan.FolderToBackup,
                DestinationFolder = plan.DestinationFolder
            };

            if (dlg.ShowDialog(this) == DialogResult.OK)
            {
                plan.Name = dlg.Name;
                SavePlans();
            }
        }
Ejemplo n.º 7
0
        private void AddPlan(BackupPlan.BackupPlan plan)
        {
            var item     = new ListViewItem(plan.Name);
            var subitems = new ListViewItem.ListViewSubItemCollection(item)
            {
                plan.FolderToBackup,
                plan.DestinationFolder,
                "Never Run"
            };

            item.Tag = plan;
            planListView_.Items.Add(item);
            if (!plans_.Contains(plan))
            {
                plans_.Add(plan);
            }
            runNowToolStripButton_.Enabled = (plans_.Count > 0);
        }