Exemplo n.º 1
0
        void CleanUp()   // removes dropped controllers from list
        {
            List <Joycon> rem = new List <Joycon>();

            for (int i = 0; i < j.Count; i++)
            {
                Joycon v = j[i];
                if (v.state == Joycon.state_.DROPPED)
                {
                    v.Detach(); rem.Add(v);
                    form.AppendTextBox("Removed dropped controller to list. Can be reconnected.\r\n");
                }
            }

            foreach (Joycon v in rem)
            {
                j.Remove(v);
            }
        }
Exemplo n.º 2
0
        void CleanUp()           // removes dropped controllers from list
        {
            List <Joycon> rem = new List <Joycon>();

            for (int i = 0; i < j.Count; i++)
            {
                Joycon v = j[i];
                if (v.state == Joycon.state_.DROPPED)
                {
                    if (v.other != null)
                    {
                        v.other.other = null;                         // The other of the other is the joycon itself
                    }
                    v.Detach(); rem.Add(v);

                    foreach (Button b in form.con)
                    {
                        if (b.Enabled & b.Tag == v)
                        {
                            b.Invoke(new MethodInvoker(delegate {
                                b.BackColor       = System.Drawing.Color.FromArgb(0x00, System.Drawing.SystemColors.Control);
                                b.Enabled         = false;
                                b.BackgroundImage = Properties.Resources.cross;
                            }));
                            break;
                        }
                    }

                    form.AppendTextBox("Removed dropped controller to list. Can be reconnected.\r\n");
                }
            }

            foreach (Joycon v in rem)
            {
                j.Remove(v);
            }
        }