mirror of https://github.com/quasar/Quasar.git
Removed unnecessary ThreadStart
This commit is contained in:
parent
90a4d4a89f
commit
5855fc9adf
|
@ -21,7 +21,7 @@ public static void HandleInitialize(Client client, Initialize packet, FrmMain ma
|
|||
mainForm.ListenServer.AllTimeConnectedClients++;
|
||||
mainForm.UpdateWindowTitle(mainForm.ListenServer.ConnectedClients, mainForm.lstClients.SelectedItems.Count);
|
||||
|
||||
new Thread(new ThreadStart(() =>
|
||||
new Thread(() =>
|
||||
{
|
||||
try
|
||||
{
|
||||
|
@ -52,7 +52,7 @@ public static void HandleInitialize(Client client, Initialize packet, FrmMain ma
|
|||
}
|
||||
catch
|
||||
{ }
|
||||
})).Start();
|
||||
}).Start();
|
||||
}
|
||||
|
||||
private static void ShowPopup(Client c, FrmMain mainForm)
|
||||
|
@ -62,7 +62,7 @@ private static void ShowPopup(Client c, FrmMain mainForm)
|
|||
|
||||
public static void HandleStatus(Client client, Status packet, FrmMain mainForm)
|
||||
{
|
||||
new Thread(new ThreadStart(() =>
|
||||
new Thread(() =>
|
||||
{
|
||||
foreach (ListViewItem lvi in mainForm.lstClients.Items)
|
||||
{
|
||||
|
@ -77,12 +77,12 @@ public static void HandleStatus(Client client, Status packet, FrmMain mainForm)
|
|||
}
|
||||
}
|
||||
|
||||
})).Start();
|
||||
}).Start();
|
||||
}
|
||||
|
||||
public static void HandleUserStatus(Client client, UserStatus packet, FrmMain mainForm)
|
||||
{
|
||||
new Thread(new ThreadStart(() =>
|
||||
new Thread(() =>
|
||||
{
|
||||
foreach (ListViewItem lvi in mainForm.lstClients.Items)
|
||||
{
|
||||
|
@ -97,7 +97,7 @@ public static void HandleUserStatus(Client client, UserStatus packet, FrmMain ma
|
|||
}
|
||||
}
|
||||
|
||||
})).Start();
|
||||
}).Start();
|
||||
}
|
||||
|
||||
public static void HandleRemoteDesktopResponse(Client client, DesktopResponse packet)
|
||||
|
@ -105,35 +105,35 @@ public static void HandleRemoteDesktopResponse(Client client, DesktopResponse pa
|
|||
if (client.Value.FrmRdp == null)
|
||||
return;
|
||||
|
||||
// we can not dispose all bitmaps here, cause they are later used again in `client.Value.LastDesktop`
|
||||
if (client.Value.LastDesktop == null)
|
||||
{
|
||||
using (Bitmap newScreen = (Bitmap)Helper.Helper.CByteToImg(packet.Image))
|
||||
Bitmap newScreen = (Bitmap)Helper.Helper.CByteToImg(packet.Image);
|
||||
client.Value.LastDesktop = newScreen;
|
||||
client.Value.FrmRdp.Invoke((MethodInvoker)delegate
|
||||
{
|
||||
client.Value.LastDesktop = newScreen;
|
||||
client.Value.FrmRdp.Invoke((MethodInvoker)delegate
|
||||
{
|
||||
client.Value.FrmRdp.picDesktop.Image = newScreen;
|
||||
});
|
||||
}
|
||||
client.Value.FrmRdp.picDesktop.Image = newScreen;
|
||||
});
|
||||
newScreen = null;
|
||||
}
|
||||
else
|
||||
{
|
||||
using (Bitmap screen = (Bitmap)Helper.Helper.CByteToImg(packet.Image))
|
||||
using (Bitmap screen = (Bitmap) Helper.Helper.CByteToImg(packet.Image))
|
||||
{
|
||||
using (Bitmap newScreen = new Bitmap(screen.Width, screen.Height))
|
||||
{
|
||||
using (Graphics g = Graphics.FromImage(newScreen))
|
||||
{
|
||||
g.DrawImage(client.Value.LastDesktop, 0, 0, newScreen.Width, newScreen.Height);
|
||||
g.DrawImage(screen, 0, 0, newScreen.Width, newScreen.Height);
|
||||
}
|
||||
Bitmap newScreen = new Bitmap(screen.Width, screen.Height);
|
||||
|
||||
client.Value.LastDesktop = newScreen;
|
||||
client.Value.FrmRdp.Invoke((MethodInvoker)delegate
|
||||
{
|
||||
client.Value.FrmRdp.picDesktop.Image = newScreen;
|
||||
});
|
||||
using (Graphics g = Graphics.FromImage(newScreen))
|
||||
{
|
||||
g.DrawImage(client.Value.LastDesktop, 0, 0, newScreen.Width, newScreen.Height);
|
||||
g.DrawImage(screen, 0, 0, newScreen.Width, newScreen.Height);
|
||||
}
|
||||
|
||||
client.Value.LastDesktop = newScreen;
|
||||
client.Value.FrmRdp.Invoke((MethodInvoker) delegate
|
||||
{
|
||||
client.Value.FrmRdp.picDesktop.Image = newScreen;
|
||||
});
|
||||
newScreen = null;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -151,7 +151,7 @@ public static void HandleGetProcessesResponse(Client client, GetProcessesRespons
|
|||
client.Value.FrmTm.lstTasks.Items.Clear();
|
||||
});
|
||||
|
||||
new Thread(new ThreadStart(() =>
|
||||
new Thread(() =>
|
||||
{
|
||||
for (int i = 0; i < packet.Processes.Length; i++)
|
||||
{
|
||||
|
@ -169,7 +169,7 @@ public static void HandleGetProcessesResponse(Client client, GetProcessesRespons
|
|||
{ break; }
|
||||
}
|
||||
}
|
||||
})).Start();
|
||||
}).Start();
|
||||
}
|
||||
|
||||
public static void HandleDrivesResponse(Client client, DrivesResponse packet)
|
||||
|
@ -195,7 +195,7 @@ public static void HandleDirectoryResponse(Client client, DirectoryResponse pack
|
|||
client.Value.FrmFm.lstDirectory.Items.Clear();
|
||||
});
|
||||
|
||||
new Thread(new ThreadStart(() =>
|
||||
new Thread(() =>
|
||||
{
|
||||
ListViewItem lviBack = new ListViewItem(new string[] { "..", "", "Directory" });
|
||||
lviBack.Tag = "dir";
|
||||
|
@ -254,7 +254,7 @@ public static void HandleDirectoryResponse(Client client, DirectoryResponse pack
|
|||
}
|
||||
|
||||
client.Value.LastDirectorySeen = true;
|
||||
})).Start();
|
||||
}).Start();
|
||||
}
|
||||
|
||||
public static void HandleDownloadFileResponse(Client client, DownloadFileResponse packet)
|
||||
|
@ -290,7 +290,7 @@ public static void HandleDownloadFileResponse(Client client, DownloadFileRespons
|
|||
|
||||
if (Continue)
|
||||
{
|
||||
new Thread(new ThreadStart(() =>
|
||||
new Thread(() =>
|
||||
{
|
||||
try
|
||||
{
|
||||
|
@ -311,7 +311,7 @@ public static void HandleDownloadFileResponse(Client client, DownloadFileRespons
|
|||
}
|
||||
catch
|
||||
{ }
|
||||
})).Start();
|
||||
}).Start();
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -106,7 +106,7 @@ private void ctxtDownload_Click(object sender, EventArgs e)
|
|||
{
|
||||
if (lstDirectory.SelectedItems.Count != 0)
|
||||
{
|
||||
new Thread(new ThreadStart(() =>
|
||||
new Thread(() =>
|
||||
{
|
||||
foreach (ListViewItem files in lstDirectory.SelectedItems)
|
||||
{
|
||||
|
@ -122,9 +122,11 @@ private void ctxtDownload_Click(object sender, EventArgs e)
|
|||
|
||||
new Core.Packets.ServerPackets.DownloadFile(path, ID).Execute(_connectClient);
|
||||
|
||||
ListViewItem lvi = new ListViewItem(new string[] { ID.ToString(), "Downloading...", files.SubItems[0].Text });
|
||||
|
||||
this.Invoke((MethodInvoker)delegate
|
||||
ListViewItem lvi =
|
||||
new ListViewItem(new string[]
|
||||
{ID.ToString(), "Downloading...", files.SubItems[0].Text});
|
||||
|
||||
this.Invoke((MethodInvoker) delegate
|
||||
{
|
||||
lstTransfers.Items.Add(lvi);
|
||||
});
|
||||
|
@ -132,7 +134,7 @@ private void ctxtDownload_Click(object sender, EventArgs e)
|
|||
Thread.Sleep(50);
|
||||
}
|
||||
}
|
||||
})).Start();
|
||||
}).Start();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue