void GuiLogger_CFSLog(object o, string txt) { if (this.tbLog.InvokeRequired) { LogUpdateDelegate d = new LogUpdateDelegate(GuiLogger_CFSLog); this.Invoke(d, new object[] { o, txt }); } else { log(txt); } }
public Experiment(int populationSize, int reactions, int reactionDelay, int productMaxLength, float pAtomic, float pAbstraction, int seedMaxLength, bool copyAllowed, bool perturbations, int perturbationsCollisions, int perturbationsObjects, string[] seeds, LogUpdateDelegate logUpdate, Graphics displayG, Bitmap displayBuffer, Color backColor) { PopulationSize = populationSize; Reactions = reactions; ReactionDelay = reactionDelay; ProductMaxLength = productMaxLength; PAtomic = pAtomic; PAbstraction = pAbstraction; SeedMaxLength = seedMaxLength; CopyAllowed = copyAllowed; Perturbations = perturbations; PerturbationsCollisions = perturbationsCollisions; PerturbationsObjects = perturbationsObjects; Seeds = seeds; LogUpdate = logUpdate; DisplayG = displayG; DisplayBuffer = displayBuffer; DisplayBufferG = Graphics.FromImage(DisplayBuffer); DisplayBufferG.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.HighQuality; BackColor = backColor; F10 = new Font("Segoe UI", 10); F12 = new Font("Segoe UI", 12); F16 = new Font("Segoe UI", 16); F32 = new Font("Segoe UI", 32); Background = Color.FromArgb(22, 23, 22); GAverageLength = new Graph2D(3, DisplayBufferG, new RectangleF(240, 10, 220, 150), BackColor, Color.White); GAverageLength.SetComponent(0, "Max length", Color.White); GAverageLength.SetComponent(1, "Mean length", Color.Silver); GAverageLength.SetComponent(2, "Min length", Color.Gray); GDiversity = new Graph2D(1, DisplayBufferG, new RectangleF(470, 10, 220, 150), BackColor, Color.White); GDiversity.SetComponent(0, "Reactor diversity", Color.White); GLengthHistogram = new GraphHistogram("Length distribution", 15, DisplayBufferG, new RectangleF(700, 10, 220, 150), BackColor, Color.White, Color.LightGray); LogUpdate("Reactor initialized", null); }