Server/ProgressForm.cs
author Stephane Lenclud
Fri, 02 Sep 2016 01:38:08 +0200
changeset 267 a601b377a3eb
permissions -rw-r--r--
Event trigger by name now won't trigger disabled events.
     1 using System;
     2 using System.Collections.Generic;
     3 using System.ComponentModel;
     4 using System.Data;
     5 using System.Drawing;
     6 using System.Linq;
     7 using System.Text;
     8 using System.Windows.Forms;
     9 
    10 namespace BackgroundWorkerDemo
    11 {
    12     public partial class ProgressForm : Form
    13     {
    14 
    15         #region PROPERTIES
    16 
    17         public string Message
    18         {
    19             set { labelMessage.Text = value; }
    20         }
    21 
    22         public int ProgressValue
    23         {
    24             set { progressBar1.Value = value; }
    25         }
    26 
    27         #endregion
    28 
    29         #region METHODS
    30 
    31         public ProgressForm()
    32         {
    33             InitializeComponent();
    34         }
    35 
    36         #endregion
    37 
    38         #region EVENTS
    39 
    40         public event EventHandler<EventArgs> Canceled;
    41 
    42         private void buttonCancel_Click(object sender, EventArgs e)
    43         {
    44             // Create a copy of the event to work with
    45             EventHandler<EventArgs> ea = Canceled;
    46             /* If there are no subscribers, eh will be null so we need to check
    47              * to avoid a NullReferenceException. */
    48             if (ea != null)
    49                 ea(this, e);
    50         }
    51 
    52         #endregion
    53 
    54     }
    55 }