Esempio n. 1
0
 public void OnBindingMessage(ObservableMessage message)
 {
     if (message.Name == this.PropertyName)
     {
         this.DataInstance = message.Value;
     }
 }
Esempio n. 2
0
        /// <summary>
        /// Handle all change notification here
        /// </summary>
        /// <param name="m"></param>
        public virtual void OnBindingMessage(ObservableMessage m)
        {
            // ignore if editor
            if (!Application.isPlaying)
            {
                return;
            }

            if (Model == null)
            {
                return;
            }

            if (!enabled)
            {
                return;
            }

            var bindings = GetBindingInfos().Where(o => o.MemberName == m.Name && o.Action != null).ToArray();

            foreach (var binding in bindings)
            {
                if (binding.Action != null)
                {
                    binding.Action(m.Value);
                }
            }
        }
Esempio n. 3
0
        private async Task UpdateMessages(HostState hostState)
        {
            await hostState.BoincState.UpdateMessages();

            if (!_useObservableCollections)
            {
                return;
            }

            foreach (BoincRpc.Message rpcMessage in hostState.BoincState.Messages)
            {
                ObservableMessage message = Messages.FirstOrDefault(mvm => mvm.HostId == hostState.Id);
                if (message == null)
                {
                    message = new ObservableMessage(hostState, rpcMessage);
                    if (string.IsNullOrEmpty(SearchString))
                    {
                        Messages.Add(message);
                    }
                    else
                    {
                        foreach (var content in message.GetContentsForFiltering())
                        {
                            if (content != null && content.IndexOf(SearchString, StringComparison.InvariantCultureIgnoreCase) != -1)
                            {
                                // The search string is found in any of the Models's property
                                Messages.Add(message);
                                break;
                            }
                        }
                    }
                }
            }
        }
Esempio n. 4
0
 public virtual void OnBindingMessage(ObservableMessage m)
 {
     if (!Application.get_isPlaying())
     {
         return;
     }
     if (this.Model == null)
     {
         return;
     }
     if (this == null)
     {
         return;
     }
     if (!base.get_enabled())
     {
         return;
     }
     BindingBase.BindingInfo[] bindingInfos = this.GetBindingInfos();
     BindingBase.BindingInfo[] array        = Enumerable.ToArray <BindingBase.BindingInfo>(Enumerable.Where <BindingBase.BindingInfo>(bindingInfos, (BindingBase.BindingInfo o) => o.MemberName == m.Name && o.Action != null));
     for (int i = 0; i < array.Length; i++)
     {
         if (array[i].Action != null)
         {
             array[i].Action.Invoke(m.Value);
         }
     }
 }
Esempio n. 5
0
 void _bindableInstance_OnBindingUpdate(ObservableMessage obj)
 {
     if (_onBindingEvent != null)
     {
         _onBindingEvent(obj);
     }
 }
Esempio n. 6
0
 private void RelayBindingUpdate(ObservableMessage message)
 {
     IBindingElement[] array = this.Binders.ToArray();
     for (int i = 0; i < array.Length; i++)
     {
         array[i].OnBindingMessage(message);
     }
 }
        /// <summary>
        /// Posts a message down to data binders
        /// </summary>
        /// <param name="message"></param>
        void RelayBindingUpdate(ObservableMessage message)
        {
            var array = Binders.ToArray();

            for (int i = 0; i < array.Length; i++)
            {
                array[i].OnBindingMessage(message);
            }

            OnBindingMessage(message);
        }
        public void OnBindingMessage(ObservableMessage message)
        {
            if (message.Name == PropertyName)
            {
                DataInstance = message.Value;

                var array = Binders.ToArray();

                for (int i = 0; i < array.Length; i++)
                {
                    array[i].OnBindingRefresh();
                }
            }
        }
        public virtual void Dispose()
        {
            _isDisposed = true;

            if (_binder != null)
            {
                _binder.Dispose();
            }

            if (_bindingMessage != null)
            {
                _bindingMessage.Dispose();
            }

            _bindingMessage = null;
            _binder         = null;
        }
        public void RaiseBindingUpdate(string memberName, object paramater)
        {
            if (_bindingMessage == null)
            {
                _bindingMessage = new ObservableMessage {
                    Sender = this
                }
            }
            ;

            Binder.RaiseBindingUpdate(memberName, paramater);

            if (_onBindingEvent != null)
            {
                _bindingMessage.Name  = memberName;
                _bindingMessage.Value = paramater;
                _onBindingEvent(_bindingMessage);
            }
        }
Esempio n. 11
0
        public void Dispose()
        {
            _bindingMessage.Dispose();

            if (_bindableInstance != null)
            {
                _bindableInstance.OnBindingUpdate -= _bindableInstance_OnBindingUpdate;
            }
            if (_notifyInstance != null)
            {
                _notifyInstance.PropertyChanged -= _notifyInstance_PropertyChanged;
            }
            _luaTable.Dispose();
            _luaTable         = null;
            _instance         = null;
            _insanceBehaviour = null;
            _bindableInstance = null;
            _bindingMessage   = null;
            _notifyInstance   = null;
        }
        /// <summary>
        /// Awake is called when the script instance is being loaded.
        /// </summary>
        protected virtual void Awake()
        {
            if (_bindingMessage == null)
            {
                _bindingMessage = new ObservableMessage {
                    Sender = this
                }
            }
            ;
            InitBinder();

            if (awakeMethod != null)
            {
                awakeMethod();
            }
        }

        void Start()
        {
            if (startMethod != null)
            {
                startMethod();
            }
        }

        void OnEnable()
        {
            if (onenableMethod != null)
            {
                onenableMethod();
            }
        }

        void OnDisable()
        {
            if (ondisableMethod != null)
            {
                ondisableMethod();
            }
        }
        /// <summary>
        /// Handle all change notification here
        /// </summary>
        /// <param name="m"></param>
        public virtual void OnBindingMessage(ObservableMessage m)
        {
            // ignore if editor
            if (!Application.isPlaying)
                return;

            if (Model == null)
                return;

            if (!enabled)
                return;

            var bindings = GetBindingInfos().Where(o => o.MemberName == m.Name && o.Action != null).ToArray();

            foreach (var binding in bindings)
            {
                if (binding.Action != null)
                    binding.Action(m.Value);
            }
        }
        public void Dispose()
        {
            _bindingMessage.Dispose();

            if (_bindableInstance != null)
            {
                _bindableInstance.OnBindingUpdate -= _bindableInstance_OnBindingUpdate;
            }
            if (_notifyInstance != null)
            {
                _notifyInstance.PropertyChanged -= _notifyInstance_PropertyChanged;
            }
            _myType = null;
            _instance = null;
            _insanceBehaviour = null;
            _bindableInstance = null;
            _bindingMessage = null;
            _notifyInstance = null;
        }
 void DatabindingTester_OnBindingUpdate(ObservableMessage obj)
 {
     Log = string.Format("{0} : {1}", obj.Name, obj.Value);
 }
 void _bindableInstance_OnBindingUpdate(ObservableMessage obj)
 {
     if (_onBindingEvent != null)
     {
         _onBindingEvent(obj);
     }
 }
Esempio n. 17
0
 private void DatabindingTester_OnBindingUpdate(ObservableMessage obj)
 {
     Log = string.Format("{0} : {1}", obj.Name, obj.Value);
 }