Subversion Repositories Code-Repo

Rev

Rev 63 | Details | Compare with Previous | 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
        }
36
        private void btn_Cancel_Click(object sender, EventArgs e)
37
        {
38
            Reimage_USB_Drives.bwThread.CancelAsync();
39
            foreach (BackgroundWorker bw in Reimage_USB_Drives.backgroundWorkerList)
40
                bw.CancelAsync();
41
            btn_Cancel.Text = "Cancellation Pending";
42
        }
43
        delegate void updateStatus_(string parameter);
44
        public void updateStatus(string status)
45
        {
46
            try
47
            {
48
                if (!InvokeRequired)
49
                {
50
                    lbl_Status.Text = status;
51
                }
52
                else
53
                    Invoke(new updateStatus_(updateStatus), new object[] { status });
54
            }
55
            catch (Exception e)
56
            {
53 Kevin 57
                //MessageBox.Show(e.ToString(), "Error");
63 Kevin 58
                Debug.appendText(e.ToString());
53 Kevin 59
                MessageBox.Show("An error has occured. Please notify a supervisor to debug.", "Error");
9 Kevin 60
            }
61
        }
62
        delegate void closeForm_();
63
        public void closeForm()
64
        {
65
            try
66
            {
67
                if (!InvokeRequired)
68
                {
69
                    this.Close();
70
                }
71
                else
72
                    Invoke(new closeForm_(closeForm), new object[] { });
73
            }
74
            catch (Exception e)
75
            {
53 Kevin 76
                //MessageBox.Show(e.ToString(), "Error");
63 Kevin 77
                Debug.appendText(e.ToString());
53 Kevin 78
                MessageBox.Show("An error has occured. Please notify a supervisor to debug.", "Error");
9 Kevin 79
            }
80
        }
81
    }
82
}