|
| 1 | + <!-- |
| 2 | +//<copyright> |
| 3 | +// Copyright by the Spark Development Network |
| 4 | +// |
| 5 | +// Licensed under the Rock Community License (the "License"); |
| 6 | +// you may not use this file except in compliance with the License. |
| 7 | +// You may obtain a copy of the License at |
| 8 | +// |
| 9 | +// http://www.rockrms.com/license |
| 10 | +// |
| 11 | +// Unless required by applicable law or agreed to in writing, software |
| 12 | +// distributed under the License is distributed on an "AS IS" BASIS, |
| 13 | +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 14 | +// See the License for the specific language governing permissions and |
| 15 | +// limitations under the License. |
| 16 | +//</copyright> |
| 17 | +--> |
| 18 | +<Window x:Class="RockDbBackupManager.MainWindow" |
| 19 | + xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" |
| 20 | + xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" |
| 21 | + xmlns:d="http://schemas.microsoft.com/expression/blend/2008" |
| 22 | + xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" |
| 23 | + xmlns:local="clr-namespace:RockDbBackupManager" |
| 24 | + mc:Ignorable="d" |
| 25 | + Title="RockDB Backup Manager" Height="435" Width="965" MinHeight="565" MinWidth="965"> |
| 26 | + <DockPanel> |
| 27 | + <Menu DockPanel.Dock="Top"> |
| 28 | + <Menu.ItemsPanel> |
| 29 | + <ItemsPanelTemplate> |
| 30 | + <DockPanel HorizontalAlignment="Stretch"/> |
| 31 | + </ItemsPanelTemplate> |
| 32 | + </Menu.ItemsPanel> |
| 33 | + <MenuItem Header="File"> |
| 34 | + <MenuItem Header="Exit" Click="ExitMenuItem_Click"/> |
| 35 | + </MenuItem> |
| 36 | + <MenuItem Header="Reset"> |
| 37 | + <MenuItem Header="Reset 'Restore Database' Warning" Click="RestoreWarningMenuItem_Click"/> |
| 38 | + </MenuItem> |
| 39 | + <MenuItem Header="Help" HorizontalAlignment="Right"> |
| 40 | + <MenuItem Header="About RockDB Backup Manager" Click="AboutMenuItem_Click"/> |
| 41 | + </MenuItem> |
| 42 | + </Menu> |
| 43 | + <Grid Margin="20"> |
| 44 | + <Grid.RowDefinitions> |
| 45 | + <RowDefinition Height="Auto"/> |
| 46 | + <RowDefinition Height="Auto"/> |
| 47 | + <RowDefinition Height="*"/> |
| 48 | + <RowDefinition Height="Auto"/> |
| 49 | + </Grid.RowDefinitions> |
| 50 | + <Grid.ColumnDefinitions> |
| 51 | + <ColumnDefinition Width="*"/> |
| 52 | + </Grid.ColumnDefinitions> |
| 53 | + |
| 54 | + <!-- Shared Controls --> |
| 55 | + <Grid Grid.Row="0" Grid.ColumnSpan="2" Margin="0,0,0,10"> |
| 56 | + <Grid.ColumnDefinitions> |
| 57 | + <ColumnDefinition Width="Auto"/> |
| 58 | + <ColumnDefinition Width="Auto"/> |
| 59 | + <ColumnDefinition Width="Auto"/> |
| 60 | + <ColumnDefinition Width="*"/> |
| 61 | + <ColumnDefinition Width="Auto"/> |
| 62 | + <ColumnDefinition Width="Auto"/> |
| 63 | + </Grid.ColumnDefinitions> |
| 64 | + <TextBlock Grid.Column="0" Text="Database:" VerticalAlignment="Center" Margin="0,0,10,0"/> |
| 65 | + <ComboBox Grid.Column="1" x:Name="DatabaseNameComboBox" Width="150" Margin="0,0,20,0" SelectionChanged="DatabaseNameComboBox_SelectionChanged"/> |
| 66 | + <TextBlock Grid.Column="2" Text="Backup Directory:" VerticalAlignment="Center" Margin="0,0,10,0"/> |
| 67 | + <TextBox Grid.Column="3" x:Name="BackupDirectoryTextBox" IsReadOnly="True" Text="C:\Program Files\Microsoft SQL Server\MSSQL16.MSSQLSERVER\MSSQL\Backup\"/> |
| 68 | + <Button Grid.Column="4" |
| 69 | + Width="24" |
| 70 | + Height="24" |
| 71 | + Margin="10,0,0,0" |
| 72 | + Padding="0" |
| 73 | + Background="Transparent" |
| 74 | + BorderThickness="0" |
| 75 | + BorderBrush="Transparent" |
| 76 | + Focusable="False" |
| 77 | + ToolTip="The directory where your database backups will be stored. You can change this to any folder, however, the SQL Server service account (typically NT SERVICE\MSSQLSERVER) must have write access to this directory, or backups will fail."> |
| 78 | + <TextBlock Text="?" FontWeight="Bold" FontSize="16" VerticalAlignment="Center" HorizontalAlignment="Center"/> |
| 79 | + </Button> |
| 80 | + <Button Grid.Column="5" x:Name="BrowseBackupDirectoryButton" Content="Browse..." Width="80" Margin="10,0,0,0" Click="BrowseBackupDirectoryButton_Click"/> |
| 81 | + </Grid> |
| 82 | + |
| 83 | + <!-- Backup Controls (Top) --> |
| 84 | + <GroupBox Header="Backup" Grid.Row="1" Grid.Column="0" Margin="0,0,0,10"> |
| 85 | + <StackPanel> |
| 86 | + <StackPanel Orientation="Horizontal" Margin="0,0,0,5"> |
| 87 | + <TextBlock Text="Additional Tags:" VerticalAlignment="Center" Margin="0,0,10,0"/> |
| 88 | + <TextBox x:Name="AdditionalTagsTextBox" Width="200"/> |
| 89 | + <Button Width="24" Height="24" Margin="10,0,0,0" Padding="0" |
| 90 | + Background="Transparent" BorderThickness="0" BorderBrush="Transparent" Focusable="False" |
| 91 | + ToolTip="Comma separated tags to add to the backup filename. Only alphanumeric characters are used. For example, 'clean, migrated' will result in a filename like yyyy_MM_dd_HHmmss_dbName_clean_migrated.bak. Note: All non-alphanumeric characters, including whitespace, are removed."> |
| 92 | + <TextBlock Text="?" FontWeight="Bold" FontSize="16" VerticalAlignment="Center" HorizontalAlignment="Center"/> |
| 93 | + </Button> |
| 94 | + </StackPanel> |
| 95 | + <Button x:Name="BackupButton" Content="Backup Selected Database" Width="150" Margin="0,10,0,10" Click="BackupButton_Click"/> |
| 96 | + </StackPanel> |
| 97 | + </GroupBox> |
| 98 | + |
| 99 | + <!-- Restore Controls (Bottom) --> |
| 100 | + <GroupBox Header="Restore" Grid.Row="2" Grid.Column="0" Margin="0,0,0,0"> |
| 101 | + <Grid Margin="20,0,20,0"> |
| 102 | + <Grid.RowDefinitions> |
| 103 | + <RowDefinition Height="Auto"/> |
| 104 | + <RowDefinition Height="*"/> |
| 105 | + <RowDefinition Height="Auto"/> |
| 106 | + <RowDefinition Height="Auto"/> |
| 107 | + </Grid.RowDefinitions> |
| 108 | + <TextBlock Grid.Row="0" Text="Available Backups:" Margin="0,0,0,5"/> |
| 109 | + <ListBox Grid.Row="1" x:Name="BackupFilesListBox" |
| 110 | + MinHeight="120" |
| 111 | + VerticalAlignment="Stretch" |
| 112 | + Height="Auto" |
| 113 | + SelectionChanged="BackupFilesListBox_SelectionChanged"> |
| 114 | + <ListBox.ItemTemplate> |
| 115 | + <DataTemplate> |
| 116 | + <StackPanel Orientation="Horizontal"> |
| 117 | + <TextBlock Text="{Binding}" VerticalAlignment="Center" Margin="0,0,10,0"/> |
| 118 | + <Button Content="X" Width="24" Height="24" Padding="0" Margin="0,0,0,0" |
| 119 | + Background="Transparent" BorderThickness="0" BorderBrush="Transparent" |
| 120 | + Focusable="False" Click="DeleteBackupButton_Click" |
| 121 | + Tag="{Binding}"/> |
| 122 | + </StackPanel> |
| 123 | + </DataTemplate> |
| 124 | + </ListBox.ItemTemplate> |
| 125 | + </ListBox> |
| 126 | + <StackPanel Grid.Row="2" Orientation="Horizontal" Margin="0,10,0,0"> |
| 127 | + <TextBox x:Name="RestoreFileTextBox" Width="200" IsReadOnly="True"/> |
| 128 | + <Button x:Name="BrowseRestoreFileButton" Content="Browse..." Width="80" Margin="10,0,0,0" Click="BrowseRestoreFileButton_Click"/> |
| 129 | + </StackPanel> |
| 130 | + <Button Grid.Row="4" x:Name="RestoreButton" Content="Restore Database" Width="150" Margin="0,10,0,0" Click="RestoreButton_Click"/> |
| 131 | + </Grid> |
| 132 | + </GroupBox> |
| 133 | + |
| 134 | + <!-- Status --> |
| 135 | + <TextBlock x:Name="StatusTextBlock" Grid.Row="3" Grid.Column="0" Margin="0,20,0,0" Foreground="DarkGreen" HorizontalAlignment="Stretch" TextWrapping="Wrap"/> |
| 136 | + </Grid> |
| 137 | + </DockPanel> |
| 138 | +</Window> |
0 commit comments