Skip to content

Commit 79b51cd

Browse files
[create-pull-request] automated change
1 parent 69e7b24 commit 79b51cd

File tree

11 files changed

+19
-36
lines changed

11 files changed

+19
-36
lines changed

src/Controls/samples/Controls.Sample/Pages/HitTestingPage.xaml.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -138,8 +138,7 @@ private void HandleTapped(double x, double y)
138138
SelectionLabel.Text = "Selected: " + string.Join(" <- ", elements!.Select(x => x.GetType().Name));
139139
var e = elements!.FirstOrDefault() as Microsoft.Maui.Controls.View;
140140

141-
if (e != null)
142-
e.BackgroundColor = new Microsoft.Maui.Graphics.Color(255, 0, 0);
141+
e?.BackgroundColor = new Microsoft.Maui.Graphics.Color(255, 0, 0);
143142
}
144143

145144
// IWindowOverlayElement/IDrawable is implemented to show the rectangle selection lasso

src/Controls/src/Core/BindableLayout/BindableLayout.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -118,8 +118,7 @@ static void SetBindableLayoutController(BindableObject b, BindableLayoutControll
118118

119119
static void OnControllerChanged(BindableObject b, BindableLayoutController oldC, BindableLayoutController newC)
120120
{
121-
if (oldC != null)
122-
oldC.ItemsSource = null;
121+
oldC?.ItemsSource = null;
123122

124123
if (newC == null)
125124
{

src/Controls/src/Core/ImageElement.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -137,8 +137,7 @@ async static void CancelOldValue(ImageSource oldvalue)
137137
static void ImageSourceChanged(BindableObject bindable, ImageSource newSource)
138138
{
139139
var imageElement = (VisualElement)bindable;
140-
if (newSource != null)
141-
newSource.Parent = imageElement;
140+
newSource?.Parent = imageElement;
142141
imageElement?.InvalidateMeasureInternal(InvalidationTrigger.MeasureChanged);
143142
}
144143

src/Controls/src/Core/Interactivity/TriggerBase.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -96,8 +96,7 @@ internal virtual void OnSeal()
9696
((SealedList<TriggerAction>)ExitActions).IsReadOnly = true;
9797
if (Setters != null)
9898
((SealedList<Setter>)Setters).IsReadOnly = true;
99-
if (Condition != null)
100-
Condition.IsSealed = true;
99+
Condition?.IsSealed = true;
101100
}
102101

103102
void OnConditionChanged(BindableObject bindable, bool oldValue, bool newValue)

src/Controls/src/Core/Internals/EffectUtilities.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,7 @@ public static void RegisterEffectControlProvider(IEffectControlProvider self, IE
1616

1717
controller = newElement;
1818

19-
if (controller != null)
20-
controller.EffectControlProvider = self;
19+
controller?.EffectControlProvider = self;
2120
}
2221

2322
/// <include file="../../../docs/Microsoft.Maui.Controls.Internals/EffectUtilities.xml" path="//Member[@MemberName='UnregisterEffectControlProvider']/Docs/*" />

src/Controls/src/Core/ObservableWrapper.cs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -144,13 +144,11 @@ public TRestrict this[int index]
144144
set
145145
{
146146
int innerIndex = ToInnerIndex(index);
147-
if (value != null)
148-
value.Owned = true;
147+
value?.Owned = true;
149148
TTrack old = _list[innerIndex];
150149
_list[innerIndex] = value;
151150

152-
if (old != null)
153-
old.Owned = false;
151+
old?.Owned = false;
154152
}
155153
}
156154

src/Controls/src/Core/SetterSpecificityList.cs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,16 +24,14 @@ public void SetValue(SetterSpecificity specificity, object value)
2424
if (_first is null || _first.Value.Key == specificity)
2525
{
2626
_first = new KeyValuePair<SetterSpecificity, object>(specificity, value);
27-
if (_values != null)
28-
_values[specificity] = value;
27+
_values?[specificity] = value;
2928
return;
3029
}
3130

3231
if (_second is null || _second.Value.Key == specificity)
3332
{
3433
_second = new KeyValuePair<SetterSpecificity, object>(specificity, value);
35-
if (_values != null)
36-
_values[specificity] = value;
34+
_values?[specificity] = value;
3735
return;
3836
}
3937

src/Controls/src/Core/StyleSheets/Selector.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -116,8 +116,7 @@ static void SetCurrentSelector(ref Selector root, ref Selector workingRoot, ref
116116
op.Left = workingRoot;
117117
op.Right = sel;
118118
workingRoot = op;
119-
if (workingRootParent != null)
120-
workingRootParent.Right = workingRoot;
119+
workingRootParent?.Right = workingRoot;
121120

122121
if (updateRoot)
123122
root = workingRoot;

src/Core/src/Handlers/RadioButton/RadioButtonHandler.Gtk.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
using Gtk;
2-
using System;
1+
using System;
2+
using Gtk;
33

44
namespace Microsoft.Maui.Handlers
55
{

src/Essentials/src/Accelerometer/AccelerometerQueue.shared.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,7 @@ internal void Add(long timestamp, bool accelerating)
2525
added.IsAccelerating = accelerating;
2626
added.Next = null;
2727

28-
if (newest != null)
29-
newest.Next = added;
28+
newest?.Next = added;
3029

3130
newest = added;
3231

0 commit comments

Comments
 (0)