combobox sorter
This commit is contained in:
parent
cd14199d8f
commit
5a3b35edb8
@ -19,6 +19,13 @@ namespace Presence.Desktop.ViewModels
|
|||||||
private ObservableCollection<GroupPresenter> _groups;
|
private ObservableCollection<GroupPresenter> _groups;
|
||||||
public ObservableCollection<GroupPresenter> Groups => _groups;
|
public ObservableCollection<GroupPresenter> Groups => _groups;
|
||||||
private GroupPresenter? _selectedGroupItem;
|
private GroupPresenter? _selectedGroupItem;
|
||||||
|
public ObservableCollection<UserPresenter> Users { get => _users;}
|
||||||
|
public ObservableCollection<UserPresenter> _users;
|
||||||
|
|
||||||
|
|
||||||
|
private ObservableCollection<string> _secondComboBoxItems = new ObservableCollection<string> { "no sort", "name sort", "name sort rev" };
|
||||||
|
public ObservableCollection<string> SecondComboBoxItems => _secondComboBoxItems;
|
||||||
|
private string? _selectedSecondItem;
|
||||||
|
|
||||||
public ReactiveCommand<Unit, Unit> ButtonRemoveUsersByGroup {get; }
|
public ReactiveCommand<Unit, Unit> ButtonRemoveUsersByGroup {get; }
|
||||||
// public ReactiveCommand<Unit, Unit> ButtonAddUser { get; }
|
// public ReactiveCommand<Unit, Unit> ButtonAddUser { get; }
|
||||||
@ -30,8 +37,11 @@ namespace Presence.Desktop.ViewModels
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public ObservableCollection<UserPresenter> Users { get => _users;}
|
public string? SelectedSecondItem
|
||||||
public ObservableCollection<UserPresenter> _users;
|
{
|
||||||
|
get => _selectedSecondItem;
|
||||||
|
set => this.RaiseAndSetIfChanged(ref _selectedSecondItem, value);
|
||||||
|
}
|
||||||
public GroupViewModel(IGroupUseCase groupUseCase, IUserUseCase userUseCase)
|
public GroupViewModel(IGroupUseCase groupUseCase, IUserUseCase userUseCase)
|
||||||
{
|
{
|
||||||
foreach (var item in groupUseCase.GetAllGroupsWithUsers())
|
foreach (var item in groupUseCase.GetAllGroupsWithUsers())
|
||||||
@ -58,6 +68,11 @@ namespace Presence.Desktop.ViewModels
|
|||||||
this.WhenAnyValue(vm => vm.SelectedGroupItem)
|
this.WhenAnyValue(vm => vm.SelectedGroupItem)
|
||||||
.Subscribe(_ => SetUsers());
|
.Subscribe(_ => SetUsers());
|
||||||
|
|
||||||
|
this.WhenAnyValue(vm => vm.SelectedSecondItem)
|
||||||
|
.Subscribe(_ => SetUsers());
|
||||||
|
|
||||||
|
SelectedSecondItem = _secondComboBoxItems.First();
|
||||||
|
|
||||||
ButtonRemoveUsersByGroup = ReactiveCommand.Create(() => RemoveUsersByGroup(groupUseCase));
|
ButtonRemoveUsersByGroup = ReactiveCommand.Create(() => RemoveUsersByGroup(groupUseCase));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -65,8 +80,15 @@ namespace Presence.Desktop.ViewModels
|
|||||||
{
|
{
|
||||||
if(SelectedGroupItem == null) return;
|
if(SelectedGroupItem == null) return;
|
||||||
if (SelectedGroupItem.users == null) return;
|
if (SelectedGroupItem.users == null) return;
|
||||||
|
var sortedUsers = SelectedSecondItem switch
|
||||||
|
{
|
||||||
|
"name sort" => SelectedGroupItem.users.OrderBy(user => user.Name),
|
||||||
|
"name sort rev" => SelectedGroupItem.users.OrderByDescending(user => user.Name),
|
||||||
|
_ => SelectedGroupItem.users
|
||||||
|
};
|
||||||
|
|
||||||
Users.Clear();
|
Users.Clear();
|
||||||
foreach (var item in SelectedGroupItem.users)
|
foreach (var item in sortedUsers)
|
||||||
{
|
{
|
||||||
Users.Add(item);
|
Users.Add(item);
|
||||||
}
|
}
|
||||||
|
@ -12,14 +12,11 @@
|
|||||||
</Design.DataContext>
|
</Design.DataContext>
|
||||||
|
|
||||||
<DockPanel Background="Azure">
|
<DockPanel Background="Azure">
|
||||||
<!-- Панель с кнопками справа, окрашена в серый -->
|
|
||||||
<StackPanel Width="200" DockPanel.Dock="Right" HorizontalAlignment="Center" Background="Gray">
|
<StackPanel Width="200" DockPanel.Dock="Right" HorizontalAlignment="Center" Background="Gray">
|
||||||
<!-- Две кнопки сверху -->
|
|
||||||
<Button Content="remove" HorizontalAlignment="Center" Margin="10" Command="{Binding ButtonRemoveUsersByGroup}"/>
|
<Button Content="remove" HorizontalAlignment="Center" Margin="10" Command="{Binding ButtonRemoveUsersByGroup}"/>
|
||||||
<Button Content="create" HorizontalAlignment="Center" Margin="10"/>
|
<Button Content="create" HorizontalAlignment="Center" Margin="10"/>
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
|
|
||||||
<!-- Содержание на остальной части экрана -->
|
|
||||||
<StackPanel DockPanel.Dock="Bottom">
|
<StackPanel DockPanel.Dock="Bottom">
|
||||||
<TextBlock Text="List ↑" HorizontalAlignment="Center"/>
|
<TextBlock Text="List ↑" HorizontalAlignment="Center"/>
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
@ -37,7 +34,13 @@
|
|||||||
</DataTemplate>
|
</DataTemplate>
|
||||||
</ComboBox.ItemTemplate>
|
</ComboBox.ItemTemplate>
|
||||||
</ComboBox>
|
</ComboBox>
|
||||||
<ComboBox/>
|
<ComboBox ItemsSource="{Binding SecondComboBoxItems}" SelectedValue="{Binding SelectedSecondItem}">
|
||||||
|
<ComboBox.ItemTemplate>
|
||||||
|
<DataTemplate>
|
||||||
|
<TextBlock Text="{Binding}"/>
|
||||||
|
</DataTemplate>
|
||||||
|
</ComboBox.ItemTemplate>
|
||||||
|
</ComboBox>
|
||||||
<ComboBox/>
|
<ComboBox/>
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
|
|
||||||
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -13,7 +13,7 @@ using System.Reflection;
|
|||||||
[assembly: System.Reflection.AssemblyCompanyAttribute("Presence.Desktop")]
|
[assembly: System.Reflection.AssemblyCompanyAttribute("Presence.Desktop")]
|
||||||
[assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")]
|
[assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")]
|
||||||
[assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")]
|
[assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")]
|
||||||
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+9b3cfbc40067bba6974cdbc4861c00da71d37748")]
|
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+cd14199d8f8882eb539425bae3cd58b140c7b374")]
|
||||||
[assembly: System.Reflection.AssemblyProductAttribute("Presence.Desktop")]
|
[assembly: System.Reflection.AssemblyProductAttribute("Presence.Desktop")]
|
||||||
[assembly: System.Reflection.AssemblyTitleAttribute("Presence.Desktop")]
|
[assembly: System.Reflection.AssemblyTitleAttribute("Presence.Desktop")]
|
||||||
[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")]
|
[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")]
|
||||||
|
@ -1 +1 @@
|
|||||||
b49bc57aafd42cc70f1ceb2001b578d4ddca925ef01fbdabf8868df998e5f23a
|
1601b8a97c679a8fd3f637d2ddc30637f34b37df92211063253b3ecf6124d488
|
||||||
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -13,7 +13,7 @@ using System.Reflection;
|
|||||||
[assembly: System.Reflection.AssemblyCompanyAttribute("console_ui")]
|
[assembly: System.Reflection.AssemblyCompanyAttribute("console_ui")]
|
||||||
[assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")]
|
[assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")]
|
||||||
[assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")]
|
[assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")]
|
||||||
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+9b3cfbc40067bba6974cdbc4861c00da71d37748")]
|
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+cd14199d8f8882eb539425bae3cd58b140c7b374")]
|
||||||
[assembly: System.Reflection.AssemblyProductAttribute("console_ui")]
|
[assembly: System.Reflection.AssemblyProductAttribute("console_ui")]
|
||||||
[assembly: System.Reflection.AssemblyTitleAttribute("console_ui")]
|
[assembly: System.Reflection.AssemblyTitleAttribute("console_ui")]
|
||||||
[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")]
|
[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")]
|
||||||
|
@ -1 +1 @@
|
|||||||
770ea89dce6ce080c15fdf94274a49847e7c529222e0904469672fc8bb9c4e68
|
51219e92f7d27c4d00e5b1e874dab7a450a0879becdee4165bf84b610fab9305
|
||||||
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -13,7 +13,7 @@ using System.Reflection;
|
|||||||
[assembly: System.Reflection.AssemblyCompanyAttribute("data")]
|
[assembly: System.Reflection.AssemblyCompanyAttribute("data")]
|
||||||
[assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")]
|
[assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")]
|
||||||
[assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")]
|
[assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")]
|
||||||
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+9b3cfbc40067bba6974cdbc4861c00da71d37748")]
|
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+cd14199d8f8882eb539425bae3cd58b140c7b374")]
|
||||||
[assembly: System.Reflection.AssemblyProductAttribute("data")]
|
[assembly: System.Reflection.AssemblyProductAttribute("data")]
|
||||||
[assembly: System.Reflection.AssemblyTitleAttribute("data")]
|
[assembly: System.Reflection.AssemblyTitleAttribute("data")]
|
||||||
[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")]
|
[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")]
|
||||||
|
@ -1 +1 @@
|
|||||||
1558d09e481ca9418b121ad5863b65830da7ea514f1808ff381fe4ad5db6f7e7
|
cbcf9f65ddea20ee5dba4f0994bf30c3c28bcbacd4b18ea08dddbae4d7329598
|
||||||
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -13,7 +13,7 @@ using System.Reflection;
|
|||||||
[assembly: System.Reflection.AssemblyCompanyAttribute("domain")]
|
[assembly: System.Reflection.AssemblyCompanyAttribute("domain")]
|
||||||
[assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")]
|
[assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")]
|
||||||
[assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")]
|
[assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")]
|
||||||
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+9b3cfbc40067bba6974cdbc4861c00da71d37748")]
|
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+cd14199d8f8882eb539425bae3cd58b140c7b374")]
|
||||||
[assembly: System.Reflection.AssemblyProductAttribute("domain")]
|
[assembly: System.Reflection.AssemblyProductAttribute("domain")]
|
||||||
[assembly: System.Reflection.AssemblyTitleAttribute("domain")]
|
[assembly: System.Reflection.AssemblyTitleAttribute("domain")]
|
||||||
[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")]
|
[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")]
|
||||||
|
@ -1 +1 @@
|
|||||||
0ffcb0fca7a9d06b20b47de202623d255ccae331784de912c2e9a40a27013411
|
6639613f2b7545edc3a375874517b2293f0381addf587f17148b84d4d9f20b3e
|
||||||
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -13,7 +13,7 @@ using System.Reflection;
|
|||||||
[assembly: System.Reflection.AssemblyCompanyAttribute("presence_api")]
|
[assembly: System.Reflection.AssemblyCompanyAttribute("presence_api")]
|
||||||
[assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")]
|
[assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")]
|
||||||
[assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")]
|
[assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")]
|
||||||
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+9b3cfbc40067bba6974cdbc4861c00da71d37748")]
|
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+cd14199d8f8882eb539425bae3cd58b140c7b374")]
|
||||||
[assembly: System.Reflection.AssemblyProductAttribute("presence_api")]
|
[assembly: System.Reflection.AssemblyProductAttribute("presence_api")]
|
||||||
[assembly: System.Reflection.AssemblyTitleAttribute("presence_api")]
|
[assembly: System.Reflection.AssemblyTitleAttribute("presence_api")]
|
||||||
[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")]
|
[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")]
|
||||||
|
@ -1 +1 @@
|
|||||||
c01432216cb4203fe13c4e29d65b112ff88f4e1a3345350f9d8ec2afbe35e070
|
cdb6b5133bde93b1586d7932ccbb76ae9ea6878c6857ff99e7fdf6b01f268cf2
|
||||||
|
Binary file not shown.
@ -13,7 +13,7 @@ using System.Reflection;
|
|||||||
[assembly: System.Reflection.AssemblyCompanyAttribute("ui")]
|
[assembly: System.Reflection.AssemblyCompanyAttribute("ui")]
|
||||||
[assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")]
|
[assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")]
|
||||||
[assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")]
|
[assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")]
|
||||||
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+9b3cfbc40067bba6974cdbc4861c00da71d37748")]
|
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+cd14199d8f8882eb539425bae3cd58b140c7b374")]
|
||||||
[assembly: System.Reflection.AssemblyProductAttribute("ui")]
|
[assembly: System.Reflection.AssemblyProductAttribute("ui")]
|
||||||
[assembly: System.Reflection.AssemblyTitleAttribute("ui")]
|
[assembly: System.Reflection.AssemblyTitleAttribute("ui")]
|
||||||
[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")]
|
[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")]
|
||||||
|
@ -1 +1 @@
|
|||||||
1c75734ac91201aa26d7fb2f98e0657676471ec12934feb45d23ee2e32b7b5ab
|
fef66748500a16e29f0a17a78c8a1c71cb47b72d1a0688ea26826661405a52af
|
||||||
|
Binary file not shown.
Loading…
Reference in New Issue
Block a user