mirror of
https://github.com/claunia/marechai.git
synced 2025-12-16 19:14:25 +00:00
34 lines
864 B
C#
34 lines
864 B
C#
|
|
using System.Threading.Tasks;
|
||
|
|
using System.Windows.Input;
|
||
|
|
using Uno.Extensions.Navigation;
|
||
|
|
|
||
|
|
namespace Marechai.App.Presentation;
|
||
|
|
|
||
|
|
public partial class MainViewModel : ObservableObject
|
||
|
|
{
|
||
|
|
private INavigator _navigator;
|
||
|
|
|
||
|
|
[ObservableProperty] private string? name;
|
||
|
|
|
||
|
|
public MainViewModel(
|
||
|
|
IStringLocalizer localizer,
|
||
|
|
IOptions<AppConfig> appInfo,
|
||
|
|
INavigator navigator)
|
||
|
|
{
|
||
|
|
_navigator = navigator;
|
||
|
|
Title = "Main";
|
||
|
|
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!));
|
||
|
|
}
|
||
|
|
}
|