Ejemplo n.º 1
0
        protected override IRegionBehaviorFactory ConfigureDefaultRegionBehaviors()
        {
            IRegionBehaviorFactory behaviors = base.ConfigureDefaultRegionBehaviors();

            behaviors.AddIfMissing(RegionManagerAwareBehavior.BehaviorKey, typeof(RegionManagerAwareBehavior));
            behaviors.AddIfMissing(RibbonRegionBehavior.BehaviorKey, typeof(RibbonRegionBehavior));
            return(behaviors);
        }
        /// <summary>
        /// Configures the <see cref="T:Prism.Regions.IRegionBehaviorFactory" />.
        /// This will be the list of default behaviors that will be added to a region.
        /// </summary>
        /// <returns>IRegionBehaviorFactory.</returns>
        protected override IRegionBehaviorFactory ConfigureDefaultRegionBehaviors()
        {
            IRegionBehaviorFactory factory = base.ConfigureDefaultRegionBehaviors();

            factory.AddIfMissing("AutoPopulateExportedViewsBehavior", typeof(AutoPopulateExportedViewsBehavior));
            return(factory);
        }
Ejemplo n.º 3
0
        protected override void ConfigureDefaultRegionBehaviors(IRegionBehaviorFactory regionBehaviors)
        {
            base.ConfigureDefaultRegionBehaviors(regionBehaviors);

            // Add Region Behavior to all regions (add in the adapter for just 1 region)
            regionBehaviors.AddIfMissing(DependentViewRegionBehaviour.BehaviourKey, typeof(DependentViewRegionBehaviour));
        }
Ejemplo n.º 4
0
        protected override IRegionBehaviorFactory ConfigureDefaultRegionBehaviors()
        {
            IRegionBehaviorFactory behaviors = base.ConfigureDefaultRegionBehaviors();

            behaviors.AddIfMissing(TabbedGroupRegionBehavior.BehaviorKey, typeof(TabbedGroupRegionBehavior));

            return(behaviors);
        }
Ejemplo n.º 5
0
        protected override IRegionBehaviorFactory ConfigureDefaultRegionBehaviors()
        {
            IRegionBehaviorFactory behaviors = base.ConfigureDefaultRegionBehaviors();

            behaviors.AddIfMissing(XamRibbonRegionBehavior.BehaviorKey, typeof(XamRibbonRegionBehavior));
            //behaviors.AddIfMissing(typeof(DisposeClosedViewsBehavior).FullName, typeof(DisposeClosedViewsBehavior));
            return(behaviors);
        }
Ejemplo n.º 6
0
        protected override void ConfigureDefaultRegionBehaviors(IRegionBehaviorFactory regionBehaviors)
        {
            base.ConfigureDefaultRegionBehaviors(regionBehaviors);

            regionBehaviors.AddIfMissing(
                behaviorKey: DisposableRegionBehavior.BehaviorKey,
                behaviorType: typeof(DisposableRegionBehavior));
        }
Ejemplo n.º 7
0
        protected override IRegionBehaviorFactory ConfigureDefaultRegionBehaviors()
        {
            IRegionBehaviorFactory f = base.ConfigureDefaultRegionBehaviors();

            // Dispose Behavior
            f.AddIfMissing(Behaviors.DisposeRegionBehavior.Key, typeof(Behaviors.DisposeRegionBehavior));
            return(f);
        }
Ejemplo n.º 8
0
 internal static void RegisterDefaultRegionBehaviors(this IRegionBehaviorFactory regionBehaviors)
 {
     regionBehaviors.AddIfMissing <BindRegionContextToDependencyObjectBehavior>(BindRegionContextToDependencyObjectBehavior.BehaviorKey);
     regionBehaviors.AddIfMissing <RegionActiveAwareBehavior>(RegionActiveAwareBehavior.BehaviorKey);
     regionBehaviors.AddIfMissing <SyncRegionContextWithHostBehavior>(SyncRegionContextWithHostBehavior.BehaviorKey);
     regionBehaviors.AddIfMissing <RegionManagerRegistrationBehavior>(RegionManagerRegistrationBehavior.BehaviorKey);
     regionBehaviors.AddIfMissing <RegionMemberLifetimeBehavior>(RegionMemberLifetimeBehavior.BehaviorKey);
     regionBehaviors.AddIfMissing <ClearChildViewsRegionBehavior>(ClearChildViewsRegionBehavior.BehaviorKey);
     regionBehaviors.AddIfMissing <AutoPopulateRegionBehavior>(AutoPopulateRegionBehavior.BehaviorKey);
     regionBehaviors.AddIfMissing <DestructibleRegionBehavior>(DestructibleRegionBehavior.BehaviorKey);
 }
