예제 #1
0
 private void AddButton_Click(object sender, EventArgs e)
 {
     if (int.TryParse(AddTextBox.Text, out int value))
     {
         var item = new SortedItem(value, items.Count);
         items.Add(item);
     }
     RefreshItems();
     AddTextBox.Text = "";
 }
예제 #2
0
 private void AddRandom_Click(object sender, EventArgs e)
 {
     if (int.TryParse(AddRandomTextBox.Text, out int value))
     {
         var rnd = new Random();
         for (int i = 0; i < value; i++)
         {
             var item = new SortedItem(rnd.Next(100), items.Count);
             items.Add(item);
         }
     }
     RefreshItems();
     AddRandomTextBox.Text = "";
 }
예제 #3
0
 private void Swap(SortedItem a, SortedItem b)
 {
     a.SetColor(Color.Red);
     b.SetColor(Color.Green);
 }