Neuron®
The Neuron® is the basis for the creation of open and secure federated networks for smart societies.
Loading...
Searching...
No Matches
MainViewModel.cs
1using System.Collections.ObjectModel;
2using CommunityToolkit.Mvvm.ComponentModel;
6
8{
12 public partial class MainViewModel : BaseViewModel
13 {
14 private readonly ObservableCollection<TabDefinition> tabs;
15
20 {
21 this.tabs = new ObservableCollection<TabDefinition>
22 {
23 this.CreateTab("home", "home.svg", ServiceRef.Localizer[nameof(AppResources.Home)]),
24 this.CreateTab("wallet", "wallet.svg", ServiceRef.Localizer[nameof(AppResources.Wallet)], isProminent: true),
25 this.CreateTab("apps", "apps.svg", ServiceRef.Localizer[nameof(AppResources.Apps)])
26 };
27
28 this.Tabs = new ReadOnlyObservableCollection<TabDefinition>(this.tabs);
29 this.SelectedTabIndex = 0;
30 }
31
35 public ReadOnlyObservableCollection<TabDefinition> Tabs { get; }
36
40 [ObservableProperty]
41 private int selectedTabIndex;
42
43 private TabDefinition CreateTab(string key, string icon, string title, bool isProminent = false)
44 {
45 return new TabDefinition
46 {
47 Key = key,
48 Icon = icon,
49 Title = title,
50 IsProminent = isProminent
51 };
52 }
53 }
54}
A strongly-typed resource class, for looking up localized strings, etc.
static string Apps
Looks up a localized string similar to Apps.
static string Home
Looks up a localized string similar to Home.
static string Wallet
Looks up a localized string similar to Wallet.
Base class that references services in the app.
Definition: ServiceRef.cs:43
static IReportingStringLocalizer Localizer
Localization service
Definition: ServiceRef.cs:370
Represents a data descriptor for a tab entry displayed by TabNavigationHost.
A base class for all view models, inheriting from the BindableObject. NOTE: using this class requir...
Provides the tab definitions and selection state for the main view-switcher surface.
ReadOnlyObservableCollection< TabDefinition > Tabs
Gets the collection of tabs displayed in the navigation host.
MainViewModel()
Initializes a new instance of the MainViewModel class.