But how can I do this in this code? [code] private void pictureBox1_Paint(object sender, PaintEventArgs e) { // opvragen van de burst die momenteel gedaan is // dit kan via een methode in de Controller te steken // die controlleerd welke knop (FCFS-SJF) ingedrukt werd // in deze klasse wordt er dan gekeken naar de eindeburst // Dat moet dan doorgestuurd worden naar hier. Graphics g = e.Graphics; String algoritme = cmbSchedule.SelectedItem.ToString(); int burstlengte = 0; switch (algoritme) { case "FCFS": //burstlengte = Controller.GetInstance(ProcessList).Simulatie(ProcessList[0].lijstvanBursts[0]); burstlengte = Controller.GetInstance(ProcessList).Hoeveelburst(ProcessList[0].lijstvanBursts[0].Lengte); foreach (Proces p in ProcessList) { foreach (Burst b in p.lijstvanBursts) { if (Controller.GetInstance(ProcessList).Teller > p.PAankomst + b.Lengte) { // No simulation anymore //burstlengte = 0; //pictureBox1.Update(); } //do //{ // eind(); //} while (Controller.GetInstance(ProcessList).Teller > (p.PAankomst + b.Lengte) || Controller.GetInstance(ProcessList).Teller == (p.PAankomst + b.Lengte)); } } break; case "SJF": //burstlengte = SJF.getInstance().GeordendeLijst[0].lijstvanBursts[0].Lengte; //burstlengte = Controller.GetInstance(ProcessList).Hoeveelburst(SJF.getInstance().GeordendeLijst[0].lijstvanBursts[0].Lengte); break; } // Laat de simulatie niet verder gaan als de burst gedaan is //if (Controller.GetInstance(ProcessList).Teller > burstlengte + ProcessList[0].PAankomst) //{ // burstlengte = 0; //} //int burstlengte = Controller.GetInstance(ProcessList).Simulatie(ProcessList[0].lijs
Anneke
Posts
-
How to freeze an application? -
How to freeze an application?Thank you for your reply. Is there also an oposit of Update()? Something like .Pause()? I've tried somethings out but they aren't right.
-
How to freeze an application?Hi I've made a graphic simulation with a timer. But now I want to stop the simulation (but not disappear) only freeze the simulation. I've already tried to use a do-while-loop but then the application crashes. I've also tried to use a if-loop and in the loop set the length (that the application have to drawn) to zero but it doesn't freeze. I've also tried to use in a if-loop, to call another function which doesn't do anything but this doesn't freeze the application. Also I did this in a do-while-loop but then it crashes. Does someone knows an answer and perhaps knows an example that I can understand what you're trying to say. PS: The simulation is shown in a pictureBox
-
SortedListHi It's not only 2 objects that I have to compare but a whole list. In this list there's a member PAankomst which I have to compare with all the other objects in the list, also with their PAankomst. I've read that IComparer is only for when we have to compare two objects. Now I don't really find a method to compare a member in a list with other members in the same list. I've tried with IComparable<> and then the method CompareTo but it wouldn't work. Any suggestions?
-
SortedListHi All I have a list Proces with PNaam,PNr,PAankomst and PStatus. This is show'n in listbox1. ListBox2 is a list of Burst with lengte and soort. This is of each Proces. Processes can have more Bursts but one Burst can only have one Proces. I have next two listboxes beside each other. In listbox3 I wanted to show PNaam sorted by PAankomst. In Listbox4 I wanted to show PNr, PAankomst, lengte and soort of that one Proces. (The user has to select one PNaam in listbox3 when I read the properties of that PNaam) I've got a class ProcesKlasse with members PNaam,PNr,PAankomst and PStatus. I've got a BurstKlasse with lengte and two inherented subclasses IOBurst and CPUBurst with each a member soort. I don't really know where to put the code. Also I've tried to search on internet but all the sugestions doesn't match... In Form.cs I've tried [code] Proces.Sort(delegate(Proces p1, Proces p2) {return p1.PAankomst.CompareTo(p2.PAankomst);}); [/code] but it can't find the PAankomst (it was private in ProcesKlasse, but even when it's public, I can't reach it) Also I've tried this in ProcesKlasse [code] public List SortedList(List) { for (Proces.PAankomst // can't go further :s } [/code] Is there someone who can give me a hint? Thank you! Anneke