public int CompareTo(object obj) { QueueStructLight that = (QueueStructLight)obj; if (this.nStatus < that.nStatus) { return(-1); } if (this.nStatus > that.nStatus) { return(1); } return(0); }
//Returns the queue for display in front public ArrayList GetQueue() { ArrayList aTempList = new ArrayList(); //Loop through for (int i = 0; i < aQueue.Count; i++) { QueueStructLight aLight = new QueueStructLight(); aLight.nQueueID = ((QueueStruct)aQueue[i]).nQueueID; aLight.nStatus = ((QueueStruct)aQueue[i]).nStatus; switch (aLight.nStatus) { case QueueStatus.FINISHED: aLight.sDisplayStatus = "Finished"; break; case QueueStatus.FINISHEDANDFAIL: aLight.sDisplayStatus = "Finished and failed"; break; case QueueStatus.NOT_RUNNING: aLight.sDisplayStatus = "Not running"; break; case QueueStatus.RUNNING: aLight.sDisplayStatus = "Running"; break; } aLight.sDisplayDirectory = ((QueueStruct)aQueue[i]).sDisplayDirectory; aLight.sDisplayName = ((QueueStruct)aQueue[i]).sDisplayName; aLight.sHandbrakeProfile = ((QueueStruct)aQueue[i]).sHandbrakeProfile; aLight.iProcentage = ((QueueStruct)aQueue[i]).iProcentage; aLight.sETA = ((QueueStruct)aQueue[i]).sETA; aTempList.Add(aLight); } //Now sort the bastard aTempList.Sort(); return(aTempList); }