-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMainWindow.xaml
222 lines (171 loc) · 7.34 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
<Window
x:Class = "SubnetCalculatorGUI.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:SubnetCalculator"
mc:Ignorable= "d"
FontFamily = "Lucinda Console"
Title = "Subnet Calculator"
Height = "690"
Width = "420"
MinHeight="500"
MinWidth="360"
Icon="Properties\SubnetCalc.ico"
TextElement.FontFamily="Lucinda Console"
>
<!-- STYLE DEFINITIONS -->
<Window.Resources>
<Style x:Key="propValueStyle" TargetType="{x:Type TextBox}">
<Setter Property="Foreground" Value="#BBFFFFFF"/>
<Setter Property="VerticalAlignment" Value="Center"/>
<Setter Property="Background" Value="#44444444"/>
<Setter Property="IsReadOnly" Value="True"/>
<Setter Property="BorderThickness" Value="0"/>
<Setter Property="Padding" Value="5"/>
<Setter Property="FontSize" Value="18"/>
<Setter Property="Margin" Value="10,0"/>
</Style>
<Style x:Key="propNameStyle" TargetType="{x:Type Label}" >
<Setter Property="Foreground" Value="#AAFFFFFF" />
<Setter Property="Margin" Value="5"/>
<Setter Property="VerticalAlignment" Value="Center"/>
<Setter Property="FontSize" Value="18"/>
</Style>
<Style x:Key="inputNameStyle" TargetType="{x:Type Label}" BasedOn="{StaticResource propNameStyle}" >
<Setter Property="FontSize" Value="30"/>
<Setter Property="Foreground" Value="Purple"/>
<Setter Property="FontWeight" Value="Bold"/>
</Style>
<Style x:Key="inputValueStyle" TargetType="{x:Type TextBox}" BasedOn="{StaticResource propValueStyle}" >
<Setter Property="FontSize" Value="30"/>
<Setter Property="Background" Value="Transparent"/>
<Setter Property="Foreground" Value="White"/>
<Setter Property="IsReadOnly" Value="False"/>
<Setter Property="CaretBrush" Value="Snow"/>
<EventSetter Event="PreviewTextInput" Handler="InputPreviewTextInput"/>
<EventSetter Event="TextChanged" Handler="InputChanged"/>
</Style>
<Style x:Key="borderStyle" TargetType="{x:Type Border}">
<Setter Property="Background" Value="Purple"/>
<Setter Property="Margin" Value="10"/>
<Setter Property="CornerRadius" Value="10"/>
</Style>
</Window.Resources>
<!-- VISUAL DEFINITIONS -->
<Border Background="White">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="1*"/>
<RowDefinition Height="0.4*"/>
<RowDefinition Height="2*"/>
<RowDefinition Height="0.1*"/>
</Grid.RowDefinitions>
<!-- INPUT DEFINITIONS -->
<Grid Grid.Row="0">
<Grid.RowDefinitions>
<RowDefinition Height="0.75*"/>
<RowDefinition Height="1*"/>
</Grid.RowDefinitions>
<Grid Grid.Row="0">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="1.5*"/>
<ColumnDefinition Width="1*"/>
</Grid.ColumnDefinitions>
<Label Content="IP ADDRESS"
Target="{Binding ElementName=IP}"
Style="{StaticResource inputNameStyle}"
Margin="20, 0"
/>
<Label Content="PREFIX" Grid.Column="1"
Target="{Binding ElementName=Prefix}"
Style="{StaticResource inputNameStyle}"
Margin="10, 0"/>
</Grid>
<Border Grid.Row="1" Style="{StaticResource borderStyle}">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="1.4*"/>
<ColumnDefinition Width="0.1*"/>
<ColumnDefinition Width="1*"/>
</Grid.ColumnDefinitions>
<TextBox Grid.Column="0" x:Name="IP" Style="{StaticResource inputValueStyle}" />
<TextBlock Text="/" Grid.Column="1" HorizontalAlignment="Center" VerticalAlignment="Center" FontSize="30" Foreground="White" />
<TextBox Grid.Column="2" x:Name="Prefix" MaxLength="2" Style="{StaticResource inputValueStyle}"/>
</Grid>
</Border>
</Grid>
<!--Subnet slider-->
<StackPanel Grid.Row="1">
<Label DockPanel.Dock="Top" Content="Prefix Slider"
Foreground="Purple"
VerticalAlignment="Bottom"
Margin="20,0"
/>
<Slider DockPanel.Dock="Top"
VerticalAlignment="Center"
TickFrequency="1"
TickPlacement="BottomRight"
IsSnapToTickEnabled="True"
Minimum="8" Maximum="30"
ValueChanged="Slider_ValueChanged"
x:Name="PrefixSlider"
Value="24"
Margin="20,0"
Foreground="Purple"
/>
</StackPanel>
<!-- PROPERTY DEFINITIONS -->
<Border Grid.Row="2" Style="{StaticResource borderStyle}">
<Grid >
<Grid.RowDefinitions>
<RowDefinition/>
<RowDefinition/>
<RowDefinition/>
<RowDefinition/>
<RowDefinition/>
<RowDefinition/>
<RowDefinition/>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition/>
<ColumnDefinition/>
</Grid.ColumnDefinitions>
<!--Network ID-->
<Label Content="Network ID:" Style="{StaticResource propNameStyle}" Grid.Column="0" Grid.Row="0"
Target="{Binding ElementName=txtbxNetworkID}" ToolTip="Network ID is the portion of an IP address that identifies the TCP/IP network on which a host resides."/>
<TextBox x:Name="txtbxNetworkID" Style="{StaticResource propValueStyle}" Grid.Column="1" Grid.Row="0" />
<!--Broadcast IP-->
<Label Content="Broadcast IP:" Style="{StaticResource propNameStyle}" Grid.Column="0" Grid.Row="1"
Target="{Binding ElementName=txtbxBroadcast}" ToolTip="Broadcast address is the last address in the network, and it is used for addressing all the nodes in the network at the same time."/>
<TextBox x:Name="txtbxBroadcast" Style="{StaticResource propValueStyle}" Grid.Column="1" Grid.Row="1"/>
<!--First IP-->
<Label Content="First IP:" Style="{StaticResource propNameStyle}" Grid.Column="0" Grid.Row="2"
Target="{Binding ElementName=txtbxFirstIP}" ToolTip="First usable IP in network."/>
<TextBox x:Name="txtbxFirstIP" Style="{StaticResource propValueStyle}" Grid.Column="1" Grid.Row="2"/>
<!--Last IP-->
<Label Content="Last IP:" Style="{StaticResource propNameStyle}" Grid.Column="0" Grid.Row="3"
Target="{Binding ElementName=txtbxLastIP}" ToolTip="Last usable IP in network."/>
<TextBox x:Name="txtbxLastIP" Style="{StaticResource propValueStyle}" Grid.Column="1" Grid.Row="3"/>
<!--Subnet mask-->
<Label Content="Subnet mask:" Style="{StaticResource propNameStyle}" Grid.Column="0" Grid.Row="4"
Target="{Binding ElementName=txtbxSubnet}" ToolTip="Masks the bytes used for the network that cant be used for hosts."/>
<TextBox x:Name="txtbxSubnet" Style="{StaticResource propValueStyle}" Grid.Column="1" Grid.Row="4"/>
<!--Wildcard Mask-->
<Label Content="Wildcard mask:" Style="{StaticResource propNameStyle}" Grid.Column="0" Grid.Row="5"
Target="{Binding ElementName=txtbxWildcard}" ToolTip="Masks the bytes used for the hosts that arent used to specify the network."/>
<TextBox x:Name="txtbxWildcard" Style="{StaticResource propValueStyle}" Grid.Column="1" Grid.Row="5"/>
<!--Hosts-->
<Label Content="Hosts:" Style="{StaticResource propNameStyle}" Grid.Column="0" Grid.Row="6"
Target="{Binding ElementName=txtbxHosts}" ToolTip="Amount of useable hosts inside the network."/>
<TextBox x:Name="txtbxHosts" Style="{StaticResource propValueStyle}" Grid.Column="1" Grid.Row="6"/>
</Grid>
</Border>
<!-- AUTHOR LINK -->
<TextBlock Grid.Row="3" HorizontalAlignment="Right" Margin="10,0">
<Hyperlink NavigateUri="https://github.com/WilcoMatthijssen" RequestNavigate="Hyperlink_RequestNavigate" > Made by Wilco Matthijssen </Hyperlink>
</TextBlock>
</Grid>
</Border>
</Window>