Exemplo n.º 1
0
        private void btnAdd_Click(object sender, EventArgs e)
        {
            using (var newTarget = new TargetForm(TargetFormState.New))
            {
                newTarget.Where = Settings.Default.Where;
                newTarget.Compressed = Settings.Default.Compressed;
                newTarget.CompressionAlgo = (CompressionAlgo)Settings.Default.Algo;
                newTarget.CompressionLevel = (CompressionLevel)Settings.Default.Level;
                newTarget.Interval = Settings.Default.Interval;
                newTarget.StartTime = Settings.Default.StartTime;

                newTarget.ExistingTargets = Backup.TargetWhats.ToArray();

                if (newTarget.ShowDialog(this) == DialogResult.OK)
                {
                    Backup.AddTarget(
                        newTarget.What,
                        newTarget.Where,
                        newTarget.Compressed,
                        newTarget.CompressionAlgo,
                        newTarget.CompressionLevel,
                        newTarget.StartTime,
                        newTarget.Interval);

                    UpdateList();
                }
            }
        }
Exemplo n.º 2
0
        private void btnEdit_Click(object sender, EventArgs e)
        {
            if (listTargets.SelectedItems.Count == 0)
                return;

            using (var editTarget = new TargetForm(TargetFormState.Edit))
            {
                var target = Backup.GetTarget(listTargets.SelectedItems[0].Text);

                editTarget.What = target.What;
                editTarget.Where = target.Where;
                editTarget.Compressed = target.Compressed;
                editTarget.CompressionAlgo = target.Algo;
                editTarget.CompressionLevel = target.Level;
                editTarget.Interval = target.Interval;
                editTarget.StartTime = target.Start;

                editTarget.ExistingTargets = Backup.TargetWhats.ToArray();

                if (editTarget.ShowDialog(this) == DialogResult.OK)
                {
                    Backup.UpdateTarget(
                        editTarget.What,
                        editTarget.Where,
                        editTarget.Compressed,
                        editTarget.CompressionAlgo,
                        editTarget.CompressionLevel,
                        editTarget.StartTime,
                        editTarget.Interval);

                    UpdateList();
                }
            }
        }