2022-07-08 19:47:11 +01:00
|
|
|
using Avalonia.Interactivity;
|
|
|
|
using Ryujinx.Ava.Common.Locale;
|
2022-12-29 14:24:05 +00:00
|
|
|
using Ryujinx.Ava.UI.ViewModels;
|
2023-03-21 22:41:19 +00:00
|
|
|
using Ryujinx.Ui.Common.Models.Amiibo;
|
2022-07-08 19:47:11 +01:00
|
|
|
|
2022-12-29 14:24:05 +00:00
|
|
|
namespace Ryujinx.Ava.UI.Windows
|
2022-07-08 19:47:11 +01:00
|
|
|
{
|
2022-07-24 18:38:38 +01:00
|
|
|
public partial class AmiiboWindow : StyleableWindow
|
2022-07-08 19:47:11 +01:00
|
|
|
{
|
|
|
|
public AmiiboWindow(bool showAll, string lastScannedAmiiboId, string titleId)
|
|
|
|
{
|
|
|
|
ViewModel = new AmiiboWindowViewModel(this, lastScannedAmiiboId, titleId);
|
|
|
|
|
|
|
|
ViewModel.ShowAllAmiibo = showAll;
|
|
|
|
|
|
|
|
DataContext = ViewModel;
|
|
|
|
|
|
|
|
InitializeComponent();
|
2022-07-28 23:41:34 +01:00
|
|
|
|
2023-01-03 18:45:08 +00:00
|
|
|
Title = $"Ryujinx {Program.Version} - " + LocaleManager.Instance[LocaleKeys.Amiibo];
|
2022-07-08 19:47:11 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
public AmiiboWindow()
|
|
|
|
{
|
|
|
|
ViewModel = new AmiiboWindowViewModel(this, string.Empty, string.Empty);
|
|
|
|
|
|
|
|
DataContext = ViewModel;
|
|
|
|
|
|
|
|
InitializeComponent();
|
2022-07-28 23:41:34 +01:00
|
|
|
|
2022-07-08 19:47:11 +01:00
|
|
|
if (Program.PreviewerDetached)
|
|
|
|
{
|
2023-01-03 18:45:08 +00:00
|
|
|
Title = $"Ryujinx {Program.Version} - " + LocaleManager.Instance[LocaleKeys.Amiibo];
|
2022-07-08 19:47:11 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
public bool IsScanned { get; set; }
|
2023-03-21 22:41:19 +00:00
|
|
|
public AmiiboApi ScannedAmiibo { get; set; }
|
2022-07-08 19:47:11 +01:00
|
|
|
public AmiiboWindowViewModel ViewModel { get; set; }
|
|
|
|
|
|
|
|
private void ScanButton_Click(object sender, RoutedEventArgs e)
|
|
|
|
{
|
|
|
|
if (ViewModel.AmiiboSelectedIndex > -1)
|
|
|
|
{
|
2023-03-21 22:41:19 +00:00
|
|
|
AmiiboApi amiibo = ViewModel.AmiiboList[ViewModel.AmiiboSelectedIndex];
|
2022-07-08 19:47:11 +01:00
|
|
|
ScannedAmiibo = amiibo;
|
|
|
|
IsScanned = true;
|
|
|
|
Close();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
private void CancelButton_Click(object sender, RoutedEventArgs e)
|
|
|
|
{
|
|
|
|
IsScanned = false;
|
|
|
|
|
|
|
|
Close();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|