示例#1
0
        public SMSC(string description, string host, int port, string systemId, string password, string systemType, int sequenceNumber, BindModes bindMode)
        {
            this.description = description;
            this.host        = host;
            this.port        = port;

            if (systemId.Length > 15)
            {
                this.systemId = systemId.Substring(0, 15);
            }
            else
            {
                this.systemId = systemId;
            }

            if (password.Length > 8)
            {
                this.password = password.Substring(0, 8);
            }
            else
            {
                this.password = password;
            }

            if (systemType.Length > 12)
            {
                this.systemType = systemType.Substring(0, 8);
            }
            else
            {
                this.systemType = systemType;
            }

            this.sequenceNumber = sequenceNumber;
            this.bindMode       = bindMode;
        }
        public bool BindViewProperty(object view, string viewProperty, BaseObservable bindable, string bindableProperty, BindMode bindMode)
        {
            if (view == null)
            {
                return(false);
            }
            if (string.IsNullOrEmpty(viewProperty))
            {
                return(false);
            }
            if (bindable == null)
            {
                return(false);
            }
            if (string.IsNullOrEmpty(bindableProperty))
            {
                return(false);
            }

            var vProp = view.GetType().GetProperty(viewProperty);

            if (vProp == null)
            {
                return(false);
            }
            var bProp = bindable.GetType().GetProperty(bindableProperty);

            if (bProp == null)
            {
                return(false);
            }

            //if (!bProp.PropertyType.Equals(typeof(T)) && !bProp.PropertyType.IsSubclassOf(typeof(T)))
            //  return false;

            string cViewPropID = string.Concat(view.GetType().Name, view.GetHashCode(), viewProperty);

            if (ObjectLinks.ContainsKey(cViewPropID))
            {
                return(false);
            }

            string cObjectPropID = string.Concat(bindable.GetType().Name, bindable.GetHashCode(), bindableProperty);

            ObjectLinks.Add(cViewPropID, new ObjectLink {
                ID = cObjectPropID, Object = bindable, Property = bProp
            });
            BindModes.Add(cViewPropID, bindMode);


            ViewLinks.Add(new KeyValuePair <string, ViewLink>(cObjectPropID, new ViewLink {
                ID = cViewPropID, View = view, Property = vProp
            }));

            if (!ObservedObjects.Contains(bindable))
            {
                ObservedObjects.Add(bindable);
            }

            return(true);
        }
示例#3
0
 public SMSC(string description, string host, int port, string systemId, string password, string systemType, byte addrTon, byte addrNpi, string addressRange, int sequenceNumber, BindModes bindMode) : this(description, host, port, systemId, password, systemType, sequenceNumber, bindMode)
 {
     this.addrTon      = addrTon;
     this.addrNpi      = addrNpi;
     this.addressRange = addressRange;
 }