2025-11-14 01:50:56 +00:00
|
|
|
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 01:50:56 +00:00
|
|
|
|
2025-11-14 15:18:30 +00:00
|
|
|
[ObservableProperty]
|
|
|
|
|
private string? name;
|
|
|
|
|
[ObservableProperty]
|
|
|
|
|
private NewsViewModel? newsViewModel;
|
2025-11-14 01:50:56 +00:00
|
|
|
|
2025-11-14 15:18:30 +00:00
|
|
|
public MainViewModel(IStringLocalizer localizer, IOptions<AppConfig> appInfo, INavigator navigator,
|
|
|
|
|
NewsViewModel newsViewModel)
|
2025-11-14 01:50:56 +00:00
|
|
|
{
|
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);
|
2025-11-14 01:50:56 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
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
|
|
|
}
|