Update logos + ViewModel
134
Ryujinx.Ava/UI/ViewModels/AboutWindowViewModel.cs
Normal file
|
@ -0,0 +1,134 @@
|
||||||
|
using Avalonia;
|
||||||
|
using Avalonia.Media.Imaging;
|
||||||
|
using Avalonia.Threading;
|
||||||
|
using Ryujinx.Ava.Common.Locale;
|
||||||
|
using Ryujinx.Common.Utilities;
|
||||||
|
using Ryujinx.Ui.Common.Configuration;
|
||||||
|
using System;
|
||||||
|
using System.Net.Http;
|
||||||
|
using System.Net.NetworkInformation;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace Ryujinx.Ava.UI.ViewModels;
|
||||||
|
|
||||||
|
public class AboutWindowViewModel : BaseModel
|
||||||
|
{
|
||||||
|
private Bitmap _githubLogo;
|
||||||
|
private Bitmap _discordLogo;
|
||||||
|
private Bitmap _patreonLogo;
|
||||||
|
private Bitmap _twitterLogo;
|
||||||
|
|
||||||
|
private string _version;
|
||||||
|
private string _supporters;
|
||||||
|
|
||||||
|
public Bitmap GithubLogo
|
||||||
|
{
|
||||||
|
get => _githubLogo;
|
||||||
|
set
|
||||||
|
{
|
||||||
|
_githubLogo = value;
|
||||||
|
OnPropertyChanged();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public Bitmap DiscordLogo
|
||||||
|
{
|
||||||
|
get => _discordLogo;
|
||||||
|
set
|
||||||
|
{
|
||||||
|
_discordLogo = value;
|
||||||
|
OnPropertyChanged();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public Bitmap PatreonLogo
|
||||||
|
{
|
||||||
|
get => _patreonLogo;
|
||||||
|
set
|
||||||
|
{
|
||||||
|
_patreonLogo = value;
|
||||||
|
OnPropertyChanged();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public Bitmap TwitterLogo
|
||||||
|
{
|
||||||
|
get => _twitterLogo;
|
||||||
|
set
|
||||||
|
{
|
||||||
|
_twitterLogo = value;
|
||||||
|
OnPropertyChanged();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public string Supporters
|
||||||
|
{
|
||||||
|
get => _supporters;
|
||||||
|
set
|
||||||
|
{
|
||||||
|
_supporters = value;
|
||||||
|
OnPropertyChanged();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public string Version
|
||||||
|
{
|
||||||
|
get => _version;
|
||||||
|
set
|
||||||
|
{
|
||||||
|
_version = value;
|
||||||
|
OnPropertyChanged();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public string Developers
|
||||||
|
{
|
||||||
|
get => string.Format(LocaleManager.Instance["AboutPageDeveloperListMore"], "gdkchan, Ac_K, Thog, rip in peri peri, LDj3SNuD, emmaus, Thealexbarney, Xpl0itR, GoffyDude, »jD«");
|
||||||
|
}
|
||||||
|
|
||||||
|
public AboutWindowViewModel()
|
||||||
|
{
|
||||||
|
Version = Program.Version;
|
||||||
|
|
||||||
|
var assets = AvaloniaLocator.Current.GetService<Avalonia.Platform.IAssetLoader>();
|
||||||
|
|
||||||
|
if (ConfigurationState.Instance.Ui.BaseStyle.Value == "Light")
|
||||||
|
{
|
||||||
|
GithubLogo = new Bitmap(assets.Open(new Uri("resm:Ryujinx.Ui.Common.Resources.Logo_GitHub_Light.png?assembly=Ryujinx.Ui.Common")));
|
||||||
|
DiscordLogo = new Bitmap(assets.Open(new Uri("resm:Ryujinx.Ui.Common.Resources.Logo_Discord_Light.png?assembly=Ryujinx.Ui.Common")));
|
||||||
|
PatreonLogo = new Bitmap(assets.Open(new Uri("resm:Ryujinx.Ui.Common.Resources.Logo_Patreon_Light.png?assembly=Ryujinx.Ui.Common")));
|
||||||
|
TwitterLogo = new Bitmap(assets.Open(new Uri("resm:Ryujinx.Ui.Common.Resources.Logo_Twitter_Light.png?assembly=Ryujinx.Ui.Common")));
|
||||||
|
} else
|
||||||
|
{
|
||||||
|
GithubLogo = new Bitmap(assets.Open(new Uri("resm:Ryujinx.Ui.Common.Resources.Logo_GitHub_Dark.png?assembly=Ryujinx.Ui.Common")));
|
||||||
|
DiscordLogo = new Bitmap(assets.Open(new Uri("resm:Ryujinx.Ui.Common.Resources.Logo_Discord_Dark.png?assembly=Ryujinx.Ui.Common")));
|
||||||
|
PatreonLogo = new Bitmap(assets.Open(new Uri("resm:Ryujinx.Ui.Common.Resources.Logo_Patreon_Dark.png?assembly=Ryujinx.Ui.Common")));
|
||||||
|
TwitterLogo = new Bitmap(assets.Open(new Uri("resm:Ryujinx.Ui.Common.Resources.Logo_Twitter_Dark.png?assembly=Ryujinx.Ui.Common")));
|
||||||
|
}
|
||||||
|
|
||||||
|
Dispatcher.UIThread.InvokeAsync(DownloadPatronsJson);
|
||||||
|
}
|
||||||
|
|
||||||
|
private async Task DownloadPatronsJson()
|
||||||
|
{
|
||||||
|
if (!NetworkInterface.GetIsNetworkAvailable())
|
||||||
|
{
|
||||||
|
Supporters = LocaleManager.Instance["ConnectionError"];
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
HttpClient httpClient = new();
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
string patreonJsonString = await httpClient.GetStringAsync("https://patreon.ryujinx.org/");
|
||||||
|
|
||||||
|
Supporters = string.Join(", ", JsonHelper.Deserialize<string[]>(patreonJsonString));
|
||||||
|
}
|
||||||
|
catch
|
||||||
|
{
|
||||||
|
Supporters = LocaleManager.Instance["ApiError"];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -5,6 +5,7 @@
|
||||||
xmlns:locale="clr-namespace:Ryujinx.Ava.Common.Locale"
|
xmlns:locale="clr-namespace:Ryujinx.Ava.Common.Locale"
|
||||||
xmlns:flex="clr-namespace:Avalonia.Flexbox;assembly=Avalonia.Flexbox"
|
xmlns:flex="clr-namespace:Avalonia.Flexbox;assembly=Avalonia.Flexbox"
|
||||||
xmlns:ui="clr-namespace:FluentAvalonia.UI.Controls;assembly=FluentAvalonia"
|
xmlns:ui="clr-namespace:FluentAvalonia.UI.Controls;assembly=FluentAvalonia"
|
||||||
|
xmlns:viewModel="clr-namespace:Ryujinx.Ava.UI.ViewModels"
|
||||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||||
mc:Ignorable="d"
|
mc:Ignorable="d"
|
||||||
d:DesignHeight="260"
|
d:DesignHeight="260"
|
||||||
|
@ -12,8 +13,13 @@
|
||||||
Height="260"
|
Height="260"
|
||||||
Width="550"
|
Width="550"
|
||||||
x:Class="Ryujinx.Ava.UI.Windows.AboutWindow"
|
x:Class="Ryujinx.Ava.UI.Windows.AboutWindow"
|
||||||
|
x:DataType="viewModel:AboutWindowViewModel"
|
||||||
|
x:CompileBindings="True"
|
||||||
Margin="0 -12 0 0"
|
Margin="0 -12 0 0"
|
||||||
Focusable="True">
|
Focusable="True">
|
||||||
|
<Design.DataContext>
|
||||||
|
<viewModel:AboutWindowViewModel />
|
||||||
|
</Design.DataContext>
|
||||||
<Grid
|
<Grid
|
||||||
HorizontalAlignment="Stretch"
|
HorizontalAlignment="Stretch"
|
||||||
VerticalAlignment="Stretch">
|
VerticalAlignment="Stretch">
|
||||||
|
@ -101,7 +107,7 @@
|
||||||
Background="Transparent"
|
Background="Transparent"
|
||||||
Click="Button_OnClick"
|
Click="Button_OnClick"
|
||||||
Tag="https://www.patreon.com/ryujinx">
|
Tag="https://www.patreon.com/ryujinx">
|
||||||
<Image Source="resm:Ryujinx.Ui.Common.Resources.Logo_Patreon.png?assembly=Ryujinx.Ui.Common" />
|
<Image Source="{Binding PatreonLogo}" />
|
||||||
</Button>
|
</Button>
|
||||||
<Button
|
<Button
|
||||||
MaxHeight="30"
|
MaxHeight="30"
|
||||||
|
@ -113,7 +119,7 @@
|
||||||
Background="Transparent"
|
Background="Transparent"
|
||||||
Click="Button_OnClick"
|
Click="Button_OnClick"
|
||||||
Tag="https://github.com/Ryujinx/Ryujinx">
|
Tag="https://github.com/Ryujinx/Ryujinx">
|
||||||
<Image Source="resm:Ryujinx.Ui.Common.Resources.Logo_GitHub.png?assembly=Ryujinx.Ui.Common" />
|
<Image Source="{Binding GithubLogo}" />
|
||||||
</Button>
|
</Button>
|
||||||
<Button
|
<Button
|
||||||
MaxHeight="30"
|
MaxHeight="30"
|
||||||
|
@ -125,7 +131,7 @@
|
||||||
Background="Transparent"
|
Background="Transparent"
|
||||||
Click="Button_OnClick"
|
Click="Button_OnClick"
|
||||||
Tag="https://discordapp.com/invite/N2FmfVc">
|
Tag="https://discordapp.com/invite/N2FmfVc">
|
||||||
<Image Source="resm:Ryujinx.Ui.Common.Resources.Logo_Discord.png?assembly=Ryujinx.Ui.Common" />
|
<Image Source="{Binding DiscordLogo}" />
|
||||||
</Button>
|
</Button>
|
||||||
<Button
|
<Button
|
||||||
MaxHeight="30"
|
MaxHeight="30"
|
||||||
|
@ -137,7 +143,7 @@
|
||||||
Background="Transparent"
|
Background="Transparent"
|
||||||
Click="Button_OnClick"
|
Click="Button_OnClick"
|
||||||
Tag="https://twitter.com/RyujinxEmu">
|
Tag="https://twitter.com/RyujinxEmu">
|
||||||
<Image Source="resm:Ryujinx.Ui.Common.Resources.Logo_Twitter.png?assembly=Ryujinx.Ui.Common" />
|
<Image Source="{Binding TwitterLogo}" />
|
||||||
</Button>
|
</Button>
|
||||||
<Button
|
<Button
|
||||||
MaxHeight="30"
|
MaxHeight="30"
|
||||||
|
|
|
@ -2,12 +2,12 @@
|
||||||
using Avalonia.Controls;
|
using Avalonia.Controls;
|
||||||
using Avalonia.Input;
|
using Avalonia.Input;
|
||||||
using Avalonia.Interactivity;
|
using Avalonia.Interactivity;
|
||||||
using Avalonia.Markup.Xaml.Templates;
|
|
||||||
using Avalonia.Styling;
|
using Avalonia.Styling;
|
||||||
using Avalonia.Threading;
|
using Avalonia.Threading;
|
||||||
using DynamicData;
|
using DynamicData;
|
||||||
using FluentAvalonia.UI.Controls;
|
using FluentAvalonia.UI.Controls;
|
||||||
using Ryujinx.Ava.Common.Locale;
|
using Ryujinx.Ava.Common.Locale;
|
||||||
|
using Ryujinx.Ava.UI.ViewModels;
|
||||||
using Ryujinx.Common.Utilities;
|
using Ryujinx.Common.Utilities;
|
||||||
using Ryujinx.Ui.Common.Helper;
|
using Ryujinx.Ui.Common.Helper;
|
||||||
using System.Net.Http;
|
using System.Net.Http;
|
||||||
|
@ -21,23 +21,15 @@ namespace Ryujinx.Ava.UI.Windows
|
||||||
{
|
{
|
||||||
public AboutWindow()
|
public AboutWindow()
|
||||||
{
|
{
|
||||||
Version = Program.Version;
|
DataContext = new AboutWindowViewModel();
|
||||||
|
|
||||||
DataContext = this;
|
|
||||||
|
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
|
|
||||||
_ = DownloadPatronsJson();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public string Supporters { get; set; }
|
|
||||||
public string Version { get; set; }
|
|
||||||
|
|
||||||
public string Developers => string.Format(LocaleManager.Instance["AboutPageDeveloperListMore"], "gdkchan, Ac_K, Thog, rip in peri peri, LDj3SNuD, emmaus, Thealexbarney, Xpl0itR, GoffyDude, »jD«");
|
|
||||||
|
|
||||||
public static async Task Show()
|
public static async Task Show()
|
||||||
{
|
{
|
||||||
var content = new AboutWindow();
|
var content = new AboutWindow();
|
||||||
|
|
||||||
ContentDialog contentDialog = new ContentDialog
|
ContentDialog contentDialog = new ContentDialog
|
||||||
{
|
{
|
||||||
PrimaryButtonText = "",
|
PrimaryButtonText = "",
|
||||||
|
@ -66,31 +58,6 @@ namespace Ryujinx.Ava.UI.Windows
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private async Task DownloadPatronsJson()
|
|
||||||
{
|
|
||||||
if (!NetworkInterface.GetIsNetworkAvailable())
|
|
||||||
{
|
|
||||||
Supporters = LocaleManager.Instance["ConnectionError"];
|
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
HttpClient httpClient = new();
|
|
||||||
|
|
||||||
try
|
|
||||||
{
|
|
||||||
string patreonJsonString = await httpClient.GetStringAsync("https://patreon.ryujinx.org/");
|
|
||||||
|
|
||||||
Supporters = string.Join(", ", JsonHelper.Deserialize<string[]>(patreonJsonString));
|
|
||||||
}
|
|
||||||
catch
|
|
||||||
{
|
|
||||||
Supporters = LocaleManager.Instance["ApiError"];
|
|
||||||
}
|
|
||||||
|
|
||||||
await Dispatcher.UIThread.InvokeAsync(() => SupportersTextBlock.Text = Supporters);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void AmiiboLabel_OnPointerPressed(object sender, PointerPressedEventArgs e)
|
private void AmiiboLabel_OnPointerPressed(object sender, PointerPressedEventArgs e)
|
||||||
{
|
{
|
||||||
if (sender is TextBlock)
|
if (sender is TextBlock)
|
||||||
|
|
Before Width: | Height: | Size: 37 KiB |
BIN
Ryujinx.Ui.Common/Resources/Logo_Discord_Dark.png
Normal file
After Width: | Height: | Size: 9.6 KiB |
BIN
Ryujinx.Ui.Common/Resources/Logo_Discord_Light.png
Normal file
After Width: | Height: | Size: 10 KiB |
Before Width: | Height: | Size: 16 KiB |
BIN
Ryujinx.Ui.Common/Resources/Logo_GitHub_Dark.png
Normal file
After Width: | Height: | Size: 4.7 KiB |
BIN
Ryujinx.Ui.Common/Resources/Logo_GitHub_Light.png
Normal file
After Width: | Height: | Size: 5 KiB |
Before Width: | Height: | Size: 7.9 KiB |
BIN
Ryujinx.Ui.Common/Resources/Logo_Patreon_Dark.png
Normal file
After Width: | Height: | Size: 51 KiB |
BIN
Ryujinx.Ui.Common/Resources/Logo_Patreon_Light.png
Normal file
After Width: | Height: | Size: 29 KiB |
Before Width: | Height: | Size: 14 KiB |
BIN
Ryujinx.Ui.Common/Resources/Logo_Twitter_Dark.png
Normal file
After Width: | Height: | Size: 18 KiB |
BIN
Ryujinx.Ui.Common/Resources/Logo_Twitter_Light.png
Normal file
After Width: | Height: | Size: 19 KiB |
|
@ -34,11 +34,15 @@
|
||||||
<EmbeddedResource Include="Resources\Icon_NSP.png" />
|
<EmbeddedResource Include="Resources\Icon_NSP.png" />
|
||||||
<EmbeddedResource Include="Resources\Icon_XCI.png" />
|
<EmbeddedResource Include="Resources\Icon_XCI.png" />
|
||||||
<EmbeddedResource Include="Resources\Logo_Amiibo.png" />
|
<EmbeddedResource Include="Resources\Logo_Amiibo.png" />
|
||||||
<EmbeddedResource Include="Resources\Logo_Discord.png" />
|
|
||||||
<EmbeddedResource Include="Resources\Logo_GitHub.png" />
|
|
||||||
<EmbeddedResource Include="Resources\Logo_Patreon.png" />
|
|
||||||
<EmbeddedResource Include="Resources\Logo_Ryujinx.png" />
|
<EmbeddedResource Include="Resources\Logo_Ryujinx.png" />
|
||||||
<EmbeddedResource Include="Resources\Logo_Twitter.png" />
|
<EmbeddedResource Include="Resources\Logo_Discord_Dark.png" />
|
||||||
|
<EmbeddedResource Include="Resources\Logo_Discord_Light.png" />
|
||||||
|
<EmbeddedResource Include="Resources\Logo_GitHub_Dark.png" />
|
||||||
|
<EmbeddedResource Include="Resources\Logo_GitHub_Light.png" />
|
||||||
|
<EmbeddedResource Include="Resources\Logo_Patreon_Dark.png" />
|
||||||
|
<EmbeddedResource Include="Resources\Logo_Patreon_Light.png" />
|
||||||
|
<EmbeddedResource Include="Resources\Logo_Twitter_Dark.png" />
|
||||||
|
<EmbeddedResource Include="Resources\Logo_Twitter_Light.png" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
|