sl@91: using System; sl@91: using System.Collections.Generic; sl@91: using System.ComponentModel; sl@91: using System.Data; sl@91: using System.Drawing; sl@91: using System.Linq; sl@91: using System.Text; sl@91: using System.Windows.Forms; sl@91: sl@91: namespace BackgroundWorkerDemo sl@91: { sl@91: public partial class ProgressForm : Form sl@91: { sl@91: sl@91: #region PROPERTIES sl@91: sl@91: public string Message sl@91: { sl@91: set { labelMessage.Text = value; } sl@91: } sl@91: sl@91: public int ProgressValue sl@91: { sl@91: set { progressBar1.Value = value; } sl@91: } sl@91: sl@91: #endregion sl@91: sl@91: #region METHODS sl@91: sl@91: public ProgressForm() sl@91: { sl@91: InitializeComponent(); sl@91: } sl@91: sl@91: #endregion sl@91: sl@91: #region EVENTS sl@91: sl@91: public event EventHandler Canceled; sl@91: sl@91: private void buttonCancel_Click(object sender, EventArgs e) sl@91: { sl@91: // Create a copy of the event to work with sl@91: EventHandler ea = Canceled; sl@91: /* If there are no subscribers, eh will be null so we need to check sl@91: * to avoid a NullReferenceException. */ sl@91: if (ea != null) sl@91: ea(this, e); sl@91: } sl@91: sl@91: #endregion sl@91: sl@91: } sl@91: }