diff --git a/samples/ControlCatalog/ControlCatalog.csproj b/samples/ControlCatalog/ControlCatalog.csproj index dea9b35e24..61f2443eb7 100644 --- a/samples/ControlCatalog/ControlCatalog.csproj +++ b/samples/ControlCatalog/ControlCatalog.csproj @@ -35,4 +35,4 @@ - \ No newline at end of file + diff --git a/samples/ControlCatalog/MainView.xaml b/samples/ControlCatalog/MainView.xaml index 87cb5e9c5c..ec3bf799b4 100644 --- a/samples/ControlCatalog/MainView.xaml +++ b/samples/ControlCatalog/MainView.xaml @@ -20,8 +20,9 @@ + - + diff --git a/samples/ControlCatalog/Pages/ListBoxPage.xaml b/samples/ControlCatalog/Pages/ListBoxPage.xaml new file mode 100644 index 0000000000..3dd8be91c2 --- /dev/null +++ b/samples/ControlCatalog/Pages/ListBoxPage.xaml @@ -0,0 +1,13 @@ + + + ListBox + Hosts a collection of ListBoxItem. + + + + + + diff --git a/samples/ControlCatalog/Pages/ListBoxPage.xaml.cs b/samples/ControlCatalog/Pages/ListBoxPage.xaml.cs new file mode 100644 index 0000000000..dbe6c74800 --- /dev/null +++ b/samples/ControlCatalog/Pages/ListBoxPage.xaml.cs @@ -0,0 +1,25 @@ +using System; +using System.Collections; +using System.Collections.Generic; +using System.Linq; +using Avalonia.Controls; +using Avalonia.Markup.Xaml; + +namespace ControlCatalog.Pages +{ + public class ListBoxPage : UserControl + { + public ListBoxPage() + { + this.InitializeComponent(); + DataContext = Enumerable.Range(1, 10).Select(i => $"Item {i}" ) + .ToArray(); + } + + private void InitializeComponent() + { + AvaloniaXamlLoader.Load(this); + } + + } +} diff --git a/samples/ControlCatalog/Pages/NumericUpDownPage.xaml b/samples/ControlCatalog/Pages/NumericUpDownPage.xaml index 305bcd177c..2bb6214b58 100644 --- a/samples/ControlCatalog/Pages/NumericUpDownPage.xaml +++ b/samples/ControlCatalog/Pages/NumericUpDownPage.xaml @@ -14,7 +14,7 @@ AllowSpin: - + ClipValueToMinMax: @@ -77,4 +77,4 @@ - \ No newline at end of file + diff --git a/samples/ControlCatalog/Pages/ScreenPage.cs b/samples/ControlCatalog/Pages/ScreenPage.cs index 34aa85b8aa..fd66185832 100644 --- a/samples/ControlCatalog/Pages/ScreenPage.cs +++ b/samples/ControlCatalog/Pages/ScreenPage.cs @@ -42,7 +42,11 @@ namespace ControlCatalog.Pages context.DrawRectangle(p, boundsRect); context.DrawRectangle(p, workingAreaRect); - FormattedText text = new FormattedText(); + FormattedText text = new FormattedText() + { + Typeface = Typeface.Default + }; + text.Text = $"Bounds: {screen.Bounds.Width}:{screen.Bounds.Height}"; context.DrawText(Brushes.Black, boundsRect.Position.WithY(boundsRect.Size.Height), text); @@ -59,4 +63,4 @@ namespace ControlCatalog.Pages context.DrawRectangle(p, new Rect(w.Position.X / 10f + Math.Abs(_leftMost), w.Position.Y / 10, w.Bounds.Width / 10, w.Bounds.Height / 10)); } } -} \ No newline at end of file +} diff --git a/samples/ControlCatalog/SideBar.xaml b/samples/ControlCatalog/SideBar.xaml index 7d72d1821b..cc3c31d13a 100644 --- a/samples/ControlCatalog/SideBar.xaml +++ b/samples/ControlCatalog/SideBar.xaml @@ -36,7 +36,7 @@ - + diff --git a/samples/RenderDemo/SideBar.xaml b/samples/RenderDemo/SideBar.xaml index b5f8ccaf01..26da2cc556 100644 --- a/samples/RenderDemo/SideBar.xaml +++ b/samples/RenderDemo/SideBar.xaml @@ -37,7 +37,7 @@ - + diff --git a/samples/RenderDemo/ViewModels/AnimationsPageViewModel.cs b/samples/RenderDemo/ViewModels/AnimationsPageViewModel.cs index 626a3e7c77..f724baf3c6 100644 --- a/samples/RenderDemo/ViewModels/AnimationsPageViewModel.cs +++ b/samples/RenderDemo/ViewModels/AnimationsPageViewModel.cs @@ -10,21 +10,21 @@ namespace RenderDemo.ViewModels public AnimationsPageViewModel() { - ToggleGlobalPlayState = ReactiveCommand.Create(()=>TogglePlayState()); + ToggleGlobalPlayState = ReactiveCommand.Create(() => TogglePlayState()); } void TogglePlayState() { - switch (Timing.GetGlobalPlayState()) + switch (Animation.GlobalPlayState) { case PlayState.Run: PlayStateText = "Resume all animations"; - Timing.SetGlobalPlayState(PlayState.Pause); + Animation.GlobalPlayState = PlayState.Pause; break; case PlayState.Pause: PlayStateText = "Pause all animations"; - Timing.SetGlobalPlayState(PlayState.Run); + Animation.GlobalPlayState = PlayState.Run; break; } } @@ -36,5 +36,5 @@ namespace RenderDemo.ViewModels } public ReactiveCommand ToggleGlobalPlayState { get; } - } + } } diff --git a/src/Android/Avalonia.Android/AndroidPlatform.cs b/src/Android/Avalonia.Android/AndroidPlatform.cs index 7134e7d1b4..2b46bfa492 100644 --- a/src/Android/Avalonia.Android/AndroidPlatform.cs +++ b/src/Android/Avalonia.Android/AndroidPlatform.cs @@ -1,8 +1,4 @@ using System; -using System.IO; -using System.Linq; -using Android.Content; -using Android.Views; using Avalonia.Android.Platform; using Avalonia.Android.Platform.Input; using Avalonia.Android.Platform.SkiaPlatform; @@ -79,4 +75,4 @@ namespace Avalonia.Android return new PopupImpl(); } } -} \ No newline at end of file +} diff --git a/src/Android/Avalonia.Android/AndroidThreadingInterface.cs b/src/Android/Avalonia.Android/AndroidThreadingInterface.cs index 77dfc60b83..6fe77adca1 100644 --- a/src/Android/Avalonia.Android/AndroidThreadingInterface.cs +++ b/src/Android/Avalonia.Android/AndroidThreadingInterface.cs @@ -1,16 +1,7 @@ using System; -using System.Collections.Generic; -using System.Diagnostics; -using System.Linq; using System.Reactive.Disposables; -using System.Text; using System.Threading; -using Android.App; -using Android.Content; using Android.OS; -using Android.Runtime; -using Android.Views; -using Android.Widget; using Avalonia.Platform; using Avalonia.Threading; @@ -88,4 +79,3 @@ namespace Avalonia.Android public event Action Signaled; } } - \ No newline at end of file diff --git a/src/Android/Avalonia.Android/AppBuilder.cs b/src/Android/Avalonia.Android/AppBuilder.cs index 6078e3bb98..805bb61655 100644 --- a/src/Android/Avalonia.Android/AppBuilder.cs +++ b/src/Android/Avalonia.Android/AppBuilder.cs @@ -1,16 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; - -using Android.App; -using Android.Content; -using Android.OS; -using Android.Runtime; -using Android.Views; -using Android.Widget; using Avalonia.Controls; -using Avalonia.Platform; using Avalonia.Shared.PlatformSupport; namespace Avalonia @@ -23,4 +11,4 @@ namespace Avalonia } } -} \ No newline at end of file +} diff --git a/src/Android/Avalonia.Android/AvaloniaActivity.cs b/src/Android/Avalonia.Android/AvaloniaActivity.cs index 21ce555086..d3696aa41d 100644 --- a/src/Android/Avalonia.Android/AvaloniaActivity.cs +++ b/src/Android/Avalonia.Android/AvaloniaActivity.cs @@ -1,14 +1,7 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; using Android.App; -using Android.Content; using Android.OS; -using Android.Runtime; using Android.Views; -using Android.Widget; namespace Avalonia.Android { @@ -48,4 +41,4 @@ namespace Avalonia.Android return View.DispatchKeyEvent(e); } } -} \ No newline at end of file +} diff --git a/src/Android/Avalonia.Android/AvaloniaView.cs b/src/Android/Avalonia.Android/AvaloniaView.cs index 6c4274a6e4..fbe027db00 100644 --- a/src/Android/Avalonia.Android/AvaloniaView.cs +++ b/src/Android/Avalonia.Android/AvaloniaView.cs @@ -1,12 +1,5 @@ using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; - -using Android.App; using Android.Content; -using Android.OS; -using Android.Runtime; using Android.Views; using Android.Widget; using Avalonia.Android.Platform.SkiaPlatform; @@ -66,4 +59,4 @@ namespace Avalonia.Android public IDisposable ShowDialog() => null; } } -} \ No newline at end of file +} diff --git a/src/Android/Avalonia.Android/CursorFactory.cs b/src/Android/Avalonia.Android/CursorFactory.cs index e6b9433cca..9eb28c67f9 100644 --- a/src/Android/Avalonia.Android/CursorFactory.cs +++ b/src/Android/Avalonia.Android/CursorFactory.cs @@ -9,4 +9,4 @@ namespace Avalonia.Android public IPlatformHandle GetCursor(StandardCursorType cursorType) => new PlatformHandle(IntPtr.Zero, "ZeroCursor"); } -} \ No newline at end of file +} diff --git a/src/Android/Avalonia.Android/Platform/ClipboardImpl.cs b/src/Android/Avalonia.Android/Platform/ClipboardImpl.cs index 8c28b48019..51e0a1e799 100644 --- a/src/Android/Avalonia.Android/Platform/ClipboardImpl.cs +++ b/src/Android/Avalonia.Android/Platform/ClipboardImpl.cs @@ -1,9 +1,9 @@ +using System.Threading.Tasks; using Android.Content; using Android.Runtime; using Android.Views; using Avalonia.Input.Platform; using Avalonia.Platform; -using System.Threading.Tasks; namespace Avalonia.Android.Platform { @@ -44,4 +44,4 @@ namespace Avalonia.Android.Platform return Task.FromResult(null); } } -} \ No newline at end of file +} diff --git a/src/Android/Avalonia.Android/Platform/Input/AndroidKeyboardDevice.cs b/src/Android/Avalonia.Android/Platform/Input/AndroidKeyboardDevice.cs index d5494a69ef..726ccdbbdd 100644 --- a/src/Android/Avalonia.Android/Platform/Input/AndroidKeyboardDevice.cs +++ b/src/Android/Avalonia.Android/Platform/Input/AndroidKeyboardDevice.cs @@ -1,12 +1,11 @@ -using System; -using Avalonia.Input; //using Android.InputMethodServices; using System.Collections.Generic; using Android.Views; +using Avalonia.Input; namespace Avalonia.Android.Platform.Input { - public class AndroidKeyboardDevice : KeyboardDevice, IKeyboardDevice { + public class AndroidKeyboardDevice : KeyboardDevice, IKeyboardDevice { private static readonly Dictionary KeyDic = new Dictionary { // { Keycode.Cancel?, Key.Cancel }, diff --git a/src/Android/Avalonia.Android/Platform/SkiaPlatform/AndroidFramebuffer.cs b/src/Android/Avalonia.Android/Platform/SkiaPlatform/AndroidFramebuffer.cs index 051a058363..405da12967 100644 --- a/src/Android/Avalonia.Android/Platform/SkiaPlatform/AndroidFramebuffer.cs +++ b/src/Android/Avalonia.Android/Platform/SkiaPlatform/AndroidFramebuffer.cs @@ -102,4 +102,4 @@ namespace Avalonia.Android.Platform.SkiaPlatform uint reserved6; } } -} \ No newline at end of file +} diff --git a/src/Android/Avalonia.Android/Platform/SkiaPlatform/InvalidationAwareSurfaceView.cs b/src/Android/Avalonia.Android/Platform/SkiaPlatform/InvalidationAwareSurfaceView.cs index d2d5909815..02ea702236 100644 --- a/src/Android/Avalonia.Android/Platform/SkiaPlatform/InvalidationAwareSurfaceView.cs +++ b/src/Android/Avalonia.Android/Platform/SkiaPlatform/InvalidationAwareSurfaceView.cs @@ -1,17 +1,9 @@ using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; - -using Android.App; using Android.Content; using Android.Graphics; using Android.OS; -using Android.Runtime; using Android.Util; using Android.Views; -using Android.Widget; -using Avalonia.Media; using Avalonia.Platform; namespace Avalonia.Android @@ -90,4 +82,4 @@ namespace Avalonia.Android protected abstract void Draw(); public string HandleDescriptor => "SurfaceView"; } -} \ No newline at end of file +} diff --git a/src/Android/Avalonia.Android/Platform/SkiaPlatform/PopupImpl.cs b/src/Android/Avalonia.Android/Platform/SkiaPlatform/PopupImpl.cs index 041d91043a..d55755d6e3 100644 --- a/src/Android/Avalonia.Android/Platform/SkiaPlatform/PopupImpl.cs +++ b/src/Android/Avalonia.Android/Platform/SkiaPlatform/PopupImpl.cs @@ -1,15 +1,8 @@ using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; - -using Android.App; using Android.Content; using Android.Graphics; -using Android.OS; using Android.Runtime; using Android.Views; -using Android.Widget; using Avalonia.Controls; using Avalonia.Platform; @@ -116,4 +109,4 @@ namespace Avalonia.Android.Platform.SkiaPlatform //Not supported } } -} \ No newline at end of file +} diff --git a/src/Android/Avalonia.Android/Platform/SkiaPlatform/TopLevelImpl.cs b/src/Android/Avalonia.Android/Platform/SkiaPlatform/TopLevelImpl.cs index 6c8db17c71..8e8886269c 100644 --- a/src/Android/Avalonia.Android/Platform/SkiaPlatform/TopLevelImpl.cs +++ b/src/Android/Avalonia.Android/Platform/SkiaPlatform/TopLevelImpl.cs @@ -1,18 +1,15 @@ -using Android.App; +using System; +using System.Collections.Generic; using Android.Content; using Android.Graphics; using Android.Views; +using Avalonia.Android.Platform.Input; using Avalonia.Android.Platform.Specific; using Avalonia.Android.Platform.Specific.Helpers; +using Avalonia.Controls.Platform.Surfaces; using Avalonia.Input; using Avalonia.Input.Raw; using Avalonia.Platform; -using System; -using System.Collections.Generic; -using System.Reactive.Disposables; -using Avalonia.Android.Platform.Input; -using Avalonia.Controls; -using Avalonia.Controls.Platform.Surfaces; using Avalonia.Rendering; namespace Avalonia.Android.Platform.SkiaPlatform @@ -196,4 +193,4 @@ namespace Avalonia.Android.Platform.SkiaPlatform ILockedFramebuffer IFramebufferPlatformSurface.Lock()=>new AndroidFramebuffer(_view.Holder.Surface); } -} \ No newline at end of file +} diff --git a/src/Android/Avalonia.Android/Platform/Specific/Helpers/AndroidKeyboardEventsHelper.cs b/src/Android/Avalonia.Android/Platform/Specific/Helpers/AndroidKeyboardEventsHelper.cs index ab990066de..c7b01413a9 100644 --- a/src/Android/Avalonia.Android/Platform/Specific/Helpers/AndroidKeyboardEventsHelper.cs +++ b/src/Android/Avalonia.Android/Platform/Specific/Helpers/AndroidKeyboardEventsHelper.cs @@ -1,3 +1,5 @@ +using System; +using System.ComponentModel; using Android.Content; using Android.Runtime; using Android.Views; @@ -7,8 +9,6 @@ using Avalonia.Controls; using Avalonia.Input; using Avalonia.Input.Raw; using Avalonia.Platform; -using System; -using System.ComponentModel; namespace Avalonia.Android.Platform.Specific.Helpers { @@ -120,7 +120,7 @@ namespace Avalonia.Android.Platform.Specific.Helpers _lastFocusedElement = element; } - public void ActivateAutoShowKeybord() + public void ActivateAutoShowKeyboard() { var kbDevice = (KeyboardDevice.Instance as INotifyPropertyChanged); @@ -142,4 +142,4 @@ namespace Avalonia.Android.Platform.Specific.Helpers HandleEvents = false; } } -} \ No newline at end of file +} diff --git a/src/Android/Avalonia.Android/Platform/Specific/Helpers/AndroidTouchEventsHelper.cs b/src/Android/Avalonia.Android/Platform/Specific/Helpers/AndroidTouchEventsHelper.cs index 71822a6f47..112925ab0f 100644 --- a/src/Android/Avalonia.Android/Platform/Specific/Helpers/AndroidTouchEventsHelper.cs +++ b/src/Android/Avalonia.Android/Platform/Specific/Helpers/AndroidTouchEventsHelper.cs @@ -1,10 +1,8 @@ -using Android.Graphics; +using System; using Android.Views; using Avalonia.Input; using Avalonia.Input.Raw; -using Avalonia.Media; using Avalonia.Platform; -using System; namespace Avalonia.Android.Platform.Specific.Helpers { @@ -131,4 +129,4 @@ namespace Avalonia.Android.Platform.Specific.Helpers HandleEvents = false; } } -} \ No newline at end of file +} diff --git a/src/Android/Avalonia.Android/Platform/Specific/IAndroidView.cs b/src/Android/Avalonia.Android/Platform/Specific/IAndroidView.cs index 2e7816362d..c72de8e197 100644 --- a/src/Android/Avalonia.Android/Platform/Specific/IAndroidView.cs +++ b/src/Android/Avalonia.Android/Platform/Specific/IAndroidView.cs @@ -1,16 +1,9 @@ -using Android.Graphics; using Android.Views; -using System; -using System.Collections.Generic; namespace Avalonia.Android.Platform.Specific { public interface IAndroidView { - - View View { get; } } - - -} \ No newline at end of file +} diff --git a/src/Android/Avalonia.Android/PlatformIconLoader.cs b/src/Android/Avalonia.Android/PlatformIconLoader.cs index 289025ce1d..88677a9375 100644 --- a/src/Android/Avalonia.Android/PlatformIconLoader.cs +++ b/src/Android/Avalonia.Android/PlatformIconLoader.cs @@ -1,16 +1,5 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; - -using Android.App; -using Android.Content; -using Android.OS; -using Android.Runtime; -using Android.Views; -using Android.Widget; -using Avalonia.Platform; using System.IO; +using Avalonia.Platform; namespace Avalonia.Android { @@ -54,4 +43,4 @@ namespace Avalonia.Android stream.CopyTo(outputStream); } } -} \ No newline at end of file +} diff --git a/src/Android/Avalonia.Android/SystemDialogImpl.cs b/src/Android/Avalonia.Android/SystemDialogImpl.cs index bad45b78fb..a8d201d66e 100644 --- a/src/Android/Avalonia.Android/SystemDialogImpl.cs +++ b/src/Android/Avalonia.Android/SystemDialogImpl.cs @@ -18,4 +18,4 @@ namespace Avalonia.Android throw new NotImplementedException(); } } -} \ No newline at end of file +} diff --git a/src/Avalonia.Animation/Animatable.cs b/src/Avalonia.Animation/Animatable.cs index a27d996301..8a1a17a6fc 100644 --- a/src/Avalonia.Animation/Animatable.cs +++ b/src/Avalonia.Animation/Animatable.cs @@ -1,48 +1,20 @@ // Copyright (c) The Avalonia Project. All rights reserved. // Licensed under the MIT license. See licence.md file in the project root for full license information. -using System.Linq; -using Avalonia.Data; using System; +using System.Collections.Generic; +using System.Linq; using System.Reactive.Linq; using Avalonia.Collections; -using Avalonia.Animation; -using System.Collections.Generic; -using System.Threading; -using System.Collections.Concurrent; +using Avalonia.Data; namespace Avalonia.Animation { /// - /// Base class for control which can have property transitions. + /// Base class for all animatable objects. /// public class Animatable : AvaloniaObject - { - /// - /// Initializes this object. - /// - public Animatable() - { - Transitions = new Transitions(); - AnimatableTimer = Timing.AnimationStateTimer - .Select(p => - { - if (this._playState == PlayState.Pause) - { - return PlayState.Pause; - } - else return p; - }) - .Publish() - .RefCount(); - } - - /// - /// The specific animations timer for this control. - /// - /// - public IObservable AnimatableTimer; - + { /// /// Defines the property. /// @@ -62,27 +34,25 @@ namespace Avalonia.Animation { get { return _playState; } set { SetAndRaise(PlayStateProperty, ref _playState, value); } - } - /// /// Defines the property. /// - public static readonly DirectProperty> TransitionsProperty = - AvaloniaProperty.RegisterDirect>( + public static readonly DirectProperty TransitionsProperty = + AvaloniaProperty.RegisterDirect( nameof(Transitions), o => o.Transitions, (o, v) => o.Transitions = v); - private IEnumerable _transitions = new AvaloniaList(); + private Transitions _transitions; /// /// Gets or sets the property transitions for the control. /// - public IEnumerable Transitions + public Transitions Transitions { - get { return _transitions; } + get { return _transitions ?? (_transitions = new Transitions()); } set { SetAndRaise(TransitionsProperty, ref _transitions, value); } } @@ -103,6 +73,5 @@ namespace Avalonia.Animation } } } - } -} +} \ No newline at end of file diff --git a/src/Avalonia.Animation/Animation.cs b/src/Avalonia.Animation/Animation.cs index 3dc5b5c71a..2c359ecac3 100644 --- a/src/Avalonia.Animation/Animation.cs +++ b/src/Avalonia.Animation/Animation.cs @@ -1,18 +1,14 @@ // Copyright (c) The Avalonia Project. All rights reserved. // Licensed under the MIT license. See licence.md file in the project root for full license information. -using Avalonia.Animation.Easings; -using Avalonia.Animation; -using Avalonia.Collections; -using Avalonia.Metadata; using System; using System.Collections.Generic; -using System.Collections.Specialized; -using System.Reflection; using System.Linq; -using System.Threading.Tasks; -using System.Reactive.Linq; using System.Reactive.Disposables; +using System.Reactive.Linq; +using System.Threading.Tasks; +using Avalonia.Animation.Easings; +using Avalonia.Collections; namespace Avalonia.Animation { @@ -21,6 +17,60 @@ namespace Avalonia.Animation /// public class Animation : AvaloniaList, IAnimation { + /// + /// Gets or sets the animation play state for all animations + /// + public static PlayState GlobalPlayState { get; set; } = PlayState.Run; + + /// + /// Gets or sets the active time of this animation. + /// + public TimeSpan Duration { get; set; } + + /// + /// Gets or sets the repeat count for this animation. + /// + public RepeatCount RepeatCount { get; set; } + + /// + /// Gets or sets the playback direction for this animation. + /// + public PlaybackDirection PlaybackDirection { get; set; } + + /// + /// Gets or sets the value fill mode for this animation. + /// + public FillMode FillMode { get; set; } + + /// + /// Gets or sets the easing function to be used for this animation. + /// + public Easing Easing { get; set; } = new LinearEasing(); + + /// + /// Gets or sets the speed multiple for this animation. + /// + public double SpeedRatio { get; set; } = 1d; + + /// + /// Gets or sets the delay time for this animation. + /// + /// + /// Describes a delay to be added before the animation starts, and optionally between + /// repeats of the animation if is set. + /// + public TimeSpan Delay { get; set; } + + /// + /// Gets or sets a value indicating whether will be applied between + /// iterations of the animation. + /// + /// + /// If this property is not set, then will only be applied to the first + /// iteration of the animation. + /// + public bool DelayBetweenIterations { get; set; } + private readonly static List<(Func Condition, Type Animator)> Animators = new List<(Func, Type)> { ( prop => typeof(double).IsAssignableFrom(prop.PropertyType), typeof(DoubleAnimator) ) @@ -44,38 +94,6 @@ namespace Avalonia.Animation return null; } - public AvaloniaList _animators { get; set; } = new AvaloniaList(); - - /// - /// Run time of this animation. - /// - public TimeSpan Duration { get; set; } - - /// - /// Delay time for this animation. - /// - public TimeSpan Delay { get; set; } - - /// - /// The repeat count for this animation. - /// - public RepeatCount RepeatCount { get; set; } - - /// - /// The playback direction for this animation. - /// - public PlaybackDirection PlaybackDirection { get; set; } - - /// - /// The value fill mode for this animation. - /// - public FillMode FillMode { get; set; } - - /// - /// Easing function to be used. - /// - public Easing Easing { get; set; } = new LinearEasing(); - private (IList Animators, IList subscriptions) InterpretKeyframes(Animatable control) { var handlerList = new List<(Type type, AvaloniaProperty property)>(); diff --git a/src/Avalonia.Animation/AnimationInstance`1.cs b/src/Avalonia.Animation/AnimationInstance`1.cs new file mode 100644 index 0000000000..5a72904ed2 --- /dev/null +++ b/src/Avalonia.Animation/AnimationInstance`1.cs @@ -0,0 +1,228 @@ +using System; +using System.Linq; +using System.Reactive.Linq; +using Avalonia.Animation.Utils; +using Avalonia.Data; +using Avalonia.Reactive; + +namespace Avalonia.Animation +{ + /// + /// Handles interpolatoin and time-related functions + /// for keyframe animations. + /// + internal class AnimationInstance : SingleSubscriberObservableBase + { + private T _lastInterpValue; + private T _firstKFValue; + private long _repeatCount; + private double _currentIteration; + private bool _isLooping; + private bool _gotFirstKFValue; + private bool _gotFirstFrameCount; + private bool _iterationDelay; + private FillMode _fillMode; + private PlaybackDirection _animationDirection; + private Animator _parent; + private Animatable _targetControl; + private T _neutralValue; + private double _speedRatio; + private TimeSpan _delay; + private TimeSpan _duration; + private TimeSpan _firstFrameCount; + private TimeSpan _internalClock; + private TimeSpan? _previousClock; + private Easings.Easing _easeFunc; + private Action _onCompleteAction; + private Func _interpolator; + private IDisposable _timerSubscription; + + public AnimationInstance(Animation animation, Animatable control, Animator animator, Action OnComplete, Func Interpolator) + { + if (animation.SpeedRatio <= 0) + throw new InvalidOperationException("Speed ratio cannot be negative or zero."); + + if (animation.Duration.TotalSeconds <= 0) + throw new InvalidOperationException("Duration cannot be negative or zero."); + + _parent = animator; + _easeFunc = animation.Easing; + _targetControl = control; + _neutralValue = (T)_targetControl.GetValue(_parent.Property); + + _speedRatio = animation.SpeedRatio; + + _delay = animation.Delay; + _duration = animation.Duration; + _iterationDelay = animation.DelayBetweenIterations; + + switch (animation.RepeatCount.RepeatType) + { + case RepeatType.None: + _repeatCount = 1; + break; + case RepeatType.Loop: + _isLooping = true; + break; + case RepeatType.Repeat: + _repeatCount = (long)animation.RepeatCount.Value; + break; + } + + _animationDirection = animation.PlaybackDirection; + _fillMode = animation.FillMode; + _onCompleteAction = OnComplete; + _interpolator = Interpolator; + } + + protected override void Unsubscribed() + { + _timerSubscription?.Dispose(); + } + + protected override void Subscribed() + { + _timerSubscription = Timing.AnimationsTimer + .Subscribe(p => this.Step(p)); + } + + public void Step(TimeSpan frameTick) + { + try + { + InternalStep(frameTick); + } + catch (Exception e) + { + PublishError(e); + } + } + + private void DoComplete() + { + if (_fillMode == FillMode.Forward || _fillMode == FillMode.Both) + _targetControl.SetValue(_parent.Property, _lastInterpValue, BindingPriority.LocalValue); + + _onCompleteAction?.Invoke(); + PublishCompleted(); + } + + private void DoDelay() + { + if (_fillMode == FillMode.Backward || _fillMode == FillMode.Both) + if (_currentIteration == 0) + PublishNext(_firstKFValue); + else + PublishNext(_lastInterpValue); + } + + private void DoPlayStatesAndTime(TimeSpan systemTime) + { + if (Animation.GlobalPlayState == PlayState.Stop || _targetControl.PlayState == PlayState.Stop) + DoComplete(); + + if (!_previousClock.HasValue) + { + _previousClock = systemTime; + _internalClock = TimeSpan.Zero; + } + else + { + if (Animation.GlobalPlayState == PlayState.Pause || _targetControl.PlayState == PlayState.Pause) + { + _previousClock = systemTime; + return; + } + var delta = systemTime - _previousClock; + _internalClock += delta.Value; + _previousClock = systemTime; + } + + if (!_gotFirstKFValue) + { + _firstKFValue = (T)_parent.First().Value; + _gotFirstKFValue = true; + } + + if (!_gotFirstFrameCount) + { + _firstFrameCount = _internalClock; + _gotFirstFrameCount = true; + } + } + + private void InternalStep(TimeSpan systemTime) + { + DoPlayStatesAndTime(systemTime); + + var time = _internalClock - _firstFrameCount; + var delayEndpoint = _delay; + var iterationEndpoint = delayEndpoint + _duration; + + //determine if time is currently in the first iteration. + if (time >= TimeSpan.Zero & time <= iterationEndpoint) + { + _currentIteration = 1; + } + else if (time > iterationEndpoint) + { + //Subtract first iteration to properly get the subsequent iteration time + time -= iterationEndpoint; + + if (!_iterationDelay & delayEndpoint > TimeSpan.Zero) + { + delayEndpoint = TimeSpan.Zero; + iterationEndpoint = _duration; + } + + //Calculate the current iteration number + _currentIteration = (int)Math.Floor((double)time.Ticks / iterationEndpoint.Ticks) + 2; + } + else + { + _previousClock = systemTime; + return; + } + + time = TimeSpan.FromTicks(time.Ticks % iterationEndpoint.Ticks); + + if (!_isLooping) + { + if (_currentIteration > _repeatCount) + DoComplete(); + + if (time > iterationEndpoint) + DoComplete(); + } + + // Determine if the current iteration should have its normalized time inverted. + bool isCurIterReverse = _animationDirection == PlaybackDirection.Normal ? false : + _animationDirection == PlaybackDirection.Alternate ? (_currentIteration % 2 == 0) ? false : true : + _animationDirection == PlaybackDirection.AlternateReverse ? (_currentIteration % 2 == 0) ? true : false : + _animationDirection == PlaybackDirection.Reverse ? true : false; + + if (delayEndpoint > TimeSpan.Zero & time < delayEndpoint) + { + DoDelay(); + } + else + { + // Offset the delay time + time -= delayEndpoint; + iterationEndpoint -= delayEndpoint; + + // Normalize time + var interpVal = (double)time.Ticks / iterationEndpoint.Ticks; + + if (isCurIterReverse) + interpVal = 1 - interpVal; + + // Ease and interpolate + var easedTime = _easeFunc.Ease(interpVal); + _lastInterpValue = _interpolator(easedTime, _neutralValue); + + PublishNext(_lastInterpValue); + } + } + } +} \ No newline at end of file diff --git a/src/Avalonia.Animation/AnimatorKeyFrame.cs b/src/Avalonia.Animation/AnimatorKeyFrame.cs index 0276c6fa92..09f259e754 100644 --- a/src/Avalonia.Animation/AnimatorKeyFrame.cs +++ b/src/Avalonia.Animation/AnimatorKeyFrame.cs @@ -1,9 +1,5 @@ using System; -using System.Collections.Generic; -using System.Text; using System.ComponentModel; -using Avalonia.Metadata; -using Avalonia.Collections; using Avalonia.Data; using Avalonia.Reactive; @@ -29,6 +25,7 @@ namespace Avalonia.Animation Cue = cue; } + internal bool isNeutral; public Type AnimatorType { get; } public Cue Cue { get; } public AvaloniaProperty Property { get; private set; } diff --git a/src/Avalonia.Animation/AnimatorStateMachine`1.cs b/src/Avalonia.Animation/AnimatorStateMachine`1.cs deleted file mode 100644 index 87e189c997..0000000000 --- a/src/Avalonia.Animation/AnimatorStateMachine`1.cs +++ /dev/null @@ -1,273 +0,0 @@ -using System; -using System.Linq; -using Avalonia.Data; - -namespace Avalonia.Animation -{ - /// - /// Provides statefulness for an iteration of a keyframe animation. - /// - internal class AnimatorStateMachine : IObservable, IDisposable - { - object _lastInterpValue; - object _firstKFValue; - - private ulong _delayTotalFrameCount; - private ulong _durationTotalFrameCount; - private ulong _delayFrameCount; - private ulong _durationFrameCount; - private ulong _repeatCount; - private ulong _currentIteration; - - private bool _isLooping; - private bool _isRepeating; - private bool _isReversed; - private bool _checkLoopAndRepeat; - private bool _gotFirstKFValue; - - private FillMode _fillMode; - private PlaybackDirection _animationDirection; - private KeyFramesStates _currentState; - private KeyFramesStates _savedState; - private Animator _parent; - private Animation _targetAnimation; - private Animatable _targetControl; - private T _neutralValue; - internal bool _unsubscribe = false; - private IObserver _targetObserver; - private readonly Action _onComplete; - - [Flags] - private enum KeyFramesStates - { - Initialize, - DoDelay, - DoRun, - RunForwards, - RunBackwards, - RunApplyValue, - RunComplete, - Pause, - Stop, - Disposed - } - - public AnimatorStateMachine(Animation animation, Animatable control, Animator animator, Action onComplete) - { - _parent = animator; - _targetAnimation = animation; - _targetControl = control; - _neutralValue = (T)_targetControl.GetValue(_parent.Property); - - _delayTotalFrameCount = (ulong)(animation.Delay.Ticks / Timing.FrameTick.Ticks); - _durationTotalFrameCount = (ulong)(animation.Duration.Ticks / Timing.FrameTick.Ticks); - - switch (animation.RepeatCount.RepeatType) - { - case RepeatType.Loop: - _isLooping = true; - _checkLoopAndRepeat = true; - break; - case RepeatType.Repeat: - _isRepeating = true; - _checkLoopAndRepeat = true; - _repeatCount = animation.RepeatCount.Value; - break; - } - - _isReversed = (animation.PlaybackDirection & PlaybackDirection.Reverse) != 0; - _animationDirection = _targetAnimation.PlaybackDirection; - _fillMode = _targetAnimation.FillMode; - - if (_durationTotalFrameCount > 0) - _currentState = KeyFramesStates.DoDelay; - else - _currentState = KeyFramesStates.DoRun; - _onComplete = onComplete; - } - - public void Step(PlayState _playState, Func Interpolator) - { - try - { - InternalStep(_playState, Interpolator); - } - catch (Exception e) - { - _targetObserver?.OnError(e); - } - } - - private void InternalStep(PlayState _playState, Func Interpolator) - { - if (!_gotFirstKFValue) - { - _firstKFValue = _parent.First().Value; - _gotFirstKFValue = true; - } - - if (_currentState == KeyFramesStates.Disposed) - throw new InvalidProgramException("This KeyFrames Animation is already disposed."); - - if (_playState == PlayState.Stop) - _currentState = KeyFramesStates.Stop; - - // Save state and pause the machine - if (_playState == PlayState.Pause && _currentState != KeyFramesStates.Pause) - { - _savedState = _currentState; - _currentState = KeyFramesStates.Pause; - } - - // Resume the previous state - if (_playState != PlayState.Pause && _currentState == KeyFramesStates.Pause) - _currentState = _savedState; - - double _tempDuration = 0d, _easedTime; - - bool handled = false; - - while (!handled) - { - switch (_currentState) - { - case KeyFramesStates.DoDelay: - - if (_fillMode == FillMode.Backward - || _fillMode == FillMode.Both) - { - if (_currentIteration == 0) - { - _targetObserver.OnNext(_firstKFValue); - } - else - { - _targetObserver.OnNext(_lastInterpValue); - } - } - - if (_delayFrameCount > _delayTotalFrameCount) - { - _currentState = KeyFramesStates.DoRun; - } - else - { - handled = true; - _delayFrameCount++; - } - break; - - case KeyFramesStates.DoRun: - - if (_isReversed) - _currentState = KeyFramesStates.RunBackwards; - else - _currentState = KeyFramesStates.RunForwards; - - break; - - case KeyFramesStates.RunForwards: - - if (_durationFrameCount > _durationTotalFrameCount) - { - _currentState = KeyFramesStates.RunComplete; - } - else - { - _tempDuration = (double)_durationFrameCount / _durationTotalFrameCount; - _currentState = KeyFramesStates.RunApplyValue; - - } - break; - - case KeyFramesStates.RunBackwards: - - if (_durationFrameCount > _durationTotalFrameCount) - { - _currentState = KeyFramesStates.RunComplete; - } - else - { - _tempDuration = (double)(_durationTotalFrameCount - _durationFrameCount) / _durationTotalFrameCount; - _currentState = KeyFramesStates.RunApplyValue; - } - break; - - case KeyFramesStates.RunApplyValue: - - _easedTime = _targetAnimation.Easing.Ease(_tempDuration); - - _durationFrameCount++; - _lastInterpValue = Interpolator(_easedTime, _neutralValue); - _targetObserver.OnNext(_lastInterpValue); - _currentState = KeyFramesStates.DoRun; - handled = true; - break; - - case KeyFramesStates.RunComplete: - - if (_checkLoopAndRepeat) - { - _delayFrameCount = 0; - _durationFrameCount = 0; - - if (_isLooping) - { - _currentState = KeyFramesStates.DoRun; - } - else if (_isRepeating) - { - if (_currentIteration >= _repeatCount) - { - _currentState = KeyFramesStates.Stop; - } - else - { - _currentState = KeyFramesStates.DoRun; - } - _currentIteration++; - } - - if (_animationDirection == PlaybackDirection.Alternate - || _animationDirection == PlaybackDirection.AlternateReverse) - _isReversed = !_isReversed; - - break; - } - - _currentState = KeyFramesStates.Stop; - break; - - case KeyFramesStates.Stop: - - if (_fillMode == FillMode.Forward - || _fillMode == FillMode.Both) - { - _targetControl.SetValue(_parent.Property, _lastInterpValue, BindingPriority.LocalValue); - } - - _targetObserver.OnCompleted(); - _onComplete?.Invoke(); - Dispose(); - handled = true; - break; - default: - handled = true; - break; - } - } - } - - public IDisposable Subscribe(IObserver observer) - { - _targetObserver = observer; - return this; - } - - public void Dispose() - { - _unsubscribe = true; - _currentState = KeyFramesStates.Disposed; - } - } -} diff --git a/src/Avalonia.Animation/Animator`1.cs b/src/Avalonia.Animation/Animator`1.cs index eb8b40647d..f0ef55aa9e 100644 --- a/src/Avalonia.Animation/Animator`1.cs +++ b/src/Avalonia.Animation/Animator`1.cs @@ -1,13 +1,10 @@ using System; using System.Collections.Generic; -using System.Text; -using Avalonia.Collections; -using System.ComponentModel; -using Avalonia.Animation.Utils; -using System.Reactive.Linq; using System.Linq; +using System.Reactive.Linq; +using Avalonia.Animation.Utils; +using Avalonia.Collections; using Avalonia.Data; -using System.Reactive.Disposables; namespace Avalonia.Animation { @@ -19,9 +16,9 @@ namespace Avalonia.Animation /// /// List of type-converted keyframes. /// - private readonly SortedList _convertedKeyframes = new SortedList(); - - private bool _isVerfifiedAndConverted; + private readonly List _convertedKeyframes = new List(); + + private bool _isVerifiedAndConverted; /// /// Gets or sets the target property for the keyframe. @@ -31,18 +28,17 @@ namespace Avalonia.Animation public Animator() { // Invalidate keyframes when changed. - this.CollectionChanged += delegate { _isVerfifiedAndConverted = false; }; + this.CollectionChanged += delegate { _isVerifiedAndConverted = false; }; } /// - public virtual IDisposable Apply(Animation animation, Animatable control, IObservable obsMatch, Action onComplete) + public virtual IDisposable Apply(Animation animation, Animatable control, IObservable match, Action onComplete) { - if (!_isVerfifiedAndConverted) + if (!_isVerifiedAndConverted) VerifyConvertKeyFrames(); - return obsMatch - // Ignore triggers when global timers are paused. - .Where(p => p && Timing.GetGlobalPlayState() != PlayState.Pause) + return match + .Where(p => p) .Subscribe(_ => { var timerObs = RunKeyFrames(animation, control, onComplete); @@ -59,53 +55,56 @@ namespace Avalonia.Animation /// The time parameter, relative to the total animation time protected (double IntraKFTime, KeyFramePair KFPair) GetKFPairAndIntraKFTime(double t) { - KeyValuePair firstCue, lastCue; + AnimatorKeyFrame firstCue, lastCue ; int kvCount = _convertedKeyframes.Count; if (kvCount > 2) { - if (DoubleUtils.AboutEqual(t, 0.0) || t < 0.0) + if (t <= 0.0) { - firstCue = _convertedKeyframes.First(); - lastCue = _convertedKeyframes.Skip(1).First(); + firstCue = _convertedKeyframes[0]; + lastCue = _convertedKeyframes[1]; } - else if (DoubleUtils.AboutEqual(t, 1.0) || t > 1.0) + else if (t >= 1.0) { - firstCue = _convertedKeyframes.Skip(kvCount - 2).First(); - lastCue = _convertedKeyframes.Last(); + firstCue = _convertedKeyframes[_convertedKeyframes.Count - 2]; + lastCue = _convertedKeyframes[_convertedKeyframes.Count - 1]; } else { - firstCue = _convertedKeyframes.Last(j => j.Key <= t); - lastCue = _convertedKeyframes.First(j => j.Key >= t); + (double time, int index) maxval = (0.0d, 0); + for (int i = 0; i < _convertedKeyframes.Count; i++) + { + var comp = _convertedKeyframes[i].Cue.CueValue; + if (t >= comp) + { + maxval = (comp, i); + } + } + firstCue = _convertedKeyframes[maxval.index]; + lastCue = _convertedKeyframes[maxval.index + 1]; } } else { - firstCue = _convertedKeyframes.First(); - lastCue = _convertedKeyframes.Last(); + firstCue = _convertedKeyframes[0]; + lastCue = _convertedKeyframes[1]; } - double t0 = firstCue.Key; - double t1 = lastCue.Key; + double t0 = firstCue.Cue.CueValue; + double t1 = lastCue.Cue.CueValue; var intraframeTime = (t - t0) / (t1 - t0); - var firstFrameData = (firstCue.Value.frame.GetTypedValue(), firstCue.Value.isNeutral); - var lastFrameData = (lastCue.Value.frame.GetTypedValue(), lastCue.Value.isNeutral); + var firstFrameData = (firstCue.GetTypedValue(), firstCue.isNeutral); + var lastFrameData = (lastCue.GetTypedValue(), lastCue.isNeutral); return (intraframeTime, new KeyFramePair(firstFrameData, lastFrameData)); } - /// /// Runs the KeyFrames Animation. /// private IDisposable RunKeyFrames(Animation animation, Animatable control, Action onComplete) { - var stateMachine = new AnimatorStateMachine(animation, control, this, onComplete); - - Timing.AnimationStateTimer - .TakeWhile(_ => !stateMachine._unsubscribe) - .Subscribe(p => stateMachine.Step(p, DoInterpolation)); - - return control.Bind(Property, stateMachine, BindingPriority.Animation); + var instance = new AnimationInstance(animation, control, this, onComplete, DoInterpolation); + return control.Bind((AvaloniaProperty)Property, instance, BindingPriority.Animation); } /// @@ -114,18 +113,26 @@ namespace Avalonia.Animation protected abstract T DoInterpolation(double time, T neutralValue); /// - /// Verifies and converts keyframe values according to this class's target type. + /// Verifies, converts and sorts keyframe values according to this class's target type. /// private void VerifyConvertKeyFrames() { foreach (AnimatorKeyFrame keyframe in this) { - _convertedKeyframes.Add(keyframe.Cue.CueValue, (keyframe, false)); + _convertedKeyframes.Add(keyframe); } AddNeutralKeyFramesIfNeeded(); - _isVerfifiedAndConverted = true; + var copy = _convertedKeyframes.ToList().OrderBy(p => p.Cue.CueValue); + _convertedKeyframes.Clear(); + + foreach (AnimatorKeyFrame keyframe in copy) + { + _convertedKeyframes.Add(keyframe); + } + + _isVerifiedAndConverted = true; } private void AddNeutralKeyFramesIfNeeded() @@ -133,14 +140,14 @@ namespace Avalonia.Animation bool hasStartKey, hasEndKey; hasStartKey = hasEndKey = false; - // Make start and end keyframe mandatory. - foreach (var converted in _convertedKeyframes.Keys) + // Check if there's start and end keyframes. + foreach (var frame in _convertedKeyframes) { - if (DoubleUtils.AboutEqual(converted, 0.0)) + if (frame.Cue.CueValue == 0.0d) { hasStartKey = true; } - else if (DoubleUtils.AboutEqual(converted, 1.0)) + else if (frame.Cue.CueValue == 1.0d) { hasEndKey = true; } @@ -154,12 +161,12 @@ namespace Avalonia.Animation { if (!hasStartKey) { - _convertedKeyframes.Add(0.0d, (new AnimatorKeyFrame { Value = default(T) }, true)); + _convertedKeyframes.Add(new AnimatorKeyFrame(null, new Cue(0.0d)) { Value = default(T), isNeutral = true }); } if (!hasEndKey) { - _convertedKeyframes.Add(1.0d, (new AnimatorKeyFrame { Value = default(T) }, true)); + _convertedKeyframes.Add(new AnimatorKeyFrame(null, new Cue(1.0d)) { Value = default(T), isNeutral = true }); } } } diff --git a/src/Avalonia.Animation/Cue.cs b/src/Avalonia.Animation/Cue.cs index 5a95c108e3..52d1609cf9 100644 --- a/src/Avalonia.Animation/Cue.cs +++ b/src/Avalonia.Animation/Cue.cs @@ -1,13 +1,11 @@ using System; -using System.Collections.Generic; using System.ComponentModel; using System.Globalization; -using System.Text; namespace Avalonia.Animation { /// - /// A Cue object for . + /// Determines the time index for a . /// [TypeConverter(typeof(CueTypeConverter))] public readonly struct Cue : IEquatable, IEquatable @@ -84,5 +82,4 @@ namespace Avalonia.Animation return Cue.Parse((string)value, culture); } } - -} +} \ No newline at end of file diff --git a/src/Avalonia.Animation/DoubleAnimator.cs b/src/Avalonia.Animation/DoubleAnimator.cs index 154f37360c..aeeb29a7dd 100644 --- a/src/Avalonia.Animation/DoubleAnimator.cs +++ b/src/Avalonia.Animation/DoubleAnimator.cs @@ -1,13 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Text; -using System.Linq; -using System.Reactive.Linq; -using System.Diagnostics; -using Avalonia.Animation.Utils; -using Avalonia.Data; - -namespace Avalonia.Animation +namespace Avalonia.Animation { /// /// Animator that handles properties. diff --git a/src/Avalonia.Animation/DoubleTransition.cs b/src/Avalonia.Animation/DoubleTransition.cs index 26f7f975e8..23445e1122 100644 --- a/src/Avalonia.Animation/DoubleTransition.cs +++ b/src/Avalonia.Animation/DoubleTransition.cs @@ -1,7 +1,6 @@ // Copyright (c) The Avalonia Project. All rights reserved. // Licensed under the MIT license. See licence.md file in the project root for full license information. -using Avalonia.Metadata; using System; using System.Reactive.Linq; diff --git a/src/Avalonia.Animation/Easing/BounceEaseIn.cs b/src/Avalonia.Animation/Easing/BounceEaseIn.cs index 6aa6f171f5..3fc879b3cf 100644 --- a/src/Avalonia.Animation/Easing/BounceEaseIn.cs +++ b/src/Avalonia.Animation/Easing/BounceEaseIn.cs @@ -1,7 +1,6 @@ // Copyright (c) The Avalonia Project. All rights reserved. // Licensed under the MIT license. See licence.md file in the project root for full license information. - using Avalonia.Animation.Utils; namespace Avalonia.Animation.Easings diff --git a/src/Avalonia.Animation/Easing/Easing.cs b/src/Avalonia.Animation/Easing/Easing.cs index 62bcf723fb..5b0dea6c60 100644 --- a/src/Avalonia.Animation/Easing/Easing.cs +++ b/src/Avalonia.Animation/Easing/Easing.cs @@ -1,10 +1,7 @@ -using Avalonia.Collections; using System; using System.Collections.Generic; -using System.Text; -using System.Reflection; -using System.Linq; using System.ComponentModel; +using System.Linq; namespace Avalonia.Animation.Easings { diff --git a/src/Avalonia.Animation/Easing/EasingTypeConverter.cs b/src/Avalonia.Animation/Easing/EasingTypeConverter.cs index 70ddfd2699..ee15761eff 100644 --- a/src/Avalonia.Animation/Easing/EasingTypeConverter.cs +++ b/src/Avalonia.Animation/Easing/EasingTypeConverter.cs @@ -1,7 +1,6 @@ // Copyright (c) The Avalonia Project. All rights reserved. // Licensed under the MIT license. See licence.md file in the project root for full license information. -using Avalonia.Animation.Easings; using System; using System.ComponentModel; using System.Globalization; @@ -20,4 +19,4 @@ namespace Avalonia.Animation.Easings return Easing.Parse((string)value); } } -} \ No newline at end of file +} diff --git a/src/Avalonia.Animation/Easing/ElasticEaseIn.cs b/src/Avalonia.Animation/Easing/ElasticEaseIn.cs index 0dea7b20a7..654ac6991b 100644 --- a/src/Avalonia.Animation/Easing/ElasticEaseIn.cs +++ b/src/Avalonia.Animation/Easing/ElasticEaseIn.cs @@ -1,8 +1,8 @@ // Copyright (c) The Avalonia Project. All rights reserved. // Licensed under the MIT license. See licence.md file in the project root for full license information. -using Avalonia.Animation.Utils; using System; +using Avalonia.Animation.Utils; namespace Avalonia.Animation.Easings { diff --git a/src/Avalonia.Animation/Easing/ElasticEaseOut.cs b/src/Avalonia.Animation/Easing/ElasticEaseOut.cs index 31e31374a0..1cc38a9dea 100644 --- a/src/Avalonia.Animation/Easing/ElasticEaseOut.cs +++ b/src/Avalonia.Animation/Easing/ElasticEaseOut.cs @@ -1,8 +1,8 @@ // Copyright (c) The Avalonia Project. All rights reserved. // Licensed under the MIT license. See licence.md file in the project root for full license information. -using Avalonia.Animation.Utils; using System; +using Avalonia.Animation.Utils; namespace Avalonia.Animation.Easings { diff --git a/src/Avalonia.Animation/Easing/SineEaseIn.cs b/src/Avalonia.Animation/Easing/SineEaseIn.cs index 31a8f0ca94..a4b496e4b6 100644 --- a/src/Avalonia.Animation/Easing/SineEaseIn.cs +++ b/src/Avalonia.Animation/Easing/SineEaseIn.cs @@ -1,8 +1,8 @@ // Copyright (c) The Avalonia Project. All rights reserved. // Licensed under the MIT license. See licence.md file in the project root for full license information. -using Avalonia.Animation.Utils; using System; +using Avalonia.Animation.Utils; namespace Avalonia.Animation.Easings { diff --git a/src/Avalonia.Animation/Easing/SineEaseOut.cs b/src/Avalonia.Animation/Easing/SineEaseOut.cs index ed5a998e30..267b4b3809 100644 --- a/src/Avalonia.Animation/Easing/SineEaseOut.cs +++ b/src/Avalonia.Animation/Easing/SineEaseOut.cs @@ -1,8 +1,8 @@ // Copyright (c) The Avalonia Project. All rights reserved. // Licensed under the MIT license. See licence.md file in the project root for full license information. -using Avalonia.Animation.Utils; using System; +using Avalonia.Animation.Utils; namespace Avalonia.Animation.Easings { diff --git a/src/Avalonia.Animation/FillMode.cs b/src/Avalonia.Animation/FillMode.cs index 047d185db5..001e1cdeb4 100644 --- a/src/Avalonia.Animation/FillMode.cs +++ b/src/Avalonia.Animation/FillMode.cs @@ -1,8 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Text; - -namespace Avalonia.Animation +namespace Avalonia.Animation { public enum FillMode { diff --git a/src/Avalonia.Animation/FloatTransition.cs b/src/Avalonia.Animation/FloatTransition.cs index b94295d311..825a3f958f 100644 --- a/src/Avalonia.Animation/FloatTransition.cs +++ b/src/Avalonia.Animation/FloatTransition.cs @@ -1,7 +1,6 @@ // Copyright (c) The Avalonia Project. All rights reserved. // Licensed under the MIT license. See licence.md file in the project root for full license information. -using Avalonia.Metadata; using System; using System.Reactive.Linq; diff --git a/src/Avalonia.Animation/IAnimation.cs b/src/Avalonia.Animation/IAnimation.cs index 905d90fa52..1d545a322a 100644 --- a/src/Avalonia.Animation/IAnimation.cs +++ b/src/Avalonia.Animation/IAnimation.cs @@ -1,6 +1,4 @@ using System; -using System.Collections.Generic; -using System.Text; using System.Threading.Tasks; namespace Avalonia.Animation diff --git a/src/Avalonia.Animation/IAnimator.cs b/src/Avalonia.Animation/IAnimator.cs index 8b763db603..9a4da35a02 100644 --- a/src/Avalonia.Animation/IAnimator.cs +++ b/src/Avalonia.Animation/IAnimator.cs @@ -1,6 +1,5 @@ using System; using System.Collections.Generic; -using System.Text; namespace Avalonia.Animation { diff --git a/src/Avalonia.Animation/ITransition.cs b/src/Avalonia.Animation/ITransition.cs index 76f45e0c87..e2ffe7fc6e 100644 --- a/src/Avalonia.Animation/ITransition.cs +++ b/src/Avalonia.Animation/ITransition.cs @@ -1,9 +1,7 @@ // Copyright (c) The Avalonia Project. All rights reserved. // Licensed under the MIT license. See licence.md file in the project root for full license information. -using Avalonia.Metadata; using System; -using System.Reactive.Linq; namespace Avalonia.Animation { diff --git a/src/Avalonia.Animation/IntegerTransition.cs b/src/Avalonia.Animation/IntegerTransition.cs index 200b93a3df..e3dca5b26d 100644 --- a/src/Avalonia.Animation/IntegerTransition.cs +++ b/src/Avalonia.Animation/IntegerTransition.cs @@ -1,7 +1,6 @@ // Copyright (c) The Avalonia Project. All rights reserved. // Licensed under the MIT license. See licence.md file in the project root for full license information. -using Avalonia.Metadata; using System; using System.Reactive.Linq; diff --git a/src/Avalonia.Animation/KeyFrame.cs b/src/Avalonia.Animation/KeyFrame.cs index ea04aa0aab..5eb0d2e901 100644 --- a/src/Avalonia.Animation/KeyFrame.cs +++ b/src/Avalonia.Animation/KeyFrame.cs @@ -1,8 +1,5 @@ using System; using System.Collections.Generic; -using System.Text; -using System.ComponentModel; -using Avalonia.Metadata; using Avalonia.Collections; namespace Avalonia.Animation diff --git a/src/Avalonia.Animation/KeyFramePair`1.cs b/src/Avalonia.Animation/KeyFramePair`1.cs index 408b13e0d8..b0622a1580 100644 --- a/src/Avalonia.Animation/KeyFramePair`1.cs +++ b/src/Avalonia.Animation/KeyFramePair`1.cs @@ -1,14 +1,3 @@ -using System; -using System.Collections.Generic; -using System.Text; -using Avalonia.Collections; -using System.ComponentModel; -using Avalonia.Animation.Utils; -using System.Reactive.Linq; -using System.Linq; -using Avalonia.Data; -using System.Reactive.Disposables; - namespace Avalonia.Animation { /// diff --git a/src/Avalonia.Animation/PlayState.cs b/src/Avalonia.Animation/PlayState.cs index a3a6eb34d7..313d33d586 100644 --- a/src/Avalonia.Animation/PlayState.cs +++ b/src/Avalonia.Animation/PlayState.cs @@ -1,8 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Text; - -namespace Avalonia.Animation +namespace Avalonia.Animation { /// /// Determines the playback state of an animation. @@ -24,4 +20,4 @@ namespace Avalonia.Animation /// Stop } -} \ No newline at end of file +} diff --git a/src/Avalonia.Animation/PlaybackDirection.cs b/src/Avalonia.Animation/PlaybackDirection.cs index 39529323da..bbce6106e1 100644 --- a/src/Avalonia.Animation/PlaybackDirection.cs +++ b/src/Avalonia.Animation/PlaybackDirection.cs @@ -1,8 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Text; - -namespace Avalonia.Animation +namespace Avalonia.Animation { /// /// Determines the playback direction of an animation. diff --git a/src/Avalonia.Animation/RepeatCount.cs b/src/Avalonia.Animation/RepeatCount.cs index 2050513df2..9794fe8f36 100644 --- a/src/Avalonia.Animation/RepeatCount.cs +++ b/src/Avalonia.Animation/RepeatCount.cs @@ -1,12 +1,9 @@ // Copyright (c) The Avalonia Project. All rights reserved. // Licensed under the MIT license. See licence.md file in the project root for full license information. -using Avalonia.Utilities; using System; -using System.Collections.Generic; using System.ComponentModel; using System.Globalization; -using System.Linq; namespace Avalonia.Animation { @@ -199,4 +196,4 @@ namespace Avalonia.Animation } } } -} \ No newline at end of file +} diff --git a/src/Avalonia.Animation/RepeatCountTypeConverter.cs b/src/Avalonia.Animation/RepeatCountTypeConverter.cs index 604e9b54e7..4eab50c1c7 100644 --- a/src/Avalonia.Animation/RepeatCountTypeConverter.cs +++ b/src/Avalonia.Animation/RepeatCountTypeConverter.cs @@ -1,7 +1,6 @@ // Copyright (c) The Avalonia Project. All rights reserved. // Licensed under the MIT license. See licence.md file in the project root for full license information. -using Avalonia.Animation.Easings; using System; using System.ComponentModel; using System.Globalization; @@ -20,4 +19,4 @@ namespace Avalonia.Animation return RepeatCount.Parse((string)value); } } -} \ No newline at end of file +} diff --git a/src/Avalonia.Animation/Timing.cs b/src/Avalonia.Animation/Timing.cs index 10d65cca7f..6367425911 100644 --- a/src/Avalonia.Animation/Timing.cs +++ b/src/Avalonia.Animation/Timing.cs @@ -2,10 +2,8 @@ // Licensed under the MIT license. See licence.md file in the project root for full license information. using System; -using System.Diagnostics; using System.Linq; using System.Reactive.Linq; -using Avalonia.Data; using Avalonia.Threading; namespace Avalonia.Animation @@ -15,9 +13,6 @@ namespace Avalonia.Animation /// public static class Timing { - static ulong _transitionsFrameCount; - static PlayState _globalState = PlayState.Run; - /// /// The number of frames per second. /// @@ -32,41 +27,16 @@ namespace Avalonia.Animation /// Initializes static members of the class. /// static Timing() - { + { var globalTimer = Observable.Interval(FrameTick, AvaloniaScheduler.Instance); - AnimationStateTimer = globalTimer - .Select(_ => - { - return _globalState; - }) + AnimationsTimer = globalTimer + .Select(_ => GetTickCount()) .Publish() .RefCount(); - - TransitionsTimer = globalTimer - .Select(p => _transitionsFrameCount++) - .Publish() - .RefCount(); - } - - - /// - /// Sets the animation play state for all animations - /// - public static void SetGlobalPlayState(PlayState playState) - { - Dispatcher.UIThread.VerifyAccess(); - _globalState = playState; } - /// - /// Gets the animation play state for all animations - /// - public static PlayState GetGlobalPlayState() - { - Dispatcher.UIThread.VerifyAccess(); - return _globalState; - } + internal static TimeSpan GetTickCount() => TimeSpan.FromMilliseconds(Environment.TickCount); /// /// Gets the animation timer. @@ -76,48 +46,9 @@ namespace Avalonia.Animation /// defined in . /// The parameter passed to a subsciber is the current playstate of the animation. /// - internal static IObservable AnimationStateTimer + internal static IObservable AnimationsTimer { get; } - - /// - /// Gets the transitions timer. - /// - /// - /// The transitions timer increments usually 60 times per second as - /// defined in . - /// The parameter passed to a subsciber is the number of frames since the animation system was - /// initialized. - /// - public static IObservable TransitionsTimer - { - get; - } - - /// - /// Gets a timer that fires every frame for the specified duration with delay. - /// - /// - /// An observable that notifies the subscriber of the progress along the transition. - /// - /// - /// The parameter passed to the subscriber is the progress along the transition, with - /// 0 being the start and 1 being the end. The observable is guaranteed to fire 0 - /// immediately on subscribe and 1 at the end of the duration. - /// - public static IObservable GetTransitionsTimer(Animatable control, TimeSpan duration, TimeSpan delay = default(TimeSpan)) - { - var startTime = _transitionsFrameCount; - var _duration = (ulong)(duration.Ticks / FrameTick.Ticks); - var endTime = startTime + _duration; - - return TransitionsTimer - .TakeWhile(x => x < endTime) - .Select(x => (double)(x - startTime) / _duration) - .StartWith(0.0) - .Concat(Observable.Return(1.0)); - } - } -} +} \ No newline at end of file diff --git a/src/Avalonia.Animation/TransitionInstance.cs b/src/Avalonia.Animation/TransitionInstance.cs new file mode 100644 index 0000000000..e2719cb472 --- /dev/null +++ b/src/Avalonia.Animation/TransitionInstance.cs @@ -0,0 +1,54 @@ +// Copyright (c) The Avalonia Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. + +using Avalonia.Metadata; +using System; +using System.Reactive.Linq; +using Avalonia.Animation.Easings; +using Avalonia.Animation.Utils; +using Avalonia.Reactive; + +namespace Avalonia.Animation +{ + /// + /// Handles the timing and lifetime of a . + /// + internal class TransitionInstance : SingleSubscriberObservableBase + { + private IDisposable timerSubscription; + private TimeSpan startTime; + private TimeSpan duration; + + public TransitionInstance(TimeSpan Duration) + { + duration = Duration; + } + + private void TimerTick(TimeSpan t) + { + var interpVal = (double)(t.Ticks - startTime.Ticks) / duration.Ticks; + + if (interpVal > 1d + || interpVal < 0d) + { + PublishCompleted(); + return; + } + + PublishNext(interpVal); + } + + protected override void Unsubscribed() + { + timerSubscription?.Dispose(); + } + + protected override void Subscribed() + { + startTime = Timing.GetTickCount(); + timerSubscription = Timing.AnimationsTimer + .Subscribe(t => TimerTick(t)); + PublishNext(0.0d); + } + } +} \ No newline at end of file diff --git a/src/Avalonia.Animation/Transition`1.cs b/src/Avalonia.Animation/Transition`1.cs index 5db3082deb..4b01c54f5c 100644 --- a/src/Avalonia.Animation/Transition`1.cs +++ b/src/Avalonia.Animation/Transition`1.cs @@ -1,10 +1,10 @@ // Copyright (c) The Avalonia Project. All rights reserved. // Licensed under the MIT license. See licence.md file in the project root for full license information. -using Avalonia.Metadata; using System; using System.Reactive.Linq; using Avalonia.Animation.Easings; +using Avalonia.Animation.Utils; namespace Avalonia.Animation { @@ -24,17 +24,7 @@ namespace Avalonia.Animation /// /// Gets the easing class to be used. /// - public Easing Easing - { - get - { - return _easing ?? (_easing = new LinearEasing()); - } - set - { - _easing = value; - } - } + public Easing Easing { get; set; } = new LinearEasing(); /// public AvaloniaProperty Property @@ -61,8 +51,10 @@ namespace Avalonia.Animation /// public virtual IDisposable Apply(Animatable control, object oldValue, object newValue) { - var transition = DoTransition(Timing.GetTransitionsTimer(control, Duration, TimeSpan.Zero), (T)oldValue, (T)newValue).Select(p => (object)p); - return control.Bind(Property, transition, Data.BindingPriority.Animation); + var transition = DoTransition(new TransitionInstance(Duration), (T)oldValue, (T)newValue); + return control.Bind((AvaloniaProperty)Property, transition, Data.BindingPriority.Animation); } + + } -} \ No newline at end of file +} diff --git a/src/Avalonia.Animation/Utils/DoubleUtils.cs b/src/Avalonia.Animation/Utils/DoubleUtils.cs deleted file mode 100644 index 67943b687d..0000000000 --- a/src/Avalonia.Animation/Utils/DoubleUtils.cs +++ /dev/null @@ -1,18 +0,0 @@ -// Copyright (c) The Avalonia Project. All rights reserved. -// Licensed under the MIT license. See licence.md file in the project root for full license information. - -using System; -using System.Collections.Generic; -using System.Text; - -namespace Avalonia.Animation.Utils -{ - internal static class DoubleUtils - { - internal static bool AboutEqual(double x, double y) - { - double epsilon = Math.Max(Math.Abs(x), Math.Abs(y)) * 1E-15; - return Math.Abs(x - y) <= epsilon; - } - } -} diff --git a/src/Avalonia.Animation/Utils/EasingUtils.cs b/src/Avalonia.Animation/Utils/EasingUtils.cs index d07ec3cdf4..1a7688cace 100644 --- a/src/Avalonia.Animation/Utils/EasingUtils.cs +++ b/src/Avalonia.Animation/Utils/EasingUtils.cs @@ -13,6 +13,6 @@ namespace Avalonia.Animation.Utils /// /// Half of /// - internal static double HALFPI = Math.PI / 2d; + internal const double HALFPI = Math.PI / 2d; } } diff --git a/src/Avalonia.Base/Data/Core/Plugins/DataValidationBase.cs b/src/Avalonia.Base/Data/Core/Plugins/DataValidationBase.cs index faec981eed..2e0d1aa805 100644 --- a/src/Avalonia.Base/Data/Core/Plugins/DataValidationBase.cs +++ b/src/Avalonia.Base/Data/Core/Plugins/DataValidationBase.cs @@ -2,7 +2,6 @@ // Licensed under the MIT license. See licence.md file in the project root for full license information. using System; -using Avalonia.Data; namespace Avalonia.Data.Core.Plugins { diff --git a/src/Avalonia.Base/Threading/Dispatcher.cs b/src/Avalonia.Base/Threading/Dispatcher.cs index aa2a7a7a8e..55a9b6984a 100644 --- a/src/Avalonia.Base/Threading/Dispatcher.cs +++ b/src/Avalonia.Base/Threading/Dispatcher.cs @@ -92,6 +92,20 @@ namespace Avalonia.Threading return _jobRunner.InvokeAsync(function, priority); } + /// + public Task InvokeAsync(Func function, DispatcherPriority priority = DispatcherPriority.Normal) + { + Contract.Requires(function != null); + return _jobRunner.InvokeAsync(function, priority).Unwrap(); + } + + /// + public Task InvokeAsync(Func> function, DispatcherPriority priority = DispatcherPriority.Normal) + { + Contract.Requires(function != null); + return _jobRunner.InvokeAsync(function, priority).Unwrap(); + } + /// public void Post(Action action, DispatcherPriority priority = DispatcherPriority.Normal) { diff --git a/src/Avalonia.Base/Threading/IDispatcher.cs b/src/Avalonia.Base/Threading/IDispatcher.cs index 1fdc9da5fe..8f46f99283 100644 --- a/src/Avalonia.Base/Threading/IDispatcher.cs +++ b/src/Avalonia.Base/Threading/IDispatcher.cs @@ -40,5 +40,23 @@ namespace Avalonia.Threading /// The method. /// The priority with which to invoke the method. Task InvokeAsync(Func function, DispatcherPriority priority = DispatcherPriority.Normal); + + /// + /// Queues the specified work to run on the dispatcher thread and returns a proxy for the + /// task returned by . + /// + /// The work to execute asynchronously. + /// The priority with which to invoke the method. + /// A task that represents a proxy for the task returned by . + Task InvokeAsync(Func function, DispatcherPriority priority = DispatcherPriority.Normal); + + /// + /// Queues the specified work to run on the dispatcher thread and returns a proxy for the + /// task returned by . + /// + /// The work to execute asynchronously. + /// The priority with which to invoke the method. + /// A task that represents a proxy for the task returned by . + Task InvokeAsync(Func> function, DispatcherPriority priority = DispatcherPriority.Normal); } } \ No newline at end of file diff --git a/src/Avalonia.Controls/Canvas.cs b/src/Avalonia.Controls/Canvas.cs index 5c9a97cb27..e16a0b074b 100644 --- a/src/Avalonia.Controls/Canvas.cs +++ b/src/Avalonia.Controls/Canvas.cs @@ -48,7 +48,7 @@ namespace Avalonia.Controls static Canvas() { ClipToBoundsProperty.OverrideDefaultValue(false); - AffectsCanvasArrange(LeftProperty, TopProperty, RightProperty, BottomProperty); + AffectsParentArrange(LeftProperty, TopProperty, RightProperty, BottomProperty); } /// @@ -207,29 +207,5 @@ namespace Avalonia.Controls return finalSize; } - - /// - /// Marks a property on a child as affecting the canvas' arrangement. - /// - /// The properties. - private static void AffectsCanvasArrange(params AvaloniaProperty[] properties) - { - foreach (var property in properties) - { - property.Changed.Subscribe(AffectsCanvasArrangeInvalidate); - } - } - - /// - /// Calls on the parent of the control whose - /// property changed, if that parent is a canvas. - /// - /// The event args. - private static void AffectsCanvasArrangeInvalidate(AvaloniaPropertyChangedEventArgs e) - { - var control = e.Sender as IControl; - var canvas = control?.VisualParent as Canvas; - canvas?.InvalidateArrange(); - } } } diff --git a/src/Avalonia.Controls/ContentControl.cs b/src/Avalonia.Controls/ContentControl.cs index 6da6da54a5..f9241956bd 100644 --- a/src/Avalonia.Controls/ContentControl.cs +++ b/src/Avalonia.Controls/ContentControl.cs @@ -45,6 +45,8 @@ namespace Avalonia.Controls static ContentControl() { ContentControlMixin.Attach(ContentProperty, x => x.LogicalChildren); + PseudoClass(ContentProperty, x => x != null, ":valid"); + PseudoClass(ContentProperty, x => x == null, ":invalid"); } /// diff --git a/src/Avalonia.Controls/Converters/MarginMultiplierConverter.cs b/src/Avalonia.Controls/Converters/MarginMultiplierConverter.cs new file mode 100644 index 0000000000..54bd6bcf39 --- /dev/null +++ b/src/Avalonia.Controls/Converters/MarginMultiplierConverter.cs @@ -0,0 +1,32 @@ +using System; +using System.Globalization; +using Avalonia.Data.Converters; + +namespace Avalonia.Controls.Converters +{ + public class MarginMultiplierConverter : IValueConverter + { + public double Indent { get; set; } + + public bool Left { get; set; } = false; + + public bool Top { get; set; } = false; + + public bool Right { get; set; } = false; + + public bool Bottom { get; set; } = false; + + public object Convert(object value, Type targetType, object parameter, CultureInfo culture) + { + if (!(value is int depth)) + return new Thickness(0); + + return new Thickness(Left ? Indent * depth : 0, Top ? Indent * depth : 0, Right ? Indent * depth : 0, Bottom ? Indent * depth : 0); + } + + public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) + { + throw new System.NotImplementedException(); + } + } +} diff --git a/src/Avalonia.Controls/DockPanel.cs b/src/Avalonia.Controls/DockPanel.cs index 66e84c1110..e147fe1a52 100644 --- a/src/Avalonia.Controls/DockPanel.cs +++ b/src/Avalonia.Controls/DockPanel.cs @@ -37,7 +37,7 @@ namespace Avalonia.Controls /// static DockPanel() { - AffectsArrange(DockProperty); + AffectsParentMeasure(DockProperty); } /// @@ -173,4 +173,4 @@ namespace Avalonia.Controls return arrangeSize; } } -} \ No newline at end of file +} diff --git a/src/Avalonia.Controls/Grid.cs b/src/Avalonia.Controls/Grid.cs index 5f194bdd71..1a07ccaf7e 100644 --- a/src/Avalonia.Controls/Grid.cs +++ b/src/Avalonia.Controls/Grid.cs @@ -48,6 +48,11 @@ namespace Avalonia.Controls private RowDefinitions _rowDefinitions; + static Grid() + { + AffectsParentMeasure(ColumnProperty, ColumnSpanProperty, RowProperty, RowSpanProperty); + } + /// /// Gets or sets the columns definitions for the grid. /// diff --git a/src/Avalonia.Controls/Panel.cs b/src/Avalonia.Controls/Panel.cs index a2cb013300..c0d211effb 100644 --- a/src/Avalonia.Controls/Panel.cs +++ b/src/Avalonia.Controls/Panel.cs @@ -72,6 +72,32 @@ namespace Avalonia.Controls base.Render(context); } + /// + /// Marks a property on a child as affecting the parent panel's arrangement. + /// + /// The properties. + protected static void AffectsParentArrange(params AvaloniaProperty[] properties) + where TPanel : class, IPanel + { + foreach (var property in properties) + { + property.Changed.Subscribe(AffectsParentArrangeInvalidate); + } + } + + /// + /// Marks a property on a child as affecting the parent panel's measurement. + /// + /// The properties. + protected static void AffectsParentMeasure(params AvaloniaProperty[] properties) + where TPanel : class, IPanel + { + foreach (var property in properties) + { + property.Changed.Subscribe(AffectsParentMeasureInvalidate); + } + } + /// /// Called when the collection changes. /// @@ -116,5 +142,21 @@ namespace Avalonia.Controls InvalidateMeasure(); } + + private static void AffectsParentArrangeInvalidate(AvaloniaPropertyChangedEventArgs e) + where TPanel : class, IPanel + { + var control = e.Sender as IControl; + var panel = control?.VisualParent as TPanel; + panel?.InvalidateArrange(); + } + + private static void AffectsParentMeasureInvalidate(AvaloniaPropertyChangedEventArgs e) + where TPanel : class, IPanel + { + var control = e.Sender as IControl; + var panel = control?.VisualParent as TPanel; + panel?.InvalidateMeasure(); + } } } diff --git a/src/Avalonia.Controls/Presenters/ItemVirtualizer.cs b/src/Avalonia.Controls/Presenters/ItemVirtualizer.cs index c5344b29d9..46da8fe3f8 100644 --- a/src/Avalonia.Controls/Presenters/ItemVirtualizer.cs +++ b/src/Avalonia.Controls/Presenters/ItemVirtualizer.cs @@ -279,6 +279,6 @@ namespace Avalonia.Controls.Presenters /// /// Invalidates the current scroll. /// - protected void InvalidateScroll() => ((ILogicalScrollable)Owner).InvalidateScroll(); + protected void InvalidateScroll() => ((ILogicalScrollable)Owner).InvalidateScroll?.Invoke(); } } diff --git a/src/Avalonia.Controls/Presenters/TextPresenter.cs b/src/Avalonia.Controls/Presenters/TextPresenter.cs index 3181e76c3f..a30d9bfc48 100644 --- a/src/Avalonia.Controls/Presenters/TextPresenter.cs +++ b/src/Avalonia.Controls/Presenters/TextPresenter.cs @@ -35,6 +35,11 @@ namespace Avalonia.Controls.Presenters private int _selectionEnd; private bool _caretBlink; private IBrush _highlightBrush; + + static TextPresenter() + { + AffectsRender(PasswordCharProperty); + } public TextPresenter() { @@ -49,6 +54,9 @@ namespace Avalonia.Controls.Presenters this.GetObservable(CaretIndexProperty) .Subscribe(CaretIndexChanged); + + this.GetObservable(PasswordCharProperty) + .Subscribe(_ => InvalidateFormattedText()); } public int CaretIndex diff --git a/src/Avalonia.Controls/Slider.cs b/src/Avalonia.Controls/Slider.cs index 31113812d1..32b0a1f259 100644 --- a/src/Avalonia.Controls/Slider.cs +++ b/src/Avalonia.Controls/Slider.cs @@ -171,11 +171,7 @@ namespace Avalonia.Controls /// Value that want to snap to closest Tick. private void MoveToNextTick(double value) { - double next = SnapToTick(Math.Max(Minimum, Math.Min(Maximum, value))); - if (next != value) - { - Value = next; - } + Value = SnapToTick(Math.Max(Minimum, Math.Min(Maximum, value))); } /// @@ -194,4 +190,4 @@ namespace Avalonia.Controls return value; } } -} \ No newline at end of file +} diff --git a/src/Avalonia.Controls/TreeView.cs b/src/Avalonia.Controls/TreeView.cs index 3003dab85e..c574799724 100644 --- a/src/Avalonia.Controls/TreeView.cs +++ b/src/Avalonia.Controls/TreeView.cs @@ -1,6 +1,8 @@ // Copyright (c) The Avalonia Project. All rights reserved. // Licensed under the MIT license. See licence.md file in the project root for full license information. +using System; +using System.Collections.Generic; using System.Linq; using Avalonia.Controls.Generators; using Avalonia.Controls.Primitives; @@ -31,6 +33,14 @@ namespace Avalonia.Controls o => o.SelectedItem, (o, v) => o.SelectedItem = v); + /// + /// Defines the event. + /// + public static readonly RoutedEvent SelectedItemChangedEvent = + RoutedEvent.Register( + "SelectedItemChanged", + RoutingStrategies.Bubble); + private object _selectedItem; /// @@ -41,6 +51,15 @@ namespace Avalonia.Controls // HACK: Needed or SelectedItem property will not be found in Release build. } + /// + /// Occurs when the control's selection changes. + /// + public event EventHandler SelectedItemChanged + { + add { AddHandler(SelectedItemChangedEvent, value); } + remove { RemoveHandler(SelectedItemChangedEvent, value); } + } + /// /// Gets the for the tree view. /// @@ -74,6 +93,7 @@ namespace Avalonia.Controls MarkContainerSelected(container, false); } + var oldItem = _selectedItem; SetAndRaise(SelectedItemProperty, ref _selectedItem, value); if (_selectedItem != null) @@ -86,6 +106,28 @@ namespace Avalonia.Controls container.BringIntoView(); } } + + if (oldItem != _selectedItem) + { + // Fire the SelectionChanged event + List removed = new List(); + if (oldItem != null) + { + removed.Add(oldItem); + } + + List added = new List(); + if (_selectedItem != null) + { + added.Add(_selectedItem); + } + + var changed = new SelectionChangedEventArgs( + SelectedItemChangedEvent, + added, + removed); + RaiseEvent(changed); + } } } diff --git a/src/Avalonia.Controls/TreeViewItem.cs b/src/Avalonia.Controls/TreeViewItem.cs index 0886c05038..4d229390cb 100644 --- a/src/Avalonia.Controls/TreeViewItem.cs +++ b/src/Avalonia.Controls/TreeViewItem.cs @@ -21,7 +21,7 @@ namespace Avalonia.Controls /// public static readonly DirectProperty IsExpandedProperty = AvaloniaProperty.RegisterDirect( - "IsExpanded", + nameof(IsExpanded), o => o.IsExpanded, (o, v) => o.IsExpanded = v); @@ -31,17 +31,25 @@ namespace Avalonia.Controls public static readonly StyledProperty IsSelectedProperty = ListBoxItem.IsSelectedProperty.AddOwner(); + /// + /// Defines the property. + /// + public static readonly DirectProperty LevelProperty = + AvaloniaProperty.RegisterDirect( + nameof(Level), o => o.Level); + private static readonly ITemplate DefaultPanel = new FuncTemplate(() => new StackPanel()); private TreeView _treeView; private bool _isExpanded; + private int _level; /// /// Initializes static members of the class. /// static TreeViewItem() - { + { SelectableMixin.Attach(IsSelectedProperty); FocusableProperty.OverrideDefaultValue(true); ItemsPanelProperty.OverrideDefaultValue(DefaultPanel); @@ -65,6 +73,15 @@ namespace Avalonia.Controls set { SetValue(IsSelectedProperty, value); } } + /// + /// Gets the level/indentation of the item. + /// + public int Level + { + get { return _level; } + private set { SetAndRaise(LevelProperty, ref _level, value); } + } + /// /// Gets the for the tree view. /// @@ -89,6 +106,8 @@ namespace Avalonia.Controls base.OnAttachedToLogicalTree(e); _treeView = this.GetLogicalAncestors().OfType().FirstOrDefault(); + Level = CalculateDistanceFromLogicalParent(this) - 1; + if (ItemTemplate == null && _treeView?.ItemTemplate != null) { ItemTemplate = _treeView.ItemTemplate; @@ -126,5 +145,18 @@ namespace Avalonia.Controls // Don't call base.OnKeyDown - let events bubble up to containing TreeView. } + + private static int CalculateDistanceFromLogicalParent(ILogical logical, int @default = -1) where T : class + { + var result = 0; + + while (logical != null && logical.GetType() != typeof(T)) + { + ++result; + logical = logical.LogicalParent; + } + + return logical != null ? result : @default; + } } } diff --git a/src/Avalonia.DesignerSupport/Remote/PreviewerWindowingPlatform.cs b/src/Avalonia.DesignerSupport/Remote/PreviewerWindowingPlatform.cs index ca3bb2b97f..01998052d9 100644 --- a/src/Avalonia.DesignerSupport/Remote/PreviewerWindowingPlatform.cs +++ b/src/Avalonia.DesignerSupport/Remote/PreviewerWindowingPlatform.cs @@ -63,4 +63,4 @@ namespace Avalonia.DesignerSupport.Remote public Size DoubleClickSize { get; } = new Size(2, 2); public TimeSpan DoubleClickTime { get; } = TimeSpan.FromMilliseconds(500); } -} \ No newline at end of file +} diff --git a/src/Avalonia.DesignerSupport/Remote/RemoteDesignerEntryPoint.cs b/src/Avalonia.DesignerSupport/Remote/RemoteDesignerEntryPoint.cs index 2857272ac1..4536748836 100644 --- a/src/Avalonia.DesignerSupport/Remote/RemoteDesignerEntryPoint.cs +++ b/src/Avalonia.DesignerSupport/Remote/RemoteDesignerEntryPoint.cs @@ -1,11 +1,8 @@ using System; using System.Collections.Generic; -using System.Diagnostics; using System.Net; using System.Reflection; using Avalonia.Controls; -using Avalonia.Controls.Shapes; -using Avalonia.DesignerSupport; using Avalonia.Input; using Avalonia.Remote.Protocol; using Avalonia.Remote.Protocol.Designer; @@ -207,4 +204,4 @@ namespace Avalonia.DesignerSupport.Remote } }); } -} \ No newline at end of file +} diff --git a/src/Avalonia.Diagnostics/Debug.cs b/src/Avalonia.Diagnostics/Debug.cs index 4313c3f0a2..af3b5a8552 100644 --- a/src/Avalonia.Diagnostics/Debug.cs +++ b/src/Avalonia.Diagnostics/Debug.cs @@ -2,10 +2,8 @@ // Licensed under the MIT license. See licence.md file in the project root for full license information. using System; -using System.Collections.Generic; using System.Linq; using System.Text; -using System.Threading.Tasks; using Avalonia.Controls; using Avalonia.Data; using Avalonia.VisualTree; diff --git a/src/Avalonia.Diagnostics/ViewModels/LogicalTreeNode.cs b/src/Avalonia.Diagnostics/ViewModels/LogicalTreeNode.cs index e8a8951f0d..638cf6c88f 100644 --- a/src/Avalonia.Diagnostics/ViewModels/LogicalTreeNode.cs +++ b/src/Avalonia.Diagnostics/ViewModels/LogicalTreeNode.cs @@ -1,7 +1,6 @@ // Copyright (c) The Avalonia Project. All rights reserved. // Licensed under the MIT license. See licence.md file in the project root for full license information. -using System; using Avalonia.Collections; using Avalonia.Controls; using Avalonia.LogicalTree; diff --git a/src/Avalonia.Diagnostics/ViewModels/ViewModelBase.cs b/src/Avalonia.Diagnostics/ViewModels/ViewModelBase.cs index 349404603a..00660754c0 100644 --- a/src/Avalonia.Diagnostics/ViewModels/ViewModelBase.cs +++ b/src/Avalonia.Diagnostics/ViewModels/ViewModelBase.cs @@ -1,5 +1,4 @@ -using System; -using System.Collections.Generic; +using System.Collections.Generic; using System.ComponentModel; using System.Runtime.CompilerServices; using JetBrains.Annotations; diff --git a/src/Avalonia.Diagnostics/Views/PropertyChangedExtenions.cs b/src/Avalonia.Diagnostics/Views/PropertyChangedExtenions.cs index 1d4ad24fd0..2d833763a6 100644 --- a/src/Avalonia.Diagnostics/Views/PropertyChangedExtenions.cs +++ b/src/Avalonia.Diagnostics/Views/PropertyChangedExtenions.cs @@ -5,7 +5,7 @@ using System.Reflection; namespace Avalonia.Diagnostics.Views { - internal static class PropertyChangedExtenions + internal static class PropertyChangedExtensions { public static IObservable GetObservable(this INotifyPropertyChanged source, string propertyName) { diff --git a/src/Avalonia.Diagnostics/Views/SimpleGrid.cs b/src/Avalonia.Diagnostics/Views/SimpleGrid.cs index fb5b7821f3..33d9d81ed7 100644 --- a/src/Avalonia.Diagnostics/Views/SimpleGrid.cs +++ b/src/Avalonia.Diagnostics/Views/SimpleGrid.cs @@ -2,7 +2,6 @@ // Licensed under the MIT license. See licence.md file in the project root for full license information. using System.Collections.Generic; -using System.Linq; using Avalonia.Controls; namespace Avalonia.Diagnostics.Views diff --git a/src/Avalonia.DotNetCoreRuntime/AppBuilder.cs b/src/Avalonia.DotNetCoreRuntime/AppBuilder.cs index 5ae836eb24..5f1e845134 100644 --- a/src/Avalonia.DotNetCoreRuntime/AppBuilder.cs +++ b/src/Avalonia.DotNetCoreRuntime/AppBuilder.cs @@ -1,9 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Reflection; -using System.Text; -using System.Threading.Tasks; +using System.Reflection; using Avalonia.Controls; using Avalonia.Platform; using Avalonia.Shared.PlatformSupport; @@ -60,4 +55,4 @@ namespace Avalonia void LoadWin32() => this.UseWin32(); void LoadGtk3() => this.UseGtk3(); } -} \ No newline at end of file +} diff --git a/src/Avalonia.DotNetCoreRuntime/RuntimeInfo.cs b/src/Avalonia.DotNetCoreRuntime/RuntimeInfo.cs index 348c3f6e25..0e70f09296 100644 --- a/src/Avalonia.DotNetCoreRuntime/RuntimeInfo.cs +++ b/src/Avalonia.DotNetCoreRuntime/RuntimeInfo.cs @@ -1,9 +1,5 @@ using System; -using System.Collections.Generic; -using System.Linq; using System.Runtime.InteropServices; -using System.Text; -using System.Threading.Tasks; using Avalonia.Platform; diff --git a/src/Avalonia.Input/AccessKeyHandler.cs b/src/Avalonia.Input/AccessKeyHandler.cs index b78e5a9f98..b36e145d44 100644 --- a/src/Avalonia.Input/AccessKeyHandler.cs +++ b/src/Avalonia.Input/AccessKeyHandler.cs @@ -49,7 +49,7 @@ namespace Avalonia.Input private bool _altIsDown; /// - /// Element to restore folowing AltKey taking focus. + /// Element to restore following AltKey taking focus. /// private IInputElement _restoreFocusElement; diff --git a/src/Avalonia.Input/Cursors.cs b/src/Avalonia.Input/Cursors.cs index f38f653503..6f67f3b08c 100644 --- a/src/Avalonia.Input/Cursors.cs +++ b/src/Avalonia.Input/Cursors.cs @@ -2,10 +2,6 @@ // Licensed under the MIT license. See licence.md file in the project root for full license information. using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; using Avalonia.Platform; namespace Avalonia.Input @@ -69,7 +65,7 @@ namespace Avalonia.Input { return Enum.TryParse(s, true, out var t) ? new Cursor(t) : - throw new ArgumentException($"Unrecognised cursor type '{s}'."); + throw new ArgumentException($"Unrecognized cursor type '{s}'."); } private static IPlatformHandle GetCursor(StandardCursorType type) diff --git a/src/Avalonia.Input/DataObject.cs b/src/Avalonia.Input/DataObject.cs index cb642f4d65..60d7d67606 100644 --- a/src/Avalonia.Input/DataObject.cs +++ b/src/Avalonia.Input/DataObject.cs @@ -1,6 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Text; +using System.Collections.Generic; namespace Avalonia.Input { diff --git a/src/Avalonia.Input/DragDrop.cs b/src/Avalonia.Input/DragDrop.cs index c312732afa..b5aba55f6c 100644 --- a/src/Avalonia.Input/DragDrop.cs +++ b/src/Avalonia.Input/DragDrop.cs @@ -1,6 +1,6 @@ using System.Threading.Tasks; -using Avalonia.Interactivity; using Avalonia.Input.Platform; +using Avalonia.Interactivity; namespace Avalonia.Input { @@ -51,4 +51,4 @@ namespace Avalonia.Input return src?.DoDragDrop(data, allowedEffects) ?? Task.FromResult(DragDropEffects.None); } } -} \ No newline at end of file +} diff --git a/src/Avalonia.Input/ICustomKeyboardNavigation.cs b/src/Avalonia.Input/ICustomKeyboardNavigation.cs index de5f98e04b..ff4c2094b3 100644 --- a/src/Avalonia.Input/ICustomKeyboardNavigation.cs +++ b/src/Avalonia.Input/ICustomKeyboardNavigation.cs @@ -1,7 +1,6 @@ // Copyright (c) The Avalonia Project. All rights reserved. // Licensed under the MIT license. See licence.md file in the project root for full license information. -using System; namespace Avalonia.Input { diff --git a/src/Avalonia.Input/IDataObject.cs b/src/Avalonia.Input/IDataObject.cs index 1b12323d99..1aa8fd63d5 100644 --- a/src/Avalonia.Input/IDataObject.cs +++ b/src/Avalonia.Input/IDataObject.cs @@ -14,7 +14,7 @@ namespace Avalonia.Input IEnumerable GetDataFormats(); /// - /// Checks wether a given DataFormat is present in this object + /// Checks whether a given DataFormat is present in this object /// /// bool Contains(string dataFormat); @@ -36,4 +36,4 @@ namespace Avalonia.Input /// object Get(string dataFormat); } -} \ No newline at end of file +} diff --git a/src/Avalonia.Input/IInputManager.cs b/src/Avalonia.Input/IInputManager.cs index bc8ccbed5a..cdd72a7f3e 100644 --- a/src/Avalonia.Input/IInputManager.cs +++ b/src/Avalonia.Input/IInputManager.cs @@ -7,24 +7,24 @@ using Avalonia.Input.Raw; namespace Avalonia.Input { /// - /// Recieves input from the windowing subsystem and dispatches it to interested parties + /// Receives input from the windowing subsystem and dispatches it to interested parties /// for processing. /// public interface IInputManager { /// - /// Gets an observable that notifies on each input event recieved before + /// Gets an observable that notifies on each input event received before /// . /// IObservable PreProcess { get; } /// - /// Gets an observable that notifies on each input event recieved. + /// Gets an observable that notifies on each input event received. /// IObservable Process { get; } /// - /// Gets an observable that notifies on each input event recieved after + /// Gets an observable that notifies on each input event received after /// . /// IObservable PostProcess { get; } diff --git a/src/Avalonia.Input/IPointerDevice.cs b/src/Avalonia.Input/IPointerDevice.cs index 4ffbd1c6e3..8613717f60 100644 --- a/src/Avalonia.Input/IPointerDevice.cs +++ b/src/Avalonia.Input/IPointerDevice.cs @@ -1,8 +1,6 @@ // Copyright (c) The Avalonia Project. All rights reserved. // Licensed under the MIT license. See licence.md file in the project root for full license information. -using System; -using Avalonia.Interactivity; using Avalonia.VisualTree; namespace Avalonia.Input diff --git a/src/Avalonia.Input/InputElement.cs b/src/Avalonia.Input/InputElement.cs index 3aff5d0a8b..5aa0c1fe39 100644 --- a/src/Avalonia.Input/InputElement.cs +++ b/src/Avalonia.Input/InputElement.cs @@ -5,7 +5,6 @@ using System; using System.Collections.Generic; using System.Linq; using Avalonia.Interactivity; -using Avalonia.Rendering; using Avalonia.VisualTree; namespace Avalonia.Input diff --git a/src/Avalonia.Input/InputExtensions.cs b/src/Avalonia.Input/InputExtensions.cs index 01098e754e..a861bae528 100644 --- a/src/Avalonia.Input/InputExtensions.cs +++ b/src/Avalonia.Input/InputExtensions.cs @@ -1,10 +1,10 @@ // Copyright (c) The Avalonia Project. All rights reserved. // Licensed under the MIT license. See licence.md file in the project root for full license information. -using Avalonia.VisualTree; using System; using System.Collections.Generic; using System.Linq; +using Avalonia.VisualTree; namespace Avalonia.Input { @@ -48,4 +48,4 @@ namespace Avalonia.Input element.IsEnabledCore; } } -} \ No newline at end of file +} diff --git a/src/Avalonia.Input/InputManager.cs b/src/Avalonia.Input/InputManager.cs index 9e2d5ffea3..4fbdfd56c0 100644 --- a/src/Avalonia.Input/InputManager.cs +++ b/src/Avalonia.Input/InputManager.cs @@ -8,7 +8,7 @@ using Avalonia.Input.Raw; namespace Avalonia.Input { /// - /// Recieves input from the windowing subsystem and dispatches it to interested parties + /// Receives input from the windowing subsystem and dispatches it to interested parties /// for processing. /// public class InputManager : IInputManager diff --git a/src/Avalonia.Input/Key.cs b/src/Avalonia.Input/Key.cs index c10cbc0a6c..d4f95dbd5c 100644 --- a/src/Avalonia.Input/Key.cs +++ b/src/Avalonia.Input/Key.cs @@ -77,7 +77,7 @@ namespace Avalonia.Input KanaMode = 9, /// - /// The IME Janja mode key. + /// The IME Junja mode key. /// JunjaMode = 10, diff --git a/src/Avalonia.Input/KeyBinding.cs b/src/Avalonia.Input/KeyBinding.cs index 035b6978f4..856157eafa 100644 --- a/src/Avalonia.Input/KeyBinding.cs +++ b/src/Avalonia.Input/KeyBinding.cs @@ -1,8 +1,3 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; using System.Windows.Input; namespace Avalonia.Input diff --git a/src/Avalonia.Input/KeyEventArgs.cs b/src/Avalonia.Input/KeyEventArgs.cs index c44f2b2fca..89053c6f61 100644 --- a/src/Avalonia.Input/KeyEventArgs.cs +++ b/src/Avalonia.Input/KeyEventArgs.cs @@ -1,7 +1,6 @@ // Copyright (c) The Avalonia Project. All rights reserved. // Licensed under the MIT license. See licence.md file in the project root for full license information. -using System; using Avalonia.Interactivity; namespace Avalonia.Input diff --git a/src/Avalonia.Input/KeyGesture.cs b/src/Avalonia.Input/KeyGesture.cs index 954333b80f..bb3b15c64f 100644 --- a/src/Avalonia.Input/KeyGesture.cs +++ b/src/Avalonia.Input/KeyGesture.cs @@ -1,8 +1,6 @@ using System; using System.Collections.Generic; using System.Linq; -using System.Text; -using System.Threading.Tasks; namespace Avalonia.Input { @@ -45,7 +43,7 @@ namespace Avalonia.Input public InputModifiers Modifiers { get; set; } - static readonly Dictionary KeySynonims = new Dictionary + static readonly Dictionary KeySynonyms = new Dictionary { {"+", Key.OemPlus }, {"-", Key.OemMinus}, @@ -56,7 +54,7 @@ namespace Avalonia.Input static Key ParseKey(string key) { Key rv; - if (KeySynonims.TryGetValue(key.ToLower(), out rv)) + if (KeySynonyms.TryGetValue(key.ToLower(), out rv)) return rv; return (Key)Enum.Parse(typeof (Key), key, true); } diff --git a/src/Avalonia.Input/KeyboardDevice.cs b/src/Avalonia.Input/KeyboardDevice.cs index 2a1cdec1c0..00606bd9b1 100644 --- a/src/Avalonia.Input/KeyboardDevice.cs +++ b/src/Avalonia.Input/KeyboardDevice.cs @@ -1,10 +1,7 @@ // Copyright (c) The Avalonia Project. All rights reserved. // Licensed under the MIT license. See licence.md file in the project root for full license information. -using System; using System.ComponentModel; -using System.Linq; -using System.Reactive.Linq; using System.Runtime.CompilerServices; using Avalonia.Input.Raw; using Avalonia.Interactivity; diff --git a/src/Avalonia.Input/KeyboardNavigationHandler.cs b/src/Avalonia.Input/KeyboardNavigationHandler.cs index bc3098a7fb..32faf98603 100644 --- a/src/Avalonia.Input/KeyboardNavigationHandler.cs +++ b/src/Avalonia.Input/KeyboardNavigationHandler.cs @@ -46,7 +46,7 @@ namespace Avalonia.Input /// The navigation direction. /// /// The next element in the specified direction, or null if - /// was the last in therequested direction. + /// was the last in the requested direction. /// public static IInputElement GetNext( IInputElement element, diff --git a/src/Avalonia.Input/MouseDevice.cs b/src/Avalonia.Input/MouseDevice.cs index 7689f55d80..e581772978 100644 --- a/src/Avalonia.Input/MouseDevice.cs +++ b/src/Avalonia.Input/MouseDevice.cs @@ -2,7 +2,6 @@ // Licensed under the MIT license. See licence.md file in the project root for full license information. using System; -using System.Collections.Generic; using System.Linq; using System.Reactive.Linq; using Avalonia.Input.Raw; @@ -27,7 +26,7 @@ namespace Avalonia.Input /// Gets the control that is currently capturing by the mouse, if any. /// /// - /// When an element captures the mouse, it recieves mouse input whether the cursor is + /// When an element captures the mouse, it receives mouse input whether the cursor is /// within the control's bounds or not. To set the mouse capture, call the /// method. /// @@ -66,7 +65,7 @@ namespace Avalonia.Input /// /// The control. /// - /// When an element captures the mouse, it recieves mouse input whether the cursor is + /// When an element captures the mouse, it receives mouse input whether the cursor is /// within the control's bounds or not. The current mouse capture control is exposed /// by the property. /// diff --git a/src/Avalonia.Input/Platform/IClipboard.cs b/src/Avalonia.Input/Platform/IClipboard.cs index 2426af7f5a..4afb69f509 100644 --- a/src/Avalonia.Input/Platform/IClipboard.cs +++ b/src/Avalonia.Input/Platform/IClipboard.cs @@ -1,10 +1,6 @@ // Copyright (c) The Avalonia Project. All rights reserved. // Licensed under the MIT license. See licence.md file in the project root for full license information. -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; using System.Threading.Tasks; namespace Avalonia.Input.Platform diff --git a/src/Avalonia.Input/Platform/IPlatformDragSource.cs b/src/Avalonia.Input/Platform/IPlatformDragSource.cs index 669251c50b..bfe69f3a90 100644 --- a/src/Avalonia.Input/Platform/IPlatformDragSource.cs +++ b/src/Avalonia.Input/Platform/IPlatformDragSource.cs @@ -1,9 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Text; -using System.Threading.Tasks; -using Avalonia.Input; -using Avalonia.Interactivity; +using System.Threading.Tasks; namespace Avalonia.Input.Platform { diff --git a/src/Avalonia.Input/Platform/IStandardCursorFactory.cs b/src/Avalonia.Input/Platform/IStandardCursorFactory.cs index 7510c0681e..393ba6b40a 100644 --- a/src/Avalonia.Input/Platform/IStandardCursorFactory.cs +++ b/src/Avalonia.Input/Platform/IStandardCursorFactory.cs @@ -1,11 +1,6 @@ // Copyright (c) The Avalonia Project. All rights reserved. // Licensed under the MIT license. See licence.md file in the project root for full license information. -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; using Avalonia.Input; namespace Avalonia.Platform diff --git a/src/Avalonia.Input/PointerEventArgs.cs b/src/Avalonia.Input/PointerEventArgs.cs index c4964897dd..7b2497c460 100644 --- a/src/Avalonia.Input/PointerEventArgs.cs +++ b/src/Avalonia.Input/PointerEventArgs.cs @@ -1,7 +1,6 @@ // Copyright (c) The Avalonia Project. All rights reserved. // Licensed under the MIT license. See licence.md file in the project root for full license information. -using System; using Avalonia.Interactivity; using Avalonia.VisualTree; diff --git a/src/Avalonia.Input/Raw/IDragDropDevice.cs b/src/Avalonia.Input/Raw/IDragDropDevice.cs index 6aab1b868d..f7b7914bd1 100644 --- a/src/Avalonia.Input/Raw/IDragDropDevice.cs +++ b/src/Avalonia.Input/Raw/IDragDropDevice.cs @@ -1,8 +1,6 @@ -using Avalonia.Input; - -namespace Avalonia.Input.Raw +namespace Avalonia.Input.Raw { public interface IDragDropDevice : IInputDevice { } -} \ No newline at end of file +} diff --git a/src/Avalonia.Input/Raw/RawDragEvent.cs b/src/Avalonia.Input/Raw/RawDragEvent.cs index 80653b4873..d251fe8640 100644 --- a/src/Avalonia.Input/Raw/RawDragEvent.cs +++ b/src/Avalonia.Input/Raw/RawDragEvent.cs @@ -1,8 +1,4 @@ -using System; -using Avalonia.Input; -using Avalonia.Input.Raw; - -namespace Avalonia.Input.Raw +namespace Avalonia.Input.Raw { public class RawDragEvent : RawInputEventArgs { @@ -25,4 +21,4 @@ namespace Avalonia.Input.Raw Modifiers = modifiers; } } -} \ No newline at end of file +} diff --git a/src/Avalonia.Input/Raw/RawMouseWheelEventArgs.cs b/src/Avalonia.Input/Raw/RawMouseWheelEventArgs.cs index d0ea8e5b93..f4078af9e1 100644 --- a/src/Avalonia.Input/Raw/RawMouseWheelEventArgs.cs +++ b/src/Avalonia.Input/Raw/RawMouseWheelEventArgs.cs @@ -1,8 +1,6 @@ // Copyright (c) The Avalonia Project. All rights reserved. // Licensed under the MIT license. See licence.md file in the project root for full license information. -using System; -using Avalonia.Layout; namespace Avalonia.Input.Raw { diff --git a/src/Avalonia.Input/TextInputEventArgs.cs b/src/Avalonia.Input/TextInputEventArgs.cs index 17df088bdd..b7203b54d5 100644 --- a/src/Avalonia.Input/TextInputEventArgs.cs +++ b/src/Avalonia.Input/TextInputEventArgs.cs @@ -1,11 +1,6 @@ // Copyright (c) The Avalonia Project. All rights reserved. // Licensed under the MIT license. See licence.md file in the project root for full license information. -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; using Avalonia.Interactivity; namespace Avalonia.Input diff --git a/src/Avalonia.Interactivity/IInteractive.cs b/src/Avalonia.Interactivity/IInteractive.cs index dee8396f39..47046b58e2 100644 --- a/src/Avalonia.Interactivity/IInteractive.cs +++ b/src/Avalonia.Interactivity/IInteractive.cs @@ -11,7 +11,7 @@ namespace Avalonia.Interactivity public interface IInteractive { /// - /// Gets the interactive parent of the object for bubbling and tunnelling events. + /// Gets the interactive parent of the object for bubbling and tunneling events. /// IInteractive InteractiveParent { get; } diff --git a/src/Avalonia.Interactivity/Interactive.cs b/src/Avalonia.Interactivity/Interactive.cs index 78df6f6151..911fc2130e 100644 --- a/src/Avalonia.Interactivity/Interactive.cs +++ b/src/Avalonia.Interactivity/Interactive.cs @@ -19,7 +19,7 @@ namespace Avalonia.Interactivity private Dictionary> _eventHandlers; /// - /// Gets the interactive parent of the object for bubbling and tunnelling events. + /// Gets the interactive parent of the object for bubbling and tunneling events. /// IInteractive IInteractive.InteractiveParent => ((IVisual)this).VisualParent as IInteractive; diff --git a/src/Avalonia.Layout/ILayoutManager.cs b/src/Avalonia.Layout/ILayoutManager.cs index b41cfd9f91..a255fb155c 100644 --- a/src/Avalonia.Layout/ILayoutManager.cs +++ b/src/Avalonia.Layout/ILayoutManager.cs @@ -1,8 +1,6 @@ // Copyright (c) The Avalonia Project. All rights reserved. // Licensed under the MIT license. See licence.md file in the project root for full license information. -using System; -using System.Reactive; namespace Avalonia.Layout { diff --git a/src/Avalonia.Layout/LayoutManager.cs b/src/Avalonia.Layout/LayoutManager.cs index 9cf8521008..f3540ea631 100644 --- a/src/Avalonia.Layout/LayoutManager.cs +++ b/src/Avalonia.Layout/LayoutManager.cs @@ -3,7 +3,6 @@ using System; using System.Collections.Generic; -using System.Linq; using Avalonia.Logging; using Avalonia.Threading; @@ -100,7 +99,7 @@ namespace Avalonia.Layout } stopwatch.Stop(); - Logger.Information(LogArea.Layout, this, "Layout pass finised in {Time}", stopwatch.Elapsed); + Logger.Information(LogArea.Layout, this, "Layout pass finished in {Time}", stopwatch.Elapsed); } _queued = false; @@ -150,7 +149,7 @@ namespace Avalonia.Layout // Controls closest to the visual root need to be arranged first. We don't try to store // ordered invalidation lists, instead we traverse the tree upwards, measuring the // controls closest to the root first. This has been shown by benchmarks to be the - // fastest and most memory-efficent algorithm. + // fastest and most memory-efficient algorithm. if (control.VisualParent is ILayoutable parent) { Measure(parent); diff --git a/src/Avalonia.Layout/Layoutable.cs b/src/Avalonia.Layout/Layoutable.cs index 7112e216ff..54bdbb5d48 100644 --- a/src/Avalonia.Layout/Layoutable.cs +++ b/src/Avalonia.Layout/Layoutable.cs @@ -4,7 +4,6 @@ using System; using System.Linq; using Avalonia.Logging; -using Avalonia.Platform; using Avalonia.VisualTree; namespace Avalonia.Layout @@ -654,7 +653,7 @@ namespace Avalonia.Layout } /// - /// Tests whether any of a 's properties incude nagative values, + /// Tests whether any of a 's properties include negative values, /// a NaN or Infinity. /// /// The rect. @@ -669,7 +668,7 @@ namespace Avalonia.Layout } /// - /// Tests whether any of a 's properties incude nagative values, + /// Tests whether any of a 's properties include negative values, /// a NaN or Infinity. /// /// The size. diff --git a/src/Avalonia.Logging.Serilog/SerilogExtensions.cs b/src/Avalonia.Logging.Serilog/SerilogExtensions.cs index 6abc7e4684..7382421dc6 100644 --- a/src/Avalonia.Logging.Serilog/SerilogExtensions.cs +++ b/src/Avalonia.Logging.Serilog/SerilogExtensions.cs @@ -1,5 +1,4 @@ -using System; -using Avalonia.Controls; +using Avalonia.Controls; using Serilog; using SerilogLevel = Serilog.Events.LogEventLevel; diff --git a/src/Avalonia.ReactiveUI/AppBuilderExtensions.cs b/src/Avalonia.ReactiveUI/AppBuilderExtensions.cs index e081763e99..3eab54115a 100644 --- a/src/Avalonia.ReactiveUI/AppBuilderExtensions.cs +++ b/src/Avalonia.ReactiveUI/AppBuilderExtensions.cs @@ -4,9 +4,6 @@ using Avalonia.Controls; using Avalonia.Threading; using ReactiveUI; -using System; -using System.Reactive.Concurrency; -using System.Threading; namespace Avalonia { diff --git a/src/Avalonia.Remote.Protocol/AvaloniaRemoteMessageGuidAttribute.cs b/src/Avalonia.Remote.Protocol/AvaloniaRemoteMessageGuidAttribute.cs index 12ee3178d3..98a843bad1 100644 --- a/src/Avalonia.Remote.Protocol/AvaloniaRemoteMessageGuidAttribute.cs +++ b/src/Avalonia.Remote.Protocol/AvaloniaRemoteMessageGuidAttribute.cs @@ -1,8 +1,4 @@ using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; namespace Avalonia.Remote.Protocol { diff --git a/src/Avalonia.Remote.Protocol/BsonStreamTransport.cs b/src/Avalonia.Remote.Protocol/BsonStreamTransport.cs index 93a3b60599..78712985d9 100644 --- a/src/Avalonia.Remote.Protocol/BsonStreamTransport.cs +++ b/src/Avalonia.Remote.Protocol/BsonStreamTransport.cs @@ -1,5 +1,4 @@ using System; -using System.Collections.Generic; using System.IO; using System.Threading; using System.Threading.Tasks; diff --git a/src/Avalonia.Remote.Protocol/DefaultMessageTypeResolver.cs b/src/Avalonia.Remote.Protocol/DefaultMessageTypeResolver.cs index 9d44f33627..fb909dd58d 100644 --- a/src/Avalonia.Remote.Protocol/DefaultMessageTypeResolver.cs +++ b/src/Avalonia.Remote.Protocol/DefaultMessageTypeResolver.cs @@ -2,8 +2,6 @@ using System.Collections.Generic; using System.Linq; using System.Reflection; -using System.Text; -using System.Threading.Tasks; namespace Avalonia.Remote.Protocol { diff --git a/src/Avalonia.Remote.Protocol/ITransport.cs b/src/Avalonia.Remote.Protocol/ITransport.cs index afc7d86845..0f419b95ae 100644 --- a/src/Avalonia.Remote.Protocol/ITransport.cs +++ b/src/Avalonia.Remote.Protocol/ITransport.cs @@ -1,7 +1,4 @@ using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; using System.Threading.Tasks; namespace Avalonia.Remote.Protocol diff --git a/src/Avalonia.Remote.Protocol/InputMessages.cs b/src/Avalonia.Remote.Protocol/InputMessages.cs index f1996372fc..e612eb3730 100644 --- a/src/Avalonia.Remote.Protocol/InputMessages.cs +++ b/src/Avalonia.Remote.Protocol/InputMessages.cs @@ -1,8 +1,4 @@ using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; /* We are keeping copies of core events here, so they can be used without referencing Avalonia itself, e. g. from projects that diff --git a/src/Avalonia.Remote.Protocol/MetsysBson.cs b/src/Avalonia.Remote.Protocol/MetsysBson.cs index eb6445c3a5..f6bb73129f 100644 --- a/src/Avalonia.Remote.Protocol/MetsysBson.cs +++ b/src/Avalonia.Remote.Protocol/MetsysBson.cs @@ -28,20 +28,19 @@ Code imported from https://github.com/elaberge/Metsys.Bson without any changes */ -using System.Text; -using System.Text.RegularExpressions; -using System.IO; +using System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; -using System.Net; -using System.Security.Cryptography; +using System.IO; using System.Linq; using System.Linq.Expressions; +using System.Net; using System.Reflection; -using System; using System.Runtime.Serialization; - +using System.Security.Cryptography; +using System.Text; +using System.Text.RegularExpressions; using Metsys.Bson.Configuration; // ReSharper disable All @@ -251,7 +250,7 @@ namespace Metsys.Bson _writer.Write((long)((DateTime)value).ToUniversalTime().Subtract(Helper.Epoch).TotalMilliseconds); return; case Types.Binary: - WriteBinnary(value); + WriteBinary(value); return; case Types.ScopedCode: Write((ScopedCode)value); @@ -309,7 +308,7 @@ namespace Metsys.Bson } } - private void WriteBinnary(object value) + private void WriteBinary(object value) { if (value is byte[]) { @@ -833,14 +832,14 @@ namespace Metsys.Bson return enumerableType.IsGenericType ? enumerableType.GetGenericArguments()[0] : typeof(object); } - public static Type GetDictionarKeyType(Type enumerableType) + public static Type GetDictionaryKeyType(Type enumerableType) { return enumerableType.IsGenericType ? enumerableType.GetGenericArguments()[0] : typeof(object); } - public static Type GetDictionarValueType(Type enumerableType) + public static Type GetDictionaryValueType(Type enumerableType) { return enumerableType.IsGenericType ? enumerableType.GetGenericArguments()[1] @@ -1259,9 +1258,9 @@ namespace Metsys.Bson private object ReadDictionary(Type listType, object existingContainer, Options options) { - var valueType = ListHelper.GetDictionarValueType(listType); + var valueType = ListHelper.GetDictionaryValueType(listType); var isObject = typeof(object) == valueType; - var container = existingContainer == null ? ListHelper.CreateDictionary(listType, ListHelper.GetDictionarKeyType(listType), valueType) : (IDictionary)existingContainer; + var container = existingContainer == null ? ListHelper.CreateDictionary(listType, ListHelper.GetDictionaryKeyType(listType), valueType) : (IDictionary)existingContainer; while (!IsDone()) { @@ -1310,7 +1309,7 @@ namespace Metsys.Bson private string ReadString() { var length = _reader.ReadInt32(); - var buffer = _reader.ReadBytes(length - 1); //todo: again, look at fragementation prevention + var buffer = _reader.ReadBytes(length - 1); //todo: again, look at fragmentation prevention _reader.ReadByte(); //null; Read(4 + length); diff --git a/src/Avalonia.Remote.Protocol/ViewportMessages.cs b/src/Avalonia.Remote.Protocol/ViewportMessages.cs index f71e893d26..0627e9d629 100644 --- a/src/Avalonia.Remote.Protocol/ViewportMessages.cs +++ b/src/Avalonia.Remote.Protocol/ViewportMessages.cs @@ -1,10 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace Avalonia.Remote.Protocol.Viewport +namespace Avalonia.Remote.Protocol.Viewport { public enum PixelFormat { diff --git a/src/Avalonia.Styling/Controls/Classes.cs b/src/Avalonia.Styling/Controls/Classes.cs index 85935b030b..3981ec01ad 100644 --- a/src/Avalonia.Styling/Controls/Classes.cs +++ b/src/Avalonia.Styling/Controls/Classes.cs @@ -3,7 +3,6 @@ using System; using System.Collections.Generic; -using System.Linq; using Avalonia.Collections; namespace Avalonia.Controls diff --git a/src/Avalonia.Styling/Controls/INameScope.cs b/src/Avalonia.Styling/Controls/INameScope.cs index e88186e276..e4ff90c573 100644 --- a/src/Avalonia.Styling/Controls/INameScope.cs +++ b/src/Avalonia.Styling/Controls/INameScope.cs @@ -21,7 +21,7 @@ namespace Avalonia.Controls event EventHandler Unregistered; /// - /// Registers an element eith the name scope. + /// Registers an element in the name scope. /// /// The element name. /// The element. diff --git a/src/Avalonia.Styling/Controls/IPseudoClasses.cs b/src/Avalonia.Styling/Controls/IPseudoClasses.cs index 56320a6f6f..6c59078ebc 100644 --- a/src/Avalonia.Styling/Controls/IPseudoClasses.cs +++ b/src/Avalonia.Styling/Controls/IPseudoClasses.cs @@ -1,7 +1,6 @@ // Copyright (c) The Avalonia Project. All rights reserved. // Licensed under the MIT license. See licence.md file in the project root for full license information. -using System; namespace Avalonia.Controls { diff --git a/src/Avalonia.Styling/Controls/IResourceDictionary.cs b/src/Avalonia.Styling/Controls/IResourceDictionary.cs index d7c86b7d74..2a395f44b4 100644 --- a/src/Avalonia.Styling/Controls/IResourceDictionary.cs +++ b/src/Avalonia.Styling/Controls/IResourceDictionary.cs @@ -1,7 +1,6 @@ // Copyright (c) The Avalonia Project. All rights reserved. // Licensed under the MIT license. See licence.md file in the project root for full license information. -using System; using System.Collections.Generic; namespace Avalonia.Controls diff --git a/src/Avalonia.Styling/Controls/ResourceProviderExtensions.cs b/src/Avalonia.Styling/Controls/ResourceProviderExtensions.cs index 1586c61185..52309b87a2 100644 --- a/src/Avalonia.Styling/Controls/ResourceProviderExtensions.cs +++ b/src/Avalonia.Styling/Controls/ResourceProviderExtensions.cs @@ -1,6 +1,4 @@ using System; -using System.Reactive; -using System.Reactive.Linq; using Avalonia.Reactive; namespace Avalonia.Controls diff --git a/src/Avalonia.Styling/IStyledElement.cs b/src/Avalonia.Styling/IStyledElement.cs index 8369717233..bcf1898c4c 100644 --- a/src/Avalonia.Styling/IStyledElement.cs +++ b/src/Avalonia.Styling/IStyledElement.cs @@ -1,6 +1,4 @@ using System; -using System.Collections.Generic; -using System.Text; using Avalonia.Controls; using Avalonia.LogicalTree; using Avalonia.Styling; diff --git a/src/Avalonia.Styling/StyledElement.cs b/src/Avalonia.Styling/StyledElement.cs index bd0d0b8c1f..1964078b56 100644 --- a/src/Avalonia.Styling/StyledElement.cs +++ b/src/Avalonia.Styling/StyledElement.cs @@ -4,7 +4,6 @@ using System.Collections.Specialized; using System.Linq; using System.Reactive.Linq; using System.Reactive.Subjects; -using System.Text; using Avalonia.Animation; using Avalonia.Collections; using Avalonia.Controls; @@ -160,7 +159,7 @@ namespace Avalonia /// /// Even though this property can be set, the setter is only intended for use in object /// initializers. Assigning to this property does not change the underlying collection, - /// it simply clears the existing collection and addds the contents of the assigned + /// it simply clears the existing collection and adds the contents of the assigned /// collection. /// /// @@ -469,7 +468,7 @@ namespace Avalonia if (newRoot == null) { - throw new AvaloniaInternalException("Parent is atttached to logical tree but cannot find root."); + throw new AvaloniaInternalException("Parent is attached to logical tree but cannot find root."); } var e = new LogicalTreeAttachmentEventArgs(newRoot); @@ -749,7 +748,7 @@ namespace Avalonia break; case NotifyCollectionChangedAction.Reset: - throw new NotSupportedException("Reset should not be signalled on LogicalChildren collection"); + throw new NotSupportedException("Reset should not be signaled on LogicalChildren collection"); } } diff --git a/src/Avalonia.Styling/Styling/IRequiresTemplateInSetter.cs b/src/Avalonia.Styling/Styling/IRequiresTemplateInSetter.cs index 1f64326526..2d562b78d9 100644 --- a/src/Avalonia.Styling/Styling/IRequiresTemplateInSetter.cs +++ b/src/Avalonia.Styling/Styling/IRequiresTemplateInSetter.cs @@ -1,8 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Text; - -namespace Avalonia.Styling +namespace Avalonia.Styling { /// /// This is an interface for advanced scenarios to assist users in correct style development. diff --git a/src/Avalonia.Styling/Styling/ISetStyleParent.cs b/src/Avalonia.Styling/Styling/ISetStyleParent.cs index 9f5855b401..bca3d9d714 100644 --- a/src/Avalonia.Styling/Styling/ISetStyleParent.cs +++ b/src/Avalonia.Styling/Styling/ISetStyleParent.cs @@ -1,7 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Text; -using Avalonia.Controls; +using Avalonia.Controls; namespace Avalonia.Styling { diff --git a/src/Avalonia.Styling/Styling/IStyleHost.cs b/src/Avalonia.Styling/Styling/IStyleHost.cs index b225419c2d..fa722aeb41 100644 --- a/src/Avalonia.Styling/Styling/IStyleHost.cs +++ b/src/Avalonia.Styling/Styling/IStyleHost.cs @@ -1,7 +1,6 @@ // Copyright (c) The Avalonia Project. All rights reserved. // Licensed under the MIT license. See licence.md file in the project root for full license information. -using System; namespace Avalonia.Styling { diff --git a/src/Avalonia.Styling/Styling/IStyleable.cs b/src/Avalonia.Styling/Styling/IStyleable.cs index 98c8501681..5ad97d8a61 100644 --- a/src/Avalonia.Styling/Styling/IStyleable.cs +++ b/src/Avalonia.Styling/Styling/IStyleable.cs @@ -3,7 +3,6 @@ using System; using Avalonia.Collections; -using Avalonia.LogicalTree; namespace Avalonia.Styling { @@ -13,7 +12,7 @@ namespace Avalonia.Styling public interface IStyleable : IAvaloniaObject, INamed { /// - /// Signalled when the control's style should be removed. + /// Signaled when the control's style should be removed. /// IObservable StyleDetach { get; } diff --git a/src/Avalonia.Styling/Styling/IStyler.cs b/src/Avalonia.Styling/Styling/IStyler.cs index 0789c3d3cc..97fe1497c8 100644 --- a/src/Avalonia.Styling/Styling/IStyler.cs +++ b/src/Avalonia.Styling/Styling/IStyler.cs @@ -1,7 +1,6 @@ // Copyright (c) The Avalonia Project. All rights reserved. // Licensed under the MIT license. See licence.md file in the project root for full license information. -using System; namespace Avalonia.Styling { diff --git a/src/Avalonia.Styling/Styling/ITemplatedControl.cs b/src/Avalonia.Styling/Styling/ITemplatedControl.cs index 3bf981b69b..4e1a51e18a 100644 --- a/src/Avalonia.Styling/Styling/ITemplatedControl.cs +++ b/src/Avalonia.Styling/Styling/ITemplatedControl.cs @@ -1,7 +1,6 @@ // Copyright (c) The Avalonia Project. All rights reserved. // Licensed under the MIT license. See licence.md file in the project root for full license information. -using System; namespace Avalonia.Styling { diff --git a/src/Avalonia.Styling/Styling/PropertyEqualsSelector.cs b/src/Avalonia.Styling/Styling/PropertyEqualsSelector.cs index 57d5ad9271..25f12ffa57 100644 --- a/src/Avalonia.Styling/Styling/PropertyEqualsSelector.cs +++ b/src/Avalonia.Styling/Styling/PropertyEqualsSelector.cs @@ -60,7 +60,7 @@ namespace Avalonia.Styling builder.Append(_property.Name); builder.Append('='); - builder.Append(_value); + builder.Append(_value ?? string.Empty); builder.Append(']'); _selectorString = builder.ToString(); @@ -78,11 +78,11 @@ namespace Avalonia.Styling } else if (subscribe) { - return new SelectorMatch(control.GetObservable(_property).Select(v => Equals(v, _value))); + return new SelectorMatch(control.GetObservable(_property).Select(v => Equals(v ?? string.Empty, _value))); } else { - return new SelectorMatch(control.GetValue(_property).Equals(_value)); + return new SelectorMatch((control.GetValue(_property) ?? string.Empty).Equals(_value)); } } diff --git a/src/Avalonia.Styling/Styling/SelectorMatch.cs b/src/Avalonia.Styling/Styling/SelectorMatch.cs index f73c1497ce..f325578389 100644 --- a/src/Avalonia.Styling/Styling/SelectorMatch.cs +++ b/src/Avalonia.Styling/Styling/SelectorMatch.cs @@ -41,7 +41,7 @@ namespace Avalonia.Styling } /// - /// Gets the immedate result of the selector match, in the case of selectors that cannot + /// Gets the immediate result of the selector match, in the case of selectors that cannot /// change over time. /// public bool? ImmediateResult { get; } diff --git a/src/Avalonia.Styling/Styling/Setter.cs b/src/Avalonia.Styling/Styling/Setter.cs index c75bae4db8..54d0a7d40f 100644 --- a/src/Avalonia.Styling/Styling/Setter.cs +++ b/src/Avalonia.Styling/Styling/Setter.cs @@ -3,7 +3,6 @@ using System; using System.Reactive.Disposables; -using System.Reactive.Subjects; using System.Reflection; using Avalonia.Animation; using Avalonia.Controls; diff --git a/src/Avalonia.Styling/Styling/Style.cs b/src/Avalonia.Styling/Styling/Style.cs index 203f679683..399be5470d 100644 --- a/src/Avalonia.Styling/Styling/Style.cs +++ b/src/Avalonia.Styling/Styling/Style.cs @@ -3,12 +3,10 @@ using System; using System.Collections.Generic; -using System.Collections.Specialized; using System.Reactive.Linq; +using Avalonia.Animation; using Avalonia.Controls; using Avalonia.Metadata; -using Avalonia.Animation; -using System.Diagnostics; namespace Avalonia.Styling { @@ -200,7 +198,7 @@ namespace Avalonia.Styling } /// - /// Called when a control's is signalled to remove + /// Called when a control's is signaled to remove /// all applied styles. /// /// The control. diff --git a/src/Avalonia.Themes.Default/Accents/BaseLight.xaml b/src/Avalonia.Themes.Default/Accents/BaseLight.xaml index 4c85e172ff..46767feca0 100644 --- a/src/Avalonia.Themes.Default/Accents/BaseLight.xaml +++ b/src/Avalonia.Themes.Default/Accents/BaseLight.xaml @@ -1,30 +1,56 @@ \ No newline at end of file + #FF086F9E + #FFFF0000 + #10FF0000 + + + + + + + + + + + + + + + + + + + + + + + 2 + 0.5 + + 10 + 12 + 16 + + diff --git a/src/Avalonia.Themes.Default/AutoCompleteBox.xaml b/src/Avalonia.Themes.Default/AutoCompleteBox.xaml index 6a9af487cb..11d8a344d9 100644 --- a/src/Avalonia.Themes.Default/AutoCompleteBox.xaml +++ b/src/Avalonia.Themes.Default/AutoCompleteBox.xaml @@ -36,8 +36,4 @@ - - - \ No newline at end of file + diff --git a/src/Avalonia.Themes.Default/CalendarButton.xaml b/src/Avalonia.Themes.Default/CalendarButton.xaml index 84969c135f..b70740e0c8 100644 --- a/src/Avalonia.Themes.Default/CalendarButton.xaml +++ b/src/Avalonia.Themes.Default/CalendarButton.xaml @@ -7,6 +7,7 @@ - \ No newline at end of file + diff --git a/src/Avalonia.Themes.Default/CalendarDayButton.xaml b/src/Avalonia.Themes.Default/CalendarDayButton.xaml index ee7afdc73b..4a971ef0cb 100644 --- a/src/Avalonia.Themes.Default/CalendarDayButton.xaml +++ b/src/Avalonia.Themes.Default/CalendarDayButton.xaml @@ -42,7 +42,7 @@ HorizontalAlignment="Stretch" VerticalAlignment="Stretch" RenderTransformOrigin="0.5,0.5" - Fill="#FF000000" + Fill="{DynamicResource ThemeForegroundBrush}" Stretch="Fill" Data="M8.1772461,11.029181 L10.433105,11.029181 L11.700684,12.801641 L12.973633,11.029181 L15.191895,11.029181 L12.844727,13.999395 L15.21875,17.060919 L12.962891,17.060919 L11.673828,15.256231 L10.352539,17.060919 L8.1396484,17.060919 L10.519043,14.042364 z" /> @@ -103,7 +103,7 @@ - \ No newline at end of file + diff --git a/src/Avalonia.Themes.Default/CalendarItem.xaml b/src/Avalonia.Themes.Default/CalendarItem.xaml index 3d3d75a39a..b52b7acf53 100644 --- a/src/Avalonia.Themes.Default/CalendarItem.xaml +++ b/src/Avalonia.Themes.Default/CalendarItem.xaml @@ -153,7 +153,7 @@ @@ -180,4 +180,4 @@ - \ No newline at end of file + diff --git a/src/Avalonia.Themes.Default/CheckBox.xaml b/src/Avalonia.Themes.Default/CheckBox.xaml index 62a05a3525..3d14dd8e51 100644 --- a/src/Avalonia.Themes.Default/CheckBox.xaml +++ b/src/Avalonia.Themes.Default/CheckBox.xaml @@ -40,6 +40,9 @@ + @@ -58,4 +61,4 @@ - \ No newline at end of file + diff --git a/src/Avalonia.Themes.Default/DataValidationErrors.xaml b/src/Avalonia.Themes.Default/DataValidationErrors.xaml index f7f28d90d0..16c2d6adef 100644 --- a/src/Avalonia.Themes.Default/DataValidationErrors.xaml +++ b/src/Avalonia.Themes.Default/DataValidationErrors.xaml @@ -21,10 +21,10 @@ + Background="Transparent"> @@ -35,4 +35,4 @@ - \ No newline at end of file + diff --git a/src/Avalonia.Themes.Default/DatePicker.xaml b/src/Avalonia.Themes.Default/DatePicker.xaml index b706b5b4e5..93bafdb56f 100644 --- a/src/Avalonia.Themes.Default/DatePicker.xaml +++ b/src/Avalonia.Themes.Default/DatePicker.xaml @@ -6,7 +6,8 @@ --> + xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" + xmlns:sys="clr-namespace:System;assembly=mscorlib"> - \ No newline at end of file + diff --git a/src/Avalonia.Themes.Default/DropDownItem.xaml b/src/Avalonia.Themes.Default/DropDownItem.xaml index 257030d8af..f52608c0a8 100644 --- a/src/Avalonia.Themes.Default/DropDownItem.xaml +++ b/src/Avalonia.Themes.Default/DropDownItem.xaml @@ -18,10 +18,24 @@ + + + - + + + + - \ No newline at end of file + diff --git a/src/Avalonia.Themes.Default/Expander.xaml b/src/Avalonia.Themes.Default/Expander.xaml index 0bea0c9763..d12f704cc4 100644 --- a/src/Avalonia.Themes.Default/Expander.xaml +++ b/src/Avalonia.Themes.Default/Expander.xaml @@ -108,7 +108,7 @@ - \ No newline at end of file + diff --git a/src/Avalonia.Themes.Default/ListBoxItem.xaml b/src/Avalonia.Themes.Default/ListBoxItem.xaml index fc2600c1a9..19a6e3d4ec 100644 --- a/src/Avalonia.Themes.Default/ListBoxItem.xaml +++ b/src/Avalonia.Themes.Default/ListBoxItem.xaml @@ -1,6 +1,9 @@ + + + + + + + + - \ No newline at end of file + diff --git a/src/Avalonia.Themes.Default/ScrollBar.xaml b/src/Avalonia.Themes.Default/ScrollBar.xaml index b24c863be9..ef57474eaf 100644 --- a/src/Avalonia.Themes.Default/ScrollBar.xaml +++ b/src/Avalonia.Themes.Default/ScrollBar.xaml @@ -10,7 +10,7 @@ Grid.Column="0"> + Fill="{DynamicResource ThemeForegroundLightBrush}" /> + Fill="{DynamicResource ThemeForegroundLightBrush}" /> @@ -61,7 +61,7 @@ Grid.Column="0"> + Fill="{DynamicResource ThemeForegroundLightBrush}" /> + Fill="{DynamicResource ThemeForegroundLightBrush}" /> @@ -124,4 +124,4 @@ - \ No newline at end of file + diff --git a/src/Avalonia.Themes.Default/Slider.xaml b/src/Avalonia.Themes.Default/Slider.xaml index 58fd67b2f6..95924b31a1 100644 --- a/src/Avalonia.Themes.Default/Slider.xaml +++ b/src/Avalonia.Themes.Default/Slider.xaml @@ -80,10 +80,11 @@ - \ No newline at end of file + diff --git a/src/Avalonia.Themes.Default/TreeView.xaml b/src/Avalonia.Themes.Default/TreeView.xaml index 42c0b2cdd9..4e38c6db3a 100644 --- a/src/Avalonia.Themes.Default/TreeView.xaml +++ b/src/Avalonia.Themes.Default/TreeView.xaml @@ -3,11 +3,15 @@ + + - + - \ No newline at end of file + diff --git a/src/Avalonia.Themes.Default/TreeViewItem.xaml b/src/Avalonia.Themes.Default/TreeViewItem.xaml index 95347044bc..b5e0e7a005 100644 --- a/src/Avalonia.Themes.Default/TreeViewItem.xaml +++ b/src/Avalonia.Themes.Default/TreeViewItem.xaml @@ -1,69 +1,92 @@ - - + + - + - - - - - - - + - - \ No newline at end of file + + + + + + + + + + + + + + diff --git a/src/Avalonia.Visuals/Animation/CrossFade.cs b/src/Avalonia.Visuals/Animation/CrossFade.cs index 2230f8534b..3795d66d05 100644 --- a/src/Avalonia.Visuals/Animation/CrossFade.cs +++ b/src/Avalonia.Visuals/Animation/CrossFade.cs @@ -3,7 +3,6 @@ using System; using System.Collections.Generic; -using System.Reactive.Threading.Tasks; using System.Threading.Tasks; using Avalonia.Styling; using Avalonia.VisualTree; diff --git a/src/Avalonia.Visuals/Animation/IPageTransition.cs b/src/Avalonia.Visuals/Animation/IPageTransition.cs index 88912c1931..4f598fa08e 100644 --- a/src/Avalonia.Visuals/Animation/IPageTransition.cs +++ b/src/Avalonia.Visuals/Animation/IPageTransition.cs @@ -2,7 +2,6 @@ // Licensed under the MIT license. See licence.md file in the project root for full license information. using System.Threading.Tasks; -using Avalonia.VisualTree; namespace Avalonia.Animation { diff --git a/src/Avalonia.Visuals/Animation/PageSlide.cs b/src/Avalonia.Visuals/Animation/PageSlide.cs index 5f03dc6b0c..dc2c64f1c7 100644 --- a/src/Avalonia.Visuals/Animation/PageSlide.cs +++ b/src/Avalonia.Visuals/Animation/PageSlide.cs @@ -3,7 +3,6 @@ using System; using System.Collections.Generic; -using System.Reactive.Threading.Tasks; using System.Threading.Tasks; using Avalonia.Media; using Avalonia.Styling; diff --git a/src/Avalonia.Visuals/Animation/PointTransition.cs b/src/Avalonia.Visuals/Animation/PointTransition.cs index 4412852781..a883c517dd 100644 --- a/src/Avalonia.Visuals/Animation/PointTransition.cs +++ b/src/Avalonia.Visuals/Animation/PointTransition.cs @@ -1,7 +1,6 @@ // Copyright (c) The Avalonia Project. All rights reserved. // Licensed under the MIT license. See licence.md file in the project root for full license information. -using Avalonia.Metadata; using System; using System.Reactive.Linq; diff --git a/src/Avalonia.Visuals/Animation/ThicknessTransition.cs b/src/Avalonia.Visuals/Animation/ThicknessTransition.cs index 22876dd8e2..6c2ca22b74 100644 --- a/src/Avalonia.Visuals/Animation/ThicknessTransition.cs +++ b/src/Avalonia.Visuals/Animation/ThicknessTransition.cs @@ -1,7 +1,6 @@ // Copyright (c) The Avalonia Project. All rights reserved. // Licensed under the MIT license. See licence.md file in the project root for full license information. -using Avalonia.Metadata; using System; using System.Reactive.Linq; diff --git a/src/Avalonia.Visuals/Animation/TransformAnimator.cs b/src/Avalonia.Visuals/Animation/TransformAnimator.cs index 61cac695b1..2be1226abe 100644 --- a/src/Avalonia.Visuals/Animation/TransformAnimator.cs +++ b/src/Avalonia.Visuals/Animation/TransformAnimator.cs @@ -1,13 +1,6 @@ using System; -using System.Collections.Generic; -using System.Text; -using Avalonia.Collections; -using System.ComponentModel; -using Avalonia.Animation.Utils; -using System.Reactive.Linq; -using System.Linq; -using Avalonia.Media; using Avalonia.Logging; +using Avalonia.Media; namespace Avalonia.Animation { diff --git a/src/Avalonia.Visuals/CornerRadius.cs b/src/Avalonia.Visuals/CornerRadius.cs index 33a553d477..2d41acb5bc 100644 --- a/src/Avalonia.Visuals/CornerRadius.cs +++ b/src/Avalonia.Visuals/CornerRadius.cs @@ -3,7 +3,6 @@ using System; using System.Globalization; -using System.Linq; using Avalonia.Utilities; namespace Avalonia @@ -90,4 +89,4 @@ namespace Avalonia return !(cr1 == cr2); } } -} \ No newline at end of file +} diff --git a/src/Avalonia.Visuals/Matrix.cs b/src/Avalonia.Visuals/Matrix.cs index 9ed5923109..287ad1b3a2 100644 --- a/src/Avalonia.Visuals/Matrix.cs +++ b/src/Avalonia.Visuals/Matrix.cs @@ -1,10 +1,9 @@ // Copyright (c) The Avalonia Project. All rights reserved. // Licensed under the MIT license. See licence.md file in the project root for full license information. -using Avalonia.Utilities; using System; using System.Globalization; -using System.Linq; +using Avalonia.Utilities; namespace Avalonia { @@ -56,7 +55,7 @@ namespace Avalonia public bool IsIdentity => Equals(Identity); /// - /// HasInverse Property - returns true if this matrix is invertable, false otherwise. + /// HasInverse Property - returns true if this matrix is invertible, false otherwise. /// public bool HasInverse => GetDeterminant() != 0; @@ -207,7 +206,7 @@ namespace Avalonia } /// - /// Converts an ange in degrees to radians. + /// Converts an angle in degrees to radians. /// /// The angle in degrees. /// The angle in radians. @@ -330,4 +329,4 @@ namespace Avalonia } } } -} \ No newline at end of file +} diff --git a/src/Avalonia.Visuals/Media/BrushMappingMode.cs b/src/Avalonia.Visuals/Media/BrushMappingMode.cs index 15fb9700ca..eb64a063a1 100644 --- a/src/Avalonia.Visuals/Media/BrushMappingMode.cs +++ b/src/Avalonia.Visuals/Media/BrushMappingMode.cs @@ -1,11 +1,6 @@ // Copyright (c) The Avalonia Project. All rights reserved. // Licensed under the MIT license. See licence.md file in the project root for full license information. -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; namespace Avalonia.Media { @@ -14,4 +9,4 @@ namespace Avalonia.Media Absolute, RelativeToBoundingBox } -} \ No newline at end of file +} diff --git a/src/Avalonia.Visuals/Media/Color.cs b/src/Avalonia.Visuals/Media/Color.cs index 1ee5da1324..8294934751 100644 --- a/src/Avalonia.Visuals/Media/Color.cs +++ b/src/Avalonia.Visuals/Media/Color.cs @@ -3,8 +3,6 @@ using System; using System.Globalization; -using System.Linq; -using System.Reflection; namespace Avalonia.Media { @@ -140,4 +138,4 @@ namespace Avalonia.Media return ((uint)A << 24) | ((uint)R << 16) | ((uint)G << 8) | (uint)B; } } -} \ No newline at end of file +} diff --git a/src/Avalonia.Visuals/Media/Colors.cs b/src/Avalonia.Visuals/Media/Colors.cs index 1067cf66aa..ca4a0793cb 100644 --- a/src/Avalonia.Visuals/Media/Colors.cs +++ b/src/Avalonia.Visuals/Media/Colors.cs @@ -1,7 +1,6 @@ // Copyright (c) The Avalonia Project. All rights reserved. // Licensed under the MIT license. See licence.md file in the project root for full license information. -using System.Linq; namespace Avalonia.Media { @@ -715,4 +714,4 @@ namespace Avalonia.Media /// public static Color YellowGreen => KnownColor.YellowGreen.ToColor(); } -} \ No newline at end of file +} diff --git a/src/Avalonia.Visuals/Media/DashStyle.cs b/src/Avalonia.Visuals/Media/DashStyle.cs index 3fcfcaee70..c7e1db57b2 100644 --- a/src/Avalonia.Visuals/Media/DashStyle.cs +++ b/src/Avalonia.Visuals/Media/DashStyle.cs @@ -1,11 +1,7 @@ namespace Avalonia.Media { - using Avalonia.Animation; - using System; using System.Collections.Generic; - using System.Linq; - using System.Text; - using System.Threading.Tasks; + using Avalonia.Animation; public class DashStyle : Animatable { diff --git a/src/Avalonia.Visuals/Media/DrawingContext.cs b/src/Avalonia.Visuals/Media/DrawingContext.cs index 60a7a2e518..6b19167381 100644 --- a/src/Avalonia.Visuals/Media/DrawingContext.cs +++ b/src/Avalonia.Visuals/Media/DrawingContext.cs @@ -5,7 +5,7 @@ using Avalonia.Platform; using Avalonia.Visuals.Media.Imaging; namespace Avalonia.Media -{ +{ public sealed class DrawingContext : IDisposable { private int _currentLevel; @@ -205,7 +205,7 @@ namespace Avalonia.Media /// - /// Pushes a clip rectange. + /// Pushes a clip rectangle. /// /// The clip rectangle. /// A disposable used to undo the clip rectangle. diff --git a/src/Avalonia.Visuals/Media/Fonts/FontFamilyLoader.cs b/src/Avalonia.Visuals/Media/Fonts/FontFamilyLoader.cs index 2b77371bb5..57e6c756cc 100644 --- a/src/Avalonia.Visuals/Media/Fonts/FontFamilyLoader.cs +++ b/src/Avalonia.Visuals/Media/Fonts/FontFamilyLoader.cs @@ -26,7 +26,7 @@ namespace Avalonia.Media.Fonts } /// - /// Searches for font assets at a given location and returns a quanity of found assets + /// Searches for font assets at a given location and returns a quantity of found assets /// /// /// @@ -69,4 +69,4 @@ namespace Avalonia.Media.Fonts return new Uri("resm:" + absolutePath + "?assembly=" + assembly.GetName().Name, UriKind.RelativeOrAbsolute); } } -} \ No newline at end of file +} diff --git a/src/Avalonia.Visuals/Media/FormattedText.cs b/src/Avalonia.Visuals/Media/FormattedText.cs index 9a052f4eb9..0d456eb3b7 100644 --- a/src/Avalonia.Visuals/Media/FormattedText.cs +++ b/src/Avalonia.Visuals/Media/FormattedText.cs @@ -1,7 +1,6 @@ // Copyright (c) The Avalonia Project. All rights reserved. // Licensed under the MIT license. See licence.md file in the project root for full license information. -using System; using System.Collections.Generic; using Avalonia.Platform; @@ -76,7 +75,7 @@ namespace Avalonia.Media } /// - /// Gets or sets the aligment of the text. + /// Gets or sets the alignment of the text. /// public TextAlignment TextAlignment { diff --git a/src/Avalonia.Visuals/Media/FormattedTextStyleSpan.cs b/src/Avalonia.Visuals/Media/FormattedTextStyleSpan.cs index 96a5c05c74..92fdd651c3 100644 --- a/src/Avalonia.Visuals/Media/FormattedTextStyleSpan.cs +++ b/src/Avalonia.Visuals/Media/FormattedTextStyleSpan.cs @@ -1,6 +1,4 @@ -using System; - -namespace Avalonia.Media +namespace Avalonia.Media { /// /// Describes the formatting for a span of text in a object. diff --git a/src/Avalonia.Visuals/Media/GradientBrush.cs b/src/Avalonia.Visuals/Media/GradientBrush.cs index fb29f68373..41c3afc8c3 100644 --- a/src/Avalonia.Visuals/Media/GradientBrush.cs +++ b/src/Avalonia.Visuals/Media/GradientBrush.cs @@ -1,7 +1,6 @@ // Copyright (c) The Avalonia Project. All rights reserved. // Licensed under the MIT license. See licence.md file in the project root for full license information. -using System; using System.Collections.Generic; using Avalonia.Metadata; @@ -52,4 +51,4 @@ namespace Avalonia.Media set { SetValue(GradientStopsProperty, value); } } } -} \ No newline at end of file +} diff --git a/src/Avalonia.Visuals/Media/GradientSpreadMethod.cs b/src/Avalonia.Visuals/Media/GradientSpreadMethod.cs index 4020a6afbd..f9506d78a0 100644 --- a/src/Avalonia.Visuals/Media/GradientSpreadMethod.cs +++ b/src/Avalonia.Visuals/Media/GradientSpreadMethod.cs @@ -1,12 +1,6 @@ // Copyright (c) The Avalonia Project. All rights reserved. // Licensed under the MIT license. See licence.md file in the project root for full license information. -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - namespace Avalonia.Media { public enum GradientSpreadMethod @@ -15,4 +9,4 @@ namespace Avalonia.Media Reflect, Repeat } -} \ No newline at end of file +} diff --git a/src/Avalonia.Visuals/Media/IMutableBrush.cs b/src/Avalonia.Visuals/Media/IMutableBrush.cs index f9cd97077c..39dd8b80c4 100644 --- a/src/Avalonia.Visuals/Media/IMutableBrush.cs +++ b/src/Avalonia.Visuals/Media/IMutableBrush.cs @@ -1,6 +1,4 @@ -using System; - -namespace Avalonia.Media +namespace Avalonia.Media { /// /// Represents a mutable brush which can return an immutable clone of itself. diff --git a/src/Avalonia.Visuals/Media/Imaging/RenderTargetBitmap.cs b/src/Avalonia.Visuals/Media/Imaging/RenderTargetBitmap.cs index 52bd8a3c04..db2259dde3 100644 --- a/src/Avalonia.Visuals/Media/Imaging/RenderTargetBitmap.cs +++ b/src/Avalonia.Visuals/Media/Imaging/RenderTargetBitmap.cs @@ -2,7 +2,6 @@ // Licensed under the MIT license. See licence.md file in the project root for full license information. using System; -using System.Runtime.CompilerServices; using Avalonia.Platform; using Avalonia.Rendering; using Avalonia.Utilities; @@ -44,7 +43,7 @@ namespace Avalonia.Media.Imaging public void Render(IVisual visual) => ImmediateRenderer.Render(visual, this); /// - /// Creates a platform-specific imlementation for a . + /// Creates a platform-specific implementation for a . /// /// The width of the bitmap. /// The height of the bitmap. diff --git a/src/Avalonia.Visuals/Media/Imaging/WriteableBitmap.cs b/src/Avalonia.Visuals/Media/Imaging/WriteableBitmap.cs index af6fde6876..529c2efa42 100644 --- a/src/Avalonia.Visuals/Media/Imaging/WriteableBitmap.cs +++ b/src/Avalonia.Visuals/Media/Imaging/WriteableBitmap.cs @@ -1,10 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using Avalonia.Platform; -using Avalonia.Utilities; +using Avalonia.Platform; namespace Avalonia.Media.Imaging { diff --git a/src/Avalonia.Visuals/Media/Immutable/ImmutableGradientBrush.cs b/src/Avalonia.Visuals/Media/Immutable/ImmutableGradientBrush.cs index ca67789c7f..6664a2b30e 100644 --- a/src/Avalonia.Visuals/Media/Immutable/ImmutableGradientBrush.cs +++ b/src/Avalonia.Visuals/Media/Immutable/ImmutableGradientBrush.cs @@ -1,5 +1,4 @@ -using System; -using System.Collections.Generic; +using System.Collections.Generic; using System.Linq; namespace Avalonia.Media.Immutable diff --git a/src/Avalonia.Visuals/Media/Immutable/ImmutableLinearGradientBrush.cs b/src/Avalonia.Visuals/Media/Immutable/ImmutableLinearGradientBrush.cs index 39ddc305fb..142eb34625 100644 --- a/src/Avalonia.Visuals/Media/Immutable/ImmutableLinearGradientBrush.cs +++ b/src/Avalonia.Visuals/Media/Immutable/ImmutableLinearGradientBrush.cs @@ -1,8 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; +using System.Collections.Generic; namespace Avalonia.Media.Immutable { diff --git a/src/Avalonia.Visuals/Media/Immutable/ImmutableRadialGradientBrush.cs b/src/Avalonia.Visuals/Media/Immutable/ImmutableRadialGradientBrush.cs index 672a45ebc4..f36a1cd2de 100644 --- a/src/Avalonia.Visuals/Media/Immutable/ImmutableRadialGradientBrush.cs +++ b/src/Avalonia.Visuals/Media/Immutable/ImmutableRadialGradientBrush.cs @@ -1,5 +1,4 @@ -using System; -using System.Collections.Generic; +using System.Collections.Generic; namespace Avalonia.Media.Immutable { diff --git a/src/Avalonia.Visuals/Media/LinearGradientBrush.cs b/src/Avalonia.Visuals/Media/LinearGradientBrush.cs index 344e05e16e..d092bebf0f 100644 --- a/src/Avalonia.Visuals/Media/LinearGradientBrush.cs +++ b/src/Avalonia.Visuals/Media/LinearGradientBrush.cs @@ -1,8 +1,6 @@ // Copyright (c) The Avalonia Project. All rights reserved. // Licensed under the MIT license. See licence.md file in the project root for full license information. -using System; - namespace Avalonia.Media { /// @@ -50,4 +48,4 @@ namespace Avalonia.Media return new Immutable.ImmutableLinearGradientBrush(this); } } -} \ No newline at end of file +} diff --git a/src/Avalonia.Visuals/Media/PathGeometry.cs b/src/Avalonia.Visuals/Media/PathGeometry.cs index e7a2c8577a..3a91c924d2 100644 --- a/src/Avalonia.Visuals/Media/PathGeometry.cs +++ b/src/Avalonia.Visuals/Media/PathGeometry.cs @@ -113,4 +113,4 @@ namespace Avalonia.Media _figuresPropertiesObserver = figures?.TrackItemPropertyChanged(_ => InvalidateGeometry()); } } -} \ No newline at end of file +} diff --git a/src/Avalonia.Visuals/Media/PenLineCap.cs b/src/Avalonia.Visuals/Media/PenLineCap.cs index 66b43f1b32..56c5c040eb 100644 --- a/src/Avalonia.Visuals/Media/PenLineCap.cs +++ b/src/Avalonia.Visuals/Media/PenLineCap.cs @@ -1,9 +1,3 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - namespace Avalonia.Media { public enum PenLineCap diff --git a/src/Avalonia.Visuals/Media/PenLineJoin.cs b/src/Avalonia.Visuals/Media/PenLineJoin.cs index 2ea098383b..7395ea284a 100644 --- a/src/Avalonia.Visuals/Media/PenLineJoin.cs +++ b/src/Avalonia.Visuals/Media/PenLineJoin.cs @@ -1,9 +1,3 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - namespace Avalonia.Media { public enum PenLineJoin diff --git a/src/Avalonia.Visuals/Media/PolylineGeometry.cs b/src/Avalonia.Visuals/Media/PolylineGeometry.cs index 06dbcccf3e..5ed16ca957 100644 --- a/src/Avalonia.Visuals/Media/PolylineGeometry.cs +++ b/src/Avalonia.Visuals/Media/PolylineGeometry.cs @@ -3,9 +3,9 @@ using System; using System.Collections.Generic; -using Avalonia.Platform; -using Avalonia.Metadata; using Avalonia.Collections; +using Avalonia.Metadata; +using Avalonia.Platform; namespace Avalonia.Media { diff --git a/src/Avalonia.Visuals/Media/RotateTransform.cs b/src/Avalonia.Visuals/Media/RotateTransform.cs index 4fe615a6df..c3babcfbab 100644 --- a/src/Avalonia.Visuals/Media/RotateTransform.cs +++ b/src/Avalonia.Visuals/Media/RotateTransform.cs @@ -45,7 +45,7 @@ namespace Avalonia.Media } /// - /// Gets the tranform's . + /// Gets the transform's . /// public override Matrix Value => Matrix.CreateRotation(Matrix.ToRadians(Angle)); } diff --git a/src/Avalonia.Visuals/Media/ScaleTransform.cs b/src/Avalonia.Visuals/Media/ScaleTransform.cs index dc7d38fde0..fd301802e0 100644 --- a/src/Avalonia.Visuals/Media/ScaleTransform.cs +++ b/src/Avalonia.Visuals/Media/ScaleTransform.cs @@ -63,8 +63,8 @@ namespace Avalonia.Media } /// - /// Gets the tranform's . + /// Gets the transform's . /// public override Matrix Value => Matrix.CreateScale(ScaleX, ScaleY); } -} \ No newline at end of file +} diff --git a/src/Avalonia.Visuals/Media/SkewTransform.cs b/src/Avalonia.Visuals/Media/SkewTransform.cs index 880b73750b..405e3947e8 100644 --- a/src/Avalonia.Visuals/Media/SkewTransform.cs +++ b/src/Avalonia.Visuals/Media/SkewTransform.cs @@ -62,8 +62,8 @@ namespace Avalonia.Media } /// - /// Gets the tranform's . + /// Gets the transform's . /// public override Matrix Value => Matrix.CreateSkew(Matrix.ToRadians(AngleX), Matrix.ToRadians(AngleY)); } -} \ No newline at end of file +} diff --git a/src/Avalonia.Visuals/Media/SolidColorBrush.cs b/src/Avalonia.Visuals/Media/SolidColorBrush.cs index d090f63069..d84e407cb4 100644 --- a/src/Avalonia.Visuals/Media/SolidColorBrush.cs +++ b/src/Avalonia.Visuals/Media/SolidColorBrush.cs @@ -1,8 +1,6 @@ // Copyright (c) The Avalonia Project. All rights reserved. // Licensed under the MIT license. See licence.md file in the project root for full license information. -using System; - namespace Avalonia.Media { /// diff --git a/src/Avalonia.Visuals/Media/StreamGeometryContext.cs b/src/Avalonia.Visuals/Media/StreamGeometryContext.cs index 7521582067..9df67c226e 100644 --- a/src/Avalonia.Visuals/Media/StreamGeometryContext.cs +++ b/src/Avalonia.Visuals/Media/StreamGeometryContext.cs @@ -1,7 +1,6 @@ // Copyright (c) The Avalonia Project. All rights reserved. // Licensed under the MIT license. See licence.md file in the project root for full license information. -using System; using Avalonia.Platform; namespace Avalonia.Media diff --git a/src/Avalonia.Visuals/Media/Transform.cs b/src/Avalonia.Visuals/Media/Transform.cs index c17810fc4a..677514763c 100644 --- a/src/Avalonia.Visuals/Media/Transform.cs +++ b/src/Avalonia.Visuals/Media/Transform.cs @@ -23,7 +23,7 @@ namespace Avalonia.Media public event EventHandler Changed; /// - /// Gets the tranform's . + /// Gets the transform's . /// public abstract Matrix Value { get; } diff --git a/src/Avalonia.Visuals/Media/TransformGroup.cs b/src/Avalonia.Visuals/Media/TransformGroup.cs index dd9a3f9abf..3a47f40045 100644 --- a/src/Avalonia.Visuals/Media/TransformGroup.cs +++ b/src/Avalonia.Visuals/Media/TransformGroup.cs @@ -3,7 +3,6 @@ using Avalonia.Collections; using Avalonia.Metadata; -using System.Collections.Specialized; namespace Avalonia.Media { @@ -47,7 +46,7 @@ namespace Avalonia.Media } /// - /// Gets the tranform's . + /// Gets the transform's . /// public override Matrix Value { @@ -68,4 +67,4 @@ namespace Avalonia.Media public sealed class Transforms : AvaloniaList { } -} \ No newline at end of file +} diff --git a/src/Avalonia.Visuals/Media/TranslateTransform.cs b/src/Avalonia.Visuals/Media/TranslateTransform.cs index b66ca7939c..6ffbdb9623 100644 --- a/src/Avalonia.Visuals/Media/TranslateTransform.cs +++ b/src/Avalonia.Visuals/Media/TranslateTransform.cs @@ -63,7 +63,7 @@ namespace Avalonia.Media } /// - /// Gets the tranform's . + /// Gets the transform's . /// public override Matrix Value => Matrix.CreateTranslation(X, Y); } diff --git a/src/Avalonia.Visuals/Media/Typeface.cs b/src/Avalonia.Visuals/Media/Typeface.cs index 40e98d1565..6dde2bb591 100644 --- a/src/Avalonia.Visuals/Media/Typeface.cs +++ b/src/Avalonia.Visuals/Media/Typeface.cs @@ -7,6 +7,8 @@ namespace Avalonia.Media /// public class Typeface { + public static Typeface Default = new Typeface(FontFamily.Default); + /// /// Initializes a new instance of the class. /// diff --git a/src/Avalonia.Visuals/Platform/ExportRenderingSubsystemAttribute.cs b/src/Avalonia.Visuals/Platform/ExportRenderingSubsystemAttribute.cs index 73526d7622..57f9c68456 100644 --- a/src/Avalonia.Visuals/Platform/ExportRenderingSubsystemAttribute.cs +++ b/src/Avalonia.Visuals/Platform/ExportRenderingSubsystemAttribute.cs @@ -1,8 +1,4 @@ using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; namespace Avalonia.Platform { diff --git a/src/Avalonia.Visuals/Platform/IDrawingContextImpl.cs b/src/Avalonia.Visuals/Platform/IDrawingContextImpl.cs index b11d9f52ab..57b974f900 100644 --- a/src/Avalonia.Visuals/Platform/IDrawingContextImpl.cs +++ b/src/Avalonia.Visuals/Platform/IDrawingContextImpl.cs @@ -98,7 +98,7 @@ namespace Avalonia.Platform IRenderTargetBitmapImpl CreateLayer(Size size); /// - /// Pushes a clip rectange. + /// Pushes a clip rectangle. /// /// The clip rectangle. void PushClip(Rect clip); diff --git a/src/Avalonia.Visuals/Platform/IFormattedTextImpl.cs b/src/Avalonia.Visuals/Platform/IFormattedTextImpl.cs index 606da02c49..2a4e9cde4f 100644 --- a/src/Avalonia.Visuals/Platform/IFormattedTextImpl.cs +++ b/src/Avalonia.Visuals/Platform/IFormattedTextImpl.cs @@ -1,7 +1,6 @@ // Copyright (c) The Avalonia Project. All rights reserved. // Licensed under the MIT license. See licence.md file in the project root for full license information. -using System; using System.Collections.Generic; using Avalonia.Media; diff --git a/src/Avalonia.Visuals/Platform/IGeometryImpl.cs b/src/Avalonia.Visuals/Platform/IGeometryImpl.cs index d93bdc0c20..4e8e6521bd 100644 --- a/src/Avalonia.Visuals/Platform/IGeometryImpl.cs +++ b/src/Avalonia.Visuals/Platform/IGeometryImpl.cs @@ -1,7 +1,6 @@ // Copyright (c) The Avalonia Project. All rights reserved. // Licensed under the MIT license. See licence.md file in the project root for full license information. -using System; using Avalonia.Media; namespace Avalonia.Platform diff --git a/src/Avalonia.Visuals/Platform/IRenderTargetBitmapImpl.cs b/src/Avalonia.Visuals/Platform/IRenderTargetBitmapImpl.cs index c3c19ac150..6464fdd41b 100644 --- a/src/Avalonia.Visuals/Platform/IRenderTargetBitmapImpl.cs +++ b/src/Avalonia.Visuals/Platform/IRenderTargetBitmapImpl.cs @@ -1,7 +1,6 @@ // Copyright (c) The Avalonia Project. All rights reserved. // Licensed under the MIT license. See licence.md file in the project root for full license information. -using System; namespace Avalonia.Platform { diff --git a/src/Avalonia.Visuals/Platform/ITransformedGeometryImpl.cs b/src/Avalonia.Visuals/Platform/ITransformedGeometryImpl.cs index ca68005906..1ed025b571 100644 --- a/src/Avalonia.Visuals/Platform/ITransformedGeometryImpl.cs +++ b/src/Avalonia.Visuals/Platform/ITransformedGeometryImpl.cs @@ -1,6 +1,4 @@ -using System; - -namespace Avalonia.Platform +namespace Avalonia.Platform { /// /// Represents a geometry with a transform applied. diff --git a/src/Avalonia.Visuals/Platform/IWriteableBitmapImpl.cs b/src/Avalonia.Visuals/Platform/IWriteableBitmapImpl.cs index 7ab5a7c100..c4e2e4915f 100644 --- a/src/Avalonia.Visuals/Platform/IWriteableBitmapImpl.cs +++ b/src/Avalonia.Visuals/Platform/IWriteableBitmapImpl.cs @@ -1,10 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace Avalonia.Platform +namespace Avalonia.Platform { /// /// Defines the platform-specific interface for a . diff --git a/src/Avalonia.Visuals/Platform/PathGeometryContext.cs b/src/Avalonia.Visuals/Platform/PathGeometryContext.cs index cc881094fd..19322b9620 100644 --- a/src/Avalonia.Visuals/Platform/PathGeometryContext.cs +++ b/src/Avalonia.Visuals/Platform/PathGeometryContext.cs @@ -1,9 +1,9 @@ // Copyright (c) The Avalonia Project. All rights reserved. // Licensed under the MIT license. See licence.md file in the project root for full license information. +using System; using Avalonia.Media; using Avalonia.Platform; -using System; namespace Avalonia.Visuals.Platform { diff --git a/src/Avalonia.Visuals/Point.cs b/src/Avalonia.Visuals/Point.cs index 34070ac71f..e74094fe50 100644 --- a/src/Avalonia.Visuals/Point.cs +++ b/src/Avalonia.Visuals/Point.cs @@ -1,10 +1,8 @@ // Copyright (c) The Avalonia Project. All rights reserved. // Licensed under the MIT license. See licence.md file in the project root for full license information. -using Avalonia.Utilities; -using System; using System.Globalization; -using System.Linq; +using Avalonia.Utilities; namespace Avalonia { @@ -75,7 +73,7 @@ namespace Avalonia } /// - /// Checks for unequality between two s. + /// Checks for inequality between two s. /// /// The first point. /// The second point. diff --git a/src/Avalonia.Visuals/Rect.cs b/src/Avalonia.Visuals/Rect.cs index d28fff0216..63d34b474b 100644 --- a/src/Avalonia.Visuals/Rect.cs +++ b/src/Avalonia.Visuals/Rect.cs @@ -1,10 +1,9 @@ // Copyright (c) The Avalonia Project. All rights reserved. // Licensed under the MIT license. See licence.md file in the project root for full license information. -using Avalonia.Utilities; using System; using System.Globalization; -using System.Linq; +using Avalonia.Utilities; namespace Avalonia { @@ -173,7 +172,7 @@ namespace Avalonia } /// - /// Checks for unequality between two s. + /// Checks for inequality between two s. /// /// The first rect. /// The second rect. diff --git a/src/Avalonia.Visuals/RelativePoint.cs b/src/Avalonia.Visuals/RelativePoint.cs index 5d3cb23a90..d38bb1d496 100644 --- a/src/Avalonia.Visuals/RelativePoint.cs +++ b/src/Avalonia.Visuals/RelativePoint.cs @@ -1,10 +1,9 @@ // Copyright (c) The Avalonia Project. All rights reserved. // Licensed under the MIT license. See licence.md file in the project root for full license information. -using Avalonia.Utilities; using System; using System.Globalization; -using System.Linq; +using Avalonia.Utilities; namespace Avalonia { @@ -93,7 +92,7 @@ namespace Avalonia } /// - /// Checks for unequality between two s. + /// Checks for inequality between two s. /// /// The first point. /// The second point. diff --git a/src/Avalonia.Visuals/RelativeRect.cs b/src/Avalonia.Visuals/RelativeRect.cs index 0afe74f0be..927ec3ef75 100644 --- a/src/Avalonia.Visuals/RelativeRect.cs +++ b/src/Avalonia.Visuals/RelativeRect.cs @@ -1,10 +1,9 @@ // Copyright (c) The Avalonia Project. All rights reserved. // Licensed under the MIT license. See licence.md file in the project root for full license information. -using Avalonia.Utilities; using System; using System.Globalization; -using System.Linq; +using Avalonia.Utilities; namespace Avalonia { @@ -102,7 +101,7 @@ namespace Avalonia } /// - /// Checks for unequality between two s. + /// Checks for inequality between two s. /// /// The first rectangle. /// The second rectangle. diff --git a/src/Avalonia.Visuals/RenderTargetCorruptedException.cs b/src/Avalonia.Visuals/RenderTargetCorruptedException.cs index f67a866be2..966aaf352f 100644 --- a/src/Avalonia.Visuals/RenderTargetCorruptedException.cs +++ b/src/Avalonia.Visuals/RenderTargetCorruptedException.cs @@ -1,8 +1,4 @@ using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; namespace Avalonia { diff --git a/src/Avalonia.Visuals/Rendering/DeferredRenderer.cs b/src/Avalonia.Visuals/Rendering/DeferredRenderer.cs index a14923b410..dc1d2933d0 100644 --- a/src/Avalonia.Visuals/Rendering/DeferredRenderer.cs +++ b/src/Avalonia.Visuals/Rendering/DeferredRenderer.cs @@ -2,17 +2,17 @@ // Licensed under the MIT license. See licence.md file in the project root for full license information. using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Threading; using Avalonia.Media; +using Avalonia.Media.Immutable; using Avalonia.Platform; using Avalonia.Rendering.SceneGraph; using Avalonia.Threading; -using Avalonia.VisualTree; -using System.Collections.Generic; -using System.IO; -using Avalonia.Media.Immutable; -using System.Threading; -using System.Linq; using Avalonia.Utilities; +using Avalonia.VisualTree; namespace Avalonia.Rendering { @@ -337,6 +337,8 @@ namespace Avalonia.Rendering private void RenderComposite(Scene scene, IDrawingContextImpl context) { + context.Clear(Colors.Transparent); + var clientRect = new Rect(scene.Size); foreach (var layer in scene.Layers) diff --git a/src/Avalonia.Visuals/Rendering/DirtyRects.cs b/src/Avalonia.Visuals/Rendering/DirtyRects.cs index 473d002c76..d206d23a24 100644 --- a/src/Avalonia.Visuals/Rendering/DirtyRects.cs +++ b/src/Avalonia.Visuals/Rendering/DirtyRects.cs @@ -1,7 +1,6 @@ // Copyright (c) The Avalonia Project. All rights reserved. // Licensed under the MIT license. See licence.md file in the project root for full license information. -using System; using System.Collections; using System.Collections.Generic; @@ -21,12 +20,12 @@ namespace Avalonia.Rendering /// /// The dirt rectangle. /// - /// We probably want to do this more intellegently because: + /// We probably want to do this more intelligently because: /// - Adding e.g. the top left quarter of a scene and the bottom left quarter of a scene /// will cause the whole scene to be invalidated if they overlap by a single pixel /// - Adding two adjacent rectangles that don't overlap will not cause them to be /// coalesced - /// - It only coaleces the first intersecting rectangle found - one needs to + /// - It only coalesces the first intersecting rectangle found - one needs to /// call at the end of the draw cycle to coalesce the rest. /// public void Add(Rect rect) diff --git a/src/Avalonia.Visuals/Rendering/DisplayDirtyRect.cs b/src/Avalonia.Visuals/Rendering/DisplayDirtyRect.cs index 03b8e95825..7e6c3062cd 100644 --- a/src/Avalonia.Visuals/Rendering/DisplayDirtyRect.cs +++ b/src/Avalonia.Visuals/Rendering/DisplayDirtyRect.cs @@ -30,7 +30,7 @@ namespace Avalonia.Rendering public DateTimeOffset Born { get; private set; } /// - /// Gets the time at which the rectagle should no longer be displayed. + /// Gets the time at which the rectangle should no longer be displayed. /// public DateTimeOffset Dies { get; private set; } diff --git a/src/Avalonia.Visuals/Rendering/IRenderRoot.cs b/src/Avalonia.Visuals/Rendering/IRenderRoot.cs index 2982a5d081..2b364e5d22 100644 --- a/src/Avalonia.Visuals/Rendering/IRenderRoot.cs +++ b/src/Avalonia.Visuals/Rendering/IRenderRoot.cs @@ -1,7 +1,6 @@ // Copyright (c) The Avalonia Project. All rights reserved. // Licensed under the MIT license. See licence.md file in the project root for full license information. -using System; using Avalonia.Platform; using Avalonia.VisualTree; diff --git a/src/Avalonia.Visuals/Rendering/IRendererFactory.cs b/src/Avalonia.Visuals/Rendering/IRendererFactory.cs index 0d7044e125..27af39e40d 100644 --- a/src/Avalonia.Visuals/Rendering/IRendererFactory.cs +++ b/src/Avalonia.Visuals/Rendering/IRendererFactory.cs @@ -1,7 +1,6 @@ // Copyright (c) The Avalonia Project. All rights reserved. // Licensed under the MIT license. See licence.md file in the project root for full license information. -using System; namespace Avalonia.Rendering { diff --git a/src/Avalonia.Visuals/Rendering/IVisualBrushInitialize.cs b/src/Avalonia.Visuals/Rendering/IVisualBrushInitialize.cs index b3209e2462..2949c9c051 100644 --- a/src/Avalonia.Visuals/Rendering/IVisualBrushInitialize.cs +++ b/src/Avalonia.Visuals/Rendering/IVisualBrushInitialize.cs @@ -1,13 +1,12 @@ // Copyright (c) The Avalonia Project. All rights reserved. // Licensed under the MIT license. See licence.md file in the project root for full license information. -using System; using Avalonia.Media; namespace Avalonia.Rendering { /// - /// Internal interface for initializing controls that are to be used as the viusal in a + /// Internal interface for initializing controls that are to be used as the visual in a /// . /// public interface IVisualBrushInitialize diff --git a/src/Avalonia.Visuals/Rendering/IVisualBrushRenderer.cs b/src/Avalonia.Visuals/Rendering/IVisualBrushRenderer.cs index 3d9b20713c..84f540ca8e 100644 --- a/src/Avalonia.Visuals/Rendering/IVisualBrushRenderer.cs +++ b/src/Avalonia.Visuals/Rendering/IVisualBrushRenderer.cs @@ -1,7 +1,6 @@ // Copyright (c) The Avalonia Project. All rights reserved. // Licensed under the MIT license. See licence.md file in the project root for full license information. -using System; using Avalonia.Media; using Avalonia.Platform; diff --git a/src/Avalonia.Visuals/Rendering/ImmediateRenderer.cs b/src/Avalonia.Visuals/Rendering/ImmediateRenderer.cs index 2118b66de2..fd62c8a59f 100644 --- a/src/Avalonia.Visuals/Rendering/ImmediateRenderer.cs +++ b/src/Avalonia.Visuals/Rendering/ImmediateRenderer.cs @@ -2,11 +2,11 @@ // Licensed under the MIT license. See licence.md file in the project root for full license information. using System; -using Avalonia.Platform; -using Avalonia.VisualTree; using System.Collections.Generic; -using Avalonia.Media; using System.Linq; +using Avalonia.Media; +using Avalonia.Platform; +using Avalonia.VisualTree; namespace Avalonia.Rendering { @@ -54,6 +54,8 @@ namespace Avalonia.Rendering { using (var context = new DrawingContext(_renderTarget.CreateDrawingContext(this))) { + context.PlatformImpl.Clear(Colors.Transparent); + using (context.PushTransformContainer()) { Render(context, _root, _root.Bounds); diff --git a/src/Avalonia.Visuals/Rendering/RenderLayer.cs b/src/Avalonia.Visuals/Rendering/RenderLayer.cs index d1b1f1440a..cd09bdee10 100644 --- a/src/Avalonia.Visuals/Rendering/RenderLayer.cs +++ b/src/Avalonia.Visuals/Rendering/RenderLayer.cs @@ -1,5 +1,4 @@ -using System; -using Avalonia.Media; +using Avalonia.Media; using Avalonia.Platform; using Avalonia.Utilities; using Avalonia.VisualTree; diff --git a/src/Avalonia.Visuals/Rendering/RenderLayers.cs b/src/Avalonia.Visuals/Rendering/RenderLayers.cs index 6a45ecd912..9b0ce944e7 100644 --- a/src/Avalonia.Visuals/Rendering/RenderLayers.cs +++ b/src/Avalonia.Visuals/Rendering/RenderLayers.cs @@ -1,5 +1,4 @@ -using System; -using System.Collections; +using System.Collections; using System.Collections.Generic; using Avalonia.Platform; using Avalonia.Rendering.SceneGraph; diff --git a/src/Avalonia.Visuals/Rendering/SceneGraph/BrushDrawOperation.cs b/src/Avalonia.Visuals/Rendering/SceneGraph/BrushDrawOperation.cs index f56e7448a7..4c09dc2ddd 100644 --- a/src/Avalonia.Visuals/Rendering/SceneGraph/BrushDrawOperation.cs +++ b/src/Avalonia.Visuals/Rendering/SceneGraph/BrushDrawOperation.cs @@ -1,7 +1,6 @@ // Copyright (c) The Avalonia Project. All rights reserved. // Licensed under the MIT license. See licence.md file in the project root for full license information. -using System; using System.Collections.Generic; using Avalonia.Media; using Avalonia.VisualTree; diff --git a/src/Avalonia.Visuals/Rendering/SceneGraph/ClipNode.cs b/src/Avalonia.Visuals/Rendering/SceneGraph/ClipNode.cs index 14e6b4ab63..34f042e334 100644 --- a/src/Avalonia.Visuals/Rendering/SceneGraph/ClipNode.cs +++ b/src/Avalonia.Visuals/Rendering/SceneGraph/ClipNode.cs @@ -1,5 +1,4 @@ -using System; -using Avalonia.Platform; +using Avalonia.Platform; namespace Avalonia.Rendering.SceneGraph { diff --git a/src/Avalonia.Visuals/Rendering/SceneGraph/DeferredDrawingContextImpl.cs b/src/Avalonia.Visuals/Rendering/SceneGraph/DeferredDrawingContextImpl.cs index 42ecde6a6d..dfed0d911c 100644 --- a/src/Avalonia.Visuals/Rendering/SceneGraph/DeferredDrawingContextImpl.cs +++ b/src/Avalonia.Visuals/Rendering/SceneGraph/DeferredDrawingContextImpl.cs @@ -6,8 +6,8 @@ using System.Collections.Generic; using Avalonia.Media; using Avalonia.Platform; using Avalonia.Utilities; -using Avalonia.VisualTree; using Avalonia.Visuals.Media.Imaging; +using Avalonia.VisualTree; namespace Avalonia.Rendering.SceneGraph { diff --git a/src/Avalonia.Visuals/Rendering/SceneGraph/GeometryClipNode.cs b/src/Avalonia.Visuals/Rendering/SceneGraph/GeometryClipNode.cs index 2c1decf5dc..a2ad83d845 100644 --- a/src/Avalonia.Visuals/Rendering/SceneGraph/GeometryClipNode.cs +++ b/src/Avalonia.Visuals/Rendering/SceneGraph/GeometryClipNode.cs @@ -1,5 +1,4 @@ -using System; -using Avalonia.Platform; +using Avalonia.Platform; namespace Avalonia.Rendering.SceneGraph { diff --git a/src/Avalonia.Visuals/Rendering/SceneGraph/GeometryNode.cs b/src/Avalonia.Visuals/Rendering/SceneGraph/GeometryNode.cs index 7b79ebab4f..46d264e518 100644 --- a/src/Avalonia.Visuals/Rendering/SceneGraph/GeometryNode.cs +++ b/src/Avalonia.Visuals/Rendering/SceneGraph/GeometryNode.cs @@ -1,7 +1,6 @@ // Copyright (c) The Avalonia Project. All rights reserved. // Licensed under the MIT license. See licence.md file in the project root for full license information. -using System; using System.Collections.Generic; using Avalonia.Media; using Avalonia.Platform; diff --git a/src/Avalonia.Visuals/Rendering/SceneGraph/IVisualNode.cs b/src/Avalonia.Visuals/Rendering/SceneGraph/IVisualNode.cs index 75ef49f8e7..e640925b3a 100644 --- a/src/Avalonia.Visuals/Rendering/SceneGraph/IVisualNode.cs +++ b/src/Avalonia.Visuals/Rendering/SceneGraph/IVisualNode.cs @@ -3,7 +3,6 @@ using System; using System.Collections.Generic; -using Avalonia.Media; using Avalonia.Platform; using Avalonia.Utilities; using Avalonia.VisualTree; diff --git a/src/Avalonia.Visuals/Rendering/SceneGraph/ImageNode.cs b/src/Avalonia.Visuals/Rendering/SceneGraph/ImageNode.cs index 9e8fca5f84..1abd966a9f 100644 --- a/src/Avalonia.Visuals/Rendering/SceneGraph/ImageNode.cs +++ b/src/Avalonia.Visuals/Rendering/SceneGraph/ImageNode.cs @@ -1,7 +1,6 @@ // Copyright (c) The Avalonia Project. All rights reserved. // Licensed under the MIT license. See licence.md file in the project root for full license information. -using System; using Avalonia.Platform; using Avalonia.Utilities; using Avalonia.Visuals.Media.Imaging; diff --git a/src/Avalonia.Visuals/Rendering/SceneGraph/LineNode.cs b/src/Avalonia.Visuals/Rendering/SceneGraph/LineNode.cs index d3df478a63..11c763fcc9 100644 --- a/src/Avalonia.Visuals/Rendering/SceneGraph/LineNode.cs +++ b/src/Avalonia.Visuals/Rendering/SceneGraph/LineNode.cs @@ -1,7 +1,6 @@ // Copyright (c) The Avalonia Project. All rights reserved. // Licensed under the MIT license. See licence.md file in the project root for full license information. -using System; using System.Collections.Generic; using Avalonia.Media; using Avalonia.Platform; diff --git a/src/Avalonia.Visuals/Rendering/SceneGraph/OpacityMaskNode.cs b/src/Avalonia.Visuals/Rendering/SceneGraph/OpacityMaskNode.cs index 28b8f53e26..d6dbc1a8cb 100644 --- a/src/Avalonia.Visuals/Rendering/SceneGraph/OpacityMaskNode.cs +++ b/src/Avalonia.Visuals/Rendering/SceneGraph/OpacityMaskNode.cs @@ -1,5 +1,4 @@ -using System; -using System.Collections.Generic; +using System.Collections.Generic; using Avalonia.Media; using Avalonia.Platform; using Avalonia.VisualTree; diff --git a/src/Avalonia.Visuals/Rendering/SceneGraph/OpacityNode.cs b/src/Avalonia.Visuals/Rendering/SceneGraph/OpacityNode.cs index ef49ac8879..8fc630588f 100644 --- a/src/Avalonia.Visuals/Rendering/SceneGraph/OpacityNode.cs +++ b/src/Avalonia.Visuals/Rendering/SceneGraph/OpacityNode.cs @@ -1,5 +1,4 @@ -using System; -using Avalonia.Platform; +using Avalonia.Platform; namespace Avalonia.Rendering.SceneGraph { diff --git a/src/Avalonia.Visuals/Rendering/SceneGraph/RectangleNode.cs b/src/Avalonia.Visuals/Rendering/SceneGraph/RectangleNode.cs index 1730621c55..33cc39cbe3 100644 --- a/src/Avalonia.Visuals/Rendering/SceneGraph/RectangleNode.cs +++ b/src/Avalonia.Visuals/Rendering/SceneGraph/RectangleNode.cs @@ -1,7 +1,6 @@ // Copyright (c) The Avalonia Project. All rights reserved. // Licensed under the MIT license. See licence.md file in the project root for full license information. -using System; using System.Collections.Generic; using Avalonia.Media; using Avalonia.Platform; @@ -20,7 +19,7 @@ namespace Avalonia.Rendering.SceneGraph /// The transform. /// The fill brush. /// The stroke pen. - /// The rectanle to draw. + /// The rectangle to draw. /// The rectangle corner radius. /// Child scenes for drawing visual brushes. public RectangleNode( diff --git a/src/Avalonia.Visuals/Rendering/SceneGraph/SceneLayer.cs b/src/Avalonia.Visuals/Rendering/SceneGraph/SceneLayer.cs index 77ad96a222..02fae562ef 100644 --- a/src/Avalonia.Visuals/Rendering/SceneGraph/SceneLayer.cs +++ b/src/Avalonia.Visuals/Rendering/SceneGraph/SceneLayer.cs @@ -1,5 +1,4 @@ -using System; -using Avalonia.Media; +using Avalonia.Media; using Avalonia.Platform; using Avalonia.VisualTree; diff --git a/src/Avalonia.Visuals/Rendering/SceneGraph/TextNode.cs b/src/Avalonia.Visuals/Rendering/SceneGraph/TextNode.cs index 6328d7dd14..c06d0d26b4 100644 --- a/src/Avalonia.Visuals/Rendering/SceneGraph/TextNode.cs +++ b/src/Avalonia.Visuals/Rendering/SceneGraph/TextNode.cs @@ -1,7 +1,6 @@ // Copyright (c) The Avalonia Project. All rights reserved. // Licensed under the MIT license. See licence.md file in the project root for full license information. -using System; using System.Collections.Generic; using Avalonia.Media; using Avalonia.Platform; @@ -71,7 +70,7 @@ namespace Avalonia.Rendering.SceneGraph /// Determines if this draw operation equals another. /// /// The transform of the other draw operation. - /// The foregroundof the other draw operation. + /// The foreground of the other draw operation. /// The draw origin of the other draw operation. /// The text of the other draw operation. /// True if the draw operations are the same, otherwise false. diff --git a/src/Avalonia.Visuals/Rendering/SceneGraph/VisualNode.cs b/src/Avalonia.Visuals/Rendering/SceneGraph/VisualNode.cs index 306036ca2c..760cedcbf0 100644 --- a/src/Avalonia.Visuals/Rendering/SceneGraph/VisualNode.cs +++ b/src/Avalonia.Visuals/Rendering/SceneGraph/VisualNode.cs @@ -82,7 +82,7 @@ namespace Avalonia.Rendering.SceneGraph } /// - /// Gets or sets the opacity mask for the scnee graph node. + /// Gets or sets the opacity mask for the scene graph node. /// public IBrush OpacityMask { get; set; } @@ -159,7 +159,7 @@ namespace Avalonia.Rendering.SceneGraph /// /// Replaces an item in the collection. /// - /// The opeation to be replaced. + /// The operation to be replaced. /// The operation to add. public void ReplaceDrawOperation(int index, IRef operation) { diff --git a/src/Avalonia.Visuals/Rendering/ZIndexComparer.cs b/src/Avalonia.Visuals/Rendering/ZIndexComparer.cs index 491541cd2e..3ed076f22e 100644 --- a/src/Avalonia.Visuals/Rendering/ZIndexComparer.cs +++ b/src/Avalonia.Visuals/Rendering/ZIndexComparer.cs @@ -1,5 +1,4 @@ -using System; -using System.Collections.Generic; +using System.Collections.Generic; using Avalonia.VisualTree; namespace Avalonia.Rendering diff --git a/src/Avalonia.Visuals/Size.cs b/src/Avalonia.Visuals/Size.cs index 50a3973a5c..8057571bf1 100644 --- a/src/Avalonia.Visuals/Size.cs +++ b/src/Avalonia.Visuals/Size.cs @@ -1,10 +1,9 @@ // Copyright (c) The Avalonia Project. All rights reserved. // Licensed under the MIT license. See licence.md file in the project root for full license information. -using Avalonia.Utilities; using System; using System.Globalization; -using System.Linq; +using Avalonia.Utilities; namespace Avalonia { @@ -71,7 +70,7 @@ namespace Avalonia } /// - /// Checks for unequality between two s. + /// Checks for inequality between two s. /// /// The first size. /// The second size. @@ -141,9 +140,9 @@ namespace Avalonia return new Size(size._width + toAdd._width, size._height + toAdd._height); } - public static Size operator -(Size size, Size toSubstract) + public static Size operator -(Size size, Size toSubtract) { - return new Size(size._width - toSubstract._width, size._height - toSubstract._height); + return new Size(size._width - toSubtract._width, size._height - toSubtract._height); } /// @@ -260,4 +259,4 @@ namespace Avalonia return string.Format(CultureInfo.InvariantCulture, "{0}, {1}", _width, _height); } } -} \ No newline at end of file +} diff --git a/src/Avalonia.Visuals/Thickness.cs b/src/Avalonia.Visuals/Thickness.cs index 759abd5943..3e70ecafb1 100644 --- a/src/Avalonia.Visuals/Thickness.cs +++ b/src/Avalonia.Visuals/Thickness.cs @@ -1,10 +1,9 @@ // Copyright (c) The Avalonia Project. All rights reserved. // Licensed under the MIT license. See licence.md file in the project root for full license information. -using Avalonia.Utilities; using System; using System.Globalization; -using System.Linq; +using Avalonia.Utilities; namespace Avalonia { @@ -114,7 +113,7 @@ namespace Avalonia /// /// The first thickness. /// The second thickness. - /// The unequality. + /// The inequality. public static bool operator !=(Thickness a, Thickness b) { return !a.Equals(b); diff --git a/src/Avalonia.Visuals/Visual.cs b/src/Avalonia.Visuals/Visual.cs index 2be39d4522..81e1a93a6f 100644 --- a/src/Avalonia.Visuals/Visual.cs +++ b/src/Avalonia.Visuals/Visual.cs @@ -5,7 +5,6 @@ using System; using System.Collections.Specialized; using System.Linq; using System.Reactive.Linq; -using Avalonia.Animation; using Avalonia.Collections; using Avalonia.Data; using Avalonia.Logging; diff --git a/src/Avalonia.Visuals/VisualExtensions.cs b/src/Avalonia.Visuals/VisualExtensions.cs index d69785cc59..7c5d011ce8 100644 --- a/src/Avalonia.Visuals/VisualExtensions.cs +++ b/src/Avalonia.Visuals/VisualExtensions.cs @@ -2,15 +2,6 @@ // Licensed under the MIT license. See licence.md file in the project root for full license information. using System; -using System.Collections.Generic; -using System.Collections.Specialized; -using System.Linq; -using System.Reactive.Linq; -using Avalonia.Animation; -using Avalonia.Collections; -using Avalonia.Data; -using Avalonia.Media; -using Avalonia.Platform; using Avalonia.Rendering; using Avalonia.VisualTree; diff --git a/src/Avalonia.Visuals/VisualTree/TransformedBounds.cs b/src/Avalonia.Visuals/VisualTree/TransformedBounds.cs index f8356bbcd6..da21a416e1 100644 --- a/src/Avalonia.Visuals/VisualTree/TransformedBounds.cs +++ b/src/Avalonia.Visuals/VisualTree/TransformedBounds.cs @@ -1,7 +1,6 @@ // Copyright (c) The Avalonia Project. All rights reserved. // Licensed under the MIT license. See licence.md file in the project root for full license information. -using Avalonia.Media; namespace Avalonia.VisualTree { @@ -52,4 +51,4 @@ namespace Avalonia.VisualTree } } } -} \ No newline at end of file +} diff --git a/src/Gtk/Avalonia.Gtk3/ClipboardImpl.cs b/src/Gtk/Avalonia.Gtk3/ClipboardImpl.cs index 333391a064..a3e7590cf5 100644 --- a/src/Gtk/Avalonia.Gtk3/ClipboardImpl.cs +++ b/src/Gtk/Avalonia.Gtk3/ClipboardImpl.cs @@ -1,8 +1,5 @@ using System; -using System.Collections.Generic; -using System.Linq; using System.Runtime.InteropServices; -using System.Text; using System.Threading.Tasks; using Avalonia.Gtk3.Interop; using Avalonia.Input.Platform; diff --git a/src/Gtk/Avalonia.Gtk3/FramebufferManager.cs b/src/Gtk/Avalonia.Gtk3/FramebufferManager.cs index 82dbf53579..e3bbe19978 100644 --- a/src/Gtk/Avalonia.Gtk3/FramebufferManager.cs +++ b/src/Gtk/Avalonia.Gtk3/FramebufferManager.cs @@ -1,8 +1,4 @@ using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; using Avalonia.Controls.Platform.Surfaces; using Avalonia.Platform; using Avalonia.Threading; diff --git a/src/Gtk/Avalonia.Gtk3/GdkCursor.cs b/src/Gtk/Avalonia.Gtk3/GdkCursor.cs index 48815e1273..4fad8208b3 100644 --- a/src/Gtk/Avalonia.Gtk3/GdkCursor.cs +++ b/src/Gtk/Avalonia.Gtk3/GdkCursor.cs @@ -1,10 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace Avalonia.Gtk3 +namespace Avalonia.Gtk3 { enum GdkCursorType { @@ -88,4 +82,4 @@ namespace Avalonia.Gtk3 Xterm = 152, LastCursor = 153, } -} \ No newline at end of file +} diff --git a/src/Gtk/Avalonia.Gtk3/GdkKey.cs b/src/Gtk/Avalonia.Gtk3/GdkKey.cs index b4a0f31b92..7aa165a1da 100644 --- a/src/Gtk/Avalonia.Gtk3/GdkKey.cs +++ b/src/Gtk/Avalonia.Gtk3/GdkKey.cs @@ -1,10 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace Avalonia.Gtk3 +namespace Avalonia.Gtk3 { enum GdkKey { diff --git a/src/Gtk/Avalonia.Gtk3/Gtk3Platform.cs b/src/Gtk/Avalonia.Gtk3/Gtk3Platform.cs index b687d9d447..ca8a1ad3a4 100644 --- a/src/Gtk/Avalonia.Gtk3/Gtk3Platform.cs +++ b/src/Gtk/Avalonia.Gtk3/Gtk3Platform.cs @@ -1,18 +1,14 @@ using System; -using System.Collections.Generic; -using System.Linq; using System.Runtime.InteropServices; -using System.Text; using System.Threading; -using System.Threading.Tasks; using Avalonia.Controls; using Avalonia.Controls.Platform; +using Avalonia.Gtk3; using Avalonia.Gtk3.Interop; using Avalonia.Input; using Avalonia.Input.Platform; using Avalonia.Platform; using Avalonia.Rendering; -using Avalonia.Gtk3; using Avalonia.Threading; namespace Avalonia.Gtk3 @@ -133,4 +129,4 @@ namespace Avalonia return builder.UseWindowingSubsystem(Gtk3Platform.Initialize, "GTK3"); } } -} \ No newline at end of file +} diff --git a/src/Gtk/Avalonia.Gtk3/ImageSurfaceFramebuffer.cs b/src/Gtk/Avalonia.Gtk3/ImageSurfaceFramebuffer.cs index efda21c753..cd0074c287 100644 --- a/src/Gtk/Avalonia.Gtk3/ImageSurfaceFramebuffer.cs +++ b/src/Gtk/Avalonia.Gtk3/ImageSurfaceFramebuffer.cs @@ -1,10 +1,4 @@ using System; -using System.Collections.Generic; -using System.Diagnostics; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using Avalonia.Controls.Platform.Surfaces; using Avalonia.Gtk3.Interop; using Avalonia.Platform; using Avalonia.Threading; diff --git a/src/Gtk/Avalonia.Gtk3/Interop/CairoSurface.cs b/src/Gtk/Avalonia.Gtk3/Interop/CairoSurface.cs index 87a70c4d35..7838be9305 100644 --- a/src/Gtk/Avalonia.Gtk3/Interop/CairoSurface.cs +++ b/src/Gtk/Avalonia.Gtk3/Interop/CairoSurface.cs @@ -1,5 +1,4 @@ using System; -using System.Collections.Generic; using System.Runtime.InteropServices; namespace Avalonia.Gtk3.Interop diff --git a/src/Gtk/Avalonia.Gtk3/Interop/DynLoader.cs b/src/Gtk/Avalonia.Gtk3/Interop/DynLoader.cs index 93fb82d285..112e00c879 100644 --- a/src/Gtk/Avalonia.Gtk3/Interop/DynLoader.cs +++ b/src/Gtk/Avalonia.Gtk3/Interop/DynLoader.cs @@ -1,5 +1,4 @@ using System; -using System.Collections.Generic; using System.Runtime.InteropServices; /* diff --git a/src/Gtk/Avalonia.Gtk3/Interop/GException.cs b/src/Gtk/Avalonia.Gtk3/Interop/GException.cs index ab08df4ec3..b0c171089e 100644 --- a/src/Gtk/Avalonia.Gtk3/Interop/GException.cs +++ b/src/Gtk/Avalonia.Gtk3/Interop/GException.cs @@ -1,9 +1,5 @@ using System; -using System.Collections.Generic; -using System.Linq; using System.Runtime.InteropServices; -using System.Text; -using System.Threading.Tasks; namespace Avalonia.Gtk3.Interop { diff --git a/src/Gtk/Avalonia.Gtk3/Interop/GObject.cs b/src/Gtk/Avalonia.Gtk3/Interop/GObject.cs index 24bcfd71e9..bb272b06d5 100644 --- a/src/Gtk/Avalonia.Gtk3/Interop/GObject.cs +++ b/src/Gtk/Avalonia.Gtk3/Interop/GObject.cs @@ -1,10 +1,6 @@ using System; -using System.Collections.Generic; using System.Diagnostics; -using System.Linq; using System.Runtime.InteropServices; -using System.Text; -using System.Threading.Tasks; namespace Avalonia.Gtk3.Interop { diff --git a/src/Gtk/Avalonia.Gtk3/Interop/GlibPriority.cs b/src/Gtk/Avalonia.Gtk3/Interop/GlibPriority.cs index add4ba3c02..08448e30d5 100644 --- a/src/Gtk/Avalonia.Gtk3/Interop/GlibPriority.cs +++ b/src/Gtk/Avalonia.Gtk3/Interop/GlibPriority.cs @@ -1,6 +1,4 @@ using System; -using System.Collections.Generic; -using System.Text; using Avalonia.Threading; namespace Avalonia.Gtk3.Interop diff --git a/src/Gtk/Avalonia.Gtk3/Interop/GlibTimeout.cs b/src/Gtk/Avalonia.Gtk3/Interop/GlibTimeout.cs index 971edb1364..6e3840914c 100644 --- a/src/Gtk/Avalonia.Gtk3/Interop/GlibTimeout.cs +++ b/src/Gtk/Avalonia.Gtk3/Interop/GlibTimeout.cs @@ -1,10 +1,5 @@ using System; -using System.Collections.Generic; -using System.Linq; using System.Runtime.InteropServices; -using System.Text; -using System.Threading.Tasks; -using Avalonia.Threading; namespace Avalonia.Gtk3.Interop { diff --git a/src/Gtk/Avalonia.Gtk3/Interop/ICustomGtk3NativeLibraryResolver.cs b/src/Gtk/Avalonia.Gtk3/Interop/ICustomGtk3NativeLibraryResolver.cs index 2f88b09896..3b78953d1b 100644 --- a/src/Gtk/Avalonia.Gtk3/Interop/ICustomGtk3NativeLibraryResolver.cs +++ b/src/Gtk/Avalonia.Gtk3/Interop/ICustomGtk3NativeLibraryResolver.cs @@ -1,9 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using Avalonia.Gtk3.Interop; +using Avalonia.Gtk3.Interop; namespace Avalonia.Gtk3 { diff --git a/src/Gtk/Avalonia.Gtk3/Interop/ManagedCairoSurface.cs b/src/Gtk/Avalonia.Gtk3/Interop/ManagedCairoSurface.cs index 2cde99afa5..2b0a7eae12 100644 --- a/src/Gtk/Avalonia.Gtk3/Interop/ManagedCairoSurface.cs +++ b/src/Gtk/Avalonia.Gtk3/Interop/ManagedCairoSurface.cs @@ -1,5 +1,4 @@ using System; -using System.Runtime.InteropServices; using Avalonia.Platform; namespace Avalonia.Gtk3.Interop @@ -35,4 +34,4 @@ namespace Avalonia.Gtk3.Interop } } -} \ No newline at end of file +} diff --git a/src/Gtk/Avalonia.Gtk3/Interop/Native.cs b/src/Gtk/Avalonia.Gtk3/Interop/Native.cs index f57769c224..914d0feafc 100644 --- a/src/Gtk/Avalonia.Gtk3/Interop/Native.cs +++ b/src/Gtk/Avalonia.Gtk3/Interop/Native.cs @@ -1,19 +1,14 @@ #pragma warning disable 649 using System; -using System.Collections.Generic; -using System.Linq; using System.Runtime.InteropServices; -using System.Text; -using System.Threading.Tasks; using Avalonia.Controls; -using gint8 = System.Byte; -using gint16 = System.Int16; -using gint32 = System.Int32; +using gdouble = System.Double; using gint = System.Int32; +using gint16 = System.Int16; +using gint8 = System.Byte; +using guint = System.UInt32; using guint16 = System.UInt16; using guint32 = System.UInt32; -using guint = System.UInt32; -using gdouble = System.Double; namespace Avalonia.Gtk3.Interop { diff --git a/src/Gtk/Avalonia.Gtk3/Interop/NativeException.cs b/src/Gtk/Avalonia.Gtk3/Interop/NativeException.cs index 43659f8f83..64cbccbd26 100644 --- a/src/Gtk/Avalonia.Gtk3/Interop/NativeException.cs +++ b/src/Gtk/Avalonia.Gtk3/Interop/NativeException.cs @@ -1,8 +1,4 @@ using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; namespace Avalonia.Gtk3.Interop { diff --git a/src/Gtk/Avalonia.Gtk3/Interop/Pixbuf.cs b/src/Gtk/Avalonia.Gtk3/Interop/Pixbuf.cs index 1a0a772522..989a96a4f0 100644 --- a/src/Gtk/Avalonia.Gtk3/Interop/Pixbuf.cs +++ b/src/Gtk/Avalonia.Gtk3/Interop/Pixbuf.cs @@ -1,10 +1,6 @@ using System; -using System.Collections.Generic; using System.IO; -using System.Linq; using System.Runtime.InteropServices; -using System.Text; -using System.Threading.Tasks; using Avalonia.Platform; namespace Avalonia.Gtk3.Interop diff --git a/src/Gtk/Avalonia.Gtk3/Interop/Resolver.cs b/src/Gtk/Avalonia.Gtk3/Interop/Resolver.cs index 31625e3f27..57c8ac7c3a 100644 --- a/src/Gtk/Avalonia.Gtk3/Interop/Resolver.cs +++ b/src/Gtk/Avalonia.Gtk3/Interop/Resolver.cs @@ -4,8 +4,6 @@ using System.IO; using System.Linq; using System.Reflection; using System.Runtime.InteropServices; -using System.Text; -using System.Threading.Tasks; using Avalonia.Platform; namespace Avalonia.Gtk3.Interop diff --git a/src/Gtk/Avalonia.Gtk3/Interop/Signal.cs b/src/Gtk/Avalonia.Gtk3/Interop/Signal.cs index 5f173000a2..bc55558551 100644 --- a/src/Gtk/Avalonia.Gtk3/Interop/Signal.cs +++ b/src/Gtk/Avalonia.Gtk3/Interop/Signal.cs @@ -1,9 +1,5 @@ using System; -using System.Collections.Generic; -using System.Linq; using System.Runtime.InteropServices; -using System.Text; -using System.Threading.Tasks; namespace Avalonia.Gtk3.Interop { diff --git a/src/Gtk/Avalonia.Gtk3/KeyTransform.cs b/src/Gtk/Avalonia.Gtk3/KeyTransform.cs index 69c5a1bf5f..29ee6aaeb5 100644 --- a/src/Gtk/Avalonia.Gtk3/KeyTransform.cs +++ b/src/Gtk/Avalonia.Gtk3/KeyTransform.cs @@ -1,10 +1,6 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using Avalonia.Input; +using System.Collections.Generic; using Avalonia.Gtk3; +using Avalonia.Input; namespace Avalonia.Gtk.Common { diff --git a/src/Gtk/Avalonia.Gtk3/PlatformIconLoader.cs b/src/Gtk/Avalonia.Gtk3/PlatformIconLoader.cs index b4e293cdff..6965e7c812 100644 --- a/src/Gtk/Avalonia.Gtk3/PlatformIconLoader.cs +++ b/src/Gtk/Avalonia.Gtk3/PlatformIconLoader.cs @@ -17,4 +17,4 @@ namespace Avalonia.Gtk3 return Pixbuf.NewFromBytes(ms.ToArray()); } } -} \ No newline at end of file +} diff --git a/src/Gtk/Avalonia.Gtk3/PopupImpl.cs b/src/Gtk/Avalonia.Gtk3/PopupImpl.cs index 13beff580e..ef17407dd6 100644 --- a/src/Gtk/Avalonia.Gtk3/PopupImpl.cs +++ b/src/Gtk/Avalonia.Gtk3/PopupImpl.cs @@ -1,10 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Diagnostics; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using Avalonia.Gtk3.Interop; +using Avalonia.Gtk3.Interop; using Avalonia.Platform; namespace Avalonia.Gtk3 diff --git a/src/Gtk/Avalonia.Gtk3/ScreenImpl.cs b/src/Gtk/Avalonia.Gtk3/ScreenImpl.cs index 786c9a2cf0..97b5029219 100644 --- a/src/Gtk/Avalonia.Gtk3/ScreenImpl.cs +++ b/src/Gtk/Avalonia.Gtk3/ScreenImpl.cs @@ -1,8 +1,6 @@ using System; -using Avalonia.Controls; using Avalonia.Gtk3.Interop; using Avalonia.Platform; -using Avalonia.Utilities; namespace Avalonia.Gtk3 { @@ -54,4 +52,4 @@ namespace Avalonia.Gtk3 _allScreens = null; } } -} \ No newline at end of file +} diff --git a/src/Gtk/Avalonia.Gtk3/SystemDialogs.cs b/src/Gtk/Avalonia.Gtk3/SystemDialogs.cs index cff376ad1f..d4bd878d53 100644 --- a/src/Gtk/Avalonia.Gtk3/SystemDialogs.cs +++ b/src/Gtk/Avalonia.Gtk3/SystemDialogs.cs @@ -2,12 +2,10 @@ using System.Collections.Generic; using System.IO; using System.Linq; -using System.Text; using System.Threading.Tasks; using Avalonia.Controls; using Avalonia.Controls.Platform; using Avalonia.Gtk3.Interop; -using Avalonia.Input.Platform; using Avalonia.Platform; namespace Avalonia.Gtk3 diff --git a/src/Gtk/Avalonia.Gtk3/WindowBaseImpl.cs b/src/Gtk/Avalonia.Gtk3/WindowBaseImpl.cs index 8a880fd306..67ddcf1e5f 100644 --- a/src/Gtk/Avalonia.Gtk3/WindowBaseImpl.cs +++ b/src/Gtk/Avalonia.Gtk3/WindowBaseImpl.cs @@ -1,9 +1,7 @@ using System; using System.Collections.Generic; -using System.Diagnostics; using System.Linq; using System.Runtime.InteropServices; -using System.Text; using System.Threading; using Avalonia.Controls; using Avalonia.Gtk3.Interop; diff --git a/src/Gtk/Avalonia.Gtk3/X11Framebuffer.cs b/src/Gtk/Avalonia.Gtk3/X11Framebuffer.cs index 4b27920d64..dde29f85c2 100644 --- a/src/Gtk/Avalonia.Gtk3/X11Framebuffer.cs +++ b/src/Gtk/Avalonia.Gtk3/X11Framebuffer.cs @@ -1,5 +1,4 @@ using System; -using System.Runtime.InteropServices; using Avalonia.Platform; namespace Avalonia.Gtk3 @@ -55,4 +54,4 @@ namespace Avalonia.Gtk3 public Vector Dpi { get; } public PixelFormat Format { get; } } -} \ No newline at end of file +} diff --git a/src/Linux/Avalonia.LinuxFramebuffer/EvDevDevice.cs b/src/Linux/Avalonia.LinuxFramebuffer/EvDevDevice.cs index 7b399863f7..f28dca81b8 100644 --- a/src/Linux/Avalonia.LinuxFramebuffer/EvDevDevice.cs +++ b/src/Linux/Avalonia.LinuxFramebuffer/EvDevDevice.cs @@ -3,7 +3,6 @@ using System.Collections.Generic; using System.IO; using System.Linq; using System.Runtime.InteropServices; -using System.Text; namespace Avalonia.LinuxFramebuffer { diff --git a/src/Linux/Avalonia.LinuxFramebuffer/FramebufferToplevelImpl.cs b/src/Linux/Avalonia.LinuxFramebuffer/FramebufferToplevelImpl.cs index 627b508aa8..968873abc0 100644 --- a/src/Linux/Avalonia.LinuxFramebuffer/FramebufferToplevelImpl.cs +++ b/src/Linux/Avalonia.LinuxFramebuffer/FramebufferToplevelImpl.cs @@ -1,7 +1,5 @@ using System; -using System.Collections; using System.Collections.Generic; -using System.Text; using Avalonia.Input; using Avalonia.Input.Raw; using Avalonia.Platform; diff --git a/src/Linux/Avalonia.LinuxFramebuffer/LinuxFramebuffer.cs b/src/Linux/Avalonia.LinuxFramebuffer/LinuxFramebuffer.cs index 8d04360edf..87b55be488 100644 --- a/src/Linux/Avalonia.LinuxFramebuffer/LinuxFramebuffer.cs +++ b/src/Linux/Avalonia.LinuxFramebuffer/LinuxFramebuffer.cs @@ -1,11 +1,6 @@ using System; -using System.Collections.Generic; -using System.ComponentModel; -using System.Diagnostics; -using System.Linq; using System.Runtime.InteropServices; using System.Text; -using System.Threading.Tasks; using Avalonia.Controls.Platform.Surfaces; using Avalonia.Platform; @@ -135,4 +130,4 @@ namespace Avalonia.LinuxFramebuffer ReleaseUnmanagedResources(); } } -} \ No newline at end of file +} diff --git a/src/Linux/Avalonia.LinuxFramebuffer/LinuxFramebufferPlatform.cs b/src/Linux/Avalonia.LinuxFramebuffer/LinuxFramebufferPlatform.cs index 896c91d087..810be77b2b 100644 --- a/src/Linux/Avalonia.LinuxFramebuffer/LinuxFramebufferPlatform.cs +++ b/src/Linux/Avalonia.LinuxFramebuffer/LinuxFramebufferPlatform.cs @@ -1,18 +1,14 @@ using System; -using System.Collections.Generic; using System.Diagnostics; -using System.Text; using System.Threading; using Avalonia.Controls; using Avalonia.Controls.Embedding; +using Avalonia.Controls.Platform; using Avalonia.Input; -using Avalonia.Input.Platform; using Avalonia.LinuxFramebuffer; using Avalonia.Platform; using Avalonia.Rendering; using Avalonia.Threading; -using Avalonia; -using Avalonia.Controls.Platform; namespace Avalonia.LinuxFramebuffer { diff --git a/src/Linux/Avalonia.LinuxFramebuffer/Mice.cs b/src/Linux/Avalonia.LinuxFramebuffer/Mice.cs index 7e85796c0c..291374a75e 100644 --- a/src/Linux/Avalonia.LinuxFramebuffer/Mice.cs +++ b/src/Linux/Avalonia.LinuxFramebuffer/Mice.cs @@ -1,10 +1,5 @@ using System; -using System.Collections.Generic; -using System.ComponentModel; -using System.IO; using System.Linq; -using System.Runtime.InteropServices; -using System.Text; using System.Threading; using Avalonia.Input; using Avalonia.Input.Raw; diff --git a/src/Linux/Avalonia.LinuxFramebuffer/NativeUnsafeMethods.cs b/src/Linux/Avalonia.LinuxFramebuffer/NativeUnsafeMethods.cs index fbbf036b74..5427af7d44 100644 --- a/src/Linux/Avalonia.LinuxFramebuffer/NativeUnsafeMethods.cs +++ b/src/Linux/Avalonia.LinuxFramebuffer/NativeUnsafeMethods.cs @@ -1,8 +1,8 @@ -using __u32 = System.UInt32; +using System; +using System.Runtime.InteropServices; using __s32 = System.Int32; using __u16 = System.UInt16; -using System; -using System.Runtime.InteropServices; +using __u32 = System.UInt32; // ReSharper disable FieldCanBeMadeReadOnly.Local // ReSharper disable ArrangeTypeMemberModifiers // ReSharper disable BuiltInTypeReferenceStyle @@ -69,7 +69,7 @@ namespace Avalonia.LinuxFramebuffer FB_VBLANK_HAVE_VCOUNT = 0x020 /* the vcount field is valid */, FB_VBLANK_HAVE_HCOUNT = 0x040 /* the hcount field is valid */, FB_VBLANK_VSYNCING = 0x080 /* currently in a vsync */, - FB_VBLANK_HAVE_VSYNC = 0x100 /* verical syncs can be detected */ + FB_VBLANK_HAVE_VSYNC = 0x100 /* vertical syncs can be detected */ } [StructLayout(LayoutKind.Sequential)] @@ -252,4 +252,4 @@ namespace Avalonia.LinuxFramebuffer public __s32 resolution; } -} \ No newline at end of file +} diff --git a/src/Linux/Avalonia.LinuxFramebuffer/Stubs.cs b/src/Linux/Avalonia.LinuxFramebuffer/Stubs.cs index 67d62e3410..7a257da0dd 100644 --- a/src/Linux/Avalonia.LinuxFramebuffer/Stubs.cs +++ b/src/Linux/Avalonia.LinuxFramebuffer/Stubs.cs @@ -1,6 +1,4 @@ using System; -using System.Collections.Generic; -using System.Text; using Avalonia.Input; using Avalonia.Platform; diff --git a/src/Markup/Avalonia.Markup/Data/Binding.cs b/src/Markup/Avalonia.Markup/Data/Binding.cs index cb43873cee..0b85e3224d 100644 --- a/src/Markup/Avalonia.Markup/Data/Binding.cs +++ b/src/Markup/Avalonia.Markup/Data/Binding.cs @@ -322,7 +322,7 @@ namespace Avalonia.Data private IObservable GetParentDataContext(IAvaloniaObject target) { // The DataContext is based on the visual parent and not the logical parent: this may - // seem unintuitive considering the fact that property inheritance works on the logical + // seem counter intuitive considering the fact that property inheritance works on the logical // tree, but consider a ContentControl with a ContentPresenter. The ContentControl's // Content property is bound to a value which becomes the ContentPresenter's // DataContext - it is from this that the child hosted by the ContentPresenter needs to diff --git a/src/Markup/Avalonia.Markup/Data/MultiBinding.cs b/src/Markup/Avalonia.Markup/Data/MultiBinding.cs index a3fa6880ac..4c47ef32e0 100644 --- a/src/Markup/Avalonia.Markup/Data/MultiBinding.cs +++ b/src/Markup/Avalonia.Markup/Data/MultiBinding.cs @@ -6,11 +6,8 @@ using System.Collections.Generic; using System.Globalization; using System.Linq; using System.Reactive.Linq; -using System.Reactive.Subjects; -using Avalonia.Controls; using Avalonia.Data.Converters; using Avalonia.Metadata; -using JetBrains.Annotations; namespace Avalonia.Data { @@ -92,4 +89,4 @@ namespace Avalonia.Data return converted; } } -} \ No newline at end of file +} diff --git a/src/Markup/Avalonia.Markup/Data/RelativeSource.cs b/src/Markup/Avalonia.Markup/Data/RelativeSource.cs index 42b43622da..369bd8112c 100644 --- a/src/Markup/Avalonia.Markup/Data/RelativeSource.cs +++ b/src/Markup/Avalonia.Markup/Data/RelativeSource.cs @@ -21,7 +21,7 @@ namespace Avalonia.Data TemplatedParent, /// - /// The binding will be to the control iself. + /// The binding will be to the control itself. /// Self, @@ -106,4 +106,4 @@ namespace Avalonia.Data public TreeType Tree { get; set; } = TreeType.Visual; } -} \ No newline at end of file +} diff --git a/src/Markup/Avalonia.Markup/Markup/Data/DelayedBinding.cs b/src/Markup/Avalonia.Markup/Markup/Data/DelayedBinding.cs index fb126622c1..e03427c161 100644 --- a/src/Markup/Avalonia.Markup/Markup/Data/DelayedBinding.cs +++ b/src/Markup/Avalonia.Markup/Markup/Data/DelayedBinding.cs @@ -5,7 +5,6 @@ using System; using System.Collections.Generic; using System.Reflection; using System.Runtime.CompilerServices; -using Avalonia.Controls; using Avalonia.Data; using Avalonia.Logging; diff --git a/src/Markup/Avalonia.Markup/Markup/Parsers/ArgumentListParser.cs b/src/Markup/Avalonia.Markup/Markup/Parsers/ArgumentListParser.cs index 23bc463e39..cb9c81caa1 100644 --- a/src/Markup/Avalonia.Markup/Markup/Parsers/ArgumentListParser.cs +++ b/src/Markup/Avalonia.Markup/Markup/Parsers/ArgumentListParser.cs @@ -1,11 +1,9 @@ // Copyright (c) The Avalonia Project. All rights reserved. // Licensed under the MIT license. See licence.md file in the project root for full license information. +using System.Collections.Generic; using Avalonia.Data.Core; using Avalonia.Utilities; -using System; -using System.Collections.Generic; -using System.Text; namespace Avalonia.Markup.Parsers { diff --git a/src/Markup/Avalonia.Markup/Markup/Parsers/ExpressionObserverBuilder.cs b/src/Markup/Avalonia.Markup/Markup/Parsers/ExpressionObserverBuilder.cs index 90627fe14d..8cb14277ff 100644 --- a/src/Markup/Avalonia.Markup/Markup/Parsers/ExpressionObserverBuilder.cs +++ b/src/Markup/Avalonia.Markup/Markup/Parsers/ExpressionObserverBuilder.cs @@ -1,9 +1,7 @@ -using Avalonia.Data.Core; -using Avalonia.Utilities; -using System; -using System.Collections.Generic; +using System; using System.Reactive; -using System.Text; +using Avalonia.Data.Core; +using Avalonia.Utilities; namespace Avalonia.Markup.Parsers { diff --git a/src/Markup/Avalonia.Markup/Markup/Parsers/Nodes/ElementNameNode.cs b/src/Markup/Avalonia.Markup/Markup/Parsers/Nodes/ElementNameNode.cs index bd70c1b222..f09efca7d0 100644 --- a/src/Markup/Avalonia.Markup/Markup/Parsers/Nodes/ElementNameNode.cs +++ b/src/Markup/Avalonia.Markup/Markup/Parsers/Nodes/ElementNameNode.cs @@ -1,6 +1,4 @@ using System; -using System.Collections.Generic; -using System.Text; using Avalonia.Data.Core; using Avalonia.LogicalTree; diff --git a/src/Markup/Avalonia.Markup/Markup/Parsers/Nodes/FindAncestorNode.cs b/src/Markup/Avalonia.Markup/Markup/Parsers/Nodes/FindAncestorNode.cs index 6a5f5a5751..221df44327 100644 --- a/src/Markup/Avalonia.Markup/Markup/Parsers/Nodes/FindAncestorNode.cs +++ b/src/Markup/Avalonia.Markup/Markup/Parsers/Nodes/FindAncestorNode.cs @@ -1,6 +1,4 @@ using System; -using System.Collections.Generic; -using System.Text; using Avalonia.Data.Core; using Avalonia.LogicalTree; diff --git a/src/Markup/Avalonia.Markup/Markup/Parsers/Nodes/SelfNode.cs b/src/Markup/Avalonia.Markup/Markup/Parsers/Nodes/SelfNode.cs index 88163eda44..2cb87efa65 100644 --- a/src/Markup/Avalonia.Markup/Markup/Parsers/Nodes/SelfNode.cs +++ b/src/Markup/Avalonia.Markup/Markup/Parsers/Nodes/SelfNode.cs @@ -1,7 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Text; -using Avalonia.Data.Core; +using Avalonia.Data.Core; namespace Avalonia.Markup.Parsers.Nodes { diff --git a/src/Markup/Avalonia.Markup/Markup/Parsers/Nodes/StringIndexerNode.cs b/src/Markup/Avalonia.Markup/Markup/Parsers/Nodes/StringIndexerNode.cs index b3d0555f14..ea847bde11 100644 --- a/src/Markup/Avalonia.Markup/Markup/Parsers/Nodes/StringIndexerNode.cs +++ b/src/Markup/Avalonia.Markup/Markup/Parsers/Nodes/StringIndexerNode.cs @@ -1,18 +1,17 @@ // Copyright (c) The Avalonia Project. All rights reserved. // Licensed under the MIT license. See licence.md file in the project root for full license information. -using Avalonia.Utilities; using System; using System.Collections; using System.Collections.Generic; -using System.Collections.Specialized; using System.ComponentModel; using System.Globalization; using System.Linq; -using System.Reflection; using System.Reactive.Linq; +using System.Reflection; using Avalonia.Data; using Avalonia.Data.Core; +using Avalonia.Utilities; namespace Avalonia.Markup.Parsers.Nodes { @@ -51,7 +50,7 @@ namespace Avalonia.Markup.Parsers.Nodes var intArgs = convertedObjectArray.OfType().ToArray(); - // Try special cases where we can validate indicies + // Try special cases where we can validate indices if (typeInfo.IsArray) { return SetValueInArray((Array)Target.Target, intArgs, value); @@ -114,11 +113,11 @@ namespace Avalonia.Markup.Parsers.Nodes } - private bool SetValueInArray(Array array, int[] indicies, object value) + private bool SetValueInArray(Array array, int[] indices, object value) { - if (ValidBounds(indicies, array)) + if (ValidBounds(indices, array)) { - array.SetValue(value, indicies); + array.SetValue(value, indices); return true; } return false; @@ -155,7 +154,7 @@ namespace Avalonia.Markup.Parsers.Nodes var intArgs = convertedObjectArray.OfType().ToArray(); - // Try special cases where we can validate indicies + // Try special cases where we can validate indices if (typeInfo.IsArray) { return GetValueFromArray((Array)target, intArgs); @@ -210,11 +209,11 @@ namespace Avalonia.Markup.Parsers.Nodes return GetValueFromArray(array, intArgs); } - private object GetValueFromArray(Array array, int[] indicies) + private object GetValueFromArray(Array array, int[] indices) { - if (ValidBounds(indicies, array)) + if (ValidBounds(indices, array)) { - return array.GetValue(indicies); + return array.GetValue(indices); } return AvaloniaProperty.UnsetValue; } @@ -262,13 +261,13 @@ namespace Avalonia.Markup.Parsers.Nodes return null; } - private bool ValidBounds(int[] indicies, Array array) + private bool ValidBounds(int[] indices, Array array) { - if (indicies.Length == array.Rank) + if (indices.Length == array.Rank) { - for (var i = 0; i < indicies.Length; ++i) + for (var i = 0; i < indices.Length; ++i) { - if (indicies[i] >= array.GetLength(i)) + if (indices[i] >= array.GetLength(i)) { return false; } diff --git a/src/Markup/Avalonia.Markup/Markup/Parsers/SelectorGrammar.cs b/src/Markup/Avalonia.Markup/Markup/Parsers/SelectorGrammar.cs index 214e61ae37..f66d3e51fc 100644 --- a/src/Markup/Avalonia.Markup/Markup/Parsers/SelectorGrammar.cs +++ b/src/Markup/Avalonia.Markup/Markup/Parsers/SelectorGrammar.cs @@ -3,7 +3,6 @@ using System; using System.Collections.Generic; -using System.Globalization; using Avalonia.Data.Core; using Avalonia.Utilities; diff --git a/src/Markup/Avalonia.Markup/Markup/Parsers/SelectorParser.cs b/src/Markup/Avalonia.Markup/Markup/Parsers/SelectorParser.cs index 94ce61b5c3..bf5b396bec 100644 --- a/src/Markup/Avalonia.Markup/Markup/Parsers/SelectorParser.cs +++ b/src/Markup/Avalonia.Markup/Markup/Parsers/SelectorParser.cs @@ -2,9 +2,7 @@ // Licensed under the MIT license. See licence.md file in the project root for full license information. using System; -using System.Collections.Generic; using System.Globalization; -using Avalonia.Data.Core; using Avalonia.Styling; using Avalonia.Utilities; diff --git a/src/OSX/Avalonia.MonoMac/ClipboardImpl.cs b/src/OSX/Avalonia.MonoMac/ClipboardImpl.cs index 29eb3720ec..475083b469 100644 --- a/src/OSX/Avalonia.MonoMac/ClipboardImpl.cs +++ b/src/OSX/Avalonia.MonoMac/ClipboardImpl.cs @@ -1,7 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Text; -using System.Threading.Tasks; +using System.Threading.Tasks; using Avalonia.Input.Platform; using MonoMac.AppKit; diff --git a/src/OSX/Avalonia.MonoMac/Cursor.cs b/src/OSX/Avalonia.MonoMac/Cursor.cs index d9370e527b..fff2d92e63 100644 --- a/src/OSX/Avalonia.MonoMac/Cursor.cs +++ b/src/OSX/Avalonia.MonoMac/Cursor.cs @@ -63,4 +63,4 @@ namespace Avalonia.MonoMac return new Cursor(_cache[cursorType]); } } -} \ No newline at end of file +} diff --git a/src/OSX/Avalonia.MonoMac/DragSource.cs b/src/OSX/Avalonia.MonoMac/DragSource.cs index 41a206b580..5d799d3fbe 100644 --- a/src/OSX/Avalonia.MonoMac/DragSource.cs +++ b/src/OSX/Avalonia.MonoMac/DragSource.cs @@ -1,23 +1,18 @@ using System; using System.Collections.Generic; -using System.Data; using System.IO; using System.Linq; -using System.Linq.Expressions; using System.Reactive.Linq; using System.Reactive.Subjects; -using System.Runtime.InteropServices; using System.Runtime.Serialization.Formatters.Binary; using System.Threading.Tasks; using Avalonia.Controls; using Avalonia.Input; using Avalonia.Input.Platform; using Avalonia.Input.Raw; -using MonoMac; using MonoMac.AppKit; using MonoMac.CoreGraphics; using MonoMac.Foundation; -using MonoMac.OpenGL; namespace Avalonia.MonoMac { @@ -121,4 +116,4 @@ namespace Avalonia.MonoMac _result.OnCompleted(); } } -} \ No newline at end of file +} diff --git a/src/OSX/Avalonia.MonoMac/DraggingInfo.cs b/src/OSX/Avalonia.MonoMac/DraggingInfo.cs index fc5f52713e..5ea7169a1e 100644 --- a/src/OSX/Avalonia.MonoMac/DraggingInfo.cs +++ b/src/OSX/Avalonia.MonoMac/DraggingInfo.cs @@ -1,5 +1,4 @@ -using System; -using System.Collections.Generic; +using System.Collections.Generic; using System.Linq; using Avalonia.Input; using MonoMac.AppKit; @@ -87,4 +86,4 @@ namespace Avalonia.MonoMac return _info.DraggingPasteboard.GetDataForType(dataFormat).ToArray(); } } -} \ No newline at end of file +} diff --git a/src/OSX/Avalonia.MonoMac/EmulatedFramebuffer.cs b/src/OSX/Avalonia.MonoMac/EmulatedFramebuffer.cs index 6cd2b16afa..4da67ae1dd 100644 --- a/src/OSX/Avalonia.MonoMac/EmulatedFramebuffer.cs +++ b/src/OSX/Avalonia.MonoMac/EmulatedFramebuffer.cs @@ -1,8 +1,8 @@ using System; -using Avalonia.Platform; -using MonoMac.AppKit; using System.Runtime.InteropServices; +using Avalonia.Platform; using Avalonia.Threading; +using MonoMac.AppKit; using MonoMac.CoreGraphics; namespace Avalonia.MonoMac @@ -103,4 +103,4 @@ namespace Avalonia.MonoMac Image = null; } } -} \ No newline at end of file +} diff --git a/src/OSX/Avalonia.MonoMac/Helpers.cs b/src/OSX/Avalonia.MonoMac/Helpers.cs index 454b775cc0..527eccafdc 100644 --- a/src/OSX/Avalonia.MonoMac/Helpers.cs +++ b/src/OSX/Avalonia.MonoMac/Helpers.cs @@ -1,8 +1,6 @@ -using System; - using System.ComponentModel; - using MonoMac.AppKit; - using MonoMac.CoreGraphics; - using MonoMac.OpenGL; +using System; +using MonoMac.AppKit; +using MonoMac.CoreGraphics; namespace Avalonia.MonoMac { diff --git a/src/OSX/Avalonia.MonoMac/PlatformThreadingInterface.cs b/src/OSX/Avalonia.MonoMac/PlatformThreadingInterface.cs index b02a3192de..04a36d9f0f 100644 --- a/src/OSX/Avalonia.MonoMac/PlatformThreadingInterface.cs +++ b/src/OSX/Avalonia.MonoMac/PlatformThreadingInterface.cs @@ -3,7 +3,6 @@ using System.Threading; using Avalonia.Platform; using Avalonia.Threading; using MonoMac.AppKit; -using MonoMac.CoreFoundation; using MonoMac.CoreGraphics; using MonoMac.Foundation; using MonoMac.ObjCRuntime; diff --git a/src/OSX/Avalonia.MonoMac/RenderLoop.cs b/src/OSX/Avalonia.MonoMac/RenderLoop.cs index a6f3e9f493..4d1f9b4201 100644 --- a/src/OSX/Avalonia.MonoMac/RenderLoop.cs +++ b/src/OSX/Avalonia.MonoMac/RenderLoop.cs @@ -1,6 +1,4 @@ using System; -using System.Collections.Generic; -using System.Text; using Avalonia.Platform; using Avalonia.Rendering; using MonoMac.Foundation; diff --git a/src/OSX/Avalonia.MonoMac/ScreenImpl.cs b/src/OSX/Avalonia.MonoMac/ScreenImpl.cs index bf8545a300..46cd200cab 100644 --- a/src/OSX/Avalonia.MonoMac/ScreenImpl.cs +++ b/src/OSX/Avalonia.MonoMac/ScreenImpl.cs @@ -1,6 +1,4 @@ -using Avalonia.Controls; -using Avalonia.Platform; -using Avalonia.Utilities; +using Avalonia.Platform; using MonoMac.AppKit; using MonoMac.Foundation; @@ -48,4 +46,4 @@ namespace Avalonia.MonoMac _allScreens = null; } } -} \ No newline at end of file +} diff --git a/src/OSX/Avalonia.MonoMac/Stubs.cs b/src/OSX/Avalonia.MonoMac/Stubs.cs index f3ff6a260c..188ceeaab1 100644 --- a/src/OSX/Avalonia.MonoMac/Stubs.cs +++ b/src/OSX/Avalonia.MonoMac/Stubs.cs @@ -44,4 +44,4 @@ namespace Avalonia.MonoMac return LoadIcon(ms); } } -} \ No newline at end of file +} diff --git a/src/OSX/Avalonia.MonoMac/SystemDialogsImpl.cs b/src/OSX/Avalonia.MonoMac/SystemDialogsImpl.cs index 16a0b25ef1..382311e28a 100644 --- a/src/OSX/Avalonia.MonoMac/SystemDialogsImpl.cs +++ b/src/OSX/Avalonia.MonoMac/SystemDialogsImpl.cs @@ -1,7 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; +using System.Linq; using System.Threading.Tasks; using Avalonia.Controls; using Avalonia.Controls.Platform; diff --git a/src/OSX/Avalonia.MonoMac/TopLevelImpl.cs b/src/OSX/Avalonia.MonoMac/TopLevelImpl.cs index b528d84e4c..fb4c5afc2d 100644 --- a/src/OSX/Avalonia.MonoMac/TopLevelImpl.cs +++ b/src/OSX/Avalonia.MonoMac/TopLevelImpl.cs @@ -1,13 +1,12 @@ using System; using System.Collections.Generic; +using Avalonia.Controls.Platform.Surfaces; using Avalonia.Input; using Avalonia.Input.Raw; using Avalonia.Platform; -using Avalonia.Controls.Platform.Surfaces; using Avalonia.Rendering; using Avalonia.Threading; using MonoMac.AppKit; -using MonoMac.CoreFoundation; using MonoMac.CoreGraphics; using MonoMac.Foundation; using MonoMac.ObjCRuntime; @@ -503,4 +502,4 @@ namespace Avalonia.MonoMac public ILockedFramebuffer Lock() => new EmulatedFramebuffer(View); } -} \ No newline at end of file +} diff --git a/src/OSX/Avalonia.MonoMac/WindowImpl.cs b/src/OSX/Avalonia.MonoMac/WindowImpl.cs index 89b5550688..f276e07c99 100644 --- a/src/OSX/Avalonia.MonoMac/WindowImpl.cs +++ b/src/OSX/Avalonia.MonoMac/WindowImpl.cs @@ -1,9 +1,9 @@ using System; using Avalonia.Controls; using Avalonia.Platform; +using Avalonia.Threading; using MonoMac.AppKit; using MonoMac.CoreGraphics; -using Avalonia.Threading; namespace Avalonia.MonoMac { diff --git a/src/Shared/PlatformSupport/AssetLoader.cs b/src/Shared/PlatformSupport/AssetLoader.cs index b4d17b22a1..d73c98415e 100644 --- a/src/Shared/PlatformSupport/AssetLoader.cs +++ b/src/Shared/PlatformSupport/AssetLoader.cs @@ -119,7 +119,7 @@ namespace Avalonia.Shared.PlatformSupport { throw new ArgumentException( "No default assembly, entry assembly or explicit assembly specified; " + - "don't know where to look up for the resource, try specifiyng assembly explicitly."); + "don't know where to look up for the resource, try specifying assembly explicitly."); } IAssetDescriptor rv; @@ -233,4 +233,4 @@ namespace Avalonia.Shared.PlatformSupport public string Name { get; } } } -} \ No newline at end of file +} diff --git a/src/Shared/PlatformSupport/StandardRuntimePlatform.cs b/src/Shared/PlatformSupport/StandardRuntimePlatform.cs index 16977d5f97..beed847539 100644 --- a/src/Shared/PlatformSupport/StandardRuntimePlatform.cs +++ b/src/Shared/PlatformSupport/StandardRuntimePlatform.cs @@ -4,7 +4,6 @@ using System; using System.Collections.Generic; using System.Reflection; -using System.Resources; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Threading; diff --git a/src/Shared/PlatformSupport/StandardRuntimePlatformServices.cs b/src/Shared/PlatformSupport/StandardRuntimePlatformServices.cs index 70601fdf4a..9ccf097ffd 100644 --- a/src/Shared/PlatformSupport/StandardRuntimePlatformServices.cs +++ b/src/Shared/PlatformSupport/StandardRuntimePlatformServices.cs @@ -1,7 +1,4 @@ -using System; -using System.Collections.Generic; using System.Reflection; -using System.Text; using Avalonia.Platform; namespace Avalonia.Shared.PlatformSupport diff --git a/src/Shared/RenderHelpers/ArcToHelper.cs b/src/Shared/RenderHelpers/ArcToHelper.cs index 2457606f9d..8445da8dd5 100644 --- a/src/Shared/RenderHelpers/ArcToHelper.cs +++ b/src/Shared/RenderHelpers/ArcToHelper.cs @@ -595,7 +595,7 @@ namespace Avalonia.RenderHelpers double cos4 = Math.Cos(4 * eta); double cos6 = Math.Cos(6 * eta); - // select the right coeficients set according to degree and b/a + // select the right coefficients set according to degree and b/a double[][][] coeffs; double[] safety; if (degree == 2) @@ -654,7 +654,7 @@ namespace Avalonia.RenderHelpers if (IsPieSlice) { // check the location of the test point with respect to the - // angular sector counted from the centre of the ellipse + // angular sector counted from the center of the ellipse double dxC = x - Cx; double dyC = y - Cy; double u = dxC * _cosTheta + dyC * _sinTheta; diff --git a/src/Shared/WindowResizeDragHelper.cs b/src/Shared/WindowResizeDragHelper.cs index c133e493fa..e0e0936b69 100644 --- a/src/Shared/WindowResizeDragHelper.cs +++ b/src/Shared/WindowResizeDragHelper.cs @@ -1,6 +1,5 @@ using System; using Avalonia.Controls; -using Avalonia.Input; using Avalonia.Input.Raw; using Avalonia.Platform; @@ -82,4 +81,4 @@ namespace Avalonia } } } -} \ No newline at end of file +} diff --git a/src/Skia/Avalonia.Skia/FormattedTextImpl.cs b/src/Skia/Avalonia.Skia/FormattedTextImpl.cs index d835c83aa6..2a8f517995 100644 --- a/src/Skia/Avalonia.Skia/FormattedTextImpl.cs +++ b/src/Skia/Avalonia.Skia/FormattedTextImpl.cs @@ -1,12 +1,12 @@ // Copyright (c) The Avalonia Project. All rights reserved. // Licensed under the MIT license. See licence.md file in the project root for full license information. -using Avalonia.Media; -using Avalonia.Platform; -using SkiaSharp; using System; using System.Collections.Generic; using System.Linq; +using Avalonia.Media; +using Avalonia.Platform; +using SkiaSharp; namespace Avalonia.Skia { @@ -723,4 +723,4 @@ namespace Avalonia.Skia } } } -} \ No newline at end of file +} diff --git a/src/Skia/Avalonia.Skia/FramebufferRenderTarget.cs b/src/Skia/Avalonia.Skia/FramebufferRenderTarget.cs index 99dbbefd4d..829b9097c9 100644 --- a/src/Skia/Avalonia.Skia/FramebufferRenderTarget.cs +++ b/src/Skia/Avalonia.Skia/FramebufferRenderTarget.cs @@ -6,7 +6,6 @@ using System.Reactive.Disposables; using Avalonia.Controls.Platform.Surfaces; using Avalonia.Platform; using Avalonia.Rendering; -using Avalonia.Skia.Helpers; using SkiaSharp; namespace Avalonia.Skia @@ -95,7 +94,7 @@ namespace Avalonia.Skia var surface = SKSurface.Create(desiredImageInfo, _currentFramebufferAddress, framebuffer.RowBytes); - // If surface cannot be created - try to create a compatibilty shim first + // If surface cannot be created - try to create a compatibility shim first if (surface == null) { _conversionShim = new PixelFormatConversionShim(desiredImageInfo, framebuffer.Address); @@ -196,4 +195,4 @@ namespace Avalonia.Skia } } } -} \ No newline at end of file +} diff --git a/src/Skia/Avalonia.Skia/GeometryImpl.cs b/src/Skia/Avalonia.Skia/GeometryImpl.cs index af4cdb8056..fbbd6eb58c 100644 --- a/src/Skia/Avalonia.Skia/GeometryImpl.cs +++ b/src/Skia/Avalonia.Skia/GeometryImpl.cs @@ -108,7 +108,7 @@ namespace Avalonia.Skia } /// - /// Invalidate all caches. Call after chaning path contents. + /// Invalidate all caches. Call after chaining path contents. /// protected void InvalidateCaches() { diff --git a/src/Skia/Avalonia.Skia/Helpers/PixelFormatHelper.cs b/src/Skia/Avalonia.Skia/Helpers/PixelFormatHelper.cs index 307af708af..04756994f5 100644 --- a/src/Skia/Avalonia.Skia/Helpers/PixelFormatHelper.cs +++ b/src/Skia/Avalonia.Skia/Helpers/PixelFormatHelper.cs @@ -32,4 +32,4 @@ namespace Avalonia.Skia.Helpers return colorType; } } -} \ No newline at end of file +} diff --git a/src/Skia/Avalonia.Skia/IDrawableBitmapImpl.cs b/src/Skia/Avalonia.Skia/IDrawableBitmapImpl.cs index 5aa5de2abc..f900e7af77 100644 --- a/src/Skia/Avalonia.Skia/IDrawableBitmapImpl.cs +++ b/src/Skia/Avalonia.Skia/IDrawableBitmapImpl.cs @@ -20,4 +20,4 @@ namespace Avalonia.Skia /// Paint to use. void Draw(DrawingContextImpl context, SKRect sourceRect, SKRect destRect, SKPaint paint); } -} \ No newline at end of file +} diff --git a/src/Skia/Avalonia.Skia/SKTypefaceCollection.cs b/src/Skia/Avalonia.Skia/SKTypefaceCollection.cs index bd951ef3a3..687fe7feca 100644 --- a/src/Skia/Avalonia.Skia/SKTypefaceCollection.cs +++ b/src/Skia/Avalonia.Skia/SKTypefaceCollection.cs @@ -71,4 +71,4 @@ namespace Avalonia.Skia } } } -} \ No newline at end of file +} diff --git a/src/Skia/Avalonia.Skia/SKTypefaceCollectionCache.cs b/src/Skia/Avalonia.Skia/SKTypefaceCollectionCache.cs index dc533cbf3c..b9a8c9b98b 100644 --- a/src/Skia/Avalonia.Skia/SKTypefaceCollectionCache.cs +++ b/src/Skia/Avalonia.Skia/SKTypefaceCollectionCache.cs @@ -50,4 +50,4 @@ namespace Avalonia.Skia return typeFaceCollection; } } -} \ No newline at end of file +} diff --git a/src/Skia/Avalonia.Skia/SkiaApplicationExtensions.cs b/src/Skia/Avalonia.Skia/SkiaApplicationExtensions.cs index 0086671880..f4412df473 100644 --- a/src/Skia/Avalonia.Skia/SkiaApplicationExtensions.cs +++ b/src/Skia/Avalonia.Skia/SkiaApplicationExtensions.cs @@ -8,7 +8,7 @@ using Avalonia.Skia; namespace Avalonia { /// - /// Skia appication extensions. + /// Skia application extensions. /// public static class SkiaApplicationExtensions { @@ -17,7 +17,6 @@ namespace Avalonia /// /// Builder type. /// Builder. - /// Preferred backend type. /// Configure builder. public static T UseSkia(this T builder) where T : AppBuilderBase, new() { @@ -25,4 +24,4 @@ namespace Avalonia return builder; } } -} \ No newline at end of file +} diff --git a/src/Skia/Avalonia.Skia/SkiaPlatform.cs b/src/Skia/Avalonia.Skia/SkiaPlatform.cs index 06679478cb..a9d69aea31 100644 --- a/src/Skia/Avalonia.Skia/SkiaPlatform.cs +++ b/src/Skia/Avalonia.Skia/SkiaPlatform.cs @@ -1,8 +1,6 @@ // Copyright (c) The Avalonia Project. All rights reserved. // Licensed under the MIT license. See licence.md file in the project root for full license information. -using System; -using Avalonia.Logging; using Avalonia.Platform; namespace Avalonia.Skia diff --git a/src/Skia/Avalonia.Skia/TypefaceCache.cs b/src/Skia/Avalonia.Skia/TypefaceCache.cs index f85dd84055..cf862f3400 100644 --- a/src/Skia/Avalonia.Skia/TypefaceCache.cs +++ b/src/Skia/Avalonia.Skia/TypefaceCache.cs @@ -1,9 +1,7 @@ // Copyright (c) The Avalonia Project. All rights reserved. // Licensed under the MIT license. See licence.md file in the project root for full license information. -using System; using System.Collections.Generic; -using System.Linq; using Avalonia.Media; using SkiaSharp; @@ -94,4 +92,4 @@ namespace Avalonia.Skia } } -} \ No newline at end of file +} diff --git a/src/Windows/Avalonia.Direct2D1/Direct2D1Platform.cs b/src/Windows/Avalonia.Direct2D1/Direct2D1Platform.cs index 296edcb2d9..81a70f8311 100644 --- a/src/Windows/Avalonia.Direct2D1/Direct2D1Platform.cs +++ b/src/Windows/Avalonia.Direct2D1/Direct2D1Platform.cs @@ -4,14 +4,12 @@ using System; using System.Collections.Generic; using System.IO; -using System.Linq; -using Avalonia.Direct2D1.Media; -using Avalonia.Media; -using Avalonia.Platform; using Avalonia.Controls; using Avalonia.Controls.Platform.Surfaces; +using Avalonia.Direct2D1.Media; using Avalonia.Direct2D1.Media.Imaging; -using Avalonia.Rendering; +using Avalonia.Media; +using Avalonia.Platform; namespace Avalonia { @@ -193,4 +191,4 @@ namespace Avalonia.Direct2D1 return new WicBitmapImpl(s_imagingFactory, format, data, width, height, stride); } } -} \ No newline at end of file +} diff --git a/src/Windows/Avalonia.Direct2D1/Direct2DChecker.cs b/src/Windows/Avalonia.Direct2D1/Direct2DChecker.cs index e7e27493e5..d1233ca4e7 100644 --- a/src/Windows/Avalonia.Direct2D1/Direct2DChecker.cs +++ b/src/Windows/Avalonia.Direct2D1/Direct2DChecker.cs @@ -1,9 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using Avalonia.Platform; +using Avalonia.Platform; namespace Avalonia.Direct2D1 { diff --git a/src/Windows/Avalonia.Direct2D1/ExternalRenderTarget.cs b/src/Windows/Avalonia.Direct2D1/ExternalRenderTarget.cs index 176cedd377..ac18d0943b 100644 --- a/src/Windows/Avalonia.Direct2D1/ExternalRenderTarget.cs +++ b/src/Windows/Avalonia.Direct2D1/ExternalRenderTarget.cs @@ -1,5 +1,4 @@ -using System; -using Avalonia.Direct2D1.Media; +using Avalonia.Direct2D1.Media; using Avalonia.Direct2D1.Media.Imaging; using Avalonia.Platform; using Avalonia.Rendering; diff --git a/src/Windows/Avalonia.Direct2D1/FramebufferShimRenderTarget.cs b/src/Windows/Avalonia.Direct2D1/FramebufferShimRenderTarget.cs index 523cfeed46..83ce571152 100644 --- a/src/Windows/Avalonia.Direct2D1/FramebufferShimRenderTarget.cs +++ b/src/Windows/Avalonia.Direct2D1/FramebufferShimRenderTarget.cs @@ -1,10 +1,6 @@ using System; -using System.Collections.Generic; -using System.Runtime.CompilerServices; -using System.Text; using Avalonia.Controls.Platform.Surfaces; using Avalonia.Direct2D1.Media; -using Avalonia.Direct2D1.Media.Imaging; using Avalonia.Platform; using Avalonia.Rendering; using Avalonia.Win32.Interop; diff --git a/src/Windows/Avalonia.Direct2D1/HwndRenderTarget.cs b/src/Windows/Avalonia.Direct2D1/HwndRenderTarget.cs index 49402d54b9..dc6d8ea016 100644 --- a/src/Windows/Avalonia.Direct2D1/HwndRenderTarget.cs +++ b/src/Windows/Avalonia.Direct2D1/HwndRenderTarget.cs @@ -1,10 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using Avalonia.Controls.Platform.Surfaces; -using Avalonia.Platform; +using Avalonia.Platform; using Avalonia.Win32.Interop; using SharpDX; using SharpDX.DXGI; diff --git a/src/Windows/Avalonia.Direct2D1/IExternalDirect2DRenderTargetSurface.cs b/src/Windows/Avalonia.Direct2D1/IExternalDirect2DRenderTargetSurface.cs index aad51f46d5..9c7d74ff68 100644 --- a/src/Windows/Avalonia.Direct2D1/IExternalDirect2DRenderTargetSurface.cs +++ b/src/Windows/Avalonia.Direct2D1/IExternalDirect2DRenderTargetSurface.cs @@ -1,10 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace Avalonia.Direct2D1 +namespace Avalonia.Direct2D1 { public interface IExternalDirect2DRenderTargetSurface { diff --git a/src/Windows/Avalonia.Direct2D1/ILayerFactory.cs b/src/Windows/Avalonia.Direct2D1/ILayerFactory.cs index 99f8d4f7ac..08273f1bb2 100644 --- a/src/Windows/Avalonia.Direct2D1/ILayerFactory.cs +++ b/src/Windows/Avalonia.Direct2D1/ILayerFactory.cs @@ -1,5 +1,4 @@ -using System; -using Avalonia.Platform; +using Avalonia.Platform; namespace Avalonia.Direct2D1 { diff --git a/src/Windows/Avalonia.Direct2D1/Media/DWriteResourceFontFileStream.cs b/src/Windows/Avalonia.Direct2D1/Media/DWriteResourceFontFileStream.cs index 1b1cb85495..1802ef4d21 100644 --- a/src/Windows/Avalonia.Direct2D1/Media/DWriteResourceFontFileStream.cs +++ b/src/Windows/Avalonia.Direct2D1/Media/DWriteResourceFontFileStream.cs @@ -5,7 +5,7 @@ using SharpDX.DirectWrite; namespace Avalonia.Direct2D1.Media { /// - /// This FontFileStream implem is reading data from a . + /// This FontFileStream implementation is reading data from a . /// public class DWriteResourceFontFileStream : CallbackBase, FontFileStream { @@ -81,4 +81,4 @@ namespace Avalonia.Direct2D1.Media return 0; } } -} \ No newline at end of file +} diff --git a/src/Windows/Avalonia.Direct2D1/Media/DWriteResourceFontLoader.cs b/src/Windows/Avalonia.Direct2D1/Media/DWriteResourceFontLoader.cs index 065da8d3e8..e5f87e71a2 100644 --- a/src/Windows/Avalonia.Direct2D1/Media/DWriteResourceFontLoader.cs +++ b/src/Windows/Avalonia.Direct2D1/Media/DWriteResourceFontLoader.cs @@ -1,5 +1,4 @@ using System.Collections.Generic; -using Avalonia.Media.Fonts; using Avalonia.Platform; using SharpDX; using SharpDX.DirectWrite; @@ -96,4 +95,4 @@ namespace Avalonia.Direct2D1.Media return _fontStreams[index]; } } -} \ No newline at end of file +} diff --git a/src/Windows/Avalonia.Direct2D1/Media/Imaging/D2DBitmapImpl.cs b/src/Windows/Avalonia.Direct2D1/Media/Imaging/D2DBitmapImpl.cs index 6713cb13be..3835cd16da 100644 --- a/src/Windows/Avalonia.Direct2D1/Media/Imaging/D2DBitmapImpl.cs +++ b/src/Windows/Avalonia.Direct2D1/Media/Imaging/D2DBitmapImpl.cs @@ -1,10 +1,10 @@ using System; using System.IO; using SharpDX.Direct2D1; -using WICFactory = SharpDX.WIC.ImagingFactory; -using ImagingFactory2 = SharpDX.WIC.ImagingFactory2; using ImageParameters = SharpDX.WIC.ImageParameters; +using ImagingFactory2 = SharpDX.WIC.ImagingFactory2; using PngBitmapEncoder = SharpDX.WIC.PngBitmapEncoder; +using WICFactory = SharpDX.WIC.ImagingFactory; namespace Avalonia.Direct2D1.Media { diff --git a/src/Windows/Avalonia.Direct2D1/Media/Imaging/D2DRenderTargetBitmapImpl.cs b/src/Windows/Avalonia.Direct2D1/Media/Imaging/D2DRenderTargetBitmapImpl.cs index 2843848fac..18a746436c 100644 --- a/src/Windows/Avalonia.Direct2D1/Media/Imaging/D2DRenderTargetBitmapImpl.cs +++ b/src/Windows/Avalonia.Direct2D1/Media/Imaging/D2DRenderTargetBitmapImpl.cs @@ -1,5 +1,4 @@ -using System; -using Avalonia.Platform; +using Avalonia.Platform; using Avalonia.Rendering; using SharpDX; using SharpDX.Direct2D1; diff --git a/src/Windows/Avalonia.Direct2D1/Media/Imaging/WicBitmapImpl.cs b/src/Windows/Avalonia.Direct2D1/Media/Imaging/WicBitmapImpl.cs index 371dfcfc3e..ef2177b167 100644 --- a/src/Windows/Avalonia.Direct2D1/Media/Imaging/WicBitmapImpl.cs +++ b/src/Windows/Avalonia.Direct2D1/Media/Imaging/WicBitmapImpl.cs @@ -3,7 +3,6 @@ using System; using System.IO; -using System.Runtime.CompilerServices; using Avalonia.Win32.Interop; using SharpDX.WIC; using APixelFormat = Avalonia.Platform.PixelFormat; diff --git a/src/Windows/Avalonia.Direct2D1/Media/Imaging/WriteableWicBitmapImpl.cs b/src/Windows/Avalonia.Direct2D1/Media/Imaging/WriteableWicBitmapImpl.cs index fc931c32db..cf7759af28 100644 --- a/src/Windows/Avalonia.Direct2D1/Media/Imaging/WriteableWicBitmapImpl.cs +++ b/src/Windows/Avalonia.Direct2D1/Media/Imaging/WriteableWicBitmapImpl.cs @@ -1,8 +1,4 @@ using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; using Avalonia.Platform; using SharpDX.WIC; using PixelFormat = Avalonia.Platform.PixelFormat; diff --git a/src/Windows/Avalonia.Direct2D1/Media/StreamGeometryContextImpl.cs b/src/Windows/Avalonia.Direct2D1/Media/StreamGeometryContextImpl.cs index 4228745d6b..10b89d79b8 100644 --- a/src/Windows/Avalonia.Direct2D1/Media/StreamGeometryContextImpl.cs +++ b/src/Windows/Avalonia.Direct2D1/Media/StreamGeometryContextImpl.cs @@ -1,13 +1,13 @@ // Copyright (c) The Avalonia Project. All rights reserved. // Licensed under the MIT license. See licence.md file in the project root for full license information. +using System; +using Avalonia.Logging; using Avalonia.Media; using Avalonia.Platform; using SharpDX.Direct2D1; -using SweepDirection = SharpDX.Direct2D1.SweepDirection; using D2D = SharpDX.Direct2D1; -using Avalonia.Logging; -using System; +using SweepDirection = SharpDX.Direct2D1.SweepDirection; namespace Avalonia.Direct2D1.Media { diff --git a/src/Windows/Avalonia.Direct2D1/RenderTarget.cs b/src/Windows/Avalonia.Direct2D1/RenderTarget.cs index 6086b0c67c..f2a83d78e8 100644 --- a/src/Windows/Avalonia.Direct2D1/RenderTarget.cs +++ b/src/Windows/Avalonia.Direct2D1/RenderTarget.cs @@ -1,7 +1,6 @@ // Copyright (c) The Avalonia Project. All rights reserved. // Licensed under the MIT license. See licence.md file in the project root for full license information. -using System; using Avalonia.Direct2D1.Media; using Avalonia.Direct2D1.Media.Imaging; using Avalonia.Platform; diff --git a/src/Windows/Avalonia.Direct2D1/SwapChainRenderTarget.cs b/src/Windows/Avalonia.Direct2D1/SwapChainRenderTarget.cs index 0a23c63498..102e166433 100644 --- a/src/Windows/Avalonia.Direct2D1/SwapChainRenderTarget.cs +++ b/src/Windows/Avalonia.Direct2D1/SwapChainRenderTarget.cs @@ -1,16 +1,15 @@ -using System; +using Avalonia.Direct2D1.Media; +using Avalonia.Direct2D1.Media.Imaging; using Avalonia.Platform; +using Avalonia.Rendering; using SharpDX; using SharpDX.Direct2D1; using SharpDX.DXGI; -using PixelFormat = SharpDX.Direct2D1.PixelFormat; using AlphaMode = SharpDX.Direct2D1.AlphaMode; using Device = SharpDX.Direct2D1.Device; using Factory = SharpDX.Direct2D1.Factory; using Factory2 = SharpDX.DXGI.Factory2; -using Avalonia.Rendering; -using Avalonia.Direct2D1.Media; -using Avalonia.Direct2D1.Media.Imaging; +using PixelFormat = SharpDX.Direct2D1.PixelFormat; namespace Avalonia.Direct2D1 { @@ -119,7 +118,7 @@ namespace Avalonia.Direct2D1 new BitmapProperties1( new PixelFormat { - AlphaMode = AlphaMode.Ignore, + AlphaMode = AlphaMode.Premultiplied, Format = Format.B8G8R8A8_UNorm }, _savedDpi.Width, diff --git a/src/Windows/Avalonia.Win32.Interop/Wpf/CursorShim.cs b/src/Windows/Avalonia.Win32.Interop/Wpf/CursorShim.cs index 6ae898ae3d..2ad6287689 100644 --- a/src/Windows/Avalonia.Win32.Interop/Wpf/CursorShim.cs +++ b/src/Windows/Avalonia.Win32.Interop/Wpf/CursorShim.cs @@ -1,11 +1,8 @@ using System; -using System.Collections.Generic; using System.Linq; using System.Reflection; using System.Runtime.InteropServices; using System.Runtime.Serialization; -using System.Text; -using System.Threading.Tasks; using System.Windows.Input; namespace Avalonia.Win32.Interop.Wpf diff --git a/src/Windows/Avalonia.Win32.Interop/Wpf/Direct2DImageSurface.cs b/src/Windows/Avalonia.Win32.Interop/Wpf/Direct2DImageSurface.cs index 8fe7275a0f..400dd59ea9 100644 --- a/src/Windows/Avalonia.Win32.Interop/Wpf/Direct2DImageSurface.cs +++ b/src/Windows/Avalonia.Win32.Interop/Wpf/Direct2DImageSurface.cs @@ -1,13 +1,8 @@ using System; -using System.Collections.Generic; -using System.Linq; using System.Runtime.InteropServices; -using System.Text; -using System.Threading.Tasks; using System.Windows; using System.Windows.Interop; using Avalonia.Direct2D1; -using SharpDX; using SharpDX.Direct2D1; using SharpDX.Direct3D11; using SharpDX.Direct3D9; @@ -15,13 +10,10 @@ using SharpDX.DXGI; using AlphaMode = SharpDX.Direct2D1.AlphaMode; using Device = SharpDX.Direct3D11.Device; using Format = SharpDX.DXGI.Format; -using MapFlags = SharpDX.Direct3D11.MapFlags; -using PresentParameters = SharpDX.DXGI.PresentParameters; using Query = SharpDX.Direct3D11.Query; using QueryType = SharpDX.Direct3D11.QueryType; using RenderTarget = SharpDX.Direct2D1.RenderTarget; using Surface = SharpDX.DXGI.Surface; -using SwapEffect = SharpDX.DXGI.SwapEffect; using Usage = SharpDX.Direct3D9.Usage; namespace Avalonia.Win32.Interop.Wpf diff --git a/src/Windows/Avalonia.Win32.Interop/Wpf/IntSize.cs b/src/Windows/Avalonia.Win32.Interop/Wpf/IntSize.cs index 3fdbdedfd9..b8648dfc50 100644 --- a/src/Windows/Avalonia.Win32.Interop/Wpf/IntSize.cs +++ b/src/Windows/Avalonia.Win32.Interop/Wpf/IntSize.cs @@ -1,8 +1,4 @@ using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; namespace Avalonia.Win32.Interop.Wpf { diff --git a/src/Windows/Avalonia.Win32.Interop/Wpf/WpfAvaloniaHost.cs b/src/Windows/Avalonia.Win32.Interop/Wpf/WpfAvaloniaHost.cs index 6dc9ba9e09..7883c28153 100644 --- a/src/Windows/Avalonia.Win32.Interop/Wpf/WpfAvaloniaHost.cs +++ b/src/Windows/Avalonia.Win32.Interop/Wpf/WpfAvaloniaHost.cs @@ -1,18 +1,7 @@ using System; -using System.Collections; -using System.Collections.Generic; -using System.ComponentModel; -using System.Linq; -using System.Text; using System.Threading; -using System.Threading.Tasks; using System.Windows; -using System.Windows.Controls; using System.Windows.Markup; -using System.Windows.Media; -using Avalonia.Markup.Xaml.Styling; -using Avalonia.Platform; -using Avalonia.Styling; namespace Avalonia.Win32.Interop.Wpf { @@ -55,7 +44,7 @@ namespace Avalonia.Win32.Interop.Wpf set => _impl.ControlRoot.Content = value; } - //Separate class is needed to prevent accidential resurrection + //Separate class is needed to prevent accidental resurrection class Disposer { private readonly WpfTopLevelImpl _impl; diff --git a/src/Windows/Avalonia.Win32.Interop/Wpf/WpfInteropExtensions.cs b/src/Windows/Avalonia.Win32.Interop/Wpf/WpfInteropExtensions.cs index 6433ff05e0..44c4c84cd6 100644 --- a/src/Windows/Avalonia.Win32.Interop/Wpf/WpfInteropExtensions.cs +++ b/src/Windows/Avalonia.Win32.Interop/Wpf/WpfInteropExtensions.cs @@ -1,10 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace Avalonia.Win32.Interop.Wpf +namespace Avalonia.Win32.Interop.Wpf { static class WpfInteropExtensions { diff --git a/src/Windows/Avalonia.Win32.Interop/Wpf/WpfMouseDevice.cs b/src/Windows/Avalonia.Win32.Interop/Wpf/WpfMouseDevice.cs index 4aad80f8a5..0d93115714 100644 --- a/src/Windows/Avalonia.Win32.Interop/Wpf/WpfMouseDevice.cs +++ b/src/Windows/Avalonia.Win32.Interop/Wpf/WpfMouseDevice.cs @@ -27,4 +27,4 @@ namespace Avalonia.Win32.Interop.Wpf base.Capture(control); } } -} \ No newline at end of file +} diff --git a/src/Windows/Avalonia.Win32.Interop/Wpf/WpfTopLevelImpl.cs b/src/Windows/Avalonia.Win32.Interop/Wpf/WpfTopLevelImpl.cs index 7c0e0311a6..b5fb158168 100644 --- a/src/Windows/Avalonia.Win32.Interop/Wpf/WpfTopLevelImpl.cs +++ b/src/Windows/Avalonia.Win32.Interop/Wpf/WpfTopLevelImpl.cs @@ -1,10 +1,7 @@ using System; using System.Collections.Generic; using System.Linq; -using System.Text; -using System.Threading.Tasks; using System.Windows; -using System.Windows.Controls; using System.Windows.Input; using System.Windows.Interop; using System.Windows.Media; diff --git a/src/Windows/Avalonia.Win32.Interop/Wpf/WritableBitmapSurface.cs b/src/Windows/Avalonia.Win32.Interop/Wpf/WritableBitmapSurface.cs index 0f8752fb8d..79340fa335 100644 --- a/src/Windows/Avalonia.Win32.Interop/Wpf/WritableBitmapSurface.cs +++ b/src/Windows/Avalonia.Win32.Interop/Wpf/WritableBitmapSurface.cs @@ -1,9 +1,4 @@ using System; -using System.Collections.Generic; -using System.IO; -using System.Linq; -using System.Text; -using System.Threading.Tasks; using System.Windows; using System.Windows.Media; using System.Windows.Media.Imaging; diff --git a/src/Windows/Avalonia.Win32/ClipboardFormats.cs b/src/Windows/Avalonia.Win32/ClipboardFormats.cs index 5e0bbab975..a18116aade 100644 --- a/src/Windows/Avalonia.Win32/ClipboardFormats.cs +++ b/src/Windows/Avalonia.Win32/ClipboardFormats.cs @@ -7,7 +7,7 @@ using Avalonia.Input; using Avalonia.Win32.Interop; namespace Avalonia.Win32 -{ +{ static class ClipboardFormats { private const int MAX_FORMAT_NAME_LENGTH = 260; @@ -77,4 +77,4 @@ namespace Avalonia.Win32 } -} \ No newline at end of file +} diff --git a/src/Windows/Avalonia.Win32/ClipboardImpl.cs b/src/Windows/Avalonia.Win32/ClipboardImpl.cs index a908c9e1e2..ad000f11eb 100644 --- a/src/Windows/Avalonia.Win32/ClipboardImpl.cs +++ b/src/Windows/Avalonia.Win32/ClipboardImpl.cs @@ -2,13 +2,10 @@ // Licensed under the MIT license. See licence.md file in the project root for full license information. using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; +using System.Runtime.InteropServices; using System.Threading.Tasks; using Avalonia.Input.Platform; using Avalonia.Win32.Interop; -using System.Runtime.InteropServices; namespace Avalonia.Win32 { diff --git a/src/Windows/Avalonia.Win32/CursorFactory.cs b/src/Windows/Avalonia.Win32/CursorFactory.cs index fa2fbe4810..e582b5fb82 100644 --- a/src/Windows/Avalonia.Win32/CursorFactory.cs +++ b/src/Windows/Avalonia.Win32/CursorFactory.cs @@ -1,15 +1,11 @@ // Copyright (c) The Avalonia Project. All rights reserved. // Licensed under the MIT license. See licence.md file in the project root for full license information. -using Avalonia.Win32.Interop; using System; using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; using Avalonia.Input; using Avalonia.Platform; -using System.Runtime.InteropServices; +using Avalonia.Win32.Interop; namespace Avalonia.Win32 { diff --git a/src/Windows/Avalonia.Win32/DataObject.cs b/src/Windows/Avalonia.Win32/DataObject.cs index 13d5f662c2..e78a99cc03 100644 --- a/src/Windows/Avalonia.Win32/DataObject.cs +++ b/src/Windows/Avalonia.Win32/DataObject.cs @@ -1,14 +1,13 @@ using System; -using System.Linq; using System.Collections.Generic; +using System.IO; +using System.Linq; using System.Runtime.InteropServices; using System.Runtime.InteropServices.ComTypes; -using System.Text; +using System.Runtime.Serialization.Formatters.Binary; using Avalonia.Input; using Avalonia.Win32.Interop; using IDataObject = Avalonia.Input.IDataObject; -using System.IO; -using System.Runtime.Serialization.Formatters.Binary; namespace Avalonia.Win32 { diff --git a/src/Windows/Avalonia.Win32/DragSource.cs b/src/Windows/Avalonia.Win32/DragSource.cs index ea124e5f29..a1bc5023a5 100644 --- a/src/Windows/Avalonia.Win32/DragSource.cs +++ b/src/Windows/Avalonia.Win32/DragSource.cs @@ -1,7 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Text; -using System.Threading.Tasks; +using System.Threading.Tasks; using Avalonia.Input; using Avalonia.Input.Platform; using Avalonia.Threading; diff --git a/src/Windows/Avalonia.Win32/FramebufferManager.cs b/src/Windows/Avalonia.Win32/FramebufferManager.cs index bdc6fb29fd..bb0bde34ff 100644 --- a/src/Windows/Avalonia.Win32/FramebufferManager.cs +++ b/src/Windows/Avalonia.Win32/FramebufferManager.cs @@ -1,8 +1,4 @@ using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; using Avalonia.Controls.Platform.Surfaces; using Avalonia.Platform; using Avalonia.Win32.Interop; diff --git a/src/Windows/Avalonia.Win32/IconImpl.cs b/src/Windows/Avalonia.Win32/IconImpl.cs index b7293397d7..8548801555 100644 --- a/src/Windows/Avalonia.Win32/IconImpl.cs +++ b/src/Windows/Avalonia.Win32/IconImpl.cs @@ -1,12 +1,8 @@ -using Avalonia.Platform; -using System; -using System.Collections.Generic; +using System; using System.Drawing; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using System.IO; using System.Drawing.Imaging; +using System.IO; +using Avalonia.Platform; namespace Avalonia.Win32 { diff --git a/src/Windows/Avalonia.Win32/Input/WindowsMouseDevice.cs b/src/Windows/Avalonia.Win32/Input/WindowsMouseDevice.cs index 3d8d04d6cc..2b4105efee 100644 --- a/src/Windows/Avalonia.Win32/Input/WindowsMouseDevice.cs +++ b/src/Windows/Avalonia.Win32/Input/WindowsMouseDevice.cs @@ -1,9 +1,7 @@ // Copyright (c) The Avalonia Project. All rights reserved. // Licensed under the MIT license. See licence.md file in the project root for full license information. -using System; using Avalonia.Input; -using Avalonia.Interactivity; using Avalonia.Win32.Interop; namespace Avalonia.Win32.Input @@ -32,4 +30,4 @@ namespace Avalonia.Win32.Input } } } -} \ No newline at end of file +} diff --git a/src/Windows/Avalonia.Win32/OleDataObject.cs b/src/Windows/Avalonia.Win32/OleDataObject.cs index d7b663e7bf..70d651b2aa 100644 --- a/src/Windows/Avalonia.Win32/OleDataObject.cs +++ b/src/Windows/Avalonia.Win32/OleDataObject.cs @@ -167,4 +167,4 @@ namespace Avalonia.Win32 } } } -} \ No newline at end of file +} diff --git a/src/Windows/Avalonia.Win32/OleDragSource.cs b/src/Windows/Avalonia.Win32/OleDragSource.cs index a87995952a..c903a9ca57 100644 --- a/src/Windows/Avalonia.Win32/OleDragSource.cs +++ b/src/Windows/Avalonia.Win32/OleDragSource.cs @@ -1,6 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; +using System.Linq; using Avalonia.Win32.Interop; namespace Avalonia.Win32 diff --git a/src/Windows/Avalonia.Win32/OleDropTarget.cs b/src/Windows/Avalonia.Win32/OleDropTarget.cs index 6a10cc7e98..7013931be9 100644 --- a/src/Windows/Avalonia.Win32/OleDropTarget.cs +++ b/src/Windows/Avalonia.Win32/OleDropTarget.cs @@ -181,4 +181,4 @@ namespace Avalonia.Win32 return _target.PointToClient(screenPt); } } -} \ No newline at end of file +} diff --git a/src/Windows/Avalonia.Win32/SystemDialogImpl.cs b/src/Windows/Avalonia.Win32/SystemDialogImpl.cs index dec5e3a544..d792ad9991 100644 --- a/src/Windows/Avalonia.Win32/SystemDialogImpl.cs +++ b/src/Windows/Avalonia.Win32/SystemDialogImpl.cs @@ -1,12 +1,12 @@ -using Avalonia.Controls; -using Avalonia.Controls.Platform; -using Avalonia.Platform; -using Avalonia.Win32.Interop; using System; using System.Collections.Generic; using System.Linq; using System.Runtime.InteropServices; using System.Threading.Tasks; +using Avalonia.Controls; +using Avalonia.Controls.Platform; +using Avalonia.Platform; +using Avalonia.Win32.Interop; namespace Avalonia.Win32 { diff --git a/src/Windows/Avalonia.Win32/WindowFramebuffer.cs b/src/Windows/Avalonia.Win32/WindowFramebuffer.cs index 83ab288c54..6193ebd02b 100644 --- a/src/Windows/Avalonia.Win32/WindowFramebuffer.cs +++ b/src/Windows/Avalonia.Win32/WindowFramebuffer.cs @@ -1,6 +1,4 @@ using System; -using System.Runtime.InteropServices; -using Avalonia.Controls.Platform.Surfaces; using Avalonia.Platform; using Avalonia.Win32.Interop; using PixelFormat = Avalonia.Platform.PixelFormat; @@ -101,4 +99,4 @@ namespace Avalonia.Win32 public void Deallocate() => _bitmapBlob.Dispose(); } -} \ No newline at end of file +} diff --git a/src/iOS/Avalonia.iOS/AppBuilder.cs b/src/iOS/Avalonia.iOS/AppBuilder.cs index 06ac7ed6cd..a68dd6387a 100644 --- a/src/iOS/Avalonia.iOS/AppBuilder.cs +++ b/src/iOS/Avalonia.iOS/AppBuilder.cs @@ -1,12 +1,5 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; using Avalonia.Controls; -using Avalonia.Platform; using Avalonia.Shared.PlatformSupport; -using Foundation; -using UIKit; namespace Avalonia { @@ -18,4 +11,4 @@ namespace Avalonia } } -} \ No newline at end of file +} diff --git a/src/iOS/Avalonia.iOS/AvaloniaView.cs b/src/iOS/Avalonia.iOS/AvaloniaView.cs index d70a31a706..b1de4b8d47 100644 --- a/src/iOS/Avalonia.iOS/AvaloniaView.cs +++ b/src/iOS/Avalonia.iOS/AvaloniaView.cs @@ -1,7 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Text; -using Avalonia.Controls.Embedding; +using Avalonia.Controls.Embedding; using CoreGraphics; using UIKit; diff --git a/src/iOS/Avalonia.iOS/AvaloniaWindow.cs b/src/iOS/Avalonia.iOS/AvaloniaWindow.cs index d3f88e0e1e..19e2bb494c 100644 --- a/src/iOS/Avalonia.iOS/AvaloniaWindow.cs +++ b/src/iOS/Avalonia.iOS/AvaloniaWindow.cs @@ -1,9 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; using Avalonia.Media; -using Foundation; using UIKit; namespace Avalonia.iOS @@ -28,4 +23,4 @@ namespace Avalonia.iOS set { _controller.StatusBarColor = value; } } } -} \ No newline at end of file +} diff --git a/src/iOS/Avalonia.iOS/Clipboard.cs b/src/iOS/Avalonia.iOS/Clipboard.cs index 498b671cb8..c66b379453 100644 --- a/src/iOS/Avalonia.iOS/Clipboard.cs +++ b/src/iOS/Avalonia.iOS/Clipboard.cs @@ -23,4 +23,4 @@ namespace Avalonia.iOS return Task.FromResult(0); } } -} \ No newline at end of file +} diff --git a/src/iOS/Avalonia.iOS/DisplayLinkRenderLoop.cs b/src/iOS/Avalonia.iOS/DisplayLinkRenderLoop.cs index a6d1bf1670..4f275dd8ea 100644 --- a/src/iOS/Avalonia.iOS/DisplayLinkRenderLoop.cs +++ b/src/iOS/Avalonia.iOS/DisplayLinkRenderLoop.cs @@ -1,11 +1,7 @@ using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; using Avalonia.Rendering; using CoreAnimation; using Foundation; -using UIKit; namespace Avalonia.iOS { @@ -32,4 +28,4 @@ namespace Avalonia.iOS } } } -} \ No newline at end of file +} diff --git a/src/iOS/Avalonia.iOS/EmbeddableImpl.cs b/src/iOS/Avalonia.iOS/EmbeddableImpl.cs index 7d34cf40f7..65a6c15971 100644 --- a/src/iOS/Avalonia.iOS/EmbeddableImpl.cs +++ b/src/iOS/Avalonia.iOS/EmbeddableImpl.cs @@ -1,9 +1,6 @@ using System; -using System.Collections.Generic; using System.Reactive.Disposables; -using System.Text; using Avalonia.Platform; -using UIKit; namespace Avalonia.iOS { diff --git a/src/iOS/Avalonia.iOS/EmulatedFramebuffer.cs b/src/iOS/Avalonia.iOS/EmulatedFramebuffer.cs index 517b372ba4..b3b41fe724 100644 --- a/src/iOS/Avalonia.iOS/EmulatedFramebuffer.cs +++ b/src/iOS/Avalonia.iOS/EmulatedFramebuffer.cs @@ -1,7 +1,5 @@ using System; -using System.Collections.Generic; using System.Runtime.InteropServices; -using System.Text; using Avalonia.Platform; using CoreGraphics; using UIKit; diff --git a/src/iOS/Avalonia.iOS/Extensions.cs b/src/iOS/Avalonia.iOS/Extensions.cs index 5364129911..28708b20d8 100644 --- a/src/iOS/Avalonia.iOS/Extensions.cs +++ b/src/iOS/Avalonia.iOS/Extensions.cs @@ -1,6 +1,4 @@ using System; -using System.Collections.Generic; -using System.Text; using Avalonia.Media; using CoreGraphics; using UIKit; diff --git a/src/iOS/Avalonia.iOS/PlatformIconLoader.cs b/src/iOS/Avalonia.iOS/PlatformIconLoader.cs index ca54a660b3..c539aba846 100644 --- a/src/iOS/Avalonia.iOS/PlatformIconLoader.cs +++ b/src/iOS/Avalonia.iOS/PlatformIconLoader.cs @@ -1,5 +1,5 @@ -using Avalonia.Platform; -using System.IO; +using System.IO; +using Avalonia.Platform; namespace Avalonia.iOS { @@ -43,4 +43,4 @@ namespace Avalonia.iOS stream.CopyTo(outputStream); } } -} \ No newline at end of file +} diff --git a/src/iOS/Avalonia.iOS/PlatformSettings.cs b/src/iOS/Avalonia.iOS/PlatformSettings.cs index 9f238d4d30..9545795629 100644 --- a/src/iOS/Avalonia.iOS/PlatformSettings.cs +++ b/src/iOS/Avalonia.iOS/PlatformSettings.cs @@ -1,6 +1,4 @@ using System; -using System.Collections.Generic; -using System.Text; using Avalonia.Platform; using UIKit; diff --git a/src/iOS/Avalonia.iOS/PlatformThreadingInterface.cs b/src/iOS/Avalonia.iOS/PlatformThreadingInterface.cs index 43a620cccd..7762e0e03b 100644 --- a/src/iOS/Avalonia.iOS/PlatformThreadingInterface.cs +++ b/src/iOS/Avalonia.iOS/PlatformThreadingInterface.cs @@ -1,15 +1,8 @@ using System; -using System.Collections.Generic; -using System.Diagnostics; -using System.Linq; -using System.Reactive.Disposables; -using System.Text; using System.Threading; -using CoreAnimation; -using Foundation; using Avalonia.Platform; -using Avalonia.Shared.PlatformSupport; using Avalonia.Threading; +using Foundation; namespace Avalonia.iOS { diff --git a/src/iOS/Avalonia.iOS/Specific/KeyboardEventsHelper.cs b/src/iOS/Avalonia.iOS/Specific/KeyboardEventsHelper.cs index 567bb9a5e0..be32d12315 100644 --- a/src/iOS/Avalonia.iOS/Specific/KeyboardEventsHelper.cs +++ b/src/iOS/Avalonia.iOS/Specific/KeyboardEventsHelper.cs @@ -1,11 +1,11 @@ -using ObjCRuntime; +using System; +using System.ComponentModel; +using System.Linq; using Avalonia.Controls; using Avalonia.Input; using Avalonia.Input.Raw; using Avalonia.Platform; -using System; -using System.ComponentModel; -using System.Linq; +using ObjCRuntime; using UIKit; namespace Avalonia.iOS.Specific @@ -122,7 +122,7 @@ namespace Avalonia.iOS.Specific _lastFocusedElement = element; } - public void ActivateAutoShowKeybord() + public void ActivateAutoShowKeyboard() { var kbDevice = (KeyboardDevice.Instance as INotifyPropertyChanged); @@ -144,4 +144,4 @@ namespace Avalonia.iOS.Specific HandleEvents = false; } } -} \ No newline at end of file +} diff --git a/src/iOS/Avalonia.iOS/TopLevelImpl.cs b/src/iOS/Avalonia.iOS/TopLevelImpl.cs index 3a2d2a33c6..1101f53222 100644 --- a/src/iOS/Avalonia.iOS/TopLevelImpl.cs +++ b/src/iOS/Avalonia.iOS/TopLevelImpl.cs @@ -1,23 +1,15 @@ using System; using System.Collections.Generic; -using System.Diagnostics; -using System.Linq; -using System.Reactive.Disposables; -using System.Text; -using CoreAnimation; -using CoreGraphics; -using Foundation; -using Avalonia.Controls.Platform; +using Avalonia.Controls.Platform.Surfaces; using Avalonia.Input; using Avalonia.Input.Raw; -using Avalonia.Media; -using Avalonia.Platform; -using UIKit; using Avalonia.iOS.Specific; -using ObjCRuntime; -using Avalonia.Controls; -using Avalonia.Controls.Platform.Surfaces; +using Avalonia.Platform; using Avalonia.Rendering; +using CoreGraphics; +using Foundation; +using ObjCRuntime; +using UIKit; namespace Avalonia.iOS { @@ -31,7 +23,7 @@ namespace Avalonia.iOS { _keyboardHelper = new KeyboardEventsHelper(this); AutoresizingMask = UIViewAutoresizing.All; - _keyboardHelper.ActivateAutoShowKeybord(); + _keyboardHelper.ActivateAutoShowKeyboard(); } [Export("hasText")] diff --git a/src/iOS/Avalonia.iOS/WindowingPlatformImpl.cs b/src/iOS/Avalonia.iOS/WindowingPlatformImpl.cs index 5cac259ce7..9a40b7162e 100644 --- a/src/iOS/Avalonia.iOS/WindowingPlatformImpl.cs +++ b/src/iOS/Avalonia.iOS/WindowingPlatformImpl.cs @@ -1,5 +1,5 @@ -using Avalonia.Platform; using System; +using Avalonia.Platform; namespace Avalonia.iOS { diff --git a/src/iOS/Avalonia.iOS/iOSPlatform.cs b/src/iOS/Avalonia.iOS/iOSPlatform.cs index 91e3bcc041..abaebca489 100644 --- a/src/iOS/Avalonia.iOS/iOSPlatform.cs +++ b/src/iOS/Avalonia.iOS/iOSPlatform.cs @@ -1,13 +1,10 @@ -using System; -using System.Reflection; +using Avalonia.Controls; using Avalonia.Input; using Avalonia.Input.Platform; using Avalonia.iOS; using Avalonia.Platform; -using Avalonia.Shared.PlatformSupport; -using UIKit; -using Avalonia.Controls; using Avalonia.Rendering; +using Avalonia.Shared.PlatformSupport; namespace Avalonia { diff --git a/src/tools/Avalonia.Designer.HostApp.NetFX/Program.cs b/src/tools/Avalonia.Designer.HostApp.NetFX/Program.cs index bef53bb685..da1c5a1da3 100644 --- a/src/tools/Avalonia.Designer.HostApp.NetFX/Program.cs +++ b/src/tools/Avalonia.Designer.HostApp.NetFX/Program.cs @@ -1,11 +1,6 @@ using System; -using System.Collections.Generic; -using System.Diagnostics; using System.IO; -using System.Linq; using System.Reflection; -using System.Text; -using System.Threading.Tasks; namespace Avalonia.Designer.HostApp.NetFX { diff --git a/tests/Avalonia.Controls.UnitTests/DockPanelTests.cs b/tests/Avalonia.Controls.UnitTests/DockPanelTests.cs index 3de67839a7..59f047abae 100644 --- a/tests/Avalonia.Controls.UnitTests/DockPanelTests.cs +++ b/tests/Avalonia.Controls.UnitTests/DockPanelTests.cs @@ -58,5 +58,29 @@ namespace Avalonia.Controls.UnitTests Assert.Equal(new Rect(50, 350, 500, 50), target.Children[3].Bounds); Assert.Equal(new Rect(50, 50, 500, 300), target.Children[4].Bounds); } + + [Fact] + public void Changing_Child_Dock_Invalidates_Measure() + { + Border child; + var target = new DockPanel + { + Children = + { + (child = new Border + { + [DockPanel.DockProperty] = Dock.Left, + }), + } + }; + + target.Measure(Size.Infinity); + target.Arrange(new Rect(target.DesiredSize)); + Assert.True(target.IsMeasureValid); + + DockPanel.SetDock(child, Dock.Right); + + Assert.False(target.IsMeasureValid); + } } } diff --git a/tests/Avalonia.Controls.UnitTests/GridTests.cs b/tests/Avalonia.Controls.UnitTests/GridTests.cs index 4c79b7775b..5799cb91c4 100644 --- a/tests/Avalonia.Controls.UnitTests/GridTests.cs +++ b/tests/Avalonia.Controls.UnitTests/GridTests.cs @@ -154,5 +154,31 @@ namespace Avalonia.Controls.UnitTests GridAssert.ChildrenHeight(rowGrid, 200, 300, 300); GridAssert.ChildrenWidth(columnGrid, 200, 300, 300); } + + [Fact] + public void Changing_Child_Column_Invalidates_Measure() + { + Border child; + var target = new Grid + { + ColumnDefinitions = new ColumnDefinitions("*,*"), + Children = + { + (child = new Border + { + [Grid.ColumnProperty] = 0, + }), + } + }; + + target.Measure(Size.Infinity); + target.Arrange(new Rect(target.DesiredSize)); + Assert.True(target.IsMeasureValid); + + Grid.SetColumn(child, 1); + + Assert.False(target.IsMeasureValid); + } + } } diff --git a/tests/Avalonia.Controls.UnitTests/TreeViewTests.cs b/tests/Avalonia.Controls.UnitTests/TreeViewTests.cs index c49c343a45..1a913865cb 100644 --- a/tests/Avalonia.Controls.UnitTests/TreeViewTests.cs +++ b/tests/Avalonia.Controls.UnitTests/TreeViewTests.cs @@ -166,6 +166,39 @@ namespace Avalonia.Controls.UnitTests Assert.True(container.IsSelected); } + + [Fact] + public void Setting_SelectedItem_Should_Raise_SelectedItemChanged_Event() + { + var tree = CreateTestTreeData(); + var target = new TreeView + { + Template = CreateTreeViewTemplate(), + Items = tree, + }; + + var visualRoot = new TestRoot(); + visualRoot.Child = target; + + CreateNodeDataTemplate(target); + ApplyTemplates(target); + + var item = tree[0].Children[1].Children[0]; + + var called = false; + target.SelectedItemChanged += (s, e) => + { + Assert.Empty(e.RemovedItems); + Assert.Equal(1, e.AddedItems.Count); + Assert.Same(item, e.AddedItems[0]); + called = true; + }; + + target.SelectedItem = item; + Assert.True(called); + } + + [Fact] public void LogicalChildren_Should_Be_Set() { diff --git a/tests/Avalonia.UnitTests/ImmediateDispatcher.cs b/tests/Avalonia.UnitTests/ImmediateDispatcher.cs index 44d8c78054..fac4ee64e7 100644 --- a/tests/Avalonia.UnitTests/ImmediateDispatcher.cs +++ b/tests/Avalonia.UnitTests/ImmediateDispatcher.cs @@ -9,28 +9,45 @@ namespace Avalonia.UnitTests /// public class ImmediateDispatcher : IDispatcher { + /// public bool CheckAccess() { return true; } + /// public void Post(Action action, DispatcherPriority priority = DispatcherPriority.Normal) { action(); } + /// public Task InvokeAsync(Action action, DispatcherPriority priority = DispatcherPriority.Normal) { action(); - return Task.FromResult(null); + return Task.CompletedTask; } + /// public Task InvokeAsync(Func function, DispatcherPriority priority = DispatcherPriority.Normal) { var result = function(); return Task.FromResult(result); } + /// + public Task InvokeAsync(Func function, DispatcherPriority priority = DispatcherPriority.Normal) + { + return function(); + } + + /// + public Task InvokeAsync(Func> function, DispatcherPriority priority = DispatcherPriority.Normal) + { + return function(); + } + + /// public void VerifyAccess() { }