UserSelector.axaml 6.2 KB

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