예제 #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);
            }));
        }
        private void SendFolder(ConnectionState connection, IDeckFolder folder)
        {
            List <int> list = new List <int>();

            var clearPacket = new Networking.Implementation.SlotImageClearChunkPacket();
            var packet      = new Networking.Implementation.SlotImageChangeChunkPacket();

            foreach (var item in folder.GetDeckItems())
            {
                if (!(item is DynamicDeckItem))
                {
                    continue;
                }
                var index = folder.GetItemIndex(item);
                list.Add(index);
                packet.AddToQueue(index, ((DynamicDeckItem)item).DeckImage);
            }
            for (int i = 0; i < 15; i++)
            {
                if (list.Contains(i + 1))
                {
                    continue;
                }
                clearPacket.AddToQueue(i + 1);
            }
            connection.SendPacket(packet);
            connection.SendPacket(clearPacket);
        }
예제 #3
0
        public static IDeckItem getDeckItem(int slot)
        {
            IDeckFolder folder = MainForm.Instance.CurrentDevice?.CurrentProfile.Currentfolder;

            if (folder == null)
            {
                return(null);
            }
            IDeckItem item = null;

            for (int i = 0; i < folder.GetDeckItems().Count; i++)
            {
                item = folder.GetDeckItems()[i];
                if (folder.GetItemIndex(item) != slot)
                {
                    continue;
                }
            }


            return(item);
        }