Browse Source

"field can be readonly"

pull/131/head
Nikita Tsukanov 11 years ago
parent
commit
3cd3579475
  1. 6
      Tests/Perspex.Markup.Xaml.UnitTests/DataContextChangeSynchronizerTest.cs
  2. 4
      samples/TestApplication/Program.cs
  3. 2
      src/Gtk/Perspex.Cairo/CairoPlatform.cs
  4. 2
      src/Gtk/Perspex.Cairo/Media/DrawingContext.cs
  5. 6
      src/Gtk/Perspex.Cairo/Media/StreamGeometryContextImpl.cs
  6. 2
      src/Gtk/Perspex.Cairo/Media/StreamGeometryImpl.cs
  7. 2
      src/Gtk/Perspex.Cairo/Renderer.cs
  8. 2
      src/Gtk/Perspex.Gtk/GtkPlatform.cs
  9. 2
      src/Gtk/Perspex.Gtk/Input/GtkKeyboardDevice.cs
  10. 2
      src/Gtk/Perspex.Gtk/Input/GtkMouseDevice.cs
  11. 4
      src/Markup/Perspex.Markup.Xaml/DataBinding/XamlBindingDefinition.cs
  12. 4
      src/Perspex.Animation/Animation.cs
  13. 4
      src/Perspex.Animation/Animation`1.cs
  14. 2
      src/Perspex.Application/Application.cs
  15. 6
      src/Perspex.Base/PerspexObject.cs
  16. 8
      src/Perspex.Base/PerspexProperty.cs
  17. 4
      src/Perspex.Base/PriorityLevel.cs
  18. 10
      src/Perspex.Base/PriorityValue.cs
  19. 4
      src/Perspex.Base/Threading/Dispatcher.cs
  20. 2
      src/Perspex.Base/Threading/DispatcherTimer.cs
  21. 4
      src/Perspex.Base/Threading/MainLoop.cs
  22. 2
      src/Perspex.Controls/Control.cs
  23. 2
      src/Perspex.Controls/Generators/ItemContainerGenerator.cs
  24. 4
      src/Perspex.Controls/Generators/TreeItemContainerGenerator.cs
  25. 8
      src/Perspex.Controls/Grid.cs
  26. 4
      src/Perspex.Controls/GridLength.cs
  27. 2
      src/Perspex.Controls/MenuItemAccessKeyHandler.cs
  28. 2
      src/Perspex.Controls/Panel.cs
  29. 2
      src/Perspex.Controls/Presenters/TextPresenter.cs
  30. 4
      src/Perspex.Controls/Primitives/AdornerLayer.cs
  31. 2
      src/Perspex.Controls/Primitives/TemplatedControl.cs
  32. 2
      src/Perspex.Controls/Templates/DataTemplate.cs
  33. 2
      src/Perspex.Controls/Templates/FuncTemplate`1.cs
  34. 2
      src/Perspex.Controls/Templates/FuncTemplate`2.cs
  35. 4
      src/Perspex.Controls/Templates/TreeDataTemplate.cs
  36. 2
      src/Perspex.Controls/ToolTip.cs
  37. 12
      src/Perspex.Controls/TopLevel.cs
  38. 2
      src/Perspex.Diagnostics/DevTools.cs
  39. 4
      src/Perspex.Diagnostics/ViewModels/DevToolsViewModel.cs
  40. 2
      src/Perspex.Diagnostics/ViewModels/LogicalTreeViewModel.cs
  41. 2
      src/Perspex.Diagnostics/ViewModels/VisualTreeViewModel.cs
  42. 2
      src/Perspex.Input/AccessKeyHandler.cs
  43. 2
      src/Perspex.Input/FocusManager.cs
  44. 4
      src/Perspex.Input/InputManager.cs
  45. 2
      src/Perspex.Input/MouseDevice.cs
  46. 2
      src/Perspex.Interactivity/Interactive.cs
  47. 2
      src/Perspex.Interactivity/RoutedEvent.cs
  48. 6
      src/Perspex.Layout/LayoutManager.cs
  49. 2
      src/Perspex.Layout/Layoutable.cs
  50. 12
      src/Perspex.SceneGraph/Matrix.cs
  51. 2
      src/Perspex.SceneGraph/Media/PathMarkupParser.cs
  52. 2
      src/Perspex.SceneGraph/Media/StreamGeometryContext.cs
  53. 2
      src/Perspex.SceneGraph/Origin.cs
  54. 4
      src/Perspex.SceneGraph/Point.cs
  55. 8
      src/Perspex.SceneGraph/Rect.cs
  56. 2
      src/Perspex.SceneGraph/Rendering/RenderManager.cs
  57. 4
      src/Perspex.SceneGraph/Size.cs
  58. 8
      src/Perspex.SceneGraph/Thickness.cs
  59. 4
      src/Perspex.SceneGraph/Vector.cs
  60. 4
      src/Perspex.SceneGraph/Visual.cs
  61. 8
      src/Perspex.Styling/Styling/Classes.cs
  62. 6
      src/Perspex.Styling/Styling/Selector.cs
  63. 8
      src/Perspex.Styling/Styling/StyleActivator.cs
  64. 2
      src/Perspex.Styling/Styling/StyleBinding.cs
  65. 8
      src/Windows/Perspex.Direct2D1/Direct2D1Platform.cs
  66. 2
      src/Windows/Perspex.Direct2D1/Disposable.cs
  67. 2
      src/Windows/Perspex.Direct2D1/Media/DrawingContext.cs
  68. 2
      src/Windows/Perspex.Direct2D1/Media/Imaging/BitmapImpl.cs
  69. 2
      src/Windows/Perspex.Direct2D1/Media/Imaging/RenderTargetBitmapImpl.cs
  70. 6
      src/Windows/Perspex.Direct2D1/Media/PerspexTextRenderer.cs
  71. 2
      src/Windows/Perspex.Direct2D1/Media/StreamGeometryContextImpl.cs
  72. 2
      src/Windows/Perspex.Direct2D1/Media/StreamGeometryImpl.cs
  73. 2
      src/Windows/Perspex.Direct2D1/Renderer.cs
  74. 4
      src/Windows/Perspex.Win32/Input/KeyInterop.cs
  75. 4
      src/Windows/Perspex.Win32/Input/WindowsKeyboardDevice.cs
  76. 2
      src/Windows/Perspex.Win32/Input/WindowsMouseDevice.cs
  77. 4
      src/Windows/Perspex.Win32/Win32Platform.cs
  78. 2
      src/Windows/Perspex.Win32/WindowImpl.cs
  79. BIN
      tests/Perspex.RenderTests/Controls/ImageTests.cs
  80. 4
      tests/Perspex.Styling.UnitTests/TestSubject.cs

6
Tests/Perspex.Markup.Xaml.UnitTests/DataContextChangeSynchronizerTest.cs

@ -16,9 +16,9 @@ namespace Perspex.Xaml.Base.UnitTest
{ {
public class DataContextChangeSynchronizerTest public class DataContextChangeSynchronizerTest
{ {
private TypeConverterProvider _repo; private readonly TypeConverterProvider _repo;
private SamplePerspexObject _guiObject; private readonly SamplePerspexObject _guiObject;
private ViewModelMock _viewModel; private readonly ViewModelMock _viewModel;
public DataContextChangeSynchronizerTest() public DataContextChangeSynchronizerTest()
{ {

4
samples/TestApplication/Program.cs

@ -40,7 +40,7 @@ namespace TestApplication
internal class Program internal class Program
{ {
private static PerspexList<Node> s_treeData = new PerspexList<Node> private static readonly PerspexList<Node> s_treeData = new PerspexList<Node>
{ {
new Node new Node
{ {
@ -78,7 +78,7 @@ namespace TestApplication
}, },
}; };
private static PerspexList<Item> s_listBoxData = new PerspexList<Item> private static readonly PerspexList<Item> s_listBoxData = new PerspexList<Item>
{ {
new Item { Name = "Item 1", Value = "Item 1 Value" }, new Item { Name = "Item 1", Value = "Item 1 Value" },
new Item { Name = "Item 2", Value = "Item 2 Value" }, new Item { Name = "Item 2", Value = "Item 2 Value" },

2
src/Gtk/Perspex.Cairo/CairoPlatform.cs

@ -14,7 +14,7 @@ namespace Perspex.Cairo
public class CairoPlatform : IPlatformRenderInterface public class CairoPlatform : IPlatformRenderInterface
{ {
private static CairoPlatform s_instance = new CairoPlatform(); private static readonly CairoPlatform s_instance = new CairoPlatform();
public static void Initialize() public static void Initialize()
{ {

2
src/Gtk/Perspex.Cairo/Media/DrawingContext.cs

@ -19,7 +19,7 @@ namespace Perspex.Cairo.Media
/// <summary> /// <summary>
/// The cairo context. /// The cairo context.
/// </summary> /// </summary>
private Cairo.Context _context; private readonly Cairo.Context _context;
/// <summary> /// <summary>
/// Initializes a new instance of the <see cref="DrawingContext"/> class. /// Initializes a new instance of the <see cref="DrawingContext"/> class.

6
src/Gtk/Perspex.Cairo/Media/StreamGeometryContextImpl.cs

@ -12,7 +12,7 @@ namespace Perspex.Cairo.Media
public class StreamGeometryContextImpl : IStreamGeometryContextImpl public class StreamGeometryContextImpl : IStreamGeometryContextImpl
{ {
private StreamGeometryImpl _impl; private readonly StreamGeometryImpl _impl;
public StreamGeometryContextImpl(StreamGeometryImpl imp) public StreamGeometryContextImpl(StreamGeometryImpl imp)
{ {
_impl = imp; _impl = imp;
@ -39,8 +39,8 @@ namespace Perspex.Cairo.Media
_context.LineTo(point.ToCairo()); _context.LineTo(point.ToCairo());
} }
private Cairo.Context _context; private readonly Cairo.Context _context;
private Cairo.ImageSurface _surf; private readonly Cairo.ImageSurface _surf;
public void EndFigure(bool isClosed) public void EndFigure(bool isClosed)
{ {

2
src/Gtk/Perspex.Cairo/Media/StreamGeometryImpl.cs

@ -36,7 +36,7 @@ namespace Perspex.Cairo.Media
set; set;
} }
private StreamGeometryContextImpl _impl; private readonly StreamGeometryContextImpl _impl;
private Matrix _transform = Matrix.Identity; private Matrix _transform = Matrix.Identity;
public Matrix Transform public Matrix Transform

2
src/Gtk/Perspex.Cairo/Renderer.cs

@ -17,7 +17,7 @@ namespace Perspex.Cairo
/// </summary> /// </summary>
public class Renderer : RendererBase public class Renderer : RendererBase
{ {
private Surface _surface; private readonly Surface _surface;
private Gdk.Window _window; private Gdk.Window _window;
/// <summary> /// <summary>

2
src/Gtk/Perspex.Gtk/GtkPlatform.cs

@ -14,7 +14,7 @@ namespace Perspex.Gtk
public class GtkPlatform : IPlatformThreadingInterface, IPlatformSettings public class GtkPlatform : IPlatformThreadingInterface, IPlatformSettings
{ {
private static GtkPlatform s_instance = new GtkPlatform(); private static readonly GtkPlatform s_instance = new GtkPlatform();
public GtkPlatform() public GtkPlatform()
{ {

2
src/Gtk/Perspex.Gtk/Input/GtkKeyboardDevice.cs

@ -10,7 +10,7 @@ namespace Perspex.Gtk
{ {
public class GtkKeyboardDevice : KeyboardDevice public class GtkKeyboardDevice : KeyboardDevice
{ {
private static GtkKeyboardDevice s_instance; private static readonly GtkKeyboardDevice s_instance;
private static readonly Dictionary<Gdk.Key, string> NameDic = new Dictionary<Gdk.Key, string>(); private static readonly Dictionary<Gdk.Key, string> NameDic = new Dictionary<Gdk.Key, string>();
static GtkKeyboardDevice() static GtkKeyboardDevice()

2
src/Gtk/Perspex.Gtk/Input/GtkMouseDevice.cs

@ -6,7 +6,7 @@ namespace Perspex.Gtk
{ {
public class GtkMouseDevice : MouseDevice public class GtkMouseDevice : MouseDevice
{ {
private static GtkMouseDevice s_instance; private static readonly GtkMouseDevice s_instance;
private Point _clientPosition; private Point _clientPosition;

4
src/Markup/Perspex.Markup.Xaml/DataBinding/XamlBindingDefinition.cs

@ -8,8 +8,8 @@ namespace Perspex.Markup.Xaml.DataBinding
{ {
public class XamlBindingDefinition public class XamlBindingDefinition
{ {
private PropertyPath _sourcePropertyPath; private readonly PropertyPath _sourcePropertyPath;
private BindingMode _bindingMode; private readonly BindingMode _bindingMode;
private readonly Control _target; private readonly Control _target;
private readonly PerspexProperty _targetProperty; private readonly PerspexProperty _targetProperty;

4
src/Perspex.Animation/Animation.cs

@ -13,12 +13,12 @@ namespace Perspex.Animation
/// <summary> /// <summary>
/// The animation being tracked. /// The animation being tracked.
/// </summary> /// </summary>
private IObservable<object> _inner; private readonly IObservable<object> _inner;
/// <summary> /// <summary>
/// The disposable used to cancel the animation. /// The disposable used to cancel the animation.
/// </summary> /// </summary>
private IDisposable _subscription; private readonly IDisposable _subscription;
/// <summary> /// <summary>
/// Initializes a new instance of the <see cref="Animation"/> class. /// Initializes a new instance of the <see cref="Animation"/> class.

4
src/Perspex.Animation/Animation`1.cs

