Skip to content

Commit f8abe44

Browse files
committed
feat: Align enums (netstandard2.0)
1 parent d33b60b commit f8abe44

File tree

18 files changed

+260
-88
lines changed

18 files changed

+260
-88
lines changed

src/Uno.UI/DataBinding/BindingPropertyHelper.FastConvert.cs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -593,10 +593,18 @@ private static bool FastStringToTextAlignmentConvert(Type outputType, string inp
593593
output = TextAlignment.Left;
594594
return true;
595595

596+
case "start":
597+
output = TextAlignment.Start;
598+
return true;
599+
596600
case "right":
597601
output = TextAlignment.Right;
598602
return true;
599603

604+
case "end":
605+
output = TextAlignment.End;
606+
return true;
607+
600608
case "justify":
601609
output = TextAlignment.Justify;
602610
return true;

src/Uno.UI/UI/Xaml/Controls/TextBlock/TextBlock.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -632,7 +632,7 @@ public TextDecorations TextDecorations
632632
public static DependencyProperty TextDecorationsProperty =
633633
DependencyProperty.Register(
634634
"TextDecorations",
635-
typeof(int),
635+
typeof(uint),
636636
typeof(TextBlock),
637637
new FrameworkPropertyMetadata(
638638
defaultValue: TextDecorations.None,

src/Uno.UI/UI/Xaml/Documents/TextElement.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -245,7 +245,7 @@ public TextDecorations TextDecorations
245245
public static DependencyProperty TextDecorationsProperty =
246246
DependencyProperty.Register(
247247
"TextDecorations",
248-
typeof(int),
248+
typeof(uint),
249249
typeof(TextElement),
250250
new FrameworkPropertyMetadata(
251251
defaultValue: TextDecorations.None,

src/Uno.UI/UI/Xaml/TextAlignment.cs

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,18 @@ public enum TextAlignment
1414
/// </summary>
1515
Left = 1,
1616
/// <summary>
17+
/// The beginning of the text is aligned to the edge of the container.
18+
/// </summary>
19+
Start = 1,
20+
/// <summary>
1721
/// Text is aligned to the right edge of the container.
1822
/// </summary>
1923
Right = 2,
2024
/// <summary>
25+
/// The end of the text is aligned to the edge of the container.
26+
/// </summary>
27+
End = 2,
28+
/// <summary>
2129
/// Text is justified within the container.
2230
/// </summary>
2331
Justify = 3,
@@ -26,4 +34,4 @@ public enum TextAlignment
2634
/// </summary>
2735
DetectFromContent = 4,
2836
}
29-
}
37+
}

src/Uno.UWP/ApplicationModel/Contacts/ContactQueryDesiredFields.cs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,23 +6,23 @@ namespace Windows.ApplicationModel.Contacts
66
/// Defines which fields must exist on a contact in order to match a search operation.
77
/// </summary>
88
[Flags]
9-
public enum ContactQueryDesiredFields
9+
public enum ContactQueryDesiredFields : uint
1010
{
1111
/// <summary>
1212
/// No required fields.
1313
/// </summary>
14-
None = 0,
14+
None = 0U,
1515
/// <summary>
1616
/// The contact must have a phone number.
1717
/// </summary>
18-
PhoneNumber = 1,
18+
PhoneNumber = 1U,
1919
/// <summary>
2020
/// The contact must have an email address.
2121
/// </summary>
22-
EmailAddress = 2,
22+
EmailAddress = 2U,
2323
/// <summary>
2424
/// The contact must have a postal address.
2525
/// </summary>
26-
PostalAddress = 4
26+
PostalAddress = 4U
2727
}
2828
}
Lines changed: 21 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,28 @@
1-

2-
3-
using System;
1+
using System;
42

53
namespace Windows.Devices.Geolocation.Geofencing
64
{
5+
/// <summary>
6+
/// Indicates the current state of a Geofence.
7+
/// </summary>
78
[Flags]
8-
public enum GeofenceState
9+
public enum GeofenceState : uint
910
{
10-
None =0,
11-
Entered=1,
12-
Exited=2,
13-
Removed=4,
11+
/// <summary>
12+
/// No flag is set.
13+
/// </summary>
14+
None = 0U,
15+
/// <summary>
16+
/// The device has entered the geofence area.
17+
/// </summary>
18+
Entered = 1U,
19+
/// <summary>
20+
/// The device has left the geofence area.
21+
/// </summary>
22+
Exited = 2U,
23+
/// <summary>
24+
/// The geofence was removed.
25+
/// </summary>
26+
Removed = 4U
1427
}
1528
}
Lines changed: 20 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,28 @@
11
using System;
2-
using System.Collections.Generic;
3-
using System.Text;
42

53
namespace Windows.Devices.Geolocation.Geofencing
64
{
5+
/// <summary>
6+
/// Indicates the state or states of the Geofences that are currently being monitored by the system.
7+
/// </summary>
78
[Flags]
8-
public enum MonitoredGeofenceStates
9+
public enum MonitoredGeofenceStates : uint
910
{
10-
None =0,
11-
Entered=1,
12-
Exited=2,
13-
Removed=4,
11+
/// <summary>
12+
/// No flag is set.
13+
/// </summary>
14+
None = 0U,
15+
/// <summary>
16+
/// The device has entered a geofence area.
17+
/// </summary>
18+
Entered = 1U,
19+
/// <summary>
20+
/// The device has left a geofence area.
21+
/// </summary>
22+
Exited = 2U,
23+
/// <summary>
24+
/// The geofence has been removed.
25+
/// </summary>
26+
Removed = 4U
1427
}
1528
}
Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,21 @@
1-
using System.Collections.Generic;
2-
using System.Linq;
3-
using System.Text;
4-
using Uno;
1+
using System;
52

63
namespace Windows.Graphics.Display
74
{
8-
public enum DisplayBrightnessOverrideOptions
5+
/// <summary>
6+
/// Describes the options that modify the brightness level of the screen during the override session. When UseDimmedPolicyWhenBatteryIsLow is set, it reduces the specified override brightness level in order to conserve battery if the device battery is low during the override session. For example, if the override brightness level is set to 100% and UseDimmedPolicyWhenBatteryIsLow is set, the screen will dim to 70% instead.
7+
/// </summary>
8+
[Flags]
9+
public enum DisplayBrightnessOverrideOptions : uint
910
{
10-
None,
11-
[NotImplemented]
12-
UseDimmedPolicyWhenBatteryIsLow
11+
/// <summary>
12+
/// Screen display stays at the specified override brightness level when the device battery is low.
13+
/// </summary>
14+
None = 0U,
15+
/// <summary>
16+
/// Screen display dims when the device battery is low and a brightness override session is running.
17+
/// </summary>
18+
[Uno.NotImplemented]
19+
UseDimmedPolicyWhenBatteryIsLow = 1U
1320
}
1421
}
Lines changed: 27 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,32 @@
11
using System;
2-
using System.Collections.Generic;
3-
using System.Text;
42

53
namespace Windows.Graphics.Display
6-
{
4+
{
5+
/// <summary>
6+
/// Describes the orientation of a rectangular monitor.
7+
/// </summary>
78
[Flags]
8-
public enum DisplayOrientations
9-
{
10-
None = 0,
11-
Landscape = 1,
12-
Portrait = 2,
13-
LandscapeFlipped = 4,
14-
PortraitFlipped = 8,
15-
}
9+
public enum DisplayOrientations : uint
10+
{
11+
/// <summary>
12+
/// No display orientation is specified.
13+
/// </summary>
14+
None = 0U,
15+
/// <summary>
16+
/// Specifies that the monitor is oriented in landscape mode where the width of the display viewing area is greater than the height.
17+
/// </summary>
18+
Landscape = 1U,
19+
/// <summary>
20+
/// Specifies that the monitor rotated 90 degrees in the clockwise direction to orient the display in portrait mode where the height of the display viewing area is greater than the width.
21+
/// </summary>
22+
Portrait = 2U,
23+
/// <summary>
24+
/// Specifies that the monitor rotated another 90 degrees in the clockwise direction (to equal 180 degrees) to orient the display in landscape mode where the width of the display viewing area is greater than the height. This landscape mode is flipped 180 degrees from the **Landscape** mode.
25+
/// </summary>
26+
LandscapeFlipped = 4U,
27+
/// <summary>
28+
/// Specifies that the monitor rotated another 90 degrees in the clockwise direction (to equal 270 degrees) to orient the display in portrait mode where the height of the display viewing area is greater than the width. This portrait mode is flipped 180 degrees from the **Portrait** mode.
29+
/// </summary>
30+
PortraitFlipped = 8U
31+
}
1632
}
Lines changed: 30 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,35 @@
1+
using System;
2+
13
namespace Windows.Security.Authentication.Web
24
{
3-
public enum WebAuthenticationOptions
5+
/// <summary>
6+
/// Contains the options available to the asynchronous operation.
7+
/// </summary>
8+
[Flags]
9+
public enum WebAuthenticationOptions : uint
410
{
5-
None,
6-
SilentMode,
7-
[global::Uno.NotImplemented] UseTitle,
8-
[global::Uno.NotImplemented] UseHttpPost,
9-
[global::Uno.NotImplemented] UseCorporateNetwork
11+
/// <summary>
12+
/// No options are requested.
13+
/// </summary>
14+
None = 0U,
15+
/// <summary>
16+
/// Tells the web authentication broker to not render any UI. This option will throw an exception if used with AuthenticateAndContinue; AuthenticateSilentlyAsync, which includes this option implicitly, should be used instead.
17+
/// </summary>
18+
SilentMode = 1U,
19+
/// <summary>
20+
/// Tells the web authentication broker to return the window title string of the webpage in the ResponseData property.
21+
/// </summary>
22+
[Uno.NotImplemented]
23+
UseTitle = 2U,
24+
/// <summary>
25+
/// Tells the web authentication broker to return the body of the HTTP POST in the ResponseData property. For use with single sign-on (SSO) only.
26+
/// </summary>
27+
[Uno.NotImplemented]
28+
UseHttpPost = 4U,
29+
/// <summary>
30+
/// Tells the web authentication broker to render the webpage in an app container that supports privateNetworkClientServer, enterpriseAuthentication, and sharedUserCertificate capabilities. Note the application that uses this flag must have these capabilities as well.
31+
/// </summary>
32+
[Uno.NotImplemented]
33+
UseCorporateNetwork = 8U
1034
}
1135
}
Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,24 @@
1+
using System;
2+
13
namespace Windows.Storage
24
{
3-
public enum StorageItemTypes
5+
/// <summary>
6+
/// Describes whether an item that implements the IStorageItem interface is a file or a folder.
7+
/// </summary>
8+
[Flags]
9+
public enum StorageItemTypes : uint
410
{
5-
None,
6-
File,
7-
Folder,
11+
/// <summary>
12+
/// A storage item that is neither a file nor a folder.
13+
/// </summary>
14+
None = 0U,
15+
/// <summary>
16+
/// A file that is represented as a StorageFile instance.
17+
/// </summary>
18+
File = 1U,
19+
/// <summary>
20+
/// A folder that is represented as a StorageFolder instance.
21+
/// </summary>
22+
Folder = 2U
823
}
924
}
Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,24 @@
1+
using System;
2+
13
namespace Windows.Storage
24
{
3-
public enum StorageOpenOptions
5+
/// <summary>
6+
/// Provides options to use when opening a file.
7+
/// </summary>
8+
[Flags]
9+
public enum StorageOpenOptions : uint
410
{
5-
None,
6-
AllowOnlyReaders,
7-
AllowReadersAndWriters,
11+
/// <summary>
12+
/// No options are specified.
13+
/// </summary>
14+
None = 0U,
15+
/// <summary>
16+
/// Only allow the file to be read.
17+
/// </summary>
18+
AllowOnlyReaders = 1U,
19+
/// <summary>
20+
/// Allows both readers and writers to coexist.
21+
/// </summary>
22+
AllowReadersAndWriters = 2U
823
}
924
}

src/Uno.UWP/System.Threading/WorkItemOptions.cs

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,19 @@
22

33
namespace Windows.System.Threading
44
{
5+
/// <summary>
6+
/// Specifies how work items should be run.
7+
/// </summary>
58
[Flags]
6-
public enum WorkItemOptions
9+
public enum WorkItemOptions : uint
710
{
8-
None = 0,
9-
TimeSliced = 1
11+
/// <summary>
12+
/// The work item should be run when the thread pool has an available worker thread.
13+
/// </summary>
14+
None = 0U,
15+
/// <summary>
16+
/// The work items should be run simultaneously with other work items sharing a processor.
17+
/// </summary>
18+
TimeSliced = 1U
1019
}
1120
}
Lines changed: 26 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,32 @@
1-
#nullable enable
1+
using System;
22

33
namespace Windows.UI.Composition
44
{
5-
public enum CompositionBatchTypes
5+
/// <summary>
6+
/// Batch types for CompositionCommitBatch and CompositionScopedBatch.
7+
/// </summary>
8+
[Flags]
9+
public enum CompositionBatchTypes : uint
610
{
7-
None,
8-
Animation,
9-
Effect,
11+
/// <summary>
12+
/// None.
13+
/// </summary>
14+
None = 0U,
15+
/// <summary>
16+
/// The batch contains animations.
17+
/// </summary>
18+
Animation = 1U,
19+
/// <summary>
20+
/// The batch contains effects.
21+
/// </summary>
22+
Effect = 2U,
23+
/// <summary>
24+
/// The batch contains an infinite animation.
25+
/// </summary>
26+
InfiniteAnimation = 4U,
27+
/// <summary>
28+
/// The batch contains all animations.
29+
/// </summary>
30+
AllAnimations = InfiniteAnimation | Animation
1031
}
1132
}

0 commit comments

Comments
 (0)