Exemplo n.º 1
0
        public async static Task <ActiveView <TPresenter> > CreateActiveViewAsync <TPresenter>(this IViewFactory factory, IActivity activity, params object[] parameters)
            where TPresenter : IPresenter
        {
            var view = await factory.CreateActiveViewAsync(activity, typeof(TPresenter), parameters);

            return(new ActiveView <TPresenter>((TPresenter)view.Presenter, view.ViewModel, view.View, view.Activity));
        }
Exemplo n.º 2
0
        public async Task AddViewAsync <TActivityInfo>(ActiveView contentView, TActivityInfo activityInfo)
            where TActivityInfo : ViewActivityInfo
        {
            var activeView = await viewFactory.CreateActiveViewAsync <TabPresenter>(
                new TabActivityInfo(activityInfo.Title, activityInfo.IsCloseable),
                new TypeOverride <IRegionManager>(regionManager));

            var view = (TabView)activeView.View;

            view.Content = contentView.View;
            activeView.Presenter.RequestClose +=
                (s, e) =>
            {
                var region = this.regionManager.Regions[TabContainerRegion.Default];
                region.Remove(activeView.View);
            };


            var containedService = contentView.Presenter as IViewContainerAware;

            if (containedService != null)
            {
                containedService.ViewContainerService = activeView.Presenter;
            }


            regionManager.RegisterViewWithRegion(TabContainerRegion.Default, () => activeView.View);
        }
Exemplo n.º 3
0
 public static Task <ActiveView> CreateActiveViewAsync(this IViewFactory factory, Type presenterType, params object[] parameters)
 {
     return(factory.CreateActiveViewAsync(null, presenterType, parameters));
 }
Exemplo n.º 4
0
        public async Task StartAsync()
        {
            var presenter = await ViewFactory.CreateActiveViewAsync <TPresenter>(this, Parameters);

            await AddViewAsync(presenter);
        }