@ -14,12 +14,12 @@ namespace Perspex.Animation
/// <summary> /// <summary>
/// The animation being tracked. /// The animation being tracked.
/// </summary> /// </summary>
private IObservable<T> _inner; private readonly IObservable<T> _inner;
/// <summary> /// <summary>
/// The disposable used to cancel the animation. /// The disposable used to cancel the animation.
/// </summary> /// </summary>
private IDisposable _subscription; private readonly IDisposable _subscription;
/// <summary> /// <summary>
/// Initializes a new instance of the <see cref="Animation{T}"/> class. /// Initializes a new instance of the <see cref="Animation{T}"/> class.

2
src/Perspex.Application/Application.cs

@ -45,7 +45,7 @@ namespace Perspex
/// <summary> /// <summary>
/// The styler that will be used to apply styles to controls. /// The styler that will be used to apply styles to controls.
/// </summary> /// </summary>
private Styler _styler = new Styler(); private readonly Styler _styler = new Styler();
/// <summary> /// <summary>
/// Initializes a new instance of the <see cref="Application"/> class. /// Initializes a new instance of the <see cref="Application"/> class.

6
src/Perspex.Base/PerspexObject.cs

@ -68,7 +68,7 @@ namespace Perspex
/// <summary> /// <summary>
/// The registered properties by type. /// The registered properties by type.
/// </summary> /// </summary>
private static Dictionary<Type, List<PerspexProperty>> s_registered = private static readonly Dictionary<Type, List<PerspexProperty>> s_registered =
new Dictionary<Type, List<PerspexProperty>>(); new Dictionary<Type, List<PerspexProperty>>();
/// <summary> /// <summary>
@ -79,7 +79,7 @@ namespace Perspex
/// <summary> /// <summary>
/// The set values/bindings on this object. /// The set values/bindings on this object.
/// </summary> /// </summary>
private Dictionary<PerspexProperty, PriorityValue> _values = private readonly Dictionary<PerspexProperty, PriorityValue> _values =
new Dictionary<PerspexProperty, PriorityValue>(); new Dictionary<PerspexProperty, PriorityValue>();
/// <summary> /// <summary>
@ -90,7 +90,7 @@ namespace Perspex
/// <summary> /// <summary>
/// A serilog logger for logging property events. /// A serilog logger for logging property events.
/// </summary> /// </summary>
private ILogger _propertyLog; private readonly ILogger _propertyLog;
/// <summary> /// <summary>
/// Initializes a new instance of the <see cref="PerspexObject"/> class. /// Initializes a new instance of the <see cref="PerspexObject"/> class.

