Пример #1
0
        public void Assign(string propertyName, object value, object[] indexer)
        {
            OM_Assign             data = new OM_Assign(propertyName, value, indexer);
            delegateOnGetInstance eh   = new delegateOnGetInstance(onAssign);

            WorkOnAllInstances(eh, data);
        }
Пример #2
0
        private void onAssign(RAIS_R r, object data)
        {
            OM_Assign    e  = (OM_Assign)data;
            PropertyInfo pi = r.Instance.GetType().GetProperty(e.PropertyName);

            pi.SetValue(r.Instance, e.Value, e.Indexer);
        }
        private void onSetValue(object instance, object data)
        {
            OM_Assign oa = (OM_Assign)data;
            object    v;

            if (instance is RAIS_R)
            {
                v = ((RAIS_R)instance).Instance;
            }
            else
            {
                v = instance;
            }
            setValue(v, oa.PropertyName, oa.Indexer, oa.Value);
        }
        /// <summary>
        /// push value from source to destination
        /// </summary>
        /// <param name="sender">data source</param>
        /// <param name="propertyName">source property</param>
        /// <param name="parameters">indexer</param>
        /// <param name="value">value to send</param>
        public void SinkPushValue(IDataFlowSource sender, string propertyName, object[] parameters, object value)
        {
            Dictionary <string, Dictionary <DL_Indexer, Dictionary <object, Dictionary <string, DL_DataDestination> > > > v1 = null;

            if (this.ContainsKey(sender))
            {
                v1 = this[sender];
            }
            else
            {
                foreach (object v in this.Keys)
                {
                    if (v is RAIS_A)
                    {
                        if (((RAIS_A)v).IsInstance(sender))
                        {
                            v1 = this[v];
                            break;
                        }
                    }
                }
            }
            if (v1 != null)
            {
                if (_dataSources == null)
                {
                    _dataSources = new Hashtable();
                }
                if (_dataSources.ContainsKey(sender))
                {
                    return;
                }
                _dataSources.Add(sender, v1);
                try
                {
                    Dictionary <DL_Indexer, Dictionary <object, Dictionary <string, DL_DataDestination> > > v2;
                    if (v1.ContainsKey(propertyName))
                    {
                        v2 = v1[propertyName];
                        Dictionary <object, Dictionary <string, DL_DataDestination> > v3 = null;
                        Dictionary <DL_Indexer, Dictionary <object, Dictionary <string, DL_DataDestination> > > .Enumerator e2 = v2.GetEnumerator();
                        while (e2.MoveNext())
                        {
                            if (e2.Current.Key.IsSameSignature(parameters))
                            {
                                v3 = e2.Current.Value;
                                break;
                            }
                        }
                        if (v3 != null)
                        {
                            Dictionary <object, Dictionary <string, DL_DataDestination> > .Enumerator e3 = v3.GetEnumerator();
                            while (e3.MoveNext())
                            {
                                Dictionary <string, DL_DataDestination> .Enumerator e4 = e3.Current.Value.GetEnumerator();
                                while (e4.MoveNext())
                                {
                                    if (e3.Current.Key is Type)
                                    {
                                        EventInfo ei = ((Type)e3.Current.Key).GetEvent("OnVOBStaticSetValue", BindingFlags.Static);
                                        if (ei != null)
                                        {
                                            MethodInfo mi = ei.GetRaiseMethod(true);
                                            mi.Invoke(null, new object[] { sender, e4.Current.Key, parameters, value });
                                        }
                                    }
                                    else
                                    {
                                        if (e3.Current.Key is string)
                                        {
                                            OM_Assign             oa = new OM_Assign(e4.Current.Key, value, parameters);
                                            delegateOnGetInstance h  = new delegateOnGetInstance(onSetValue);
                                            _objectManager.WorkOnAllInstances(e3.Current.Key.ToString(), h, oa);
                                        }
                                        else
                                        {
                                            setValue(e3.Current.Key, e4.Current.Key, parameters, value);
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
                catch
                {
                    throw;
                }
                finally
                {
                    _dataSources.Remove(sender);
                }
            }
        }