better about screen

This commit is contained in:
Dexrn ZacAttack
2025-03-03 07:44:32 -08:00
parent 5333817130
commit cbba78d07d
12 changed files with 171 additions and 55 deletions

1
.gitignore vendored
View File

@@ -399,3 +399,4 @@ FodyWeavers.xsd
.idea
# Other
Assets/contributors.txt

1
BuildScripts/build.bat Normal file
View File

@@ -0,0 +1 @@
py BuildScripts\contributors.py

View File

@@ -0,0 +1,32 @@
import json
import os
f = open('Assets/contributors.txt', 'w+')
try:
import requests
except ImportError:
# didn't even know you could do this
os.system("pip install requests")
import requests
except:
print("Requests is missing and the script couldn't install it...")
exit(0)
try:
contribs = requests.get("https://api.github.com/repos/WinDurango/WinDurango.UI/contributors?anon=1&per_page=50")
for contributor in contribs.json():
# why tf did they call it login
name = contributor.get("login", None)
pfp = contributor.get("avatar_url", None)
url = contributor.get("html_url", None)
contribution_count = str(contributor.get("contributions", None))
f.write(name.replace(";", "WD_CONTRIB_SEMICOLON") + ";" + pfp.replace(";", "WD_CONTRIB_SEMICOLON") + ";" + url.replace(";", "WD_CONTRIB_SEMICOLON") + ";" + contribution_count + "\n")
except:
print("Couldn't fetch contributor information.")
exit(0)
f.close()

View File

@@ -11,7 +11,7 @@
<Button Width="320" Height="180" Padding="0" Name="startButton" CornerRadius="5, 5, 0, 0" BorderThickness="0" Background="{ThemeResource SystemControlAltLowAcrylicElementBrush}" >
<Image x:Name="appLogo"/>
</Button>
<Expander CornerRadius="0, 0, 5, 5" Width="320" Name="infoExpander">
<Expander CornerRadius="0, 0, 5, 5" Width="320" Name="infoExpander" Background="{ThemeResource DesktopAcrylicTransparentBrush}">
<Grid Name="expanderControls" Width="320">
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>

View File

@@ -0,0 +1,32 @@
<?xml version="1.0" encoding="utf-8"?>
<UserControl
x:Class="WinDurango.UI.Controls.ApplicationInfo"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:WinDurango.UI.Controls"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d">
<StackPanel Background="{ThemeResource SystemControlAltLowAcrylicElementBrush}" BorderBrush="{ThemeResource ControlElevationBorderBrush}" BorderThickness="1" CornerRadius="5">
<StackPanel Orientation="Horizontal" Margin="5, 5, 0, 0">
<PersonPicture Name="appPicture" Width="64" Height="64" BorderBrush="{ThemeResource ControlElevationBorderBrush}" BorderThickness="1"></PersonPicture>
<HyperlinkButton Name="appName" FontSize="18" VerticalAlignment="Center" NavigateUri="https://github.com/WinDurango/WinDurango.UI">WinDurango UI</HyperlinkButton>
</StackPanel>
<TextBlock Name="appInfo" TextWrapping="WrapWholeWords" VerticalAlignment="Top" HorizontalAlignment="Left" Margin="5, 5, 0, 0"></TextBlock>
<StackPanel Orientation="Horizontal" Margin="5, 10, 0, 0">
<StackPanel Margin="10, 0, 5, 0">
<TextBlock FontSize="18">Stars</TextBlock>
<HyperlinkButton FontSize="18" Name="stars" HorizontalAlignment="Center" NavigateUri="https://github.com/WinDurango/WinDurango.UI/stargazers">Unknown</HyperlinkButton>
</StackPanel>
<StackPanel Margin="10, 0, 5, 0">
<TextBlock FontSize="18">Watchers</TextBlock>
<HyperlinkButton FontSize="18" Name="watchers" HorizontalAlignment="Center" NavigateUri="https://github.com/WinDurango/WinDurango.UI/watchers">Unknown</HyperlinkButton>
</StackPanel>
<StackPanel Margin="10, 0, 5, 0">
<TextBlock FontSize="18">Forks</TextBlock>
<HyperlinkButton FontSize="18" Name="forks" HorizontalAlignment="Center" NavigateUri="https://github.com/WinDurango/WinDurango.UI/forks">Unknown</HyperlinkButton>
</StackPanel>
</StackPanel>
</StackPanel>
</UserControl>

View File

