2024-12-26 08:03:24 +00:00
|
|
|
using System.Linq;
|
2024-12-13 07:21:14 +00:00
|
|
|
using Avalonia;
|
|
|
|
using Avalonia.Controls;
|
|
|
|
using Avalonia.Markup.Xaml;
|
|
|
|
using Avalonia.ReactiveUI;
|
2024-12-26 08:03:24 +00:00
|
|
|
using Presence.Desktop.Models;
|
2024-12-13 07:21:14 +00:00
|
|
|
using Presence.Desktop.ViewModels;
|
|
|
|
using ReactiveUI;
|
|
|
|
|
|
|
|
namespace Presence.Desktop.Views;
|
|
|
|
|
|
|
|
public partial class PresenceView : ReactiveUserControl<PresenceViewModel>
|
|
|
|
{
|
|
|
|
public PresenceView()
|
|
|
|
{
|
|
|
|
this.WhenActivated(disposables => { });
|
|
|
|
AvaloniaXamlLoader.Load(this); }
|
2024-12-26 08:03:24 +00:00
|
|
|
|
|
|
|
private void OnDataGridSelectionChanged(object sender, SelectionChangedEventArgs e)
|
|
|
|
{
|
|
|
|
if (this.DataContext is PresenceViewModel viewModel)
|
|
|
|
{
|
|
|
|
// Обновляем выделенные элементы в ViewModel
|
|
|
|
viewModel.SelectedItems.Clear();
|
|
|
|
foreach (var item in e.AddedItems.OfType<PresencePresenter>())
|
|
|
|
{
|
|
|
|
viewModel.SelectedItems.Add(item);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2024-12-13 07:21:14 +00:00
|
|
|
}
|