public async Task <TOutput> Navigate <TViewModel, TInput, TOutput>(TInput payload, IView sourceView = null)
            where TViewModel : ViewModel <TInput, TOutput>
        {
            var viewModel = viewModelLocator.Load <TViewModel>();

            try
            {
                await viewModel.Initialize(payload).ConfigureAwait(false);
            }
            catch (Exception exception)
            {
                var name = viewModel?.GetType().Name ?? "";
                analyticsService.Track(exception, $"{name}.Initialize :: {exception.Message}");
                analyticsService.DebugNavigationError.Track("Initialize", name);
                throw;
            }

            try
            {
                await presenter.Present(viewModel, sourceView).ConfigureAwait(false);
            }
            catch (Exception exception)
            {
                var name = viewModel?.GetType().Name ?? "";
                analyticsService.Track(exception, $"{name}.Present :: {exception.Message}");
                analyticsService.DebugNavigationError.Track("Present", name);
                throw;
            }

            analyticsService.CurrentPage.Track(typeof(TViewModel));

            return(await viewModel.Result);
        }
Beispiel #2
0
        public async Task <TOutput> Navigate <TViewModel, TInput, TOutput>(TInput payload, IView sourceView = null)
            where TViewModel : ViewModel <TInput, TOutput>
        {
            var viewModel = viewModelLocator.Load <TViewModel>();

            var initialize = viewModel.Initialize(payload);
            var present    = presenter.Present(viewModel, sourceView);
            await Task.WhenAll(initialize, present).ConfigureAwait(false);

            analyticsService.CurrentPage.Track(typeof(TViewModel));

            return(await viewModel.Result);
        }