コード例 #1
0
        /// <summary>
        /// Initializes the module.
        /// </summary>
        public void Initialize()
        {
            // Add a view in the right panel in the interaction window

            // Here we register the view (GUI) "IMySampleView" and its behavior counterpart "IMySampleViewModel"
            container.RegisterType <IHeadsetView, HeadsetView>();
            container.RegisterType <IPresentationModel, PresentationModel>();

            // Put the MySample view in the region "InteractionWorksheetRegion"
            viewManager.ViewsByRegionName["InteractionWorksheetRegion"].Add(
                new ViewActivator()
            {
                ViewType = typeof(IHeadsetView), ViewName = "HeadsetInteraction", ActivateView = true
            }
                );

            // Here we register the view (GUI) "IMySampleButtonView"
            container.RegisterType <IHeadsetButtonView, HeadsetButtonView>();

            // Put the MySampleMenuView view in the region "CaseViewSideButtonRegion" (The case toggle button in the interaction windows)
            viewManager.ViewsByRegionName["CaseViewSideButtonRegion"].Add(
                new ViewActivator()
            {
                ViewType = typeof(IHeadsetButtonView), ViewName = "HeadsetButtonView", ActivateView = true
            }
                );
        }
コード例 #2
0
 internal void SetDefault(Type type, string name, Lifecycle lifecycle = Lifecycle.Singleton)
 {
     if (!_container.IsRegistered(type, name))
     {
         _container.RegisterType(type, name, lifecycle);
     }
 }
コード例 #3
0
        /// <summary>
        /// Initializes the module.
        /// </summary>
        public void Initialize()
        {
            // Add a view in the right panel in the interaction window

            // Here we register the view (GUI) "InstGenesysView" and its behavior counterpart "InstGenesysModel"
            container.RegisterType <ICiscoVoiceModel, CiscoVoiceModel>();
            container.RegisterType <ICiscoVoiceView, CiscoVoiceView>();

            // Put the MySample view in the region "InteractionWorksheetRegion" //InteractionDetailsRegion
            //viewManager.ViewsByRegionName["InteractionsBundleRegion"].Clear();
            viewManager.ViewsByRegionName["InteractionsBundleRegion"].Insert(0,
                                                                             new ViewActivator()
            {
                ViewType = typeof(ICiscoVoiceView), ViewName = "CiscoVoice", ActivateView = true, Condition = CiscoVoiceModel.CiscoVoiceViewModelCondition
            }
                                                                             );
            //Register The commands
            commandManager.AddCommandToChainOfCommand("CiscoVoiceStopProcessingCommand",
                                                      new List <CommandActivator>()
            {
                new CommandActivator()
                {
                    CommandType = typeof(CiscoVoiceStopProcessingCommand),
                    Name        = "StopProcessing"
                }
            });
        }
コード例 #4
0
        /// <summary>
        /// Initializes the module.
        /// </summary>
        public void Initialize()
        {
            // Here we register the view (GUI) "InstGenesysView" and its behavior counterpart "InstGenesysModel"
            container.RegisterType <ICiscoTabModel, CiscoTabModel>();
            container.RegisterType <ICiscoTabView, CiscoTabView>();

            // Put the MySample view in the region "InteractionWorksheetRegion" //InteractionDetailsRegion
            viewManager.ViewsByRegionName["ToolbarWorkplaceRegion"].Add(
                new ViewActivator()
            {
                ViewType = typeof(ICiscoTabView), ViewName = "CiscoTab"
            }
                );
            //viewManager.ViewsByRegionName["ToolbarWorkplaceRegion"].Insert(0,
            //    new ViewActivator() { ViewType = typeof(ICiscoTabView), ViewName = "CiscoAgent" });

            // Here we register the view (GUI) "ICiscoMenuView"
            container.RegisterType <ICiscoMenuView, CiscoMenuView>();

            // Put the CiscoMenuView view in the region "WorkspaceMenuRegion" (The Workspace toggle button in the main toolbar)
            viewManager.ViewsByRegionName["WorkspaceMenuRegion"].Insert(0,
                                                                        new ViewActivator()
            {
                ViewType = typeof(ICiscoMenuView), ViewName = "CiscoMenu", ActivateView = true
            });
        }
