Files
LanMountainDesktop/LanMountainDesktop/ViewModels/MainWindowViewModel.cs

33 lines
961 B
C#
Raw Normal View History

2026-04-08 00:55:10 +08:00
using CommunityToolkit.Mvvm.Input;
using System.Diagnostics;
using System.IO;
namespace LanMountainDesktop.ViewModels;
2026-02-26 23:08:19 +08:00
public partial class MainWindowViewModel : ViewModelBase
{
2026-02-27 13:43:27 +08:00
public string Greeting { get; } = "A modern desktop shell powered by FluentAvalonia.";
2026-04-08 00:55:10 +08:00
[RelayCommand]
private void OpenDesignSpec(string? fileName)
{
if (string.IsNullOrWhiteSpace(fileName)) return;
var fullPath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "docs", fileName);
if (!File.Exists(fullPath))
{
// Try relative to project root in dev
fullPath = Path.GetFullPath(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "..", "..", "..", "..", "docs", fileName));
}
if (File.Exists(fullPath))
{
Process.Start(new ProcessStartInfo
{
FileName = fullPath,
UseShellExecute = true
});
}
}
2026-02-26 23:08:19 +08:00
}