about page finished

This commit is contained in:
2024-03-06 01:26:43 +01:00
Unverified
parent 411a32039f
commit ab1c6de8e3
12 changed files with 505 additions and 205 deletions

View File

@@ -117,7 +117,22 @@
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<data name="String1" xml:space="preserve">
<value>ss</value>
<data name="Developers.Text" xml:space="preserve">
<value>Developers</value>
</data>
<data name="Donation.Text" xml:space="preserve">
<value>Donation</value>
</data>
<data name="More.Text" xml:space="preserve">
<value>More</value>
</data>
<data name="Repository.Text" xml:space="preserve">
<value>Repository</value>
</data>
<data name="SelfbuiltVersion" xml:space="preserve">
<value>Self-built version</value>
</data>
<data name="Translation.Text" xml:space="preserve">
<value>Translation (English (US))</value>
</data>
</root>

View File

@@ -1,13 +1,88 @@
using CommunityToolkit.Mvvm.ComponentModel;
using CommunityToolkit.Mvvm.Input;
using Microsoft.UI.Xaml;
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Diagnostics;
using System.Linq;
using System.Reflection;
using System.Text;
using System.Threading.Tasks;
using VDownload.Core.ViewModels.About.Helpers;
using VDownload.Services.Data.Configuration;
using VDownload.Services.Data.Configuration.Models;
using VDownload.Services.UI.StringResources;
using Windows.System.UserProfile;
namespace VDownload.Core.ViewModels.About
{
public class AboutViewModel : ObservableObject
public partial class AboutViewModel : ObservableObject
{
#region SERVICES
protected readonly IStringResourcesService _stringResourcesService;
protected readonly IConfigurationService _configurationService;
#endregion
#region PROPERTIES
[ObservableProperty]
protected string _version;
[ObservableProperty]
protected ObservableCollection<PersonViewModel> _developers;
[ObservableProperty]
protected ObservableCollection<PersonViewModel> _translators;
[ObservableProperty]
protected Uri _repositoryUrl;
[ObservableProperty]
protected Uri _donationUrl;
#endregion
#region CONSTRUCTORS
public AboutViewModel(IStringResourcesService stringResourcesService, IConfigurationService configurationService)
{
_stringResourcesService = stringResourcesService;
_configurationService = configurationService;
string version = Assembly.GetEntryAssembly().GetCustomAttribute<AssemblyInformationalVersionAttribute>()?.InformationalVersion;
if (version == "0.0.0")
{
version = _stringResourcesService.AboutViewResources.Get("SelfbuiltVersion");
}
_version = version;
_developers = new ObservableCollection<PersonViewModel>(_configurationService.Common.About.Developers.Select(x => new PersonViewModel(x.Name, x.Url)));
_repositoryUrl = new Uri(_configurationService.Common.About.RepositoryUrl);
_donationUrl = new Uri(_configurationService.Common.About.DonationUrl);
}
#endregion
#region COMMANDS
[RelayCommand]
public void Navigation()
{
string languageCode = "en-US";
Language language = _configurationService.Common.About.Translation.FirstOrDefault(x => x.Code == languageCode);
Translators = new ObservableCollection<PersonViewModel>(language.Translators.Select(x => new PersonViewModel(x.Name, x.Url)));
}
#endregion
}
}

View File

@@ -0,0 +1,34 @@
using CommunityToolkit.Mvvm.ComponentModel;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace VDownload.Core.ViewModels.About.Helpers
{
public partial class PersonViewModel : ObservableObject
{
#region PROPERTIES
[ObservableProperty]
protected string _name;
[ObservableProperty]
protected Uri _url;
#endregion
#region CONSTRUCTORS
public PersonViewModel(string name, string url)
{
_name = name;
_url = new Uri(url);
}
#endregion
}
}

View File

@@ -6,10 +6,88 @@
xmlns:local="using:VDownload.Core.Views.About"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:i="using:Microsoft.Xaml.Interactivity"
xmlns:ic="using:Microsoft.Xaml.Interactions.Core"
mc:Ignorable="d"
Background="Transparent">
<i:Interaction.Behaviors>
<ic:EventTriggerBehavior EventName="Loaded">
<ic:InvokeCommandAction Command="{Binding NavigationCommand}"/>
</ic:EventTriggerBehavior>
</i:Interaction.Behaviors>
<Grid>
<StackPanel HorizontalAlignment="Center"
VerticalAlignment="Center" Spacing="20">
<StackPanel HorizontalAlignment="Center">
<Image Source="{StaticResource ImageLogo}"
Width="150"
Height="150"
HorizontalAlignment="Center"/>
<TextBlock Text="VDownload"
HorizontalAlignment="Center"
FontWeight="SemiBold"
FontSize="30"/>
<TextBlock Text="{Binding Version}"
HorizontalAlignment="Center"
FontSize="16"/>
</StackPanel>
<StackPanel HorizontalAlignment="Center"
Spacing="2">
<TextBlock x:Uid="/VDownload.Core.Strings/AboutViewResources/Developers"
HorizontalAlignment="Center"
FontSize="17"
FontWeight="SemiBold"/>
<ItemsRepeater HorizontalAlignment="Center"
ItemsSource="{Binding Developers}">
<ItemsRepeater.ItemTemplate>
<DataTemplate>
<HyperlinkButton HorizontalAlignment="Center"
NavigateUri="{Binding Url}">
<TextBlock FontSize="12"
Text="{Binding Name}"/>
</HyperlinkButton>
</DataTemplate>
</ItemsRepeater.ItemTemplate>
</ItemsRepeater>
</StackPanel>
<StackPanel HorizontalAlignment="Center"
Spacing="2">
<TextBlock x:Uid="/VDownload.Core.Strings/AboutViewResources/Translation"
HorizontalAlignment="Center"
FontSize="17"
FontWeight="SemiBold"/>
<ItemsRepeater HorizontalAlignment="Center"
ItemsSource="{Binding Translators}">
<ItemsRepeater.ItemTemplate>
<DataTemplate>
<HyperlinkButton HorizontalAlignment="Center"
NavigateUri="{Binding Url}">
<TextBlock FontSize="12"
Text="{Binding Name}"/>
</HyperlinkButton>
</DataTemplate>
</ItemsRepeater.ItemTemplate>
</ItemsRepeater>
</StackPanel>
<StackPanel HorizontalAlignment="Center"
Spacing="2">
<TextBlock x:Uid="/VDownload.Core.Strings/AboutViewResources/More"
HorizontalAlignment="Center"
FontSize="17"
FontWeight="SemiBold"/>
<StackPanel Orientation="Horizontal">
<HyperlinkButton HorizontalAlignment="Center"
NavigateUri="{Binding RepositoryUrl}">
<TextBlock x:Uid="/VDownload.Core.Strings/AboutViewResources/Repository"
FontSize="12"/>
</HyperlinkButton>
<HyperlinkButton HorizontalAlignment="Center"
NavigateUri="{Binding DonationUrl}">
<TextBlock x:Uid="/VDownload.Core.Strings/AboutViewResources/Donation"
FontSize="12"/>
</HyperlinkButton>
</StackPanel>
</StackPanel>
</StackPanel>
</Grid>
</Page>