Hash for checking upload/download, waiting screen

This commit is contained in:
Aurélie Delhaie
2022-06-16 22:44:53 +02:00
parent 24a04e8c02
commit 2a9fd72e14
17 changed files with 691 additions and 80 deletions

View File

@@ -0,0 +1,42 @@
using OpenSaveCloudClient.Core;
using OpenSaveCloudClient.Models;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace OpenSaveCloudClient
{
public partial class WaitingForm : Form
{
private TaskManager taskManager;
bool busy = true;
public WaitingForm()
{
InitializeComponent();
taskManager = TaskManager.GetInstance();
taskManager.TaskChanged += OnTaskChanged;
}
private void WaitingForm_FormClosing(object sender, FormClosingEventArgs e)
{
e.Cancel = busy;
}
private void OnTaskChanged(object? sender, TaskChangedEventArgs e)
{
busy = (taskManager.TasksInformation.Count(ti => ti.Status == AsyncTaskStatus.Running) > 0);
if (!busy)
{
this.Invoke((MethodInvoker)delegate {
Close();
});
}
}
}
}