diff --git a/build.cake b/build.cake index e3507d05fa..8806f29cec 100644 --- a/build.cake +++ b/build.cake @@ -635,21 +635,19 @@ Task("Run-Unit-Tests") .WithCriteria(() => !skipTests) .Does(() => { - var pattern = "./tests/Avalonia.*.UnitTests/bin/" + dirSuffix + "/Avalonia.*.UnitTests.dll"; - - Func ExcludeWindowsTests = i => { - return !(i.Path.FullPath.IndexOf("Direct2D", StringComparison.OrdinalIgnoreCase) >= 0); - }; - - var unitTests = isRunningOnWindows ? GetFiles(pattern) : GetFiles(pattern, ExcludeWindowsTests); + var unitTests = GetDirectories("./tests/Avalonia.*.UnitTests") + .Select(dir => System.IO.Path.GetFileName(dir.FullPath)) + .Where(name => isRunningOnWindows ? true : !(name.IndexOf("Direct2D", StringComparison.OrdinalIgnoreCase) >= 0)) + .Select(name => MakeAbsolute(File("./tests/" + name + "/bin/" + dirSuffix + "/" + name + ".dll"))) + .ToList(); if (isRunningOnWindows) { - var windowsTests = GetFiles("./tests/Avalonia.DesignerSupport.Tests/bin/" + dirSuffix + "/*Tests.dll") + - GetFiles("./tests/Avalonia.LeakTests/bin/" + dirSuffix + "/*Tests.dll") + - GetFiles("./tests/Avalonia.RenderTests/bin/" + dirSuffix + "/*Tests.dll"); + var windowsTests = GetFiles("./tests/Avalonia.DesignerSupport.Tests/bin/" + dirSuffix + "/*.Tests.dll") + + GetFiles("./tests/Avalonia.LeakTests/bin/" + dirSuffix + "/*.LeakTests.dll") + + GetFiles("./tests/Avalonia.RenderTests/bin/" + dirSuffix + "/*.RenderTests.dll"); - unitTests += windowsTests; + unitTests.AddRange(windowsTests); } var toolPath = (isPlatformAnyCPU || isPlatformX86) ? diff --git a/samples/ControlCatalog.Android/ControlCatalog.Android.v2.ncrunchproject b/samples/ControlCatalog.Android/ControlCatalog.Android.v2.ncrunchproject new file mode 100644 index 0000000000..e1b4d7cf28 --- /dev/null +++ b/samples/ControlCatalog.Android/ControlCatalog.Android.v2.ncrunchproject @@ -0,0 +1,26 @@ + + true + 1000 + false + false + false + true + false + false + true + false + false + false + true + false + true + true + true + 60000 + + + + AutoDetect + STA + x86 + \ No newline at end of file diff --git a/src/Android/Avalonia.Android/Platform/SkiaPlatform/MainWindowImpl.cs b/src/Android/Avalonia.Android/Platform/SkiaPlatform/MainWindowImpl.cs index 5c8778aa96..690c509b53 100644 --- a/src/Android/Avalonia.Android/Platform/SkiaPlatform/MainWindowImpl.cs +++ b/src/Android/Avalonia.Android/Platform/SkiaPlatform/MainWindowImpl.cs @@ -14,7 +14,7 @@ namespace Avalonia.Android.Platform.SkiaPlatform { } - public WindowState WindowState + public new WindowState WindowState { get { return WindowState.Normal; } set { } diff --git a/src/Avalonia.Animation/Avalonia.Animation.csproj b/src/Avalonia.Animation/Avalonia.Animation.csproj index 65489f3308..d74f4d9c69 100644 --- a/src/Avalonia.Animation/Avalonia.Animation.csproj +++ b/src/Avalonia.Animation/Avalonia.Animation.csproj @@ -25,6 +25,7 @@ prompt 4 bin\Debug\Avalonia.Animation.XML + false pdbonly @@ -35,6 +36,7 @@ 4 bin\Release\Avalonia.Animation.XML CS1591 + true diff --git a/src/Avalonia.Base/Avalonia.Base.csproj b/src/Avalonia.Base/Avalonia.Base.csproj index 46e24aa15a..bc52e31d2c 100644 --- a/src/Avalonia.Base/Avalonia.Base.csproj +++ b/src/Avalonia.Base/Avalonia.Base.csproj @@ -38,6 +38,7 @@ 4 bin\Release\Avalonia.Base.XML CS1591 + true diff --git a/src/Avalonia.Base/AvaloniaObject.cs b/src/Avalonia.Base/AvaloniaObject.cs index eeaf782e83..48e937d6b2 100644 --- a/src/Avalonia.Base/AvaloniaObject.cs +++ b/src/Avalonia.Base/AvaloniaObject.cs @@ -164,9 +164,7 @@ namespace Avalonia set { - var metadata = binding.Property.GetMetadata(GetType()); var sourceBinding = value as IBinding; - this.Bind(binding.Property, sourceBinding); } } diff --git a/src/Avalonia.Base/AvaloniaPropertyRegistry.cs b/src/Avalonia.Base/AvaloniaPropertyRegistry.cs index a1d6db64df..190b3ee2be 100644 --- a/src/Avalonia.Base/AvaloniaPropertyRegistry.cs +++ b/src/Avalonia.Base/AvaloniaPropertyRegistry.cs @@ -64,8 +64,6 @@ namespace Avalonia { Contract.Requires(type != null); - var i = type.GetTypeInfo(); - while (type != null) { // Ensure the type's static ctor has been run. @@ -265,7 +263,8 @@ namespace Avalonia /// The property. /// /// You won't usually want to call this method directly, instead use the - /// method. + /// + /// method. /// public void Register(Type type, AvaloniaProperty property) { diff --git a/src/Avalonia.Base/Collections/AvaloniaDictionary.cs b/src/Avalonia.Base/Collections/AvaloniaDictionary.cs index 9626e343ee..d63a5baf16 100644 --- a/src/Avalonia.Base/Collections/AvaloniaDictionary.cs +++ b/src/Avalonia.Base/Collections/AvaloniaDictionary.cs @@ -207,7 +207,6 @@ namespace Avalonia.Collections if (CollectionChanged != null) { - var val = new KeyValuePair(key, value); var e = new NotifyCollectionChangedEventArgs( NotifyCollectionChangedAction.Add, new[] { new KeyValuePair(key, value) }, diff --git a/src/Avalonia.Base/Collections/AvaloniaList.cs b/src/Avalonia.Base/Collections/AvaloniaList.cs index 65b559482d..ace898b55f 100644 --- a/src/Avalonia.Base/Collections/AvaloniaList.cs +++ b/src/Avalonia.Base/Collections/AvaloniaList.cs @@ -397,8 +397,6 @@ namespace Avalonia.Collections { Contract.Requires(items != null); - var list = (items as IList) ?? items.ToList(); - foreach (var i in items) { // TODO: Optimize to only send as many notifications as necessary. diff --git a/src/Avalonia.Base/Data/InstancedBinding.cs b/src/Avalonia.Base/Data/InstancedBinding.cs index 7df1017f05..899cfed1fe 100644 --- a/src/Avalonia.Base/Data/InstancedBinding.cs +++ b/src/Avalonia.Base/Data/InstancedBinding.cs @@ -12,7 +12,7 @@ namespace Avalonia.Data /// /// Whereas an holds a description of a binding such as "Bind to the X /// property on a control's DataContext"; this class represents a binding that has been - /// *instanced* by calling + /// *instanced* by calling /// on a target object. /// /// When a binding is initiated, it can return one of 3 possible sources for the binding: diff --git a/src/Avalonia.Base/Platform/IPlatformThreadingInterface.cs b/src/Avalonia.Base/Platform/IPlatformThreadingInterface.cs index e4f24d8638..a63ccec7c2 100644 --- a/src/Avalonia.Base/Platform/IPlatformThreadingInterface.cs +++ b/src/Avalonia.Base/Platform/IPlatformThreadingInterface.cs @@ -21,9 +21,6 @@ namespace Avalonia.Platform /// An used to stop the timer. IDisposable StartTimer(TimeSpan interval, Action tick); - /// - /// Sends a message that causes to exit. - /// void Signal(); bool CurrentThreadIsLoopThread { get; } diff --git a/src/Avalonia.Base/PriorityBindingEntry.cs b/src/Avalonia.Base/PriorityBindingEntry.cs index 580b593666..25b7bede7e 100644 --- a/src/Avalonia.Base/PriorityBindingEntry.cs +++ b/src/Avalonia.Base/PriorityBindingEntry.cs @@ -21,7 +21,6 @@ namespace Avalonia /// /// The binding index. Later bindings should have higher indexes. /// - /// The validation settings for the binding. public PriorityBindingEntry(PriorityLevel owner, int index) { _owner = owner; diff --git a/src/Avalonia.Controls/AppBuilderBase.cs b/src/Avalonia.Controls/AppBuilderBase.cs index e241f953e7..c53cca19d1 100644 --- a/src/Avalonia.Controls/AppBuilderBase.cs +++ b/src/Avalonia.Controls/AppBuilderBase.cs @@ -9,9 +9,9 @@ using Avalonia.Platform; namespace Avalonia.Controls { /// - /// Initializes up platform-specific services for an . + /// Base class for initializing platform-specific services for an . /// - /// + /// The type of the AppBuilder class itself. public abstract class AppBuilderBase where TAppBuilder : AppBuilderBase, new() { /// @@ -140,6 +140,7 @@ namespace Avalonia.Controls /// Specifies a windowing subsystem to use. /// /// The method to call to initialize the windowing subsystem. + /// The name of the windowing subsystem. /// An instance. public TAppBuilder UseWindowingSubsystem(Action initializer, string name = "") { @@ -159,6 +160,7 @@ namespace Avalonia.Controls /// Specifies a rendering subsystem to use. /// /// The method to call to initialize the rendering subsystem. + /// The name of the rendering subsystem. /// An instance. public TAppBuilder UseRenderingSubsystem(Action initializer, string name = "") { diff --git a/src/Avalonia.Controls/Avalonia.Controls.csproj b/src/Avalonia.Controls/Avalonia.Controls.csproj index 7192abd620..3439ab3101 100644 --- a/src/Avalonia.Controls/Avalonia.Controls.csproj +++ b/src/Avalonia.Controls/Avalonia.Controls.csproj @@ -38,6 +38,7 @@ 4 bin\Release\Avalonia.Controls.XML CS1591 + true diff --git a/src/Avalonia.Controls/Classes.cs b/src/Avalonia.Controls/Classes.cs index 2c93fa41ae..02fd6e63bf 100644 --- a/src/Avalonia.Controls/Classes.cs +++ b/src/Avalonia.Controls/Classes.cs @@ -197,7 +197,6 @@ namespace Avalonia.Controls /// The number of items to remove. public override void RemoveRange(int index, int count) { - var names = GetRange(index, count); base.RemoveRange(index, count); } diff --git a/src/Avalonia.Controls/Generators/TreeItemContainerGenerator.cs b/src/Avalonia.Controls/Generators/TreeItemContainerGenerator.cs index 923d24775f..abcecb5b82 100644 --- a/src/Avalonia.Controls/Generators/TreeItemContainerGenerator.cs +++ b/src/Avalonia.Controls/Generators/TreeItemContainerGenerator.cs @@ -124,11 +124,6 @@ namespace Avalonia.Controls.Generators return false; } - /// - /// Gets the data template for the specified item. - /// - /// The item. - /// The template. private ITreeDataTemplate GetTreeDataTemplate(object item, IDataTemplate primary) { var template = Owner.FindDataTemplate(item, primary) ?? FuncDataTemplate.Default; diff --git a/src/Avalonia.Controls/HotkeyManager.cs b/src/Avalonia.Controls/HotkeyManager.cs index 6c64966ef1..35c9d6a9c5 100644 --- a/src/Avalonia.Controls/HotkeyManager.cs +++ b/src/Avalonia.Controls/HotkeyManager.cs @@ -30,8 +30,9 @@ namespace Avalonia.Controls public void Execute(object parameter) => GetCommand()?.Execute(parameter); - //Implementation isn't needed in this case +#pragma warning disable 67 // Event not used public event EventHandler CanExecuteChanged; +#pragma warning restore 67 } diff --git a/src/Avalonia.Controls/Platform/PlatformManager.cs b/src/Avalonia.Controls/Platform/PlatformManager.cs index e57eb21b91..2125505efd 100644 --- a/src/Avalonia.Controls/Platform/PlatformManager.cs +++ b/src/Avalonia.Controls/Platform/PlatformManager.cs @@ -11,7 +11,6 @@ namespace Avalonia.Controls.Platform => AvaloniaLocator.Current.GetService(); static bool s_designerMode; - private static double _designerScalingFactor = 1; public static IRenderTarget CreateRenderTarget(ITopLevelImpl window) { @@ -28,7 +27,6 @@ namespace Avalonia.Controls.Platform public static void SetDesignerScalingFactor(double factor) { - _designerScalingFactor = factor; } public static IWindowImpl CreateWindow() diff --git a/src/Avalonia.Controls/Presenters/CarouselPresenter.cs b/src/Avalonia.Controls/Presenters/CarouselPresenter.cs index 8b408002a1..b50b110761 100644 --- a/src/Avalonia.Controls/Presenters/CarouselPresenter.cs +++ b/src/Avalonia.Controls/Presenters/CarouselPresenter.cs @@ -97,7 +97,9 @@ namespace Avalonia.Controls.Presenters /// protected override void PanelCreated(IPanel panel) { - var task = MoveToPage(-1, SelectedIndex); +#pragma warning disable 4014 + MoveToPage(-1, SelectedIndex); +#pragma warning restore 4014 } /// @@ -139,7 +141,6 @@ namespace Avalonia.Controls.Presenters if (toIndex != -1) { - var item = Items.Cast().ElementAt(toIndex); to = GetOrCreateContainer(toIndex); } diff --git a/src/Avalonia.Controls/Presenters/ItemVirtualizer.cs b/src/Avalonia.Controls/Presenters/ItemVirtualizer.cs index ae198dc58c..74c7da20d6 100644 --- a/src/Avalonia.Controls/Presenters/ItemVirtualizer.cs +++ b/src/Avalonia.Controls/Presenters/ItemVirtualizer.cs @@ -16,8 +16,6 @@ namespace Avalonia.Controls.Presenters /// internal abstract class ItemVirtualizer : IVirtualizingController, IDisposable { - private bool disposedValue; - /// /// Initializes a new instance of the class. /// diff --git a/src/Avalonia.Controls/Presenters/ItemVirtualizerSimple.cs b/src/Avalonia.Controls/Presenters/ItemVirtualizerSimple.cs index d2e5a720b7..afa5bb76db 100644 --- a/src/Avalonia.Controls/Presenters/ItemVirtualizerSimple.cs +++ b/src/Avalonia.Controls/Presenters/ItemVirtualizerSimple.cs @@ -359,7 +359,6 @@ namespace Avalonia.Controls.Presenters var count = Math.Min(Math.Abs(delta), panel.Children.Count); var move = count < panel.Children.Count; var first = delta < 0 && move ? panel.Children.Count + delta : 0; - var containers = panel.Children.GetRange(first, count).ToList(); for (var i = 0; i < count; ++i) { diff --git a/src/Avalonia.Controls/ScrollViewer.cs b/src/Avalonia.Controls/ScrollViewer.cs index c52c1ad505..396905c26b 100644 --- a/src/Avalonia.Controls/ScrollViewer.cs +++ b/src/Avalonia.Controls/ScrollViewer.cs @@ -157,7 +157,7 @@ namespace Avalonia.Controls /// public ScrollViewer() { - var extentAndViewport = Observable.CombineLatest( + Observable.CombineLatest( this.GetObservable(ExtentProperty), this.GetObservable(ViewportProperty)) .Select(x => new { Extent = x[0], Viewport = x[1] }); diff --git a/src/Avalonia.Controls/TextBox.cs b/src/Avalonia.Controls/TextBox.cs index 104b1ba2a7..ed73472c49 100644 --- a/src/Avalonia.Controls/TextBox.cs +++ b/src/Avalonia.Controls/TextBox.cs @@ -105,7 +105,7 @@ namespace Avalonia.Controls public TextBox() { - var canScrollHorizontally = this.GetObservable(TextWrappingProperty) + this.GetObservable(TextWrappingProperty) .Select(x => x == TextWrapping.NoWrap) .Subscribe(x => CanScrollHorizontally = x); diff --git a/src/Avalonia.Controls/TopLevel.cs b/src/Avalonia.Controls/TopLevel.cs index 47660b27e8..f64fb3cbd2 100644 --- a/src/Avalonia.Controls/TopLevel.cs +++ b/src/Avalonia.Controls/TopLevel.cs @@ -88,7 +88,6 @@ namespace Avalonia.Controls PlatformImpl = impl; dependencyResolver = dependencyResolver ?? AvaloniaLocator.Current; - var renderInterface = TryGetService(dependencyResolver); var styler = TryGetService(dependencyResolver); _accessKeyHandler = TryGetService(dependencyResolver); _inputManager = TryGetService(dependencyResolver); diff --git a/src/Avalonia.Diagnostics/Avalonia.Diagnostics.csproj b/src/Avalonia.Diagnostics/Avalonia.Diagnostics.csproj index 5cfd60b2fb..7ac724fcf4 100644 --- a/src/Avalonia.Diagnostics/Avalonia.Diagnostics.csproj +++ b/src/Avalonia.Diagnostics/Avalonia.Diagnostics.csproj @@ -38,6 +38,7 @@ 4 bin\Release\Avalonia.Diagnostics.XML CS1591 + true diff --git a/src/Avalonia.Diagnostics/ViewModels/DevToolsViewModel.cs b/src/Avalonia.Diagnostics/ViewModels/DevToolsViewModel.cs index 5335895b61..dbee9ad624 100644 --- a/src/Avalonia.Diagnostics/ViewModels/DevToolsViewModel.cs +++ b/src/Avalonia.Diagnostics/ViewModels/DevToolsViewModel.cs @@ -11,8 +11,6 @@ namespace Avalonia.Diagnostics.ViewModels { internal class DevToolsViewModel : ReactiveObject { - private IControl _root; - private ReactiveObject _content; private int _selectedTab; @@ -27,7 +25,6 @@ namespace Avalonia.Diagnostics.ViewModels public DevToolsViewModel(IControl root) { - _root = root; _logicalTree = new TreePageViewModel(LogicalTreeNode.Create(root)); _visualTree = new TreePageViewModel(VisualTreeNode.Create(root)); diff --git a/src/Avalonia.DotNetFrameworkRuntime/AppBuilder.cs b/src/Avalonia.DotNetFrameworkRuntime/AppBuilder.cs index 3510539bc7..3385e25d4f 100644 --- a/src/Avalonia.DotNetFrameworkRuntime/AppBuilder.cs +++ b/src/Avalonia.DotNetFrameworkRuntime/AppBuilder.cs @@ -1,27 +1,39 @@ using System; -using System.Collections.Generic; +using System.IO; using System.Linq; using System.Reflection; -using System.Text; -using System.Threading.Tasks; using Avalonia.Controls; using Avalonia.Platform; using Avalonia.Shared.PlatformSupport; -using System.IO; namespace Avalonia { + /// + /// Initializes platform-specific services for an . + /// public sealed class AppBuilder : AppBuilderBase { - public AppBuilder() : base(new StandardRuntimePlatform(), () => StandardRuntimePlatformServices.Register()) + /// + /// Initializes a new instance of the class. + /// + public AppBuilder() + : base(new StandardRuntimePlatform(), () => StandardRuntimePlatformServices.Register()) { } + /// + /// Initializes a new instance of the class. + /// + /// The instance. public AppBuilder(Application app) : this() { Instance = app; } + /// + /// Instructs the to use the best settings for the platform. + /// + /// An instance. public AppBuilder UsePlatformDetect() { var os = RuntimePlatform.GetRuntimeInfo().OperatingSystem; diff --git a/src/Avalonia.DotNetFrameworkRuntime/Avalonia.DotNetFrameworkRuntime.csproj b/src/Avalonia.DotNetFrameworkRuntime/Avalonia.DotNetFrameworkRuntime.csproj index b58ad3af1e..ff481f769e 100644 --- a/src/Avalonia.DotNetFrameworkRuntime/Avalonia.DotNetFrameworkRuntime.csproj +++ b/src/Avalonia.DotNetFrameworkRuntime/Avalonia.DotNetFrameworkRuntime.csproj @@ -31,6 +31,7 @@ prompt 4 bin\Release\Avalonia.DotNetFrameworkRuntime.xml + true diff --git a/src/Avalonia.Input/Avalonia.Input.csproj b/src/Avalonia.Input/Avalonia.Input.csproj index b697c91941..45a1ce9015 100644 --- a/src/Avalonia.Input/Avalonia.Input.csproj +++ b/src/Avalonia.Input/Avalonia.Input.csproj @@ -38,6 +38,7 @@ 4 bin\Release\Avalonia.Input.XML CS1591 + true diff --git a/src/Avalonia.Input/Navigation/DirectionalNavigation.cs b/src/Avalonia.Input/Navigation/DirectionalNavigation.cs index 6d4da5d976..b2f7a35799 100644 --- a/src/Avalonia.Input/Navigation/DirectionalNavigation.cs +++ b/src/Avalonia.Input/Navigation/DirectionalNavigation.cs @@ -90,7 +90,6 @@ namespace Avalonia.Input.Navigation /// The element's focusable descendents. private static IEnumerable GetFocusableDescendents(IInputElement element) { - var mode = KeyboardNavigation.GetDirectionalNavigation((InputElement)element); var children = element.GetVisualChildren().OfType(); foreach (var child in children) diff --git a/src/Avalonia.Interactivity/Avalonia.Interactivity.csproj b/src/Avalonia.Interactivity/Avalonia.Interactivity.csproj index 778bb084db..a9ddc316ca 100644 --- a/src/Avalonia.Interactivity/Avalonia.Interactivity.csproj +++ b/src/Avalonia.Interactivity/Avalonia.Interactivity.csproj @@ -38,6 +38,7 @@ 4 bin\Release\Avalonia.Interactivity.XML CS1591 + true diff --git a/src/Avalonia.Layout/Avalonia.Layout.csproj b/src/Avalonia.Layout/Avalonia.Layout.csproj index aa299d4215..4db2398dbe 100644 --- a/src/Avalonia.Layout/Avalonia.Layout.csproj +++ b/src/Avalonia.Layout/Avalonia.Layout.csproj @@ -38,6 +38,7 @@ 4 bin\Release\Avalonia.Layout.XML CS1591 + true diff --git a/src/Avalonia.Logging.Serilog/Avalonia.Logging.Serilog.csproj b/src/Avalonia.Logging.Serilog/Avalonia.Logging.Serilog.csproj index e6490d16f4..e88dc86b00 100644 --- a/src/Avalonia.Logging.Serilog/Avalonia.Logging.Serilog.csproj +++ b/src/Avalonia.Logging.Serilog/Avalonia.Logging.Serilog.csproj @@ -1,4 +1,4 @@ - + @@ -34,6 +34,7 @@ prompt 4 bin\Release\Avalonia.Logging.Serilog.XML + true diff --git a/src/Avalonia.Logging.Serilog/SerilogLogger.cs b/src/Avalonia.Logging.Serilog/SerilogLogger.cs index 460469394e..99145d49e4 100644 --- a/src/Avalonia.Logging.Serilog/SerilogLogger.cs +++ b/src/Avalonia.Logging.Serilog/SerilogLogger.cs @@ -8,21 +8,33 @@ using SerilogLogEventLevel = Serilog.Events.LogEventLevel; namespace Avalonia.Logging.Serilog { + /// + /// Sends log output to serilog. + /// public class SerilogLogger : ILogSink { private readonly ILogger _output; private readonly Dictionary _areas = new Dictionary(); + /// + /// Initializes a new instance of the class. + /// + /// The serilog logger to use. public SerilogLogger(ILogger output) { _output = output; } + /// + /// Initializes the Avalonia logging with a new instance of a . + /// + /// The serilog logger to use. public static void Initialize(ILogger output) { Logger.Sink = new SerilogLogger(output); } + /// public void Log( AvaloniaLogEventLevel level, string area, diff --git a/src/Avalonia.SceneGraph/Avalonia.SceneGraph.csproj b/src/Avalonia.SceneGraph/Avalonia.SceneGraph.csproj index 1f2734b2e9..f472c18230 100644 --- a/src/Avalonia.SceneGraph/Avalonia.SceneGraph.csproj +++ b/src/Avalonia.SceneGraph/Avalonia.SceneGraph.csproj @@ -38,6 +38,7 @@ 4 bin\Release\Avalonia.SceneGraph.XML CS1591 + true diff --git a/src/Avalonia.SceneGraph/Media/DrawingContext.cs b/src/Avalonia.SceneGraph/Media/DrawingContext.cs index d56d2ae1ad..9fd8761ca5 100644 --- a/src/Avalonia.SceneGraph/Media/DrawingContext.cs +++ b/src/Avalonia.SceneGraph/Media/DrawingContext.cs @@ -208,6 +208,9 @@ namespace Avalonia.Media /// Pushes an opacity mask. /// /// The opacity mask. + /// + /// The size of the brush's target area. TODO: Are we sure this is needed? + /// /// A disposable to undo the opacity mask. public PushedState PushOpacityMask(IBrush mask, Rect bounds) { @@ -216,15 +219,24 @@ namespace Avalonia.Media } /// - /// Pushes a matrix transformation. + /// Pushes a matrix post-transformation. /// /// The matrix /// A disposable used to undo the transformation. public PushedState PushPostTransform(Matrix matrix) => PushSetTransform(CurrentTransform*matrix); + /// + /// Pushes a matrix pre-transformation. + /// + /// The matrix + /// A disposable used to undo the transformation. public PushedState PushPreTransform(Matrix matrix) => PushSetTransform(matrix*CurrentTransform); - + /// + /// Sets the current matrix transformation. + /// + /// The matrix + /// A disposable used to undo the transformation. PushedState PushSetTransform(Matrix matrix) { var oldMatrix = CurrentTransform; @@ -233,7 +245,10 @@ namespace Avalonia.Media return new PushedState(this, PushedState.PushedStateType.Matrix, oldMatrix); } - + /// + /// Pushes a new transform context. + /// + /// A disposable used to undo the transformation. public PushedState PushTransformContainer() { _transformContainers.Push(new TransformContainer(CurrentTransform, _currentContainerTransform)); @@ -242,6 +257,9 @@ namespace Avalonia.Media return new PushedState(this, PushedState.PushedStateType.MatrixContainer); } + /// + /// Disposes of any resources held by the . + /// public void Dispose() { while (_states.Count != 0) diff --git a/src/Avalonia.SceneGraph/Media/Imaging/RenderTargetBitmap.cs b/src/Avalonia.SceneGraph/Media/Imaging/RenderTargetBitmap.cs index 1687dc811e..4cc9c3fdf2 100644 --- a/src/Avalonia.SceneGraph/Media/Imaging/RenderTargetBitmap.cs +++ b/src/Avalonia.SceneGraph/Media/Imaging/RenderTargetBitmap.cs @@ -4,6 +4,7 @@ using System; using Avalonia.Platform; using Avalonia.Rendering; +using Avalonia.VisualTree; namespace Avalonia.Media.Imaging { diff --git a/src/Avalonia.SceneGraph/Media/MatrixTransform.cs b/src/Avalonia.SceneGraph/Media/MatrixTransform.cs index 4fa0e3adc1..1507720305 100644 --- a/src/Avalonia.SceneGraph/Media/MatrixTransform.cs +++ b/src/Avalonia.SceneGraph/Media/MatrixTransform.cs @@ -2,6 +2,7 @@ // Licensed under the MIT license. See licence.md file in the project root for full license information. using System; +using Avalonia.VisualTree; namespace Avalonia.Media { diff --git a/src/Avalonia.SceneGraph/Media/PathMarkupParser.cs b/src/Avalonia.SceneGraph/Media/PathMarkupParser.cs index a9b4c21948..9c5ffe7151 100644 --- a/src/Avalonia.SceneGraph/Media/PathMarkupParser.cs +++ b/src/Avalonia.SceneGraph/Media/PathMarkupParser.cs @@ -32,18 +32,14 @@ namespace Avalonia.Media {'1', FillRule.NonZero } }; - private StreamGeometry _geometry; - private readonly StreamGeometryContext _context; /// /// Initializes a new instance of the class. /// - /// The geometry in which the path should be stored. - /// The context for . - public PathMarkupParser(StreamGeometry geometry, StreamGeometryContext context) + /// The context for the geometry. + public PathMarkupParser(StreamGeometryContext context) { - _geometry = geometry; _context = context; } diff --git a/src/Avalonia.SceneGraph/Media/RotateTransform.cs b/src/Avalonia.SceneGraph/Media/RotateTransform.cs index be84cda974..41f2335ced 100644 --- a/src/Avalonia.SceneGraph/Media/RotateTransform.cs +++ b/src/Avalonia.SceneGraph/Media/RotateTransform.cs @@ -2,6 +2,7 @@ // Licensed under the MIT license. See licence.md file in the project root for full license information. using System; +using Avalonia.VisualTree; namespace Avalonia.Media { diff --git a/src/Avalonia.SceneGraph/Media/ScaleTransform.cs b/src/Avalonia.SceneGraph/Media/ScaleTransform.cs index c0f291ed88..dc7d38fde0 100644 --- a/src/Avalonia.SceneGraph/Media/ScaleTransform.cs +++ b/src/Avalonia.SceneGraph/Media/ScaleTransform.cs @@ -2,6 +2,7 @@ // Licensed under the MIT license. See licence.md file in the project root for full license information. using System; +using Avalonia.VisualTree; namespace Avalonia.Media { diff --git a/src/Avalonia.SceneGraph/Media/StreamGeometry.cs b/src/Avalonia.SceneGraph/Media/StreamGeometry.cs index b68f15d862..a1f62b172d 100644 --- a/src/Avalonia.SceneGraph/Media/StreamGeometry.cs +++ b/src/Avalonia.SceneGraph/Media/StreamGeometry.cs @@ -39,7 +39,7 @@ namespace Avalonia.Media using (StreamGeometryContext ctx = result.Open()) { - PathMarkupParser parser = new PathMarkupParser(result, ctx); + PathMarkupParser parser = new PathMarkupParser(ctx); parser.Parse(s); return result; } diff --git a/src/Avalonia.SceneGraph/Media/Transform.cs b/src/Avalonia.SceneGraph/Media/Transform.cs index 075411d3f7..f81938dad7 100644 --- a/src/Avalonia.SceneGraph/Media/Transform.cs +++ b/src/Avalonia.SceneGraph/Media/Transform.cs @@ -3,6 +3,7 @@ using System; using Avalonia.Animation; +using Avalonia.VisualTree; namespace Avalonia.Media { diff --git a/src/Avalonia.SceneGraph/Media/TranslateTransform.cs b/src/Avalonia.SceneGraph/Media/TranslateTransform.cs index f680757925..0c9ca5debc 100644 --- a/src/Avalonia.SceneGraph/Media/TranslateTransform.cs +++ b/src/Avalonia.SceneGraph/Media/TranslateTransform.cs @@ -2,6 +2,7 @@ // Licensed under the MIT license. See licence.md file in the project root for full license information. using System; +using Avalonia.VisualTree; namespace Avalonia.Media { diff --git a/src/Avalonia.Styling/Avalonia.Styling.csproj b/src/Avalonia.Styling/Avalonia.Styling.csproj index 4c1fc4533a..067900e5ca 100644 --- a/src/Avalonia.Styling/Avalonia.Styling.csproj +++ b/src/Avalonia.Styling/Avalonia.Styling.csproj @@ -38,6 +38,7 @@ 4 bin\Release\Avalonia.Styling.XML CS1591 + true diff --git a/src/Avalonia.Styling/Styling/SelectorMatch.cs b/src/Avalonia.Styling/Styling/SelectorMatch.cs index e1d7f8dbaf..f73c1497ce 100644 --- a/src/Avalonia.Styling/Styling/SelectorMatch.cs +++ b/src/Avalonia.Styling/Styling/SelectorMatch.cs @@ -6,12 +6,12 @@ using System; namespace Avalonia.Styling { /// - /// Holds the result of a match. + /// Holds the result of a match. /// /// /// There are two types of selectors - ones whose match can never change for a particular - /// control (such as ) and ones whose result can - /// change over time (such as . For the first + /// control (such as ) and ones whose result can + /// change over time (such as . For the first /// category of selectors, the value of will be set but for the /// second, will be null and will /// hold an observable which tracks the match. diff --git a/src/Avalonia.Styling/Styling/Style.cs b/src/Avalonia.Styling/Styling/Style.cs index 865b066b86..be4282cdc0 100644 --- a/src/Avalonia.Styling/Styling/Style.cs +++ b/src/Avalonia.Styling/Styling/Style.cs @@ -82,7 +82,6 @@ namespace Avalonia.Styling { if (Selector != null) { - var description = "Style " + Selector.ToString(); var match = Selector.Match(control); if (match.ImmediateResult != false) diff --git a/src/Avalonia.Themes.Default/Avalonia.Themes.Default.csproj b/src/Avalonia.Themes.Default/Avalonia.Themes.Default.csproj index 76ed678350..cd0bf77eae 100644 --- a/src/Avalonia.Themes.Default/Avalonia.Themes.Default.csproj +++ b/src/Avalonia.Themes.Default/Avalonia.Themes.Default.csproj @@ -36,6 +36,7 @@ prompt 4 bin\Release\Avalonia.Themes.Default.XML + true diff --git a/src/Gtk/Avalonia.Gtk/EmbeddableImpl.cs b/src/Gtk/Avalonia.Gtk/EmbeddableImpl.cs index 62b2513856..a5a34cd47b 100644 --- a/src/Gtk/Avalonia.Gtk/EmbeddableImpl.cs +++ b/src/Gtk/Avalonia.Gtk/EmbeddableImpl.cs @@ -14,7 +14,9 @@ namespace Avalonia.Gtk { class EmbeddableImpl : WindowImplBase, IEmbeddableWindowImpl { +#pragma warning disable CS0067 // Method not used public event Action LostFocus; +#pragma warning restore CS0067 public EmbeddableImpl(DrawingArea area) : base(area) { diff --git a/src/Markup/Avalonia.Markup.Xaml/AvaloniaXamlLoader.cs b/src/Markup/Avalonia.Markup.Xaml/AvaloniaXamlLoader.cs index 437e6e849f..7b3d0036ef 100644 --- a/src/Markup/Avalonia.Markup.Xaml/AvaloniaXamlLoader.cs +++ b/src/Markup/Avalonia.Markup.Xaml/AvaloniaXamlLoader.cs @@ -8,14 +8,14 @@ using System.Reflection; using System.Text; using OmniXaml; using Avalonia.Platform; +using Avalonia.Markup.Xaml.Context; +using Avalonia.Markup.Xaml.Styling; +using OmniXaml.ObjectAssembler; +using Avalonia.Controls; +using Avalonia.Markup.Xaml.Data; namespace Avalonia.Markup.Xaml { - using Context; - using Controls; - using Data; - using OmniXaml.ObjectAssembler; - using System.Linq; /// /// Loads XAML for a avalonia application. /// @@ -47,7 +47,7 @@ namespace Avalonia.Markup.Xaml /// /// /// TODO: Making this internal for now as I'm not sure that this is the correct - /// thing to do, but its needd by to get the URL of + /// thing to do, but its needed by to get the URL of /// the currently loading XAML file, as we can't use the OmniXAML parsing context /// there. Maybe we need a way to inject OmniXAML context into the objects its /// constructing? diff --git a/src/Markup/Avalonia.Markup/Avalonia.Markup.csproj b/src/Markup/Avalonia.Markup/Avalonia.Markup.csproj index 738f381f4e..88c4a6ab18 100644 --- a/src/Markup/Avalonia.Markup/Avalonia.Markup.csproj +++ b/src/Markup/Avalonia.Markup/Avalonia.Markup.csproj @@ -36,6 +36,7 @@ 4 bin\Release\Avalonia.Markup.XML CS1591 + true diff --git a/src/Shared/PlatformSupport/AssetLoader.cs b/src/Shared/PlatformSupport/AssetLoader.cs index fb695aeeeb..4edb2fdd3c 100644 --- a/src/Shared/PlatformSupport/AssetLoader.cs +++ b/src/Shared/PlatformSupport/AssetLoader.cs @@ -20,6 +20,12 @@ namespace Avalonia.Shared.PlatformSupport private AssemblyDescriptor _defaultAssembly; + /// + /// Initializes a new instance of the class. + /// + /// + /// The default assembly from which to load assets for which no assembly is specified. + /// public AssetLoader(Assembly assembly = null) { if (assembly == null) @@ -28,6 +34,10 @@ namespace Avalonia.Shared.PlatformSupport _defaultAssembly = new AssemblyDescriptor(assembly); } + /// + /// Sets the default assembly from which to load assets for which no assembly is specified. + /// + /// The default assembly. public void SetDefaultAssembly(Assembly assembly) { _defaultAssembly = new AssemblyDescriptor(assembly); @@ -73,8 +83,6 @@ namespace Avalonia.Shared.PlatformSupport { if (!uri.IsAbsoluteUri || uri.Scheme == "resm") { - var uriQueryParams = ParseQueryString(uri); - var baseUriQueryParams = uri != null ? ParseQueryString(uri) : null; var asm = GetAssembly(uri) ?? GetAssembly(baseUri) ?? _defaultAssembly; if (asm == null && _defaultAssembly == null) diff --git a/src/Windows/Avalonia.Direct2D1/Avalonia.Direct2D1.csproj b/src/Windows/Avalonia.Direct2D1/Avalonia.Direct2D1.csproj index 13113ed748..f11eba2397 100644 --- a/src/Windows/Avalonia.Direct2D1/Avalonia.Direct2D1.csproj +++ b/src/Windows/Avalonia.Direct2D1/Avalonia.Direct2D1.csproj @@ -34,6 +34,7 @@ 4 bin\Release\Avalonia.Direct2D1.XML CS1591 + true diff --git a/src/Windows/Avalonia.Direct2D1/Media/StreamGeometryImpl.cs b/src/Windows/Avalonia.Direct2D1/Media/StreamGeometryImpl.cs index 7e88fe8e12..213c4b5c03 100644 --- a/src/Windows/Avalonia.Direct2D1/Media/StreamGeometryImpl.cs +++ b/src/Windows/Avalonia.Direct2D1/Media/StreamGeometryImpl.cs @@ -8,7 +8,7 @@ using D2DGeometry = SharpDX.Direct2D1.Geometry; namespace Avalonia.Direct2D1.Media { /// - /// A Direct2D implementation of a . + /// A Direct2D implementation of a . /// public class StreamGeometryImpl : GeometryImpl, IStreamGeometryImpl { @@ -56,7 +56,7 @@ namespace Avalonia.Direct2D1.Media /// Opens the geometry to start defining it. /// /// - /// A which can be used to define the geometry. + /// An which can be used to define the geometry. /// public IStreamGeometryContextImpl Open() { diff --git a/src/Windows/Avalonia.Win32/Avalonia.Win32.csproj b/src/Windows/Avalonia.Win32/Avalonia.Win32.csproj index 074fe84914..c4bb5c8a25 100644 --- a/src/Windows/Avalonia.Win32/Avalonia.Win32.csproj +++ b/src/Windows/Avalonia.Win32/Avalonia.Win32.csproj @@ -36,6 +36,7 @@ bin\Release\Avalonia.Win32.XML true CS1591 + true diff --git a/tests/Avalonia.Base.UnitTests/AvaloniaObjectTests_Direct.cs b/tests/Avalonia.Base.UnitTests/AvaloniaObjectTests_Direct.cs index cbeb8765c3..7b7a949e7c 100644 --- a/tests/Avalonia.Base.UnitTests/AvaloniaObjectTests_Direct.cs +++ b/tests/Avalonia.Base.UnitTests/AvaloniaObjectTests_Direct.cs @@ -337,7 +337,6 @@ namespace Avalonia.Base.UnitTests [Fact] public void Property_Notifies_Initialized() { - Class1 target; bool raised = false; Class1.FooProperty.Initialized.Subscribe(e => @@ -346,7 +345,7 @@ namespace Avalonia.Base.UnitTests (string)e.NewValue == "initial" && e.Priority == BindingPriority.Unset); - target = new Class1(); + var target = new Class1(); Assert.True(raised); } diff --git a/tests/Avalonia.Controls.UnitTests/Primitives/TabStripTests.cs b/tests/Avalonia.Controls.UnitTests/Primitives/TabStripTests.cs index fdc68bb96a..55b3d6f756 100644 --- a/tests/Avalonia.Controls.UnitTests/Primitives/TabStripTests.cs +++ b/tests/Avalonia.Controls.UnitTests/Primitives/TabStripTests.cs @@ -19,8 +19,10 @@ namespace Avalonia.Controls.UnitTests.Primitives { var items = new[] { +#pragma warning disable CS0252 // Possible unintended reference comparison; left hand side needs cast Mock.Of(x => x.Header == "foo"), Mock.Of(x => x.Header == "bar"), +#pragma warning restore CS0252 // Possible unintended reference comparison; left hand side needs cast }; var target = new TabStrip diff --git a/tests/Avalonia.Input.UnitTests/KeyboardNavigationTests_Arrows.cs b/tests/Avalonia.Input.UnitTests/KeyboardNavigationTests_Arrows.cs index dddb120f26..2b9b0baf01 100644 --- a/tests/Avalonia.Input.UnitTests/KeyboardNavigationTests_Arrows.cs +++ b/tests/Avalonia.Input.UnitTests/KeyboardNavigationTests_Arrows.cs @@ -13,7 +13,6 @@ namespace Avalonia.Input.UnitTests [Fact] public void Down_Continue_Returns_Down_Control_In_Container() { - StackPanel container; Button current; Button next; @@ -21,7 +20,7 @@ namespace Avalonia.Input.UnitTests { Children = new Controls { - (container = new StackPanel + new StackPanel { [KeyboardNavigation.DirectionalNavigationProperty] = KeyboardNavigationMode.Continue, Children = new Controls @@ -30,7 +29,7 @@ namespace Avalonia.Input.UnitTests (current = new Button { Name = "Button2" }), (next = new Button { Name = "Button3" }), } - }), + }, new StackPanel { [KeyboardNavigation.DirectionalNavigationProperty] = KeyboardNavigationMode.Continue, @@ -52,7 +51,6 @@ namespace Avalonia.Input.UnitTests [Fact] public void Down_Continue_Returns_First_Control_In_Down_Sibling_Container() { - StackPanel container; Button current; Button next; @@ -60,7 +58,7 @@ namespace Avalonia.Input.UnitTests { Children = new Controls { - (container = new StackPanel + new StackPanel { [KeyboardNavigation.DirectionalNavigationProperty] = KeyboardNavigationMode.Continue, Children = new Controls @@ -69,7 +67,7 @@ namespace Avalonia.Input.UnitTests new Button { Name = "Button2" }, (current = new Button { Name = "Button3" }), } - }), + }, new StackPanel { [KeyboardNavigation.DirectionalNavigationProperty] = KeyboardNavigationMode.Continue, @@ -91,7 +89,6 @@ namespace Avalonia.Input.UnitTests [Fact] public void Down_Continue_Returns_Down_Sibling() { - StackPanel container; Button current; Button next; @@ -99,7 +96,7 @@ namespace Avalonia.Input.UnitTests { Children = new Controls { - (container = new StackPanel + new StackPanel { [KeyboardNavigation.DirectionalNavigationProperty] = KeyboardNavigationMode.Continue, Children = new Controls @@ -108,7 +105,7 @@ namespace Avalonia.Input.UnitTests new Button { Name = "Button2" }, (current = new Button { Name = "Button3" }), } - }), + }, (next = new Button { Name = "Button4" }), } }; @@ -121,7 +118,6 @@ namespace Avalonia.Input.UnitTests [Fact] public void Down_Continue_Returns_First_Control_In_Down_Uncle_Container() { - StackPanel container; Button current; Button next; @@ -133,7 +129,7 @@ namespace Avalonia.Input.UnitTests { Children = new Controls { - (container = new StackPanel + new StackPanel { [KeyboardNavigation.DirectionalNavigationProperty] = KeyboardNavigationMode.Continue, Children = new Controls @@ -142,7 +138,7 @@ namespace Avalonia.Input.UnitTests new Button { Name = "Button2" }, (current = new Button { Name = "Button3" }), } - }), + }, }, }, new StackPanel @@ -185,7 +181,6 @@ namespace Avalonia.Input.UnitTests [Fact] public void Down_Continue_Wraps() { - StackPanel container; Button current; Button next; @@ -199,7 +194,7 @@ namespace Avalonia.Input.UnitTests [KeyboardNavigation.DirectionalNavigationProperty] = KeyboardNavigationMode.Continue, Children = new Controls { - (container = new StackPanel + new StackPanel { [KeyboardNavigation.DirectionalNavigationProperty] = KeyboardNavigationMode.Continue, Children = new Controls @@ -208,7 +203,7 @@ namespace Avalonia.Input.UnitTests new Button { Name = "Button2" }, new Button { Name = "Button3" }, } - }), + }, }, }, new StackPanel @@ -232,7 +227,6 @@ namespace Avalonia.Input.UnitTests [Fact] public void Down_Cycle_Returns_Down_Control_In_Container() { - StackPanel container; Button current; Button next; @@ -240,7 +234,7 @@ namespace Avalonia.Input.UnitTests { Children = new Controls { - (container = new StackPanel + new StackPanel { [KeyboardNavigation.DirectionalNavigationProperty] = KeyboardNavigationMode.Cycle, Children = new Controls @@ -249,7 +243,7 @@ namespace Avalonia.Input.UnitTests (current = new Button { Name = "Button2" }), (next = new Button { Name = "Button3" }), } - }), + }, new StackPanel { Children = new Controls @@ -270,7 +264,6 @@ namespace Avalonia.Input.UnitTests [Fact] public void Down_Cycle_Wraps_To_First() { - StackPanel container; Button current; Button next; @@ -278,7 +271,7 @@ namespace Avalonia.Input.UnitTests { Children = new Controls { - (container = new StackPanel + new StackPanel { [KeyboardNavigation.DirectionalNavigationProperty] = KeyboardNavigationMode.Cycle, Children = new Controls @@ -287,7 +280,7 @@ namespace Avalonia.Input.UnitTests new Button { Name = "Button2" }, (current = new Button { Name = "Button3" }), } - }), + }, new StackPanel { Children = new Controls @@ -308,7 +301,6 @@ namespace Avalonia.Input.UnitTests [Fact] public void Down_Contained_Returns_Down_Control_In_Container() { - StackPanel container; Button current; Button next; @@ -316,7 +308,7 @@ namespace Avalonia.Input.UnitTests { Children = new Controls { - (container = new StackPanel + new StackPanel { [KeyboardNavigation.DirectionalNavigationProperty] = KeyboardNavigationMode.Contained, Children = new Controls @@ -325,7 +317,7 @@ namespace Avalonia.Input.UnitTests (current = new Button { Name = "Button2" }), (next = new Button { Name = "Button3" }), } - }), + }, new StackPanel { [KeyboardNavigation.DirectionalNavigationProperty] = KeyboardNavigationMode.Contained, @@ -347,24 +339,22 @@ namespace Avalonia.Input.UnitTests [Fact] public void Down_Contained_Stops_At_End() { - StackPanel container; Button current; - Button next; var top = new StackPanel { Children = new Controls { - (container = new StackPanel + new StackPanel { [KeyboardNavigation.DirectionalNavigationProperty] = KeyboardNavigationMode.Contained, Children = new Controls { - (next = new Button { Name = "Button1" }), + new Button { Name = "Button1" }, new Button { Name = "Button2" }, (current = new Button { Name = "Button3" }), } - }), + }, new StackPanel { [KeyboardNavigation.DirectionalNavigationProperty] = KeyboardNavigationMode.Contained, @@ -386,14 +376,13 @@ namespace Avalonia.Input.UnitTests [Fact] public void Down_None_Does_Nothing() { - StackPanel container; Button current; var top = new StackPanel { Children = new Controls { - (container = new StackPanel + new StackPanel { [KeyboardNavigation.DirectionalNavigationProperty] = KeyboardNavigationMode.None, Children = new Controls @@ -402,7 +391,7 @@ namespace Avalonia.Input.UnitTests (current = new Button { Name = "Button2" }), new Button { Name = "Button3" }, } - }), + }, new StackPanel { [KeyboardNavigation.DirectionalNavigationProperty] = KeyboardNavigationMode.Contained, @@ -424,7 +413,6 @@ namespace Avalonia.Input.UnitTests [Fact] public void Up_Continue_Returns_Up_Control_In_Container() { - StackPanel container; Button current; Button next; @@ -432,7 +420,7 @@ namespace Avalonia.Input.UnitTests { Children = new Controls { - (container = new StackPanel + new StackPanel { [KeyboardNavigation.DirectionalNavigationProperty] = KeyboardNavigationMode.Continue, Children = new Controls @@ -441,7 +429,7 @@ namespace Avalonia.Input.UnitTests (next = new Button { Name = "Button2" }), (current = new Button { Name = "Button3" }), } - }), + }, new StackPanel { [KeyboardNavigation.DirectionalNavigationProperty] = KeyboardNavigationMode.Contained, @@ -463,7 +451,6 @@ namespace Avalonia.Input.UnitTests [Fact] public void Up_Continue_Returns_Last_Control_In_Up_Sibling_Container() { - StackPanel container; Button current; Button next; @@ -471,7 +458,7 @@ namespace Avalonia.Input.UnitTests { Children = new Controls { - (container = new StackPanel + new StackPanel { [KeyboardNavigation.DirectionalNavigationProperty] = KeyboardNavigationMode.Continue, Children = new Controls @@ -480,7 +467,7 @@ namespace Avalonia.Input.UnitTests new Button { Name = "Button2" }, (next = new Button { Name = "Button3" }), } - }), + }, new StackPanel { [KeyboardNavigation.DirectionalNavigationProperty] = KeyboardNavigationMode.Continue, @@ -502,7 +489,6 @@ namespace Avalonia.Input.UnitTests [Fact] public void Up_Continue_Returns_Last_Child_Of_Sibling() { - StackPanel container; Button current; Button next; @@ -511,7 +497,7 @@ namespace Avalonia.Input.UnitTests [KeyboardNavigation.DirectionalNavigationProperty] = KeyboardNavigationMode.Continue, Children = new Controls { - (container = new StackPanel + new StackPanel { [KeyboardNavigation.DirectionalNavigationProperty] = KeyboardNavigationMode.Continue, Children = new Controls @@ -520,7 +506,7 @@ namespace Avalonia.Input.UnitTests new Button { Name = "Button2" }, (next = new Button { Name = "Button3" }), } - }), + }, (current = new Button { Name = "Button4" }), } }; @@ -533,7 +519,6 @@ namespace Avalonia.Input.UnitTests [Fact] public void Up_Continue_Returns_Last_Control_In_Up_Nephew_Container() { - StackPanel container; Button current; Button next; @@ -545,7 +530,7 @@ namespace Avalonia.Input.UnitTests { Children = new Controls { - (container = new StackPanel + new StackPanel { [KeyboardNavigation.DirectionalNavigationProperty] = KeyboardNavigationMode.Continue, Children = new Controls @@ -554,7 +539,7 @@ namespace Avalonia.Input.UnitTests new Button { Name = "Button2" }, (next = new Button { Name = "Button3" }), } - }), + }, }, }, new StackPanel @@ -578,7 +563,6 @@ namespace Avalonia.Input.UnitTests [Fact] public void Up_Continue_Wraps() { - StackPanel container; Button current; Button next; @@ -590,7 +574,7 @@ namespace Avalonia.Input.UnitTests { Children = new Controls { - (container = new StackPanel + new StackPanel { [KeyboardNavigation.DirectionalNavigationProperty] = KeyboardNavigationMode.Continue, Children = new Controls @@ -599,7 +583,7 @@ namespace Avalonia.Input.UnitTests new Button { Name = "Button2" }, new Button { Name = "Button3" }, } - }), + }, }, }, new StackPanel @@ -643,7 +627,6 @@ namespace Avalonia.Input.UnitTests [Fact] public void Up_Cycle_Returns_Up_Control_In_Container() { - StackPanel container; Button current; Button next; @@ -651,7 +634,7 @@ namespace Avalonia.Input.UnitTests { Children = new Controls { - (container = new StackPanel + new StackPanel { [KeyboardNavigation.DirectionalNavigationProperty] = KeyboardNavigationMode.Cycle, Children = new Controls @@ -660,7 +643,7 @@ namespace Avalonia.Input.UnitTests (current = new Button { Name = "Button2" }), new Button { Name = "Button3" }, } - }), + }, new StackPanel { [KeyboardNavigation.DirectionalNavigationProperty] = KeyboardNavigationMode.Cycle, @@ -682,7 +665,6 @@ namespace Avalonia.Input.UnitTests [Fact] public void Up_Cycle_Wraps_To_Last() { - StackPanel container; Button current; Button next; @@ -690,7 +672,7 @@ namespace Avalonia.Input.UnitTests { Children = new Controls { - (container = new StackPanel + new StackPanel { [KeyboardNavigation.DirectionalNavigationProperty] = KeyboardNavigationMode.Cycle, Children = new Controls @@ -699,7 +681,7 @@ namespace Avalonia.Input.UnitTests new Button { Name = "Button2" }, (next = new Button { Name = "Button3" }), } - }), + }, new StackPanel { [KeyboardNavigation.DirectionalNavigationProperty] = KeyboardNavigationMode.Cycle, @@ -721,7 +703,6 @@ namespace Avalonia.Input.UnitTests [Fact] public void Up_Contained_Returns_Up_Control_In_Container() { - StackPanel container; Button current; Button next; @@ -729,7 +710,7 @@ namespace Avalonia.Input.UnitTests { Children = new Controls { - (container = new StackPanel + new StackPanel { [KeyboardNavigation.DirectionalNavigationProperty] = KeyboardNavigationMode.Contained, Children = new Controls @@ -738,7 +719,7 @@ namespace Avalonia.Input.UnitTests (current = new Button { Name = "Button2" }), new Button { Name = "Button3" }, } - }), + }, new StackPanel { [KeyboardNavigation.DirectionalNavigationProperty] = KeyboardNavigationMode.Contained, @@ -760,14 +741,13 @@ namespace Avalonia.Input.UnitTests [Fact] public void Up_Contained_Stops_At_Beginning() { - StackPanel container; Button current; var top = new StackPanel { Children = new Controls { - (container = new StackPanel + new StackPanel { [KeyboardNavigation.DirectionalNavigationProperty] = KeyboardNavigationMode.Contained, Children = new Controls @@ -776,7 +756,7 @@ namespace Avalonia.Input.UnitTests new Button { Name = "Button2" }, new Button { Name = "Button3" }, } - }), + }, new StackPanel { [KeyboardNavigation.DirectionalNavigationProperty] = KeyboardNavigationMode.Contained, diff --git a/tests/Avalonia.Input.UnitTests/KeyboardNavigationTests_Tab.cs b/tests/Avalonia.Input.UnitTests/KeyboardNavigationTests_Tab.cs index efc9abedbb..2cc7a4281b 100644 --- a/tests/Avalonia.Input.UnitTests/KeyboardNavigationTests_Tab.cs +++ b/tests/Avalonia.Input.UnitTests/KeyboardNavigationTests_Tab.cs @@ -13,7 +13,6 @@ namespace Avalonia.Input.UnitTests [Fact] public void Next_Continue_Returns_Next_Control_In_Container() { - StackPanel container; Button current; Button next; @@ -21,7 +20,7 @@ namespace Avalonia.Input.UnitTests { Children = new Controls { - (container = new StackPanel + new StackPanel { Children = new Controls { @@ -29,7 +28,7 @@ namespace Avalonia.Input.UnitTests (current = new Button { Name = "Button2" }), (next = new Button { Name = "Button3" }), } - }), + }, new StackPanel { Children = new Controls @@ -50,7 +49,6 @@ namespace Avalonia.Input.UnitTests [Fact] public void Next_Continue_Returns_First_Control_In_Next_Sibling_Container() { - StackPanel container; Button current; Button next; @@ -58,7 +56,7 @@ namespace Avalonia.Input.UnitTests { Children = new Controls { - (container = new StackPanel + new StackPanel { Children = new Controls { @@ -66,7 +64,7 @@ namespace Avalonia.Input.UnitTests new Button { Name = "Button2" }, (current = new Button { Name = "Button3" }), } - }), + }, new StackPanel { Children = new Controls @@ -87,7 +85,6 @@ namespace Avalonia.Input.UnitTests [Fact] public void Next_Continue_Doesnt_Enter_Panel_With_TabNavigation_None() { - StackPanel container; Button current; Button next; @@ -95,7 +92,7 @@ namespace Avalonia.Input.UnitTests { Children = new Controls { - (container = new StackPanel + new StackPanel { Children = new Controls { @@ -103,7 +100,7 @@ namespace Avalonia.Input.UnitTests new Button { Name = "Button2" }, (current = new Button { Name = "Button3" }), } - }), + }, new StackPanel { [KeyboardNavigation.TabNavigationProperty] = KeyboardNavigationMode.None, @@ -131,7 +128,6 @@ namespace Avalonia.Input.UnitTests [Fact] public void Next_Continue_Returns_Next_Sibling() { - StackPanel container; Button current; Button next; @@ -139,7 +135,7 @@ namespace Avalonia.Input.UnitTests { Children = new Controls { - (container = new StackPanel + new StackPanel { Children = new Controls { @@ -147,7 +143,7 @@ namespace Avalonia.Input.UnitTests new Button { Name = "Button2" }, (current = new Button { Name = "Button3" }), } - }), + }, (next = new Button { Name = "Button4" }), } }; @@ -160,7 +156,6 @@ namespace Avalonia.Input.UnitTests [Fact] public void Next_Continue_Returns_First_Control_In_Next_Uncle_Container() { - StackPanel container; Button current; Button next; @@ -172,7 +167,7 @@ namespace Avalonia.Input.UnitTests { Children = new Controls { - (container = new StackPanel + new StackPanel { Children = new Controls { @@ -180,7 +175,7 @@ namespace Avalonia.Input.UnitTests new Button { Name = "Button2" }, (current = new Button { Name = "Button3" }), } - }), + }, }, }, new StackPanel @@ -221,7 +216,6 @@ namespace Avalonia.Input.UnitTests [Fact] public void Next_Continue_Wraps() { - StackPanel container; Button current; Button next; @@ -233,7 +227,7 @@ namespace Avalonia.Input.UnitTests { Children = new Controls { - (container = new StackPanel + new StackPanel { Children = new Controls { @@ -241,7 +235,7 @@ namespace Avalonia.Input.UnitTests new Button { Name = "Button2" }, new Button { Name = "Button3" }, } - }), + }, }, }, new StackPanel @@ -264,7 +258,6 @@ namespace Avalonia.Input.UnitTests [Fact] public void Next_Cycle_Returns_Next_Control_In_Container() { - StackPanel container; Button current; Button next; @@ -272,7 +265,7 @@ namespace Avalonia.Input.UnitTests { Children = new Controls { - (container = new StackPanel + new StackPanel { [KeyboardNavigation.TabNavigationProperty] = KeyboardNavigationMode.Cycle, Children = new Controls @@ -281,7 +274,7 @@ namespace Avalonia.Input.UnitTests (current = new Button { Name = "Button2" }), (next = new Button { Name = "Button3" }), } - }), + }, new StackPanel { Children = new Controls @@ -302,7 +295,6 @@ namespace Avalonia.Input.UnitTests [Fact] public void Next_Cycle_Wraps_To_First() { - StackPanel container; Button current; Button next; @@ -310,7 +302,7 @@ namespace Avalonia.Input.UnitTests { Children = new Controls { - (container = new StackPanel + new StackPanel { [KeyboardNavigation.TabNavigationProperty] = KeyboardNavigationMode.Cycle, Children = new Controls @@ -319,7 +311,7 @@ namespace Avalonia.Input.UnitTests new Button { Name = "Button2" }, (current = new Button { Name = "Button3" }), } - }), + }, new StackPanel { Children = new Controls @@ -340,7 +332,6 @@ namespace Avalonia.Input.UnitTests [Fact] public void Next_Contained_Returns_Next_Control_In_Container() { - StackPanel container; Button current; Button next; @@ -348,7 +339,7 @@ namespace Avalonia.Input.UnitTests { Children = new Controls { - (container = new StackPanel + new StackPanel { [KeyboardNavigation.TabNavigationProperty] = KeyboardNavigationMode.Contained, Children = new Controls @@ -357,7 +348,7 @@ namespace Avalonia.Input.UnitTests (current = new Button { Name = "Button2" }), (next = new Button { Name = "Button3" }), } - }), + }, new StackPanel { Children = new Controls @@ -378,24 +369,22 @@ namespace Avalonia.Input.UnitTests [Fact] public void Next_Contained_Stops_At_End() { - StackPanel container; Button current; - Button next; var top = new StackPanel { Children = new Controls { - (container = new StackPanel + new StackPanel { [KeyboardNavigation.TabNavigationProperty] = KeyboardNavigationMode.Contained, Children = new Controls { - (next = new Button { Name = "Button1" }), + new Button { Name = "Button1" }, new Button { Name = "Button2" }, (current = new Button { Name = "Button3" }), } - }), + }, new StackPanel { Children = new Controls @@ -416,7 +405,6 @@ namespace Avalonia.Input.UnitTests [Fact] public void Next_Once_Moves_To_Next_Container() { - StackPanel container; Button current; Button next; @@ -424,7 +412,7 @@ namespace Avalonia.Input.UnitTests { Children = new Controls { - (container = new StackPanel + new StackPanel { [KeyboardNavigation.TabNavigationProperty] = KeyboardNavigationMode.Once, Children = new Controls @@ -433,7 +421,7 @@ namespace Avalonia.Input.UnitTests (current = new Button { Name = "Button2" }), new Button { Name = "Button3" }, } - }), + }, new StackPanel { Children = new Controls @@ -494,7 +482,6 @@ namespace Avalonia.Input.UnitTests [Fact] public void Next_None_Moves_To_Next_Container() { - StackPanel container; Button current; Button next; @@ -502,7 +489,7 @@ namespace Avalonia.Input.UnitTests { Children = new Controls { - (container = new StackPanel + new StackPanel { [KeyboardNavigation.TabNavigationProperty] = KeyboardNavigationMode.None, Children = new Controls @@ -511,7 +498,7 @@ namespace Avalonia.Input.UnitTests (current = new Button { Name = "Button2" }), new Button { Name = "Button3" }, } - }), + }, new StackPanel { Children = new Controls @@ -572,7 +559,6 @@ namespace Avalonia.Input.UnitTests [Fact] public void Previous_Continue_Returns_Previous_Control_In_Container() { - StackPanel container; Button current; Button next; @@ -580,7 +566,7 @@ namespace Avalonia.Input.UnitTests { Children = new Controls { - (container = new StackPanel + new StackPanel { Children = new Controls { @@ -588,7 +574,7 @@ namespace Avalonia.Input.UnitTests (next = new Button { Name = "Button2" }), (current = new Button { Name = "Button3" }), } - }), + }, new StackPanel { Children = new Controls @@ -609,7 +595,6 @@ namespace Avalonia.Input.UnitTests [Fact] public void Previous_Continue_Returns_Last_Control_In_Previous_Sibling_Container() { - StackPanel container; Button current; Button next; @@ -617,7 +602,7 @@ namespace Avalonia.Input.UnitTests { Children = new Controls { - (container = new StackPanel + new StackPanel { Children = new Controls { @@ -625,7 +610,7 @@ namespace Avalonia.Input.UnitTests new Button { Name = "Button2" }, (next = new Button { Name = "Button3" }), } - }), + }, new StackPanel { Children = new Controls @@ -646,7 +631,6 @@ namespace Avalonia.Input.UnitTests [Fact] public void Previous_Continue_Returns_Last_Child_Of_Sibling() { - StackPanel container; Button current; Button next; @@ -654,7 +638,7 @@ namespace Avalonia.Input.UnitTests { Children = new Controls { - (container = new StackPanel + new StackPanel { Children = new Controls { @@ -662,7 +646,7 @@ namespace Avalonia.Input.UnitTests new Button { Name = "Button2" }, (next = new Button { Name = "Button3" }), } - }), + }, (current = new Button { Name = "Button4" }), } }; @@ -675,7 +659,6 @@ namespace Avalonia.Input.UnitTests [Fact] public void Previous_Continue_Returns_Last_Control_In_Previous_Nephew_Container() { - StackPanel container; Button current; Button next; @@ -687,7 +670,7 @@ namespace Avalonia.Input.UnitTests { Children = new Controls { - (container = new StackPanel + new StackPanel { Children = new Controls { @@ -695,7 +678,7 @@ namespace Avalonia.Input.UnitTests new Button { Name = "Button2" }, (next = new Button { Name = "Button3" }), } - }), + }, }, }, new StackPanel @@ -718,7 +701,6 @@ namespace Avalonia.Input.UnitTests [Fact] public void Previous_Continue_Wraps() { - StackPanel container; Button current; Button next; @@ -730,7 +712,7 @@ namespace Avalonia.Input.UnitTests { Children = new Controls { - (container = new StackPanel + new StackPanel { Children = new Controls { @@ -738,7 +720,7 @@ namespace Avalonia.Input.UnitTests new Button { Name = "Button2" }, new Button { Name = "Button3" }, } - }), + }, }, }, new StackPanel @@ -780,7 +762,6 @@ namespace Avalonia.Input.UnitTests [Fact] public void Previous_Cycle_Returns_Previous_Control_In_Container() { - StackPanel container; Button current; Button next; @@ -788,7 +769,7 @@ namespace Avalonia.Input.UnitTests { Children = new Controls { - (container = new StackPanel + new StackPanel { [KeyboardNavigation.TabNavigationProperty] = KeyboardNavigationMode.Cycle, Children = new Controls @@ -797,7 +778,7 @@ namespace Avalonia.Input.UnitTests (current = new Button { Name = "Button2" }), new Button { Name = "Button3" }, } - }), + }, new StackPanel { Children = new Controls @@ -818,7 +799,6 @@ namespace Avalonia.Input.UnitTests [Fact] public void Previous_Cycle_Wraps_To_Last() { - StackPanel container; Button current; Button next; @@ -826,7 +806,7 @@ namespace Avalonia.Input.UnitTests { Children = new Controls { - (container = new StackPanel + new StackPanel { [KeyboardNavigation.TabNavigationProperty] = KeyboardNavigationMode.Cycle, Children = new Controls @@ -835,7 +815,7 @@ namespace Avalonia.Input.UnitTests new Button { Name = "Button2" }, (next = new Button { Name = "Button3" }), } - }), + }, new StackPanel { Children = new Controls @@ -856,7 +836,6 @@ namespace Avalonia.Input.UnitTests [Fact] public void Previous_Contained_Returns_Previous_Control_In_Container() { - StackPanel container; Button current; Button next; @@ -864,7 +843,7 @@ namespace Avalonia.Input.UnitTests { Children = new Controls { - (container = new StackPanel + new StackPanel { [KeyboardNavigation.TabNavigationProperty] = KeyboardNavigationMode.Contained, Children = new Controls @@ -873,7 +852,7 @@ namespace Avalonia.Input.UnitTests (current = new Button { Name = "Button2" }), new Button { Name = "Button3" }, } - }), + }, new StackPanel { Children = new Controls @@ -894,24 +873,22 @@ namespace Avalonia.Input.UnitTests [Fact] public void Previous_Contained_Stops_At_Beginning() { - StackPanel container; Button current; - Button next; var top = new StackPanel { Children = new Controls { - (container = new StackPanel + new StackPanel { [KeyboardNavigation.TabNavigationProperty] = KeyboardNavigationMode.Contained, Children = new Controls { (current = new Button { Name = "Button1" }), new Button { Name = "Button2" }, - (next = new Button { Name = "Button3" }), + new Button { Name = "Button3" }, } - }), + }, new StackPanel { Children = new Controls @@ -932,7 +909,6 @@ namespace Avalonia.Input.UnitTests [Fact] public void Previous_Once_Moves_To_Previous_Container() { - StackPanel container; Button current; Button next; @@ -940,7 +916,7 @@ namespace Avalonia.Input.UnitTests { Children = new Controls { - (container = new StackPanel + new StackPanel { Children = new Controls { @@ -948,7 +924,7 @@ namespace Avalonia.Input.UnitTests new Button { Name = "Button2" }, (next = new Button { Name = "Button3" }), } - }), + }, new StackPanel { [KeyboardNavigation.TabNavigationProperty] = KeyboardNavigationMode.Once, @@ -1010,7 +986,6 @@ namespace Avalonia.Input.UnitTests [Fact] public void Previous_Once_Moves_To_First_Element() { - StackPanel container; Button current; Button next; @@ -1018,7 +993,7 @@ namespace Avalonia.Input.UnitTests { Children = new Controls { - (container = new StackPanel + new StackPanel { [KeyboardNavigation.TabNavigationProperty] = KeyboardNavigationMode.Once, Children = new Controls @@ -1027,7 +1002,7 @@ namespace Avalonia.Input.UnitTests new Button { Name = "Button2" }, new Button { Name = "Button3" }, } - }), + }, new StackPanel { Children = new Controls diff --git a/tests/Avalonia.SceneGraph.UnitTests/Media/PathMarkupParserTests.cs b/tests/Avalonia.SceneGraph.UnitTests/Media/PathMarkupParserTests.cs index cb8fccb7a1..da48ea36f0 100644 --- a/tests/Avalonia.SceneGraph.UnitTests/Media/PathMarkupParserTests.cs +++ b/tests/Avalonia.SceneGraph.UnitTests/Media/PathMarkupParserTests.cs @@ -92,7 +92,6 @@ namespace Avalonia.SceneGraph.UnitTests.Media .ToConstant(Mock.Of()); return new PathMarkupParser( - new StreamGeometry(), new StreamGeometryContext(implMock != null ? implMock.Object : Mock.Of())); } } diff --git a/tests/Avalonia.Styling.UnitTests/TestControlBase.cs b/tests/Avalonia.Styling.UnitTests/TestControlBase.cs index 2ceccbd06b..f57ac836fb 100644 --- a/tests/Avalonia.Styling.UnitTests/TestControlBase.cs +++ b/tests/Avalonia.Styling.UnitTests/TestControlBase.cs @@ -17,7 +17,9 @@ namespace Avalonia.Styling.UnitTests SubscribeCheckObservable = new TestObservable(); } +#pragma warning disable CS0067 // Event not used public event EventHandler PropertyChanged; +#pragma warning restore CS0067 public string Name { get; set; }