Ejemplo n.º 9
0
 /// <summary>
 /// Configures the <see cref="IRegionBehaviorFactory"/>.
 /// This will be the list of default behaviors that will be added to a region.
 /// </summary>
 protected virtual void ConfigureDefaultRegionBehaviors(IRegionBehaviorFactory regionBehaviors)
 {
     if (regionBehaviors != null)
     {
         regionBehaviors.AddIfMissing(BindRegionContextToDependencyObjectBehavior.BehaviorKey, typeof(BindRegionContextToDependencyObjectBehavior));
         regionBehaviors.AddIfMissing(RegionActiveAwareBehavior.BehaviorKey, typeof(RegionActiveAwareBehavior));
         regionBehaviors.AddIfMissing(SyncRegionContextWithHostBehavior.BehaviorKey, typeof(SyncRegionContextWithHostBehavior));
         regionBehaviors.AddIfMissing(RegionManagerRegistrationBehavior.BehaviorKey, typeof(RegionManagerRegistrationBehavior));
         regionBehaviors.AddIfMissing(RegionMemberLifetimeBehavior.BehaviorKey, typeof(RegionMemberLifetimeBehavior));
         regionBehaviors.AddIfMissing(ClearChildViewsRegionBehavior.BehaviorKey, typeof(ClearChildViewsRegionBehavior));
         regionBehaviors.AddIfMissing(AutoPopulateRegionBehavior.BehaviorKey, typeof(AutoPopulateRegionBehavior));
         regionBehaviors.AddIfMissing(IDestructibleRegionBehavior.BehaviorKey, typeof(IDestructibleRegionBehavior));
     }
 }
        /// <inheritdoc />
        public virtual Result OnStartup(UIControlledApplication application)
        {
            ViewModelLocationProvider.SetDefaultViewModelFactory((view, type) => Container.Resolve(type));

            _containerExtension.RegisterInstance(_containerExtension);
            _containerExtension.RegisterInstance(_moduleCatalog);

            RegisterRequiredTypes(_containerExtension);
            RegisterTypes(_containerExtension);

            _containerExtension.FinalizeExtension();

            ServiceLocator.SetLocatorProvider(() => Container.Resolve <IServiceLocator>());

            ConfigureModuleCatalog(_moduleCatalog);

            RegionAdapterMappings regionAdapterMappings = Container.Resolve <RegionAdapterMappings>();

            if (regionAdapterMappings != null)
            {
                regionAdapterMappings.RegisterMapping(typeof(Selector), _containerExtension.Resolve <SelectorRegionAdapter>());
                regionAdapterMappings.RegisterMapping(typeof(ItemsControl), _containerExtension.Resolve <ItemsControlRegionAdapter>());
                regionAdapterMappings.RegisterMapping(typeof(ContentControl), _containerExtension.Resolve <ContentControlRegionAdapter>());
            }

            IRegionBehaviorFactory regionBehaviorFactory = Container.Resolve <IRegionBehaviorFactory>();

            if (regionBehaviorFactory != null)
            {
                regionBehaviorFactory.AddIfMissing(BindRegionContextToDependencyObjectBehavior.BehaviorKey, typeof(BindRegionContextToDependencyObjectBehavior));
                regionBehaviorFactory.AddIfMissing(RegionActiveAwareBehavior.BehaviorKey, typeof(RegionActiveAwareBehavior));
                regionBehaviorFactory.AddIfMissing(SyncRegionContextWithHostBehavior.BehaviorKey, typeof(SyncRegionContextWithHostBehavior));
                regionBehaviorFactory.AddIfMissing(RegionManagerRegistrationBehavior.BehaviorKey, typeof(RegionManagerRegistrationBehavior));
                regionBehaviorFactory.AddIfMissing(RegionMemberLifetimeBehavior.BehaviorKey, typeof(RegionMemberLifetimeBehavior));
                regionBehaviorFactory.AddIfMissing(ClearChildViewsRegionBehavior.BehaviorKey, typeof(ClearChildViewsRegionBehavior));
                regionBehaviorFactory.AddIfMissing(AutoPopulateRegionBehavior.BehaviorKey, typeof(AutoPopulateRegionBehavior));
                regionBehaviorFactory.AddIfMissing(IDestructibleRegionBehavior.BehaviorKey, typeof(IDestructibleRegionBehavior));
            }

            ExceptionExtensions.RegisterFrameworkExceptionType(typeof(ActivationException));
            ExceptionExtensions.RegisterFrameworkExceptionType(typeof(ContainerException));

            Container.Resolve <IModuleManager>()?.Run();

            return(Result.Succeeded);
        }
