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