PrivateSub DisplayMessage(ByVal owner As IWin32Window, ByVal message AsString)
' If the owner is not set or the owner if the current form and it is a MDI Child,
' use the overload with the IWin32Window owner
If owner IsNotNothingThenDim ownerForm As Form = TryCast(Form.FromHandle(owner.Handle), Form)
If ownerForm IsNotNothingAndAlso ownerForm.IsMdiChild = TrueThen
UltraMessageBoxManager.Show(message)
Else
UltraMessageBoxManager.Show(owner, message)
EndIfExit SubEndIf
UltraMessageBoxManager.Show(message)
End Sub
privatevoid DisplayMessage(IWin32Window owner, string message)
{
// If the owner is not set or the owner if the current form and it is a MDI Child,
// use the overload with the IWin32Window owner
if (owner != null)
{
Form ownerForm = Form.FromHandle(owner.Handle) as Form;
if (ownerForm != null &&
ownerForm.IsMdiChild == true)
UltraMessageBoxManager.Show(message);
else
UltraMessageBoxManager.Show(owner, message);
return;
}
UltraMessageBoxManager.Show(message);
}