Code:
/ 4.0 / 4.0 / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / fx / src / DataWebControlsDesign / System / Data / WebControls / Design / Util / UIHelper.cs / 1305376 / UIHelper.cs
//------------------------------------------------------------------------------
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
//
// @owner [....]
// @backupOwner [....]
//
// Helper methods for UI functionality like displaying dialogs
//-----------------------------------------------------------------------------
using System.Collections;
using System.Drawing;
using System.Windows.Forms;
using System.Windows.Forms.Design;
namespace System.Web.UI.Design.WebControls.Util
{
internal static class UIHelper
{
internal static Font GetDialogFont(IServiceProvider serviceProvider)
{
if (serviceProvider != null)
{
IUIService uiService = (IUIService)serviceProvider.GetService(typeof(IUIService));
if (uiService != null)
{
IDictionary uiStyles = uiService.Styles;
if (uiStyles != null)
{
return (Font)uiStyles["DialogFont"];
}
}
}
return null;
}
internal static DialogResult ShowDialog(IServiceProvider serviceProvider, Form form)
{
if (serviceProvider != null)
{
IUIService uiService = (IUIService)serviceProvider.GetService(typeof(IUIService));
if (uiService != null)
{
return uiService.ShowDialog(form);
}
}
return form.ShowDialog();
}
public static void ShowError(IServiceProvider serviceProvider, string message)
{
if (serviceProvider != null)
{
IUIService uiService = (IUIService)serviceProvider.GetService(typeof(IUIService));
if (uiService != null)
{
uiService.ShowError(message);
return;
}
}
RTLAwareMessageBox.Show(null, message, Strings.UIHelper_ErrorCaption, MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1, 0);
}
public static void ShowWarning(IServiceProvider serviceProvider, string message)
{
if (serviceProvider != null)
{
IUIService uiService = (IUIService)serviceProvider.GetService(typeof(IUIService));
if (uiService != null)
{
uiService.ShowError(message);
return;
}
}
RTLAwareMessageBox.Show(null, message, Strings.UIHelper_WarningCaption, MessageBoxButtons.OK, MessageBoxIcon.Warning, MessageBoxDefaultButton.Button1, 0);
}
}
}
// File provided for Reference Use Only by Microsoft Corporation (c) 2007.
//------------------------------------------------------------------------------
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
//
// @owner [....]
// @backupOwner [....]
//
// Helper methods for UI functionality like displaying dialogs
//-----------------------------------------------------------------------------
using System.Collections;
using System.Drawing;
using System.Windows.Forms;
using System.Windows.Forms.Design;
namespace System.Web.UI.Design.WebControls.Util
{
internal static class UIHelper
{
internal static Font GetDialogFont(IServiceProvider serviceProvider)
{
if (serviceProvider != null)
{
IUIService uiService = (IUIService)serviceProvider.GetService(typeof(IUIService));
if (uiService != null)
{
IDictionary uiStyles = uiService.Styles;
if (uiStyles != null)
{
return (Font)uiStyles["DialogFont"];
}
}
}
return null;
}
internal static DialogResult ShowDialog(IServiceProvider serviceProvider, Form form)
{
if (serviceProvider != null)
{
IUIService uiService = (IUIService)serviceProvider.GetService(typeof(IUIService));
if (uiService != null)
{
return uiService.ShowDialog(form);
}
}
return form.ShowDialog();
}
public static void ShowError(IServiceProvider serviceProvider, string message)
{
if (serviceProvider != null)
{
IUIService uiService = (IUIService)serviceProvider.GetService(typeof(IUIService));
if (uiService != null)
{
uiService.ShowError(message);
return;
}
}
RTLAwareMessageBox.Show(null, message, Strings.UIHelper_ErrorCaption, MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1, 0);
}
public static void ShowWarning(IServiceProvider serviceProvider, string message)
{
if (serviceProvider != null)
{
IUIService uiService = (IUIService)serviceProvider.GetService(typeof(IUIService));
if (uiService != null)
{
uiService.ShowError(message);
return;
}
}
RTLAwareMessageBox.Show(null, message, Strings.UIHelper_WarningCaption, MessageBoxButtons.OK, MessageBoxIcon.Warning, MessageBoxDefaultButton.Button1, 0);
}
}
}
// File provided for Reference Use Only by Microsoft Corporation (c) 2007.
Link Menu

