| 2151 |
ghuddy |
1 |
using System;
|
|
|
2 |
using System.Windows.Forms;
|
|
|
3 |
|
|
|
4 |
namespace EA_ReqPro
|
|
|
5 |
{
|
|
|
6 |
/// <summary>
|
| 2155 |
ghuddy |
7 |
/// A wrapper for MessageBox class, that ensures the TopMost flag is set.
|
|
|
8 |
/// WARNING - this uses an undocumented feature. It might stop working correctly in future
|
|
|
9 |
/// versions of the .NET framework. We need the topmost flag to be set because the reqpro
|
|
|
10 |
/// import/export works as a thread and any message boxes it throws up can get lost behind
|
|
|
11 |
/// EA and other windows if the user is not paying attention to what is going on, or perhaps
|
|
|
12 |
/// is using some other program while the EA window is minimized during a reqpro import/export.
|
| 2151 |
ghuddy |
13 |
/// </summary>
|
|
|
14 |
|
| 2155 |
ghuddy |
15 |
public class MessageBoxEx
|
|
|
16 |
{
|
|
|
17 |
private static int topMost = 0x40000; // .NET v1.1 does not expose this in its MessageBoxOptions enumeration
|
| 2151 |
ghuddy |
18 |
|
|
|
19 |
public static DialogResult Show(string msg)
|
|
|
20 |
{
|
| 2155 |
ghuddy |
21 |
return MessageBox.Show(msg, "", MessageBoxButtons.OK, MessageBoxIcon.None, MessageBoxDefaultButton.Button1, (MessageBoxOptions)topMost);
|
| 2151 |
ghuddy |
22 |
}
|
|
|
23 |
|
|
|
24 |
public static DialogResult Show(string msg, string caption)
|
|
|
25 |
{
|
| 2155 |
ghuddy |
26 |
return MessageBox.Show(msg, caption, MessageBoxButtons.OK, MessageBoxIcon.None, MessageBoxDefaultButton.Button1, (MessageBoxOptions)topMost);
|
| 2151 |
ghuddy |
27 |
}
|
|
|
28 |
|
| 2155 |
ghuddy |
29 |
public static DialogResult Show(string msg, string caption, MessageBoxButtons buttons)
|
| 2151 |
ghuddy |
30 |
{
|
| 2155 |
ghuddy |
31 |
return MessageBox.Show(msg, caption, buttons, MessageBoxIcon.None, MessageBoxDefaultButton.Button1, (MessageBoxOptions)topMost);
|
| 2151 |
ghuddy |
32 |
}
|
|
|
33 |
|
| 2155 |
ghuddy |
34 |
public static DialogResult Show(string msg, string caption, MessageBoxIcon icon)
|
| 2151 |
ghuddy |
35 |
{
|
| 2155 |
ghuddy |
36 |
return MessageBox.Show(msg, caption, MessageBoxButtons.OK, icon, MessageBoxDefaultButton.Button1, (MessageBoxOptions)topMost);
|
| 2151 |
ghuddy |
37 |
}
|
|
|
38 |
|
|
|
39 |
|
| 2155 |
ghuddy |
40 |
}
|
| 2151 |
ghuddy |
41 |
}
|