diff --git a/Presence.Desktop/ViewModels/GroupViewModel.cs b/Presence.Desktop/ViewModels/GroupViewModel.cs index 5c7c18a..616e543 100644 --- a/Presence.Desktop/ViewModels/GroupViewModel.cs +++ b/Presence.Desktop/ViewModels/GroupViewModel.cs @@ -10,6 +10,7 @@ using System.Linq; using System.Reactive.Linq; using System.Threading.Tasks; using System.Windows.Input; +using Avalonia.Controls.Selection; using Tmds.DBus.Protocol; namespace Presence.Desktop.ViewModels @@ -34,9 +35,10 @@ namespace Presence.Desktop.ViewModels get => _selectedGroupItem; set => this.RaiseAndSetIfChanged(ref _selectedGroupItem, value); } + private bool _MultipleSelected = false; + public bool MultipleSelected { get => _MultipleSelected; set => this.RaiseAndSetIfChanged(ref _MultipleSelected, value); } + public SelectionModel Selection { get; } private GroupPresenter? _selectedGroupItem; - - private IGroupUseCase _groupUseCase; public ObservableCollection Users { get => _users;} public ObservableCollection _users; @@ -52,6 +54,9 @@ namespace Presence.Desktop.ViewModels { RefreshGroups(); SetUsers(); }); + Selection = new SelectionModel(); + Selection.SingleSelect = false; + Selection.SelectionChanged += SelectionChanged; } private void SetUsers() @@ -93,6 +98,11 @@ namespace Presence.Desktop.ViewModels Console.WriteLine("clock"); SelectedFile = await _SelectFileInteraction.Handle("Chose csv file"); } + void SelectionChanged(object sender, SelectionModelSelectionChangedEventArgs e) + { + MultipleSelected = Selection.SelectedItems.Count > 1; + } + public string? UrlPathSegment { get; } public IScreen HostScreen { get; } } diff --git a/Presence.Desktop/Views/GroupView.axaml b/Presence.Desktop/Views/GroupView.axaml index 45c6661..042108a 100644 --- a/Presence.Desktop/Views/GroupView.axaml +++ b/Presence.Desktop/Views/GroupView.axaml @@ -31,7 +31,14 @@ - + + + + + + + +