using System.Diagnostics; using CommunityToolkit.Mvvm.ComponentModel; using CommunityToolkit.Mvvm.Input; using ExcelHelper.Views.Pages; namespace ExcelHelper.Views.ViewModels; public partial class MainViewModel : ObservableObject, IViewModel { /// /// 异常信息 /// [ObservableProperty] private string _errorMessage; [RelayCommand] private void OnSideMenuSelect(string itemTag) { Trace.WriteLine($"OnSideMenuSelect -> {itemTag}"); var targetPage = itemTag switch { "ImportExcelPage" => typeof(ImportExcelPage), _ => null }; if (targetPage != null) { App.AppHost.Get().NavigateTo(targetPage); } } }