Browse Source

Merge pull request #11437 from AvaloniaUI/refactor/grokys-internalize

Make miscellaneous Avalonia.Base APIs internal
pull/11453/head
Max Katz 3 years ago
committed by GitHub
parent
commit
6c09a0f46b
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 2
      samples/GpuInterop/VulkanDemo/VulkanContext.cs
  2. 6
      samples/VirtualizationDemo/ViewModels/PlaygroundPageViewModel.cs
  3. 4
      src/Avalonia.Base/Animation/Animatable.cs
  4. 1
      src/Avalonia.Base/Avalonia.Base.csproj
  5. 2
      src/Avalonia.Base/AvaloniaPropertyExtensions.cs
  6. 2
      src/Avalonia.Base/Collections/Pooled/ClearMode.cs
  7. 2
      src/Avalonia.Base/Collections/Pooled/IReadOnlyPooledList.cs
  8. 2
      src/Avalonia.Base/Collections/Pooled/PooledList.cs
  9. 2
      src/Avalonia.Base/Collections/Pooled/PooledStack.cs
  10. 2
      src/Avalonia.Base/Controls/ChildNameScope.cs
  11. 2
      src/Avalonia.Base/Data/Core/CommonPropertyNames.cs
  12. 2
      src/Avalonia.Base/Data/IndexerBinding.cs
  13. 2
      src/Avalonia.Base/Diagnostics/IAvaloniaObjectDebug.cs
  14. 2
      src/Avalonia.Base/Diagnostics/INotifyCollectionChangedDebug.cs
  15. 2
      src/Avalonia.Base/EnumExtensions.cs
  16. 2
      src/Avalonia.Base/Input/AccessKeyHandler.cs
  17. 2
      src/Avalonia.Base/Input/KeyboardNavigationHandler.cs
  18. 2
      src/Avalonia.Base/Interactivity/Interactive.cs
  19. 2
      src/Avalonia.Base/Logging/TraceLogSink.cs
  20. 2
      src/Avalonia.Base/Media/ArcSegment.cs
  21. 2
      src/Avalonia.Base/Media/BezierSegment .cs
  22. 2
      src/Avalonia.Base/Media/Imaging/Bitmap.cs
  23. 2
      src/Avalonia.Base/Media/Immutable/ImmutableTileBrush.cs
  24. 2
      src/Avalonia.Base/Media/LineSegment.cs
  25. 4
      src/Avalonia.Base/Media/PathSegment.cs
  26. 2
      src/Avalonia.Base/Media/PolyLineSegment.cs
  27. 2
      src/Avalonia.Base/Media/QuadraticBezierSegment .cs
  28. 1
      src/Avalonia.Base/Media/StreamGeometryContext.cs
  29. 2
      src/Avalonia.Base/Media/Transformation/TransformParser.cs
  30. 6
      src/Avalonia.Base/Platform/Storage/NameCollisionOption.cs
  31. 2
      src/Avalonia.Base/Rendering/ManagedDeferredRendererLock.cs
  32. 50
      src/Avalonia.Base/Rendering/RendererBase.cs
  33. 2
      src/Avalonia.Base/Rendering/Utilities/TileBrushCalculator.cs
  34. 3
      src/Avalonia.Base/Rendering/ZIndexComparer.cs
  35. 2
      src/Avalonia.Base/StyledElement.cs
  36. 2
      src/Avalonia.Base/Utilities/DisposableLock.cs
  37. 2
      src/Avalonia.Base/Utilities/NonPumpingLockHelper.cs
  38. 2
      src/Avalonia.Base/Utilities/SingleOrDictionary.cs
  39. 2
      src/Avalonia.Base/Utilities/SingleOrQueue.cs
  40. 2
      src/Avalonia.Base/Utilities/ValueSingleOrList.cs
  41. 49
      src/Avalonia.Base/Utilities/WeakTimer.cs
  42. 2
      src/Avalonia.Base/Visual.cs
  43. 4
      src/Avalonia.Controls.ItemsRepeater/Controls/RepeaterLayoutContext.cs
  44. 2
      src/Avalonia.Controls/Presenters/ScrollContentPresenter.cs
  45. 2
      src/Avalonia.Controls/Primitives/AccessText.cs
  46. 2
      src/Avalonia.Controls/Primitives/OverlayPopupHost.cs
  47. 2
      src/Avalonia.Controls/Primitives/PopupRoot.cs
  48. 2
      src/Avalonia.Controls/Primitives/ScrollBar.cs
  49. 2
      src/Avalonia.Controls/Primitives/TemplatedControl.cs
  50. 2
      src/Avalonia.Controls/Primitives/VisualLayerManager.cs
  51. 2
      src/Avalonia.Controls/TextBlock.cs
  52. 2
      src/Avalonia.Controls/Viewbox.cs
  53. 4
      src/Headless/Avalonia.Headless.Vnc/HeadlessVncFramebufferSource.cs
  54. 8
      src/Windows/Avalonia.Win32.Interop/Wpf/WpfTopLevelImpl.cs
  55. 6
      tests/Avalonia.IntegrationTests.Appium/PlatformFactAttribute.cs
  56. 4
      tests/Avalonia.IntegrationTests.Appium/PlatformTheoryAttribute.cs

