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
- RootBuilder.cs
- AggregateNode.cs
- PathStreamGeometryContext.cs
- HwndHostAutomationPeer.cs
- PointAnimationBase.cs
- ScalarOps.cs
- LongTypeConverter.cs
- Triangle.cs
- IfAction.cs
- IdleTimeoutMonitor.cs
- DataGridViewRowsAddedEventArgs.cs
- PrimitiveXmlSerializers.cs
- NativeMethodsOther.cs
- ValidatorUtils.cs
- DataBindEngine.cs
- EdmItemError.cs
- ViewStateException.cs
- StateDesigner.Layouts.cs
- NameSpaceExtractor.cs
- EntityTypeEmitter.cs
- XmlCodeExporter.cs
- CollectionView.cs
- UnitySerializationHolder.cs
- CryptoStream.cs
- GridViewRowCollection.cs
- SemanticAnalyzer.cs
- Thickness.cs
- SqlUserDefinedTypeAttribute.cs
- AssemblyNameProxy.cs
- InputLangChangeRequestEvent.cs
- OperationInfo.cs
- AssemblyName.cs
- SafeNativeMethods.cs
- DefaultValueTypeConverter.cs
- QilGeneratorEnv.cs
- SiteMap.cs
- FixedSchema.cs
- StrongTypingException.cs
- ReverseInheritProperty.cs
- MetadataPropertyCollection.cs
- KeyInstance.cs
- XmlSchemaObject.cs
- ReferenceService.cs
- RubberbandSelector.cs
- GeneralTransform2DTo3DTo2D.cs
- IMembershipProvider.cs
- CompressionTransform.cs
- ImmutableCollection.cs
- BlockUIContainer.cs
- NetworkInformationPermission.cs
- EntityDesignerUtils.cs
- DbParameterHelper.cs
- ChangePassword.cs
- DynamicPropertyHolder.cs
- ObjectTag.cs
- DbDeleteCommandTree.cs
- LogicalChannel.cs
- RecognizedAudio.cs
- SHA256.cs
- DefaultTextStoreTextComposition.cs
- EncryptedPackageFilter.cs
- CodeTypeDeclaration.cs
- ListDictionary.cs
- Cursors.cs
- BitmapEffectDrawingContextWalker.cs
- DropSourceBehavior.cs
- ContextStaticAttribute.cs
- DataProviderNameConverter.cs
- FontStretchConverter.cs
- DataGridViewCellValueEventArgs.cs
- QuadraticEase.cs
- __ConsoleStream.cs
- GridViewEditEventArgs.cs
- VariableQuery.cs
- SqlEnums.cs
- CodeSnippetTypeMember.cs
- QilName.cs
- XamlSerializerUtil.cs
- DataPagerCommandEventArgs.cs
- Application.cs
- Misc.cs
- SqlAggregateChecker.cs
- WindowsSecurityTokenAuthenticator.cs
- Converter.cs
- WebRequestModulesSection.cs
- ConfigXmlText.cs
- EncodingNLS.cs
- IgnoreFileBuildProvider.cs
- CellLabel.cs
- XmlDataSource.cs
- Matrix3DValueSerializer.cs
- _OverlappedAsyncResult.cs
- XmlSchemaSimpleContentRestriction.cs
- InternalConfigSettingsFactory.cs
- CollectionTypeElement.cs
- SoapInteropTypes.cs
- GeometryValueSerializer.cs
- IndexerNameAttribute.cs
- PathSegmentCollection.cs
- NullRuntimeConfig.cs