Пример #1
0
        protected virtual IAsyncOperation ShowInternalAsync(IDataContext context)
        {
            var presenters = _dynamicPresenters.ToArrayEx();

            for (int i = 0; i < presenters.Length; i++)
            {
                var operation = presenters[i].TryShowAsync(context, this);
                if (operation != null)
                {
                    Trace("show", context, presenters[i]);
                    return(operation);
                }
            }
            return(null);
        }
Пример #2
0
        public virtual INavigationOperation ShowAsync(IViewModel viewModel, IDataContext context)
        {
            Should.NotBeNull(viewModel, nameof(viewModel));
            if (context == null)
            {
                context = DataContext.Empty;
            }
            var presenters = _dynamicPresenters.ToArrayEx();

            for (int i = 0; i < presenters.Length; i++)
            {
                var operation = presenters[i].TryShowAsync(viewModel, context, this);
                if (operation != null)
                {
                    if (Tracer.TraceInformation)
                    {
                        Tracer.Info("The {0} is shown by {1}", viewModel.GetType().FullName, presenters[i].GetType().FullName);
                    }
                    return(operation);
                }
            }
            throw ExceptionManager.PresenterCannotShowViewModel(GetType(), viewModel.GetType());
        }