-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMainWindow.xaml
328 lines (303 loc) · 20.8 KB
/
MainWindow.xaml
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
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
<Window x:Class="HRM_Viewer.MainWindow"
Icon="pack://siteoforigin:,,,/Resources/main_icon.png"
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:local="clr-namespace:HRM_Viewer"
xmlns:vm="clr-namespace:HRM_Viewer.ViewModels"
xmlns:v="clr-namespace:HRM_Viewer.Views"
xmlns:m="clr-namespace:HRM_Viewer.Models"
xmlns:u="clr-namespace:HRM_Viewer.Utilities"
mc:Ignorable="d"
Title="HRM_Viewer" Height="800" MinHeight="450" Width="1200" Background="{StaticResource PaleCerulean}" MouseLeftButtonUp="Window_MouseLeftButtonUp">
<Window.DataContext>
<vm:MainViewModel/>
</Window.DataContext>
<Window.Resources>
<u:ErrorLabelBackgroundConverter x:Key="errBackConv"/>
<u:ErrorLabelForegroundConverter x:Key="errForConv"/>
<DataTemplate x:Key="SettingTemplate">
<v:Setting/>
</DataTemplate>
<DataTemplate x:Key="InfoTemplate">
<v:Info/>
</DataTemplate>
<DataTemplate x:Key="ComboIDTemplate">
<v:TemplatesIDComboBox/>
</DataTemplate>
</Window.Resources>
<Grid>
<Grid x:Name="MainGrid">
<Grid.RowDefinitions>
<RowDefinition Height="40"/>
<RowDefinition Height="*"/>
<RowDefinition Height="25"/>
</Grid.RowDefinitions>
<StackPanel Orientation="Horizontal" Grid.Row="0">
<Button Command="{Binding SaveSettingsCmd}" Style="{StaticResource ImageButton}" ToolTip="Save Settings">
<Button.Content>
<Image Height="30" Width="30" Source="pack://siteoforigin:,,,/Resources/save_icon.png"/>
</Button.Content>
</Button>
<Button Command="{Binding ReadSettingsCmd}" Style="{StaticResource ImageButton}" ToolTip="Read Settings">
<Button.Content>
<Image Height="30" Width="30" Source="pack://siteoforigin:,,,/Resources/read_icon.png"/>
</Button.Content>
</Button>
<Button Command="{Binding SaveParsedHtmlsCmd}" Style="{StaticResource ImageButton}" ToolTip="Save Parsed Htmls">
<Button.Content>
<Image Height="30" Width="30" Source="pack://siteoforigin:,,,/Resources/save_htmls_icon.png"/>
</Button.Content>
</Button>
</StackPanel>
<TabControl x:Name="MainTab" Grid.Row="1" Background="{StaticResource ShadowBlue}">
<TabItem Header="Settings">
<StackPanel Orientation="Vertical">
<!-- MAIN SETTINGS-->
<ItemsControl ItemsSource="{Binding MStModel.MainSettings}" BorderThickness="0">
<ItemsControl.Resources>
<DataTemplate DataType="{x:Type m:SettingObject}">
<v:Setting/>
</DataTemplate>
<DataTemplate DataType="{x:Type m:PasswordObject}">
<v:Password/>
</DataTemplate>
</ItemsControl.Resources>
</ItemsControl>
<StackPanel Orientation="Horizontal">
<Button Content="Apply" Command="{Binding MStModel.ApplySettingsCmd}"/>
<Button Content="Refresh" Command="{Binding MStModel.RefreshSettingsCmd}"/>
<Button Content="Test Connection" Command="{Binding MStModel.TestSQLConnectionCmd}"/>
</StackPanel>
</StackPanel>
</TabItem>
<TabItem Header="Viewer">
<Grid x:Name="ViewerMainLayout">
<Grid.RowDefinitions>
<RowDefinition Height="Auto" MinHeight="30"/>
<RowDefinition Height="Auto" MinHeight="30"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<Expander Grid.Row="0" Header="Input Settings">
<StackPanel Orientation="Vertical">
<ContentControl
x:Name="SelectedTemplateBox"
Content="{Binding VModel.DSService}"
ContentTemplate="{StaticResource ComboIDTemplate}"/>
<StackPanel Orientation="Horizontal">
<Button Content="Get Information" Command="{Binding VModel.GetHtmlTemplateInfoCmd}"/>
</StackPanel>
</StackPanel>
</Expander>
<Expander Grid.Row="1" Header="Output Data">
<DataGrid
ItemsSource="{Binding VModel.HtmlTemplateInfo}"
HorizontalAlignment="Stretch"
Width="auto"
AutoGenerateColumns="False"
CanUserAddRows="false"
IsReadOnly="True"
Margin="0,0,0,10">
<DataGrid.Columns>
<DataGridTextColumn Header="Name" Binding="{Binding htmlName}" Width="3*"/>
<DataGridTextColumn Header="Datasource" Binding="{Binding fullDatasourceName}" Width="5*"/>
<DataGridTextColumn Header="Type" Binding="{Binding datasourceType}" Width="2*"/>
<DataGridTextColumn Header="sPP" Binding="{Binding sParamPattern}" Width="1.3*"/>
<DataGridTextColumn Header="ePP" Binding="{Binding eParamPattern}" Width="1.3*"/>
<DataGridTextColumn Header="PrefID" Binding="{Binding preffixHtmlId}" Width="1.5*"/>
<DataGridTextColumn Header="SuffID" Binding="{Binding suffixHtmlId}" Width="1.5*"/>
<DataGridTextColumn Header="As1html" Binding="{Binding returnAsOneHtml}" Width="1.6*"/>
<DataGridTextColumn Header="OrderBy" Binding="{Binding orderByColumn}" Width="3*"/>
<DataGridTextColumn Header="SplitBy" Binding="{Binding splitResultSetBy}" Width="3*"/>
<DataGridTextColumn Header="SubjectCol" Binding="{Binding mSubjectColName}" Width="3*"/>
<DataGridTextColumn Header="AddressCol" Binding="{Binding mAddressColName}" Width="3*"/>
<DataGridTextColumn Header="Out" Binding="{Binding outputMode}" Width="1.2*"/>
<DataGridTextColumn Header="MailProf" Binding="{Binding mailProfile}" Width="2.5*"/>
<DataGridTextColumn Header="MergeOut" Binding="{Binding mergeOutHTMLs}" Width="2.5*" />
</DataGrid.Columns>
</DataGrid>
</Expander>
<TabControl
x:Name="SqlOutDataTabs"
Grid.Row="2"
BorderThickness="0, 0, 0, 0">
<TabItem Header="Html Source Code">
<Grid Margin="2,2,2,2">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="1*" MinWidth="60" MaxWidth="250"/>
<ColumnDefinition Width="6*" MinWidth="220"/>
</Grid.ColumnDefinitions>
<StackPanel
Grid.Column="0"
VerticalAlignment="Stretch"
CanHorizontallyScroll="True">
<Label Content="Parameters"
Style="{StaticResource Header}"
x:Name="ParametersHeader"
Margin="0,0,0,3"/>
<ListView x:Name="ParamListView"
ItemsSource="{Binding VModel.SCVM.DisplayedParameters}"
VerticalAlignment="Stretch"
BorderThickness="0"
SelectionMode="Multiple"/>
<!--SelectedItems="{Binding VModel.SCVM.ParametersSelected, UpdateSourceTrigger=PropertyChanged, Mode=OneWayToSource}"-->
<Button
Content="Highlight"
Command="{Binding VModel.SCVM.HighlightParametersCmd}"
CommandParameter="{Binding Path=SelectedItems, ElementName=ParamListView}"/>
</StackPanel>
<Grid Grid.Column="1" x:Name="ResizeableSrcCodeGrid" Margin="3,0,0,0">
<Grid.RowDefinitions>
<RowDefinition Height="0.5*" MinHeight="40"/>
<RowDefinition Height="Auto" />
<RowDefinition Height="0.5*" MinHeight="40"/>
</Grid.RowDefinitions>
<GridSplitter
Grid.Row="1"
ResizeDirection="Rows"
VerticalAlignment="Center"
HorizontalAlignment="Stretch"
Background="{StaticResource EnglishViolet}"
Height="5"/>
<Grid Grid.Row="0" x:Name="RawHtmlCodeGrid">
<Grid.RowDefinitions>
<RowDefinition Height="30"/>
<RowDefinition Height="*" MinHeight="10"/>
</Grid.RowDefinitions>
<Label Grid.Row="0"
x:Name="HtmlCodeHeader"
Style="{StaticResource Header}"
Content="Raw HTML Code"/>
<ScrollViewer Grid.Row="1">
<TextBlock
Text ="{Binding VModel.SCVM.OriginalHtmlCode}"
VerticalAlignment="Stretch"
HorizontalAlignment="Stretch"
TextWrapping="Wrap"
TextTrimming="None"
ScrollViewer.CanContentScroll="True"/>
</ScrollViewer>
</Grid>
<Grid Grid.Row="2" x:Name="RenderedHtmlCodeGrid">
<Grid.RowDefinitions>
<RowDefinition Height="30"/>
<RowDefinition Height="*" MinHeight="10"/>
</Grid.RowDefinitions>
<Label Grid.Row="0"
Style="{StaticResource Header}"
Content="HTML Code Preview"/>
<WebBrowser
Grid.Row="1"
u:BrowserBehavior.Html="{Binding VModel.SCVM.HtmlCode}"/>
</Grid>
</Grid>
</Grid>
</TabItem>
<TabItem Header="Datasource Results">
<Grid x:Name="ResizeableParsedHtmlsGrid" Margin="2, 2, 2, 2">
<Grid.RowDefinitions>
<RowDefinition Height="0.5*" MinHeight="40"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="0.5*" MinHeight="115"/>
</Grid.RowDefinitions>
<GridSplitter
Grid.Row="1"
ResizeDirection="Rows"
VerticalAlignment="Center"
HorizontalAlignment="Stretch"
Background="{StaticResource EnglishViolet}"
Height="5"/>
<Grid Grid.Row="0" x:Name="DatasourceResultsGrid">
<Grid.RowDefinitions>
<RowDefinition Height="Auto" MinHeight="30"/>
<RowDefinition Height="0.5*" MinHeight="50"/>
</Grid.RowDefinitions>
<Label Grid.Row="0"
Content="Datasource Results"
Style="{StaticResource Header}"/>
<ScrollViewer
Grid.Row="1"
VerticalScrollBarVisibility="Auto"
HorizontalScrollBarVisibility="Auto"
CanContentScroll="False">
<StackPanel>
<ContentControl Content="{Binding VModel.DRVM.FullDSName}" ContentTemplate="{StaticResource InfoTemplate}"/>
<StackPanel Orientation="Horizontal">
<Button Content="Get Data" Command="{Binding VModel.DRVM.GetDSRecordsCmd}"/>
</StackPanel>
<DataGrid
ItemsSource="{Binding VModel.DRVM.DSRecordSet}"
HorizontalAlignment="Stretch"
Width="auto"
AutoGenerateColumns="True"
ColumnWidth="auto"
CanUserAddRows="false"
IsReadOnly="True"
Margin="0,5,0,0"/>
</StackPanel>
</ScrollViewer>
</Grid>
<Grid Grid.Row="2" x:Name="ResultParsedHtmlsGrid">
<Grid.RowDefinitions>
<RowDefinition Height="Auto" MinHeight="30"/>
<RowDefinition Height="Auto" MinHeight="30"/>
<RowDefinition Height="*" MinHeight="50"/>
</Grid.RowDefinitions>
<Label Grid.Row="0"
Content="Result HTMLs"
Style="{StaticResource Header}"/>
<StackPanel Grid.Row="1" Orientation="Horizontal">
<Button Content="Download Data" Command="{Binding VModel.DRVM.GetParsedHtmlsCmd}"/>
<Button ToolTip="Go First" Style="{StaticResource ImageButton}" Command="{Binding VModel.DRVM.ChangeHtmlCmd}" CommandParameter="-2">
<Button.Content>
<Image Height="30" Width="30" Source="pack://siteoforigin:,,,/Resources/gofirst_icon.png"/>
</Button.Content>
</Button>
<Button ToolTip="Go Previous" Style="{StaticResource ImageButton}" Command="{Binding VModel.DRVM.ChangeHtmlCmd}" CommandParameter="-1">
<Button.Content>
<Image Height="25" Width="25" Source="pack://siteoforigin:,,,/Resources/goprevious_icon.png"/>
</Button.Content>
</Button>
<TextBox
Text="{Binding VModel.DRVM.CurrentHtmlNo, Mode=OneWay}"
Width="25"
IsReadOnly ="True"/>
<TextBox
Text="/"
Width="auto"
IsReadOnly ="True"
BorderThickness="0"/>
<TextBox
Text="{Binding VModel.DRVM.NoOfHtmls, Mode=OneWay}"
Width="25"
IsReadOnly ="True"/>
<Button ToolTip="Go Next" Style="{StaticResource ImageButton}" Command="{Binding VModel.DRVM.ChangeHtmlCmd}" CommandParameter="1">
<Button.Content>
<Image Height="25" Width="25" Source="pack://siteoforigin:,,,/Resources/gonext_icon.png"/>
</Button.Content>
</Button>
<Button ToolTip="Go Last" Style="{StaticResource ImageButton}" Command="{Binding VModel.DRVM.ChangeHtmlCmd}" CommandParameter="2">
<Button.Content>
<Image Height="30" Width="30" Source="pack://siteoforigin:,,,/Resources/golast_icon.png"/>
</Button.Content>
</Button>
</StackPanel>
<WebBrowser Grid.Row="2" u:BrowserBehavior.Html="{Binding VModel.DRVM.CurrentHtmlCode}"/>
</Grid>
</Grid>
</TabItem>
</TabControl>
</Grid>
</TabItem>
</TabControl>
<TextBox
x:Name="ErrorLabel"
Grid.Row="2"
Style="{StaticResource ErrorBox}"
Text="{Binding AppEx.ExMsg}"
Foreground="{Binding AppEx.OperationStatus, Converter={StaticResource errForConv}}"
Background="{Binding AppEx.OperationStatus, Converter={StaticResource errBackConv}}"/>
</Grid>
</Grid>
</Window>