Skip to content

Commit

Permalink
added about window
Browse files Browse the repository at this point in the history
  • Loading branch information
Prevter committed Sep 23, 2023
1 parent 04ae725 commit f38c363
Show file tree
Hide file tree
Showing 12 changed files with 313 additions and 2 deletions.
1 change: 1 addition & 0 deletions FloatTool/App.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
<ResourceDictionary Source="Assets/DiscordLogo.xaml"/>
<ResourceDictionary Source="Assets/SettingsIcon.xaml"/>
<ResourceDictionary Source="Assets/BenchmarkIcon.xaml"/>
<ResourceDictionary Source="Assets/AboutIcon.xaml"/>
<ResourceDictionary Source="Assets/ButtonIcons.xaml"/>
<!-- Translations -->
<ResourceDictionary Source="Languages/Lang.cs.xaml"/>
Expand Down
23 changes: 23 additions & 0 deletions FloatTool/Assets/AboutIcon.xaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<!--
- Copyright (C) 2023 Prevter
-
- This program is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program. If not, see <https://www.gnu.org/licenses/>.
-->
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
>
<Geometry x:Key="AboutIcon">
M482.906-269.333q17.427 0 29.594-12.25 12.166-12.25 12.166-30.084v-166.667q0-17.183-12.283-29.424Q500.099-520 482.673-520q-17.427 0-29.717 12.242-12.289 12.241-12.289 29.424v166.667q0 17.834 12.406 30.084 12.407 12.25 29.833 12.25Zm-3.035-337.333q17.796 0 29.962-11.833Q522-630.332 522-647.824q0-18.809-12.021-30.825-12.021-12.017-29.792-12.017-18.52 0-30.354 11.841Q438-666.984 438-648.508q0 17.908 12.038 29.875 12.038 11.967 29.833 11.967Zm.001 547.999q-87.157 0-163.841-33.353-76.684-33.354-133.671-90.34-56.986-56.987-90.34-133.808-33.353-76.821-33.353-164.165 0-87.359 33.412-164.193 33.413-76.834 90.624-134.057 57.211-57.224 133.757-89.987t163.578-32.763q87.394 0 164.429 32.763 77.034 32.763 134.117 90 57.082 57.237 89.916 134.292 32.833 77.056 32.833 164.49 0 87.433-32.763 163.67-32.763 76.236-89.987 133.308-57.223 57.073-134.261 90.608-77.037 33.535-164.45 33.535Z
</Geometry>
</ResourceDictionary>
Binary file added FloatTool/Assets/Icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
8 changes: 6 additions & 2 deletions FloatTool/FloatTool.csproj
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
<Project Sdk="Microsoft.NET.Sdk">
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
Expand All @@ -7,7 +6,6 @@
<UseWPF>true</UseWPF>
<PlatformTarget>x64</PlatformTarget>
<Authors>Prevter</Authors>
<PackageProjectUrl>https://prevter.ml/floattool</PackageProjectUrl>
<PackageProjectUrl>https://prevter.tk/floattool</PackageProjectUrl>
<RepositoryUrl>https://github.com/prevter/floattool</RepositoryUrl>
<NeutralLanguage>en</NeutralLanguage>
Expand All @@ -30,6 +28,7 @@

<ItemGroup>
<None Remove="Assets\Found.wav" />
<None Remove="Assets\Icon.png" />
<None Remove="Assets\SkinList.json" />
</ItemGroup>

Expand All @@ -39,6 +38,7 @@

<ItemGroup>
<EmbeddedResource Include="Assets\Found.wav" />
<Resource Include="Assets\Icon.png" />
<EmbeddedResource Include="Assets\SkinList.json" />
</ItemGroup>

Expand All @@ -50,6 +50,10 @@
</ItemGroup>