This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- ObjectTypeMapping.cs
- Translator.cs
- StorageComplexPropertyMapping.cs
- GPRECT.cs
- DesignerActionPropertyItem.cs
- AnonymousIdentificationSection.cs
- Walker.cs
- BindMarkupExtensionSerializer.cs
- RandomNumberGenerator.cs
- MsmqIntegrationProcessProtocolHandler.cs
- IPCCacheManager.cs
- TypeGeneratedEventArgs.cs
- BackgroundFormatInfo.cs
- WindowsAltTab.cs
- ThreadStartException.cs
- QuaternionAnimation.cs
- ConfigurationManagerInternal.cs
- ObfuscationAttribute.cs
- AdapterDictionary.cs
- HtmlTitle.cs
- XamlUtilities.cs
- ClientScriptManagerWrapper.cs
- MultitargetingHelpers.cs
- Environment.cs
- PeerNameRecord.cs
- TypePropertyEditor.cs
- ConnectionInterfaceCollection.cs
- ToolStripRenderer.cs
- SemanticKeyElement.cs
- ImageSourceValueSerializer.cs
- SubpageParagraph.cs
- reliableinputsessionchannel.cs
- RadioButtonDesigner.cs
- Serializer.cs
- SchemaNotation.cs
- UnsafeNativeMethods.cs
- NotificationContext.cs
- ActivityInstance.cs
- SharedPerformanceCounter.cs
- DependencyProperty.cs
- UriTemplateDispatchFormatter.cs
- InputLanguageCollection.cs
- CqlQuery.cs
- XmlSchemaAnyAttribute.cs
- CreateRefExpr.cs
- MatrixAnimationBase.cs
- SrgsSubset.cs
- DesignerActionTextItem.cs
- TextStore.cs
- DbProviderSpecificTypePropertyAttribute.cs
- AsyncCompletedEventArgs.cs
- PropertySourceInfo.cs
- ExtendedPropertiesHandler.cs
- ArrayTypeMismatchException.cs
- RoleService.cs
- QuaternionRotation3D.cs
- OleDbDataAdapter.cs
- WebPartEditorCancelVerb.cs
- RelationshipNavigation.cs
- RtfControls.cs
- HealthMonitoringSectionHelper.cs
- InheritanceAttribute.cs
- XmlUrlResolver.cs
- ArcSegment.cs
- OrCondition.cs
- NodeInfo.cs
- UnsafeNativeMethods.cs
- DataGridHeaderBorder.cs
- DataGridViewElement.cs
- SecurityAppliedMessage.cs
- WebPartDisplayModeEventArgs.cs
- SiteMapDataSourceView.cs
- AlternationConverter.cs
- ContextMarshalException.cs
- ThreadPoolTaskScheduler.cs
- XmlWriterSettings.cs
- ReliableSessionBindingElement.cs
- ThreadExceptionDialog.cs
- ValidationRuleCollection.cs
- SqlDataSourceQueryEditor.cs
- WebResponse.cs
- DecodeHelper.cs
- CodeIdentifier.cs
- FixedPageAutomationPeer.cs
- OdbcErrorCollection.cs
- WebException.cs
- VisualStyleInformation.cs
- SupportingTokenDuplexChannel.cs
- TypeSource.cs
- DesignerCategoryAttribute.cs
- ScrollPatternIdentifiers.cs
- ThreadStateException.cs
- SynchronizationContext.cs
- PlacementWorkspace.cs
- RepeatInfo.cs
- ManagementQuery.cs
- CodeMemberMethod.cs
- FlatButtonAppearance.cs
- Comparer.cs
- ObjectDataSourceSelectingEventArgs.cs