mirror of
https://github.com/claunia/marechai.git
synced 2025-12-16 19:14:25 +00:00
Add initial project structure and configuration files for Marechai.App
This commit is contained in:
33
Marechai.App/Presentation/MainViewModel.cs
Normal file
33
Marechai.App/Presentation/MainViewModel.cs
Normal file
@@ -0,0 +1,33 @@
|
||||
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!));
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user