2022-07-08 14:47:11 -04:00
|
|
|
using Avalonia;
|
|
|
|
using Avalonia.Interactivity;
|
|
|
|
using Avalonia.Markup.Xaml;
|
|
|
|
using Ryujinx.Ava.Common.Locale;
|
|
|
|
using Ryujinx.Ava.Ui.Models;
|
|
|
|
using Ryujinx.Ava.Ui.ViewModels;
|
|
|
|
|
|
|
|
namespace Ryujinx.Ava.Ui.Windows
|
|
|
|
{
|
2022-07-24 13:38:38 -04:00
|
|
|
public partial class AmiiboWindow : StyleableWindow
|
2022-07-08 14:47:11 -04:00
|
|
|
{
|
|
|
|
public AmiiboWindow(bool showAll, string lastScannedAmiiboId, string titleId)
|
|
|
|
{
|
|
|
|
ViewModel = new AmiiboWindowViewModel(this, lastScannedAmiiboId, titleId);
|
|
|
|
|
|
|
|
ViewModel.ShowAllAmiibo = showAll;
|
|
|
|
|
|
|
|
DataContext = ViewModel;
|
|
|
|
|
|
|
|
InitializeComponent();
|
|
|
|
#if DEBUG
|
|
|
|
this.AttachDevTools();
|
|
|
|
#endif
|
|
|
|
Title = $"Ryujinx {Program.Version} - " + LocaleManager.Instance["Amiibo"];
|
|
|
|
}
|
|
|
|
|
|
|
|
public AmiiboWindow()
|
|
|
|
{
|
|
|
|
ViewModel = new AmiiboWindowViewModel(this, string.Empty, string.Empty);
|
|
|
|
|
|
|
|
DataContext = ViewModel;
|
|
|
|
|
|
|
|
InitializeComponent();
|
|
|
|
#if DEBUG
|
|
|
|
this.AttachDevTools();
|
|
|
|
#endif
|
|
|
|
if (Program.PreviewerDetached)
|
|
|
|
{
|
|
|
|
Title = $"Ryujinx {Program.Version} - " + LocaleManager.Instance["Amiibo"];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
public bool IsScanned { get; set; }
|
|
|
|
public Amiibo.AmiiboApi ScannedAmiibo { get; set; }
|
|
|
|
public AmiiboWindowViewModel ViewModel { get; set; }
|
|
|
|
|
|
|
|
private void ScanButton_Click(object sender, RoutedEventArgs e)
|
|
|
|
{
|
|
|
|
if (ViewModel.AmiiboSelectedIndex > -1)
|
|
|
|
{
|
|
|
|
Amiibo.AmiiboApi amiibo = ViewModel.AmiiboList[ViewModel.AmiiboSelectedIndex];
|
|
|
|
ScannedAmiibo = amiibo;
|
|
|
|
IsScanned = true;
|
|
|
|
Close();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
private void CancelButton_Click(object sender, RoutedEventArgs e)
|
|
|
|
{
|
|
|
|
IsScanned = false;
|
|
|
|
|
|
|
|
Close();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|