2022-07-24 10:38:38 -07:00
|
|
|
using Avalonia.Controls;
|
2022-07-08 11:47:11 -07:00
|
|
|
using Avalonia.Interactivity;
|
2022-07-24 10:38:38 -07:00
|
|
|
using FluentAvalonia.UI.Controls;
|
|
|
|
using FluentAvalonia.UI.Navigation;
|
|
|
|
using Ryujinx.Ava.Ui.Controls;
|
|
|
|
using Ryujinx.Ava.Ui.Models;
|
2022-07-08 11:47:11 -07:00
|
|
|
using Ryujinx.Ava.Ui.ViewModels;
|
|
|
|
using Ryujinx.HLE.FileSystem;
|
|
|
|
|
|
|
|
namespace Ryujinx.Ava.Ui.Windows
|
|
|
|
{
|
2022-07-24 10:38:38 -07:00
|
|
|
public partial class AvatarWindow : UserControl
|
2022-07-08 11:47:11 -07:00
|
|
|
{
|
2022-07-24 10:38:38 -07:00
|
|
|
private NavigationDialogHost _parent;
|
|
|
|
private TempProfile _profile;
|
|
|
|
|
2022-07-08 11:47:11 -07:00
|
|
|
public AvatarWindow(ContentManager contentManager)
|
|
|
|
{
|
|
|
|
ContentManager = contentManager;
|
|
|
|
|
|
|
|
DataContext = ViewModel;
|
|
|
|
|
|
|
|
InitializeComponent();
|
|
|
|
}
|
|
|
|
|
|
|
|
public AvatarWindow()
|
|
|
|
{
|
|
|
|
InitializeComponent();
|
2022-07-24 10:38:38 -07:00
|
|
|
|
|
|
|
AddHandler(Frame.NavigatedToEvent, (s, e) =>
|
|
|
|
{
|
|
|
|
NavigatedTo(e);
|
|
|
|
}, RoutingStrategies.Direct);
|
|
|
|
}
|
|
|
|
|
|
|
|
private void NavigatedTo(NavigationEventArgs arg)
|
|
|
|
{
|
2022-07-08 11:47:11 -07:00
|
|
|
if (Program.PreviewerDetached)
|
|
|
|
{
|
2022-07-24 10:38:38 -07:00
|
|
|
if (arg.NavigationMode == NavigationMode.New)
|
|
|
|
{
|
|
|
|
(_parent, _profile) = ((NavigationDialogHost, TempProfile))arg.Parameter;
|
|
|
|
ContentManager = _parent.ContentManager;
|
|
|
|
if (Program.PreviewerDetached)
|
|
|
|
{
|
|
|
|
ViewModel = new AvatarProfileViewModel(() => ViewModel.ReloadImages());
|
|
|
|
}
|
|
|
|
|
|
|
|
DataContext = ViewModel;
|
|
|
|
}
|
2022-07-08 11:47:11 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-07-24 10:38:38 -07:00
|
|
|
public ContentManager ContentManager { get; private set; }
|
2022-07-08 11:47:11 -07:00
|
|
|
|
|
|
|
internal AvatarProfileViewModel ViewModel { get; set; }
|
|
|
|
|
2022-07-24 10:38:38 -07:00
|
|
|
private void CloseButton_OnClick(object sender, RoutedEventArgs e)
|
2022-07-08 11:47:11 -07:00
|
|
|
{
|
|
|
|
ViewModel.Dispose();
|
|
|
|
|
2022-07-24 10:38:38 -07:00
|
|
|
_parent.GoBack();
|
2022-07-08 11:47:11 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
private void ChooseButton_OnClick(object sender, RoutedEventArgs e)
|
|
|
|
{
|
|
|
|
if (ViewModel.SelectedIndex > -1)
|
|
|
|
{
|
2022-07-24 10:38:38 -07:00
|
|
|
_profile.Image = ViewModel.SelectedImage;
|
|
|
|
|
|
|
|
ViewModel.Dispose();
|
2022-07-08 11:47:11 -07:00
|
|
|
|
2022-07-24 10:38:38 -07:00
|
|
|
_parent.GoBack();
|
2022-07-08 11:47:11 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|