aboutsummaryrefslogtreecommitdiff
path: root/Ryujinx.Ava/Ui/Controls/UserSelector.axaml
blob: 3bca7d7d89e62ef967f6fcacbd9dbf37d631abc4 (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
<UserControl xmlns="https://github.com/avaloniaui"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
             xmlns:flex="clr-namespace:Avalonia.Flexbox;assembly=Avalonia.Flexbox"
             xmlns:Locale="clr-namespace:Ryujinx.Ava.Common.Locale"
             xmlns:viewModels="clr-namespace:Ryujinx.Ava.Ui.ViewModels"
             xmlns:controls="clr-namespace:Ryujinx.Ava.Ui.Controls"
             xmlns:ui="clr-namespace:FluentAvalonia.UI.Controls;assembly=FluentAvalonia"
             mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
             x:Class="Ryujinx.Ava.Ui.Controls.UserSelector">
    <UserControl.Resources>
        <controls: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>
        <ListBox HorizontalAlignment="Stretch" VerticalAlignment="Center" Margin="5" Items="{Binding Profiles}"
                 DoubleTapped="ProfilesList_DoubleTapped"
                 SelectionChanged="SelectingItemsControl_SelectionChanged">
            <ListBox.ItemsPanel>
                <ItemsPanelTemplate>
                    <flex:FlexPanel
                        HorizontalAlignment="Stretch"
                        VerticalAlignment="Stretch"
                        AlignContent="FlexStart"
                        JustifyContent="Center" />
                </ItemsPanelTemplate>
            </ListBox.ItemsPanel>
            <ListBox.ItemTemplate>
                <DataTemplate>
                    <Grid>
                        <Border
                            Margin="2"
                            HorizontalAlignment="Stretch"
                            VerticalAlignment="Stretch"
                            ClipToBounds="True"
                            CornerRadius="5">
                            <Grid Margin="0">
                                <Grid.RowDefinitions>
                                    <RowDefinition Height="Auto" />
                                    <RowDefinition Height="Auto" />
                                </Grid.RowDefinitions>
                                <Image
                                    Grid.Row="0"
                                    Margin="0"
                                    HorizontalAlignment="Stretch"
                                    VerticalAlignment="Top"
                                    Height="96" Width="96"
                                    Source="{Binding Image, Converter={StaticResource ByteImage}}" />
                                <StackPanel
                                    Grid.Row="1"
                                    Height="30"
                                    Margin="5"
                                    HorizontalAlignment="Stretch"
                                    VerticalAlignment="Stretch">
                                    <TextBlock
                                        HorizontalAlignment="Stretch"
                                        Text="{Binding Name}"
                                        TextAlignment="Center"
                                        TextWrapping="Wrap" />
                                </StackPanel>
                            </Grid>
                        </Border>
                        <Border HorizontalAlignment="Left" VerticalAlignment="Top"
                                IsVisible="{Binding IsOpened}"
                                Background="LimeGreen"
                                Width="10"
                                Height="10"
                                Margin="5"
                                CornerRadius="5" />
                    </Grid>
                </DataTemplate>
            </ListBox.ItemTemplate>
        </ListBox>
        <StackPanel Grid.Row="1" Orientation="Horizontal" Margin="10,0" Spacing="10" HorizontalAlignment="Center">
            <Button Content="{Locale:Locale UserProfilesAddNewProfile}" Command="{Binding AddUser}" />
            <Button IsEnabled="{Binding  IsSelectedProfiledEditable}"
                    Content="{Locale:Locale UserProfilesEditProfile}" Command="{Binding EditUser}" />
            <Button IsEnabled="{Binding IsSelectedProfileDeletable}"
                    Content="{Locale:Locale UserProfilesDeleteSelectedProfile}" Command="{Binding DeleteUser}" />
        </StackPanel>
    </Grid>
</UserControl>