semesterWork/Presence.Desktop/Views/GroupView.axaml.cs

56 lines
1.5 KiB
C#
Raw Normal View History

2024-12-13 05:47:52 +00:00
using System;
2024-12-08 15:27:37 +00:00
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
2024-12-08 15:00:30 +00:00
using Avalonia.Controls;
2024-12-13 05:47:52 +00:00
using Avalonia.Interactivity;
2024-12-08 15:00:30 +00:00
using Avalonia.Markup.Xaml;
2024-12-08 15:27:37 +00:00
using Avalonia.Platform.Storage;
2024-12-08 15:00:30 +00:00
using Avalonia.ReactiveUI;
2024-12-13 05:47:52 +00:00
using data;
using data.Repository;
using domain.Service;
using Microsoft.Extensions.DependencyInjection;
using Presence.Desktop.DI;
2024-12-08 15:00:30 +00:00
using Presence.Desktop.ViewModels;
using ReactiveUI;
2024-12-08 15:27:37 +00:00
namespace Presence.Desktop.Views
2024-12-08 15:00:30 +00:00
{
2024-12-12 18:16:01 +00:00
public partial class GroupView : Window
2024-12-08 15:00:30 +00:00
{
2024-12-08 15:27:37 +00:00
public GroupView()
{
2024-12-12 18:16:01 +00:00
InitializeComponent();
2024-12-08 15:27:37 +00:00
}
2024-12-12 18:16:01 +00:00
private void SelectingItemsControl_OnSelectionChanged(object? sender, SelectionChangedEventArgs e)
2024-12-08 15:27:37 +00:00
{
2024-12-12 18:16:01 +00:00
if (DataContext is GroupViewModel viewModel)
{
viewModel.UpdateSelectionStates();
}
2024-12-08 15:27:37 +00:00
}
2024-12-13 05:47:52 +00:00
private void SwapToPresences(object? sender, RoutedEventArgs e)
{
try
{
var serviceCollection = new ServiceCollection();
serviceCollection.AddPresenceService();
var services = serviceCollection.BuildServiceProvider();
var presenceViewModel = services.GetRequiredService<PresenceViewModel>();
var window = new PresenceView
{
DataContext = presenceViewModel
};
window.Show();
}
catch (Exception ex)
{
}
}
2024-12-08 15:00:30 +00:00
}
}