//CONSTRUCTOR /*TODO(get buddySystem List through constructor) constructor with parameters is somehow not possible. give buddySystem List to constructor*/ public BuddySystemViewCell() { //note: List<BuddySystemBlock> buddySystem = BuddySystem.buddySystem would not copy the list //note: buddySystem = new List<BuddySystemBlock>(BuddySystem.buddySystem); would not create new references //since the paintsurface method get's called several times, even after the object was created, //there has to be a constant copy of the original list at the time //and since the upper way of copying the list keeps the same references to the original buddysystemblock objects //it has to be copied manually List <BuddySystemBlock> original = new List <BuddySystemBlock>(BuddySystem.buddySystem); buddySystem = new List <BuddySystemBlock>(); for (int i = 0; i < original.Count; i++) { BuddySystemBlock b = new BuddySystemBlock( original[i].GetBlockSize(), original[i].GetBuddyNo()); if (original[i].GetFree() == false) { b.OccupyBlock( original[i].GetProcessName(), original[i].GetProcessSize()); } buddySystem.Add(b); } this.processName = BuddySystem.currentProcess; this.endProcess = BuddySystem.endProcess; // crate the canvas skiaview = new SKCanvasView(); skiaview.PaintSurface += PaintSurface; //changing background color for better clarity if (dari % 2 == 0) { skiaview.BackgroundColor = App._viewBackground; } else { skiaview.BackgroundColor = App._viewBackground; } dari++; // assign the canvas to the cell this.View = skiaview; }