private void OBSSceneChangeHelper_Load(object sender, EventArgs e)
        {
            comboBox1.Text = ModifiableAction.SceneName;
            Thread th = new Thread(() => {
                if (!OBSUtils.IsConnected)
                {
                    OBSUtils.ConnectToServer();
                }
                if (OBSUtils.IsConnected)
                {
                    Thread th2 = new Thread(() => {
                        var scenes = OBSUtils.GetScenes();
                        comboBox1.Invoke(new Action(() => {
                            comboBox1.Items.AddRange(scenes.ToArray());
                        }));
                    });
                    th2.Start();
                }
            });

            th.Start();
        }
        public override void OnButtonUp(DeckDevice deckDevice)
        {
            Thread th = new Thread(() => {
                //We create a deck folder
                Size imageSize           = new Size(512, 512);
                DynamicDeckFolder folder = new DynamicDeckFolder();
                Font defaultFont         = new Font("Arial", 80, GraphicsUnit.Point);
                folder.SetParent(deckDevice.CurrentFolder);

                var scenes = OBSUtils.GetScenes();
                int index  = 0;
                using (var bmp = new Bitmap(imageSize.Width, imageSize.Height)) {
                    using (var g = Graphics.FromImage(bmp)) {
                        g.DrawString("Exit", defaultFont, Brushes.Black, new RectangleF(Point.Empty, imageSize), new StringFormat {
                            LineAlignment = StringAlignment.Center, Alignment = StringAlignment.Center
                        });
                    }
                    folder.Add(++index, new DynamicDeckItem()
                    {
                        DeckImage = new DeckImage(bmp)
                    });
                }

                foreach (var s in scenes)
                {
                    using (var bmp = new Bitmap(imageSize.Width, imageSize.Height)) {
                        using (var g = Graphics.FromImage(bmp)) {
                            g.DrawString(s, defaultFont, Brushes.Black, new RectangleF(Point.Empty, imageSize), new StringFormat {
                                LineAlignment = StringAlignment.Center, Alignment = StringAlignment.Center
                            });
                        }
                        folder.Add(++index, new DynamicDeckItem()
                        {
                            DeckImage = new DeckImage(bmp)
                        });
                    }
                }

                foreach (var s in scenes)
                {
                    using (var bmp = new Bitmap(imageSize.Width, imageSize.Height)) {
                        using (var g = Graphics.FromImage(bmp)) {
                            g.DrawString(s + previewSuffix, defaultFont, Brushes.Black, new RectangleF(Point.Empty, imageSize), new StringFormat {
                                LineAlignment = StringAlignment.Center, Alignment = StringAlignment.Center
                            });
                        }
                        folder.Add(++index, new DynamicDeckItem()
                        {
                            DeckImage = new DeckImage(bmp)
                        });
                    }
                }

                try {
                    var assemblies = AppDomain.CurrentDomain.GetAssemblies().ToList();

                    Type callType = assemblies.SelectMany(a => a.GetTypes())
                                    .Single(t => t.FullName == "ButtonDeck.Misc.IDeckDeviceExtensions");

                    var method = callType.GetMethod("GetConnection", BindingFlags.Static | BindingFlags.Public);

                    ConnectionState connection = (ConnectionState)method.Invoke(null, new object[] { deckDevice });



                    deckDevice.CurrentFolder = folder;


                    //This is a local fuction. Don't be scared, because this can happen.
                    void fakeFolderHandle(object s, ButtonInteractionEventArgs e)
                    {
                        if (deckDevice.CurrentFolder != folder)
                        {
                            return;
                        }
                        if (e.PerformedAction != Networking.Implementation.ButtonInteractPacket.ButtonAction.ButtonUp)
                        {
                            return;
                        }
                        if (deckDevice.CurrentFolder.GetDeckItems().Any(c => deckDevice.CurrentFolder.GetItemIndex(c) == e.SlotID))
                        {
                            var item = deckDevice.CurrentFolder.GetDeckItems().Where(c => deckDevice.CurrentFolder.GetItemIndex(c) == e.SlotID);
                            if (item is IDeckItem && e.SlotID == 1)
                            {
                                deckDevice.CurrentFolder = folder.ParentFolder;
                                SendFolder(connection, folder.ParentFolder);
                                deckDevice.ButtonInteraction -= fakeFolderHandle;
                                return;
                            }
                            if (e.SlotID - 1 <= scenes.Count)
                            {
                                if (scenes.AsEnumerable().ElementAtOrDefault(e.SlotID - 1) != null)
                                {
                                    OBSUtils.SwitchScene(scenes[e.SlotID - 1]);
                                }
                            }
                            else
                            {
                                if (scenes.AsEnumerable().ElementAtOrDefault((e.SlotID - 1) - scenes.Count) != null)
                                {
                                    OBSUtils.SwitchPreviewScene(scenes[(e.SlotID - 1) - scenes.Count]);
                                }
                            }
                        }
                    }

                    deckDevice.ButtonInteraction += fakeFolderHandle;

                    SendFolder(connection, folder);


#pragma warning disable RECS0022 // A catch clause that catches System.Exception and has an empty body
                } catch (Exception) {
#pragma warning restore RECS0022 // A catch clause that catches System.Exception and has an empty body
                    //Don't trow. Just flow.
                }
            });

            th.Start();
        }