<ItemGroup>
<Page Update="Assets\AboutIcon.xaml">
<Generator>MSBuild:Compile</Generator>
<LastGenOutput>AboutIcon.Designer.cs</LastGenOutput>
</Page>
<Page Update="Languages\Lang.ru.xaml">
<XamlRuntime>$(DefaultXamlRuntime)</XamlRuntime>
</Page>
Expand Down
6 changes: 6 additions & 0 deletions FloatTool/FloatTool.csproj.user
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@
<_LastSelectedProfileId>E:\PROJECTS\FloatTool\FloatTool\Properties\PublishProfiles\FolderProfile.pubxml</_LastSelectedProfileId>
</PropertyGroup>
<ItemGroup>
<Compile Update="Views\AboutWindow.xaml.cs">
<SubType>Code</SubType>
</Compile>
<Compile Update="Views\BenchmarkWindow.xaml.cs">
<SubType>Code</SubType>
</Compile>
Expand Down Expand Up @@ -45,6 +48,9 @@
<Page Update="Theme\TooltipStyle.xaml">
<SubType>Designer</SubType>
</Page>
<Page Update="Views\AboutWindow.xaml">
<SubType>Designer</SubType>
</Page>
<Page Update="Views\BenchmarkWindow.xaml">
<SubType>Designer</SubType>
</Page>
Expand Down
12 changes: 12 additions & 0 deletions FloatTool/Languages/Lang.ru.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -84,4 +84,16 @@
<v:String x:Key="m_UpdateAvailable">Доступно обновление</v:String>
<v:String x:Key="m_Later">Позже</v:String>
<v:String x:Key="m_DoNotAsk">Не напоминать</v:String>

<!-- About window -->
<v:String x:Key="m_About">Информация</v:String>
<v:String x:Key="m_Version">Версия:</v:String>
<v:String x:Key="m_Author">Автор:</v:String>
<v:String x:Key="m_License">Лицензия:</v:String>
<v:String x:Key="m_SourceCode">Исходный код:</v:String>
<v:String x:Key="m_Thanks">Благодарности:</v:String>
<v:String x:Key="m_UsedLibraries">Использованные библиотеки:</v:String>
<v:String x:Key="m_CheckUpdates">Проверить обновления</v:String>
<v:String x:Key="m_DiscordServer">Discord сервер:</v:String>

</ResourceDictionary>
12 changes: 12 additions & 0 deletions FloatTool/Languages/Lang.uk.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -89,4 +89,16 @@
<v:String x:Key="m_UpdateAvailable">Доступне оновлення</v:String>
<v:String x:Key="m_Later">Пізніше</v:String>
<v:String x:Key="m_DoNotAsk">Не нагадувати</v:String>

<!-- About window -->
<v:String x:Key="m_About">Інформація</v:String>
<v:String x:Key="m_Version">Версія:</v:String>
<v:String x:Key="m_Author">Автор:</v:String>
<v:String x:Key="m_License">Ліцензія:</v:String>
<v:String x:Key="m_SourceCode">Вихідний код:</v:String>
<v:String x:Key="m_Thanks">Подяка:</v:String>
<v:String x:Key="m_UsedLibraries">Використані бібліотеки:</v:String>
<v:String x:Key="m_CheckUpdates">Перевірити оновлення</v:String>
<v:String x:Key="m_DiscordServer">Discord сервер:</v:String>

</ResourceDictionary>
12 changes: 12 additions & 0 deletions FloatTool/Languages/Lang.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -89,4 +89,16 @@
<v:String x:Key="m_UpdateAvailable">Update available</v:String>
<v:String x:Key="m_Later">Later</v:String>
<v:String x:Key="m_DoNotAsk">Do not ask</v:String>

<!-- About window -->
<v:String x:Key="m_About">About</v:String>
<v:String x:Key="m_Version">Version:</v:String>
<v:String x:Key="m_Author">Author:</v:String>
<v:String x:Key="m_License">License:</v:String>
<v:String x:Key="m_SourceCode">Source code:</v:String>
<v:String x:Key="m_Thanks">Thanks to:</v:String>
<v:String x:Key="m_UsedLibraries">Used libraries:</v:String>
<v:String x:Key="m_CheckUpdates">Check for updates</v:String>
<v:String x:Key="m_DiscordServer">Discord server:</v:String>

