Skip to content

Commit

Permalink
Added new navigation system for Pined section (#511)
Browse files Browse the repository at this point in the history
  • Loading branch information
Leo-Peyronnet committed Dec 25, 2023
1 parent b146c40 commit ad396d4
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 24 deletions.
33 changes: 18 additions & 15 deletions InternetTest/InternetTest/MainWindow.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -265,13 +265,14 @@
Margin="0 10"
FontWeight="Bold"
Text="{x:Static lang:Resources.Pinned}" />
<Button
<RadioButton
x:Name="HomePageBtn"
HorizontalContentAlignment="Left"
Background="Transparent"
BorderThickness="0"
GroupName="NavBar"
Click="HomePageBtn_Click"
Style="{DynamicResource StandardButton}">
Style="{DynamicResource NavBarButton}">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
Expand Down Expand Up @@ -307,7 +308,7 @@
Text="{x:Static lang:Resources.Home}" />
</Grid>

<Button.Triggers>
<RadioButton.Triggers>
<EventTrigger RoutedEvent="MouseEnter">
<BeginStoryboard>
<Storyboard>
Expand All @@ -320,16 +321,17 @@
</Storyboard>
</BeginStoryboard>
</EventTrigger>
</Button.Triggers>
</Button>
<Button
</RadioButton.Triggers>
</RadioButton>
<RadioButton
x:Name="HistoryPageBtn"
Margin="0 5 0 0"
HorizontalContentAlignment="Left"
Background="Transparent"
BorderThickness="0"
GroupName="NavBar"
Click="HistoryPageBtn_Click"
Style="{DynamicResource StandardButton}">
Style="{DynamicResource NavBarButton}">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
Expand Down Expand Up @@ -372,7 +374,7 @@
Text="{x:Static lang:Resources.History}" />
</Grid>

<Button.Triggers>
<RadioButton.Triggers>
<EventTrigger RoutedEvent="MouseEnter">
<BeginStoryboard>
<Storyboard>
Expand All @@ -393,16 +395,17 @@
</Storyboard>
</BeginStoryboard>
</EventTrigger>
</Button.Triggers>
</Button>
<Button
</RadioButton.Triggers>
</RadioButton>
<RadioButton
x:Name="SettingsPageBtn"
Margin="0 5 0 0"
HorizontalContentAlignment="Left"
Background="Transparent"
BorderThickness="0"
GroupName="NavBar"
Click="SettingsPageBtn_Click"
Style="{DynamicResource StandardButton}">
Style="{DynamicResource NavBarButton}">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
Expand Down Expand Up @@ -439,7 +442,7 @@
Text="{x:Static lang:Resources.Settings}" />
</Grid>

<Button.Triggers>
<RadioButton.Triggers>
<EventTrigger RoutedEvent="MouseEnter">
<BeginStoryboard>
<Storyboard>
Expand All @@ -452,8 +455,8 @@
</Storyboard>
</BeginStoryboard>
</EventTrigger>
</Button.Triggers>
</Button>
</RadioButton.Triggers>
</RadioButton>

<TextBlock
Margin="0 10"
Expand Down
12 changes: 3 additions & 9 deletions InternetTest/InternetTest/MainWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -79,12 +79,12 @@ private void InitUI()
case AppPages.Home:
PageDisplayer.Content = Global.HomePage;
UnCheckAllButton();
CheckButton(HomePageBtn, true);
HomePageBtn.IsChecked = true;
break;
case AppPages.History:
PageDisplayer.Content = Global.HistoryPage;
UnCheckAllButton();
CheckButton(HistoryPageBtn, true);
HistoryPageBtn.IsChecked = true;
break;
case AppPages.Status:
PageDisplayer.Content = Global.StatusPage;
Expand Down Expand Up @@ -466,26 +466,20 @@ private void WifiPasswordsPageBtn_Click(object sender, RoutedEventArgs e)
private void HomePageBtn_Click(object sender, RoutedEventArgs e)
{
LeavePage();
UnCheckAllButton(); // Reset all states
CheckButton(HomePageBtn, true);

HomePageBtn.IsChecked = true;
PageDisplayer.Content = Global.HomePage; // Display the home page
}

private void HistoryPageBtn_Click(object sender, RoutedEventArgs e)
{
LeavePage();
UnCheckAllButton(); // Reset all states
CheckButton(HistoryPageBtn, true);

PageDisplayer.Content = Global.HistoryPage; // Display the history page
}

private void SettingsPageBtn_Click(object sender, RoutedEventArgs e)
{
LeavePage();
UnCheckAllButton(); // Reset all states
CheckButton(SettingsPageBtn, true);

PageDisplayer.Content = Global.SettingsPage;
}
Expand Down

0 comments on commit ad396d4

Please sign in to comment.