mirror of
https://github.com/BlossomiShymae/Needlework.Net.git
synced 2025-12-06 10:10:48 +01:00
27 lines
954 B
C#
27 lines
954 B
C#
using Avalonia.Collections;
|
|
using CommunityToolkit.Mvvm.ComponentModel;
|
|
using CommunityToolkit.Mvvm.Messaging;
|
|
using Needlework.Net.Desktop.Messages;
|
|
using SukiUI.Controls;
|
|
using System.Linq;
|
|
|
|
namespace Needlework.Net.Desktop.ViewModels
|
|
{
|
|
public partial class EndpointViewModel : ObservableObject, ISukiStackPageTitleProvider
|
|
{
|
|
public string Endpoint { get; }
|
|
public string Title => Endpoint;
|
|
|
|
[ObservableProperty] private IAvaloniaReadOnlyList<PathOperationViewModel> _pathOperations;
|
|
[ObservableProperty] private PathOperationViewModel? _selectedPathOperation;
|
|
|
|
public EndpointViewModel(string endpoint)
|
|
{
|
|
Endpoint = endpoint;
|
|
|
|
var handler = WeakReferenceMessenger.Default.Send<DataRequestMessage>().Response;
|
|
PathOperations = new AvaloniaList<PathOperationViewModel>(handler.Plugins[endpoint].Select(x => new PathOperationViewModel(x)));
|
|
}
|
|
}
|
|
}
|