Fixed another cross threading bug

This commit is contained in:
MaxXor 2015-04-06 20:33:00 +02:00
parent aacd1e0f33
commit 29a5a258ea
1 changed files with 30 additions and 32 deletions

View File

@ -1,11 +1,10 @@
using System; using System;
using System.Drawing; using System.Drawing;
using System.IO; using System.IO;
using System.Runtime.InteropServices;
using System.Threading; using System.Threading;
using System.Windows.Forms; using System.Windows.Forms;
using xServer.Core.Extensions;
using xServer.Core.Helper; using xServer.Core.Helper;
using xServer.Core.Misc;
using xServer.Core.Packets.ClientPackets; using xServer.Core.Packets.ClientPackets;
using xServer.Forms; using xServer.Forms;
using xServer.Settings; using xServer.Settings;
@ -91,20 +90,19 @@ public static void HandleStatus(Client client, Status packet)
public static void HandleUserStatus(Client client, UserStatus packet) public static void HandleUserStatus(Client client, UserStatus packet)
{ {
new Thread(() => new Thread(() =>
{
FrmMain.Instance.Invoke((MethodInvoker)delegate
{ {
foreach (ListViewItem lvi in FrmMain.Instance.lstClients.Items) foreach (ListViewItem lvi in FrmMain.Instance.lstClients.Items)
{ {
Client c = (Client)lvi.Tag; Client c = (Client)lvi.Tag;
if (client == c) if (client == c)
{
FrmMain.Instance.Invoke((MethodInvoker)delegate
{ {
lvi.SubItems[4].Text = packet.Message; lvi.SubItems[4].Text = packet.Message;
});
break; break;
} }
} }
});
}).Start(); }).Start();
} }
@ -414,7 +412,7 @@ public static void HandleGetSystemInfoResponse(Client client, GetSystemInfoRespo
} }
}); });
ListViewExtensions.autosizeColumns(client.Value.FrmSi.lstSystem); ListViewExtensions.AutosizeColumns(client.Value.FrmSi.lstSystem);
} }
catch catch
{ } { }