Code:
/ 4.0 / 4.0 / untmp / 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.
Link Menu

This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- ReferencedType.cs
- WorkflowIdleBehavior.cs
- EditingCommands.cs
- GeometryModel3D.cs
- EntityDataSourceView.cs
- EdgeProfileValidation.cs
- SafeFileHandle.cs
- ToolboxComponentsCreatingEventArgs.cs
- ParenthesizePropertyNameAttribute.cs
- InstalledFontCollection.cs
- CacheEntry.cs
- VSWCFServiceContractGenerator.cs
- FrameworkContextData.cs
- WorkflowItemsPresenter.cs
- AutomationPropertyInfo.cs
- AttributeCollection.cs
- ModelProperty.cs
- WebPartTransformerAttribute.cs
- MulticastNotSupportedException.cs
- TypedTableBaseExtensions.cs
- TextEvent.cs
- TraceHandlerErrorFormatter.cs
- WebPartDescription.cs
- SqlGenerator.cs
- PointIndependentAnimationStorage.cs
- LinkedResourceCollection.cs
- ImageProxy.cs
- TraceContextRecord.cs
- InputLanguageProfileNotifySink.cs
- Container.cs
- RegistrationContext.cs
- Bezier.cs
- PieceNameHelper.cs
- TypeUtil.cs
- UserPreferenceChangedEventArgs.cs
- ReadOnlyCollectionBase.cs
- XsltCompileContext.cs
- HelpEvent.cs
- DecimalAverageAggregationOperator.cs
- Property.cs
- SqlRetyper.cs
- Compilation.cs
- dbenumerator.cs
- Msec.cs
- TransactionFlowElement.cs
- BitmapPalettes.cs
- CompilationUnit.cs
- CompilerTypeWithParams.cs
- ConnectionStringsExpressionBuilder.cs
- MULTI_QI.cs
- DateTimeOffsetStorage.cs
- StylusPointPropertyId.cs
- TransformCollection.cs
- ListView.cs
- ExpressionBinding.cs
- NameObjectCollectionBase.cs
- StringArrayConverter.cs
- StylusOverProperty.cs
- ProfileSection.cs
- CommandConverter.cs
- PropertyTabAttribute.cs
- RelatedImageListAttribute.cs
- Base64Encoding.cs
- XmlChildEnumerator.cs
- HandlerFactoryWrapper.cs
- ListView.cs
- TcpChannelHelper.cs
- DbConnectionPoolGroupProviderInfo.cs
- LinqDataSourceInsertEventArgs.cs
- mactripleDES.cs
- HttpRawResponse.cs
- AdCreatedEventArgs.cs
- DynamicPropertyReader.cs
- DelegatingHeader.cs
- ReadOnlyHierarchicalDataSourceView.cs
- MessageQueue.cs
- FocusWithinProperty.cs
- DataControlFieldsEditor.cs
- ControlPropertyNameConverter.cs
- SurrogateEncoder.cs
- DataGridColumnEventArgs.cs
- StringToken.cs
- LinqTreeNodeEvaluator.cs
- ToolStripMenuItemCodeDomSerializer.cs
- Menu.cs
- DateBoldEvent.cs
- SchemaElement.cs
- TypeDescriptionProviderAttribute.cs
- PageRouteHandler.cs
- ToolStripGripRenderEventArgs.cs
- SimpleTextLine.cs
- OdbcCommandBuilder.cs
- NumericExpr.cs
- loginstatus.cs
- TextDecorationUnitValidation.cs
- WorkflowInstanceExtensionCollection.cs
- URL.cs
- AutomationTextAttribute.cs
- DataGridViewSelectedCellCollection.cs
- TextElementCollection.cs