/// <summary> /// Initializes class and components /// </summary> protected override void Initialize() { this.Components.Add(this.colorStream); base.Initialize(); System.Random random = new System.Random(); this.Components.Add(new Button(new Rectangle(colorStream.drawRectangle.Left, colorStream.drawRectangle.Bottom + 20, colorStream.drawRectangle.Width, 60), "Undo", udisplay.Revert, spriteBatch, this)); for (int i = 0; i < 3; i++) { for (int j = 0; j < 3; j++) { if (i * 3 + j >= delList.Count) { break; } /*if (delList.Count == 0) break; * UserDisplay.StateManipDel selDel = delList[ (int)(delList.Count * random.NextDouble())]; * delList.Remove(selDel);*/ ScreenDisplay tsd = new ScreenDisplay (new Vector2(colorStream.drawRectangle.Right + 10 + 240 * j + 5 * (j + 1), 200 * i + 5 * (i + 1)), this, spriteBatch, labelList[i * 3 + j], /*selDel*/ delList[i * 3 + j]); this.Components.Add(tsd); } } }
protected override void OnExiting(object sender, EventArgs args) { foreach (DrawableGameComponent dgc in Components) { if (dgc is ScreenDisplay) { ScreenDisplay sd = (ScreenDisplay)(dgc); Console.Out.WriteLine("Writing " + sd.label); sd.WriteDataToFile(); } } base.OnExiting(sender, args); }