Пример #1
0
                /// <summary>
                /// Updates the <see cref="Control"/>. This is called for every <see cref="Control"/>, even if it is disabled or
                /// not visible.
                /// </summary>
                /// <param name="currentTime">The current time in milliseconds.</param>
                protected override void UpdateControl(TickCount currentTime)
                {
                    base.UpdateControl(currentTime);

                    if (!IsVisible)
                    {
                        return;
                    }

                    // Get the current item info
                    var currItemInfo = ItemsCollection.GetItemInfo(Slot);

                    // Check if the item info has changed and, if so, re-initialize the sprite
                    if (currItemInfo != _lastItemInfo)
                    {
                        ItemsCollection.PeerTradeForm.InitializeItemInfoSprite(_sprite, currItemInfo);
                        _lastItemInfo = currItemInfo;
                    }

                    // Update the sprite
                    if (_sprite.GrhData != null)
                    {
                        _sprite.Update(currentTime);
                    }
                }
        private TItemInfo CreateItemInfo <TItemInfo>() where TItemInfo : WsItem
        {
            XmlReader subReader = _xmlReader.ReadSubtree();
            DataContractSerializer serializer = new DataContractSerializer(typeof(TItemInfo));
            TItemInfo item = (TItemInfo)serializer.ReadObject(subReader);

            item.Init(_apiClient, _folderPath.IsPrivate);
            _xmlReader.Read();
            return(item);
        }