コード例 #5
0
        private void RegisterDbContext(IObjectContainer container)
        {
            IDbRuleContext instance = new DbRuleContext();

            container.RegisterInstance <IDbRuleContext>(instance);
            if (!container.IsRegistered(typeof(ISqlFormatter)))
            {
                container.RegisterType <ISqlFormatter, SqlServerFormatter>(new object[0]);
            }
            InjectionProperty property  = new InjectionProperty("DbObjectOperator", new ResolvedParameter <DbObjectOperator>());
            InjectionProperty property2 = new InjectionProperty("DbRuleContext", new ResolvedParameter <IDbRuleContext>());

            container.RegisterType <IDbContext, DbContext>(new object[] { property, property2 });
        }
コード例 #6
0
 /// <summary>
 /// 注册类型
 /// </summary>
 public static void RegisterMultiple(this IObjectContainer that, IEnumerable <Type> registrationTypes, Type implementationType, Lifecycle lifecycle = Lifecycle.Singleton)
 {
     foreach (var registrationType in registrationTypes)
     {
         that.RegisterType(registrationType, implementationType, lifecycle);
     }
 }
コード例 #7
0
        public void Initialize()
        {
            // Add a view in the right panel in the interaction window

            // Here we register the view (GUI) "IMySampleView" and its behavior counterpart "IMySampleViewModel"
            container.RegisterType <IInstGenesysView, InstGenesysView>();
            container.RegisterType <IInstGenesysModel, InstInteractionModel>();

            // Put the MySample view in the region "InteractionWorksheetRegion"
            viewManager.ViewsByRegionName["InteractionDetailsRegion"].Add(
                new ViewActivator()
            {
                ViewType = typeof(IMainToolbarInteractionContainerView), ViewName = "InstGenesys", ActivateView = true
            }
                );
        }
コード例 #8
0
        /// <summary>
        /// Initializes the module.
        /// </summary>
        public void Initialize()
        {
            // Add a view in the right panel in the interaction window

            // Here we register the view (GUI) "InstGenesysView" and its behavior counterpart "InstGenesysModel"
            container.RegisterType <IUSDModel, USDModel>();
            container.RegisterType <IUSDView, USDView>();

            // Put the MySample view in the region "InteractionWorksheetRegion" //InteractionDetailsRegion
            //viewManager.ViewsByRegionName["InteractionsBundleRegion"].Clear();
            viewManager.ViewsByRegionName["InteractionsBundleRegion"].Insert(0,
                                                                             new ViewActivator()
            {
                ViewType = typeof(IUSDView), ViewName = "USD", ActivateView = true, Condition = USDModel.USDViewModelCondition
            }
                                                                             );
        }
コード例 #9
0
        private OperationKey GetOperationKey(string value)
        {
            IObjectContainer objectContainer = ObjectContainerFactory.GetObjectContainer();

            if (!objectContainer.IsRegistered(typeof(IOperationKeyFormatter)))
            {
                objectContainer.RegisterType <IOperationKeyFormatter, OperationKeyFormatter>(new object[0]);
            }
            return(objectContainer.Resolve <IOperationKeyFormatter>().Parse(value));
        }
