mirror of
https://github.com/BlossomiShymae/Needlework.Net.git
synced 2025-12-06 18:20:47 +01:00
39 lines
1.2 KiB
C#
39 lines
1.2 KiB
C#
using CommunityToolkit.Mvvm.ComponentModel;
|
|
using CommunityToolkit.Mvvm.Input;
|
|
using Needlework.Net.Models;
|
|
using Needlework.Net.Services;
|
|
using System;
|
|
|
|
namespace Needlework.Net.ViewModels.Pages.Endpoints
|
|
{
|
|
public partial class EndpointSearchDetailsViewModel : ObservableObject
|
|
{
|
|
private readonly Document _document;
|
|
|
|
private readonly Tab _tab;
|
|
|
|
private readonly Action<ObservableObject> _onClicked;
|
|
|
|
private readonly NotificationService _notificationService;
|
|
|
|
public EndpointSearchDetailsViewModel(Services.NotificationService notificationService, Document document, Tab tab, Action<ObservableObject> onClicked, string? plugin)
|
|
{
|
|
_document = document;
|
|
_tab = tab;
|
|
_onClicked = onClicked;
|
|
_plugin = plugin;
|
|
_notificationService = notificationService;
|
|
}
|
|
|
|
[ObservableProperty]
|
|
private string? _plugin;
|
|
|
|
[RelayCommand]
|
|
private void OpenEndpoint()
|
|
{
|
|
if (string.IsNullOrEmpty(Plugin)) return;
|
|
_onClicked.Invoke(new PluginViewModel(_notificationService, Plugin, _document, _tab));
|
|
}
|
|
}
|
|
}
|