Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
drpetersonfernandes committed Feb 16, 2024
1 parent 7f5b841 commit 35a9656
Show file tree
Hide file tree
Showing 6 changed files with 122 additions and 3 deletions.
52 changes: 52 additions & 0 deletions MAMEUtility/AboutWindow.xaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
<Window
x:Class="MAMEUtility.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"
Title="About"
Width="350"
Height="350"
ResizeMode="NoResize"
WindowStartupLocation="CenterOwner"
mc:Ignorable="d">

<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>

<StackPanel
Grid.Row="0"
Margin="10"
HorizontalAlignment="Center"
Orientation="Horizontal">
<Image
Width="150"
Height="150"
Source="pack://application:,,,/images/logo.png" />
</StackPanel>

<StackPanel Grid.Row="1" Margin="10">
<TextBlock FontWeight="Bold" Text="MAME Utility" />
<TextBlock Margin="0,10,0,0" Text="{Binding ApplicationVersion}" />
<TextBlock Margin="0,10,0,0">
<Hyperlink NavigateUri="https://purelogiccode.com" RequestNavigate="Hyperlink_RequestNavigate">https://purelogiccode.com</Hyperlink>
</TextBlock>
</StackPanel>

<StackPanel
Grid.Row="2"
Margin="10"
HorizontalAlignment="Center"
Orientation="Horizontal">
<Button
Width="120"
Margin="10,0,0,0"
Click="CloseButton_Click"
Content="Close" />
</StackPanel>
</Grid>
</Window>
40 changes: 40 additions & 0 deletions MAMEUtility/AboutWindow.xaml.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
using System.Windows;
using System.Diagnostics;
using System.Windows.Navigation;
using System.Reflection;

namespace MAMEUtility
{
public partial class AboutWindow : Window
{
public AboutWindow()
{
InitializeComponent();
DataContext = this; // Set the data context for data binding
}

private void CloseButton_Click(object sender, RoutedEventArgs e)
{
this.Close();
}

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

public static string ApplicationVersion
{
get
{
var version = Assembly.GetExecutingAssembly().GetName().Version;
return "Version: " + (version?.ToString() ?? "Unknown");
}
}
}
}
9 changes: 9 additions & 0 deletions MAMEUtility/MAMEUtility.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,19 @@
<ApplicationIcon>icon\icon.ico</ApplicationIcon>
<PackageIcon>icon2.png</PackageIcon>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<AssemblyVersion>1.0.0.1</AssemblyVersion>
<FileVersion>1.0.0.1</FileVersion>
</PropertyGroup>

<ItemGroup>
<None Remove="images\logo.png" />
</ItemGroup>

<ItemGroup>
<Content Include="icon\icon.ico" />
<Resource Include="images\logo.png">
<CopyToOutputDirectory></CopyToOutputDirectory>
</Resource>
</ItemGroup>

<ItemGroup>
Expand Down
3 changes: 2 additions & 1 deletion MAMEUtility/MainWindow.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
Title="MAME Utility"
Width="565"
Height="540"
mc:Ignorable="d">
mc:Ignorable="d" ResizeMode="CanMinimize">

<Grid>
<Grid.RowDefinitions>
Expand All @@ -18,6 +18,7 @@
</Grid.RowDefinitions>

<Menu Grid.Row="0">
<MenuItem Click="DonateButton_Click" Header="_Donate" />
<MenuItem Click="About_Click" Header="_About" />
<MenuItem Click="Exit_Click" Header="_Exit" />
</Menu>
Expand Down
21 changes: 19 additions & 2 deletions MAMEUtility/MainWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
using System.Windows;
using System.Windows.Controls;
using System.Xml.Linq;
using MessageBox = System.Windows.MessageBox;

namespace MameUtility
{
Expand All @@ -28,9 +27,27 @@ public MainWindow()
_worker.ProgressChanged += Worker_ProgressChanged;
}

private void DonateButton_Click(object sender, RoutedEventArgs e)
{
try
{
var psi = new System.Diagnostics.ProcessStartInfo
{
FileName = "https://www.buymeacoffee.com/purelogiccode",
UseShellExecute = true
};
System.Diagnostics.Process.Start(psi);
}
catch (Exception ex)
{
System.Windows.MessageBox.Show("Unable to open the link: " + ex.Message);
}
}

private void About_Click(object sender, RoutedEventArgs e)
{
MessageBox.Show("MAME Utility\nPure Logic Code\nVersion 1.0.0.1", "About");
AboutWindow aboutWindow = new();
aboutWindow.ShowDialog();
}

private void Exit_Click(object sender, RoutedEventArgs e)
Expand Down
Binary file added MAMEUtility/images/logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 35a9656

Please sign in to comment.