Exemplo n.º 1
0
        private void buttonArrowDown_Click(object sender, EventArgs e)
        {
            if (listBoxLinks.SelectedItems.Count == 1)
            {
                int previndex = listBoxLinks.SelectedIndex;

                if (previndex < listBoxLinks.Items.Count - 1)
                {
                    switch (eventType)
                    {
                    case EventType.BFBB:
                    {
                        LinkBFBB post = (LinkBFBB)listBoxLinks.Items[previndex + 1];
                        listBoxLinks.Items[previndex + 1] = (LinkBFBB)listBoxLinks.Items[previndex];
                        listBoxLinks.Items[previndex]     = post;
                        break;
                    }

                    case EventType.TSSM:
                    {
                        LinkTSSM post = (LinkTSSM)listBoxLinks.Items[previndex + 1];
                        listBoxLinks.Items[previndex + 1] = (LinkTSSM)listBoxLinks.Items[previndex];
                        listBoxLinks.Items[previndex]     = post;
                        break;
                    }

                    case EventType.Incredibles:
                    {
                        LinkIncredibles post = (LinkIncredibles)listBoxLinks.Items[previndex + 1];
                        listBoxLinks.Items[previndex + 1] = (LinkIncredibles)listBoxLinks.Items[previndex];
                        listBoxLinks.Items[previndex]     = post;
                        break;
                    }
                    }
                }

                listBoxLinks.SelectedIndices.Clear();
                listBoxLinks.SelectedIndex = Math.Min(previndex + 1, listBoxLinks.Items.Count - 1);
            }
        }
Exemplo n.º 2
0
        private void buttonArrowUp_Click(object sender, EventArgs e)
        {
            if (listBoxLinks.SelectedItems.Count == 1)
            {
                int previndex = listBoxLinks.SelectedIndex;

                if (previndex > 0)
                {
                    switch (eventType)
                    {
                    case EventType.BFBB:
                    {
                        LinkBFBB previous = (LinkBFBB)listBoxLinks.Items[previndex - 1];
                        listBoxLinks.Items[previndex - 1] = (LinkBFBB)listBoxLinks.Items[previndex];
                        listBoxLinks.Items[previndex]     = previous;
                        break;
                    }

                    case EventType.TSSM:
                    {
                        LinkTSSM previous = (LinkTSSM)listBoxLinks.Items[previndex - 1];
                        listBoxLinks.Items[previndex - 1] = (LinkTSSM)listBoxLinks.Items[previndex];
                        listBoxLinks.Items[previndex]     = previous;
                        break;
                    }

                    case EventType.Incredibles:
                    {
                        LinkIncredibles previous = (LinkIncredibles)listBoxLinks.Items[previndex - 1];
                        listBoxLinks.Items[previndex - 1] = (LinkIncredibles)listBoxLinks.Items[previndex];
                        listBoxLinks.Items[previndex]     = previous;
                        break;
                    }
                    }
                }

                listBoxLinks.SelectedIndices.Clear();
                listBoxLinks.SelectedIndex = Math.Max(previndex - 1, 0);
            }
        }