UserRecovererView.axaml.cs 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. using Avalonia.Controls;
  2. using Avalonia.Interactivity;
  3. using FluentAvalonia.UI.Controls;
  4. using FluentAvalonia.UI.Navigation;
  5. using Ryujinx.Ava.Common.Locale;
  6. using Ryujinx.Ava.UI.Controls;
  7. namespace Ryujinx.Ava.UI.Views.User
  8. {
  9. public partial class UserRecovererView : UserControl
  10. {
  11. private NavigationDialogHost _parent;
  12. public UserRecovererView()
  13. {
  14. InitializeComponent();
  15. AddHandler(Frame.NavigatedToEvent, (s, e) =>
  16. {
  17. NavigatedTo(e);
  18. }, RoutingStrategies.Direct);
  19. }
  20. private void NavigatedTo(NavigationEventArgs arg)
  21. {
  22. if (Program.PreviewerDetached)
  23. {
  24. switch (arg.NavigationMode)
  25. {
  26. case NavigationMode.New:
  27. var parent = (NavigationDialogHost)arg.Parameter;
  28. _parent = parent;
  29. ((ContentDialog)_parent.Parent).Title = $"{LocaleManager.Instance[LocaleKeys.UserProfileWindowTitle]} - {LocaleManager.Instance[LocaleKeys.UserProfilesRecoverHeading]}";
  30. break;
  31. }
  32. }
  33. }
  34. private void GoBack(object sender, RoutedEventArgs e)
  35. {
  36. _parent?.GoBack();
  37. }
  38. private void Recover(object sender, RoutedEventArgs e)
  39. {
  40. _parent?.RecoverLostAccounts();
  41. }
  42. }
  43. }