1
//------------------------------------------------------------------------------
2 // <copyright file="UIHelper.cs" company="Microsoft">
3 // Copyright (c) Microsoft Corporation. All rights reserved.
7 // @backupOwner Microsoft
9 // Helper methods for UI functionality like displaying dialogs
10 //------------------------------------------------------------------------------
12 using System
.Collections
;
14 using System
.Windows
.Forms
;
15 using System
.Windows
.Forms
.Design
;
17 namespace System
.Web
.UI
.Design
.WebControls
.Util
19 internal static class UIHelper
21 internal static Font
GetDialogFont(IServiceProvider serviceProvider
)
23 if (serviceProvider
!= null)
25 IUIService uiService
= (IUIService
)serviceProvider
.GetService(typeof(IUIService
));
26 if (uiService
!= null)
28 IDictionary uiStyles
= uiService
.Styles
;
31 return (Font
)uiStyles
["DialogFont"];
38 internal static DialogResult
ShowDialog(IServiceProvider serviceProvider
, Form form
)
40 if (serviceProvider
!= null)
42 IUIService uiService
= (IUIService
)serviceProvider
.GetService(typeof(IUIService
));
43 if (uiService
!= null)
45 return uiService
.ShowDialog(form
);
49 return form
.ShowDialog();
52 public static void ShowError(IServiceProvider serviceProvider
, string message
)
54 if (serviceProvider
!= null)
56 IUIService uiService
= (IUIService
)serviceProvider
.GetService(typeof(IUIService
));
57 if (uiService
!= null)
59 uiService
.ShowError(message
);
64 RTLAwareMessageBox
.Show(null, message
, Strings
.UIHelper_ErrorCaption
, MessageBoxButtons
.OK
, MessageBoxIcon
.Error
, MessageBoxDefaultButton
.Button1
, 0);
67 public static void ShowWarning(IServiceProvider serviceProvider
, string message
)
69 if (serviceProvider
!= null)
71 IUIService uiService
= (IUIService
)serviceProvider
.GetService(typeof(IUIService
));
72 if (uiService
!= null)
74 uiService
.ShowError(message
);
79 RTLAwareMessageBox
.Show(null, message
, Strings
.UIHelper_WarningCaption
, MessageBoxButtons
.OK
, MessageBoxIcon
.Warning
, MessageBoxDefaultButton
.Button1
, 0);