</ResourceDictionary>
161 changes: 161 additions & 0 deletions FloatTool/Views/AboutWindow.xaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,161 @@
<!--
- Copyright (C) 2023 Prevter
-
- This program is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program. If not, see <https://www.gnu.org/licenses/>.
-->
<Window x:Class="FloatTool.Views.AboutWindow"
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:FloatTool"
mc:Ignorable="d"
WindowStartupLocation="CenterScreen"
WindowStyle="None"
AllowsTransparency="True" ResizeMode="NoResize"
Background="Transparent" d:DesignHeight="400"
Title="{DynamicResource m_About}" Height="450" Width="400">
<Window.Effect>
<DropShadowEffect BlurRadius="3" ShadowDepth="3" Opacity="0.5"/>
</Window.Effect>
<Border Margin="4,4,4,4" BorderBrush="{DynamicResource WindowBorder}" BorderThickness="1" Background="{DynamicResource SettingsBackground}" CornerRadius="8">
<Grid>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="40"/>
<RowDefinition/>
</Grid.RowDefinitions>
<Rectangle Grid.Row="0" Grid.ColumnSpan="2" Fill="{DynamicResource SettingsTopBarBackground}" RadiusX="8" RadiusY="8"/>

<TextBlock Text="{DynamicResource m_About}"
VerticalAlignment="Center"
Foreground="{DynamicResource SettingsTopBarForeground}"
FontSize="22"
Margin="10,0,0,0"/>

<StackPanel Orientation="Horizontal"
HorizontalAlignment="Right">
<Button Style="{DynamicResource TopButton}"
Click="WindowButton_Click">
<Path Width ="20"
Stretch="Uniform"
Stroke="{DynamicResource TopBarButtonsColor}"
Fill="{DynamicResource TopBarButtonsColor}"
Data="{DynamicResource CloseIcon}"/>
</Button>
</StackPanel>

<Grid Grid.Row="1">
<StackPanel Grid.Column="0" Grid.Row="0" Margin="10,10,10,10">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>

<Image Source="/Assets/Icon.png" Width="100" HorizontalAlignment="Left" Margin="0,0,20,20"/>

<StackPanel Grid.Column="1" HorizontalAlignment="Left">
<TextBlock Text="FloatTool"
Foreground="{DynamicResource SettingsMainForeground}"
FontSize="22"
Margin="0,0,0,10"/>
<TextBlock
Foreground="{DynamicResource SettingsMainForeground}"
FontSize="16"
Margin="0,0,0,5">
<Run Text="{DynamicResource m_Version}"/>
<Run Text="{Binding CurrentVersion}"/>
</TextBlock>
<TextBlock
Foreground="{DynamicResource SettingsMainForeground}"
FontSize="16"
Margin="0,0,0,5">
<Hyperlink NavigateUri="{Binding AuthorUrl}"
RequestNavigate="Hyperlink_CheckUpdates">
<Run Text="{DynamicResource m_CheckUpdates}"/>
</Hyperlink>
</TextBlock>
</StackPanel>
</Grid>

