0
0
Fork 0
This repository has been archived on 2024-10-12. You can view files and clone it, but cannot push or open issues or pull requests.
ryujinx-final/Ryujinx.Ava/Ui/Windows/AvatarWindow.axaml.cs
Emmanuel Hansen 3af42d6c7e
UI - Avalonia Part 3 (#3441)
* Add all other windows

* addreesed review

* Prevent "No Update" option from being deleted

* Select no update is the current update is removed from the title update window

* fix amiibo crash
2022-07-08 15:47:11 -03:00

71 lines
No EOL
1.8 KiB
C#

using Avalonia;
using Avalonia.Interactivity;
using Avalonia.Markup.Xaml;
using Ryujinx.Ava.Common.Locale;
using Ryujinx.Ava.Ui.ViewModels;
using Ryujinx.HLE.FileSystem;
using System;
namespace Ryujinx.Ava.Ui.Windows
{
public class AvatarWindow : StyleableWindow
{
public AvatarWindow(ContentManager contentManager)
{
ContentManager = contentManager;
ViewModel = new AvatarProfileViewModel(() => ViewModel.ReloadImages());
DataContext = ViewModel;
InitializeComponent();
#if DEBUG
this.AttachDevTools();
#endif
Title = $"Ryujinx {Program.Version} - " + LocaleManager.Instance["AvatarWindowTitle"];
}
public AvatarWindow()
{
InitializeComponent();
#if DEBUG
this.AttachDevTools();
#endif
if (Program.PreviewerDetached)
{
Title = $"Ryujinx {Program.Version} - " + LocaleManager.Instance["AvatarWindowTitle"];
}
}
public ContentManager ContentManager { get; }
public byte[] SelectedImage { get; set; }
internal AvatarProfileViewModel ViewModel { get; set; }
private void InitializeComponent()
{
AvaloniaXamlLoader.Load(this);
}
protected override void OnClosed(EventArgs e)
{
ViewModel.Dispose();
base.OnClosed(e);
}
private void CloseButton_OnClick(object sender, RoutedEventArgs e)
{
Close();
}
private void ChooseButton_OnClick(object sender, RoutedEventArgs e)
{
if (ViewModel.SelectedIndex > -1)
{
SelectedImage = ViewModel.SelectedImage;
Close();
}
}
}
}