Thread pool
This commit is contained in:
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -47,7 +47,7 @@ namespace OpenSaveCloudClient
|
|||||||
private void button1_Click(object sender, EventArgs e)
|
private void button1_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
LockControls(true);
|
LockControls(true);
|
||||||
new Thread(() =>
|
ThreadPool.QueueUserWorkItem(delegate
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
@@ -78,7 +78,7 @@ namespace OpenSaveCloudClient
|
|||||||
LockControls(false);
|
LockControls(false);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}).Start();
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
private void LockControls(bool value)
|
private void LockControls(bool value)
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ namespace OpenSaveCloudClient.Core
|
|||||||
{
|
{
|
||||||
saves = new List<GameSave>();
|
saves = new List<GameSave>();
|
||||||
Load();
|
Load();
|
||||||
new Thread(() => CleanArchiveFolder()).Start();
|
ThreadPool.QueueUserWorkItem(delegate { CleanArchiveFolder(); });
|
||||||
}
|
}
|
||||||
|
|
||||||
public static SaveManager GetInstance()
|
public static SaveManager GetInstance()
|
||||||
|
|||||||
@@ -34,12 +34,12 @@ namespace OpenSaveCloudClient
|
|||||||
|
|
||||||
private void DownloadGameForm_Load(object sender, EventArgs e)
|
private void DownloadGameForm_Load(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
new Thread(() => {
|
ThreadPool.QueueUserWorkItem(delegate {
|
||||||
List<Game>? remoteGames = serverConnector.GetGamesInfo();
|
List<Game>? remoteGames = serverConnector.GetGamesInfo();
|
||||||
this.Invoke((MethodInvoker)delegate {
|
this.Invoke((MethodInvoker)delegate {
|
||||||
UpdateRemoteList(remoteGames);
|
UpdateRemoteList(remoteGames);
|
||||||
});
|
});
|
||||||
}).Start();
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
private void UpdateRemoteList(List<Game>? remoteGames)
|
private void UpdateRemoteList(List<Game>? remoteGames)
|
||||||
|
|||||||
@@ -37,7 +37,7 @@ namespace OpenSaveCloudClient
|
|||||||
taskManager.TaskChanged += taskManager_TaskChanged;
|
taskManager.TaskChanged += taskManager_TaskChanged;
|
||||||
logManager.Cleared += LogManager_LogCleared;
|
logManager.Cleared += LogManager_LogCleared;
|
||||||
logManager.NewMessage += LogManager_NewMessage;
|
logManager.NewMessage += LogManager_NewMessage;
|
||||||
new Thread(() =>
|
ThreadPool.QueueUserWorkItem(delegate
|
||||||
{
|
{
|
||||||
this.Invoke((MethodInvoker)delegate {
|
this.Invoke((MethodInvoker)delegate {
|
||||||
CheckPaths();
|
CheckPaths();
|
||||||
@@ -75,7 +75,7 @@ namespace OpenSaveCloudClient
|
|||||||
SetTaskFailed(taskUuid);
|
SetTaskFailed(taskUuid);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}).Start();
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
private void CheckPaths()
|
private void CheckPaths()
|
||||||
@@ -124,7 +124,7 @@ namespace OpenSaveCloudClient
|
|||||||
Close();
|
Close();
|
||||||
} else
|
} else
|
||||||
{
|
{
|
||||||
new Thread(() =>
|
ThreadPool.QueueUserWorkItem(delegate
|
||||||
{
|
{
|
||||||
string taskUuid = StartTask("Detecting changes...", true, 1);
|
string taskUuid = StartTask("Detecting changes...", true, 1);
|
||||||
try
|
try
|
||||||
@@ -137,7 +137,7 @@ namespace OpenSaveCloudClient
|
|||||||
logManager.AddError(e);
|
logManager.AddError(e);
|
||||||
SetTaskFailed(taskUuid);
|
SetTaskFailed(taskUuid);
|
||||||
}
|
}
|
||||||
}).Start();
|
});
|
||||||
SetAdminControls();
|
SetAdminControls();
|
||||||
Enabled = true;
|
Enabled = true;
|
||||||
AboutButton.Enabled = true;
|
AboutButton.Enabled = true;
|
||||||
@@ -171,7 +171,7 @@ namespace OpenSaveCloudClient
|
|||||||
AddGameForm form = new(_client);
|
AddGameForm form = new(_client);
|
||||||
if (form.ShowDialog() == DialogResult.OK) {
|
if (form.ShowDialog() == DialogResult.OK) {
|
||||||
GameSave newGame = form.Result;
|
GameSave newGame = form.Result;
|
||||||
new Thread(() => AddGameToLibrary(newGame)).Start();
|
ThreadPool.QueueUserWorkItem(delegate { AddGameToLibrary(newGame); });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -335,12 +335,12 @@ namespace OpenSaveCloudClient
|
|||||||
private void SyncButton_Click(object sender, EventArgs e)
|
private void SyncButton_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
LockCriticalControls(true);
|
LockCriticalControls(true);
|
||||||
new Thread(() => {
|
ThreadPool.QueueUserWorkItem(delegate {
|
||||||
serverConnector.Synchronize();
|
serverConnector.Synchronize();
|
||||||
this.Invoke((MethodInvoker)delegate {
|
this.Invoke((MethodInvoker)delegate {
|
||||||
LockCriticalControls(false);
|
LockCriticalControls(false);
|
||||||
});
|
});
|
||||||
}).Start();
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
private void DownloadButton_Click(object sender, EventArgs e)
|
private void DownloadButton_Click(object sender, EventArgs e)
|
||||||
|
|||||||
@@ -37,7 +37,7 @@ namespace OpenSaveCloudClient
|
|||||||
LockControls(false);
|
LockControls(false);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
new Thread(() =>
|
ThreadPool.QueueUserWorkItem(delegate
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
@@ -88,7 +88,7 @@ namespace OpenSaveCloudClient
|
|||||||
LockControls(false);
|
LockControls(false);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}).Start();
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
private void LockControls(bool value)
|
private void LockControls(bool value)
|
||||||
|
|||||||
@@ -58,7 +58,7 @@ namespace OpenSaveCloudClient
|
|||||||
LockControls(false);
|
LockControls(false);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
new Thread(() =>
|
ThreadPool.QueueUserWorkItem(delegate
|
||||||
{
|
{
|
||||||
serverConnector.ChangePassword(new NewPassword { Password = NewPasswordBox.Text, VerifyPassword = PasswordAgainBox.Text });
|
serverConnector.ChangePassword(new NewPassword { Password = NewPasswordBox.Text, VerifyPassword = PasswordAgainBox.Text });
|
||||||
this.Invoke((MethodInvoker)delegate {
|
this.Invoke((MethodInvoker)delegate {
|
||||||
@@ -66,7 +66,7 @@ namespace OpenSaveCloudClient
|
|||||||
PasswordAgainBox.Clear();
|
PasswordAgainBox.Clear();
|
||||||
LockControls(false);
|
LockControls(false);
|
||||||
});
|
});
|
||||||
}).Start();
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
private void LockControls(bool l)
|
private void LockControls(bool l)
|
||||||
|
|||||||
@@ -36,7 +36,7 @@ namespace OpenSaveCloudClient
|
|||||||
|
|
||||||
private void LoadUsers()
|
private void LoadUsers()
|
||||||
{
|
{
|
||||||
new Thread(() =>
|
ThreadPool.QueueUserWorkItem(delegate
|
||||||
{
|
{
|
||||||
List<User>? users = serverConnector.GetUsers();
|
List<User>? users = serverConnector.GetUsers();
|
||||||
if (users != null)
|
if (users != null)
|
||||||
@@ -45,7 +45,7 @@ namespace OpenSaveCloudClient
|
|||||||
UpdateRemoteList(users);
|
UpdateRemoteList(users);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}).Start();
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
private void UpdateRemoteList(List<User> users)
|
private void UpdateRemoteList(List<User> users)
|
||||||
@@ -107,7 +107,7 @@ namespace OpenSaveCloudClient
|
|||||||
long userId = Convert.ToInt64(item.SubItems[1].Text);
|
long userId = Convert.ToInt64(item.SubItems[1].Text);
|
||||||
ids.Add(userId);
|
ids.Add(userId);
|
||||||
}
|
}
|
||||||
new Thread(() =>
|
ThreadPool.QueueUserWorkItem(delegate
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
@@ -134,7 +134,7 @@ namespace OpenSaveCloudClient
|
|||||||
LockControls(false);
|
LockControls(false);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}).Start();
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user