Skip to content

Commit

Permalink
Added the possibility to pin the window (#310)
Browse files Browse the repository at this point in the history
  • Loading branch information
Leo-Peyronnet committed Mar 22, 2022
1 parent 4f8951a commit 2978826
Show file tree
Hide file tree
Showing 7 changed files with 58 additions and 3 deletions.
12 changes: 9 additions & 3 deletions InternetTest/InternetTest/MainWindow.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -113,10 +113,16 @@
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="Auto"/>
</Grid.ColumnDefinitions>

<Button Grid.Column="1" FontSize="14" Content="&#xFC75;" FontFamily="/Fonts/#FluentSystemIcons-Regular" Name="MinimizeBtn" Click="MinimizeBtn_Click" RenderOptions.EdgeMode="Aliased" Style="{StaticResource TitleBarButtonStyle}" Background="Transparent" Width="46" Height="32" Foreground="{Binding Source={StaticResource Foreground1}}"/>
<Button Grid.Column="2" FontSize="14" Content="&#xF36B;" FontFamily="/Fonts/#FluentSystemIcons-Regular" Name="CloseBtn" Click="CloseBtn_Click" RenderOptions.EdgeMode="Aliased" Style="{StaticResource TitleBarCloseButtonStyle}" Background="Transparent" Width="46" Height="32" Foreground="{Binding Source={StaticResource Foreground1}}"/>

<Button Grid.Column="1" FontSize="14" Content="&#xF602;" FontFamily="/Fonts/#FluentSystemIcons-Regular" Name="PinBtn" Click="PinBtn_Click" RenderOptions.EdgeMode="Aliased" Style="{StaticResource TitleBarButtonStyle}" Background="Transparent" Width="46" Height="32" Foreground="{Binding Source={StaticResource Foreground1}}">
<Button.ToolTip>
<ToolTip x:Name="PinToolTip" Content="{x:Static lang:Resources.Pin}" Foreground="{Binding Source={StaticResource Foreground1}}" Background="{Binding Source={StaticResource Background1}}"/>
</Button.ToolTip>
</Button>
<Button Grid.Column="2" FontSize="14" Content="&#xFC75;" FontFamily="/Fonts/#FluentSystemIcons-Regular" Name="MinimizeBtn" Click="MinimizeBtn_Click" RenderOptions.EdgeMode="Aliased" Style="{StaticResource TitleBarButtonStyle}" Background="Transparent" Width="46" Height="32" Foreground="{Binding Source={StaticResource Foreground1}}"/>
<Button Grid.Column="3" FontSize="14" Content="&#xF36B;" FontFamily="/Fonts/#FluentSystemIcons-Regular" Name="CloseBtn" Click="CloseBtn_Click" RenderOptions.EdgeMode="Aliased" Style="{StaticResource TitleBarCloseButtonStyle}" Background="Transparent" Width="46" Height="32" Foreground="{Binding Source={StaticResource Foreground1}}"/>
</Grid>
</Border>

Expand Down
7 changes: 7 additions & 0 deletions InternetTest/InternetTest/MainWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -171,4 +171,11 @@ private void AnimatePage()
Storyboard.SetTargetProperty(t, new(Frame.MarginProperty));
storyboard.Begin(this);
}

private void PinBtn_Click(object sender, RoutedEventArgs e)
{
Topmost = !Topmost; // Pin/Unpin
PinBtn.Content = Topmost ? "\uF604" : "\uF602"; // Set text
PinToolTip.Content = Topmost ? Properties.Resources.Unpin : Properties.Resources.Pin; // Set text
}
}
18 changes: 18 additions & 0 deletions InternetTest/InternetTest/Properties/Resources.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions InternetTest/InternetTest/Properties/Resources.en-US.resx
Original file line number Diff line number Diff line change
Expand Up @@ -474,4 +474,10 @@
<data name="HideShowIP" xml:space="preserve">
<value>Hide or show the IP address</value>
</data>
<data name="Pin" xml:space="preserve">
<value>Pin</value>
</data>
<data name="Unpin" xml:space="preserve">
<value>Unpin</value>
</data>
</root>
6 changes: 6 additions & 0 deletions InternetTest/InternetTest/Properties/Resources.fr-FR.resx
Original file line number Diff line number Diff line change
Expand Up @@ -474,4 +474,10 @@
<data name="HideShowIP" xml:space="preserve">
<value>Cacher ou montrer l'adresse IP</value>
</data>
<data name="Pin" xml:space="preserve">
<value>Epingler</value>
</data>
<data name="Unpin" xml:space="preserve">
<value>Désépingler</value>
</data>
</root>
6 changes: 6 additions & 0 deletions InternetTest/InternetTest/Properties/Resources.resx
Original file line number Diff line number Diff line change
Expand Up @@ -454,4 +454,10 @@
<data name="HideShowIP" xml:space="preserve">
<value>Hide or show the IP address</value>
</data>
<data name="Pin" xml:space="preserve">
<value>Pin</value>
</data>
<data name="Unpin" xml:space="preserve">
<value>Unpin</value>
</data>
</root>
6 changes: 6 additions & 0 deletions InternetTest/InternetTest/Properties/Resources.zh-CN.resx
Original file line number Diff line number Diff line change
Expand Up @@ -474,4 +474,10 @@
<data name="HideShowIP" xml:space="preserve">
<value>Hide or show the IP address</value>
</data>
<data name="Pin" xml:space="preserve">
<value>Pin</value>
</data>
<data name="Unpin" xml:space="preserve">
<value>Unpin</value>
</data>
</root>

0 comments on commit 2978826

Please sign in to comment.