-
-
Notifications
You must be signed in to change notification settings - Fork 281
Expand file tree
/
Copy pathFirstViewModel.cs
More file actions
40 lines (31 loc) · 1.29 KB
/
FirstViewModel.cs
File metadata and controls
40 lines (31 loc) · 1.29 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
using MvvmCross.Commands;
using MvvmCross.Navigation;
using MvvmCross.Plugin.JsonLocalization;
namespace Babel.Core.ViewModels
{
public class FirstViewModel : BaseViewModel
{
private readonly IMvxTextProviderBuilder _builder;
private readonly IMvxNavigationService _navigationService;
private string _hello;
public FirstViewModel(IMvxTextProviderBuilder builder, IMvxNavigationService navigationService)
{
_builder = builder;
_navigationService = navigationService;
}
public IMvxCommand LolCatCommand => new MvxCommand(() => PickLanguage("LolCat"));
public IMvxCommand ProperEnglishCommand => new MvxCommand(() => PickLanguage("ProperEnglish"));
public IMvxCommand DefaultCommand => new MvxCommand(() => PickLanguage(string.Empty));
private void PickLanguage(string which)
{
_builder.LoadResources(which);
}
public IMvxCommand GoCommand => new MvxCommand(() => _navigationService.Navigate<SecondViewModel>());
public IMvxCommand ForceTextRefreshCommand => new MvxCommand(() => RaisePropertyChanged(() => TextSource));
public string Hello
{
get => _hello;
set => SetProperty(ref _hello, value);
}
}
}