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>

View File

@@ -6,6 +6,9 @@ namespace VDownload.Services.Data.Configuration
{
public class CommonConfiguration
{
[ConfigurationKeyName("about")]
public About About { get; set; }
[ConfigurationKeyName("filename_templates")]
public IEnumerable<FilenameTemplate> FilenameTemplates { get; set; }

View File

@@ -0,0 +1,24 @@
using Microsoft.Extensions.Configuration;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace VDownload.Services.Data.Configuration.Models
{
public class About
{
[ConfigurationKeyName("repository_url")]
public string RepositoryUrl { get; set; }
[ConfigurationKeyName("donation_url")]
public string DonationUrl { get; set; }
[ConfigurationKeyName("developers")]
public IEnumerable<Person> Developers { get; set; }
[ConfigurationKeyName("translation")]
public IEnumerable<Language> Translation { get; set; }
}
}

View File

@@ -0,0 +1,18 @@
using Microsoft.Extensions.Configuration;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace VDownload.Services.Data.Configuration.Models
{
public class Language
{
[ConfigurationKeyName("code")]
public string Code { get; set; }
[ConfigurationKeyName("translators")]
public IEnumerable<Person> Translators { get; set; }
}
}

View File

@@ -0,0 +1,18 @@
using Microsoft.Extensions.Configuration;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace VDownload.Services.Data.Configuration.Models
{
public class Person
{
[ConfigurationKeyName("name")]
public string Name { get; set; }
[ConfigurationKeyName("url")]
public string Url { get; set; }
}
}

View File

@@ -7,10 +7,12 @@ using System.Net.Http;
using System.Threading.Tasks;
using VDownload.Core.Tasks;
using VDownload.Core.ViewModels;
using VDownload.Core.ViewModels.About;
using VDownload.Core.ViewModels.Authentication;
using VDownload.Core.ViewModels.Home;
using VDownload.Core.ViewModels.Settings;
using VDownload.Core.Views;
using VDownload.Core.Views.About;
using VDownload.Core.Views.Authentication;
using VDownload.Core.Views.Home;
using VDownload.Core.Views.Settings;
@@ -145,6 +147,7 @@ namespace VDownload
protected void BuildPresentation(IServiceCollection services)
{
// ViewModels
services.AddSingleton<AboutViewModel>();
services.AddSingleton<AuthenticationViewModel>();
services.AddSingleton<SettingsViewModel>();
services.AddSingleton<HomeDownloadsViewModel>();
@@ -154,6 +157,7 @@ namespace VDownload
services.AddSingleton<BaseViewModel>();
// Views
services.AddTransient<AboutView>();
services.AddTransient<AuthenticationView>();
services.AddTransient<SettingsView>();
services.AddTransient<HomeDownloadsView>();

View File

@@ -8,15 +8,15 @@
IgnorableNamespaces="uap rescap">
<Identity
Name="df3e7de0-430a-4a93-a68b-48c2f3ec497a"
Name="VDownload"
Publisher="CN=mateusz"
Version="1.0.0.0" />
Version="0.0.0.0" />
<mp:PhoneIdentity PhoneProductId="df3e7de0-430a-4a93-a68b-48c2f3ec497a" PhonePublisherId="00000000-0000-0000-0000-000000000000"/>
<Properties>
<DisplayName>VDownload</DisplayName>
<PublisherDisplayName>mateusz</PublisherDisplayName>
<PublisherDisplayName>Mateusz Skoczek</PublisherDisplayName>
<Logo>Assets\Logo\StoreLogo.png</Logo>
</Properties>

View File

@@ -1,4 +1,4 @@
<Project Sdk="Microsoft.NET.Sdk">
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>WinExe</OutputType>
<TargetFramework>net8.0-windows10.0.19041.0</TargetFramework>
@@ -14,6 +14,10 @@
<UseRidGraph>true</UseRidGraph>
<EnableCoreMrtTooling Condition=" '$(BuildingInsideVisualStudio)' != 'true' ">false</EnableCoreMrtTooling>
<ApplicationIcon>Assets\Logo\Logo.ico</ApplicationIcon>
<PackageLicenseFile>LICENSE</PackageLicenseFile>
<PackageRequireLicenseAcceptance>True</PackageRequireLicenseAcceptance>
<Version>0.0.0</Version>
<IncludeSourceRevisionInInformationalVersion>false</IncludeSourceRevisionInInformationalVersion>
</PropertyGroup>
<ItemGroup>
<Content Remove="Assets\BaseView\AuthenticationDark.png" />
@@ -175,6 +179,12 @@
<ItemGroup>
<Folder Include="FFmpeg\" />
</ItemGroup>
<ItemGroup>
<None Include="..\LICENSE">
<Pack>True</Pack>
<PackagePath>\</PackagePath>
</None>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\VDownload.Core\VDownload.Core.ViewModels\VDownload.Core.ViewModels.csproj" />
<ProjectReference Include="..\VDownload.Core\VDownload.Core.Views\VDownload.Core.Views.csproj" />

View File

@@ -1,5 +1,26 @@
{
"common": {
"about": {
"repository_url": "https://github.com/mateuszskoczek/VDownload",
"donation_url": "https://paypal.me/mateuszskoczek",
"developers": [
{
"name": "Mateusz Skoczek",
"url": "https://github.com/mateuszskoczek"
}
],
"translation": [
{
"code": "en-US",
"translators": [
{
"name": "Mateusz Skoczek",
"url": "https://github.com/mateuszskoczek"
}
]
}
]
},
"filename_templates": [
{
"name": "id",