Exemplo n.º 1
0
        private void RegisterContextCommands()
        {
            var registry = mContainer.Resolve <IGenericContextMenuCommandProviderFactoryRegistry>();

            var commandsFactoryType = mContainer.CreateAssistedInterfaceFactoryType(typeof(IGenericContextMenuCommandProviderFactory <ICommandsContext>), typeof(ItemDetailsCommandProvider));
            var commandsFactory     = (IGenericContextMenuCommandProviderFactory <ICommandsContext>)mContainer.Resolve(commandsFactoryType);

            registry.Register <ICommandsContext>(commandsFactory);
        }
Exemplo n.º 2
0
        private void RegisterContextCommands()
        {
            // Ask unity to give us the central registry for holding on to
            // context menu command provider factories.
            var registry = mContainer.Resolve <IGenericContextMenuCommandProviderFactoryRegistry>();

            // Create an assisted implementation of the context menu command
            // provider factory, for producing ExampleCommandProvider factory
            // instances.
            var commandsFactoryType = mContainer.CreateAssistedInterfaceFactoryType(
                factoryInterfaceType: typeof(IGenericContextMenuCommandProviderFactory <ICommandsContext>),
                implementationType: typeof(ExampleCommandProvider));

            // Create an instance of our ExampleCommandProvider factory.
            var commandsFactory = (IGenericContextMenuCommandProviderFactory <ICommandsContext>)mContainer.Resolve(commandsFactoryType);

            // Register our factory with the central registry.
            registry.Register <ICommandsContext>(commandsFactory);
        }