8
src/Perspex.Base/PerspexProperty.cs

@ -25,22 +25,22 @@ namespace Perspex
/// <summary> /// <summary>
/// The default values for the property, by type. /// The default values for the property, by type.
/// </summary> /// </summary>
private Dictionary<Type, object> _defaultValues = new Dictionary<Type, object>(); private readonly Dictionary<Type, object> _defaultValues = new Dictionary<Type, object>();
/// <summary> /// <summary>
/// Observable fired when this property changes on any <see cref="PerspexObject"/>. /// Observable fired when this property changes on any <see cref="PerspexObject"/>.
/// </summary> /// </summary>
private Subject<PerspexPropertyChangedEventArgs> _initialized = new Subject<PerspexPropertyChangedEventArgs>(); private readonly Subject<PerspexPropertyChangedEventArgs> _initialized = new Subject<PerspexPropertyChangedEventArgs>();
/// <summary> /// <summary>
/// Observable fired when this property changes on any <see cref="PerspexObject"/>. /// Observable fired when this property changes on any <see cref="PerspexObject"/>.
/// </summary> /// </summary>
private Subject<PerspexPropertyChangedEventArgs> _changed = new Subject<PerspexPropertyChangedEventArgs>(); private readonly Subject<PerspexPropertyChangedEventArgs> _changed = new Subject<PerspexPropertyChangedEventArgs>();
/// <summary> /// <summary>
/// The validation functions for the property, by type. /// The validation functions for the property, by type.
/// </summary> /// </summary>
private Dictionary<Type, Func<PerspexObject, object, object>> _validation = private readonly Dictionary<Type, Func<PerspexObject, object, object>> _validation =
new Dictionary<Type, Func<PerspexObject, object, object>>(); new Dictionary<Type, Func<PerspexObject, object, object>>();
/// <summary> /// <summary>

4
src/Perspex.Base/PriorityLevel.cs

@ -50,7 +50,7 @@ namespace Perspex
/// <summary> /// <summary>
/// Method called when current value changes. /// Method called when current value changes.
/// </summary> /// </summary>
private Action<PriorityLevel> _changed; private readonly Action<PriorityLevel> _changed;
/// <summary> /// <summary>
/// The current direct value. /// The current direct value.
@ -62,7 +62,7 @@ namespace Perspex
/// </summary> /// </summary>
private int _nextIndex; private int _nextIndex;
private LevelPrecedenceMode _mode; private readonly LevelPrecedenceMode _mode;
/// <summary> /// <summary>
/// Initializes a new instance of the <see cref="PriorityLevel"/> class. /// Initializes a new instance of the <see cref="PriorityLevel"/> class.

10
src/Perspex.Base/PriorityValue.cs

@ -27,22 +27,22 @@ namespace Perspex
/// <summary> /// <summary>
/// The name of the property. /// The name of the property.
/// </summary> /// </summary>
private string _name; private readonly string _name;
/// <summary> /// <summary>
/// The value type. /// The value type.
/// </summary> /// </summary>
private Type _valueType; private readonly Type _valueType;
/// <summary> /// <summary>
/// The currently registered bindings organised by priority. /// The currently registered bindings organised by priority.
/// </summary> /// </summary>
private Dictionary<int, PriorityLevel> _levels = new Dictionary<int, PriorityLevel>(); private readonly Dictionary<int, PriorityLevel> _levels = new Dictionary<int, PriorityLevel>();
/// <summary> /// <summary>
/// The changed observable. /// The changed observable.
/// </summary> /// </summary>
private Subject<Tuple<object, object>> _changed = new Subject<Tuple<object, object>>(); private readonly Subject<Tuple<object, object>> _changed = new Subject<Tuple<object, object>>();
/// <summary> /// <summary>
/// The current value. /// The current value.
@ -52,7 +52,7 @@ namespace Perspex
/// <summary> /// <summary>
/// The function used to validate the value, if any. /// The function used to validate the value, if any.
/// </summary> /// </summary>
private Func<object, object> _validate; private readonly Func<object, object> _validate;
/// <summary> /// <summary>
/// Initializes a new instance of the <see cref="PriorityValue"/> class. /// Initializes a new instance of the <see cref="PriorityValue"/> class.

4
src/Perspex.Base/Threading/Dispatcher.cs

