Skip to content

Commit 8bef4f6

Browse files
authored
Merge pull request #11168 from Youssef1313/solidcolorbrushhelper
fix!: Make `SolidColorBrushHelper` internal
2 parents 853671a + 5d34c75 commit 8bef4f6

File tree

6 files changed

+13
-364
lines changed

6 files changed

+13
-364
lines changed

build/PackageDiffIgnore.xml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9133,13 +9133,13 @@
91339133
<Member fullName="Microsoft.UI.Xaml.Automation.Peers.ScrollPresenterAutomationPeer" reason="Not present in WinAppSDK 1.2" />
91349134
<Member fullName="Microsoft.UI.Xaml.Media.RevealBrushState" reason="Not present in WinAppSDK 1.2" />
91359135
<Member fullName="Windows.Foundation.IClosable" reason="Shouldn't be visible in .NET and shows as IDisposable instead." />
9136-
<Member fullName="Windows.Storage.Streams.InMemoryBuffer reason="Windows.Storage.Streams.Buffer should be used." />
91379136
<Member fullName="Windows.Foundation.HResult" reason="Type is hidden in .NET and shouldn't be used" />
91389137
<Member fullName="Windows.Storage.Streams.InMemoryBuffer" reason="Windows.Storage.Streams.Buffer should be used." />
91399138
<Member fullName="Uno.Extensions.JavaObjectExtensions" reason="Only needed internally" />
91409139
<Member fullName="Uno.Client.ICommandExtensions" reason="Only needed internally" />
91419140
<Member fullName="Uno.Extensions.UriExtensions" reason="Not needed publicly" />
91429141
<Member fullName="Windows.UI.Xaml.FontFamilyHelper" reason="Only needed internally. The public facing type is Uno.UI.Xaml.Media.FontFamilyHelper" />
9142+
<Member fullName="Windows.UI.Xaml.SolidColorBrushHelper" reason="Not needed publicly and not present in Windows." />
91439143
</Types>
91449144
<Events>
91459145
<Member fullName="Windows.Foundation.TypedEventHandler`2&lt;Microsoft.UI.Xaml.Controls.IInputValidationControl,Microsoft.UI.Xaml.Controls.HasValidationErrorsChangedEventArgs&gt; Microsoft.UI.Xaml.Controls.AutoSuggestBox::HasValidationErrorsChanged" reason="Not present in WinAppSDK 1.2" />
@@ -9401,8 +9401,8 @@
94019401
<Member fullName="System.Void Windows.ApplicationModel.SuspendingDeferral..ctor(System.Action deferralDone)" reason="This constructor does not exist in Windows" />
94029402
<Member fullName="System.Void Windows.UI.Xaml.Controls.CalendarDatePicker.add__dateChanged(Windows.Foundation.TypedEventHandler`2&lt;Windows.UI.Xaml.Controls.CalendarDatePicker,Windows.UI.Xaml.Controls.CalendarDatePickerDateChangedEventArgs&gt; value)" reason="Not in Windows" />
94039403
<Member fullName="System.Void Windows.UI.Xaml.Controls.CalendarDatePicker.remove__dateChanged(Windows.Foundation.TypedEventHandler`2&lt;Windows.UI.Xaml.Controls.CalendarDatePicker,Windows.UI.Xaml.Controls.CalendarDatePickerDateChangedEventArgs&gt; value)" reason="Not in Windows" />
9404-
<Member fullName="System.Threading.Tasks.Task`1&lgt;System.Collections.Generic.IList`1&lt;Windows.Devices.Geolocation.Geoposition&gt;&gt; Windows.Devices.Geolocation.Geolocator.GetGeopositionHistoryAsync(System.DateTime startTime)" reason="Not in Windows and not implemented properly" />
9405-
<Member fullName="System.Threading.Tasks.Task`1&lgt;System.Collections.Generic.IList`1&lt;Windows.Devices.Geolocation.Geoposition&gt;&gt; Windows.Devices.Geolocation.Geolocator.GetGeopositionHistoryAsync(System.DateTime startTime, System.TimeSpan duration)" reason="Not in Windows and not implemented properly" />
9404+
<Member fullName="System.Threading.Tasks.Task`1&lt;System.Collections.Generic.IList`1&lt;Windows.Devices.Geolocation.Geoposition&gt;&gt; Windows.Devices.Geolocation.Geolocator.GetGeopositionHistoryAsync(System.DateTime startTime)" reason="Not in Windows and not implemented properly" />
9405+
<Member fullName="System.Threading.Tasks.Task`1&lt;System.Collections.Generic.IList`1&lt;Windows.Devices.Geolocation.Geoposition&gt;&gt; Windows.Devices.Geolocation.Geolocator.GetGeopositionHistoryAsync(System.DateTime startTime, System.TimeSpan duration)" reason="Not in Windows and not implemented properly" />
94069406
<Member fullName="System.Void Uno.UI.Controls.Window.SetNeedsKeyboard(AppKit.NSView view, System.Boolean needsKeyboard)" reason="Not needed and doesn't do something useful" />
94079407
<Member fullName="System.Threading.Tasks.Task`1&lt;System.Collections.Generic.IList`1&lt;Windows.Devices.Geolocation.Geoposition&gt;&gt; Windows.Devices.Geolocation.Geolocator.GetGeopositionHistoryAsync(System.DateTime startTime)" reason="Not in Windows and not implemented properly" />
94089408
<Member fullName="System.Threading.Tasks.Task`1&lt;System.Collections.Generic.IList`1&lt;Windows.Devices.Geolocation.Geoposition&gt;&gt; Windows.Devices.Geolocation.Geolocator.GetGeopositionHistoryAsync(System.DateTime startTime, System.TimeSpan duration)" reason="Not in Windows and not implemented properly" />

