52 lines
1.4 KiB
C#
52 lines
1.4 KiB
C#
using CloudBuilder.Core.DependencyInjection.Form;
|
|
using CloudBuilder.Core.DependencyInjection.Request;
|
|
using Krypton.Toolkit;
|
|
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;
|
|
using static System.Windows.Forms.VisualStyles.VisualStyleElement;
|
|
|
|
namespace CloudBuilder.Gui
|
|
{
|
|
public partial class ProgressForm : AbstractForm, IForm
|
|
{
|
|
private BackgroundWorker _worker;
|
|
|
|
public ProgressForm(BackgroundWorker worker)
|
|
{
|
|
InitializeComponent();
|
|
|
|
InitResourceManager();
|
|
|
|
this.SetBounds((Screen.GetBounds(this).Width / 2) - (this.Width / 2),
|
|
(Screen.GetBounds(this).Height / 2) - (this.Height / 2),
|
|
this.Width, this.Height, BoundsSpecified.Location);
|
|
|
|
_worker = worker;
|
|
_worker.ProgressChanged += Worker_ProgressChanged;
|
|
_worker.RunWorkerCompleted += Worker_RunWorkerCompleted;
|
|
}
|
|
|
|
|
|
private void Worker_ProgressChanged(object sender, ProgressChangedEventArgs e)
|
|
{
|
|
progressBar.Value = e.ProgressPercentage;
|
|
}
|
|
|
|
private void Worker_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e)
|
|
{
|
|
if (e.Error != null)
|
|
{
|
|
ShowMessageBox.ShowError(e.Error.Message);
|
|
}
|
|
this.Close();
|
|
}
|
|
}
|
|
}
|