-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMainWindow.xaml
More file actions
244 lines (214 loc) · 16.1 KB
/
MainWindow.xaml
File metadata and controls
244 lines (214 loc) · 16.1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
<metro:MetroWindow x:Class="DataBaseCompare.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:metro="http://metro.mahapps.com/winfx/xaml/controls"
xmlns:local="clr-namespace:DataBaseCompare"
xmlns:helpers="clr-namespace:DataBaseCompare.Helpers"
xmlns:vm="clr-namespace:DataBaseCompare.ViewModels"
xmlns:views="clr-namespace:DataBaseCompare.Views"
ShowIconOnTitleBar="True"
d:DataContext="{d:DesignInstance Type=vm:MainViewModel, IsDesignTimeCreatable=True}"
mc:Ignorable="d"
xmlns:meterialDesign="http://materialdesigninxaml.net/winfx/xaml/themes"
GlowBrush="{DynamicResource AccentColorBrush}"
TextElement.Foreground="{DynamicResource MaterialDesignBody}"
Icon="database_access.ico"
TextElement.FontWeight="Regular"
TextElement.FontSize="13"
TextOptions.TextFormattingMode="Ideal"
TextOptions.TextRenderingMode="Auto"
WindowStartupLocation="CenterScreen"
WindowState="Normal"
Background="{DynamicResource MaterialDesignPaper}"
FontFamily="{DynamicResource MaterialDesignFont}"
BorderThickness="1"
Closed="MetroWindow_Closed"
Title="{Binding Title, UpdateSourceTrigger=PropertyChanged}" Height="500" Width="850">
<metro:MetroWindow.DataContext>
<vm:MainViewModel />
</metro:MetroWindow.DataContext>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="auto" />
<RowDefinition />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition />
<ColumnDefinition />
</Grid.ColumnDefinitions>
<Border BorderBrush="AliceBlue" BorderThickness="0,0,1,0">
<StackPanel>
<Label HorizontalAlignment="Center" >Source</Label>
<views:ConnectionView DataContext="{Binding SourceConnection}" />
</StackPanel>
</Border>
<StackPanel Grid.Column="1">
<Label HorizontalAlignment="Center" >Destination</Label>
<views:ConnectionView DataContext="{Binding DestinationConnection}" />
</StackPanel>
<Grid Grid.Row="1" Grid.ColumnSpan="2" Margin="2">
<Grid.RowDefinitions>
<RowDefinition Height="auto" />
<RowDefinition Height="auto" />
<RowDefinition />
<RowDefinition Height="auto" />
<RowDefinition Height="auto" />
</Grid.RowDefinitions>
<StackPanel Orientation="Horizontal">
<Button Margin="2" Command="{Binding LoadSourceDatabases}" >Load Databases</Button>
<Button Margin="2" Command="{Binding SelectAll}" >Select All</Button>
</StackPanel>
<metro:MetroProgressBar Visibility="{Binding IsBusy, Converter={StaticResource CollapsedIfFalse}}" IsIndeterminate="True" Grid.ColumnSpan="2" Grid.Row="1" />
<ScrollViewer Grid.Row="2">
<ItemsControl Background="Transparent" ItemsSource="{Binding Databases}">
<ItemsControl.ItemTemplate>
<DataTemplate>
<Grid Margin="5,0,0,0">
<Grid.RowDefinitions>
<RowDefinition Height="auto" />
<RowDefinition Height="auto" />
<RowDefinition Height="auto" />
<RowDefinition Height="auto" />
<RowDefinition Height="auto" />
<RowDefinition Height="auto" />
<RowDefinition Height="auto" />
<RowDefinition Height="auto" />
<RowDefinition Height="auto" />
<RowDefinition />
</Grid.RowDefinitions>
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition />
<ColumnDefinition Width="auto" />
<ColumnDefinition Width="auto" />
<ColumnDefinition Width="auto" />
</Grid.ColumnDefinitions>
<CheckBox IsChecked="{Binding IsSelected,Mode=TwoWay}" VerticalAlignment="Stretch" VerticalContentAlignment="Center" Content="{Binding Name}" />
<Button Command="{Binding RefreshDatabaseTables}" Visibility="{Binding ShowTables, UpdateSourceTrigger=PropertyChanged, Converter={StaticResource CollapsedIfFalse}}" Grid.Column="1" Margin="1">
<meterialDesign:PackIcon Kind="Refresh" />
</Button>
<Button Command="{Binding ShowTablesCommand}" Grid.Column="2" Margin="1">
<meterialDesign:PackIcon Kind="Eye" />
</Button>
<Button Command="{Binding HideTablesCommand}" Grid.Column="3" Margin="1">
<meterialDesign:PackIcon Kind="EyeOff" />
</Button>
</Grid>
<metro:MetroProgressBar Visibility="{Binding IsBusy, Converter={StaticResource CollapsedIfFalse}}" IsIndeterminate="True" Grid.Row="1" />
<Label BorderBrush="Red" BorderThickness="0,0,0,0" Grid.Row="2" Visibility="{Binding Message, Converter={StaticResource HasValue}, UpdateSourceTrigger=PropertyChanged}" Content="{Binding Message, UpdateSourceTrigger=PropertyChanged}"></Label>
<TextBox IsReadOnly="True" Foreground="Red" Grid.Row="2" Visibility="{Binding Error, Converter={StaticResource HasValue}, UpdateSourceTrigger=PropertyChanged}" Text="{Binding Error, UpdateSourceTrigger=PropertyChanged}"></TextBox>
<Label Margin="30,0,0,0" Grid.Row="3" FontSize="20" Visibility="{Binding ShowTables,UpdateSourceTrigger=PropertyChanged, Converter={StaticResource CollapsedIfFalse}}" >Tables</Label>
<Border MaxHeight="150" Visibility="{Binding ShowTables,UpdateSourceTrigger=PropertyChanged, Converter={StaticResource CollapsedIfFalse}}" BorderBrush="White" BorderThickness="0,0,0,1" Margin="5" Grid.Row="4">
<ScrollViewer VerticalScrollBarVisibility="Auto">
<ItemsControl Margin="30,0,0,0" ItemsSource="{Binding Tables}">
<ItemsControl.ItemTemplate>
<DataTemplate>
<StackPanel Orientation="Horizontal">
<meterialDesign:PackIcon Kind="Table" />
<TextBlock Margin="2" Text="{Binding Name}" />
</StackPanel>
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>
</ScrollViewer>
</Border>
<Label Margin="30,0,0,0" Grid.Row="5" FontSize="20" Visibility="{Binding ShowTables,UpdateSourceTrigger=PropertyChanged, Converter={StaticResource CollapsedIfFalse}}" >Views</Label>
<Border MaxHeight="150" Grid.Row="6" Visibility="{Binding ShowTables,UpdateSourceTrigger=PropertyChanged, Converter={StaticResource CollapsedIfFalse}}" BorderBrush="White" BorderThickness="0,0,0,1" Margin="5">
<ScrollViewer VerticalScrollBarVisibility="Auto">
<ItemsControl Margin="30,0,0,0" ItemsSource="{Binding Views}">
<ItemsControl.ItemTemplate>
<DataTemplate>
<StackPanel Orientation="Horizontal">
<meterialDesign:PackIcon Kind="Table" />
<TextBlock Margin="2" Text="{Binding Name}" />
</StackPanel>
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>
</ScrollViewer>
</Border>
<Label Margin="30,0,0,0" Grid.Row="7" FontSize="20" Visibility="{Binding ShowTables,UpdateSourceTrigger=PropertyChanged, Converter={StaticResource CollapsedIfFalse}}" >Stored Procedures / Functions</Label>
<Border MaxHeight="150" Grid.Row="8" Visibility="{Binding ShowTables,UpdateSourceTrigger=PropertyChanged, Converter={StaticResource CollapsedIfFalse}}" BorderBrush="White" BorderThickness="0,0,0,1" Margin="5">
<ScrollViewer VerticalScrollBarVisibility="Auto">
<ItemsControl Margin="30,0,0,0" ItemsSource="{Binding Routines}">
<ItemsControl.ItemTemplate>
<DataTemplate>
<StackPanel Orientation="Horizontal">
<meterialDesign:PackIcon Kind="Table" />
<TextBlock Margin="2" Text="{Binding Name}" />
</StackPanel>
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>
</ScrollViewer>
</Border>
</Grid>
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>
</ScrollViewer>
<StackPanel Orientation="Horizontal" Grid.Row="3">
<metro:ToggleSwitch IsOn="{Binding CopyTables}" Content="Tables" />
<metro:ToggleSwitch IsOn="{Binding CopyData}" Content="Data" />
<metro:ToggleSwitch IsOn="{Binding DropDatabase}" Content="Drop Database" />
</StackPanel>
<Grid Grid.Row="4">
<Grid.RowDefinitions>
<RowDefinition Height="auto" />
<RowDefinition Height="auto" />
<RowDefinition Height="auto" />
</Grid.RowDefinitions>
<Label Grid.Row="0" Visibility="{Binding Message, Converter={StaticResource HasValue}, UpdateSourceTrigger=PropertyChanged}" Content="{Binding Message, UpdateSourceTrigger=PropertyChanged}"></Label>
<Label Foreground="Red" Grid.Row="1" Visibility="{Binding Error, Converter={StaticResource HasValue}, UpdateSourceTrigger=PropertyChanged}" Content="{Binding Error, UpdateSourceTrigger=PropertyChanged}"></Label>
<Button Grid.Row="2" Command="{Binding CopySelectedDatabases}" >Copy Database</Button>
</Grid>
</Grid>
<metro:Flyout Header="Database Config" IsOpen="{Binding SourceConnection.ShowConfiguration, UpdateSourceTrigger=PropertyChanged, Mode=TwoWay}" Position="Left" Width="300" Grid.ColumnSpan="5" Grid.RowSpan="5" Background="{DynamicResource HighlightBrush}">
<StackPanel DataContext="{Binding SourceConnection}">
<Label HorizontalContentAlignment="Center" FontSize="30" >Source Database</Label>
<Border Margin="1,0,1,0" BorderThickness="0,0,0,1" BorderBrush="White" ></Border>
<DockPanel Margin="3">
<Label VerticalAlignment="Center" Width="80" >Instance</Label>
<TextBox Text="{Binding ServerInstance}"></TextBox>
</DockPanel>
<DockPanel Margin="3">
<Label VerticalAlignment="Center" Width="80">UserName</Label>
<TextBox Text="{Binding UserName}" ></TextBox>
</DockPanel>
<DockPanel Margin="3">
<Label VerticalAlignment="Center" Width="80">Password</Label>
<PasswordBox helpers:PasswordHelper.Attach="True" helpers:PasswordHelper.Password="{Binding Password, Converter={StaticResource SecureValue}, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" ></PasswordBox>
</DockPanel>
<Button Grid.Column="2" Margin="1" TabIndex="-1" Command="{Binding TestConnection}">
<StackPanel Orientation="Horizontal">
<meterialDesign:PackIcon Kind="Play"></meterialDesign:PackIcon>
<TextBlock>Test Connection</TextBlock>
</StackPanel>
</Button>
<TextBlock HorizontalAlignment="Center" Text="{Binding Message}" Visibility="{Binding Message, Converter={StaticResource HasValue}}" Grid.ColumnSpan="4" Grid.Row="1" />
<TextBox IsReadOnly="True" BorderThickness="0" TextWrapping="Wrap" Text="{Binding ConnectionError}" Visibility="{Binding ConnectionError, Converter={StaticResource HasValue}}" Foreground="Red" Grid.ColumnSpan="4" Grid.Row="1" />
<metro:MetroProgressBar Visibility="{Binding IsBusy,Converter={StaticResource CollapsedIfFalse}, UpdateSourceTrigger=PropertyChanged}" Grid.Row="2" IsIndeterminate="True" Grid.ColumnSpan="4" />
</StackPanel>
</metro:Flyout>
<metro:Flyout Header="Database Config" IsOpen="{Binding DestinationConnection.ShowConfiguration, UpdateSourceTrigger=PropertyChanged, Mode=TwoWay}" Position="Right" Width="300" Grid.ColumnSpan="5" Grid.RowSpan="5" Background="{DynamicResource HighlightBrush}">
<StackPanel DataContext="{Binding DestinationConnection}">
<Label HorizontalContentAlignment="Center" FontSize="30" >Destination Database</Label>
<Border Margin="1,0,1,0" BorderThickness="0,0,0,1" BorderBrush="White" ></Border>
<DockPanel Margin="3">
<Label VerticalAlignment="Center" Width="80" >Instance</Label>
<TextBox Text="{Binding ServerInstance}"></TextBox>
</DockPanel>
<DockPanel Margin="3">
<Label VerticalAlignment="Center" Width="80">UserName</Label>
<TextBox Text="{Binding UserName}" ></TextBox>
</DockPanel>
<DockPanel Margin="3">
<Label VerticalAlignment="Center" Width="80">Password</Label>
<TextBox Text="{Binding Password, Converter={StaticResource SecureValue}}" ></TextBox>
</DockPanel>
</StackPanel>
</metro:Flyout>
</Grid>
</metro:MetroWindow>