Flow.Launcher/Flow.Launcher.Avalonia/ViewModel/ResultViewModel.cs
Hongtao Zhang e961dc5668 Wire up Avalonia UI to actual plugin system
- Load settings from disk via FlowLauncherJsonStorage
- Initialize PluginManager and query plugins on text change
- Add minimal AvaloniaPublicAPI implementing IPublicAPI
- Execute plugin results on Enter key
- Add WPF framework reference for IPublicAPI compatibility
2026-01-14 23:20:19 -08:00

41 lines
1.1 KiB
C#

using CommunityToolkit.Mvvm.ComponentModel;
using Flow.Launcher.Infrastructure.UserSettings;
using Flow.Launcher.Plugin;
namespace Flow.Launcher.Avalonia.ViewModel;
/// <summary>
/// ViewModel for a single result item.
/// </summary>
public partial class ResultViewModel : ObservableObject
{
[ObservableProperty]
private string _title = string.Empty;
[ObservableProperty]
private string _subTitle = string.Empty;
[ObservableProperty]
private string _iconPath = string.Empty;
[ObservableProperty]
private bool _isSelected;
[ObservableProperty]
private Settings? _settings;
/// <summary>
/// The underlying plugin result. Used for executing actions and accessing additional properties.
/// </summary>
public Result? PluginResult { get; set; }
// Computed properties for display
public bool ShowIcon => !string.IsNullOrEmpty(IconPath);
public bool ShowSubTitle => !string.IsNullOrEmpty(SubTitle);
/// <summary>
/// Gets the query suggestion text for autocomplete, if available.
/// </summary>
public string? QuerySuggestionText => PluginResult?.AutoCompleteText;
}