1 public class Forms
2 {
3 #region ~VERSION HISTORY ...
4
5 /*==================================================================
6 DATE CREATED: 05.12.2004
7 CREATED BY: ERIC RITZIE
8
9 NOTES:
10
11 HISTORY:
12 05.12.2004 ER INITIAL CREATION
13 ==================================================================*/
14 #endregion
15 #region CONTRUCTORS ...
16
17
18 public Forms()
19 {
20 //
21 // TODO: Add constructor logic here
22 //
23 }
24 #endregion
25 #region DECONSTRUCTORS ...
26
27
28 // Implement IDisposable.
29 // Do not make this method virtual.
30 // A derived class should not be able to override this method.
31 public void Dispose()
32 {
33 Dispose(true);
34
35 // Take yourself off the Finalization queue to prevent finalization code for the object
36 // from executing a second time.
37 GC.SuppressFinalize(this);
38 }
39
40 // Dispose (bool disposing) executes in two distinct scenarios.
41 // If disposing equals true, the method has been called directly or indirectly by a user's code.
42 // Managed and unmanaged resources can be disposed.
43 // If disposing equals false, the method has been called by the runtime from inside the
44 // finalizer and you should not reference other objects. Only unmanaged resources can be disposed.
45 protected virtual void Dispose(bool disposing)
46 {
47 // Check to see if Dispose has already been called.
48 if (!this.disposed)
49 {
50 // If disposing equals true, dispose all managed and unmanaged resources.
51 if (disposing)
52 {
53 // Dispose managed resources.
54 //Components.Dispose();
55 }
56
57 // Release unmanaged resources. If disposing is false, only the following code is executed.
58 //CloseHandle(handle);
59 //handle = IntPtr.Zero;
60
61 // Note that this is not thread safe.
62 // Another thread could start disposing the object after the managed resources are disposed,
63 // but before the disposed flag is set to true.
64 // If thread safety is necessary, it must be implented by the client.
65 }
66 this.disposed = true;
67 }
68
69 // Use C# destructor syntax for finalization code.
70 // This destructor will run only if the Dispose method does not get called.
71 // It gives your code class the opportunity to finalize.
72 // Do not provide destructors in type derived from this class.
73 ~Forms()
74 {
75 // Do not re-create Dispose clean-up code here.
76 // Calling Dispose(false) is optimal in terms of readability and maintainability.
77 Dispose(false);
78 }
79 #endregion
80 #region PRIVATE VARIABLES ...
81
82
83 private bool disposed = false;
84 #endregion
85 #region PUBLIC METHODS ...
86
87
88 public bool IsFormActive(Form f)
89 {
90 bool Status = false;
91
92 //* Check if Form is already open, if so then bring it to the front
93 if ((f != null) && (f != _Main.ActiveMdiChild))
94 {
95 f.Activate();
96 Status = true;
97 }
98
99 return Status;
100 }
101
102 public bool IsChildFormActive(string Title)
103 {
104 bool Status = false;
105
106 foreach (Form child in _Main.MdiChildren)
107 {
108 if (child.Text == Title)
109 {
110 child.Activate();
111 Status = true;
112 break;
113 }
114 }
115
116 return Status;
117 }
118
119 public bool IsChildFormActive(object Tag)
120 {
121 bool Status = false;
122
123 foreach (Form child in _Main.MdiChildren)
124 {
125 if (child.Tag.ToString() == Tag.ToString())
126 {
127 child.Activate();
128 Status = true;
129 break;
130 }
131 }
132
133 return Status;
134 }
135 public bool IsChildFormActive(string Title, object Tag)
136 {
137 bool Status = false;
138
139 foreach (Form child in _Main.MdiChildren)
140 {
141 if (child.Text == Title)
142 {
143 if (child.Tag.ToString() == Tag.ToString())
144 {
145 child.Activate();
146 Status = true;
147 break;
148 }
149 }
150 }
151
152 return Status;
153 }
154 #endregion
155
156 }