51 lines
1.3 KiB
C#
51 lines
1.3 KiB
C#
using Pf2eDataScrapper.Processors;
|
|
|
|
namespace Pf2eDataScrapper.Forms;
|
|
|
|
internal partial class ProgressForm : Form
|
|
{
|
|
public ProcessProgress Progress { get; }
|
|
|
|
public ProgressForm(ProcessProgress progress)
|
|
{
|
|
Progress = progress;
|
|
|
|
InitializeComponent();
|
|
|
|
Progress.ProgressUpdate += Progress_ProgressUpdate;
|
|
Progress.ProgressMessage += Progress_ProgressMessage;
|
|
}
|
|
|
|
private void Progress_ProgressUpdate(ProcessProgress sender)
|
|
{
|
|
if (InvokeRequired)
|
|
{
|
|
Invoke(Progress_ProgressUpdate, sender);
|
|
return;
|
|
}
|
|
|
|
ProcessorsLabel.Text = sender.Processors.ToString();
|
|
ProcessorsProgressBar.Maximum = sender.Processors.Count;
|
|
ProcessorsProgressBar.Value = sender.Processors.Current;
|
|
|
|
LocalLabel.Text = sender.Local.ToString();
|
|
LocalProgressBar.Maximum = sender.Local.Count;
|
|
LocalProgressBar.Value = sender.Local.Current;
|
|
|
|
Application.DoEvents();
|
|
}
|
|
|
|
private void Progress_ProgressMessage(ProcessProgress sender, string message)
|
|
{
|
|
if (InvokeRequired)
|
|
{
|
|
Invoke(Progress_ProgressMessage, sender, message);
|
|
return;
|
|
}
|
|
|
|
MessageListView.Items.Add(message);
|
|
|
|
Application.DoEvents();
|
|
}
|
|
}
|