src/SourceGenerators/Uno.UI.SourceGenerators/XamlGenerator/XamlConstants.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,6 @@ public static class Types
9595
// Misc
9696
public const string Setter = BaseXamlNamespace + ".Setter";
9797
public const string CornerRadius = BaseXamlNamespace + ".CornerRadius";
98-
public const string SolidColorBrushHelper = BaseXamlNamespace + ".SolidColorBrushHelper";
9998
public const string GridLength = BaseXamlNamespace + ".GridLength";
10099
public const string GridUnitType = BaseXamlNamespace + ".GridUnitType";
101100
public const string Color = RootWUINamespace + ".Color";

src/SourceGenerators/Uno.UI.SourceGenerators/XamlGenerator/XamlFileGenerator.cs

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5317,19 +5317,18 @@ private string BuildFontWeight(string memberValue)
53175317

53185318
private string BuildBrush(string memberValue)
53195319
{
5320-
var colorHelper = (INamedTypeSymbol)_metadataHelper.GetTypeByFullName(XamlConstants.Types.SolidColorBrushHelper);
5320+
var colors = (INamedTypeSymbol)_metadataHelper.GetTypeByFullName(XamlConstants.Types.Colors);
53215321

53225322
// This ensures that a memberValue "DarkGoldenRod" gets converted to colorName "DarkGoldenrod" (notice the lowercase 'r')
5323-
var colorName = colorHelper.GetProperties().FirstOrDefault(m => m.Name.Equals(memberValue, StringComparison.OrdinalIgnoreCase))?.Name;
5323+
var colorName = colors.GetProperties().FirstOrDefault(m => m.Name.Equals(memberValue, StringComparison.OrdinalIgnoreCase))?.Name;
53245324
if (colorName != null)
53255325
{
5326-
return "SolidColorBrushHelper." + colorName;
5326+
return $"new global::{XamlConstants.Types.SolidColorBrush}(global::{XamlConstants.Types.Colors}.{colorName})";
53275327
}
53285328
else
53295329
{
53305330
memberValue = ColorCodeParser.ParseColorCode(memberValue);
5331-
5332-
return "SolidColorBrushHelper.FromARGB({0})".InvariantCultureFormat(memberValue);
5331+
return $"new global::{XamlConstants.Types.SolidColorBrush}(global::{XamlConstants.Types.Color}.FromArgb({{0}}))".InvariantCultureFormat(memberValue);
53335332
}
53345333
}
53355334

src/Uno.UI/UI/Xaml/Media/Brush.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ public Brush()
1717
InitializeBinder();
1818
}
1919

20-
public static implicit operator Brush(Color uiColor) => SolidColorBrushHelper.FromARGB(uiColor.A, uiColor.R, uiColor.G, uiColor.B);
20+
public static implicit operator Brush(Color uiColor) => new SolidColorBrush(uiColor);
2121

2222
public static implicit operator Brush(string colorCode) => SolidColorBrushHelper.Parse(colorCode);
2323

src/Uno.UI/UI/Xaml/Media/BrushConverter.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ public override object ConvertFrom(ITypeDescriptorContext context, CultureInfo c
2828
switch (value)
2929
{
3030
case string color:
31-
return SolidColorBrushHelper.FromARGB(color);
31+
return SolidColorBrushHelper.Parse(color);
3232

3333
case Color color:
3434
return new SolidColorBrush(color);

0 commit comments

Comments
 (0)