public void RemoveBinding(object oEventSource, string sEventName)
        {
            ITisEventBinding eventBinding =
                EventBindingsMngr.RemoveBinding(oEventSource, sEventName);

            UpdateEventSource(oEventSource, eventBinding, false);
        }
        public ITisEventBinding AddBinding(object oEventSource, string sEventName, ITisInvokeParams oInvokeParams)
        {
            ITisEventBinding eventBinding = EventBindingsMngr.AddBinding(oEventSource, sEventName, oInvokeParams);

            UpdateEventSource(oEventSource, eventBinding, true);

            return(eventBinding);
        }
        private void UpdateEventSource(
            object oEventSource,
            ITisEventBinding eventBinding,
            bool bindingAdded)
        {
            if (eventBinding != null && oEventSource is TisDataLayerTreeNode)
            {
                List <EventAssemblyInfo> eventSourceBoundEventsAssembliesContainer =
                    ((TisDataLayerTreeNode)oEventSource).BoundEventsAssemblies;

                EventAssemblyInfo eventSourceEventAssemblyInfo = FindEventAssemblyInfo(
                    eventSourceBoundEventsAssembliesContainer,
                    eventBinding.InvokeParams.ModuleName);

                TisDataLayerTreeNode flowset = (TisDataLayerTreeNode)((TisDataLayerTreeNode)oEventSource).Root;

                List <EventAssemblyInfo> flowsetBoundEventsAssembliesContainer =
                    flowset.BoundEventsAssemblies;

                EventAssemblyInfo flowsetEventAssemblyInfo = FindEventAssemblyInfo(
                    flowsetBoundEventsAssembliesContainer,
                    eventBinding.InvokeParams.ModuleName);

                if (bindingAdded)
                {
                    if (StringUtil.IsStringInitialized(((TisInvokeParams)eventBinding.InvokeParams).ModulePath))
                    {
                        EventAssemblyInfo eventAssemblyInfo = new EventAssemblyInfo(
                            ((TisInvokeParams)eventBinding.InvokeParams).ModulePath,
                            eventBinding.InvokeParams.ModuleName,
                            this,
                            m_oCustomAssemblyResolver.CustomizationDir);

                        if (eventSourceEventAssemblyInfo == null)
                        {
                            eventSourceBoundEventsAssembliesContainer.Add(eventAssemblyInfo);
                        }

                        if (flowsetEventAssemblyInfo == null)
                        {
                            flowsetBoundEventsAssembliesContainer.Add(eventAssemblyInfo);
                        }
                    }
                }
                else
                {
                    if (eventSourceEventAssemblyInfo != null)
                    {
                        eventSourceBoundEventsAssembliesContainer.Remove(eventSourceEventAssemblyInfo);
                    }

                    if (flowsetEventAssemblyInfo != null)
                    {
                        flowsetBoundEventsAssembliesContainer.Remove(flowsetEventAssemblyInfo);
                    }
                }
            }
        }
        public ITisInvokeParams GetBinding(object oEventSource, string sEventName)
        {
            ITisEventBinding oEventBinding = EventBindingsMngr.GetBinding(oEventSource, sEventName);

            if (oEventBinding == null)
            {
                return(null);
            }

            return(oEventBinding.InvokeParams);
        }
        public ITisEventBinding AddBinding(object oEventSource, string sEventName, string sInvokeTypeName, string sEventString)
        {
            ITisEventBinding eventBinding = EventBindingsMngr.AddBinding(
                oEventSource,
                sEventName,
                new TisInvokeParams(sInvokeTypeName, sEventString));

            UpdateEventSource(oEventSource, eventBinding, true);

            return(eventBinding);
        }
        public ITisEventBinding AddBinding(object oEventSource, string sEventName, MethodInfo oMethodInfo)
        {
            ITisEventBinding eventBinding = EventBindingsMngr.AddBinding(
                oEventSource,
                sEventName,
                oMethodInfo);

            UpdateEventSource(oEventSource, eventBinding, true);

            return(eventBinding);
        }
        public ITisEventBinding Add(string sEventName, ITisInvokeParams oInvokeParams)
        {
            ITisEventBinding oEventBindingInfo = GetByEventName(sEventName);

            if (oEventBindingInfo == null)
            {
                oEventBindingInfo = new EventBindingInfo(sEventName, oInvokeParams);

                m_oEventsBindingInfo.Add(sEventName, oEventBindingInfo);
            }

            return(oEventBindingInfo);
        }
        public bool Contains(object oEventSource, ITisEventBinding oEventBindingInfo)
        {
            string oPersistKey = ObtainEventSourceBindingKey(oEventSource);

            EventBindingInfoMngr oBindingInfoMngr = ObtainBindingInfoMngr(oPersistKey);

            if (oBindingInfoMngr != null)
            {
                return(oBindingInfoMngr.Contains(oEventBindingInfo));
            }

            return(false);
        }
        public ITisEventBinding AddDNBinding(
            object oEventSource,
            string sEventName,
            string sModuleName,
            string sClassName,
            string sMethodName)
        {
            ITisEventBinding eventBinding = EventBindingsMngr.AddBinding(
                oEventSource,
                sEventName,
                new TisDNInvokeParams(sModuleName, sClassName, sMethodName));

            UpdateEventSource(oEventSource, eventBinding, true);

            return(eventBinding);
        }
        public ITisEventBinding AddBinding(object oEventSource, string sEventName, ITisInvokeParams oInvokeParams)
        {
            string oPersistKey = ObtainEventSourceBindingKey(oEventSource);

            EventBindingInfoMngr oBindingInfoMngr = ObtainBindingInfoMngr(oPersistKey);

            if (oBindingInfoMngr == null)
            {
                oBindingInfoMngr = new EventBindingInfoMngr();
            }

            ITisEventBinding oEventBinding = oBindingInfoMngr.Add(sEventName, oInvokeParams);

            m_oBindings.Add(oPersistKey, oBindingInfoMngr);

            return(oEventBinding);
        }
        private ITisEventBinding InternalRemoveBinding(string oPersistKey, string sEventName)
        {
            EventBindingInfoMngr oBindingInfoMngr = null;

            if (m_oBindings.ContainsKey(oPersistKey))
            {
                oBindingInfoMngr = (EventBindingInfoMngr)m_oBindings [oPersistKey];
            }
            else
            {
                oBindingInfoMngr = new EventBindingInfoMngr();
            }

            ITisEventBinding eventBinding = oBindingInfoMngr.GetByEventName(sEventName);

            oBindingInfoMngr.Remove(new string[] { sEventName });

            return(eventBinding);
        }
        public ITisEventBinding AddBinding(object oEventSource, string sEventName, TisInvokeType enInvokeType, string sEventString)
        {
            ITisEventBinding eventBinding = null;

            switch (enInvokeType)
            {
            case TisInvokeType.DOTNET:
            {
                eventBinding = EventBindingsMngr.AddBinding(
                    oEventSource,
                    sEventName,
                    new TisDNInvokeParams(sEventString));
                break;
            }
            }

            UpdateEventSource(oEventSource, eventBinding, true);

            return(eventBinding);
        }
 public bool Contains(ITisEventBinding oEventBindingInfo)
 {
     return(m_oEventsBindingInfo.ContainsKey(oEventBindingInfo.EventName));
 }