@ -17,9 +17,9 @@ namespace Perspex.Threading
/// </remarks> /// </remarks>
public class Dispatcher public class Dispatcher
{ {
private static Dispatcher s_instance = new Dispatcher(); private static readonly Dispatcher s_instance = new Dispatcher();
private MainLoop _mainLoop = new MainLoop(); private readonly MainLoop _mainLoop = new MainLoop();
/// <summary> /// <summary>
/// Initializes a new instance of the <see cref="Dispatcher"/> class. /// Initializes a new instance of the <see cref="Dispatcher"/> class.

2
src/Perspex.Base/Threading/DispatcherTimer.cs

@ -15,7 +15,7 @@ namespace Perspex.Threading
{ {
private IDisposable _timer; private IDisposable _timer;
private DispatcherPriority _priority; private readonly DispatcherPriority _priority;
private TimeSpan _interval; private TimeSpan _interval;

4
src/Perspex.Base/Threading/MainLoop.cs

@ -16,9 +16,9 @@ namespace Perspex.Win32.Threading
/// </summary> /// </summary>
internal class MainLoop internal class MainLoop
{ {
private static IPlatformThreadingInterface s_platform; private static readonly IPlatformThreadingInterface s_platform;
private PriorityQueue<Job, DispatcherPriority> _queue = private readonly PriorityQueue<Job, DispatcherPriority> _queue =
new PriorityQueue<Job, DispatcherPriority>(PriorityQueueType.Maximum); new PriorityQueue<Job, DispatcherPriority>(PriorityQueueType.Maximum);
/// <summary> /// <summary>

2
src/Perspex.Controls/Control.cs

@ -67,7 +67,7 @@ namespace Perspex.Controls
public static readonly RoutedEvent<RequestBringIntoViewEventArgs> RequestBringIntoViewEvent = public static readonly RoutedEvent<RequestBringIntoViewEventArgs> RequestBringIntoViewEvent =
RoutedEvent.Register<Control, RequestBringIntoViewEventArgs>("RequestBringIntoView", RoutingStrategies.Bubble); RoutedEvent.Register<Control, RequestBringIntoViewEventArgs>("RequestBringIntoView", RoutingStrategies.Bubble);
private Classes _classes = new Classes(); private readonly Classes _classes = new Classes();
private DataTemplates _dataTemplates; private DataTemplates _dataTemplates;

2
src/Perspex.Controls/Generators/ItemContainerGenerator.cs

@ -17,7 +17,7 @@ namespace Perspex.Controls.Generators
{ {
private Dictionary<int, IControl> _containers = new Dictionary<int, IControl>(); private Dictionary<int, IControl> _containers = new Dictionary<int, IControl>();
private Subject<ItemContainers> _containersInitialized = new Subject<ItemContainers>(); private readonly Subject<ItemContainers> _containersInitialized = new Subject<ItemContainers>();
/// <summary> /// <summary>
/// Initializes a new instance of the <see cref="ItemContainerGenerator"/> class. /// Initializes a new instance of the <see cref="ItemContainerGenerator"/> class.

4
src/Perspex.Controls/Generators/TreeItemContainerGenerator.cs

@ -16,9 +16,9 @@ namespace Perspex.Controls.Generators
/// <typeparam name="T">The type of the container.</typeparam> /// <typeparam name="T">The type of the container.</typeparam>
public class TreeItemContainerGenerator<T> : ITreeItemContainerGenerator where T : TreeViewItem, new() public class TreeItemContainerGenerator<T> : ITreeItemContainerGenerator where T : TreeViewItem, new()
{ {
private Dictionary<object, T> _containers = new Dictionary<object, T>(); private readonly Dictionary<object, T> _containers = new Dictionary<object, T>();
private Subject<ItemContainers> _containersInitialized = new Subject<ItemContainers>(); private readonly Subject<ItemContainers> _containersInitialized = new Subject<ItemContainers>();
/// <summary> /// <summary>
/// Initializes a new instance of the <see cref="TreeItemContainerGenerator{T}"/> class. /// Initializes a new instance of the <see cref="TreeItemContainerGenerator{T}"/> class.

8
src/Perspex.Controls/Grid.cs

@ -859,10 +859,10 @@ namespace Perspex.Controls
private struct GridNode private struct GridNode
{ {
public int Row; public readonly int Row;
public int Column; public readonly int Column;
public double Size; public readonly double Size;
public Segment[,] Matrix; public readonly Segment[,] Matrix;
public GridNode(Segment[,] matrix, int row, int col, double size) public GridNode(Segment[,] matrix, int row, int col, double size)
{ {

4
src/Perspex.Controls/GridLength.cs

@ -33,9 +33,9 @@ namespace Perspex.Controls
/// </summary> /// </summary>
public struct GridLength : IEquatable<GridLength> public struct GridLength : IEquatable<GridLength>
{ {
private GridUnitType _type; private readonly GridUnitType _type;
private double _value; private readonly double _value;
/// <summary> /// <summary>
/// Initializes a new instance of the <see cref="GridLength"/> struct. /// Initializes a new instance of the <see cref="GridLength"/> struct.

2
src/Perspex.Controls/MenuItemAccessKeyHandler.cs

@ -17,7 +17,7 @@ namespace Perspex.Controls
/// <summary> /// <summary>
/// The registered access keys. /// The registered access keys.
/// </summary> /// </summary>
private List<Tuple<string, IInputElement>> _registered = new List<Tuple<string, IInputElement>>(); private readonly List<Tuple<string, IInputElement>> _registered = new List<Tuple<string, IInputElement>>();
/// <summary> /// <summary>
/// The window to which the handler belongs. /// The window to which the handler belongs.

2
src/Perspex.Controls/Panel.cs

@ -18,7 +18,7 @@ namespace Perspex.Controls
/// </remarks> /// </remarks>
public class Panel : Control, IReparentingControl, IPanel public class Panel : Control, IReparentingControl, IPanel
{ {
private Controls _children = new Controls(); private readonly Controls _children = new Controls();
private ILogical _childLogicalParent; private ILogical _childLogicalParent;

2
src/Perspex.Controls/Presenters/TextPresenter.cs

@ -21,7 +21,7 @@ namespace Perspex.Controls.Presenters
public static readonly PerspexProperty<int> SelectionEndProperty = public static readonly PerspexProperty<int> SelectionEndProperty =
TextBox.SelectionEndProperty.AddOwner<TextPresenter>(); TextBox.SelectionEndProperty.AddOwner<TextPresenter>();
private DispatcherTimer _caretTimer; private readonly DispatcherTimer _caretTimer;
private bool _caretBlink; private bool _caretBlink;

4
src/Perspex.Controls/Primitives/AdornerLayer.cs

@ -14,10 +14,10 @@ namespace Perspex.Controls.Primitives
public static PerspexProperty<Visual> AdornedElementProperty = public static PerspexProperty<Visual> AdornedElementProperty =
PerspexProperty.RegisterAttached<AdornerLayer, Visual, Visual>("AdornedElement"); PerspexProperty.RegisterAttached<AdornerLayer, Visual, Visual>("AdornedElement");
private static PerspexProperty<AdornedElementInfo> s_adornedElementInfoProperty = private static readonly PerspexProperty<AdornedElementInfo> s_adornedElementInfoProperty =
PerspexProperty.RegisterAttached<AdornerLayer, Visual, AdornedElementInfo>("AdornedElementInfo"); PerspexProperty.RegisterAttached<AdornerLayer, Visual, AdornedElementInfo>("AdornedElementInfo");
private BoundsTracker _tracker = new BoundsTracker(); private readonly BoundsTracker _tracker = new BoundsTracker();
static AdornerLayer() static AdornerLayer()
{ {

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

@ -74,7 +74,7 @@ namespace Perspex.Controls.Primitives
private bool _templateApplied; private bool _templateApplied;
private ILogger _templateLog; private readonly ILogger _templateLog;
/// <summary> /// <summary>
/// Initializes static members of the <see cref="TemplatedControl"/> class. /// Initializes static members of the <see cref="TemplatedControl"/> class.

2
src/Perspex.Controls/Templates/DataTemplate.cs

@ -20,7 +20,7 @@ namespace Perspex.Controls.Templates
/// <summary> /// <summary>
/// The implementation of the <see cref="Match"/> method. /// The implementation of the <see cref="Match"/> method.
/// </summary> /// </summary>
private Func<object, bool> _match; private readonly Func<object, bool> _match;
/// <summary> /// <summary>
/// Initializes a new instance of the <see cref="DataTemplate"/> class. /// Initializes a new instance of the <see cref="DataTemplate"/> class.

2
src/Perspex.Controls/Templates/FuncTemplate`1.cs

@ -11,7 +11,7 @@ namespace Perspex.Controls.Templates
/// <typeparam name="TControl">The type of control.</typeparam> /// <typeparam name="TControl">The type of control.</typeparam>
public class FuncTemplate<TControl> : ITemplate<TControl> where TControl : IControl public class FuncTemplate<TControl> : ITemplate<TControl> where TControl : IControl
{ {
private Func<TControl> _func; private readonly Func<TControl> _func;
/// <summary> /// <summary>
/// Initializes a new instance of the <see cref="FuncTemplate{TControl}"/> class. /// Initializes a new instance of the <see cref="FuncTemplate{TControl}"/> class.

2
src/Perspex.Controls/Templates/FuncTemplate`2.cs

@ -13,7 +13,7 @@ namespace Perspex.Controls.Templates
public class FuncTemplate<TParam, TControl> : ITemplate<TParam, TControl> public class FuncTemplate<TParam, TControl> : ITemplate<TParam, TControl>
where TControl : IControl where TControl : IControl
{ {
private Func<TParam, TControl> _func; private readonly Func<TParam, TControl> _func;
/// <summary> /// <summary>
/// Initializes a new instance of the <see cref="FuncTemplate{TControl, TParam}"/> class. /// Initializes a new instance of the <see cref="FuncTemplate{TControl, TParam}"/> class.

4
src/Perspex.Controls/Templates/TreeDataTemplate.cs

@ -12,9 +12,9 @@ namespace Perspex.Controls.Templates
/// </summary> /// </summary>
public class TreeDataTemplate : DataTemplate, ITreeDataTemplate public class TreeDataTemplate : DataTemplate, ITreeDataTemplate
{ {
private Func<object, IEnumerable> _itemsSelector; private readonly Func<object, IEnumerable> _itemsSelector;
private Func<object, bool> _isExpanded; private readonly Func<object, bool> _isExpanded;
/// <summary> /// <summary>
/// Initializes a new instance of the <see cref="TreeDataTemplate"/> class. /// Initializes a new instance of the <see cref="TreeDataTemplate"/> class.

2
src/Perspex.Controls/ToolTip.cs

@ -42,7 +42,7 @@ namespace Perspex.Controls
/// observable is throttled and calls <see cref="ShowToolTip(Control)"/> when the time /// observable is throttled and calls <see cref="ShowToolTip(Control)"/> when the time
/// period expires. /// period expires.
/// </summary> /// </summary>
private static Subject<Control> s_show = new Subject<Control>(); private static readonly Subject<Control> s_show = new Subject<Control>();
/// <summary> /// <summary>
/// Initializes static members of the <see cref="ToolTip"/> class. /// Initializes static members of the <see cref="ToolTip"/> class.

12
src/Perspex.Controls/TopLevel.cs

@ -47,32 +47,32 @@ namespace Perspex.Controls
/// <summary> /// <summary>
/// The dispatcher for the window. /// The dispatcher for the window.
/// </summary> /// </summary>
private Dispatcher _dispatcher; private readonly Dispatcher _dispatcher;
/// <summary> /// <summary>
/// The render manager for the window.s /// The render manager for the window.s
/// </summary> /// </summary>
private IRenderManager _renderManager; private readonly IRenderManager _renderManager;
/// <summary> /// <summary>
/// The window renderer. /// The window renderer.
/// </summary> /// </summary>
private IRenderer _renderer; private readonly IRenderer _renderer;
/// <summary> /// <summary>
/// The input manager for the window. /// The input manager for the window.
/// </summary> /// </summary>
private IInputManager _inputManager; private readonly IInputManager _inputManager;
/// <summary> /// <summary>
/// The access key handler for the window. /// The access key handler for the window.
/// </summary> /// </summary>
private IAccessKeyHandler _accessKeyHandler; private readonly IAccessKeyHandler _accessKeyHandler;
/// <summary> /// <summary>
/// The access keyboard navigation handler for the window. /// The access keyboard navigation handler for the window.
/// </summary> /// </summary>
private IKeyboardNavigationHandler _keyboardNavigationHandler; private readonly IKeyboardNavigationHandler _keyboardNavigationHandler;
/// <summary> /// <summary>
/// Initializes static members of the <see cref="TopLevel"/> class. /// Initializes static members of the <see cref="TopLevel"/> class.

2
src/Perspex.Diagnostics/DevTools.cs

@ -15,7 +15,7 @@ namespace Perspex.Diagnostics
public static readonly PerspexProperty<Control> RootProperty = public static readonly PerspexProperty<Control> RootProperty =
PerspexProperty.Register<DevTools, Control>("Root"); PerspexProperty.Register<DevTools, Control>("Root");
private DevToolsViewModel _viewModel; private readonly DevToolsViewModel _viewModel;
public DevTools() public DevTools()
{ {

4
src/Perspex.Diagnostics/ViewModels/DevToolsViewModel.cs

@ -17,9 +17,9 @@ namespace Perspex.Diagnostics.ViewModels
private VisualTreeViewModel _visualTree; private VisualTreeViewModel _visualTree;
private ObservableAsPropertyHelper<IInputElement> _focusedControl; private readonly ObservableAsPropertyHelper<IInputElement> _focusedControl;
private ObservableAsPropertyHelper<IInputElement> _pointerOverElement; private readonly ObservableAsPropertyHelper<IInputElement> _pointerOverElement;
public DevToolsViewModel() public DevToolsViewModel()
{ {

2
src/Perspex.Diagnostics/ViewModels/LogicalTreeViewModel.cs

@ -11,7 +11,7 @@ namespace Perspex.Diagnostics.ViewModels
{ {
private LogicalTreeNode _selected; private LogicalTreeNode _selected;
private ObservableAsPropertyHelper<ControlDetailsViewModel> _details; private readonly ObservableAsPropertyHelper<ControlDetailsViewModel> _details;
public LogicalTreeViewModel(Control root) public LogicalTreeViewModel(Control root)
{ {

2
src/Perspex.Diagnostics/ViewModels/VisualTreeViewModel.cs

@ -11,7 +11,7 @@ namespace Perspex.Diagnostics.ViewModels
{ {
private VisualTreeNode _selected; private VisualTreeNode _selected;
private ObservableAsPropertyHelper<ControlDetailsViewModel> _details; private readonly ObservableAsPropertyHelper<ControlDetailsViewModel> _details;
public VisualTreeViewModel(Control root) public VisualTreeViewModel(Control root)
{ {

2
src/Perspex.Input/AccessKeyHandler.cs

@ -26,7 +26,7 @@ namespace Perspex.Input
/// <summary> /// <summary>
/// The registered access keys. /// The registered access keys.
/// </summary> /// </summary>
private List<Tuple<string, IInputElement>> _registered = new List<Tuple<string, IInputElement>>(); private readonly List<Tuple<string, IInputElement>> _registered = new List<Tuple<string, IInputElement>>();
/// <summary> /// <summary>
/// The window to which the handler belongs. /// The window to which the handler belongs.

2
src/Perspex.Input/FocusManager.cs

@ -18,7 +18,7 @@ namespace Perspex.Input
/// <summary> /// <summary>
/// The focus scopes in which the focus is currently defined. /// The focus scopes in which the focus is currently defined.
/// </summary> /// </summary>
private Dictionary<IFocusScope, IInputElement> _focusScopes = private readonly Dictionary<IFocusScope, IInputElement> _focusScopes =
new Dictionary<IFocusScope, IInputElement>(); new Dictionary<IFocusScope, IInputElement>();
/// <summary> /// <summary>

4
src/Perspex.Input/InputManager.cs

@ -12,9 +12,9 @@ namespace Perspex.Input
{ {
public class InputManager : IInputManager public class InputManager : IInputManager
{ {
private Subject<RawInputEventArgs> _rawEventReceived = new Subject<RawInputEventArgs>(); private readonly Subject<RawInputEventArgs> _rawEventReceived = new Subject<RawInputEventArgs>();
private Subject<RawInputEventArgs> _postProcess = new Subject<RawInputEventArgs>(); private readonly Subject<RawInputEventArgs> _postProcess = new Subject<RawInputEventArgs>();
public static IInputManager Instance => Locator.Current.GetService<IInputManager>(); public static IInputManager Instance => Locator.Current.GetService<IInputManager>();

2
src/Perspex.Input/MouseDevice.cs

@ -21,7 +21,7 @@ namespace Perspex.Input
private uint _lastClickTime; private uint _lastClickTime;
private List<IInputElement> _pointerOvers = new List<IInputElement>(); private readonly List<IInputElement> _pointerOvers = new List<IInputElement>();
public MouseDevice() public MouseDevice()
{ {

2
src/Perspex.Interactivity/Interactive.cs

@ -17,7 +17,7 @@ namespace Perspex.Interactivity
/// </summary> /// </summary>
public class Interactive : Layoutable, IInteractive public class Interactive : Layoutable, IInteractive
{ {
private Dictionary<RoutedEvent, List<EventSubscription>> _eventHandlers = private readonly Dictionary<RoutedEvent, List<EventSubscription>> _eventHandlers =
new Dictionary<RoutedEvent, List<EventSubscription>>(); new Dictionary<RoutedEvent, List<EventSubscription>>();
/// <summary> /// <summary>

2
src/Perspex.Interactivity/RoutedEvent.cs

@ -18,7 +18,7 @@ namespace Perspex.Interactivity
public class RoutedEvent public class RoutedEvent
{ {
private List<ClassEventSubscription> _subscriptions = new List<ClassEventSubscription>(); private readonly List<ClassEventSubscription> _subscriptions = new List<ClassEventSubscription>();
public RoutedEvent( public RoutedEvent(
string name, string name,

6
src/Perspex.Layout/LayoutManager.cs

@ -31,12 +31,12 @@ namespace Perspex.Layout
/// <summary> /// <summary>
/// Called when a layout is needed. /// Called when a layout is needed.
/// </summary> /// </summary>
private Subject<Unit> _layoutNeeded; private readonly Subject<Unit> _layoutNeeded;
/// <summary> /// <summary>
/// Called when a layout is completed. /// Called when a layout is completed.
/// </summary> /// </summary>
private Subject<Unit> _layoutCompleted; private readonly Subject<Unit> _layoutCompleted;
/// <summary> /// <summary>
/// Whether a measure is needed on the next layout pass. /// Whether a measure is needed on the next layout pass.
@ -61,7 +61,7 @@ namespace Perspex.Layout
/// <summary> /// <summary>
/// The logger to use. /// The logger to use.
/// </summary> /// </summary>
private ILogger _log; private readonly ILogger _log;
/// <summary> /// <summary>
/// Initializes a new instance of the <see cref="LayoutManager"/> class. /// Initializes a new instance of the <see cref="LayoutManager"/> class.

2
src/Perspex.Layout/Layoutable.cs

@ -130,7 +130,7 @@ namespace Perspex.Layout
private Rect? _previousArrange; private Rect? _previousArrange;
private ILogger _layoutLog; private readonly ILogger _layoutLog;
/// <summary> /// <summary>
/// Initializes static members of the <see cref="Layoutable"/> class. /// Initializes static members of the <see cref="Layoutable"/> class.

12
src/Perspex.SceneGraph/Matrix.cs

@ -11,12 +11,12 @@ namespace Perspex
/// </summary> /// </summary>
public struct Matrix public struct Matrix
{ {
private double _m11; private readonly double _m11;
private double _m12; private readonly double _m12;
private double _m21; private readonly double _m21;
private double _m22; private readonly double _m22;
private double _m31; private readonly double _m31;
private double _m32; private readonly double _m32;
/// <summary> /// <summary>
/// Initializes a new instance of the <see cref="Matrix"/> struct. /// Initializes a new instance of the <see cref="Matrix"/> struct.

2
src/Perspex.SceneGraph/Media/PathMarkupParser.cs

@ -34,7 +34,7 @@ namespace Perspex.Media
private StreamGeometry _geometry; private StreamGeometry _geometry;
private StreamGeometryContext _context; private readonly StreamGeometryContext _context;
/// <summary> /// <summary>
/// Initializes a new instance of the <see cref="PathMarkupParser"/> class. /// Initializes a new instance of the <see cref="PathMarkupParser"/> class.

2
src/Perspex.SceneGraph/Media/StreamGeometryContext.cs

@ -17,7 +17,7 @@ namespace Perspex.Media
/// TODO: This class is just a wrapper around IStreamGeometryContextImpl: is it needed? /// TODO: This class is just a wrapper around IStreamGeometryContextImpl: is it needed?
public class StreamGeometryContext : IDisposable public class StreamGeometryContext : IDisposable
{ {
private IStreamGeometryContextImpl _impl; private readonly IStreamGeometryContextImpl _impl;
/// <summary> /// <summary>
/// Initializes a new instance of the <see cref="StreamGeometryContext"/> class. /// Initializes a new instance of the <see cref="StreamGeometryContext"/> class.

2
src/Perspex.SceneGraph/Origin.cs

@ -31,7 +31,7 @@ namespace Perspex
private Point _point; private Point _point;
private OriginUnit _unit; private readonly OriginUnit _unit;
/// <summary> /// <summary>
/// Initializes a new instance of the <see cref="Origin"/> struct. /// Initializes a new instance of the <see cref="Origin"/> struct.

4
src/Perspex.SceneGraph/Point.cs

@ -13,12 +13,12 @@ namespace Perspex
/// <summary> /// <summary>
/// The X position. /// The X position.
/// </summary> /// </summary>
private double _x; private readonly double _x;
/// <summary> /// <summary>
/// The Y position. /// The Y position.
/// </summary> /// </summary>
private double _y; private readonly double _y;
/// <summary> /// <summary>
/// Initializes a new instance of the <see cref="Point"/> structure. /// Initializes a new instance of the <see cref="Point"/> structure.

8
src/Perspex.SceneGraph/Rect.cs

@ -14,22 +14,22 @@ namespace Perspex
/// <summary> /// <summary>
/// The X position. /// The X position.
/// </summary> /// </summary>
private double _x; private readonly double _x;
/// <summary> /// <summary>
/// The Y position. /// The Y position.
/// </summary> /// </summary>
private double _y; private readonly double _y;
/// <summary> /// <summary>
/// The width. /// The width.
/// </summary> /// </summary>
private double _width; private readonly double _width;
/// <summary> /// <summary>
/// The height. /// The height.
/// </summary> /// </summary>
private double _height; private readonly double _height;
/// <summary> /// <summary>
/// Initializes a new instance of the <see cref="Rect"/> structure. /// Initializes a new instance of the <see cref="Rect"/> structure.

2
src/Perspex.SceneGraph/Rendering/RenderManager.cs

@ -12,7 +12,7 @@ namespace Perspex.Rendering
/// </summary> /// </summary>
public class RenderManager : IRenderManager public class RenderManager : IRenderManager
{ {
private Subject<Unit> _renderNeeded = new Subject<Unit>(); private readonly Subject<Unit> _renderNeeded = new Subject<Unit>();
private bool _renderQueued; private bool _renderQueued;

4
src/Perspex.SceneGraph/Size.cs

@ -19,12 +19,12 @@ namespace Perspex
/// <summary> /// <summary>
/// The width. /// The width.
/// </summary> /// </summary>
private double _width; private readonly double _width;
/// <summary> /// <summary>
/// The height. /// The height.
/// </summary> /// </summary>
private double _height; private readonly double _height;
/// <summary> /// <summary>
/// Initializes a new instance of the <see cref="Size"/> structure. /// Initializes a new instance of the <see cref="Size"/> structure.

8
src/Perspex.SceneGraph/Thickness.cs

@ -14,22 +14,22 @@ namespace Perspex
/// <summary> /// <summary>
/// The thickness on the left. /// The thickness on the left.
/// </summary> /// </summary>
private double _left; private readonly double _left;
/// <summary> /// <summary>
/// The thickness on the top. /// The thickness on the top.
/// </summary> /// </summary>
private double _top; private readonly double _top;
/// <summary> /// <summary>
/// The thickness on the right. /// The thickness on the right.
/// </summary> /// </summary>
private double _right; private readonly double _right;
/// <summary> /// <summary>
/// The thickness on the bottom. /// The thickness on the bottom.
/// </summary> /// </summary>
private double _bottom; private readonly double _bottom;
/// <summary> /// <summary>
/// Initializes a new instance of the <see cref="Thickness"/> structure. /// Initializes a new instance of the <see cref="Thickness"/> structure.

4
src/Perspex.SceneGraph/Vector.cs

@ -14,12 +14,12 @@ namespace Perspex
/// <summary> /// <summary>
/// The X vector. /// The X vector.
/// </summary> /// </summary>
private double _x; private readonly double _x;
/// <summary> /// <summary>
/// The Y vector. /// The Y vector.
/// </summary> /// </summary>
private double _y; private readonly double _y;
/// <summary> /// <summary>
/// Initializes a new instance of the <see cref="Vector"/> structure. /// Initializes a new instance of the <see cref="Vector"/> structure.

4
src/Perspex.SceneGraph/Visual.cs

@ -73,7 +73,7 @@ namespace Perspex
/// <summary> /// <summary>
/// Holds the children of the visual. /// Holds the children of the visual.
/// </summary> /// </summary>
private PerspexList<IVisual> _visualChildren; private readonly PerspexList<IVisual> _visualChildren;
/// <summary> /// <summary>
/// Holds the parent of the visual. /// Holds the parent of the visual.
@ -88,7 +88,7 @@ namespace Perspex
/// <summary> /// <summary>
/// The logger for visual-level events. /// The logger for visual-level events.
/// </summary> /// </summary>
private ILogger _visualLogger; private readonly ILogger _visualLogger;
/// <summary> /// <summary>
/// Initializes static members of the <see cref="Visual"/> class. /// Initializes static members of the <see cref="Visual"/> class.

8
src/Perspex.Styling/Styling/Classes.cs

@ -13,15 +13,15 @@ namespace Perspex.Styling
{ {
public class Classes : ICollection<string>, INotifyCollectionChanged public class Classes : ICollection<string>, INotifyCollectionChanged
{ {
private List<string> _inner; private readonly List<string> _inner;
private Subject<NotifyCollectionChangedEventArgs> _beforeChanged private readonly Subject<NotifyCollectionChangedEventArgs> _beforeChanged
= new Subject<NotifyCollectionChangedEventArgs>(); = new Subject<NotifyCollectionChangedEventArgs>();
private Subject<NotifyCollectionChangedEventArgs> _changed private readonly Subject<NotifyCollectionChangedEventArgs> _changed
= new Subject<NotifyCollectionChangedEventArgs>(); = new Subject<NotifyCollectionChangedEventArgs>();
private Subject<NotifyCollectionChangedEventArgs> _afterChanged private readonly Subject<NotifyCollectionChangedEventArgs> _afterChanged
= new Subject<NotifyCollectionChangedEventArgs>(); = new Subject<NotifyCollectionChangedEventArgs>();
public Classes() public Classes()

6
src/Perspex.Styling/Styling/Selector.cs

@ -8,11 +8,11 @@ namespace Perspex.Styling
{ {
public class Selector public class Selector
{ {
private Func<IStyleable, SelectorMatch> _evaluate; private readonly Func<IStyleable, SelectorMatch> _evaluate;
private bool _inTemplate; private readonly bool _inTemplate;
private bool _stopTraversal; private readonly bool _stopTraversal;
private string _description; private string _description;

8
src/Perspex.Styling/Styling/StyleActivator.cs

@ -16,13 +16,13 @@ namespace Perspex.Styling
public class StyleActivator : IObservable<bool>, IDisposable public class StyleActivator : IObservable<bool>, IDisposable
{ {
private ActivatorMode _mode; private readonly ActivatorMode _mode;
private bool[] _values; private readonly bool[] _values;
private List<IDisposable> _subscriptions = new List<IDisposable>(); private readonly List<IDisposable> _subscriptions = new List<IDisposable>();
private List<IObserver<bool>> _observers = new List<IObserver<bool>>(); private readonly List<IObserver<bool>> _observers = new List<IObserver<bool>>();
public StyleActivator( public StyleActivator(
IList<IObservable<bool>> inputs, IList<IObservable<bool>> inputs,

2
src/Perspex.Styling/Styling/StyleBinding.cs

@ -22,7 +22,7 @@ namespace Perspex.Styling
/// <summary> /// <summary>
/// The activator. /// The activator.
/// </summary> /// </summary>
private IObservable<bool> _activator; private readonly IObservable<bool> _activator;
/// <summary> /// <summary>
/// Initializes a new instance of the <see cref="StyleBinding"/> class. /// Initializes a new instance of the <see cref="StyleBinding"/> class.

8
src/Windows/Perspex.Direct2D1/Direct2D1Platform.cs

@ -11,13 +11,13 @@ namespace Perspex.Direct2D1
{ {
public class Direct2D1Platform : IPlatformRenderInterface public class Direct2D1Platform : IPlatformRenderInterface
{ {
private static Direct2D1Platform s_instance = new Direct2D1Platform(); private static readonly Direct2D1Platform s_instance = new Direct2D1Platform();
private static SharpDX.Direct2D1.Factory s_d2D1Factory = new SharpDX.Direct2D1.Factory(); private static readonly SharpDX.Direct2D1.Factory s_d2D1Factory = new SharpDX.Direct2D1.Factory();
private static SharpDX.DirectWrite.Factory s_dwfactory = new SharpDX.DirectWrite.Factory(); private static readonly SharpDX.DirectWrite.Factory s_dwfactory = new SharpDX.DirectWrite.Factory();
private static SharpDX.WIC.ImagingFactory s_imagingFactory = new SharpDX.WIC.ImagingFactory(); private static readonly SharpDX.WIC.ImagingFactory s_imagingFactory = new SharpDX.WIC.ImagingFactory();
public static void Initialize() public static void Initialize()
{ {

2
src/Windows/Perspex.Direct2D1/Disposable.cs

@ -7,7 +7,7 @@ namespace Perspex.Direct2D1
{ {
public class Disposable<T> : IDisposable where T : IDisposable public class Disposable<T> : IDisposable where T : IDisposable
{ {
private IDisposable _extra; private readonly IDisposable _extra;
public Disposable(T inner) public Disposable(T inner)
{ {

2
src/Windows/Perspex.Direct2D1/Media/DrawingContext.cs

@ -18,7 +18,7 @@ namespace Perspex.Direct2D1.Media
/// <summary> /// <summary>
/// The Direct2D1 render target. /// The Direct2D1 render target.
/// </summary> /// </summary>
private RenderTarget _renderTarget; private readonly RenderTarget _renderTarget;
/// <summary> /// <summary>
/// The DirectWrite factory. /// The DirectWrite factory.

2
src/Windows/Perspex.Direct2D1/Media/Imaging/BitmapImpl.cs

@ -13,7 +13,7 @@ namespace Perspex.Direct2D1.Media
/// </summary> /// </summary>
public class BitmapImpl : IBitmapImpl public class BitmapImpl : IBitmapImpl
{ {
private ImagingFactory _factory; private readonly ImagingFactory _factory;
private SharpDX.Direct2D1.Bitmap _direct2D; private SharpDX.Direct2D1.Bitmap _direct2D;

2
src/Windows/Perspex.Direct2D1/Media/Imaging/RenderTargetBitmapImpl.cs

@ -10,7 +10,7 @@ namespace Perspex.Direct2D1.Media
{ {
public class RenderTargetBitmapImpl : BitmapImpl, IRenderTargetBitmapImpl, IDisposable public class RenderTargetBitmapImpl : BitmapImpl, IRenderTargetBitmapImpl, IDisposable
{ {
private WicRenderTarget _target; private readonly WicRenderTarget _target;
public RenderTargetBitmapImpl( public RenderTargetBitmapImpl(
ImagingFactory imagingFactory, ImagingFactory imagingFactory,

6
src/Windows/Perspex.Direct2D1/Media/PerspexTextRenderer.cs

@ -10,11 +10,11 @@ namespace Perspex.Direct2D1.Media
{ {
internal class PerspexTextRenderer : TextRenderer internal class PerspexTextRenderer : TextRenderer
{ {
private DrawingContext _context; private readonly DrawingContext _context;
private RenderTarget _renderTarget; private readonly RenderTarget _renderTarget;
private Brush _foreground; private readonly Brush _foreground;
public PerspexTextRenderer( public PerspexTextRenderer(
DrawingContext context, DrawingContext context,

2
src/Windows/Perspex.Direct2D1/Media/StreamGeometryContextImpl.cs

@ -8,7 +8,7 @@ namespace Perspex.Direct2D1.Media
{ {
public class StreamGeometryContextImpl : IStreamGeometryContextImpl public class StreamGeometryContextImpl : IStreamGeometryContextImpl
{ {
private GeometrySink _sink; private readonly GeometrySink _sink;
public StreamGeometryContextImpl(GeometrySink sink) public StreamGeometryContextImpl(GeometrySink sink)
{ {

2
src/Windows/Perspex.Direct2D1/Media/StreamGeometryImpl.cs

@ -14,7 +14,7 @@ namespace Perspex.Direct2D1.Media
/// </summary> /// </summary>
public class StreamGeometryImpl : GeometryImpl, IStreamGeometryImpl public class StreamGeometryImpl : GeometryImpl, IStreamGeometryImpl
{ {
private PathGeometry _path; private readonly PathGeometry _path;
/// <summary> /// <summary>
/// Initializes a new instance of the <see cref="StreamGeometryImpl"/> class. /// Initializes a new instance of the <see cref="StreamGeometryImpl"/> class.

2
src/Windows/Perspex.Direct2D1/Renderer.cs

@ -18,7 +18,7 @@ namespace Perspex.Direct2D1
/// <summary> /// <summary>
/// The render target. /// The render target.
/// </summary> /// </summary>
private RenderTarget _renderTarget; private readonly RenderTarget _renderTarget;
/// <summary> /// <summary>
/// Initializes a new instance of the <see cref="Renderer"/> class. /// Initializes a new instance of the <see cref="Renderer"/> class.

4
src/Windows/Perspex.Win32/Input/KeyInterop.cs

@ -10,7 +10,7 @@ namespace Perspex.Win32.Input
{ {
public static class KeyInterop public static class KeyInterop
{ {
private static Dictionary<Key, int> s_virtualKeyFromKey = new Dictionary<Key, int> private static readonly Dictionary<Key, int> s_virtualKeyFromKey = new Dictionary<Key, int>
{ {
{ Key.None, 0 }, { Key.None, 0 },
{ Key.Cancel, 3 }, { Key.Cancel, 3 },
@ -187,7 +187,7 @@ namespace Perspex.Win32.Input
{ Key.DeadCharProcessed, 0 }, { Key.DeadCharProcessed, 0 },
}; };
private static Dictionary<int, Key> s_keyFromVirtualKey = new Dictionary<int, Key> private static readonly Dictionary<int, Key> s_keyFromVirtualKey = new Dictionary<int, Key>
{ {
{ 0, Key.None }, { 0, Key.None },
{ 3, Key.Cancel }, { 3, Key.Cancel },

4
src/Windows/Perspex.Win32/Input/WindowsKeyboardDevice.cs

@ -10,9 +10,9 @@ namespace Perspex.Win32.Input
{ {
public class WindowsKeyboardDevice : KeyboardDevice public class WindowsKeyboardDevice : KeyboardDevice
{ {
private static WindowsKeyboardDevice s_instance = new WindowsKeyboardDevice(); private static readonly WindowsKeyboardDevice s_instance = new WindowsKeyboardDevice();
private byte[] _keyStates = new byte[256]; private readonly byte[] _keyStates = new byte[256];
public static new WindowsKeyboardDevice Instance => s_instance; public static new WindowsKeyboardDevice Instance => s_instance;

2
src/Windows/Perspex.Win32/Input/WindowsMouseDevice.cs

@ -10,7 +10,7 @@ namespace Perspex.Win32.Input
{ {
public class WindowsMouseDevice : MouseDevice public class WindowsMouseDevice : MouseDevice
{ {
private static WindowsMouseDevice s_instance = new WindowsMouseDevice(); private static readonly WindowsMouseDevice s_instance = new WindowsMouseDevice();
public static new WindowsMouseDevice Instance => s_instance; public static new WindowsMouseDevice Instance => s_instance;

4
src/Windows/Perspex.Win32/Win32Platform.cs

@ -18,13 +18,13 @@ namespace Perspex.Win32
{ {
public class Win32Platform : IPlatformThreadingInterface, IPlatformSettings public class Win32Platform : IPlatformThreadingInterface, IPlatformSettings
{ {
private static Win32Platform s_instance = new Win32Platform(); private static readonly Win32Platform s_instance = new Win32Platform();
private UnmanagedMethods.WndProc _wndProcDelegate; private UnmanagedMethods.WndProc _wndProcDelegate;
private IntPtr _hwnd; private IntPtr _hwnd;
private List<Delegate> _delegates = new List<Delegate>(); private readonly List<Delegate> _delegates = new List<Delegate>();
public Win32Platform() public Win32Platform()
{ {

2
src/Windows/Perspex.Win32/WindowImpl.cs

@ -20,7 +20,7 @@ namespace Perspex.Win32
{ {
public class WindowImpl : IWindowImpl public class WindowImpl : IWindowImpl
{ {
private static List<WindowImpl> s_instances = new List<WindowImpl>(); private static readonly List<WindowImpl> s_instances = new List<WindowImpl>();
private static readonly IntPtr DefaultCursor = UnmanagedMethods.LoadCursor( private static readonly IntPtr DefaultCursor = UnmanagedMethods.LoadCursor(
IntPtr.Zero, new IntPtr((int)UnmanagedMethods.Cursor.IDC_ARROW)); IntPtr.Zero, new IntPtr((int)UnmanagedMethods.Cursor.IDC_ARROW));

BIN
tests/Perspex.RenderTests/Controls/ImageTests.cs

Binary file not shown.

4
tests/Perspex.Styling.UnitTests/TestSubject.cs

@ -9,9 +9,9 @@ namespace Perspex.Styling.UnitTests
{ {
internal class TestSubject<T> : IObserver<T>, IObservable<T> internal class TestSubject<T> : IObserver<T>, IObservable<T>
{ {
private T _initial; private readonly T _initial;
private List<IObserver<T>> _subscribers = new List<IObserver<T>>(); private readonly List<IObserver<T>> _subscribers = new List<IObserver<T>>();
public TestSubject(T initial) public TestSubject(T initial)
{ {

Loading…
Cancel
Save