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
- EllipseGeometry.cs
- TrackingMemoryStream.cs
- CustomLineCap.cs
- DynamicQueryableWrapper.cs
- DataGridAutoFormatDialog.cs
- WindowsTab.cs
- SerialReceived.cs
- StylusShape.cs
- DetailsViewCommandEventArgs.cs
- XmlArrayItemAttribute.cs
- XsltSettings.cs
- ChannelSinkStacks.cs
- ListViewDataItem.cs
- DesignerVerbToolStripMenuItem.cs
- PackWebRequestFactory.cs
- SimpleTypeResolver.cs
- MailBnfHelper.cs
- ContentValidator.cs
- PagedDataSource.cs
- FileSystemEnumerable.cs
- FormsAuthenticationCredentials.cs
- PaintEvent.cs
- TypeElementCollection.cs
- TimeSpanStorage.cs
- ContractSearchPattern.cs
- InfocardExtendedInformationEntry.cs
- DataListComponentEditor.cs
- KeyValuePair.cs
- SerializableAttribute.cs
- MetadataPropertyCollection.cs
- XmlUrlEditor.cs
- XmlObjectSerializerWriteContextComplexJson.cs
- ManagementBaseObject.cs
- CopyOnWriteList.cs
- Hashtable.cs
- StreamInfo.cs
- sqlcontext.cs
- DocumentSchemaValidator.cs
- GatewayIPAddressInformationCollection.cs
- BamlTreeUpdater.cs
- TransportationConfigurationTypeInstallComponent.cs
- ContentOperations.cs
- PassportAuthenticationModule.cs
- RightsManagementEncryptedStream.cs
- TagPrefixAttribute.cs
- ExpressionVisitor.cs
- CachingParameterInspector.cs
- ToolStripOverflow.cs
- HtmlAnchor.cs
- ProcessHostFactoryHelper.cs
- ControlCachePolicy.cs
- RNGCryptoServiceProvider.cs
- ConfigXmlWhitespace.cs
- ListViewUpdateEventArgs.cs
- UnsupportedPolicyOptionsException.cs
- StylusButtonEventArgs.cs
- LineServices.cs
- CapabilitiesSection.cs
- TimeSpanOrInfiniteConverter.cs
- DesignTable.cs
- DeadCharTextComposition.cs
- PageContentAsyncResult.cs
- AncestorChangedEventArgs.cs
- BoolLiteral.cs
- ComponentResourceKey.cs
- TreeViewTemplateSelector.cs
- Base64Stream.cs
- _ConnectStream.cs
- ClientBuildManager.cs
- Avt.cs
- FieldBuilder.cs
- FontDifferentiator.cs
- streamingZipPartStream.cs
- dbenumerator.cs
- ThreadBehavior.cs
- DataRowComparer.cs
- BitmapDownload.cs
- Substitution.cs
- ProxyWebPart.cs
- TypeSchema.cs
- SelectedGridItemChangedEvent.cs
- BitmapEffectState.cs
- AdvancedBindingEditor.cs
- Utils.cs
- AesManaged.cs
- PartialTrustValidationBehavior.cs
- AutoCompleteStringCollection.cs
- RunClient.cs
- EntityDataSourceSelectedEventArgs.cs
- ActivityScheduledQuery.cs
- ActivityExecutorSurrogate.cs
- ObjectComplexPropertyMapping.cs
- XamlUtilities.cs
- TcpHostedTransportConfiguration.cs
- UnsafeNativeMethods.cs
- EditorZone.cs
- AliasedSlot.cs
- TransformPattern.cs
- GridPattern.cs
- TimersDescriptionAttribute.cs