コード例 #10
0
        protected virtual IExecutionRule GetExecutionRule()
        {
            IObjectContainer objectContainer = ObjectContainerFactory.GetObjectContainer();

            if (!objectContainer.IsRegistered(typeof(IExecutionRule)))
            {
                objectContainer.RegisterType <IExecutionRule, NullExecutionRule>(new object[0]);
            }
            return(objectContainer.Resolve <IExecutionRule>());
        }
        public void Initialize()
        {
            _container.RegisterType <ITipificacionesView, TipificacionesView>();
            _container.RegisterType <ITipificacionesViewModel, TipificacionesViewModel>();

            _viewManager.ViewsByRegionName["InteractionWorksheetRegion"].Add(
                new ViewActivator
            {
                ViewType     = typeof(ITipificacionesView),
                ViewName     = "InteractionTipificaciones",
                ActivateView = true
            }
                );

            _container.RegisterType <ITipificacionesButtonView, TipificacionesButtonView>();


            _viewManager.ViewsByRegionName["CaseViewSideButtonRegion"].Add(
                new ViewActivator
            {
                ViewType     = typeof(ITipificacionesButtonView),
                ViewName     = "TipificacionesButtonView",
                ActivateView = true
            }
                );

            //_commandManager.InsertCommandToChainOfCommandBefore(
            //    "BundleClose",
            //    "IsPossibleToClose",
            //    new List<CommandActivator>()
            //    {
            //        new CommandActivator()
            //        {
            //            CommandType = typeof(MarkDone.MarkDoneCommand),
            //            Name = "CloseMarkDoneTipificado"
            //        }
            //    }
            //    );

            _interactionManager.InteractionEvent += interactionManager_InteractionEvent;

            _viewEventManager.Subscribe(CrossnetEventHandler);
        }
コード例 #12
0
            internal void Register(IObjectContainer container)
            {
                if (container.IsRegistered(this.GetServiceType(), this.ContractName))
                {
                    return;
                }

                if (this.Instance != null)
                {
                    container.RegisterInstance(this.ContractType, this.Instance, this.ContractName);
                    return;
                }

                if (this.ContractType == null)
                {
                    container.RegisterType(this.TargetType, this.ContractName, this.Lifecycle);
                }
                else
                {
                    container.RegisterType(this.ContractType, this.TargetType, this.ContractName, this.Lifecycle);
                }
            }
コード例 #13
0
        private void RegisterUserAccessManager(IObjectContainer container)
        {
            bool flag   = string.Equals(ConfigurationManager.AppSettings["unique_login"], "true", StringComparison.OrdinalIgnoreCase);
            int  result = 0;

            if (!int.TryParse(ConfigurationManager.AppSettings["session_timeout"], out result))
            {
                result = -1;
            }
            if (result <= 0)
            {
                result = 0x493e0;
            }
            InjectionProperty property  = new InjectionProperty("EnableUniqueAccess", flag);
            InjectionProperty property2 = new InjectionProperty("Timeout", result);

            if (!container.IsRegistered(typeof(IPasswordEncryptor)))
            {
                container.RegisterType <IPasswordEncryptor, SimplePasswordEncryptor>(new object[0]);
            }
            InjectionConstructor constructor = new InjectionConstructor(new object[] { new ResolvedParameter <DbObjectOperator>(), new ResolvedParameter <IPasswordEncryptor>() });

            container.RegisterType <UserAccessManager, EGUserAccessManager>(new object[] { constructor, property, property2 });
        }
コード例 #14
0
 private void TryLog(Exception ex)
 {
     try
     {
         IObjectContainer objectContainer = ObjectContainerFactory.GetObjectContainer();
         if (!objectContainer.IsRegistered(typeof(ILogger)))
         {
             objectContainer.RegisterType <ILogger, WcfLogger>(new object[0]);
         }
         objectContainer.Resolve <ILogger>().Error(ex, null);
     }
     catch (Exception exception)
     {
         Debug.WriteLine("WCF log exception error:");
         Debug.WriteLine(exception.Message);
     }
 }