@@ -0,0 +1,60 @@
using Microsoft.UI.Xaml;
using Microsoft.UI.Xaml.Controls;
using Microsoft.UI.Xaml.Controls.Primitives;
using Microsoft.UI.Xaml.Data;
using Microsoft.UI.Xaml.Input;
using Microsoft.UI.Xaml.Media;
using Microsoft.UI.Xaml.Media.Imaging;
using Microsoft.UI.Xaml.Navigation;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Net.Http;
using System.Runtime.InteropServices.WindowsRuntime;
using System.Security.Policy;
using System.Text.Json;
using System.Threading.Tasks;
using Windows.Foundation;
using Windows.Foundation.Collections;
using WinDurango.UI.Utils;
namespace WinDurango.UI.Controls
{
public sealed partial class ApplicationInfo : UserControl
{
public ApplicationInfo()
{
this.InitializeComponent();
this.appPicture.ProfilePicture = new BitmapImage(new System.Uri("https://avatars.githubusercontent.com/WinDurango"));
this.appInfo.Text = $"Version {App.Version}";
GetRepoInfo();
}
public async void GetRepoInfo()
{
using HttpClient client = new HttpClient();
try
{
client.DefaultRequestHeaders.UserAgent.ParseAdd("Mozilla/5.0 (compatible; GitHubAPI/1.0)");
string res = await client.GetStringAsync("https://api.github.com/repos/WinDurango/WinDurango.UI");
using (JsonDocument doc = JsonDocument.Parse(res))
{
JsonElement root = doc.RootElement;
int stars = root.GetProperty("stargazers_count").GetInt32();
int forks = root.GetProperty("forks").GetInt32();
int watchers = root.GetProperty("subscribers_count").GetInt32();
this.stars.Content = stars.ToString();
this.forks.Content = forks.ToString();
this.watchers.Content = watchers.ToString();
}
}
catch (System.Exception ex)
{
Logger.WriteError("Couldn't fetch https://api.github.com/WinDurango/WinDurango.UI");
Logger.WriteException(ex);
}
}
}
}

View File

@@ -9,22 +9,8 @@
d:DesignHeight="300"
d:DesignWidth="400">
<Grid Height="128" Width="256" Background="{ThemeResource SystemControlAltLowAcrylicElementBrush}" BorderBrush="{ThemeResource ControlElevationBorderBrush}" BorderThickness="1" CornerRadius="5">
<Grid.RowDefinitions>
<RowDefinition></RowDefinition>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="77"></ColumnDefinition>
<ColumnDefinition></ColumnDefinition>
</Grid.ColumnDefinitions>
<PersonPicture Name="developerPicture" x:FieldModifier="public" Grid.Row="0" Padding="5 0 0 0" Width="64" Height="64" VerticalAlignment="Center" BorderBrush="{ThemeResource ControlElevationBorderBrush}" BorderThickness="1"></PersonPicture>
<Grid Grid.Column="1">
<Grid.RowDefinitions>
<RowDefinition></RowDefinition>
<RowDefinition></RowDefinition>
</Grid.RowDefinitions>
<HyperlinkButton Name="developerName" FontSize="18" x:FieldModifier="public" VerticalAlignment="Bottom" Grid.Row="0" Padding="5 5 5 5" Margin="0 0 0 0"></HyperlinkButton>
<TextBlock Name="developerInfo" x:FieldModifier="public" TextWrapping="WrapWholeWords" VerticalAlignment="Top" Grid.Row="1" HorizontalAlignment="Left" Margin="5 0 0 0"></TextBlock>
</Grid>
</Grid>
<StackPanel Background="{ThemeResource SystemControlAltLowAcrylicElementBrush}" Padding="5 5 5 5" Margin="0, 5, 0, 0" HorizontalAlignment="Left" Width="512" MaxWidth="512" Orientation="Horizontal" BorderBrush="{ThemeResource ControlElevationBorderBrush}" BorderThickness="1" CornerRadius="5">
<PersonPicture Name="developerPicture" x:FieldModifier="public" Grid.Row="0" Padding="5 0 0 0" Width="32" Height="32" VerticalAlignment="Center" BorderBrush="{ThemeResource ControlElevationBorderBrush}" BorderThickness="1"></PersonPicture>
<HyperlinkButton Name="developerName" FontSize="18" x:FieldModifier="public" HorizontalContentAlignment="Left" Grid.Row="0" Padding="5 5 5 5" Margin="0 0 0 0">Name</HyperlinkButton>
</StackPanel>
</UserControl>

View File

@@ -1,13 +1,17 @@
using Microsoft.UI.Xaml.Controls;
using Microsoft.UI.Xaml.Media.Imaging;
using System;
namespace WinDurango.UI.Controls
{
public sealed partial class ContributorInfo : UserControl
{
public ContributorInfo()
public ContributorInfo(string name, string pfp, string link)
{
this.InitializeComponent();
this.developerName.Content = name;
this.developerPicture.ProfilePicture = new BitmapImage(new Uri(pfp));
this.developerName.NavigateUri = new Uri(link);
}
}
}

View File

