ExcelHelper/Views/ViewModels/MainViewModel.cs

33 lines
786 B
C#
Raw Normal View History

2024-10-14 08:41:15 +08:00
using System.Diagnostics;
using CommunityToolkit.Mvvm.ComponentModel;
using CommunityToolkit.Mvvm.Input;
using ExcelHelper.Views.Pages;
2024-10-29 16:57:50 +08:00
namespace ExcelHelper.Views.ViewModels;
public partial class MainViewModel : ObservableObject, IViewModel
2024-10-14 08:41:15 +08:00
{
2024-10-29 16:57:50 +08:00
/// <summary>
/// 异常信息
/// </summary>
[ObservableProperty]
private string _errorMessage;
2024-10-14 08:41:15 +08:00
2024-10-29 16:57:50 +08:00
[RelayCommand]
private void OnSideMenuSelect(string itemTag)
{
Trace.WriteLine($"OnSideMenuSelect -> {itemTag}");
var targetPage = itemTag switch
2024-10-14 08:41:15 +08:00
{
2024-10-29 16:57:50 +08:00
"ImportExcelPage" => typeof(ImportExcelPage),
_ => null
};
if (targetPage != null)
{
App.AppHost.Get<Services.NavigationService>().NavigateTo(targetPage);
2024-10-14 08:41:15 +08:00
}
}
2024-10-29 16:57:50 +08:00
2024-10-14 08:41:15 +08:00
}