Browse Source

Added nullable annotations.

pull/4080/head
Steven Kirk 6 years ago
parent
commit
e209307931
  1. 3
      src/Avalonia.Layout/ILayoutManager.cs
  2. 2
      src/Avalonia.Layout/ILayoutable.cs
  3. 10
      src/Avalonia.Layout/LayoutManager.cs
  4. 5
      src/Avalonia.Layout/Layoutable.cs

3
src/Avalonia.Layout/ILayoutManager.cs

@ -1,3 +1,6 @@
using System;
#nullable enable
namespace Avalonia.Layout
{

2
src/Avalonia.Layout/ILayoutable.cs

@ -1,5 +1,7 @@
using Avalonia.VisualTree;
#nullable enable
namespace Avalonia.Layout
{
/// <summary>

10
src/Avalonia.Layout/LayoutManager.cs

@ -3,6 +3,8 @@ using System.Diagnostics;
using Avalonia.Logging;
using Avalonia.Threading;
#nullable enable
namespace Avalonia.Layout
{
/// <summary>
@ -24,7 +26,7 @@ namespace Avalonia.Layout
/// <inheritdoc/>
public void InvalidateMeasure(ILayoutable control)
{
Contract.Requires<ArgumentNullException>(control != null);
control = control ?? throw new ArgumentNullException(nameof(control));
Dispatcher.UIThread.VerifyAccess();
if (!control.IsAttachedToVisualTree)
@ -45,7 +47,7 @@ namespace Avalonia.Layout
/// <inheritdoc/>
public void InvalidateArrange(ILayoutable control)
{
Contract.Requires<ArgumentNullException>(control != null);
control = control ?? throw new ArgumentNullException(nameof(control));
Dispatcher.UIThread.VerifyAccess();
if (!control.IsAttachedToVisualTree)
@ -73,7 +75,7 @@ namespace Avalonia.Layout
{
_running = true;
Stopwatch stopwatch = null;
Stopwatch? stopwatch = null;
const LogEventLevel timingLogLevel = LogEventLevel.Information;
bool captureTiming = Logger.IsEnabled(timingLogLevel);
@ -117,7 +119,7 @@ namespace Avalonia.Layout
if (captureTiming)
{
stopwatch.Stop();
stopwatch!.Stop();
Logger.TryGet(timingLogLevel)?.Log(LogArea.Layout, this, "Layout pass finished in {Time}", stopwatch.Elapsed);
}

5
src/Avalonia.Layout/Layoutable.cs

@ -1,8 +1,9 @@
using System;
using Avalonia.Logging;
using Avalonia.Utilities;
using Avalonia.VisualTree;
#nullable enable
namespace Avalonia.Layout
{
/// <summary>
@ -153,7 +154,7 @@ namespace Avalonia.Layout
/// <summary>
/// Occurs when a layout pass completes for the control.
/// </summary>
public event EventHandler LayoutUpdated;
public event EventHandler? LayoutUpdated;
/// <summary>
/// Gets or sets the width of the element.

Loading…
Cancel
Save