Skip to content

Commit

Permalink
Add "About" window
Browse files Browse the repository at this point in the history
  • Loading branch information
tylercamp committed May 5, 2024
1 parent 7cb2210 commit 4e3c7c3
Show file tree
Hide file tree
Showing 7 changed files with 171 additions and 5 deletions.
2 changes: 2 additions & 0 deletions PalCalc.UI/App.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ namespace PalCalc.UI
/// </summary>
public partial class App : Application
{
public static string Version => "v0.9-BETA";

private static ILogger logger;

public static string LogFolder = "log";
Expand Down
19 changes: 15 additions & 4 deletions PalCalc.UI/MainWindow.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@

<GridSplitter Grid.Column="3" Width="3" HorizontalAlignment="Center" VerticalAlignment="Stretch" />

<DockPanel Grid.Column="4" IsEnabled="{Binding IsEditable}" Margin="0,0,0,10">
<DockPanel Grid.Column="4" IsEnabled="{Binding IsEditable}" Margin="0,0,0,5">
<StackPanel Orientation="Vertical" DockPanel.Dock="Top">
<GroupBox Header="Target Pal">
<v:PalTargetView DataContext="{Binding PalTarget}" />
Expand All @@ -71,9 +71,20 @@
</GroupBox>
</StackPanel>

<GroupBox Header="Results">
<v:BreedingResultListView DataContext="{Binding PalTarget.CurrentPalSpecifier.CurrentResults}" />
</GroupBox>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="*" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>

<GroupBox Header="Results" Grid.Row="0">
<v:BreedingResultListView DataContext="{Binding PalTarget.CurrentPalSpecifier.CurrentResults}" />
</GroupBox>

<Grid Grid.Row="1" Margin="0,5,0,0">
<Button Width="50" Click="AboutButton_Click">About</Button>
</Grid>
</Grid>
</DockPanel>
</Grid>
</Window>
10 changes: 9 additions & 1 deletion PalCalc.UI/MainWindow.xaml.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using PalCalc.UI.ViewModel;
using PalCalc.UI.View;
using PalCalc.UI.ViewModel;
using System;
using System.Collections.Generic;
using System.ComponentModel;
Expand Down Expand Up @@ -46,5 +47,12 @@ protected override void OnClosing(CancelEventArgs e)

ViewModel.CancelSolver();
}

private void AboutButton_Click(object sender, RoutedEventArgs e)
{
var window = new AboutWindow();
window.Owner = this;
window.ShowDialog();
}
}
}
1 change: 1 addition & 0 deletions PalCalc.UI/PalCalc.UI.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
<OutputType>WinExe</OutputType>
<TargetFramework>net8.0-windows10.0.17763.0</TargetFramework>
<UseWPF>true</UseWPF>
<FileVersion></FileVersion>
</PropertyGroup>

<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'" />
Expand Down
6 changes: 6 additions & 0 deletions PalCalc.UI/PalCalc.UI.csproj.user
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@
</ApplicationDefinition>
</ItemGroup>
<ItemGroup>
<Compile Update="View\AboutWindow.xaml.cs">
<SubType>Code</SubType>
</Compile>
<Compile Update="View\BreedingResultListView.xaml.cs">
<SubType>Code</SubType>
</Compile>
Expand Down Expand Up @@ -45,6 +48,9 @@
<Page Update="MainWindow.xaml">
<SubType>Designer</SubType>
</Page>
<Page Update="View\AboutWindow.xaml">
<SubType>Designer</SubType>
</Page>
<Page Update="View\BreedingResultListView.xaml">
<SubType>Designer</SubType>
</Page>
Expand Down
100 changes: 100 additions & 0 deletions PalCalc.UI/View/AboutWindow.xaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
<Window x:Class="PalCalc.UI.View.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:PalCalc.UI.View"
mc:Ignorable="d"
ResizeMode="NoResize"
WindowStyle="ToolWindow"
SizeToContent="WidthAndHeight"
WindowStartupLocation="CenterOwner"
Title="About Pal Calc">
<Window.DataContext>
<local:AboutViewModel />
</Window.DataContext>
<StackPanel Orientation="Vertical" Margin="10,0,10,10">
<StackPanel.Resources>
<Style TargetType="Label">
<Setter Property="HorizontalAlignment" Value="Center" />
</Style>
<Style TargetType="TextBlock">
<Setter Property="HorizontalAlignment" Value="Center" />
</Style>
<Style TargetType="Separator">
<Setter Property="Margin" Value="0,10,0,10" />
</Style>
</StackPanel.Resources>

<Label Content="{Binding Title}" FontWeight="Bold" FontSize="20" />

<TextBlock Text="by Tyler Camp" />
<TextBlock>
<Hyperlink NavigateUri="https://github.com/tylercamp/palcalc/" RequestNavigate="Hyperlink_RequestNavigate">https://github.com/tylercamp/palcalc/</Hyperlink>
</TextBlock>
<TextBlock>
<Hyperlink NavigateUri="https://github.com/tylercamp/palcalc/issues" RequestNavigate="Hyperlink_RequestNavigate">Bug Reports</Hyperlink>
|
<Hyperlink NavigateUri="https://github.com/tylercamp/palcalc/releases" RequestNavigate="Hyperlink_RequestNavigate">Releases</Hyperlink>
</TextBlock>

