From ca4c21256a18e3e919a37ed6860014eb93bdc6d8 Mon Sep 17 00:00:00 2001 From: Steven Kirk Date: Sat, 28 Nov 2015 22:12:38 +0100 Subject: [PATCH] Fixed some warnings. --- .../Perspex.Gtk/Input/GtkKeyboardDevice.cs | 2 +- .../Data/ExpressionNodeBuilder.cs | 2 +- .../Data/ExpressionParseException.cs | 19 +++++++++++++------ .../Data/Parsers/ArgumentListParser.cs | 8 ++++---- .../Data/Parsers/ExpressionParser.cs | 4 ++-- src/Perspex.Base/Threading/DispatcherTimer.cs | 2 -- .../Platform/IPlatformRenderInterface.cs | 2 -- src/Perspex.Styling/Styling/Selectors.cs | 1 - src/Skia/Perspex.Skia/BitmapImpl.cs | 3 --- .../Perspex.Direct2D1/Media/TileBrushImpl.cs | 8 ++++---- src/Windows/Perspex.Direct2D1/RenderTarget.cs | 2 -- .../Input/WindowsKeyboardDevice.cs | 4 +--- .../Perspex.Win32/Interop/UnmanagedMethods.cs | 2 +- .../InteractiveTests.cs | 2 -- 14 files changed, 27 insertions(+), 34 deletions(-) diff --git a/src/Gtk/Perspex.Gtk/Input/GtkKeyboardDevice.cs b/src/Gtk/Perspex.Gtk/Input/GtkKeyboardDevice.cs index 3ccec97656..b0b9016ff6 100644 --- a/src/Gtk/Perspex.Gtk/Input/GtkKeyboardDevice.cs +++ b/src/Gtk/Perspex.Gtk/Input/GtkKeyboardDevice.cs @@ -214,7 +214,7 @@ namespace Perspex.Gtk //{ Gdk.Key.?, Key.DeadCharProcessed } }; - public static GtkKeyboardDevice Instance { get; } = new GtkKeyboardDevice(); + public new static GtkKeyboardDevice Instance { get; } = new GtkKeyboardDevice(); public static Key ConvertKey(Gdk.Key key) { diff --git a/src/Markup/Perspex.Markup/Data/ExpressionNodeBuilder.cs b/src/Markup/Perspex.Markup/Data/ExpressionNodeBuilder.cs index af70bc717e..93b38a438a 100644 --- a/src/Markup/Perspex.Markup/Data/ExpressionNodeBuilder.cs +++ b/src/Markup/Perspex.Markup/Data/ExpressionNodeBuilder.cs @@ -20,7 +20,7 @@ namespace Perspex.Markup.Data if (!reader.End) { - throw new ExpressionParseException(reader, "Expected end of expression."); + throw new ExpressionParseException(reader.Position, "Expected end of expression."); } return node; diff --git a/src/Markup/Perspex.Markup/Data/ExpressionParseException.cs b/src/Markup/Perspex.Markup/Data/ExpressionParseException.cs index fffeac8a77..d92f42cab7 100644 --- a/src/Markup/Perspex.Markup/Data/ExpressionParseException.cs +++ b/src/Markup/Perspex.Markup/Data/ExpressionParseException.cs @@ -6,19 +6,26 @@ using Perspex.Markup.Data.Parsers; namespace Perspex.Markup.Data { + /// + /// Exception thrown when could not parse the provided + /// expression string. + /// public class ExpressionParseException : Exception { - internal ExpressionParseException(int column, string message) + /// + /// Initializes a new instance of the class. + /// + /// The column position of the error. + /// The exception message. + public ExpressionParseException(int column, string message) : base(message) { Column = column; } - internal ExpressionParseException(Reader r, string message) - : this(r.Position, message) - { - } - + /// + /// Gets the column position at which the error occurred. + /// public int Column { get; } } } diff --git a/src/Markup/Perspex.Markup/Data/Parsers/ArgumentListParser.cs b/src/Markup/Perspex.Markup/Data/Parsers/ArgumentListParser.cs index 588e3257b5..5b67166739 100644 --- a/src/Markup/Perspex.Markup/Data/Parsers/ArgumentListParser.cs +++ b/src/Markup/Perspex.Markup/Data/Parsers/ArgumentListParser.cs @@ -26,14 +26,14 @@ namespace Perspex.Markup.Data.Parsers } else { - throw new ExpressionParseException(r, "Expected integer."); + throw new ExpressionParseException(r.Position, "Expected integer."); } r.SkipWhitespace(); if (r.End) { - throw new ExpressionParseException(r, "Expected ','."); + throw new ExpressionParseException(r.Position, "Expected ','."); } else if (r.TakeIf(close)) { @@ -43,7 +43,7 @@ namespace Perspex.Markup.Data.Parsers { if (r.Take() != ',') { - throw new ExpressionParseException(r, "Expected ','."); + throw new ExpressionParseException(r.Position, "Expected ','."); } r.SkipWhitespace(); @@ -57,7 +57,7 @@ namespace Perspex.Markup.Data.Parsers } else { - throw new ExpressionParseException(r, "Expected ']'."); + throw new ExpressionParseException(r.Position, "Expected ']'."); } } diff --git a/src/Markup/Perspex.Markup/Data/Parsers/ExpressionParser.cs b/src/Markup/Perspex.Markup/Data/Parsers/ExpressionParser.cs index 6f743175c9..2ec7f49f5c 100644 --- a/src/Markup/Perspex.Markup/Data/Parsers/ExpressionParser.cs +++ b/src/Markup/Perspex.Markup/Data/Parsers/ExpressionParser.cs @@ -34,7 +34,7 @@ namespace Perspex.Markup.Data.Parsers if (state == State.BeforeMember) { - throw new ExpressionParseException(r, "Unexpected end of expression."); + throw new ExpressionParseException(r.Position, "Unexpected end of expression."); } for (int n = 0; n < nodes.Count - 1; ++n) @@ -80,7 +80,7 @@ namespace Perspex.Markup.Data.Parsers { if (args.Count == 0) { - throw new ExpressionParseException(r, "Indexer may not be empty."); + throw new ExpressionParseException(r.Position, "Indexer may not be empty."); } nodes.Add(new IndexerNode(args)); diff --git a/src/Perspex.Base/Threading/DispatcherTimer.cs b/src/Perspex.Base/Threading/DispatcherTimer.cs index d84bcf519e..18eedff08f 100644 --- a/src/Perspex.Base/Threading/DispatcherTimer.cs +++ b/src/Perspex.Base/Threading/DispatcherTimer.cs @@ -31,7 +31,6 @@ namespace Perspex.Threading /// Initializes a new instance of the class. /// /// The priority to use. - /// The dispatcher to use. public DispatcherTimer(DispatcherPriority priority) { _priority = priority; @@ -43,7 +42,6 @@ namespace Perspex.Threading /// /// The interval at which to tick. /// The priority to use. - /// The dispatcher to use. /// The event to call when the timer ticks. public DispatcherTimer(TimeSpan interval, DispatcherPriority priority, EventHandler callback) : this(priority) { diff --git a/src/Perspex.SceneGraph/Platform/IPlatformRenderInterface.cs b/src/Perspex.SceneGraph/Platform/IPlatformRenderInterface.cs index ccf55104a8..244c3bc335 100644 --- a/src/Perspex.SceneGraph/Platform/IPlatformRenderInterface.cs +++ b/src/Perspex.SceneGraph/Platform/IPlatformRenderInterface.cs @@ -39,8 +39,6 @@ namespace Perspex.Platform /// Creates a renderer. /// /// The platform handle for the renderer. - /// The initial width of the render. - /// The initial height of the render. /// An . IRenderTarget CreateRenderer(IPlatformHandle handle); diff --git a/src/Perspex.Styling/Styling/Selectors.cs b/src/Perspex.Styling/Styling/Selectors.cs index d291bcd3f9..65f0d6dee0 100644 --- a/src/Perspex.Styling/Styling/Selectors.cs +++ b/src/Perspex.Styling/Styling/Selectors.cs @@ -131,7 +131,6 @@ namespace Perspex.Styling /// /// Returns a selector which matches a control with the specified property value. /// - /// The property type. /// The previous selector. /// The property. /// The property value. diff --git a/src/Skia/Perspex.Skia/BitmapImpl.cs b/src/Skia/Perspex.Skia/BitmapImpl.cs index 75c2ae5213..83d89feac0 100644 --- a/src/Skia/Perspex.Skia/BitmapImpl.cs +++ b/src/Skia/Perspex.Skia/BitmapImpl.cs @@ -10,9 +10,6 @@ namespace Perspex.Skia { class BitmapImpl : PerspexHandleHolder, IRenderTargetBitmapImpl { - private int width; - private int height; - public void Save(string fileName) { var ext = Path.GetExtension(fileName)?.ToLower(); diff --git a/src/Windows/Perspex.Direct2D1/Media/TileBrushImpl.cs b/src/Windows/Perspex.Direct2D1/Media/TileBrushImpl.cs index 0f0d929b9e..413035f5e9 100644 --- a/src/Windows/Perspex.Direct2D1/Media/TileBrushImpl.cs +++ b/src/Windows/Perspex.Direct2D1/Media/TileBrushImpl.cs @@ -36,7 +36,7 @@ namespace Perspex.Direct2D1.Media } - protected static BrushProperties GetBrushProperties(TileBrush brush, Rect destinationRect) + private static BrushProperties GetBrushProperties(TileBrush brush, Rect destinationRect) { return new BrushProperties { @@ -49,7 +49,7 @@ namespace Perspex.Direct2D1.Media }; } - protected static BitmapBrushProperties GetBitmapBrushProperties(TileBrush brush) + private static BitmapBrushProperties GetBitmapBrushProperties(TileBrush brush) { var tileMode = brush.TileMode; @@ -60,12 +60,12 @@ namespace Perspex.Direct2D1.Media }; } - protected static ExtendMode GetExtendModeX(TileMode tileMode) + private static ExtendMode GetExtendModeX(TileMode tileMode) { return (tileMode & TileMode.FlipX) != 0 ? ExtendMode.Mirror : ExtendMode.Wrap; } - protected static ExtendMode GetExtendModeY(TileMode tileMode) + private static ExtendMode GetExtendModeY(TileMode tileMode) { return (tileMode & TileMode.FlipY) != 0 ? ExtendMode.Mirror : ExtendMode.Wrap; } diff --git a/src/Windows/Perspex.Direct2D1/RenderTarget.cs b/src/Windows/Perspex.Direct2D1/RenderTarget.cs index 53a04683d2..9627f25053 100644 --- a/src/Windows/Perspex.Direct2D1/RenderTarget.cs +++ b/src/Windows/Perspex.Direct2D1/RenderTarget.cs @@ -30,8 +30,6 @@ namespace Perspex.Direct2D1 /// Initializes a new instance of the class. /// /// The window handle. - /// The width of the window. - /// The height of the window. public RenderTarget(IntPtr hwnd) { _hwnd = hwnd; diff --git a/src/Windows/Perspex.Win32/Input/WindowsKeyboardDevice.cs b/src/Windows/Perspex.Win32/Input/WindowsKeyboardDevice.cs index 10598c4e00..34935f5e82 100644 --- a/src/Windows/Perspex.Win32/Input/WindowsKeyboardDevice.cs +++ b/src/Windows/Perspex.Win32/Input/WindowsKeyboardDevice.cs @@ -10,11 +10,9 @@ namespace Perspex.Win32.Input { public class WindowsKeyboardDevice : KeyboardDevice { - private static readonly WindowsKeyboardDevice s_instance = new WindowsKeyboardDevice(); - private readonly byte[] _keyStates = new byte[256]; - public static new WindowsKeyboardDevice Instance => s_instance; + public new static WindowsKeyboardDevice Instance { get; } = new WindowsKeyboardDevice(); public InputModifiers Modifiers { diff --git a/src/Windows/Perspex.Win32/Interop/UnmanagedMethods.cs b/src/Windows/Perspex.Win32/Interop/UnmanagedMethods.cs index 80dd0cd672..3c7154e480 100644 --- a/src/Windows/Perspex.Win32/Interop/UnmanagedMethods.cs +++ b/src/Windows/Perspex.Win32/Interop/UnmanagedMethods.cs @@ -7,7 +7,7 @@ using System.Runtime.InteropServices; using System.Text; // ReSharper disable InconsistentNaming -#pragma warning disable 169 +#pragma warning disable 169, 649 namespace Perspex.Win32.Interop { diff --git a/tests/Perspex.Interactivity.UnitTests/InteractiveTests.cs b/tests/Perspex.Interactivity.UnitTests/InteractiveTests.cs index 156fa05fce..3a3d47947a 100644 --- a/tests/Perspex.Interactivity.UnitTests/InteractiveTests.cs +++ b/tests/Perspex.Interactivity.UnitTests/InteractiveTests.cs @@ -338,8 +338,6 @@ namespace Perspex.Interactivity.UnitTests private class TestInteractive : Interactive { - public string Name { get; set; } - public bool ClassHandlerInvoked { get; private set; } public IEnumerable Children