public HubPageViewModel(IAlertMessageService alertMessageService, INavigationService navService, ROClient roClient) { _alertMessageService = alertMessageService; _navService = navService; _roClient = roClient; //NavigateToUserInputCommand = new DelegateCommand(() => navService.Navigate("UserInput", null)); GoBackCommand = new DelegateCommand(navService.GoBack, navService.CanGoBack); ProductNavigationAction = NavigateToServiceAction; // Not sure why this isn't required in AW equivalent... OnNavigatedTo(null, NavigationMode.New, null); }
/// <summary> /// This is the place you initialize your services and set default factory or default resolver for the view model locator /// </summary> /// <param name="args">The same launch arguments passed when the app starts.</param> // <snippet3302> protected override void OnInitialize(IActivatedEventArgs args) { RoClient = new ROClientOnWinRT("http://localhost:9292") { Credentials = new NetworkCredential("sven", "pass") }; // Register MvvmAppBase services with the container so that view models can take dependencies on them _container.RegisterInstance<ISessionStateService>(SessionStateService); _container.RegisterInstance<INavigationService>(NavigationService); _container.RegisterType<IAlertMessageService, AlertMessageService>(new ContainerControlledLifetimeManager()); // Register any app specific types with the container _container.RegisterInstance<ROClient>(this.RoClient); // Set a factory for the ViewModelLocator to use the container to construct view models so their // dependencies get injected by the container ViewModelLocator.SetDefaultViewModelFactory((viewModelType) => _container.Resolve(viewModelType)); }
public FPSCounter(ROClient roc) : base(roc) { _client = roc; }
public void SetUp() { homePageRepr = JsonRepr.FromResource<HomePageRepr>(Properties.Resources.HomePage); servicesRepr = JsonRepr.FromResource<ListRepr>(Properties.Resources.Services); userRepr = JsonRepr.FromResource<UserRepr>(Properties.Resources.User); versionRepr = JsonRepr.FromResource<VersionRepr>(Properties.Resources.Version); _client = Substitute.For<ROClient>(); _client.HomePage().Returns(homePageRepr); _client.Services().Returns(servicesRepr); _client.User().Returns(userRepr); _client.Version().Returns(versionRepr); }