Skip to content

Commit

Permalink
Added About Form
Browse files Browse the repository at this point in the history
  • Loading branch information
naseif committed Sep 17, 2023
1 parent dbec814 commit f789ae7
Show file tree
Hide file tree
Showing 4 changed files with 103 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
<Window xmlns="https://github.com/avaloniaui"
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"
mc:Ignorable="d" d:DesignWidth="550" d:DesignHeight="330"
SizeToContent="WidthAndHeight"
x:Class="VisualPairCoding.AvaloniaUI.AboutForm"
Title="About">
<StackPanel HorizontalAlignment="Center" VerticalAlignment="Center" Margin="10">
<TextBlock Text="Welcome to Visual Pair Coding!" FontSize="20"/>

<TextBlock FontSize="16" Margin="0,10,0,5">
This project is a collaboration by
</TextBlock>

<StackPanel Orientation="Horizontal">
<TextBlock FontSize="16">
<TextBlock Name="NaseifsUrl" Foreground="Blue">Naseif</TextBlock>
</TextBlock>
<TextBlock FontSize="16" Margin="5,0,5,0">and</TextBlock>
<TextBlock FontSize="16">
<Run Text="stho32" Foreground="Blue"/>
<TextBlock Text="'s GitHub" Foreground="Blue" />
</TextBlock>
</StackPanel>

<TextBlock FontSize="16" Margin="0,10,0,5">
This is a Clever Code Cravers project.
</TextBlock>

<TextBlock FontSize="16" Margin="0,10,0,5">
You can find the source code on GitHub:
<TextBlock Text="GitHub Repository" Foreground="Blue" />
</TextBlock>

<TextBlock FontSize="16" Margin="0,10,0,5">
Version: <Run Text="{Binding Version}" Foreground="Green"/>
</TextBlock>
</StackPanel>
</Window>
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
using Avalonia.Controls;
using Avalonia.Interactivity;
using System;

namespace VisualPairCoding.AvaloniaUI
{
public partial class AboutForm : Window
{
public AboutForm()
{
InitializeComponent();

NaseifsUrl.Tapped += NaseifsUrl_Tapped;
}

private void NaseifsUrl_Tapped(object? sender, Avalonia.Input.TappedEventArgs e)
{
OpenUrlInBrowser("https://github.com/naseif");
}

private void Naseif_OnClick(object sender, RoutedEventArgs e)
{
// Open Naseif's GitHub page
}

private void Stho32_OnClick(object sender, RoutedEventArgs e)
{
// Open stho32's GitHub page
OpenUrlInBrowser("https://github.com/stho32");
}

private void GitHubRepo_OnClick(object sender, RoutedEventArgs e)
{
// Open your GitHub repository page
OpenUrlInBrowser("https://github.com/yourrepository");
}

private void OpenUrlInBrowser(string url)
{
try
{
// Use the default web browser to open the URL.
System.Diagnostics.Process.Start(new System.Diagnostics.ProcessStartInfo(url)
{
UseShellExecute = true
});
}
catch (Exception ex)
{
// Handle any exceptions that may occur when opening the URL.
// You can add your error handling logic here.
Console.WriteLine($"Error opening URL: {ex.Message}");
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,7 @@
<Separator/>
<MenuItem Click="CloseWindow" Header="_Exit"/>
</MenuItem>
<MenuItem Header="_Info">
</MenuItem>
<MenuItem Click="OpenAboutForm" Header="_Info"/>
</Menu>

<Grid ColumnDefinitions="Auto,150,20,Auto,150" RowDefinitions="Auto,Auto,Auto,Auto,Auto" Margin="4">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
using System.Threading.Tasks;
using VisualPairCoding.BL;
using VisualPairCoding.Infrastructure;
using static System.Collections.Specialized.BitVector32;

namespace VisualPairCoding.AvaloniaUI
{
Expand Down Expand Up @@ -83,6 +84,11 @@ private void OnClosed(object? sender, EventArgs e)
);
}

private void OpenAboutForm(object? sender, RoutedEventArgs args)
{
AboutForm aboutForm = new();
aboutForm.Show();
}

private void OnMenuItemClicked(object? sender, RoutedEventArgs e)
{
Expand Down

0 comments on commit f789ae7

Please sign in to comment.