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
- PackWebResponse.cs
- AddInProcess.cs
- WebPartEditorCancelVerb.cs
- SequenceFullException.cs
- TypeResolvingOptionsAttribute.cs
- X509CertificateTokenFactoryCredential.cs
- IdentityManager.cs
- DocumentPageHost.cs
- LineProperties.cs
- UdpAnnouncementEndpoint.cs
- GroupQuery.cs
- TemplateBaseAction.cs
- TypeConvertions.cs
- ReadOnlyDictionary.cs
- BlockCollection.cs
- TreeNodeCollection.cs
- BuildProviderCollection.cs
- SchemaObjectWriter.cs
- UrlMapping.cs
- X509ChainPolicy.cs
- DBSqlParserTableCollection.cs
- AppLevelCompilationSectionCache.cs
- DataMisalignedException.cs
- SqlException.cs
- TypeGeneratedEventArgs.cs
- CircleHotSpot.cs
- XmlSerializationReader.cs
- MarshalByRefObject.cs
- CodeMethodReturnStatement.cs
- DmlSqlGenerator.cs
- ThicknessAnimation.cs
- DbProviderFactories.cs
- DbMetaDataColumnNames.cs
- MouseWheelEventArgs.cs
- Attribute.cs
- PointAnimation.cs
- IsolatedStorageFilePermission.cs
- X509Extension.cs
- SecurityPolicySection.cs
- CurrentChangingEventManager.cs
- DiscoveryClientDuplexChannel.cs
- XmlAnyElementAttributes.cs
- TemplatedAdorner.cs
- SchemaTableColumn.cs
- CustomWebEventKey.cs
- CatalogPartDesigner.cs
- XslNumber.cs
- Rotation3DAnimationBase.cs
- ConnectionStringsSection.cs
- OTFRasterizer.cs
- MetadataException.cs
- _HeaderInfoTable.cs
- DataSourceHelper.cs
- Rect3DValueSerializer.cs
- CodeArrayIndexerExpression.cs
- HttpHeaderCollection.cs
- ManagementOptions.cs
- CodeTypeOfExpression.cs
- JobInputBins.cs
- MobileControl.cs
- ResourceIDHelper.cs
- ProcessModule.cs
- AnimationException.cs
- ResXResourceSet.cs
- PerformanceCounterPermissionEntry.cs
- KeyValueSerializer.cs
- HttpRuntimeSection.cs
- CodeTypeParameter.cs
- ToolStripMenuItem.cs
- AvTrace.cs
- QilFactory.cs
- UnsafeNativeMethods.cs
- HealthMonitoringSection.cs
- MetricEntry.cs
- Int16Storage.cs
- FilterQuery.cs
- WebPartMovingEventArgs.cs
- XmlILTrace.cs
- StorageMappingFragment.cs
- ScrollableControl.cs
- ServiceHttpModule.cs
- CatalogPartCollection.cs
- ConstraintEnumerator.cs
- XmlNamespaceManager.cs
- UriTemplateCompoundPathSegment.cs
- Point.cs
- Attributes.cs
- CancellationHandlerDesigner.cs
- TimeSpanStorage.cs
- Brush.cs
- DispatcherObject.cs
- OfTypeExpression.cs
- SafeHandles.cs
- EncryptedReference.cs
- Shared.cs
- WizardStepCollectionEditor.cs
- MetadataPropertyCollection.cs
- MaterialCollection.cs
- CalendarData.cs
- PanelDesigner.cs