Exemplo n.º 1
0
        public void Update(ExchangeObjectRemovedMessage message)
        {
            var removedObj = message.Remote ?
                             RemoteObjects.FirstOrDefault(o => o.UID == message.ObjectUID) :
                             Objects.FirstOrDefault(o => o.UID == message.ObjectUID);

            if (message.Remote)
            {
                RemoteCurrentWeight += (uint)(removedObj.Quantity * removedObj.RealWeight);
                RemoteObjects.Remove(removedObj);
            }
            else
            {
                CurrentWeight += (uint)(removedObj.Quantity * removedObj.RealWeight);
                Objects.Remove(removedObj);
            }

            _step++;
            ExchangeContentChanged?.Invoke();
        }
Exemplo n.º 2
0
        public void Update(ExchangeObjectModifiedMessage message)
        {
            var modifiedObj = message.Remote ?
                              RemoteObjects.FirstOrDefault(o => o.UID == message.Object.ObjectUID) :
                              Objects.FirstOrDefault(o => o.UID == message.Object.ObjectUID);

            int qtyDiff = (int)message.Object.Quantity - (int)modifiedObj.Quantity;

            modifiedObj.Update(message.Object);

            if (message.Remote)
            {
                RemoteCurrentWeight += (uint)(qtyDiff * modifiedObj.RealWeight);
            }
            else
            {
                CurrentWeight += (uint)(qtyDiff * modifiedObj.RealWeight);
            }

            _step++;
            ExchangeContentChanged?.Invoke();
        }