未验证 提交 4912f487 编写于 作者: T ThomasGoulet73 提交者: GitHub

Replace resource constants with properties in System.Windows.Controls.Ribbon (#6834)

Contributes to dotnet/wpf#1
上级 51ba512b
......@@ -12,9 +12,14 @@
<_GenerateResourcesCodeAsConstants>true</_GenerateResourcesCodeAsConstants>
<!--
Projects that compile XAML must also check for AssemblyName because XAML compilation generates a temporary project with a different project name.
We use AssemblyName because AssemblyName is copied from the main project to the generated project.
-->
<_GenerateResourcesCodeAsConstants Condition="'$(MSBuildProjectName)'=='UIAutomationClient'">false</_GenerateResourcesCodeAsConstants>
<_GenerateResourcesCodeAsConstants Condition="'$(MSBuildProjectName)'=='UIAutomationClientSideProviders'">false</_GenerateResourcesCodeAsConstants>
<_GenerateResourcesCodeAsConstants Condition="'$(MSBuildProjectName)'=='UIAutomationProvider'">false</_GenerateResourcesCodeAsConstants>
<_GenerateResourcesCodeAsConstants Condition="'$(MSBuildProjectName)'=='System.Windows.Controls.Ribbon' or '$(AssemblyName)'=='System.Windows.Controls.Ribbon'">false</_GenerateResourcesCodeAsConstants>
<_GenerateResourcesCodeAsConstants Condition="'$(MSBuildProjectName)'=='System.Xaml'">false</_GenerateResourcesCodeAsConstants>
<_GenerateResourcesCodeAsConstants Condition="'$(MSBuildProjectName)'=='WindowsBase'">false</_GenerateResourcesCodeAsConstants>
<_GenerateResourcesCodeAsConstants Condition="'$(MSBuildProjectName)'=='WindowsFormsIntegration'">false</_GenerateResourcesCodeAsConstants>
......@@ -37,7 +42,7 @@
<ClassName Condition="'$(AssemblyName)'=='UIAutomationProvider'">MS.Internal.Automation.SR</ClassName>
<ClassName Condition="'$(AssemblyName)'=='UIAutomationTypes'">System.SR</ClassName>
<ClassName Condition="'$(AssemblyName)'=='WindowsBase'">MS.Internal.WindowsBase.SR</ClassName>
<ClassName Condition="'$(AssemblyName)'=='System.Windows.Controls.Ribbon'">Microsoft.Windows.Controls.SRID</ClassName>
<ClassName Condition="'$(AssemblyName)'=='System.Windows.Controls.Ribbon'">Microsoft.Windows.Controls.SR</ClassName>
<ClassName Condition="'$(AssemblyName)'=='System.Windows.Input.Manipulations'">System.SR</ClassName>
<ClassName Condition="'$(AssemblyName)'=='ReachFramework'">System.Windows.Xps.SRID</ClassName>
<ClassName Condition="'$(AssemblyName)'=='PresentationFramework'">System.Windows.SRID</ClassName>
......
......@@ -88,15 +88,15 @@ protected override void SetFocusCore()
{
TextBox tb = owner.EditableTextBoxSite;
if (tb == null || !tb.IsKeyboardFocused)
throw new InvalidOperationException(Microsoft.Windows.Controls.SR.Get(Microsoft.Windows.Controls.SRID.SetFocusFailed));
throw new InvalidOperationException(Microsoft.Windows.Controls.SR.SetFocusFailed);
}
else
throw new InvalidOperationException(Microsoft.Windows.Controls.SR.Get(Microsoft.Windows.Controls.SRID.SetFocusFailed));
throw new InvalidOperationException(Microsoft.Windows.Controls.SR.SetFocusFailed);
}
}
else
{
throw new InvalidOperationException(Microsoft.Windows.Controls.SR.Get(Microsoft.Windows.Controls.SRID.SetFocusFailed));
throw new InvalidOperationException(Microsoft.Windows.Controls.SR.SetFocusFailed);
}
}
......
......@@ -173,7 +173,7 @@ void IExpandCollapseProvider.Collapse()
RibbonMenuButton owner = OwningMenuButton;
if (!owner.HasItems)
{
throw new InvalidOperationException(Microsoft.Windows.Controls.SR.Get(Microsoft.Windows.Controls.SRID.UIA_OperationCannotBePerformed));
throw new InvalidOperationException(Microsoft.Windows.Controls.SR.UIA_OperationCannotBePerformed);
}
owner.IsDropDownOpen = false;
......@@ -187,7 +187,7 @@ void IExpandCollapseProvider.Expand()
RibbonMenuButton owner = OwningMenuButton;
if (!owner.HasItems)
{
throw new InvalidOperationException(Microsoft.Windows.Controls.SR.Get(Microsoft.Windows.Controls.SRID.UIA_OperationCannotBePerformed));
throw new InvalidOperationException(Microsoft.Windows.Controls.SR.UIA_OperationCannotBePerformed);
}
owner.IsDropDownOpen = true;
......@@ -237,7 +237,7 @@ bool ITransformProvider.CanRotate
void ITransformProvider.Move(double x, double y)
{
throw new InvalidOperationException(Microsoft.Windows.Controls.SR.Get(Microsoft.Windows.Controls.SRID.UIA_OperationCannotBePerformed));
throw new InvalidOperationException(Microsoft.Windows.Controls.SR.UIA_OperationCannotBePerformed);
}
void ITransformProvider.Resize(double width, double height)
......@@ -246,17 +246,17 @@ void ITransformProvider.Resize(double width, double height)
throw new ElementNotEnabledException();
if (!((ITransformProvider)this).CanResize || width <= 0 || height <= 0)
throw new InvalidOperationException(Microsoft.Windows.Controls.SR.Get(Microsoft.Windows.Controls.SRID.UIA_OperationCannotBePerformed));
throw new InvalidOperationException(Microsoft.Windows.Controls.SR.UIA_OperationCannotBePerformed);
if (!OwningMenuButton.ResizePopupInternal(width, height))
{
throw new InvalidOperationException(Microsoft.Windows.Controls.SR.Get(Microsoft.Windows.Controls.SRID.ResizeParametersNotValid));
throw new InvalidOperationException(Microsoft.Windows.Controls.SR.ResizeParametersNotValid);
}
}
void ITransformProvider.Rotate(double degrees)
{
throw new InvalidOperationException(Microsoft.Windows.Controls.SR.Get(Microsoft.Windows.Controls.SRID.UIA_OperationCannotBePerformed));
throw new InvalidOperationException(Microsoft.Windows.Controls.SR.UIA_OperationCannotBePerformed);
}
#endregion
......
......@@ -142,7 +142,7 @@ void IExpandCollapseProvider.Expand()
UIElement owner = GetWrapper();
if (owner == null)
{
throw new ElementNotAvailableException(Microsoft.Windows.Controls.SR.Get(Microsoft.Windows.Controls.SRID.VirtualizedElement));
throw new ElementNotAvailableException(Microsoft.Windows.Controls.SR.VirtualizedElement);
}
RibbonMenuItem menuItemOwner = owner as RibbonMenuItem;
......@@ -153,14 +153,14 @@ void IExpandCollapseProvider.Expand()
if ((role != MenuItemRole.TopLevelHeader && role != MenuItemRole.SubmenuHeader)
|| !menuItemOwner.HasItems)
{
throw new InvalidOperationException(Microsoft.Windows.Controls.SR.Get(Microsoft.Windows.Controls.SRID.UIA_OperationCannotBePerformed));
throw new InvalidOperationException(Microsoft.Windows.Controls.SR.UIA_OperationCannotBePerformed);
}
menuItemOwner.IsSubmenuOpen = true;
}
else
{
throw new InvalidOperationException(Microsoft.Windows.Controls.SR.Get(Microsoft.Windows.Controls.SRID.UIA_OperationCannotBePerformed));
throw new InvalidOperationException(Microsoft.Windows.Controls.SR.UIA_OperationCannotBePerformed);
}
}
......@@ -173,7 +173,7 @@ void IExpandCollapseProvider.Collapse()
UIElement owner = GetWrapper();
if (owner == null)
{
throw new ElementNotAvailableException(Microsoft.Windows.Controls.SR.Get(Microsoft.Windows.Controls.SRID.VirtualizedElement));
throw new ElementNotAvailableException(Microsoft.Windows.Controls.SR.VirtualizedElement);
}
RibbonMenuItem menuItemOwner = owner as RibbonMenuItem;
......@@ -184,14 +184,14 @@ void IExpandCollapseProvider.Collapse()
if ((role != MenuItemRole.TopLevelHeader && role != MenuItemRole.SubmenuHeader)
|| !menuItemOwner.HasItems)
{
throw new InvalidOperationException(Microsoft.Windows.Controls.SR.Get(Microsoft.Windows.Controls.SRID.UIA_OperationCannotBePerformed));
throw new InvalidOperationException(Microsoft.Windows.Controls.SR.UIA_OperationCannotBePerformed);
}
menuItemOwner.IsSubmenuOpen = false;
}
else
{
throw new InvalidOperationException(Microsoft.Windows.Controls.SR.Get(Microsoft.Windows.Controls.SRID.UIA_OperationCannotBePerformed));
throw new InvalidOperationException(Microsoft.Windows.Controls.SR.UIA_OperationCannotBePerformed);
}
}
......@@ -203,7 +203,7 @@ ExpandCollapseState IExpandCollapseProvider.ExpandCollapseState
UIElement owner = GetWrapper();
if (owner == null)
{
throw new ElementNotAvailableException(Microsoft.Windows.Controls.SR.Get(Microsoft.Windows.Controls.SRID.VirtualizedElement));
throw new ElementNotAvailableException(Microsoft.Windows.Controls.SR.VirtualizedElement);
}
ExpandCollapseState result = ExpandCollapseState.Collapsed;
......@@ -224,7 +224,7 @@ ExpandCollapseState IExpandCollapseProvider.ExpandCollapseState
}
else
{
throw new InvalidOperationException(Microsoft.Windows.Controls.SR.Get(Microsoft.Windows.Controls.SRID.UIA_OperationCannotBePerformed));
throw new InvalidOperationException(Microsoft.Windows.Controls.SR.UIA_OperationCannotBePerformed);
}
return result;
......@@ -243,13 +243,13 @@ void IInvokeProvider.Invoke()
UIElement owner = GetWrapper();
if (owner == null)
{
throw new ElementNotAvailableException(Microsoft.Windows.Controls.SR.Get(Microsoft.Windows.Controls.SRID.VirtualizedElement));
throw new ElementNotAvailableException(Microsoft.Windows.Controls.SR.VirtualizedElement);
}
RibbonMenuItem menuItemOwner = owner as RibbonMenuItem;
if (menuItemOwner == null)
{
throw new InvalidOperationException(Microsoft.Windows.Controls.SR.Get(Microsoft.Windows.Controls.SRID.UIA_OperationCannotBePerformed));
throw new InvalidOperationException(Microsoft.Windows.Controls.SR.UIA_OperationCannotBePerformed);
}
menuItemOwner.ClickItemInternal();
......@@ -267,13 +267,13 @@ void IToggleProvider.Toggle()
UIElement owner = GetWrapper();
if (owner == null)
{
throw new ElementNotAvailableException(Microsoft.Windows.Controls.SR.Get(Microsoft.Windows.Controls.SRID.VirtualizedElement));
throw new ElementNotAvailableException(Microsoft.Windows.Controls.SR.VirtualizedElement);
}
RibbonMenuItem menuItemOwner = owner as RibbonMenuItem;
if (menuItemOwner == null || !menuItemOwner.IsCheckable)
{
throw new InvalidOperationException(Microsoft.Windows.Controls.SR.Get(Microsoft.Windows.Controls.SRID.UIA_OperationCannotBePerformed));
throw new InvalidOperationException(Microsoft.Windows.Controls.SR.UIA_OperationCannotBePerformed);
}
menuItemOwner.IsChecked = !menuItemOwner.IsChecked;
......@@ -287,13 +287,13 @@ ToggleState IToggleProvider.ToggleState
UIElement owner = GetWrapper();
if (owner == null)
{
throw new ElementNotAvailableException(Microsoft.Windows.Controls.SR.Get(Microsoft.Windows.Controls.SRID.VirtualizedElement));
throw new ElementNotAvailableException(Microsoft.Windows.Controls.SR.VirtualizedElement);
}
RibbonMenuItem menuItemOwner = owner as RibbonMenuItem;
if (menuItemOwner == null)
{
throw new InvalidOperationException(Microsoft.Windows.Controls.SR.Get(Microsoft.Windows.Controls.SRID.UIA_OperationCannotBePerformed));
throw new InvalidOperationException(Microsoft.Windows.Controls.SR.UIA_OperationCannotBePerformed);
}
return menuItemOwner.IsChecked ? ToggleState.On : ToggleState.Off;
......@@ -330,7 +330,7 @@ bool ITransformProvider.CanRotate
void ITransformProvider.Move(double x, double y)
{
throw new InvalidOperationException(Microsoft.Windows.Controls.SR.Get(Microsoft.Windows.Controls.SRID.UIA_OperationCannotBePerformed));
throw new InvalidOperationException(Microsoft.Windows.Controls.SR.UIA_OperationCannotBePerformed);
}
void ITransformProvider.Resize(double width, double height)
......@@ -341,27 +341,27 @@ void ITransformProvider.Resize(double width, double height)
UIElement owner = GetWrapper();
if (owner == null)
{
throw new ElementNotAvailableException(Microsoft.Windows.Controls.SR.Get(Microsoft.Windows.Controls.SRID.VirtualizedElement));
throw new ElementNotAvailableException(Microsoft.Windows.Controls.SR.VirtualizedElement);
}
RibbonMenuItem menuItemOwner = owner as RibbonMenuItem;
if (menuItemOwner == null)
{
throw new InvalidOperationException(Microsoft.Windows.Controls.SR.Get(Microsoft.Windows.Controls.SRID.UIA_OperationCannotBePerformed));
throw new InvalidOperationException(Microsoft.Windows.Controls.SR.UIA_OperationCannotBePerformed);
}
if (!((ITransformProvider)this).CanResize || width <= 0 || height <= 0)
throw new InvalidOperationException(Microsoft.Windows.Controls.SR.Get(Microsoft.Windows.Controls.SRID.UIA_OperationCannotBePerformed));
throw new InvalidOperationException(Microsoft.Windows.Controls.SR.UIA_OperationCannotBePerformed);
if (!menuItemOwner.ResizePopupInternal(width, height))
{
throw new InvalidOperationException(Microsoft.Windows.Controls.SR.Get(Microsoft.Windows.Controls.SRID.ResizeParametersNotValid));
throw new InvalidOperationException(Microsoft.Windows.Controls.SR.ResizeParametersNotValid);
}
}
void ITransformProvider.Rotate(double degrees)
{
throw new InvalidOperationException(Microsoft.Windows.Controls.SR.Get(Microsoft.Windows.Controls.SRID.UIA_OperationCannotBePerformed));
throw new InvalidOperationException(Microsoft.Windows.Controls.SR.UIA_OperationCannotBePerformed);
}
#endregion
......
......@@ -109,7 +109,7 @@ public void Collapse()
}
else
{
throw new InvalidOperationException(Microsoft.Windows.Controls.SR.Get(Microsoft.Windows.Controls.SRID.UIA_OperationCannotBePerformed));
throw new InvalidOperationException(Microsoft.Windows.Controls.SR.UIA_OperationCannotBePerformed);
}
}
......@@ -121,7 +121,7 @@ public void Expand()
}
else
{
throw new InvalidOperationException(Microsoft.Windows.Controls.SR.Get(Microsoft.Windows.Controls.SRID.UIA_OperationCannotBePerformed));
throw new InvalidOperationException(Microsoft.Windows.Controls.SR.UIA_OperationCannotBePerformed);
}
}
......
......@@ -75,7 +75,7 @@ void IToggleProvider.Toggle()
if (!OwningSplitButton.IsCheckable)
{
throw new InvalidOperationException(Microsoft.Windows.Controls.SR.Get(Microsoft.Windows.Controls.SRID.UIA_OperationCannotBePerformed));
throw new InvalidOperationException(Microsoft.Windows.Controls.SR.UIA_OperationCannotBePerformed);
}
if (OwningSplitButton.HeaderButton != null)
......@@ -108,7 +108,7 @@ void IInvokeProvider.Invoke()
// When IsCheckable is true, TogglePattern should be used
if (OwningSplitButton.IsCheckable)
{
throw new InvalidOperationException(Microsoft.Windows.Controls.SR.Get(Microsoft.Windows.Controls.SRID.UIA_OperationCannotBePerformed));
throw new InvalidOperationException(Microsoft.Windows.Controls.SR.UIA_OperationCannotBePerformed);
}
if (OwningSplitButton.HeaderButton != null)
......
......@@ -150,7 +150,7 @@ void ISelectionItemProvider.RemoveFromSelection()
RibbonTab tab = GetWrapper() as RibbonTab;
if (tab != null && tab.IsSelected)
{
throw new InvalidOperationException(Microsoft.Windows.Controls.SR.Get(Microsoft.Windows.Controls.SRID.UIA_OperationCannotBePerformed));
throw new InvalidOperationException(Microsoft.Windows.Controls.SR.UIA_OperationCannotBePerformed);
}
}
......@@ -165,7 +165,7 @@ void ISelectionItemProvider.AddToSelection()
Selector parentSelector = (Selector)(ItemsControlAutomationPeer.Owner);
if ((parentSelector == null) || (parentSelector.SelectedItem != null && parentSelector.SelectedItem != Item))
{
throw new InvalidOperationException(Microsoft.Windows.Controls.SR.Get(Microsoft.Windows.Controls.SRID.UIA_OperationCannotBePerformed));
throw new InvalidOperationException(Microsoft.Windows.Controls.SR.UIA_OperationCannotBePerformed);
}
}
......
......@@ -86,7 +86,7 @@ public double KeyTipHorizontalOffset
{
if (double.IsInfinity(value) || double.IsNaN(value))
{
throw new ArgumentException(Microsoft.Windows.Controls.SR.Get(Microsoft.Windows.Controls.SRID.InvalidKeyTipOffset));
throw new ArgumentException(Microsoft.Windows.Controls.SR.InvalidKeyTipOffset);
}
_horizontalOffset = value;
}
......@@ -105,7 +105,7 @@ public double KeyTipVerticalOffset
{
if (double.IsInfinity(value) || double.IsNaN(value))
{
throw new ArgumentException(Microsoft.Windows.Controls.SR.Get(Microsoft.Windows.Controls.SRID.InvalidKeyTipOffset));
throw new ArgumentException(Microsoft.Windows.Controls.SR.InvalidKeyTipOffset);
}
_verticalOffset = value;
}
......
......@@ -989,7 +989,7 @@ private void OnKeyTipExactMatch(DependencyObject exactMatchElement)
!KeyTipService.GetIsKeyTipScope(newScope) &&
newScope != _currentGlobalScope)
{
throw new InvalidOperationException(Microsoft.Windows.Controls.SR.Get(Microsoft.Windows.Controls.SRID.ElementNotKeyTipScope));
throw new InvalidOperationException(Microsoft.Windows.Controls.SR.ElementNotKeyTipScope);
}
if (newScope == null &&
KeyTipService.GetIsKeyTipScope(exactMatchElement))
......@@ -1796,7 +1796,7 @@ internal static KeyTipService Current
private const int ShowKeyTipsWaitTime = 500;
private const int NonZeroDigitCount = 9;
private static String QatKeyTipCharacters = Microsoft.Windows.Controls.SR.Get(Microsoft.Windows.Controls.SRID.QATKeyTipCharacters);
private static String QatKeyTipCharacters = Microsoft.Windows.Controls.SR.QATKeyTipCharacters;
#endregion
}
......
......@@ -737,8 +737,8 @@ private static bool CoerceCanLineUpDown(InRibbonGallery irg, bool lineUp)
private const string ScrollUpRepeatButtonTemplatePartName = "PART_ScrollUp";
private const string ScrollDownRepeatButtonTemplatePartName = "PART_ScrollDown";
private static string _scrollUpButtonAutomationName = Microsoft.Windows.Controls.SR.Get(Microsoft.Windows.Controls.SRID.InRibbonGallery_ScrollUpButtonAutomationName);
private static string _scrollDownButtonAutomationName = Microsoft.Windows.Controls.SR.Get(Microsoft.Windows.Controls.SRID.InRibbonGallery_ScrollDownButtonAutomationName);
private static string _scrollUpButtonAutomationName = Microsoft.Windows.Controls.SR.InRibbonGallery_ScrollUpButtonAutomationName;
private static string _scrollDownButtonAutomationName = Microsoft.Windows.Controls.SR.InRibbonGallery_ScrollDownButtonAutomationName;
#endregion
......
......@@ -61,7 +61,7 @@ public void RegisterStarLayoutProvider(IProvideStarLayoutInfoBase starLayoutInfo
IProvideStarLayoutInfo provider = starLayoutInfoProvider as IProvideStarLayoutInfo;
if (provider == null)
{
throw new ArgumentException(Microsoft.Windows.Controls.SR.Get(Microsoft.Windows.Controls.SRID.RibbonGroupsPanel_InvalidRegistrationParameter), "starLayoutInfoProvider");
throw new ArgumentException(Microsoft.Windows.Controls.SR.RibbonGroupsPanel_InvalidRegistrationParameter, "starLayoutInfoProvider");
}
if (!_registeredStarLayoutProviders.Contains(provider))
{
......@@ -79,7 +79,7 @@ public void UnregisterStarLayoutProvider(IProvideStarLayoutInfoBase starLayoutIn
IProvideStarLayoutInfo provider = starLayoutInfoProvider as IProvideStarLayoutInfo;
if (provider == null)
{
throw new ArgumentException(Microsoft.Windows.Controls.SR.Get(Microsoft.Windows.Controls.SRID.RibbonGroupsPanel_InvalidRegistrationParameter), "starLayoutInfoProvider");
throw new ArgumentException(Microsoft.Windows.Controls.SR.RibbonGroupsPanel_InvalidRegistrationParameter, "starLayoutInfoProvider");
}
if (_registeredStarLayoutProviders.Contains(provider))
{
......
......@@ -753,7 +753,7 @@ public override void OnApplyTemplate()
{
if (ContextualTabGroupsSource != null && ContextualTabGroups.Count > 0)
{
throw new InvalidOperationException(Microsoft.Windows.Controls.SR.Get(Microsoft.Windows.Controls.SRID.Ribbon_ContextualTabHeadersSourceInvalid));
throw new InvalidOperationException(Microsoft.Windows.Controls.SR.Ribbon_ContextualTabHeadersSourceInvalid);
}
if (ContextualTabGroupsSource != null)
{
......@@ -1470,7 +1470,7 @@ private void OnContextualTabGroupsCollectionChanged(object sender, NotifyCollect
{
if (ContextualTabGroupsSource != null && ContextualTabGroups.Count > 0)
{
throw new InvalidOperationException(Microsoft.Windows.Controls.SR.Get(Microsoft.Windows.Controls.SRID.Ribbon_ContextualTabHeadersSourceInvalid));
throw new InvalidOperationException(Microsoft.Windows.Controls.SR.Ribbon_ContextualTabHeadersSourceInvalid);
}
}
......@@ -1480,7 +1480,7 @@ private static void OnContextualTabGroupsSourceChanged(object sender, Dependency
if (ribbon.ContextualTabGroupsSource != null && ribbon.ContextualTabGroups.Count > 0)
{
throw new InvalidOperationException(Microsoft.Windows.Controls.SR.Get(Microsoft.Windows.Controls.SRID.Ribbon_ContextualTabHeadersSourceInvalid));
throw new InvalidOperationException(Microsoft.Windows.Controls.SR.Ribbon_ContextualTabHeadersSourceInvalid);
}
if (ribbon.ContextualTabGroupItemsControl != null)
......
......@@ -241,7 +241,7 @@ protected override DependencyObject GetContainerForItemOverride()
}
else
{
throw new InvalidOperationException(Microsoft.Windows.Controls.SR.Get(Microsoft.Windows.Controls.SRID.InvalidApplicationMenuOrItemContainer, this.GetType().Name, itemContainer));
throw new InvalidOperationException(Microsoft.Windows.Controls.SR.Format(Microsoft.Windows.Controls.SR.InvalidApplicationMenuOrItemContainer, this.GetType().Name, itemContainer));
}
}
}
......
......@@ -76,7 +76,7 @@ protected override DependencyObject GetContainerForItemOverride()
}
else
{
throw new InvalidOperationException(Microsoft.Windows.Controls.SR.Get(Microsoft.Windows.Controls.SRID.InvalidApplicationMenuOrItemContainer, this.GetType().Name, itemContainer));
throw new InvalidOperationException(Microsoft.Windows.Controls.SR.Format(Microsoft.Windows.Controls.SR.InvalidApplicationMenuOrItemContainer, this.GetType().Name, itemContainer));
}
}
}
......
......@@ -74,7 +74,7 @@ protected override DependencyObject GetContainerForItemOverride()
}
else
{
throw new InvalidOperationException(Microsoft.Windows.Controls.SR.Get(Microsoft.Windows.Controls.SRID.InvalidApplicationMenuOrItemContainer, this.GetType().Name, itemContainer));
throw new InvalidOperationException(Microsoft.Windows.Controls.SR.Format(Microsoft.Windows.Controls.SR.InvalidApplicationMenuOrItemContainer, this.GetType().Name, itemContainer));
}
}
}
......
......@@ -515,7 +515,7 @@ protected override DependencyObject GetContainerForItemOverride()
}
else
{
throw new InvalidOperationException(Microsoft.Windows.Controls.SR.Get(Microsoft.Windows.Controls.SRID.InvalidMenuButtonOrItemContainer, this.GetType().Name, itemContainer));
throw new InvalidOperationException(Microsoft.Windows.Controls.SR.Format(Microsoft.Windows.Controls.SR.InvalidMenuButtonOrItemContainer, this.GetType().Name, itemContainer));
}
}
}
......@@ -628,13 +628,13 @@ private void OnLoaded(object sender, RoutedEventArgs e)
private int _galleryCount;
private Popup _popup;
internal static string AddToQATText = Microsoft.Windows.Controls.SR.Get(Microsoft.Windows.Controls.SRID.RibbonContextMenu_AddToQAT);
private static string _addGalleryToQATText = Microsoft.Windows.Controls.SR.Get(Microsoft.Windows.Controls.SRID.RibbonContextMenu_AddGalleryToQAT);
internal static string RemoveFromQATText = Microsoft.Windows.Controls.SR.Get(Microsoft.Windows.Controls.SRID.RibbonContextMenu_RemoveFromQAT);
internal static string ShowQATAboveText = Microsoft.Windows.Controls.SR.Get(Microsoft.Windows.Controls.SRID.RibbonContextMenu_ShowQATAbove);
internal static string ShowQATBelowText = Microsoft.Windows.Controls.SR.Get(Microsoft.Windows.Controls.SRID.RibbonContextMenu_ShowQATBelow);
internal static string MaximizeTheRibbonText = Microsoft.Windows.Controls.SR.Get(Microsoft.Windows.Controls.SRID.RibbonContextMenu_MaximizeTheRibbon);
internal static string MinimizeTheRibbonText = Microsoft.Windows.Controls.SR.Get(Microsoft.Windows.Controls.SRID.RibbonContextMenu_MinimizeTheRibbon);
internal static string AddToQATText = Microsoft.Windows.Controls.SR.RibbonContextMenu_AddToQAT;
private static string _addGalleryToQATText = Microsoft.Windows.Controls.SR.RibbonContextMenu_AddGalleryToQAT;
internal static string RemoveFromQATText = Microsoft.Windows.Controls.SR.RibbonContextMenu_RemoveFromQAT;
internal static string ShowQATAboveText = Microsoft.Windows.Controls.SR.RibbonContextMenu_ShowQATAbove;
internal static string ShowQATBelowText = Microsoft.Windows.Controls.SR.RibbonContextMenu_ShowQATBelow;
internal static string MaximizeTheRibbonText = Microsoft.Windows.Controls.SR.RibbonContextMenu_MaximizeTheRibbon;
internal static string MinimizeTheRibbonText = Microsoft.Windows.Controls.SR.RibbonContextMenu_MinimizeTheRibbon;
private bool _ignoreDismissPopupsOnNextClose = false;
......
......@@ -50,12 +50,12 @@ public RibbonControlLength(double value, RibbonControlLengthUnitType type)
{
if (double.IsNaN(value))
{
throw new ArgumentException(Microsoft.Windows.Controls.SR.Get(Microsoft.Windows.Controls.SRID.InvalidCtorParameterNoNaN, "value"));
throw new ArgumentException(Microsoft.Windows.Controls.SR.Format(Microsoft.Windows.Controls.SR.InvalidCtorParameterNoNaN, "value"));
}
if (type == RibbonControlLengthUnitType.Star && double.IsInfinity(value))
{
throw new ArgumentException(Microsoft.Windows.Controls.SR.Get(Microsoft.Windows.Controls.SRID.InvalidCtorParameterNoInfinityForStarSize, "value"));
throw new ArgumentException(Microsoft.Windows.Controls.SR.Format(Microsoft.Windows.Controls.SR.InvalidCtorParameterNoInfinityForStarSize, "value"));
}
if (type != RibbonControlLengthUnitType.Auto
......@@ -63,7 +63,7 @@ public RibbonControlLength(double value, RibbonControlLengthUnitType type)
&& type != RibbonControlLengthUnitType.Item
&& type != RibbonControlLengthUnitType.Star)
{
throw new ArgumentException(Microsoft.Windows.Controls.SR.Get(Microsoft.Windows.Controls.SRID.InvalidCtorParameterUnknownRibbonControlLengthUnitType, "type"));
throw new ArgumentException(Microsoft.Windows.Controls.SR.Format(Microsoft.Windows.Controls.SR.InvalidCtorParameterUnknownRibbonControlLengthUnitType, "type"));
}
_unitValue = (type == RibbonControlLengthUnitType.Auto) ? 0.0 : value;
......
......@@ -3225,7 +3225,7 @@ private enum Bits
// Filtering
private ObservableCollection<object> _categoryFilters = new ObservableCollection<object>();
private static object _allFilter = Microsoft.Windows.Controls.SR.Get(Microsoft.Windows.Controls.SRID.RibbonGallery_AllFilter);
private static object _allFilter = Microsoft.Windows.Controls.SR.RibbonGallery_AllFilter;
private const string _filterMenuButtonTemplatePartName = "PART_FilterMenuButton";
private const string FilterContentPaneTemplatePartName = "PART_FilterContentPane";
private const string ScrollViewerTemplatePartName = "PART_ScrollViewer";
......
......@@ -558,7 +558,7 @@ protected override DependencyObject GetContainerForItemOverride()
}
else
{
throw new InvalidOperationException(Microsoft.Windows.Controls.SR.Get(Microsoft.Windows.Controls.SRID.InvalidMenuButtonOrItemContainer, this.GetType().Name, itemContainer));
throw new InvalidOperationException(Microsoft.Windows.Controls.SR.Format(Microsoft.Windows.Controls.SR.InvalidMenuButtonOrItemContainer, this.GetType().Name, itemContainer));
}
}
}
......
......@@ -520,7 +520,7 @@ protected override DependencyObject GetContainerForItemOverride()
}
else
{
throw new InvalidOperationException(Microsoft.Windows.Controls.SR.Get(Microsoft.Windows.Controls.SRID.InvalidMenuButtonOrItemContainer, this.GetType().Name, itemContainer));
throw new InvalidOperationException(Microsoft.Windows.Controls.SR.Format(Microsoft.Windows.Controls.SR.InvalidMenuButtonOrItemContainer, this.GetType().Name, itemContainer));
}
}
}
......
......@@ -54,7 +54,7 @@ public class RibbonQuickAccessToolBar : ItemsControl
private Popup _overflowPopup; // The Popup that hosts the overflow panel.
private RibbonToggleButton _overflowButton; // The ToggleButton that hosts the overflow panel popup.
private BitVector32 _bits = new BitVector32(0);
private static string _overflowButtonToolTipText = Microsoft.Windows.Controls.SR.Get(Microsoft.Windows.Controls.SRID.RibbonQuickAccessToolBar_OverflowButtonToolTip);
private static string _overflowButtonToolTipText = Microsoft.Windows.Controls.SR.RibbonQuickAccessToolBar_OverflowButtonToolTip;
private enum Bits
{
......
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
using System;
using System.Globalization;
using System.Resources;
namespace Microsoft.Windows.Controls
{
/// <summary>
/// Retrieves exception strings and other localized strings.
/// </summary>
internal static partial class SR
{
public static string Get(string name)
{
return GetResourceString(name, null);
}
public static string Get(string name, params object[] args)
{
return Format(GetResourceString(name, null), args);
}
}
}
......@@ -20,7 +20,6 @@
<Compile Include="AssemblyAttrs.cs" />
<Compile Include="Resources\SR.cs" />
<Compile Include="$(WpfCommonDir)src\System\SR.cs">
<Link>Common\System\SR.cs</Link>
</Compile>
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册