Example #1
0
        public static void RefreshButton(IDeckItem item, int camada, DeckItemMisc itemmisc, DeckDevice device)
        {
            // Buttons_Unfocus(this, EventArgs.Empty);
            MainForm.Instance.Invoke(new Action(() =>
            {
                IDeckFolder folder        = device.CurrentProfile.Currentfolder;
                ImageModernButton control = MainForm.Instance.Controls.Find("modernButton" + folder.GetItemIndex(item), true).FirstOrDefault() as ImageModernButton;

                if (camada == 1)
                {
                    control.Camada      = 1;
                    control.NormalImage = itemmisc?.GetItemImage()?.Bitmap;
                }
                else if (camada == 2)
                {
                    control.Camada         = 2;
                    control.NormalLayerTwo = itemmisc?.GetItemImage()?.Bitmap ?? Resources.img_item_default;;
                }
                control.TextButton = new TextLabel(itemmisc);
                control.Tag        = item;

                control.Invoke(new Action(control.Refresh));
                device.CheckCurrentFolder();

                SendSingleItemToDevice(device, folder.GetItemIndex(item), itemmisc);
            }));
        }
Example #2
0
        private void SendDeckLabel(DataOutputStream writer, int slot, DeckItemMisc item)
        {
            //Write the slot
            if (item.GetItemImage() != null)
            {
                Json headerContent = new Json();


                writer.WriteInt(slot);
                //Byte array lenght
                writer.WriteInt(item.GetItemImage().InternalBitmap.Length);
                writer.Write(item.GetItemImage().InternalBitmap);

                headerContent.Font     = " ";
                headerContent.Size     = item.Decksize;
                headerContent.Position = item.Deckposition;
                headerContent.Text     = item.Deckname;
                headerContent.Color    = item.Deckcolor;

                headerContent.Stroke_color  = item.Stroke_color;
                headerContent.Stroke_dx     = item.Stroke_dxtext;
                headerContent.Stroke_radius = item.Stroke_radius;
                headerContent.Stroke_dy     = item.Stroke_Dy;
                headerContent.IsStroke      = item.IsStroke;
                headerContent.Isboldtext    = item.Isboldtext;
                headerContent.Isnormaltext  = item.Isnormaltext;
                headerContent.Isitalictext  = item.Isitalictext;
                headerContent.Ishinttext    = item.Ishinttext;
                string jsonString = JsonConvert.SerializeObject(headerContent, Formatting.None);

                writer.WriteUTF(jsonString);

                ////text

                //writer.WriteUTF(text);
                ////size
                //writer.WriteInt(size);
                ////position
                //writer.WriteInt(pos);

                ////color

                //writer.WriteUTF(color);
            }
        }
Example #3
0
        public static void SendSingleItemToDevice(DeckDevice device, int slot, DeckItemMisc item)
        {
            var con = device.GetConnection();

            if (con != null)
            {
                bool isFolder = false;

                var image = item.GetItemImage() ?? (new DeckImage(isFolder ? Resources.img_folder : Resources.img_item_default));
                var seri  = image.BitmapSerialized;
                con.SendPacket(new SingleUniversalChangePacket(image)
                {
                    ImageSlot   = slot,
                    CurrentItem = item
                });
            }
        }