From ac5aca6dcaf0a27c8aa8d81e666ed91caa1de2c5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Manuel=20V=C3=B6gele?= Date: Wed, 30 Apr 2014 18:03:20 +0200 Subject: [PATCH] (Hoffentlich) Windows-Fix --- src/Gui/Gui.cs | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/src/Gui/Gui.cs b/src/Gui/Gui.cs index 58e5871..0858fb7 100644 --- a/src/Gui/Gui.cs +++ b/src/Gui/Gui.cs @@ -89,15 +89,18 @@ namespace WorldOfPeacecraft public void PerformRefresh () { - ITile[,] map = Backend.GetMap(); - int mapWidth = (map.GetLength(0)) * tileSize; - int mapHeight = (map.GetLength(1)) * tileSize; - this.SuspendLayout(); - this.SetClientSizeCore(mapWidth, mapHeight); - Board.Size = new Size(mapWidth, mapHeight); - this.ResumeLayout(); - this.PerformLayout(); - this.Refresh(); + this.BeginInvoke(new MethodInvoker(delegate + { + ITile[,] map = Backend.GetMap(); + int mapWidth = (map.GetLength(0)) * tileSize; + int mapHeight = (map.GetLength(1)) * tileSize; + this.SuspendLayout(); + this.SetClientSizeCore(mapWidth, mapHeight); + Board.Size = new Size(mapWidth, mapHeight); + this.ResumeLayout(); + this.PerformLayout(); + this.Refresh(); + })); } [DllImport("kernel32.dll", SetLastError = true)]