aboutsummaryrefslogtreecommitdiff
path: root/src/Ryujinx.Ava/UI/Views/User/UserSelectorView.axaml
blob: 818a21d6967c9209433bfc0defd873ec0eaa0868 (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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
<UserControl
    x:Class="Ryujinx.Ava.UI.Views.User.UserSelectorViews"
    xmlns="https://github.com/avaloniaui"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:locale="clr-namespace:Ryujinx.Ava.Common.Locale"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:flex="clr-namespace:Avalonia.Flexbox;assembly=Avalonia.Flexbox"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    xmlns:helpers="clr-namespace:Ryujinx.Ava.UI.Helpers"
    xmlns:models="clr-namespace:Ryujinx.Ava.UI.Models"
    xmlns:viewModels="clr-namespace:Ryujinx.Ava.UI.ViewModels"
    xmlns:ui="clr-namespace:FluentAvalonia.UI.Controls;assembly=FluentAvalonia"
    d:DesignHeight="450"
    MinWidth="500"
    d:DesignWidth="800"
    mc:Ignorable="d"
    Focusable="True"
    x:DataType="viewModels:UserProfileViewModel">
    <UserControl.Resources>
        <helpers:BitmapArrayValueConverter x:Key="ByteImage" />
    </UserControl.Resources>
    <Design.DataContext>
        <viewModels:UserProfileViewModel />
    </Design.DataContext>
    <Grid HorizontalAlignment="Stretch" VerticalAlignment="Stretch">
        <Grid.RowDefinitions>
            <RowDefinition />
            <RowDefinition Height="Auto" />
        </Grid.RowDefinitions>
        <Border
            CornerRadius="5"
            BorderBrush="{DynamicResource AppListHoverBackgroundColor}"
            BorderThickness="1">
            <ListBox
                MaxHeight="300"
                HorizontalAlignment="Stretch"
                VerticalAlignment="Center"
                SelectionChanged="ProfilesList_SelectionChanged"
                Background="Transparent"
                ItemsSource="{Binding Profiles}">
                <ListBox.ItemsPanel>
                    <ItemsPanelTemplate>
                        <flex:FlexPanel
                            HorizontalAlignment="Stretch"
                            VerticalAlignment="Stretch"
                            AlignContent="FlexStart"
                            JustifyContent="FlexStart" />
                    </ItemsPanelTemplate>
                </ListBox.ItemsPanel>
                <ListBox.Styles>
                    <Style Selector="ListBoxItem">
                        <Setter Property="Margin" Value="5 5 0 5" />
                        <Setter Property="CornerRadius" Value="5" />
                    </Style>
                    <Style Selector="Rectangle#SelectionIndicator">
                        <Setter Property="Opacity" Value="0" />
                    </Style>
                </ListBox.Styles>
                <ListBox.DataTemplates>
                    <DataTemplate
                        DataType="models:UserProfile">
                        <Grid
                            PointerEntered="Grid_PointerEntered"
                            PointerExited="Grid_OnPointerExited">
                            <Border
                                HorizontalAlignment="Stretch"
                                VerticalAlignment="Stretch"
                                ClipToBounds="True"
                                CornerRadius="5"
                                Background="{Binding BackgroundColor}">
                                <StackPanel
                                    HorizontalAlignment="Stretch"
                                    VerticalAlignment="Stretch">
                                    <Image
                                        Width="96"
                                        Height="96"
                                        HorizontalAlignment="Stretch"
                                        VerticalAlignment="Top"
                                        Source="{Binding Image, Converter={StaticResource ByteImage}}" />
                                    <TextBlock
                                        HorizontalAlignment="Stretch"
                                        MaxWidth="90"
                                        Text="{Binding Name}"
                                        TextAlignment="Center"
                                        TextWrapping="Wrap"
                                        TextTrimming="CharacterEllipsis"
                                        MaxLines="2"
                                        Margin="5" />
                                </StackPanel>
                            </Border>
                            <Border
                                Margin="2"
                                Height="24"
                                Width="24"
                                CornerRadius="12"
                                HorizontalAlignment="Right"
                                VerticalAlignment="Top"
                                Background="{DynamicResource ThemeContentBackgroundColor}"
                                IsVisible="{Binding IsPointerOver}">
                                <Button
                                    MaxHeight="24"
                                    MaxWidth="24"
                                    MinHeight="24"
                                    MinWidth="24"
                                    CornerRadius="12"
                                    Padding="0"
                                    Click="EditUser">
                                    <ui:SymbolIcon Symbol="Edit" />
                                </Button>
                            </Border>
                        </Grid>
                    </DataTemplate>
                    <DataTemplate
                        DataType="viewModels:BaseModel">
                        <Panel
                            Height="118"
                            Width="96">
                            <Button
                                MinWidth="50"
                                MinHeight="50"
                                MaxWidth="50"
                                MaxHeight="50"
                                CornerRadius="25"
                                Margin="10"
                                Padding="0"
                                HorizontalAlignment="Center"
                                VerticalAlignment="Center"
                                Click="AddUser">
                                <ui:SymbolIcon Symbol="Add" />
                            </Button>
                            <Panel.Styles>
                                <Style Selector="Panel">
                                    <Setter Property="Background" Value="{DynamicResource ListBoxBackground}"/>
                                </Style>
                            </Panel.Styles>
                        </Panel>
                    </DataTemplate>
                </ListBox.DataTemplates>
            </ListBox>
        </Border>
        <StackPanel
            Grid.Row="1"
            Margin="0 24 0 0"
            HorizontalAlignment="Left"
            Orientation="Horizontal"
            Spacing="10">
            <Button
                Click="ManageSaves"
                Content="{locale:Locale UserProfilesManageSaves}" />
            <Button
                Click="RecoverLostAccounts"
                Content="{locale:Locale UserProfilesRecoverLostAccounts}" />
        </StackPanel>
        <StackPanel
            Grid.Row="1"
            Margin="0 24 0 0"
            HorizontalAlignment="Right"
            Orientation="Horizontal">
            <Button
                Click="Close"
                Content="{locale:Locale UserProfilesClose}" />
        </StackPanel>
    </Grid>
</UserControl>