Ejemplo n.º 11
0
 protected override void ConfigureDefaultRegionBehaviors(IRegionBehaviorFactory regionBehaviors)
 {
     base.ConfigureDefaultRegionBehaviors(regionBehaviors);
     regionBehaviors.AddIfMissing(nameof(DisposeClosedViewsBehavior), typeof(DisposeClosedViewsBehavior));
 }
        /// <summary>
        /// Adds a particular type of RegionBehavior if it was not already registered. the <paramref name="behaviorKey"/> string is used to check if the behavior is already present
        /// </summary>
        /// <typeparam name="T">Type of the behavior to add.</typeparam>
        /// <param name="regionBehaviorFactory">The IRegionBehaviorFactory instance</param>
        /// <param name="behaviorKey">The behavior key that's used to find if a certain behavior is already added.</param>
        public static void AddIfMissing <T>(this IRegionBehaviorFactory regionBehaviorFactory, string behaviorKey) where T : IRegionBehavior
        {
            var behaviorType = typeof(T);

            regionBehaviorFactory.AddIfMissing(behaviorKey, behaviorType);
        }
Ejemplo n.º 13
0
 protected override void ConfigureDefaultRegionBehaviors(IRegionBehaviorFactory regionBehaviors)
 {
     regionBehaviors.AddIfMissing(DisposeBehavior.Key, typeof(DisposeBehavior));
     base.ConfigureDefaultRegionBehaviors(regionBehaviors);
 }
Ejemplo n.º 14
0
 protected override void ConfigureDefaultRegionBehaviors(IRegionBehaviorFactory regionBehaviors)
 {
     regionBehaviors.AddIfMissing <DependentViewRegionBehavior>(DependentViewRegionBehavior.BehaviorKey);
     base.ConfigureDefaultRegionBehaviors(regionBehaviors);
 }
Ejemplo n.º 15
0
        protected override void ConfigureDefaultRegionBehaviors(IRegionBehaviorFactory regionBehaviors)
        {
            base.ConfigureDefaultRegionBehaviors(regionBehaviors);

            regionBehaviors.AddIfMissing(DependentViewRegionBehavior.BehaviorKey, typeof(DependentViewRegionBehavior));
        }
 protected override void ConfigureDefaultRegionBehaviors(IRegionBehaviorFactory regionBehaviors)
 {
     base.ConfigureDefaultRegionBehaviors(regionBehaviors);
     regionBehaviors.AddIfMissing(RegionManagerAwareBehavior.BehaviorKey, typeof(RegionManagerAwareBehavior));
 }
Ejemplo n.º 17
0
 protected override void ConfigureDefaultRegionBehaviors(IRegionBehaviorFactory regionBehaviors)
 {
     base.ConfigureDefaultRegionBehaviors(regionBehaviors);
     regionBehaviors.AddIfMissing(DockingActivePaneSyncBehavior.BehaviorKey, typeof(DockingActivePaneSyncBehavior));
 }