コード例 #15
0
ファイル: EGServiceBehavior.cs プロジェクト: rhdlmv/aopiocwcf
        public void ApplyDispatchBehavior(ServiceDescription serviceDescription, ServiceHostBase serviceHostBase)
        {
            string           name            = serviceHostBase.Description.Name;
            Type             serviceType     = serviceHostBase.Description.ServiceType;
            IObjectContainer objectContainer = ObjectContainerFactory.GetObjectContainer();

            foreach (ChannelDispatcher dispatcher in serviceHostBase.ChannelDispatchers)
            {
                foreach (EndpointDispatcher dispatcher2 in dispatcher.Endpoints)
                {
                    foreach (ServiceEndpoint endpoint in serviceHostBase.Description.Endpoints)
                    {
                        Type contractType = endpoint.Contract.ContractType;
                        if (((endpoint.Contract.Name == dispatcher2.ContractName) && (endpoint.Contract.Namespace == dispatcher2.ContractNamespace)) && (endpoint.Contract.ContractType != null))
                        {
                            if (serviceType.GetInterfaces().Any <Type>(t => (t == contractType)) && !objectContainer.IsRegistered(contractType))
                            {
                                objectContainer.RegisterType(contractType, serviceType, name, new object[0]);
                            }
                            dispatcher2.DispatchRuntime.InstanceProvider = new EGInstanceProvider(contractType, serviceType, name);
                            lock (this)
                            {
                                foreach (OperationDescription description in endpoint.Contract.Operations)
                                {
                                    if ((description.Behaviors != null) && ((from t in description.Behaviors
                                                                             where t.GetType() == typeof(EGOperationBehavior)
                                                                             select t).Count <IOperationBehavior>() <= 0))
                                    {
                                        IOperationBehavior item = new EGOperationBehavior();
                                        description.Behaviors.Add(item);
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
コード例 #16
0
 public static IObjectContainer RegisterType <T, F>(this IObjectContainer container, string name, LifeStyle lifestyle)
 {
     return(container.RegisterType(typeof(F), typeof(T), name, lifestyle));
 }
コード例 #17
0
ファイル: DMObjectContainer.cs プロジェクト: szlixun/chutian
 public static void Register <TService, TImpl>(LifeStyle life = LifeStyle.Singleton)
     where TService : class
     where TImpl : class, TService
 {
     container.RegisterType <TService, TImpl>(life);
 }
コード例 #18
0
 /// <summary>Register a implementation type.
 /// </summary>
 /// <param name="implementationType">The implementation type.</param>
 /// <param name="life">The life cycle of the implementer type.</param>
 public static void RegisterType(Type implementationType, LifeStyle life = LifeStyle.Singleton)
 {
     _container.RegisterType(implementationType, life);
 }
コード例 #19
0
 /// <summary>
 /// 注册一个类型
 /// </summary>
 /// <typeparam name="T">注册类型</typeparam>
 /// <param name="that">容器</param>
 /// <param name="lifetime">生命周期</param>
 public static void RegisterType <T>(this IObjectContainer that, Lifecycle lifetime)
 {
     that.RegisterType <T>((string)null, lifetime);
 }
コード例 #20
0
 /// <summary>
 /// 注册一个类型
 /// </summary>
 /// <param name="that">容器</param>
 /// <param name="from">注册类型</param>
 /// <param name="to">目标类型</param>
 /// <param name="lifetime">生命周期</param>
 public static void RegisterType(this IObjectContainer that, Type from, Type to, Lifecycle lifetime)
 {
     that.RegisterType(from, to, (string)null, lifetime);
 }
コード例 #21
0
 void InitializeBuilder(IObjectContainer container)
 {
     container.Register <IComponent, SingletonComponent>(LifeStyle.Singleton);
     container.RegisterType(typeof(SingletonComponent), LifeStyle.Singleton);
     container.RegisterType(typeof(SinglecallComponent), LifeStyle.Transient);
 }
コード例 #22
0
 /// <summary>
 /// 注册一个类型
 /// </summary>
 /// <typeparam name="TFrom">注册类型</typeparam>
 /// <typeparam name="TTo">目标类型</typeparam>
 /// <param name="that">容器</param>
 /// <param name="name">注册的名称</param>
 /// <param name="lifetime">生命周期类型</param>
 public static void RegisterType <TFrom, TTo>(this IObjectContainer that, string name = null, Lifecycle lifetime = Lifecycle.Singleton)
     where TTo : TFrom
 {
     //Ensure.NotWhiteSpace(name, "name");
     that.RegisterType(typeof(TFrom), typeof(TTo), name, lifetime);
 }
コード例 #23
0
 /// <summary>
 /// 注册一个类型
 /// </summary>
 /// <typeparam name="TFrom">注册类型</typeparam>
 /// <typeparam name="TTo">目标类型</typeparam>
 /// <param name="that">容器</param>
 /// <param name="lifetime">生命周期</param>
 public static void RegisterType <TFrom, TTo>(this IObjectContainer that, Lifecycle lifetime)
     where TTo : TFrom
 {
     that.RegisterType <TFrom, TTo>((string)null, lifetime);
 }
コード例 #24
0
 /// <summary>
 /// 注册一个类型
 /// </summary>
 /// <typeparam name="T">注册类型</typeparam>
 /// <param name="that">容器</param>
 /// <param name="name">注册的名称</param>
 /// <param name="lifetime">生命周期</param>
 public static void RegisterType <T>(this IObjectContainer that, string name = null, Lifecycle lifetime = Lifecycle.Singleton)
 {
     that.RegisterType(typeof(T), name, lifetime);
 }
コード例 #25
0
 /// <summary>
 /// 注册一个类型
 /// </summary>
 /// <param name="that">容器</param>
 /// <param name="type">注册类型</param>
 /// <param name="lifetime">生命周期</param>
 public static void RegisterType(this IObjectContainer that, Type type, Lifecycle lifetime = Lifecycle.Singleton)
 {
     that.RegisterType(type, (string)null, lifetime);
 }
コード例 #26
0
ファイル: CompositionExtension.cs プロジェクト: zhuwansu/Rafy
 /// <summary>
 /// 注册类型
 /// </summary>
 /// <typeparam name="TFrom">The type of the interface.</typeparam>
 /// <typeparam name="TTo">The type of the class.</typeparam>
 /// <param name="container">The container.</param>
 /// <param name="key">The key.</param>
 public static void RegisterType <TFrom, TTo>(this IObjectContainer container, string key = null)
     where TTo : TFrom
 {
     container.RegisterType(typeof(TFrom), typeof(TTo), key);
 }
コード例 #27
0
 /// <summary>
 /// 注册一个类型
 /// </summary>
 /// <typeparam name="T">注册类型</typeparam>
 /// <param name="that">容器</param>
 /// <param name="name">注册的名称</param>
 /// <param name="lifetime">生命周期</param>
 public static void RegisterType <T>(this IObjectContainer that, string name, Lifecycle lifetime = Lifecycle.Singleton)
 {
     name.NotWhiteSpace("name");
     that.RegisterType(typeof(T), name, lifetime);
 }
コード例 #28
0
 /// <summary>
 /// 注册一个给定的类型及其所有实现的接口
 /// </summary>
 /// <param name="type"></param>
 public void RegisterType(Type type)
 {
     _container.RegisterType(type);
 }
コード例 #29
0
        private void slidemenuApexBKC()
        {
            //// will open in side menu

            // APEX nar POPUP

            // Here we register the view (GUI) "IMySampleView" and its behavior counterpart "IMySampleViewModel"
            container.RegisterType <IMySampleViewApexBKC, MySampleViewApexBKC>();
            container.RegisterType <IMySampleViewModelApexBKC, slidemenu_ApexBKC.MySampleViewModelApexBKC>();

            // Put the MySample view in the region "InteractionWorksheetRegion"
            viewManager.ViewsByRegionName["InteractionWorksheetRegion"].Add(
                new ViewActivator()
            {
                ViewType = typeof(IMySampleViewApexBKC), ViewName = "MyInteractionSampleApexBKC", ActivateView = true
            }
                );

            // Here we register the view (GUI) "IMySampleButtonView"
            container.RegisterType <IMySampleButtonViewApexBKC, MySampleButtonViewApexBKC>();

            // Put the MySampleMenuView view in the region "CaseViewSideButtonRegion" (The case toggle button in the interaction windows)
            viewManager.ViewsByRegionName["CaseViewSideButtonRegion"].Add(
                new ViewActivator()
            {
                ViewType = typeof(IMySampleButtonViewApexBKC), ViewName = "MyButtonViewApexBKC", ActivateView = true
            }
                );
        }