private void MoveDown(Task t) { MoveBy(t, 1); }
private void MoveUp(Task t) { MoveBy(t, -1); }
private void MoveBy(Task t, int move) { int listpos = tasks_.IndexOf(t); int newpos = listpos + move; // Is this a valid new position? if (newpos < 0 || newpos >= tasks_.Count) return; int orderpos = t.Order; Task other = tasks_[newpos]; t.Order = other.Order; other.Order = orderpos; tasks_.Move(listpos, newpos); }