Example #1
0
        private void sideBarButton3_Click(object sender, RoutedEventArgs e)
        {
            if (backupList.SelectedItem == null)
            {
                MessageBox.Show(this, "You need to select an item", "Error", MessageBoxButton.OK, MessageBoxImage.Error);
                return;
            }
            int index  = backupList.SelectedIndex;
            var dialog = new AddNewBackupDialog();

            // Customize the dialog.
            dialog.Title.Content = "Edit the backup";
            Backup backup = bm.backups[index];

            dialog.nameTextBox.Text     = backup.name;
            dialog.locationTextBox.Text = backup.url;
            dialog.delayTextBox.Text    = (backup.backupDelay / 60).ToString();

            dialog.Owner = this;
            dialog.ShowDialog();

            if (dialog.Success)
            {
                // Refresh the variable(It could've changed because of the threads.)
                backup = bm.backups[index];
                // Update the backup with the new properties.
                backup.name        = dialog.nameTextBox.Text;
                backup.url         = dialog.locationTextBox.Text;
                backup.backupDelay = int.Parse(dialog.delayTextBox.Text) * 60;
                bm.backups[index]  = backup;
                bm.SaveBackupFile();
            }
        }
Example #2
0
        private void sideBarButton2_Click(object sender, RoutedEventArgs e)
        {
            var dialog = new AddNewBackupDialog();

            dialog.Owner = this;
            dialog.ShowDialog();

            if (dialog.Success)
            {
                bm.backups.Add(new Backup(String.Format(templateBackupString, dialog.nameTextBox.Text, dialog.locationTextBox.Text, (Int32.Parse(dialog.delayTextBox.Text) * 60).ToString())));
            }
        }