Files
marechai/Marechai.App/Presentation/MainViewModel.cs

35 lines
1.0 KiB
C#
Raw Normal View History

using System.Threading.Tasks;
using System.Windows.Input;
using Uno.Extensions.Navigation;
namespace Marechai.App.Presentation;
public partial class MainViewModel : ObservableObject
{
2025-11-14 15:18:30 +00:00
private readonly INavigator _navigator;
2025-11-14 15:18:30 +00:00
[ObservableProperty]
private string? name;
[ObservableProperty]
private NewsViewModel? newsViewModel;
2025-11-14 15:18:30 +00:00
public MainViewModel(IStringLocalizer localizer, IOptions<AppConfig> appInfo, INavigator navigator,
NewsViewModel newsViewModel)
{
2025-11-14 15:18:30 +00:00
_navigator = navigator;
NewsViewModel = newsViewModel;
Title = "Marechai";
Title += $" - {localizer["ApplicationName"]}";
Title += $" - {appInfo?.Value?.Environment}";
GoToSecond = new AsyncRelayCommand(GoToSecondView);
}
public string? Title { get; }
public ICommand GoToSecond { get; }
private async Task GoToSecondView()
{
await _navigator.NavigateViewModelAsync<SecondViewModel>(this, data: new Entity(Name!));
}
2025-11-14 15:18:30 +00:00
}