aboutsummaryrefslogtreecommitdiff
path: root/Ryujinx.Ava/UI/Controls/UserRecoverer.axaml.cs
blob: 9f29fddbd6fe29fd8497763d78386adbf496d6a2 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
using Avalonia;
using Avalonia.Controls;
using Avalonia.Interactivity;
using Avalonia.Markup.Xaml;
using FluentAvalonia.UI.Controls;
using FluentAvalonia.UI.Navigation;
using Ryujinx.Ava.UI.Models;
using Ryujinx.Ava.UI.ViewModels;

namespace Ryujinx.Ava.UI.Controls
{
    public partial class UserRecoverer : UserControl
    {
        private UserProfileViewModel _viewModel;
        private NavigationDialogHost _parent;

        public UserRecoverer()
        {
            InitializeComponent();
            AddHandler(Frame.NavigatedToEvent, (s, e) =>
            {
                NavigatedTo(e);
            }, RoutingStrategies.Direct);
        }

        private void NavigatedTo(NavigationEventArgs arg)
        {
            if (Program.PreviewerDetached)
            {
                switch (arg.NavigationMode)
                {
                    case NavigationMode.New:
                        var args = ((NavigationDialogHost parent, UserProfileViewModel viewModel))arg.Parameter;

                        _viewModel = args.viewModel;
                        _parent = args.parent;
                        break;
                }

                DataContext = _viewModel;
            }
        }
    }
}