@@ -39,7 +39,7 @@ namespace WinDurango.UI
"AppsListPage" => typeof(AppsListPage),
"AboutPage" => typeof(AboutPage),
"NotImplementedPage" => typeof(NotImplementedPage),
_ => typeof(AppsListPage)
_ => typeof(NotImplementedPage)
};
if (contentFrame.Content?.GetType() != pageType && contentFrame.Navigate(pageType) && contentFrame.Content is AppsListPage appsList)

View File

@@ -9,22 +9,11 @@
mc:Ignorable="d">
<StackPanel Orientation="Vertical" Padding="10">
<TextBlock Text="Application Info" FontSize="24"/>
<controls:ContributorInfo Margin="0 10 10 10" x:Name="windurango_Info" HorizontalAlignment="Left"/>
<TextBlock Text="UI Lead Developers" FontSize="24"/>
<StackPanel Orientation="Horizontal">
<controls:ContributorInfo Margin="0 10 10 10" x:Name="dexrn_Info" HorizontalAlignment="Left"/>
<controls:ContributorInfo Margin="0 10 10 10" x:Name="danilwhale_Info" HorizontalAlignment="Left"/>
</StackPanel>
<!---
<TextBlock Text="Repo Contributors" FontSize="24"/>
<TextBlock>
<Run Text="Coming soon (maybe)"/>
<LineBreak/>
<Run Text="contrib.rocks apparently returns some svg instead of a png..."/>
<LineBreak/>
<Run Text="which makes it hard for me to use here."/>
</TextBlock>
-->
<TextBlock Text="About" FontSize="24"/>
<controls:ApplicationInfo Margin="0 10 10 10" HorizontalAlignment="Left"/>
<TextBlock Text="Contributors" FontSize="24"/>
<ScrollViewer>
<StackPanel Name="contributorList" />
</ScrollViewer>
</StackPanel>
</Page>

View File

@@ -1,33 +1,30 @@
using Microsoft.UI.Xaml.Controls;
using Microsoft.UI.Xaml.Media.Imaging;
using System;
using System.IO;
using WinDurango.UI.Controls;
namespace WinDurango.UI.Pages
{
public sealed partial class AboutPage : Page
{
private static Uri GetGitHubPfp(string username)
{
return new Uri($"https://github.com/{username}.png");
}
public AboutPage()
{
this.InitializeComponent();
dexrn_Info.developerPicture.ProfilePicture = new BitmapImage(GetGitHubPfp("DexrnZacAttack"));
dexrn_Info.developerName.Content = "DexrnZacAttack";
dexrn_Info.developerName.NavigateUri = new Uri("https://github.com/DexrnZacAttack");
dexrn_Info.developerInfo.Text = "UI design, functionality, learning C#";
danilwhale_Info.developerPicture.ProfilePicture = new BitmapImage(GetGitHubPfp("danilwhale"));
danilwhale_Info.developerName.Content = "danilwhale";
danilwhale_Info.developerName.NavigateUri = new Uri("https://github.com/danilwhale");
danilwhale_Info.developerInfo.Text = "Refactoring, teaching, bug fixing, etc";
windurango_Info.developerInfo.Text = $"Version {App.Version}";
windurango_Info.developerName.Content = "WinDurango.UI";
windurango_Info.developerName.NavigateUri = new Uri("https://github.com/WinDurango/WinDurango.UI");
windurango_Info.developerPicture.ProfilePicture = new BitmapImage(GetGitHubPfp("WinDurango"));
string[] lines = File.ReadAllLines("Assets/contributors.txt");
foreach (var contributor in lines)
{
string[] info = contributor.Split(";");
string name = info[0];
string avatar = info[1];
string link = info[2];
string contributionCount = info[3];
contributorList.Children.Add(new ContributorInfo(name, avatar, link));
}
}
}
}

View File

@@ -36,6 +36,7 @@
<Compile Remove="Controls\GameContainer.cs" />
</ItemGroup>
<ItemGroup>
<None Remove="Controls\ApplicationInfo.xaml" />
<None Remove="Controls\AppTile.xaml" />
<None Remove="Controls\ContainerInfo.xaml" />
<None Remove="Controls\ContributorInfo.xaml" />
@@ -105,6 +106,9 @@
</ItemGroup>
<ItemGroup>
<Content Update="Assets\contributors.txt">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
<Content Update="Assets\icon.ico">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
@@ -200,6 +204,12 @@
<PRIResource Remove="Strings\en-US\Ui.resw" />
</ItemGroup>
<ItemGroup>
<Page Update="Controls\ApplicationInfo.xaml">
<Generator>MSBuild:Compile</Generator>
</Page>
</ItemGroup>
<ItemGroup>
<Page Update="Controls\ContainerInfo.xaml">
<Generator>MSBuild:Compile</Generator>
@@ -217,4 +227,8 @@
<Generator>MSBuild:Compile</Generator>
</Page>
</ItemGroup>
<Target Name="PreBuild" BeforeTargets="PreBuildEvent">
<Exec Command="BuildScripts\build.bat" />
</Target>
</Project>