public BootStrap(ServiceLocator serviceLocator) { var webClient = new DelegateWebClient(); var sessionHelper = new SessionHelper(webClient); var serviceSetup = new ServiceSetup() { BaseUrl = "http://localhost:3022", }; serviceLocator.Navigator = (Application.Current as App).RootFrame; #if NO_SERVICE serviceLocator.AccountService = new FakeAccountService(); #else serviceLocator.AccountService = new AccountService(webClient, serviceSetup, sessionHelper); #endif serviceLocator.AccountViewModel = new AccountViewModel(serviceLocator.AccountService, serviceLocator.Navigator); #if NO_SERVICE serviceLocator.GameService = new FakeGameService(); #else serviceLocator.GameService = new GameService(webClient, serviceSetup); #endif serviceLocator.MenuGameViewModel = new MenuGameViewModel(serviceLocator.GameService, serviceLocator.Navigator); serviceLocator.GameViewModel = new GameViewModel(serviceLocator.GameService); }
private void SetupPreRequest(DelegateWebClient webClient) { if (webClient.PrepareRequestHook == null) { webClient.PrepareRequestHook = reg => { }; } var decoratedPreRequestHook = webClient.PrepareRequestHook.DecorateWithWp7Headers(); decoratedPreRequestHook = decoratedPreRequestHook.DecorateWithWp7SessionHeaders(() => this.AuthToken); webClient.PrepareRequestHook = decoratedPreRequestHook; }
public SessionHelper(DelegateWebClient webClient) { SetupPreRequest(webClient); if (webClient.RequestSuccessHook == null) { webClient.RequestSuccessHook = resp => { }; } webClient.RequestSuccessHook = webClient.RequestSuccessHook.DecorateWithWp7SessionCatcher(authToken => { this.AuthToken = authToken; }); }
public AccountService(DelegateWebClient webClient, ServiceSetup serviceSetup, SessionHelper sessionHelper) { this.webClient = webClient; this.serviceSetup = serviceSetup; this.sessionHelper = sessionHelper; }