2
samples/GpuInterop/VulkanDemo/VulkanContext.cs

@ -174,7 +174,7 @@ public unsafe class VulkanContext : IDisposable
for (uint queueFamilyIndex = 0; queueFamilyIndex < queueFamilyCount; queueFamilyIndex++)
{
var family = familyProperties[queueFamilyIndex];
if (!family.QueueFlags.HasAllFlags(QueueFlags.GraphicsBit))
if (!family.QueueFlags.HasFlag(QueueFlags.GraphicsBit))
continue;

6
samples/VirtualizationDemo/ViewModels/PlaygroundPageViewModel.cs

@ -24,19 +24,19 @@ public class PlaygroundPageViewModel : ViewModelBase
public bool Multiple
{
get => _selectionMode.HasAnyFlag(SelectionMode.Multiple);
get => _selectionMode.HasFlag(SelectionMode.Multiple);
set => SetSelectionMode(SelectionMode.Multiple, value);
}
public bool Toggle
{
get => _selectionMode.HasAnyFlag(SelectionMode.Toggle);
get => _selectionMode.HasFlag(SelectionMode.Toggle);
set => SetSelectionMode(SelectionMode.Toggle, value);
}
public bool AlwaysSelected
{
get => _selectionMode.HasAnyFlag(SelectionMode.AlwaysSelected);
get => _selectionMode.HasFlag(SelectionMode.AlwaysSelected);
set => SetSelectionMode(SelectionMode.AlwaysSelected, value);
}

4
src/Avalonia.Base/Animation/Animatable.cs

@ -58,7 +58,7 @@ namespace Avalonia.Animation
/// This method should not be called from user code, it will be called automatically by the framework
/// when a control is added to the visual tree.
/// </remarks>
protected void EnableTransitions()
internal void EnableTransitions()
{
if (!_transitionsEnabled)
{
@ -83,7 +83,7 @@ namespace Avalonia.Animation
/// This method should not be called from user code, it will be called automatically by the framework
/// when a control is removed from the visual tree.
/// </remarks>
protected void DisableTransitions()
internal void DisableTransitions()
{
if (_transitionsEnabled)
{

1
src/Avalonia.Base/Avalonia.Base.csproj

@ -63,6 +63,7 @@
<InternalsVisibleTo Include="Avalonia.iOS, PublicKey=$(AvaloniaPublicKey)" />
<InternalsVisibleTo Include="Avalonia.Dialogs, PublicKey=$(AvaloniaPublicKey)" />
<InternalsVisibleTo Include="Avalonia.Diagnostics, PublicKey=$(AvaloniaPublicKey)" />
<InternalsVisibleTo Include="Avalonia.LinuxFramebuffer, PublicKey=$(AvaloniaPublicKey)" />
<InternalsVisibleTo Include="MiniMvvm, PublicKey=$(AvaloniaPublicKey)" />
<InternalsVisibleTo Include="ControlCatalog, PublicKey=$(AvaloniaPublicKey)" />
<InternalsVisibleTo Include="DynamicProxyGenAssembly2, PublicKey=0024000004800000940000000602000000240000525341310004000001000100c547cac37abd99c8db225ef2f6c8a3602f3b3606cc9891605d02baa56104f4cfc0734aa39b93bf7852f7d9266654753cc297e7d2edfe0bac1cdcf9f717241550e0a7b191195b7667bb4f64bcb8e2121380fd1d9d46ad2d92d2d15605093924cceaf74c4861eff62abf69b9291ed0a340e113be11e6a7d3113e92484cf7045cc7" />

2
src/Avalonia.Base/AvaloniaPropertyExtensions.cs

@ -7,7 +7,7 @@ namespace Avalonia
/// <summary>
/// Extensions for <see cref="AvaloniaProperty"/>.
/// </summary>
public static class AvaloniaPropertyExtensions
internal static class AvaloniaPropertyExtensions
{
/// <summary>
/// Checks if values of given property can affect rendering (via <see cref="IAffectsRender"/>).

2
src/Avalonia.Base/Collections/Pooled/ClearMode.cs

@ -9,7 +9,7 @@ namespace Avalonia.Collections.Pooled
/// what each option does before using anything other than the default
/// of Auto.
/// </summary>
public enum ClearMode
internal enum ClearMode
{
/// <summary>
/// <para><code>Auto</code> has different behavior depending on the host project's target framework.</para>

2
src/Avalonia.Base/Collections/Pooled/IReadOnlyPooledList.cs

@ -11,7 +11,7 @@ namespace Avalonia.Collections.Pooled
/// </summary>
/// <typeparam name="T">The type of elements in the read-only pooled list.</typeparam>
public interface IReadOnlyPooledList<T> : IReadOnlyList<T>
internal interface IReadOnlyPooledList<T> : IReadOnlyList<T>
{
#pragma warning disable CS0419
/// <summary>

2
src/Avalonia.Base/Collections/Pooled/PooledList.cs

@ -29,7 +29,7 @@ namespace Avalonia.Collections.Pooled
[DebuggerDisplay("Count = {Count}")]
[DebuggerTypeProxy(typeof(ICollectionDebugView<>))]
[Serializable]
public class PooledList<T> : IList<T>, IReadOnlyPooledList<T>, IList, IDisposable, IDeserializationCallback
internal class PooledList<T> : IList<T>, IReadOnlyPooledList<T>, IList, IDisposable, IDeserializationCallback
{
// internal constant copied from Array.MaxArrayLength
private const int MaxArrayLength = 0x7FEFFFFF;

2
src/Avalonia.Base/Collections/Pooled/PooledStack.cs

@ -29,7 +29,7 @@ namespace Avalonia.Collections.Pooled
[DebuggerTypeProxy(typeof(StackDebugView<>))]
[DebuggerDisplay("Count = {Count}")]
[Serializable]
public class PooledStack<T> : IEnumerable<T>, ICollection, IReadOnlyCollection<T>, IDisposable, IDeserializationCallback
internal class PooledStack<T> : IEnumerable<T>, ICollection, IReadOnlyCollection<T>, IDisposable, IDeserializationCallback
{
[NonSerialized]
private ArrayPool<T> _pool;

2
src/Avalonia.Base/Controls/ChildNameScope.cs

@ -3,7 +3,7 @@ using Avalonia.Utilities;
namespace Avalonia.Controls
{
public class ChildNameScope : INameScope
internal class ChildNameScope : INameScope
{
private readonly INameScope _parentScope;
private readonly NameScope _inner = new NameScope();

2
src/Avalonia.Base/Data/Core/CommonPropertyNames.cs

@ -1,6 +1,6 @@
namespace Avalonia.Data.Core
{
public static class CommonPropertyNames
internal static class CommonPropertyNames
{
public const string IndexerName = "Item";
}

2
src/Avalonia.Base/Data/IndexerBinding.cs

@ -2,7 +2,7 @@
namespace Avalonia.Data
{
public class IndexerBinding : IBinding
internal class IndexerBinding : IBinding
{
public IndexerBinding(
AvaloniaObject source,

2
src/Avalonia.Base/Diagnostics/IAvaloniaObjectDebug.cs

@ -5,7 +5,7 @@ namespace Avalonia.Diagnostics
/// <summary>
/// Provides a debug interface into <see cref="AvaloniaObject"/>.
/// </summary>
public interface IAvaloniaObjectDebug
internal interface IAvaloniaObjectDebug
{
/// <summary>
/// Gets the subscriber list for the <see cref="AvaloniaObject.PropertyChanged"/>

2
src/Avalonia.Base/Diagnostics/INotifyCollectionChangedDebug.cs

@ -8,7 +8,7 @@ namespace Avalonia.Diagnostics
/// Provides a debug interface into <see cref="INotifyCollectionChanged"/> subscribers on
/// <see cref="AvaloniaList{T}"/>
/// </summary>
public interface INotifyCollectionChangedDebug
internal interface INotifyCollectionChangedDebug
{
/// <summary>
/// Gets the subscriber list for the <see cref="INotifyCollectionChanged.CollectionChanged"/>

2
src/Avalonia.Base/EnumExtensions.cs

@ -6,7 +6,7 @@ namespace Avalonia
/// <summary>
/// Provides extension methods for enums.
/// </summary>
public static class EnumExtensions
internal static class EnumExtensions
{
[MethodImpl(MethodImplOptions.AggressiveInlining)]

2
src/Avalonia.Base/Input/AccessKeyHandler.cs

@ -9,7 +9,7 @@ namespace Avalonia.Input
/// <summary>
/// Handles access keys for a window.
/// </summary>
public class AccessKeyHandler : IAccessKeyHandler
internal class AccessKeyHandler : IAccessKeyHandler
{
/// <summary>
/// Defines the AccessKeyPressed attached event.

2
src/Avalonia.Base/Input/KeyboardNavigationHandler.cs

@ -1,6 +1,7 @@
using System;
using System.Diagnostics.CodeAnalysis;
using Avalonia.Input.Navigation;
using Avalonia.Metadata;
using Avalonia.VisualTree;
namespace Avalonia.Input
@ -8,6 +9,7 @@ namespace Avalonia.Input
/// <summary>
/// Handles keyboard navigation for a window.
/// </summary>
[Unstable]
public class KeyboardNavigationHandler : IKeyboardNavigationHandler
{
/// <summary>

2
src/Avalonia.Base/Interactivity/Interactive.cs

@ -17,7 +17,7 @@ namespace Avalonia.Interactivity
/// <summary>
/// Gets the interactive parent of the object for bubbling and tunneling events.
/// </summary>
protected internal virtual Interactive? InteractiveParent => VisualParent as Interactive;
internal virtual Interactive? InteractiveParent => VisualParent as Interactive;
/// <summary>
/// Adds a handler for the specified routed event.

2
src/Avalonia.Base/Logging/TraceLogSink.cs

@ -6,7 +6,7 @@ using Avalonia.Utilities;
namespace Avalonia.Logging
{
public class TraceLogSink : ILogSink
internal class TraceLogSink : ILogSink
{
private readonly LogEventLevel _level;
private readonly IList<string>? _areas;

2
src/Avalonia.Base/Media/ArcSegment.cs

@ -95,7 +95,7 @@ namespace Avalonia.Media
set { SetValue(SweepDirectionProperty, value); }
}
protected internal override void ApplyTo(StreamGeometryContext ctx)
internal override void ApplyTo(StreamGeometryContext ctx)
{
ctx.ArcTo(Point, Size, RotationAngle, IsLargeArc, SweepDirection);
}

2
src/Avalonia.Base/Media/BezierSegment .cs

@ -56,7 +56,7 @@ namespace Avalonia.Media
set { SetValue(Point3Property, value); }
}
protected internal override void ApplyTo(StreamGeometryContext ctx)
internal override void ApplyTo(StreamGeometryContext ctx)
{
ctx.CubicBezierTo(Point1, Point2, Point3);
}

2
src/Avalonia.Base/Media/Imaging/Bitmap.cs

@ -173,7 +173,7 @@ namespace Avalonia.Media.Imaging
public virtual PixelFormat? Format => (PlatformImpl.Item as IReadableBitmapImpl)?.Format;
protected internal unsafe void CopyPixelsCore(PixelRect sourceRect, IntPtr buffer, int bufferSize, int stride,
private protected unsafe void CopyPixelsCore(PixelRect sourceRect, IntPtr buffer, int bufferSize, int stride,
ILockedFramebuffer fb)
{
if ((sourceRect.Width <= 0 || sourceRect.Height <= 0) && (sourceRect.X != 0 || sourceRect.Y != 0))

2
src/Avalonia.Base/Media/Immutable/ImmutableTileBrush.cs

@ -21,7 +21,7 @@ namespace Avalonia.Media.Immutable
/// How the source rectangle will be stretched to fill the destination rect.
/// </param>
/// <param name="tileMode">The tile mode.</param>
protected internal ImmutableTileBrush(
private protected ImmutableTileBrush(
AlignmentX alignmentX,
AlignmentY alignmentY,
RelativeRect destinationRect,

2
src/Avalonia.Base/Media/LineSegment.cs

@ -22,7 +22,7 @@ namespace Avalonia.Media
set { SetValue(PointProperty, value); }
}
protected internal override void ApplyTo(StreamGeometryContext ctx)
internal override void ApplyTo(StreamGeometryContext ctx)
{
ctx.LineTo(Point);
}

4
src/Avalonia.Base/Media/PathSegment.cs

@ -2,6 +2,6 @@ namespace Avalonia.Media
{
public abstract class PathSegment : AvaloniaObject
{
protected internal abstract void ApplyTo(StreamGeometryContext ctx);
internal abstract void ApplyTo(StreamGeometryContext ctx);
}
}
}

2
src/Avalonia.Base/Media/PolyLineSegment.cs

@ -44,7 +44,7 @@ namespace Avalonia.Media
Points = new Points(points);
}
protected internal override void ApplyTo(StreamGeometryContext ctx)
internal override void ApplyTo(StreamGeometryContext ctx)
{
var points = Points;
if (points.Count > 0)

2
src/Avalonia.Base/Media/QuadraticBezierSegment .cs

@ -40,7 +40,7 @@ namespace Avalonia.Media
set { SetValue(Point2Property, value); }
}
protected internal override void ApplyTo(StreamGeometryContext ctx)
internal override void ApplyTo(StreamGeometryContext ctx)
{
ctx.QuadraticBezierTo(Point1, Point2);
}

1
src/Avalonia.Base/Media/StreamGeometryContext.cs

@ -10,7 +10,6 @@ namespace Avalonia.Media
/// of <see cref="StreamGeometryContext"/> is obtained by calling
/// <see cref="StreamGeometry.Open"/>.
/// </remarks>
/// TODO: This class is just a wrapper around IStreamGeometryContextImpl: is it needed?
public class StreamGeometryContext : IGeometryContext
{
private readonly IStreamGeometryContextImpl _impl;

2
src/Avalonia.Base/Media/Transformation/TransformParser.cs

@ -4,7 +4,7 @@ using Avalonia.Utilities;
namespace Avalonia.Media.Transformation
{
public static class TransformParser
internal static class TransformParser
{
private static readonly (string, TransformFunction)[] s_functionMapping =
{

6
src/Avalonia.Base/Platform/Storage/NameCollisionOption.cs

@ -1,6 +0,0 @@
namespace Avalonia.Platform.Storage;
public class NameCollisionOption
{
}

2
src/Avalonia.Base/Rendering/ManagedDeferredRendererLock.cs

@ -4,7 +4,7 @@ using Avalonia.Utilities;
namespace Avalonia.Rendering
{
public class ManagedDeferredRendererLock : DisposableLock, IDeferredRendererLock
internal class ManagedDeferredRendererLock : DisposableLock, IDeferredRendererLock
{
}

50
src/Avalonia.Base/Rendering/RendererBase.cs

@ -1,50 +0,0 @@
using System;
using System.Diagnostics;
using System.Globalization;
using Avalonia.Media;
namespace Avalonia.Rendering
{
public class RendererBase
{
private readonly bool _useManualFpsCounting;
private static int s_fontSize = 18;
private readonly Stopwatch _stopwatch = Stopwatch.StartNew();
private int _framesThisSecond;
private int _fps;
private TimeSpan _lastFpsUpdate;
public RendererBase(bool useManualFpsCounting = false)
{
_useManualFpsCounting = useManualFpsCounting;
}
protected void FpsTick() => _framesThisSecond++;
protected void RenderFps(DrawingContext context, Rect clientRect, int? layerCount)
{
var now = _stopwatch.Elapsed;
var elapsed = now - _lastFpsUpdate;
if (!_useManualFpsCounting)
++_framesThisSecond;
if (elapsed.TotalSeconds > 1)
{
_fps = (int)(_framesThisSecond / elapsed.TotalSeconds);
_framesThisSecond = 0;
_lastFpsUpdate = now;
}
var text = layerCount.HasValue ? FormattableString.Invariant($"Layers: {layerCount} FPS: {_fps:000}") : FormattableString.Invariant($"FPS: {_fps:000}");
var formattedText = new FormattedText(text, CultureInfo.CurrentCulture, FlowDirection.LeftToRight, Typeface.Default, s_fontSize, Brushes.White);
var rect = new Rect(clientRect.Right - formattedText.Width, 0, formattedText.Width, formattedText.Height);
context.DrawRectangle(Brushes.Black, null, rect);
context.DrawText(formattedText, rect.TopLeft);
}
}
}

2
src/Avalonia.Base/Rendering/Utilities/TileBrushCalculator.cs

@ -2,7 +2,7 @@
namespace Avalonia.Rendering.Utilities
{
public class TileBrushCalculator
internal class TileBrushCalculator
{
private readonly Size _imageSize;
private readonly Rect _drawRect;

3
src/Avalonia.Base/Rendering/ZIndexComparer.cs

@ -1,10 +1,9 @@
using System;
using System.Collections.Generic;
using Avalonia.VisualTree;
namespace Avalonia.Rendering
{
public class ZIndexComparer : IComparer<Visual>
internal class ZIndexComparer : IComparer<Visual>
{
public static readonly ZIndexComparer Instance = new ZIndexComparer();
public static readonly Comparison<Visual> ComparisonInstance = Instance.Compare;

2
src/Avalonia.Base/StyledElement.cs

@ -556,7 +556,7 @@ namespace Avalonia
/// Notifies child controls that a change has been made to resources that apply to them.
/// </summary>
/// <param name="e">The event args.</param>
protected virtual void NotifyChildResourcesChanged(ResourcesChangedEventArgs e)
internal virtual void NotifyChildResourcesChanged(ResourcesChangedEventArgs e)
{
if (_logicalChildren is object)
{

2
src/Avalonia.Base/Utilities/DisposableLock.cs

@ -3,7 +3,7 @@ using System.Threading;
namespace Avalonia.Utilities
{
public class DisposableLock
internal class DisposableLock
{
private readonly object _lock = new object();

2
src/Avalonia.Base/Utilities/NonPumpingLockHelper.cs

@ -3,7 +3,7 @@ using Avalonia.Threading;
namespace Avalonia.Utilities
{
public class NonPumpingLockHelper
internal class NonPumpingLockHelper
{
public interface IHelperImpl
{

2
src/Avalonia.Base/Utilities/SingleOrDictionary.cs

@ -11,7 +11,7 @@ namespace Avalonia.Utilities
/// </summary>
/// <typeparam name="TKey">The type of the key.</typeparam>
/// <typeparam name="TValue">The type of the value.</typeparam>
public class SingleOrDictionary<TKey, TValue> : IEnumerable<KeyValuePair<TKey, TValue>>
internal class SingleOrDictionary<TKey, TValue> : IEnumerable<KeyValuePair<TKey, TValue>>
where TKey : notnull
{
private KeyValuePair<TKey, TValue>? _singleValue;

2
src/Avalonia.Base/Utilities/SingleOrQueue.cs

@ -7,7 +7,7 @@ namespace Avalonia.Utilities
/// FIFO Queue optimized for holding zero or one items.
/// </summary>
/// <typeparam name="T">The type of items held in the queue.</typeparam>
public class SingleOrQueue<T>
internal class SingleOrQueue<T>
{
private T? _head;
private Queue<T>? _tail;

2
src/Avalonia.Base/Utilities/ValueSingleOrList.cs

@ -9,7 +9,7 @@ namespace Avalonia.Utilities
/// <remarks>
/// Once more than value has been added to this storage it will switch to using <see cref="List"/> internally.
/// </remarks>
public ref struct ValueSingleOrList<T>
internal ref struct ValueSingleOrList<T>
{
private bool _isSingleSet;

49
src/Avalonia.Base/Utilities/WeakTimer.cs

@ -1,49 +0,0 @@
using System;
using Avalonia.Threading;
namespace Avalonia.Utilities
{
public class WeakTimer
{
public interface IWeakTimerSubscriber
{
bool Tick();
}
private readonly WeakReference<IWeakTimerSubscriber> _subscriber;
private DispatcherTimer _timer;
public WeakTimer(IWeakTimerSubscriber subscriber)
{
_subscriber = new WeakReference<IWeakTimerSubscriber>(subscriber);
_timer = new DispatcherTimer();
_timer.Tick += delegate { OnTick(); };
}
private void OnTick()
{
if (!_subscriber.TryGetTarget(out var subscriber) || !subscriber.Tick())
Stop();
}
public TimeSpan Interval
{
get { return _timer.Interval; }
set { _timer.Interval = value; }
}
public void Start() => _timer.Start();
public void Stop() => _timer.Stop();
public static WeakTimer StartWeakTimer(IWeakTimerSubscriber subscriber, TimeSpan interval)
{
var timer = new WeakTimer(subscriber) {Interval = interval};
timer.Start();
return timer;
}
}
}

2
src/Avalonia.Base/Visual.cs

@ -321,7 +321,7 @@ namespace Avalonia
internal RenderOptions RenderOptions { get; set; }
public bool HasNonUniformZIndexChildren { get; private set; }
internal bool HasNonUniformZIndexChildren { get; private set; }
/// <summary>
/// Gets a value indicating whether this control is attached to a visual root.

4
src/Avalonia.Controls.ItemsRepeater/Controls/RepeaterLayoutContext.cs

@ -53,8 +53,8 @@ namespace Avalonia.Controls
{
return _owner.GetElementImpl(
index,
options.HasAllFlags(ElementRealizationOptions.ForceCreate),
options.HasAllFlags(ElementRealizationOptions.SuppressAutoRecycle));
options.HasFlag(ElementRealizationOptions.ForceCreate),
options.HasFlag(ElementRealizationOptions.SuppressAutoRecycle));
}
protected override object GetItemAtCore(int index) => _owner.ItemsSourceView!.GetAt(index)!;

2
src/Avalonia.Controls/Presenters/ScrollContentPresenter.cs

@ -302,7 +302,7 @@ namespace Avalonia.Controls.Presenters
/// <remarks>
/// This method is automatically called when the control is attached to a visual tree.
/// </remarks>
protected internal virtual void AttachToScrollViewer()
internal void AttachToScrollViewer()
{
var owner = this.FindAncestorOfType<ScrollViewer>();

2
src/Avalonia.Controls/Primitives/AccessText.cs

@ -60,7 +60,7 @@ namespace Avalonia.Controls.Primitives
/// Renders the <see cref="AccessText"/> to a drawing context.
/// </summary>
/// <param name="context">The drawing context.</param>
protected internal override void RenderCore(DrawingContext context)
private protected override void RenderCore(DrawingContext context)
{
base.RenderCore(context);
int underscore = Text?.IndexOf('_') ?? -1;

2
src/Avalonia.Controls/Primitives/OverlayPopupHost.cs

@ -51,7 +51,7 @@ namespace Avalonia.Controls.Primitives
}
/// <inheritdoc />
protected internal override Interactive? InteractiveParent => Parent as Interactive;
internal override Interactive? InteractiveParent => Parent as Interactive;
/// <inheritdoc />
public void Dispose() => Hide();

2
src/Avalonia.Controls/Primitives/PopupRoot.cs

@ -72,7 +72,7 @@ namespace Avalonia.Controls.Primitives
/// <remarks>
/// Popup events are passed to their parent window. This facilitates this.
/// </remarks>
protected internal override Interactive? InteractiveParent => (Interactive?)Parent;
internal override Interactive? InteractiveParent => (Interactive?)Parent;
/// <summary>
/// Gets the control that is hosting the popup root.

2
src/Avalonia.Controls/Primitives/ScrollBar.cs

@ -200,7 +200,7 @@ namespace Avalonia.Controls.Primitives
/// <remarks>
/// This method is automatically called when the control is attached to a visual tree.
/// </remarks>
protected internal virtual void AttachToScrollViewer()
internal void AttachToScrollViewer()
{
var owner = this.FindAncestorOfType<ScrollViewer>();

2
src/Avalonia.Controls/Primitives/TemplatedControl.cs

@ -318,7 +318,7 @@ namespace Avalonia.Controls.Primitives
}
/// <inheritdoc />
protected sealed override void NotifyChildResourcesChanged(ResourcesChangedEventArgs e)
internal sealed override void NotifyChildResourcesChanged(ResourcesChangedEventArgs e)
{
var count = VisualChildren.Count;

2
src/Avalonia.Controls/Primitives/VisualLayerManager.cs

@ -104,7 +104,7 @@ namespace Avalonia.Controls.Primitives
}
/// <inheritdoc />
protected override void NotifyChildResourcesChanged(ResourcesChangedEventArgs e)
internal override void NotifyChildResourcesChanged(ResourcesChangedEventArgs e)
{
foreach (var l in _layers)
((ILogical)l).NotifyResourcesChanged(e);

2
src/Avalonia.Controls/TextBlock.cs

@ -555,7 +555,7 @@ namespace Avalonia.Controls
}
// Workaround to seal Render method, we need to make so because AccessText was overriding Render method which is sealed now.
internal protected virtual void RenderCore(DrawingContext context)
private protected virtual void RenderCore(DrawingContext context)
{
var background = Background;

2
src/Avalonia.Controls/Viewbox.cs

@ -82,7 +82,7 @@ namespace Avalonia.Controls
/// Gets or sets the transform applied to the container visual that
/// hosts the child of the Viewbox
/// </summary>
protected internal ITransform? InternalTransform
internal ITransform? InternalTransform
{
get => _containerVisual.RenderTransform;
set => _containerVisual.RenderTransform = value;

4
src/Headless/Avalonia.Headless.Vnc/HeadlessVncFramebufferSource.cs

@ -40,11 +40,11 @@ namespace Avalonia.Headless.Vnc
{
Window?.MouseMove(pt);
foreach (var btn in CheckedButtons)
if (_previousButtons.HasAllFlags(btn) && !buttons.HasAllFlags(btn))
if (_previousButtons.HasFlag(btn) && !buttons.HasFlag(btn))
Window?.MouseUp(pt, TranslateButton(btn), modifiers);
foreach (var btn in CheckedButtons)
if (!_previousButtons.HasAllFlags(btn) && buttons.HasAllFlags(btn))
if (!_previousButtons.HasFlag(btn) && buttons.HasFlag(btn))
Window?.MouseDown(pt, TranslateButton(btn), modifiers);
_previousButtons = buttons;
}, DispatcherPriority.Input);

8
src/Windows/Avalonia.Win32.Interop/Wpf/WpfTopLevelImpl.cs

@ -141,13 +141,13 @@ namespace Avalonia.Win32.Interop.Wpf
{
var state = Keyboard.Modifiers;
var rv = default(RawInputModifiers);
if (state.HasAllFlags(ModifierKeys.Windows))
if (state.HasFlag(ModifierKeys.Windows))
rv |= RawInputModifiers.Meta;
if (state.HasAllFlags(ModifierKeys.Alt))
if (state.HasFlag(ModifierKeys.Alt))
rv |= RawInputModifiers.Alt;
if (state.HasAllFlags(ModifierKeys.Control))
if (state.HasFlag(ModifierKeys.Control))
rv |= RawInputModifiers.Control;
if (state.HasAllFlags(ModifierKeys.Shift))
if (state.HasFlag(ModifierKeys.Shift))
rv |= RawInputModifiers.Shift;
if (e != null)
{

6
tests/Avalonia.IntegrationTests.Appium/PlatformFactAttribute.cs

@ -44,11 +44,11 @@ namespace Avalonia
private bool IsSupported()
{
if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
return Platforms.HasAnyFlag(TestPlatforms.Windows);
return Platforms.HasFlag(TestPlatforms.Windows);
if (RuntimeInformation.IsOSPlatform(OSPlatform.OSX))
return Platforms.HasAnyFlag(TestPlatforms.MacOS);
return Platforms.HasFlag(TestPlatforms.MacOS);
if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux))
return Platforms.HasAnyFlag(TestPlatforms.Linux);
return Platforms.HasFlag(TestPlatforms.Linux);
return false;
}
}

4
tests/Avalonia.IntegrationTests.Appium/PlatformTheoryAttribute.cs

@ -27,9 +27,9 @@ namespace Avalonia.IntegrationTests.Appium
private bool IsSupported()
{
if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
return Platforms.HasAnyFlag(TestPlatforms.Windows);
return Platforms.HasFlag(TestPlatforms.Windows);
if (RuntimeInformation.IsOSPlatform(OSPlatform.OSX))
return Platforms.HasAnyFlag(TestPlatforms.MacOS);
return Platforms.HasFlag(TestPlatforms.MacOS);
return false;
}
}

Loading…
Cancel
Save