10000 [StyleCleanUp] Address IDE warnings Part 3 by harshit7962 · Pull Request #10188 · dotnet/wpf · GitHub
[go: up one dir, main page]

Skip to content

[StyleCleanUp] Address IDE warnings Part 3 #10188

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Jan 30, 2025
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Update: Resolve IDE0030 in src
  • Loading branch information
harshit7962 committed Dec 13, 2024
commit 6dc7125f8fbb878b87ed53f07847c48075c7da24
3 changes: 0 additions & 3 deletions src/Microsoft.DotNet.Wpf/src/.editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -203,9 +203,6 @@ dotnet_diagnostic.IDE0020.severity = suggestion
# IDE0029: Use coalesce expression
dotnet_diagnostic.IDE0029.severity = suggestion

# IDE0030: Null check can be simplified
dotnet_diagnostic.IDE0030.severity = suggestion

# IDE0031: Use null propagation
dotnet_diagnostic.IDE0031.severity = suggestion

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Licensed to the .NET Foundation under one or more agreements.
// 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.

Expand Down Expand Up @@ -236,11 +236,11 @@ public double? CurrentProgress


/// <summary>
/// Gets a value indicating whether the Clocks current time is inside the Active period
/// Gets a value indicating whether the Clocks current time is inside the Active period
/// (meaning properties may change frame to frame), inside the Fill period, or Stopped.
/// </summary>
/// <remarks>
/// You can tell whether youre in FillBegin or FillEnd by the value of CurrentProgress
/// You can tell whether youre in FillBegin or FillEnd by the value of CurrentProgress
/// (0 for FillBegin, 1 for FillEnd).
/// </remarks>
public ClockState CurrentState
Expand Down Expand Up @@ -486,7 +486,7 @@ protected virtual TimeSpan GetCurrentTimeCore()
{
Debug.Assert(!IsTimeManager);

return _currentTime.HasValue ? _currentTime.Value : TimeSpan.Zero;
return _currentTime ?? TimeSpan.Zero;
}

/// <summary>
Expand Down Expand Up @@ -1949,8 +1949,7 @@ private bool ComputeCurrentIteration(TimeSpan parentTime, double parentSpeed,
RepeatBehavior repeatBehavior = _timeline.RepeatBehavior;

// Apply speed and offset, convert down to TimeSpan
TimeSpan beginTimeForOffsetComputation = _currentIterationBeginTime.HasValue ? _currentIterationBeginTime.Value
: _beginTime.Value;
TimeSpan beginTimeForOffsetComputation = _currentIterationBeginTime ?? _beginTime.Value;
TimeSpan offsetFromBegin = MultiplyTimeSpan(parentTime - beginTimeForOffsetComputation, _appliedSpeedRatio);

// This may be set redundantly in one case, but simplifies code
Expand Down Expand Up @@ -2806,7 +2805,7 @@ private void ComputeIntervalsWithHoldEnd(

if (parentIntervalCollection.Intersects(fillPeriod)) // We enter or leave Fill period
{
TimeSpan relativeBeginTime = _currentIterationBeginTime.HasValue ? _currentIterationBeginTime.Value : _beginTime.Value;
TimeSpan relativeBeginTime = _currentIterationBeginTime ?? _beginTime.Value;
ComputeCurrentFillInterval(parentIntervalCollection,
relativeBeginTime, endOfActivePeriod.Value,
_currentDuration, _appliedSpeedRatio,
Expand All @@ -2833,7 +2832,7 @@ private void ComputeIntervalsWithParentIntersection(
Duration postFillDuration)
{
// Make sure that our periodic function is aligned to the boundary of the current iteration, regardless of prior slip
TimeSpan relativeBeginTime = _currentIterationBeginTime.HasValue ? _currentIterationBeginTime.Value : _beginTime.Value;
TimeSpan relativeBeginTime = _currentIterationBeginTime ?? _beginTime.Value;

RaiseCurrentTimeInvalidated();

Expand Down Expand Up @@ -3178,7 +3177,7 @@ private void ComputeSyncEnter(ref TimeIntervalCollection parentIntervalCollectio
// With these limitations, we can easily preview our CurrentTime:
if (_beginTime.HasValue && currentParentTimePT >= _beginTime.Value)
{
TimeSpan relativeBeginTimePT = _currentIterationBeginTime.HasValue ? _currentIterationBeginTime.Value : _beginTime.Value;
TimeSpan relativeBeginTimePT = _currentIterationBeginTime ?? _beginTime.Value;
TimeSpan previewCurrentOffsetPT = currentParentTimePT - relativeBeginTimePT; // This is our time offset (not yet scaled by speed)
TimeSpan previewCurrentTimeLT = MultiplyTimeSpan(previewCurrentOffsetPT, _appliedSpeedRatio); // This is what our time would be

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Licensed to the .NET Foundation under one or more agreements.
// 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.

Expand Down Expand Up @@ -119,10 +119,10 @@ private void Sync()
if (_mediaPlayer != null)
{
double? currentSpeedProperty = this.CurrentGlobalSpeed;
double currentSpeedValue = currentSpeedProperty.HasValue ? currentSpeedProperty.Value : 0;
double currentSpeedValue = currentSpeedProperty ?? 0;

TimeSpan? currentTimeProperty = this.CurrentTime;
TimeSpan currentTimeValue = currentTimeProperty.HasValue ? currentTimeProperty.Value : TimeSpan.Zero;
TimeSpan currentTimeValue = currentTimeProperty ?? TimeSpan.Zero;

// If speed was potentially changed to 0, make sure we set media's speed to 0 (e.g. pause) before
// setting the position to the target frame. Otherwise, the media's scrubbing mechanism would
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Licensed to the .NET Foundation under one or more agreements.
// 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.

Expand Down Expand Up @@ -33,7 +33,7 @@ public object Convert(object value, Type targetType, object parameter, CultureIn
else if (value is Nullable<bool>)
{
Nullable<bool> tmp = (Nullable<bool>)value;
bValue = tmp.HasValue ? tmp.Value : false;
bValue = tmp ?? false;
}
return (bValue) ? Visibility.Visible : Visibility.Collapsed;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -307,7 +307,7 @@ public static bool IsCurrentSessionConnectStateWTSActive(int? SessionId = null,
IntPtr buffer = IntPtr.Zero;
int bytesReturned;

int sessionId = SessionId.HasValue ? SessionId.Value : NativeMethods.WTS_CURRENT_SESSION;
int sessionId = SessionId ?? NativeMethods.WTS_CURRENT_SESSION;
bool currentSessionConnectState = defaultResult;

try
Expand Down
0