-
Notifications
You must be signed in to change notification settings - Fork 0
/
MainWindow.xaml
306 lines (305 loc) · 17.6 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
<Window x:Name="window" x:Class="CardFilePBX.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:local="clr-namespace:CardFilePBX"
xmlns:xctk="http://schemas.xceed.com/wpf/xaml/toolkit"
mc:Ignorable="d"
Title="Картотека абонентов" Height="650" Width="1280" MinHeight="645" MinWidth="700"
FontFamily="Segoe UI"
FontSize="14"
PreviewMouseMove="ChangePopupLocation">
<Window.Resources>
<local:BooleanToVisibility x:Key="BooleanToVisibility"/>
<local:TariffConverter x:Key="TariffConverter"/>
<local:DbStateToBoolean x:Key="dbState" />
<local:InverseBooleanConverter x:Key="InverseBooleanConverter" />
<DrawingImage x:Key="PhotoPlace">
<DrawingImage.Drawing>
<DrawingGroup>
<GeometryDrawing Brush="LightSkyBlue"
Geometry="M260 8988 c0 -31 77 -264 113 -343 201 -437 481 -651 1602 -1225 925 -474 960 -493 1047 -584 55 -56 113 -147 139 -215 69 -182 122 -476 154 -855 14 -161 14 -181 0 -200 -175 -237 -283 -501 -355 -867 l-11 -57 -48 -6 c-55 -7 -89 -34 -120 -93 -23 -47 -102 -297 -125 -398 -8 -38 -27 -120 -41 -180 -34 -151 -40 -220 -25 -299 23 -125 84 -186 185 -186 l45 0 0 -37 c0 -21 -4 -112 -9 -203 -26 -451 -34 -879 -22 -1104 17 -318 57 -527 126 -667 43 -87 53 -102 116 -166 84 -85 224 -146 386 -168 37 -5 66 -17 96 -40 198 -151 436 -256 683 -301 121 -22 452 -25 617 -6 704 83 1185 428 1398 1004 65 177 109 422 109 609 0 115 -4 122 -108 177 l-58 31 -13 290 c-6 159 -14 300 -16 313 -2 12 -6 77 -7 143 l-3 119 52 9 c99 16 148 107 148 272 -1 158 -143 716 -208 813 -19 28 -65 57 -118 75 -12 4 -21 33 -34 104 -55 305 -150 581 -261 760 l-44 71 15 194 c23 283 51 473 97 653 42 167 76 254 126 327 39 57 136 150 194 187 57 36 344 186 923 481 272 139 325 167 545 288 74 41 153 84 175 96 84 47 294 182 381 246 265 197 437 414 534 673 23 61 80 252 80 267 0 7 -1330 10 -4230 10 -3202 0 -4230 -3 -4230 -12z" />
</DrawingGroup>
</DrawingImage.Drawing>
</DrawingImage>
</Window.Resources>
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="181*" MinWidth="276"/>
<ColumnDefinition Width="619*"/>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="24"/>
<RowDefinition/>
</Grid.RowDefinitions>
<Menu x:Name="TopMenu" Panel.ZIndex="10" Grid.Column="0" Grid.ColumnSpan="2"
ScrollViewer.VerticalScrollBarVisibility="Disabled"
UseLayoutRounding="False" HorizontalContentAlignment="Stretch" VerticalContentAlignment="Stretch">
<MenuItem Header="Файл" Width="40">
<MenuItem Header="Создать" Click="CreateDB"/>
<MenuItem Header="Открыть" Click="SetConnectionDB"/>
<MenuItem Header="Сохранить" Click="SaveDB"/>
<MenuItem Header="Проверить подключение" Click="ConnectionDB"/>
<Separator />
<MenuItem Header="Выход" Click="ExitProgram"/>
</MenuItem>
<MenuItem Header="Абоненты">
<MenuItem Header="Добавить" Click="AddAbonent"></MenuItem>
<MenuItem Header="Изменить" Click="EditButton_Click"></MenuItem>
<MenuItem Header="Удалить" Click="DeleteButton_Click"></MenuItem>
<Separator />
<MenuItem Header="Показать всю информацию" Click="AllInfo"></MenuItem>
</MenuItem>
<MenuItem Header="Таблица">
<MenuItem Header="Обновить" Click="RefreshBtn_Click"></MenuItem>
</MenuItem>
<MenuItem Header="?" Click="QuestionMark_Click"></MenuItem>
</Menu>
<Popup Name="NullSelectionPopup" IsOpen="False" Placement="Relative" HorizontalOffset="0" VerticalOffset="0" PlacementTarget="{Binding ElementName=window}" AllowsTransparency="True">
<Border BorderBrush="LightSkyBlue" BorderThickness="2" CornerRadius="3">
<TextBlock FontSize="11" Background="LightCyan" Padding="5" TextWrapping="Wrap" Text="Выберите для изменения"/>
</Border>
</Popup>
<Grid Grid.Column="1" Grid.Row="1" Margin="10 10 10 0">
<Grid.RowDefinitions>
<RowDefinition Height="10*"/>
</Grid.RowDefinitions>
<DataGrid x:Name="AbonentsDataGrid"
Margin="0 0 0 10"
Grid.Row="0" Grid.ColumnSpan="2"
ItemsSource="{Binding DataTable.DefaultView, Mode=OneWay, ValidatesOnNotifyDataErrors=False}"
AutoGeneratingColumn="AbonentsDataGrid_AutoGeneratingColumn"
CanUserResizeRows="False"
CanUserDeleteRows="False"
CanUserAddRows="False"
AutoGenerateColumns="True"
IsReadOnly="True"
CurrentCellChanged="AbonentViewChanged"
SelectionMode="Single">
</DataGrid>
</Grid>
<TabControl x:Name="TabMenu" Grid.Row="1" Grid.Column="0">
<TabControl.BitmapEffect>
<DropShadowBitmapEffect Color="LightGray" Direction="90" Noise="0" Softness="1" Opacity="0.5"/>
</TabControl.BitmapEffect>
<TabItem>
<TabItem.Header>
<StackPanel Orientation="Horizontal">
<TextBlock Margin="3" Cursor="Hand">Запись</TextBlock>
</StackPanel>
</TabItem.Header>
<!-- DB Write -->
<TabItem.Content>
<Grid Grid.Column="0" Grid.Row="1" Margin="10">
<StackPanel VerticalAlignment="Stretch" HorizontalAlignment="Stretch" Margin="10 5 0 5">
<DockPanel Margin="0 0 0 15">
<TextBlock TextWrapping="WrapWithOverflow" Text="Имя" VerticalAlignment="Center"/>
<TextBox x:Name="NameAddBox" HorizontalAlignment="Right" VerticalContentAlignment="Center"
PreviewTextInput="TextPreviewTextInput" Style="{Binding Source={StaticResource TextBox}}"/>
</DockPanel>
<DockPanel Margin="0 0 0 15">
<TextBlock TextWrapping="WrapWithOverflow" Text="Фамилия" VerticalAlignment="Center"/>
<TextBox x:Name="LastNameAddBox" HorizontalAlignment="Right" VerticalContentAlignment="Center"
PreviewTextInput="TextPreviewTextInput"
Style="{Binding Source={StaticResource TextBox}}"/>
</DockPanel>
<DockPanel Margin="0 0 0 15">
<TextBlock TextWrapping="WrapWithOverflow" Text="Отчество" VerticalAlignment="Center"/>
<TextBox x:Name="PatronymicAddBox" HorizontalAlignment="Right" VerticalContentAlignment="Center"
PreviewTextInput="TextPreviewTextInput"
Style="{Binding Source={StaticResource TextBox}}"/>
</DockPanel>
<DockPanel Margin="0 0 0 15" HorizontalAlignment="Stretch" VerticalAlignment="Stretch">
<TextBlock TextWrapping="WrapWithOverflow" Text="Номер телефона" VerticalAlignment="Center"/>
<xctk:MaskedTextBox x:Name="PhoneNumberAddBox" HorizontalAlignment="Right" VerticalContentAlignment="Center"
Style="{StaticResource TextBox}"
Mask="+7(000)000-00-00" GotFocus="PhoneNumberBox_GotFocus"/>
</DockPanel>
<DockPanel Margin="0 0 0 15">
<TextBlock TextWrapping="WrapWithOverflow" Text="Тариф" VerticalAlignment="Center" HorizontalAlignment="Stretch"/>
<ComboBox x:Name="TariffAddBox" VerticalContentAlignment="Center" HorizontalAlignment="Right"
Style="{StaticResource ComboBox}">
<ComboBoxItem Content="МегаТариф"/>
<ComboBoxItem Content="Максимум"/>
<ComboBoxItem Content="VIP"/>
<ComboBoxItem Content="Премиум"/>
</ComboBox>
</DockPanel>
</StackPanel>
<StackPanel Orientation="Vertical" VerticalAlignment="Bottom" Margin="15">
<!-- Add abonent button -->
<Button Content="Добавить" Height="30" Width="100" HorizontalContentAlignment="Center" Click="AddAbonent"
IsEnabled="{Binding State, Converter={StaticResource dbState}}"
Cursor="Hand" IsDefault="True"/>
</StackPanel>
</Grid>
</TabItem.Content>
</TabItem>
<!-- DB Search -->
<TabItem>
<TabItem.Header>
<StackPanel Orientation="Horizontal">
<TextBlock Margin="3" Cursor="Hand">Поиск</TextBlock>
</StackPanel>
</TabItem.Header>
<TabItem.Content>
<Grid Grid.Column="0" Grid.Row="1" Margin="10">
<StackPanel VerticalAlignment="Stretch" HorizontalAlignment="Stretch" Margin="10 5 0 5">
<DockPanel Margin="0 0 0 15">
<TextBlock TextWrapping="WrapWithOverflow" Text="Имя" VerticalAlignment="Center"/>
<TextBox x:Name="SearchNameBox" HorizontalAlignment="Right" VerticalContentAlignment="Center"
PreviewTextInput="TextPreviewTextInput"
Style="{Binding Source={StaticResource TextBox}}"/>
</DockPanel>
<DockPanel Margin="0 0 0 15">
<TextBlock TextWrapping="WrapWithOverflow" Text="Фамилия" VerticalAlignment="Center"/>
<TextBox x:Name="SearchLastNameBox" HorizontalAlignment="Right" VerticalContentAlignment="Center"
PreviewTextInput="TextPreviewTextInput"
Style="{Binding Source={StaticResource TextBox}}"/>
</DockPanel>
<DockPanel Margin="0 0 0 15">
<TextBlock TextWrapping="WrapWithOverflow" Text="Отчество" VerticalAlignment="Center"/>
<TextBox x:Name="SearchPatronymicBox" HorizontalAlignment="Right" VerticalContentAlignment="Center"
PreviewTextInput="TextPreviewTextInput"
Style="{Binding Source={StaticResource TextBox}}"/>
</DockPanel>
<DockPanel Margin="0 0 0 15">
<TextBlock TextWrapping="WrapWithOverflow" Text="Номер телефона" VerticalAlignment="Center"/>
<xctk:MaskedTextBox x:Name="SearchPhoneNumberBox" HorizontalAlignment="Right" VerticalContentAlignment="Center"
Style="{StaticResource TextBox}"
Mask="+7(000)000-00-00" GotFocus="PhoneNumberBox_GotFocus"/>
</DockPanel>
</StackPanel>
<StackPanel Orientation="Vertical" VerticalAlignment="Bottom" Margin="15">
<Button Content="Поиск" Height="30" Width="100" HorizontalContentAlignment="Center"
IsEnabled="{Binding State, Converter={StaticResource dbState}}" Click="SearchButton_Click" IsDefault="True"/>
</StackPanel>
</Grid>
</TabItem.Content>
</TabItem>
<!-- Selected abonent -->
<TabItem x:Name="AbonentCard">
<TabItem.Header>
<StackPanel Orientation="Horizontal">
<TextBlock Margin="3" Cursor="Hand">Карта абонента</TextBlock>
</StackPanel>
</TabItem.Header>
<TabItem.Content>
<Grid Grid.Column="0" Grid.Row="1" Margin="10">
<StackPanel Orientation="Vertical" Margin="0 0 0 0">
<DockPanel Margin="0 0 0 15" HorizontalAlignment="Center">
<TextBlock TextWrapping="WrapWithOverflow" Text="Идентификационный номер: "/>
<TextBlock Width="Auto" HorizontalAlignment="Left" Text="{Binding Path=AbonentView.Id}"/>
</DockPanel>
<!-- Photo -->
<Grid Height="150" Width="150" Margin="0 0 0 20">
<Border BorderThickness="2" BorderBrush="#c1c1c1"></Border>
<Image Stretch="Uniform">
<Image.Source>
<Binding Path="AbonentView.Photo" TargetNullValue="{StaticResource PhotoPlace}"/>
</Image.Source>
</Image>
</Grid>
<DockPanel Margin="0 0 0 15">
<TextBlock TextWrapping="WrapWithOverflow" Text="Имя" VerticalAlignment="Center"/>
<TextBox Width="100" HorizontalAlignment="Right" Text="{Binding AbonentView.Name, Mode=TwoWay}"
IsReadOnly="{Binding IsNoEditing}"
PreviewTextInput="TextPreviewTextInput"
Style="{Binding Source={StaticResource TextBox}}"/>
</DockPanel>
<DockPanel Margin="0 0 0 15">
<TextBlock TextWrapping="WrapWithOverflow" Text="Фамилия" VerticalAlignment="Center"/>
<TextBox Width="100" HorizontalAlignment="Right" Text="{Binding Path=AbonentView.LastName, Mode=TwoWay}"
IsReadOnly="{Binding IsNoEditing}"
PreviewTextInput="TextPreviewTextInput"
Style="{Binding Source={StaticResource TextBox}}"/>
</DockPanel>
<DockPanel Margin="0 0 0 15">
<TextBlock TextWrapping="WrapWithOverflow" Text="Отчество" VerticalAlignment="Center"/>
<TextBox Width="100" HorizontalAlignment="Right" Text="{Binding Path=AbonentView.Patronymic, Mode=TwoWay}"
IsReadOnly="{Binding IsNoEditing}"
PreviewTextInput="TextPreviewTextInput"
Style="{Binding Source={StaticResource TextBox}}"/>
</DockPanel>
<DockPanel Margin="0 0 0 15">
<TextBlock TextWrapping="WrapWithOverflow" Text="Номер телефона" VerticalAlignment="Center"/>
<xctk:MaskedTextBox Width="100" HorizontalAlignment="Right" Text="{Binding Path=AbonentView.PhoneNumber, Mode=TwoWay}"
IsReadOnly="{Binding IsNoEditing}"
Style="{Binding Source={StaticResource TextBox}}"
Mask="+7(000)000-00-00" GotFocus="PhoneNumberBox_GotFocus"/>
</DockPanel>
<DockPanel Margin="0 0 0 15">
<TextBlock TextWrapping="WrapWithOverflow" Text="Тариф" VerticalAlignment="Center" HorizontalAlignment="Stretch"/>
<ComboBox x:Name="TariffChangeComboBox" VerticalContentAlignment="Center" HorizontalAlignment="Right"
SelectedIndex="{Binding AbonentView.Tariff, Converter={StaticResource TariffConverter}, Mode=OneWay}"
IsReadOnly="{Binding IsNoEditing}" HorizontalContentAlignment="Left" VerticalAlignment="Stretch" Margin="0,0,0,0"
Style="{StaticResource ComboBox}">
<ComboBoxItem Content="МегаТариф"/>
<ComboBoxItem Content="Максимум"/>
<ComboBoxItem Content="VIP"/>
<ComboBoxItem Content="Премиум"/>
</ComboBox>
</DockPanel>
<Button Height="40" Width="Auto"
IsEnabled="{Binding AbonentView, TargetNullValue=false}"
HorizontalContentAlignment="Center" HorizontalAlignment="Stretch" Content="Информация" Click="GetAbonentInfo">
<Button.BorderBrush>
<LinearGradientBrush EndPoint="1,1" StartPoint="0,0">
<GradientStop Color="LightSkyBlue" Offset="0.5"/>
<GradientStop Color="#f73d52" Offset="1"/>
</LinearGradientBrush>
</Button.BorderBrush>
</Button>
</StackPanel>
<DockPanel VerticalAlignment="Bottom" Margin="0 15" HorizontalAlignment="Stretch">
<!-- Edit button -->
<Button Height="30" Width="40" HorizontalContentAlignment="Center"
IsEnabled="{Binding AbonentView, TargetNullValue=false}"
HorizontalAlignment="Left" Click="EditButton_Click" Visibility="{Binding IsNoEditing, Converter={StaticResource BooleanToVisibility}}">
<Button.Content>
<Path Height="23" Stretch="Uniform" Fill="#87cefa">
<Path.Data>
<Geometry>
M472.469,81.443l-63.6-63.6c-13.1-16.4-53.2-30.2-83.4,0l-290.9,289.9l0,0c-4.4,4.4-6.5,10.1-6.2,15.6l-27.1,141.8
c-4.2,16.2,11.9,26.6,22.9,25l147-29.2c4.2,0,7.3-2.1,10.4-5.2l290.9-289.8C495.469,142.943,495.469,104.443,472.469,81.443z
M354.669,46.043c6.3-7.3,18.8-7.3,26.1,0l17.3,17l-289.7,289.7l-30.1-30.4L354.669,46.043z M61.769,364.043l64.4,64.4l-80.1,15.8
L61.769,364.043z M444.369,135.643l-276.8,276.8l-30.1-30.4l290-290l16.8,16.5C453.469,118.343,449.169,130.743,444.369,135.643z
</Geometry>
</Path.Data>
</Path>
</Button.Content>
</Button>
<Button Height="30" Width="40" HorizontalContentAlignment="Center" HorizontalAlignment="Left"
IsEnabled="{Binding AbonentView, TargetNullValue=false}"
Click="ConfirmEditing" Visibility="{Binding IsNoEditing, ConverterParameter=1, Converter={StaticResource BooleanToVisibility}}">
<Button.Content>
<Path Height="23" Stretch="Uniform" Stroke="#87cefa" StrokeThickness="2">
<Path.Data>
<Geometry>
M16.145,2.571c-0.272-0.273-0.718-0.273-0.99,0L6.92,10.804l-4.241-4.27 c-0.272-0.274-0.715-0.274-0.989,0L0.204,8.019c-0.272,0.271-0.272,0.717,0,0.99l6.217,6.258c0.272,0.271,0.715,0.271,0.99,0 L17.63,5.047c0.276-0.273,0.276-0.72,0-0.994L16.145,2.571z</Geometry>
</Path.Data>
</Path>
</Button.Content>
</Button>
<Button Style="{StaticResource RedButton}" Height="30" Width="40"
IsEnabled="{Binding AbonentView, TargetNullValue=false}"
HorizontalContentAlignment="Center" HorizontalAlignment="Right"
Click="DeleteButton_Click">
<Button.Content>
<Path Width="20" Stretch="Uniform" Stroke="#f73d52">
<Path.Data>
<Geometry>
M310.4,235.083L459.88,85.527c12.545-12.546,12.545-32.972,0-45.671L429.433,9.409c-12.547-12.546-32.971-12.546-45.67,0 L234.282,158.967L85.642,10.327c-12.546-12.546-32.972-12.546-45.67,0L9.524,40.774c-12.546,12.546-12.546,32.972,0,45.671 l148.64,148.639L9.678,383.495c-12.546,12.546-12.546,32.971,0,45.67l30.447,30.447c12.546,12.546,32.972,12.546,45.67,0 l148.487-148.41l148.792,148.793c12.547,12.546,32.973,12.546,45.67,0l30.447-30.447c12.547-12.546,12.547-32.972,0-45.671 L310.4,235.083z
</Geometry>
</Path.Data>
</Path>
</Button.Content>
</Button>
</DockPanel>
</Grid>
</TabItem.Content>
</TabItem>
</TabControl>
</Grid>
</Window>