Exemple #1
0
        void init_backup_nodes()
        {
            backup_root_node.Items.Clear();

            // Add a node for each backup object.
            foreach (var backup in app.backup_manager.backups)
            {
                var backup_node = new TreeViewItem();
                backup_node.Header = backup.Name;
                backup_root_node.Items.Add(backup_node);

                backup_node.Tag       = backup;
                backup_node.Selected += backup_tv_item_handler;
            }

            // Add one last node for adding new backups.
            var new_backup_node = new TreeViewItem();

            new_backup_node.Header = "Add New Backup";
            backup_root_node.Items.Add(new_backup_node);

            var add_backup_page = new AddBackup_Page(app.backup_manager,
                                                     app.cloud_backup_services, app.key_manager, add_backup);

            associate_tv_item_to_page(new_backup_node, add_backup_page);
        }
Exemple #2
0
        void init_gui(EncryptedBackup encrypted_backup)
        {
            // Name_tb, Enabled_cb
            Name_tb.Text         = encrypted_backup.future_params.name;
            Enabled_cb.IsChecked = encrypted_backup.future_params.enabled;

            // Info_text
            source_base = encrypted_backup.source_base;

            var sb = new StringBuilder();

            sb.AppendLine("Source: " + encrypted_backup.source_base);

            if (encrypted_backup.destination_name.ToLower().Equals("disk"))
            {
                sb.AppendLine("Destination: " + encrypted_backup.destination_base);
            }
            else
            {
                sb.AppendLine("Destination: " + encrypted_backup.destination_name
                              + "\\" + encrypted_backup.destination_base);
            }

            sb.AppendLine("Embedded Prefix: " + encrypted_backup.embedded_prefix);
            Info_text.Text = sb.ToString();

            // Rules_lb
            rule_lists = encrypted_backup.future_params.rule_lists;
            AddBackup_Page.redraw_backup_rules_listbox(Rules_lb, rule_lists);
        }
Exemple #3
0
        private void Add_btn_Click(object sender, RoutedEventArgs e)
        {
            var add_rule_window = new AddRule_Window(rule_lists.backup_rule_lists.Count);

            add_rule_window.ShowDialog();

            if (add_rule_window.rule != null)
            {
                // Check directory for validity.
                if (add_rule_window.rule.directory.StartsWith(source_base) == false)
                {
                    MyMessageBox.show("The rule just added is not a subdirectory "
                                      + "of the source field. Therefore it is rejected. "
                                      + "(\"" + add_rule_window.rule.directory
                                      + "\" not a subdirectory of \"" + source_base + "\")",
                                      "Error");
                    return;
                }

                // Add new rule to rule_list.
                rule_lists.add_rule(add_rule_window.rule, add_rule_window.Category);
                modified = true;
                AddBackup_Page.redraw_backup_rules_listbox(Rules_lb, rule_lists);
            }
        }
Exemple #4
0
        void init_gui(DiskBackup disk_backup)
        {
            // Name_tb, Enabled_cb
            Name_tb.Text         = disk_backup.future_params.name;
            Enabled_cb.IsChecked = disk_backup.future_params.enabled;

            // Info_text
            source_base    = disk_backup.source_base;
            Info_text.Text = "Source: " + source_base + "\n"
                             + "Destination: " + disk_backup.destination_base;

            // Rules_lb
            rule_lists = disk_backup.future_params.rule_lists;
            AddBackup_Page.redraw_backup_rules_listbox(Rules_lb, rule_lists);
        }
Exemple #5
0
        private void Remove_btn_Click(object sender, RoutedEventArgs e)
        {
            int index = Rules_lb.SelectedIndex;

            if (index < 0)
            {
                return;
            }

            var item = (AddBackup_Page.Rule_ListBoxItem)Rules_lb.SelectedItem;

            rule_lists.backup_rule_lists[item.category].RemoveAt(item.index);

            modified = true;
            AddBackup_Page.redraw_backup_rules_listbox(Rules_lb, rule_lists);
        }