void Page_Loaded(object sender, RoutedEventArgs e) { Storyboard fadeInStoryBoard = (Storyboard)FindName("FadeInStoryBoard"); fadeInStoryBoard.Begin(); _notificationPresenter = new NotificationPresenter(NotificationControl); _notificationPresenter.ShowNotification("Loaded Okay!"); _loadingPresenter = new LoadingPresenter(LoadingControl); _optionsPresenter = new OptionsPresenter(OptionsControl); _optionsPresenter.ClearBookWeb += new EventHandler(_optionsPresenter_ClearBookWeb); _optionsPresenter.Help += new EventHandler(_optionsPresenter_Help); _optionsPresenter.TextBookSearch += new EventHandler(_optionsPresenter_TextBookSearch); _bookDetailPresenter = new BookDetailPresenter(DetailControl); _bookDetailPresenter.Hidden += new Tarantula.MVP.Events.BookEventHandler(_bookDetailPresenter_Hidden); _helpPresenter = new HelpPresenter(new HelpControl()); _textSearchPresenter = new TextSearchPresenter(new TextSearchControl()); _textSearchPresenter.StartSearch += new Tarantula.MVP.Events.TextSearchEventHandler(_textSearchPresenter_StartSearch); _bookWebPresenter= new BookWebPresenter(bookWebControl); _bookWebPresenter.OnLoadingBooks += new EventHandler(_bookWebPresenter_OnLoadingBooks); _bookWebPresenter.OnFinishedLoadingBooks += new EventHandler(_bookWebPresenter_OnFinishedLoadingBooks); _bookWebPresenter.OnLoadingBooksError += new Tarantula.MVP.Events.BookWebNotificationHandler(_bookWebPresenter_OnLoadingBooksError); _bookWebPresenter.ShowBookDetails += new Tarantula.MVP.Events.BookEventHandler(_bookWebPresenter_ShowBookDetails); _bookWebPresenter.SearchResultsSummary += new Tarantula.MVP.Events.BookWebNotificationHandler(_bookWebPresenter_SearchResultsSummary); }
protected override async void ApplyEdit() { LoadingPresenter.StartLoading(); await DataRepository.UpdateOrder(_Id, ClientUsernames[ClientUsernameIndex], OrderDate, GetProductIdQuantityMap(), GetPrice(), Delivered?DeliveryDate : (DateTime?)null); LoadingPresenter.StopLoading(); }
protected override async void ApplyCreate() { LoadingPresenter.StartLoading(); await DataRepository.CreateClient(Username, FirstName, LastName, Street, uint.Parse(StreetNumber), PhoneNumber); LoadingPresenter.StopLoading(); }
protected override async void ApplyEdit() { LoadingPresenter.StartLoading(); await DataRepository.UpdateProduct(_Id, Name, double.Parse(Price), ProductTypes[ProductTypeIndex]); LoadingPresenter.StopLoading(); }
public void WhenCallToDispose_UnsubscribeFromEventDispatch() { var loadingViewModel = Substitute.For <LoadingViewModel>(); var eventDispatcherService = Substitute.For <IEventDispatcherService>(); var loadingPresenter = new LoadingPresenter(loadingViewModel, eventDispatcherService); eventDispatcherService.ClearReceivedCalls(); loadingPresenter.Dispose(); eventDispatcherService.Received(1).Unsubscribe <UpdateLoadingScreenSignal>(Arg.Any <SignalDelegate>()); Assert.AreEqual(1, eventDispatcherService.ReceivedCalls().Count()); }
public void WhenDispatchUpdateLoadingScreenSignal_UpdateTheViewModel() { var loadingViewModel = Substitute.For <LoadingViewModel>(); var eventDispatcherService = Substitute.For <IEventDispatcherService>(); SignalDelegate callback = null; eventDispatcherService .When(service => service.Subscribe <UpdateLoadingScreenSignal>(Arg.Any <SignalDelegate>())) .Do(info => callback = info.Arg <SignalDelegate>()); var loadingPresenter = new LoadingPresenter(loadingViewModel, eventDispatcherService); var observer = Substitute.For <IObserver <bool> >(); loadingViewModel.IsVisible.Subscribe(observer); callback(new UpdateLoadingScreenSignal(true)); observer.Received().OnNext(false); }
private void Start() { var mainMenuViewModel = new MainMenuViewModel(); var inGameViewModel = new InGameViewModel(); var loadingViewModel = new LoadingViewModel(); InstantiateViews(mainMenuViewModel, inGameViewModel, loadingViewModel); // TODO: these services should be unique, instantiate it in a previous step var gameRepository = new GameRepository(); var gameServerService = new GameServerService ( new RestRestClientAdapter(new JsonUtilityAdapter()), gameRepository ); var eventDispatcherService = new EventDispatcherService(); var startGameUseCase = new StartGameUseCase(gameServerService, gameRepository, new ConfigurationGameRepository(), eventDispatcherService); var startGameController = new StartGameController(mainMenuViewModel, startGameUseCase ); var keyboardController = new KeyboardController(inGameViewModel, new GuessLetterUseCase( new CheckSolutionUseCase( gameServerService, gameRepository, eventDispatcherService ), gameRepository, gameServerService, eventDispatcherService ) ); var restartGameController = new RestartGameController(inGameViewModel, new RestartGameUseCase(startGameUseCase, eventDispatcherService)); var updateWordPresenter = new InGamePresenter(inGameViewModel, eventDispatcherService); var mainMenuPresenter = new MainMenuPresenter(mainMenuViewModel, eventDispatcherService); var loadingPresenter = new LoadingPresenter(loadingViewModel, eventDispatcherService); }