Subversion Repositories Code-Repo

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
9 Kevin 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 SWAT_Office_App
11
{
12
    public partial class Reimage_USB_Drive_Progress_Form : Form
13
    {
14
 
15
        private static Reimage_USB_Drive_Progress_Form _Reimage_USB_Drive_Progress_Form = null;
16
        // Singleton instance
17
        public static Reimage_USB_Drive_Progress_Form Reimage_USB_Drive_Progress_Form_Instance
18
        {
19
            set
20
            {
21
                _Reimage_USB_Drive_Progress_Form = value;
22
            }
23
            get
24
            {
25
                if (_Reimage_USB_Drive_Progress_Form == null)
26
                    _Reimage_USB_Drive_Progress_Form = new Reimage_USB_Drive_Progress_Form();
27
                return _Reimage_USB_Drive_Progress_Form;
28
            }
29
        }
30
        public Reimage_USB_Drive_Progress_Form()
31
        {
32
            InitializeComponent();
33
            btn_Cancel.Text = "Cancel";
34
            this.updateStatus("Beginning the Reimaging of USB Drives");
35
            //this.updateStatus("Beginning the Reimaging of USB Drives Beginning the Reimaging of USB Drives Beginning the Reimaging of USB Drives Beginning the Reimaging of USB Drives Beginning the Reimaging of USB Drives Beginning the Reimaging of USB Drives Beginning the Reimaging of USB Drives");
36
        }
37
        private void btn_Cancel_Click(object sender, EventArgs e)
38
        {
39
            Reimage_USB_Drives.bwThread.CancelAsync();
40
            foreach (BackgroundWorker bw in Reimage_USB_Drives.backgroundWorkerList)
41
                bw.CancelAsync();
42
            btn_Cancel.Text = "Cancellation Pending";
43
        }
44
        delegate void updateStatus_(string parameter);
45
        public void updateStatus(string status)
46
        {
47
            try
48
            {
49
                if (!InvokeRequired)
50
                {
51
                    lbl_Status.Text = status;
52
                }
53
                else
54
                    Invoke(new updateStatus_(updateStatus), new object[] { status });
55
            }
56
            catch (Exception e)
57
            {
58
                MessageBox.Show(e.ToString());
59
            }
60
        }
61
        delegate void closeForm_();
62
        public void closeForm()
63
        {
64
            try
65
            {
66
                if (!InvokeRequired)
67
                {
68
                    this.Close();
69
                }
70
                else
71
                    Invoke(new closeForm_(closeForm), new object[] { });
72
            }
73
            catch (Exception e)
74
            {
75
                MessageBox.Show(e.ToString());
76
            }
77
        }
78
    }
79
}