UserSelector.axaml 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145
  1. <UserControl
  2. x:Class="Ryujinx.Ava.UI.Controls.UserSelector"
  3. xmlns="https://github.com/avaloniaui"
  4. xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
  5. xmlns:locale="clr-namespace:Ryujinx.Ava.Common.Locale"
  6. xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
  7. xmlns:flex="clr-namespace:Avalonia.Flexbox;assembly=Avalonia.Flexbox"
  8. xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
  9. xmlns:viewModels="clr-namespace:Ryujinx.Ava.UI.ViewModels"
  10. xmlns:helpers="clr-namespace:Ryujinx.Ava.UI.Helpers"
  11. d:DesignHeight="450"
  12. MinWidth="500"
  13. d:DesignWidth="800"
  14. mc:Ignorable="d"
  15. Focusable="True">
  16. <UserControl.Resources>
  17. <helpers:BitmapArrayValueConverter x:Key="ByteImage" />
  18. </UserControl.Resources>
  19. <Design.DataContext>
  20. <viewModels:UserProfileViewModel />
  21. </Design.DataContext>
  22. <Grid HorizontalAlignment="Stretch" VerticalAlignment="Stretch">
  23. <Grid.RowDefinitions>
  24. <RowDefinition />
  25. <RowDefinition Height="Auto" />
  26. </Grid.RowDefinitions>
  27. <ListBox
  28. Margin="5"
  29. MaxHeight="300"
  30. HorizontalAlignment="Stretch"
  31. VerticalAlignment="Center"
  32. DoubleTapped="ProfilesList_DoubleTapped"
  33. Items="{Binding Profiles}"
  34. SelectionChanged="SelectingItemsControl_SelectionChanged">
  35. <ListBox.ItemsPanel>
  36. <ItemsPanelTemplate>
  37. <flex:FlexPanel
  38. HorizontalAlignment="Stretch"
  39. VerticalAlignment="Stretch"
  40. AlignContent="FlexStart"
  41. JustifyContent="Center" />
  42. </ItemsPanelTemplate>
  43. </ListBox.ItemsPanel>
  44. <ListBox.ItemTemplate>
  45. <DataTemplate>
  46. <Grid>
  47. <Border
  48. Margin="2"
  49. HorizontalAlignment="Stretch"
  50. VerticalAlignment="Stretch"
  51. ClipToBounds="True"
  52. CornerRadius="5">
  53. <Grid Margin="0">
  54. <Grid.RowDefinitions>
  55. <RowDefinition Height="Auto" />
  56. <RowDefinition Height="Auto" />
  57. </Grid.RowDefinitions>
  58. <Image
  59. Grid.Row="0"
  60. Width="96"
  61. Height="96"
  62. Margin="0"
  63. HorizontalAlignment="Stretch"
  64. VerticalAlignment="Top"
  65. Source="{Binding Image, Converter={StaticResource ByteImage}}" />
  66. <StackPanel
  67. Grid.Row="1"
  68. Height="30"
  69. Margin="5"
  70. HorizontalAlignment="Stretch"
  71. VerticalAlignment="Stretch">
  72. <TextBlock
  73. HorizontalAlignment="Stretch"
  74. Text="{Binding Name}"
  75. TextAlignment="Center"
  76. TextWrapping="Wrap" />
  77. </StackPanel>
  78. </Grid>
  79. </Border>
  80. <Border
  81. Width="10"
  82. Height="10"
  83. Margin="5"
  84. HorizontalAlignment="Left"
  85. VerticalAlignment="Top"
  86. Background="LimeGreen"
  87. CornerRadius="5"
  88. IsVisible="{Binding IsOpened}" />
  89. </Grid>
  90. </DataTemplate>
  91. </ListBox.ItemTemplate>
  92. </ListBox>
  93. <Grid
  94. Grid.Row="1"
  95. HorizontalAlignment="Center">
  96. <Grid.RowDefinitions>
  97. <RowDefinition Height="Auto"/>
  98. <RowDefinition Height="Auto"/>
  99. <RowDefinition Height="Auto"/>
  100. </Grid.RowDefinitions>
  101. <Grid.ColumnDefinitions>
  102. <ColumnDefinition Width="Auto"/>
  103. <ColumnDefinition Width="Auto"/>
  104. </Grid.ColumnDefinitions>
  105. <Button
  106. HorizontalAlignment="Stretch"
  107. Grid.Row="0"
  108. Grid.Column="0"
  109. Margin="2"
  110. Command="{Binding AddUser}"
  111. Content="{locale:Locale UserProfilesAddNewProfile}" />
  112. <Button
  113. HorizontalAlignment="Stretch"
  114. Grid.Row="0"
  115. Margin="2"
  116. Grid.Column="1"
  117. Command="{Binding EditUser}"
  118. Content="{locale:Locale UserProfilesEditProfile}"
  119. IsEnabled="{Binding IsSelectedProfiledEditable}" />
  120. <Button
  121. HorizontalAlignment="Stretch"
  122. Grid.Row="1"
  123. Grid.Column="0"
  124. Margin="2"
  125. Content="{locale:Locale UserProfilesManageSaves}"
  126. Command="{Binding ManageSaves}" />
  127. <Button
  128. HorizontalAlignment="Stretch"
  129. Grid.Row="1"
  130. Grid.Column="1"
  131. Margin="2"
  132. Command="{Binding DeleteUser}"
  133. Content="{locale:Locale UserProfilesDeleteSelectedProfile}"
  134. IsEnabled="{Binding IsSelectedProfileDeletable}" />
  135. <Button
  136. HorizontalAlignment="Stretch"
  137. Grid.Row="2"
  138. Grid.ColumnSpan="2"
  139. Grid.Column="0"
  140. Margin="2"
  141. Command="{Binding RecoverLostAccounts}"
  142. Content="{locale:Locale UserProfilesRecoverLostAccounts}" />
  143. </Grid>
  144. </Grid>
  145. </UserControl>