Ejemplo n.º 1
0
        /// <summary>
        /// delete all the items from the right listbox and add to the left listbox if there are no duplicates
        /// </summary>
        private void allToLeft_Click(object sender, EventArgs e)
        {
            int[] LeftArr  = ClassSom1.GetArrFromList(ListLeft);
            int[] RightArr = ClassSom1.GetArrFromList(ListRight);

            int Length = ClassSom1.LengthOfArrayWithoutDuplicates(RightArr, LeftArr);

            LeftArr = ClassSom1.MoveAllItems(RightArr, LeftArr, Length);

            ClassSom1.FillListFromArray(LeftArr, ListLeft);
            ListRight.Items.Clear();
        }
Ejemplo n.º 2
0
        /// <summary>
        /// delete the selected item in the left listbox and add in the right listbox
        /// </summary>

        private void selecToRight_Click(object sender, EventArgs e)
        {
            if (ListLeft.SelectedIndex != -1)
            {
                int[] LeftArr  = ClassSom1.GetArrFromList(ListLeft);
                int[] RightArr = ClassSom1.GetArrFromList(ListRight);

                RightArr = ClassSom1.AddSingleItem(ListLeft.SelectedIndex, ListRight.Items.Count, LeftArr, RightArr);
                LeftArr  = ClassSom1.DeleteItem(ListLeft.SelectedIndex, ListLeft.Items.Count, LeftArr);

                ClassSom1.FillListFromArray(LeftArr, ListLeft);
                ClassSom1.FillListFromArray(RightArr, ListRight);
            }
        }
Ejemplo n.º 3
0
 private void fillRandom_Click(object sender, EventArgs e)
 {
     ListLeft.Items.Clear();
     ListRight.Items.Clear();
     ClassSom1.ArrLeft = ClassSom1.FillRandom(n, min, max);
     for (int i = 0; i < ClassSom1.ArrLeft.Length; i++)
     {
         ListLeft.Items.Add(ClassSom1.ArrLeft[i]);
     }
     ClassSom1.ArrRight = ClassSom1.FillRandom(n, min, max);
     for (int i = 0; i < ClassSom1.ArrRight.Length; i++)
     {
         ListRight.Items.Add(ClassSom1.ArrRight[i]);
     }
 }