Exemplo n.º 1
0
 private static int CompareWreckage(Wreckage w1, Wreckage w2)
 {
     if (w1.Value < w2.Value)
     {
         return(1);
     }
     else if (w1.Value > w2.Value)
     {
         return(-1);
     }
     else
     {
         return(0);
     }
 }
Exemplo n.º 2
0
        private Wreckage[] GetSelectedWreckages()
        {
            List <Wreckage> selList = new List <Wreckage>();

            for (int i = 0; i < dgvWreckagesTable.Rows.Count; i++)
            {
                DataGridViewRow row    = dgvWreckagesTable.Rows[i];
                int             maxNum = int.Parse(row.Cells[2].Value.ToString());
                if (maxNum > 0)
                {
                    Wreckage wreckage = new Wreckage((int)row.Cells[1].Value, maxNum);
                    selList.Add(wreckage);
                }
            }
            selList.Sort(CompareWreckage);

            Wreckage[] arr = new Wreckage[selList.Count];
            selList.CopyTo(arr);
            return(arr);
        }