<TextBlock FontStyle="Italic" FontSize="9">
Pal Calc is an independent project and is not affiliated with Palworld or Pocket Pair, Inc.
</TextBlock>
<TextBlock FontStyle="Italic" FontSize="9">
All Palworld resources are owned by Pocket Pair, Inc.
</TextBlock>

<Separator />

<Label FontWeight="Bold" FontSize="12">References</Label>
<TextBlock>
<Hyperlink NavigateUri="https://paldb.cc/en/Pals" RequestNavigate="Hyperlink_RequestNavigate">Pal icons from Paldb.cc</Hyperlink>
</TextBlock>
<TextBlock>
<Hyperlink NavigateUri="https://www.reddit.com/r/Palworld/comments/19d98ws/spreadsheet_all_breeding_combinations_datamined/" RequestNavigate="Hyperlink_RequestNavigate">Initial data scraped by /u/blahable</Hyperlink>
</TextBlock>
<TextBlock>
<Hyperlink NavigateUri="https://www.reddit.com/r/Palworld/comments/1af9in7/passive_skill_inheritance_mechanics_in_breeding/" RequestNavigate="Hyperlink_RequestNavigate">Trait breeding calc. reverse engineered by /u/mgxts</Hyperlink>
</TextBlock>
<TextBlock>
<Hyperlink NavigateUri="https://github.com/cheahjs/palworld-save-tools" RequestNavigate="Hyperlink_RequestNavigate">Palworld save support based on palworld-save-tools</Hyperlink>
(<Hyperlink NavigateUri="https://github.com/cheahjs/palworld-save-tools/blob/main/LICENSE" RequestNavigate="Hyperlink_RequestNavigate">MIT License</Hyperlink>)
</TextBlock>
<TextBlock>
<Hyperlink NavigateUri="https://github.com/Tom60chat/Xbox-Live-Save-Exporter" RequestNavigate="Hyperlink_RequestNavigate">Xbox save support based on Xbox-Live-Save-Exporter</Hyperlink>
</TextBlock>

<Separator />

<Label FontWeight="Bold" FontSize="12">Resources</Label>
<TextBlock>
<Hyperlink NavigateUri="https://www.flaticon.com/free-icons/open" RequestNavigate="Hyperlink_RequestNavigate">Open Folder icon by Smashicons</Hyperlink>
</TextBlock>

<Separator />

<Label FontWeight="Bold" FontSize="12">Libraries</Label>
<TextBlock>
<Hyperlink NavigateUri="https://github.com/xceedsoftware/wpftoolkit" RequestNavigate="Hyperlink_RequestNavigate">WPF Toolkit by Xceed Software</Hyperlink>
(<Hyperlink NavigateUri="https://github.com/xceedsoftware/wpftoolkit/blob/master/license.md" RequestNavigate="Hyperlink_RequestNavigate">Community License</Hyperlink>)
</TextBlock>
<TextBlock>
<Hyperlink NavigateUri="https://github.com/serilog/serilog" RequestNavigate="Hyperlink_RequestNavigate">Serilog</Hyperlink>
(<Hyperlink NavigateUri="https://github.com/serilog/serilog/blob/dev/LICENSE" RequestNavigate="Hyperlink_RequestNavigate">Apache 2 License</Hyperlink>)
</TextBlock>
<TextBlock>
<Hyperlink NavigateUri="https://github.com/vain0x/DotNetKit.Wpf.AutoCompleteComboBox" RequestNavigate="Hyperlink_RequestNavigate">AutoCompleteComboBox by vain0x</Hyperlink>
(<Hyperlink NavigateUri="https://github.com/vain0x/DotNetKit.Wpf.AutoCompleteComboBox/blob/main/LICENSE.md" RequestNavigate="Hyperlink_RequestNavigate">MIT License</Hyperlink>)
</TextBlock>
<TextBlock>
<Hyperlink NavigateUri="https://github.com/NinetailLabs/GraphSharp" RequestNavigate="Hyperlink_RequestNavigate">GraphSharp by Various Authors (Defunct, Modified)</Hyperlink>
(<Hyperlink NavigateUri="https://github.com/NinetailLabs/GraphSharp/blob/master/LICENSE" RequestNavigate="Hyperlink_RequestNavigate">Apache 2 License</Hyperlink>)
</TextBlock>
<TextBlock>
<Hyperlink NavigateUri="https://github.com/YaccConstructor/QuickGraph" RequestNavigate="Hyperlink_RequestNavigate">QuickGraph by YaccConstructor</Hyperlink>
(<Hyperlink NavigateUri="https://github.com/YaccConstructor/QuickGraph/blob/master/LICENSE.txt" RequestNavigate="Hyperlink_RequestNavigate">Ms-PL License</Hyperlink>)
(<Hyperlink NavigateUri="https://github.com/deepakkumar1984/QuickGraph.NETStandard" RequestNavigate="Hyperlink_RequestNavigate">.NET Standard Port</Hyperlink>)
</TextBlock>
</StackPanel>
</Window>
38 changes: 38 additions & 0 deletions PalCalc.UI/View/AboutWindow.xaml.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
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.Shapes;

namespace PalCalc.UI.View
{
public class AboutViewModel
{
public string Title => $"Pal Calc {App.Version}";
}

/// <summary>
/// Interaction logic for AboutWindow.xaml
/// </summary>
public partial class AboutWindow : Window
{
public AboutWindow()
{
InitializeComponent();
}

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

0 comments on commit 4e3c7c3

Please sign in to comment.