Skip to content

Commit cb10a6e

Browse files
committed
Added new Sidebar (#668)
1 parent a7d3795 commit cb10a6e

File tree

4 files changed

+326
-2
lines changed

4 files changed

+326
-2
lines changed
Lines changed: 272 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,272 @@
1+
<UserControl
2+
x:Class="InternetTest.Components.Sidebar"
3+
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
4+
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
5+
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
6+
xmlns:lang="clr-namespace:InternetTest.Properties"
7+
xmlns:local="clr-namespace:InternetTest.Components"
8+
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
9+
xmlns:sys="clr-namespace:System;assembly=mscorlib"
10+
d:DesignHeight="550"
11+
d:DesignWidth="300"
12+
FontFamily="..\Fonts\#Hauora"
13+
Foreground="{DynamicResource Foreground1}"
14+
mc:Ignorable="d">
15+
<UserControl.Resources>
16+
<BooleanToVisibilityConverter x:Key="BoolToVis" />
17+
</UserControl.Resources>
18+
<Border
19+
Margin="10"
20+
Padding="10"
21+
Background="{DynamicResource SidebarBackground}"
22+
BorderBrush="{DynamicResource Border}"
23+
BorderThickness="1"
24+
CornerRadius="6">
25+
<Grid>
26+
<Grid.RowDefinitions>
27+
<RowDefinition Height="Auto" />
28+
<RowDefinition Height="Auto" />
29+
<RowDefinition Height="Auto" />
30+
<RowDefinition Height="*" />
31+
<RowDefinition Height="Auto" />
32+
</Grid.RowDefinitions>
33+
<RadioButton
34+
Padding="5"
35+
HorizontalContentAlignment="Stretch"
36+
Background="Transparent"
37+
GroupName="Sidebar"
38+
Style="{DynamicResource SidebarButton}">
39+
<Grid>
40+
<Grid.ColumnDefinitions>
41+
<ColumnDefinition Width="Auto" />
42+
<ColumnDefinition />
43+
</Grid.ColumnDefinitions>
44+
<Border
45+
Width="40"
46+
Height="40"
47+
Margin="5"
48+
Padding="5"
49+
Background="{DynamicResource Accent}"
50+
CornerRadius="10">
51+
<TextBlock
52+
HorizontalAlignment="Center"
53+
VerticalAlignment="Center"
54+
FontFamily="..\Fonts\#FluentSystemIcons-Filled"
55+
FontSize="20"
56+
Foreground="{DynamicResource WindowButtonsHoverForeground1}"
57+
Text="&#xF488;" />
58+
</Border>
59+
<StackPanel
60+
Grid.Column="1"
61+
Margin="10 0 0 0"
62+
VerticalAlignment="Center">
63+
<TextBlock
64+
FontSize="16"
65+
FontWeight="Bold"
66+
Text="{x:Static lang:Resources.InternetTest}" />
67+
<TextBlock Text="{x:Static lang:Resources.Home}" />
68+
</StackPanel>
69+
</Grid>
70+
</RadioButton>
71+
<TextBlock
72+
Grid.Row="1"
73+
Margin="0 10"
74+
FontWeight="SemiBold"
75+
Foreground="{DynamicResource Foreground2}"
76+
Text="{x:Static lang:Resources.Tools}" />
77+
78+
<StackPanel Grid.Row="2">
79+
<ToggleButton
80+
x:Name="WebUtilsBtn"
81+
Padding="5"
82+
HorizontalContentAlignment="Left"
83+
Background="Transparent"
84+
Style="{DynamicResource SidebarChevronButton}">
85+
<StackPanel Orientation="Horizontal">
86+
<TextBlock
87+
VerticalAlignment="Center"
88+
FontFamily="..\Fonts\#FluentSystemIcons-Regular"
89+
FontSize="16"
90+
Text="&#xF45B;" />
91+
<TextBlock
92+
Grid.Column="1"
93+
Margin="10 0 0 0"
94+
VerticalAlignment="Center"
95+
FontWeight="SemiBold"
96+
Text="{x:Static lang:Resources.WebUtilities}" />
97+
98+
</StackPanel>
99+
</ToggleButton>
100+
<Grid Visibility="{Binding IsChecked, ElementName=WebUtilsBtn, Converter={StaticResource BoolToVis}}">
101+
<Grid.ColumnDefinitions>
102+
<ColumnDefinition Width="Auto" />
103+
<ColumnDefinition />
104+
</Grid.ColumnDefinitions>
105+
<Rectangle
106+
Width="1"
107+
Margin="13 0 12 0"
108+
Fill="{DynamicResource Border}"
109+
RadiusX="1"
110+
RadiusY="1" />
111+
<StackPanel Grid.Column="1">
112+
<RadioButton
113+
Grid.Row="4"
114+
Padding="5"
115+
HorizontalContentAlignment="Left"
116+
Background="Transparent"
117+
Content="{x:Static lang:Resources.DownDetector}"
118+
GroupName="Sidebar"
119+
Style="{DynamicResource SidebarButton}" />
120+
<RadioButton
121+
Grid.Row="4"
122+
Padding="5"
123+
HorizontalContentAlignment="Left"
124+
Background="Transparent"
125+
Content="{x:Static lang:Resources.DNSTool}"
126+
GroupName="Sidebar"
127+
Style="{DynamicResource SidebarButton}" />
128+
<RadioButton
129+
Grid.Row="4"
130+
Padding="5"
131+
HorizontalContentAlignment="Left"
132+
Background="Transparent"
133+
Content="{x:Static lang:Resources.WiFi}"
134+
GroupName="Sidebar"
135+
Style="{DynamicResource SidebarButton}" />
136+
</StackPanel>
137+
</Grid>
138+
<ToggleButton
139+
x:Name="IpBtn"
140+
Padding="5"
141+
HorizontalContentAlignment="Left"
142+
Background="Transparent"
143+
Style="{DynamicResource SidebarChevronButton}">
144+
<StackPanel Orientation="Horizontal">
145+
<TextBlock
146+
VerticalAlignment="Center"
147+
FontFamily="..\Fonts\#FluentSystemIcons-Regular"
148+
FontSize="16"
149+
Text="&#xF4F9;" />
150+
<TextBlock
151+
Grid.Column="1"
152+
Margin="10 0 0 0"
153+
VerticalAlignment="Center"
154+
FontWeight="SemiBold"
155+
Text="{x:Static lang:Resources.IPTools}" />
156+
157+
</StackPanel>
158+
</ToggleButton>
159+
<Grid Visibility="{Binding IsChecked, ElementName=IpBtn, Converter={StaticResource BoolToVis}}">
160+
<Grid.ColumnDefinitions>
161+
<ColumnDefinition Width="Auto" />
162+
<ColumnDefinition />
163+
</Grid.ColumnDefinitions>
164+
<Rectangle
165+
Width="1"
166+
Margin="13 0 12 0"
167+
Fill="{DynamicResource Border}"
168+
RadiusX="1"
169+
RadiusY="1" />
170+
<StackPanel Grid.Column="1">
171+
<RadioButton
172+
Grid.Row="4"
173+
Padding="5"
174+
HorizontalContentAlignment="Left"
175+
Background="Transparent"
176+
Content="{x:Static lang:Resources.LocateIP}"
177+
GroupName="Sidebar"
178+
Style="{DynamicResource SidebarButton}" />
179+
<RadioButton
180+
Grid.Row="4"
181+
Padding="5"
182+
HorizontalContentAlignment="Left"
183+
Background="Transparent"
184+
Content="{x:Static lang:Resources.IPConfig}"
185+
GroupName="Sidebar"
186+
Style="{DynamicResource SidebarButton}" />
187+
</StackPanel>
188+
</Grid>
189+
<ToggleButton
190+
x:Name="CommandBtn"
191+
Padding="5"
192+
HorizontalContentAlignment="Left"
193+
Background="Transparent"
194+
Style="{DynamicResource SidebarChevronButton}">
195+
<StackPanel Orientation="Horizontal">
196+
<TextBlock
197+
VerticalAlignment="Center"
198+
FontFamily="..\Fonts\#FluentSystemIcons-Regular"
199+
FontSize="16"
200+
Text="&#xF8B9;" />
201+
<TextBlock
202+
Grid.Column="1"
203+
Margin="10 0 0 0"
204+
VerticalAlignment="Center"
205+
FontWeight="SemiBold"
206+
Text="{x:Static lang:Resources.Commands}" />
207+
208+
</StackPanel>
209+
</ToggleButton>
210+
<Grid Visibility="{Binding IsChecked, ElementName=CommandBtn, Converter={StaticResource BoolToVis}}">
211+
<Grid.ColumnDefinitions>
212+
<ColumnDefinition Width="Auto" />
213+
<ColumnDefinition />
214+
</Grid.ColumnDefinitions>
215+
<Rectangle
216+
Width="1"
217+
Margin="13 0 12 0"
218+
Fill="{DynamicResource Border}"
219+
RadiusX="1"
220+
RadiusY="1" />
221+
<StackPanel Grid.Column="1">
222+
<RadioButton
223+
Grid.Row="4"
224+
Padding="5"
225+
HorizontalContentAlignment="Left"
226+
Background="Transparent"
227+
Content="{x:Static lang:Resources.Ping}"
228+
GroupName="Sidebar"
229+
Style="{DynamicResource SidebarButton}" />
230+
<RadioButton
231+
Grid.Row="4"
232+
Padding="5"
233+
HorizontalContentAlignment="Left"
234+
Background="Transparent"
235+
Content="{x:Static lang:Resources.Requests}"
236+
GroupName="Sidebar"
237+
Style="{DynamicResource SidebarButton}" />
238+
<RadioButton
239+
Grid.Row="4"
240+
Padding="5"
241+
HorizontalContentAlignment="Left"
242+
Background="Transparent"
243+
Content="{x:Static lang:Resources.TraceRoute}"
244+
GroupName="Sidebar"
245+
Style="{DynamicResource SidebarButton}" />
246+
</StackPanel>
247+
</Grid>
248+
</StackPanel>
249+
250+
<RadioButton
251+
Grid.Row="4"
252+
Padding="5"
253+
HorizontalContentAlignment="Left"
254+
Background="Transparent"
255+
GroupName="Sidebar"
256+
Style="{DynamicResource SidebarButton}">
257+
<StackPanel Orientation="Horizontal">
258+
<TextBlock
259+
VerticalAlignment="Center"
260+
FontFamily="..\Fonts\#FluentSystemIcons-Regular"
261+
FontSize="16"
262+
Text="&#xF6AA;" />
263+
<TextBlock
264+
Margin="10 0 0 0"
265+
VerticalAlignment="Center"
266+
FontWeight="SemiBold"
267+
Text="{x:Static lang:Resources.Settings}" />
268+
</StackPanel>
269+
</RadioButton>
270+
</Grid>
271+
</Border>
272+
</UserControl>
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
/*
2+
MIT License
3+
4+
Copyright (c) Léo Corporation
5+
6+
Permission is hereby granted, free of charge, to any person obtaining a copy
7+
of this software and associated documentation files (the "Software"), to deal
8+
in the Software without restriction, including without limitation the rights
9+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10+
copies of the Software, and to permit persons to whom the Software is
11+
furnished to do so, subject to the following conditions:
12+
13+
The above copyright notice and this permission notice shall be included in all
14+
copies or substantial portions of the Software.
15+
16+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22+
SOFTWARE.
23+
*/
24+
using System.Windows.Controls;
25+
26+
namespace InternetTest.Components
27+
{
28+
/// <summary>
29+
/// Interaction logic for Sidebar.xaml
30+
/// </summary>
31+
public partial class Sidebar : UserControl
32+
{
33+
public Sidebar()
34+
{
35+
InitializeComponent();
36+
}
37+
}
38+
}

InternetTest/InternetTest/MainWindow.xaml

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
x:Class="InternetTest.MainWindow"
33
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
44
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
5+
xmlns:components="clr-namespace:InternetTest.Components"
56
xmlns:controls="clr-namespace:MicaWPF.Lite.Controls;assembly=MicaWPF.Lite"
67
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
78
xmlns:lang="clr-namespace:InternetTest.Properties"
@@ -12,7 +13,20 @@
1213
Height="600"
1314
MinWidth="500"
1415
MinHeight="500"
16+
FontFamily="\Fonts\#Hauora"
1517
WindowStartupLocation="CenterScreen"
1618
mc:Ignorable="d">
17-
<Grid />
19+
<Grid>
20+
<Grid.ColumnDefinitions>
21+
<ColumnDefinition Width="250" />
22+
<ColumnDefinition />
23+
</Grid.ColumnDefinitions>
24+
<components:Sidebar Grid.Column="0" />
25+
<ScrollViewer
26+
Grid.Column="1"
27+
HorizontalScrollBarVisibility="Disabled"
28+
VerticalScrollBarVisibility="Auto">
29+
<ContentControl Content="{Binding CurrentViewModel}" />
30+
</ScrollViewer>
31+
</Grid>
1832
</controls:MicaWindow>

InternetTest/InternetTest/Themes/Dark.xaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
<SolidColorBrush x:Key="Background1" Color="#0A0A1E" />
77
<SolidColorBrush x:Key="CardBackground" Color="#141446" />
8-
<SolidColorBrush x:Key="SidebarBackground" Color="#CC141446" />
8+
<SolidColorBrush x:Key="SidebarBackground" Color="#3F141446" />
99
<SolidColorBrush x:Key="Foreground1" Color="#FFFFFF" />
1010
<SolidColorBrush x:Key="Foreground2" Color="#DBDBD7" />
1111
<SolidColorBrush x:Key="WindowButtonsHover1" Color="#141428" />

0 commit comments

Comments
 (0)