Exemplo n.º 1
0
        public static void DrawBase(ISlot slot)
        {
            if (slot != null)
            {
                var image  = new BitmapImage(new Uri(slot.SlotImageSource, UriKind.Relative));
                var gif    = new BitmapImage(new Uri(slot.SlotInfoGif, UriKind.Relative));
                var header = slot.SlotHeader;
                var info   = slot.SlotInfo;


                Type slotType = slot.GetType();

                var imageField = slotType.GetField("SlotImage", BindingFlags.NonPublic | BindingFlags.Instance).GetValue(slot);
                imageField.GetType().GetProperty("Source", BindingFlags.Public | BindingFlags.Instance).SetValue(imageField, image);

                var gifField = slotType.GetField("InfoGif", BindingFlags.NonPublic | BindingFlags.Instance);
                ImageBehavior.SetAnimatedSource((Image)gifField.GetValue(slot), gif);

                var nameField = slotType.GetField("SlotName", BindingFlags.NonPublic | BindingFlags.Instance).GetValue(slot);
                nameField.GetType().GetProperty("Text", BindingFlags.Public | BindingFlags.Instance).SetValue(nameField, header);

                var infoField = slotType.GetField("TextInformation", BindingFlags.NonPublic | BindingFlags.Instance).GetValue(slot);
                infoField.GetType().GetProperty("Text", BindingFlags.Public | BindingFlags.Instance).SetValue(infoField, info);
            }
            else
            {
                return;
            }
        }