mirror of
https://git.naxdy.org/Mirror/Ryujinx.git
synced 2024-11-16 01:55:27 +00:00
3af42d6c7e
* 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
70 lines
1.9 KiB
C#
70 lines
1.9 KiB
C#
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
|
|
{
|
|
public class AmiiboWindow : StyleableWindow
|
|
{
|
|
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 InitializeComponent()
|
|
{
|
|
AvaloniaXamlLoader.Load(this);
|
|
}
|
|
|
|
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();
|
|
}
|
|
}
|
|
} |