/// <summary> /// Constructor /// </summary> /// <param name="navigationManager">NavigationManager (Injected)</param> /// <param name="apiConnector">ApiConnetcor (Injected)</param> public HomeViewModel(NavigationManager navigationManager, IApiConnector apiConnector) : base(navigationManager) { this.apiConnector = apiConnector; PracticeDeckCommand = new NavigationCommand(navigationManager) { IsEnabledFunction = (parameter) => (parameter as Deck).CardCount > 0, TargetUriFactory = (param) => $"/Decks/{(param as Deck).DeckId}/Practice", CommandText = Messages.Practice, ToolTip = Messages.PracticeCommandToolTip.FormatWith(EntityNameHelper.GetName <Deck>()) }; AddCardCommand = new NavigationCommand(navigationManager) { TargetUriFactory = (param) => $"/Decks/{(long)param}/Cards/New", CommandText = Messages.NewCard, ToolTip = Components.Messages.NewCommandToolTip.FormatWith(EntityNameHelper.GetName <Card>()) }; ShowStatisticsCommand = new NavigationCommand(navigationManager) { TargetUriFactory = (param) => $"/Decks/{(long)param}/Statistics", CommandText = Messages.PracticeStatistics, ToolTip = Messages.ShowStatisticsCommandToolTip.FormatWith(EntityNameHelper.GetName <Deck>()) }; NewDeckCommand = new NavigationCommand(navigationManager) { CommandText = Messages.NewDeck, TargetUri = "/Decks/New", ToolTip = Components.Messages.NewCommandToolTip.FormatWith(EntityNameHelper.GetName <Deck>()) }; NewTemplateCommand = new NavigationCommand(navigationManager) { CommandText = Messages.NewTemplate, TargetUri = "/Templates/New", ToolTip = Components.Messages.NewCommandToolTip.FormatWith(EntityNameHelper.GetName <CardTemplate>()) }; SearchDecksCommand = new NavigationCommand(navigationManager) { CommandText = Messages.SearchDecks, TargetUri = "/Decks", ToolTip = Messages.SearchCommandToolTip.FormatWith(EntityNameHelper.GetPluralName <Deck>()) }; SearchTemplatesCommand = new NavigationCommand(navigationManager) { CommandText = Messages.SearchTemplates, TargetUri = "/Templates", ToolTip = Messages.SearchCommandToolTip.FormatWith(EntityNameHelper.GetPluralName <CardTemplate>()) }; SearchCardsCommand = new NavigationCommand(navigationManager) { CommandText = Messages.SearchCards, TargetUri = "/Cards", ToolTip = Messages.SearchCommandToolTip.FormatWith(EntityNameHelper.GetPluralName <Card>()) }; }
public void GetPluralNameOfCardTemplateTest() { string name = EntityNameHelper.GetPluralName <CardTemplate>(); Assert.AreEqual("Templates", name); }
public void GetPluralNameOfUserTest() { string name = EntityNameHelper.GetPluralName <User>(); Assert.AreEqual("Users", name); }
public void GetPluralNameOfDeckTest() { string name = EntityNameHelper.GetPluralName <Deck>(); Assert.AreEqual("Decks", name); }