Skip to content

Commit

Permalink
Added tooltips in MainWindow (#564)
Browse files Browse the repository at this point in the history
  • Loading branch information
Leo-Peyronnet committed May 19, 2024
1 parent a845b14 commit f2d314b
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 5 deletions.
27 changes: 23 additions & 4 deletions InternetTest/InternetTest/MainWindow.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,11 @@
FontSize="14"
Foreground="{DynamicResource Foreground1}"
RenderOptions.EdgeMode="Aliased"
Style="{StaticResource TitleBarButtonStyle}" />
Style="{StaticResource TitleBarButtonStyle}">
<Button.ToolTip>
<ToolTip x:Name="PinTooltip" Content="{x:Static lang:Resources.Pin}" />
</Button.ToolTip>
</Button>

<Button
x:Name="ConfidentialModeBtn"
Expand All @@ -184,6 +188,9 @@
Text="&#xFC2C;"
Visibility="Collapsed" />
</Grid>
<Button.ToolTip>
<ToolTip x:Name="ConfidentialModeTooltip" Content="{x:Static lang:Resources.EnableConfidential}" />
</Button.ToolTip>
</Button>
<Button
x:Name="MinimizeBtn"
Expand All @@ -197,7 +204,11 @@
FontSize="14"
Foreground="{DynamicResource Foreground1}"
RenderOptions.EdgeMode="Aliased"
Style="{StaticResource TitleBarButtonStyle}" />
Style="{StaticResource TitleBarButtonStyle}">
<Button.ToolTip>
<ToolTip Content="{x:Static lang:Resources.Minimize}" />
</Button.ToolTip>
</Button>
<Button
x:Name="MaximizeRestoreBtn"
Grid.Column="5"
Expand All @@ -210,7 +221,11 @@
FontSize="14"
Foreground="{DynamicResource Foreground1}"
RenderOptions.EdgeMode="Aliased"
Style="{StaticResource TitleBarButtonStyle}" />
Style="{StaticResource TitleBarButtonStyle}">
<Button.ToolTip>
<ToolTip x:Name="MaximizeTooltip" Content="{x:Static lang:Resources.Maximize}" />
</Button.ToolTip>
</Button>
<Button
x:Name="CloseBtn"
Grid.Column="6"
Expand All @@ -223,7 +238,11 @@
FontSize="14"
Foreground="{DynamicResource Foreground1}"
RenderOptions.EdgeMode="Aliased"
Style="{StaticResource TitleBarCloseButtonStyle}" />
Style="{StaticResource TitleBarCloseButtonStyle}">
<Button.ToolTip>
<ToolTip Content="{x:Static lang:Resources.Close}" />
</Button.ToolTip>
</Button>
</Grid>
</Border>

Expand Down
5 changes: 4 additions & 1 deletion InternetTest/InternetTest/MainWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,7 @@ private void HandleWindowStateChanged()
MaximizeRestoreBtn.FontSize = WindowState == WindowState.Maximized
? 18
: 14;

MaximizeTooltip.Content = WindowState == WindowState.Maximized ? Properties.Resources.Restore : Properties.Resources.Maximize;
DefineMaximumSize();

WindowBorder.Margin = WindowState == WindowState.Maximized ? new(10, 10, 0, 0) : new(10); // Set
Expand Down Expand Up @@ -433,13 +433,16 @@ private void ConfidentialModeBtn_Click(object sender, RoutedEventArgs e)
Global.LocateIpPage?.ToggleConfidentialMode(Global.IsConfidentialModeEnabled);
Global.IpConfigPage?.ToggleConfidentialMode(Global.IsConfidentialModeEnabled);
Global.WiFiPasswordsPage?.ToggleConfidentialMode();

ConfidentialModeTooltip.Content = !Global.IsConfidentialModeEnabled ? Properties.Resources.EnableConfidential : Properties.Resources.DisableConfidential;
}

private void PinBtn_Click(object sender, RoutedEventArgs e)
{
Topmost = !Topmost; // Toggle
PinBtn.Content = Topmost ? "\uF604" : "\uF602"; // Set text
Global.Settings.Pinned = Topmost;
PinTooltip.Content = Topmost ? Properties.Resources.Unpin : Properties.Resources.Pin;
}

private void DnsPageBtn_Click(object sender, RoutedEventArgs e)
Expand Down

0 comments on commit f2d314b

Please sign in to comment.