<TextBlock
Foreground="{DynamicResource SettingsMainForeground}"
FontSize="16"
Margin="0,0,0,5">
<Run Text="{DynamicResource m_Author}"/>
<Hyperlink NavigateUri="{Binding AuthorUrl}"
RequestNavigate="Hyperlink_RequestNavigate">
Prevter
</Hyperlink>
</TextBlock>
<TextBlock
Foreground="{DynamicResource SettingsMainForeground}"
FontSize="16"
Margin="0,0,0,5">
<Run Text="{DynamicResource m_DiscordServer}"/>
<Hyperlink NavigateUri="https://discord.gg/RM9VrzMfhP"
RequestNavigate="Hyperlink_RequestNavigate">
discord.gg/RM9VrzMfhP
</Hyperlink>
</TextBlock>
<TextBlock
Foreground="{DynamicResource SettingsMainForeground}"
FontSize="16"
Margin="0,0,0,5">
<Run Text="{DynamicResource m_License}"/>
<Hyperlink NavigateUri="https://www.gnu.org/licenses/gpl-3.0-standalone.html"
RequestNavigate="Hyperlink_RequestNavigate">
GNU General Public License v3.0
</Hyperlink>
</TextBlock>
<TextBlock
Foreground="{DynamicResource SettingsMainForeground}"
FontSize="16"
Margin="0,0,0,5">
<Run Text="{DynamicResource m_SourceCode}"/>
<Hyperlink NavigateUri="https://github.com/prevter/floattool"
RequestNavigate="Hyperlink_RequestNavigate">
GitHub
</Hyperlink>
</TextBlock>
<TextBlock
Foreground="{DynamicResource SettingsMainForeground}"
FontSize="16"
Margin="0,0,0,5">
<Run Text="{DynamicResource m_UsedLibraries}"/>
<LineBreak/>
• <Hyperlink NavigateUri="https://www.newtonsoft.com/json"
RequestNavigate="Hyperlink_RequestNavigate">
Newtonsoft.Json
</Hyperlink><LineBreak/>
• <Hyperlink NavigateUri="https://logging.apache.org/log4net/"
RequestNavigate="Hyperlink_RequestNavigate">
log4net
</Hyperlink><LineBreak/>
• <Hyperlink NavigateUri="https://www.nuget.org/packages/MdXaml_migfree"
RequestNavigate="Hyperlink_RequestNavigate">
MdXaml_migfree
</Hyperlink><LineBreak/>
• <Hyperlink NavigateUri="https://www.nuget.org/packages/DiscordRichPresence"
RequestNavigate="Hyperlink_RequestNavigate">
DiscordRichPresence
</Hyperlink>
</TextBlock>
</StackPanel>
</Grid>
</Grid>
</Grid>
</Border>
</Window>
74 changes: 74 additions & 0 deletions FloatTool/Views/AboutWindow.xaml.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
using FloatTool.Common;
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;

namespace FloatTool.Views
{
public sealed class AboutData
{
public string AuthorUrl { get; set; } = Utils.HOME_URL[..Utils.HOME_URL.LastIndexOf('/')];
public string CurrentVersion { get; set; } = AppHelpers.VersionCode;
}

/// <summary>
/// Interaction logic for AboutWindow.xaml
/// </summary>
public partial class AboutWindow : Window
{
public AboutWindow()
{
DataContext = new AboutData();

InitializeComponent();
}

protected override void OnMouseLeftButtonDown(MouseButtonEventArgs e)
{
base.OnMouseLeftButtonDown(e);
if (e.GetPosition(this).Y < 40) DragMove();
}

private void WindowButton_Click(object sender, RoutedEventArgs e)
{
Close();
}

private void Hyperlink_RequestNavigate(object sender, RequestNavigateEventArgs e)
{
Process.Start(new ProcessStartInfo { FileName = e.Uri.ToString(), UseShellExecute = true });
}

private void Hyperlink_CheckUpdates(object sender, RequestNavigateEventArgs e)
{
Task.Factory.StartNew(() =>
{
var update = Utils.CheckForUpdates().Result;
if (update != null && update.TagName != AppHelpers.VersionCode)
{
Dispatcher.Invoke(new Action(() =>
{
Logger.Info("New version available");
var updateWindow = new UpdateWindow(update)
{
Owner = this
};
updateWindow.ShowDialog();
}));
}
});
}
}
}
3 changes: 3 additions & 0 deletions FloatTool/Views/MainWindow.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,9 @@
<Button Style="{DynamicResource TopButton}" Click="WindowButton_Click" x:Name="DiscordButton">
<Path Stretch="Uniform" Fill="{DynamicResource TopBarButtonsColor}" Data="{DynamicResource DiscordLogo}"/>
</Button>
<Button Style="{DynamicResource TopButton}" Click="WindowButton_Click" x:Name="AboutButton">
<Path Stretch="Uniform" Fill="{DynamicResource TopBarButtonsColor}" Data="{DynamicResource AboutIcon}"/>
</Button>
</StackPanel>

<StackPanel Grid.Column="1" Orientation="Horizontal" HorizontalAlignment="Right">
Expand Down
Loading

0 comments on commit f38c363

Please sign in to comment.