diff --git a/Perspex.Animation/Properties/AssemblyInfo.cs b/Perspex.Animation/Properties/AssemblyInfo.cs index 0d68cde482..7e6c0a435d 100644 --- a/Perspex.Animation/Properties/AssemblyInfo.cs +++ b/Perspex.Animation/Properties/AssemblyInfo.cs @@ -4,10 +4,8 @@ // // ----------------------------------------------------------------------- -using System.Resources; using System.Reflection; -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; +using System.Resources; // General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information diff --git a/Perspex.Base/Diagnostics/PerspexObjectExtensions.cs b/Perspex.Base/Diagnostics/PerspexObjectExtensions.cs index 76bf1ca0ba..7e644f7ebf 100644 --- a/Perspex.Base/Diagnostics/PerspexObjectExtensions.cs +++ b/Perspex.Base/Diagnostics/PerspexObjectExtensions.cs @@ -25,7 +25,7 @@ namespace Perspex.Diagnostics else { return new PerspexPropertyValue( - property, + property, o.GetValue(property), BindingPriority.Unset, "Unset"); diff --git a/Perspex.Base/Diagnostics/PerspexPropertyValue.cs b/Perspex.Base/Diagnostics/PerspexPropertyValue.cs index 74f5cbf418..ced24be77b 100644 --- a/Perspex.Base/Diagnostics/PerspexPropertyValue.cs +++ b/Perspex.Base/Diagnostics/PerspexPropertyValue.cs @@ -9,7 +9,7 @@ namespace Perspex.Diagnostics public class PerspexPropertyValue { public PerspexPropertyValue( - PerspexProperty property, + PerspexProperty property, object value, BindingPriority priority, string diagnostic) diff --git a/Perspex.Base/PerspexProperty.cs b/Perspex.Base/PerspexProperty.cs index e886859a0e..4cf1e046ab 100644 --- a/Perspex.Base/PerspexProperty.cs +++ b/Perspex.Base/PerspexProperty.cs @@ -468,7 +468,7 @@ namespace Perspex private static Func Cast(Func f) where TOwner : PerspexObject { - return f != null ? (o, v) => f((TOwner)o, v) : (Func < PerspexObject, TValue, TValue > )null; + return f != null ? (o, v) => f((TOwner)o, v) : (Func)null; } /// diff --git a/Perspex.Base/PriorityValue.cs b/Perspex.Base/PriorityValue.cs index aa312507c0..06d27629c6 100644 --- a/Perspex.Base/PriorityValue.cs +++ b/Perspex.Base/PriorityValue.cs @@ -18,7 +18,7 @@ namespace Perspex /// Maintains a list of prioritised bindings together with a current value. /// /// - /// Bindings, in the form of s are added to the object using + /// Bindings, in the form of s are added to the object using /// the method. With the observable is passed a priority, where lower values /// represent higher priorites. The current is selected from the highest /// priority binding that doesn't return . Where there diff --git a/Perspex.Base/Properties/AssemblyInfo.cs b/Perspex.Base/Properties/AssemblyInfo.cs index b2057ea73c..74214e3b22 100644 --- a/Perspex.Base/Properties/AssemblyInfo.cs +++ b/Perspex.Base/Properties/AssemblyInfo.cs @@ -8,7 +8,7 @@ using System.Reflection; using System.Resources; using System.Runtime.CompilerServices; -// General Information about an assembly is controlled through the following +// General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information // associated with an assembly. [assembly: AssemblyTitle("Perspex.Base")] @@ -24,11 +24,11 @@ using System.Runtime.CompilerServices; // Version information for an assembly consists of the following four values: // // Major Version -// Minor Version +// Minor Version // Build Number // Revision // -// You can specify all the values or you can default the Build and Revision Numbers +// You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion("1.0.0.0")] diff --git a/Perspex.Base/Threading/DispatcherTimer.cs b/Perspex.Base/Threading/DispatcherTimer.cs index 04230fef7c..ed14b3499a 100644 --- a/Perspex.Base/Threading/DispatcherTimer.cs +++ b/Perspex.Base/Threading/DispatcherTimer.cs @@ -55,17 +55,17 @@ namespace Perspex.Threading public event EventHandler Tick; - public Dispatcher Dispatcher - { - get; - private set; + public Dispatcher Dispatcher + { + get; + private set; } - - public TimeSpan Interval + + public TimeSpan Interval { - get - { - return this.interval; + get + { + return this.interval; } set @@ -76,14 +76,14 @@ namespace Perspex.Threading this.IsEnabled = enabled; } } - - public bool IsEnabled + + public bool IsEnabled { get { return this.timer != null; } - + set { if (this.IsEnabled != value) @@ -99,11 +99,11 @@ namespace Perspex.Threading } } } - - public object Tag - { - get; - set; + + public object Tag + { + get; + set; } public static IDisposable Run(Func action, TimeSpan interval, DispatcherPriority priority = DispatcherPriority.Normal) @@ -132,7 +132,7 @@ namespace Perspex.Threading this.timer = threading.StartTimer(this.Interval, this.InternalTick); } } - + public void Stop() { if (this.IsEnabled) diff --git a/Perspex.Base/Threading/PerspexScheduler.cs b/Perspex.Base/Threading/PerspexScheduler.cs index 5cbfb945ae..c6c8396eec 100644 --- a/Perspex.Base/Threading/PerspexScheduler.cs +++ b/Perspex.Base/Threading/PerspexScheduler.cs @@ -17,11 +17,11 @@ namespace Perspex.Threading public override IDisposable Schedule(TState state, TimeSpan dueTime, Func action) { return DispatcherTimer.Run( - () => + () => { action(this, state); return false; - }, + }, dueTime); } } diff --git a/Perspex.Base/Utilities/MathUtilities.cs b/Perspex.Base/Utilities/MathUtilities.cs index 50561dc765..ce5833c1ad 100644 --- a/Perspex.Base/Utilities/MathUtilities.cs +++ b/Perspex.Base/Utilities/MathUtilities.cs @@ -1,5 +1,5 @@ // ----------------------------------------------------------------------- -// +// // Copyright 2015 MIT Licence. See licence.md for more information. // // ----------------------------------------------------------------------- diff --git a/Perspex.Controls/Button.cs b/Perspex.Controls/Button.cs index 6bb6a55d79..bb08eff978 100644 --- a/Perspex.Controls/Button.cs +++ b/Perspex.Controls/Button.cs @@ -229,7 +229,7 @@ namespace Perspex.Controls private void CanExecuteChanged(object sender, EventArgs e) { - // HACK: Just set the IsEnabled property for the moment. This needs to be changed to + // HACK: Just set the IsEnabled property for the moment. This needs to be changed to // use IsEnabledCore etc. but it will do for now. this.IsEnabled = this.Command == null || this.Command.CanExecute(this.CommandParameter); } diff --git a/Perspex.Controls/GridLength.cs b/Perspex.Controls/GridLength.cs index 35fbdb62bd..1e477b3417 100644 --- a/Perspex.Controls/GridLength.cs +++ b/Perspex.Controls/GridLength.cs @@ -121,7 +121,7 @@ namespace Perspex.Controls /// Compares two GridLength structures for equality. /// /// The first GridLength. - /// The first GridLength. + /// The second GridLength. /// True if the structures are equal, otherwise false. public static bool operator ==(GridLength a, GridLength b) { @@ -131,8 +131,8 @@ namespace Perspex.Controls /// /// Compares two GridLength structures for inequality. /// - /// The first GridLength. - /// The first GridLength. + /// The first GridLength. + /// The first GridLength. /// True if the structures are unequal, otherwise false. public static bool operator !=(GridLength gl1, GridLength gl2) { diff --git a/Perspex.Controls/GridSplitter.cs b/Perspex.Controls/GridSplitter.cs index 4cee47aa26..c84f9547be 100644 --- a/Perspex.Controls/GridSplitter.cs +++ b/Perspex.Controls/GridSplitter.cs @@ -9,7 +9,7 @@ namespace Perspex.Controls using System; using Perspex.Controls.Primitives; using Perspex.Input; - using Rendering; + using Perspex.Rendering; using Perspex.VisualTree; public class GridSplitter : Thumb diff --git a/Perspex.Controls/ISelectable.cs b/Perspex.Controls/ISelectable.cs index 405e1161b1..364727f3b4 100644 --- a/Perspex.Controls/ISelectable.cs +++ b/Perspex.Controls/ISelectable.cs @@ -12,10 +12,10 @@ namespace Perspex.Controls /// Interface for objects that are selectable. /// /// - /// Controls such as use this interface to indicate the selected - /// control in a list. If changing the control's property should - /// update the selection in a or equivalent, then the - /// control should raise the . + /// Controls such as use this interface to indicate the + /// selected control in a list. If changing the control's property + /// should update the selection in a or equivalent, then + /// the control should raise the . /// public interface ISelectable { diff --git a/Perspex.Controls/Menu.cs b/Perspex.Controls/Menu.cs index 83c054c6d3..f0b571a18c 100644 --- a/Perspex.Controls/Menu.cs +++ b/Perspex.Controls/Menu.cs @@ -9,11 +9,11 @@ namespace Perspex.Controls using System; using System.Linq; using System.Reactive.Disposables; + using Perspex.Controls.Primitives; using Perspex.Input; + using Perspex.Interactivity; using Perspex.LogicalTree; using Perspex.Rendering; - using Perspex.Interactivity; - using Perspex.Controls.Primitives; /// /// A top-level menu control. diff --git a/Perspex.Controls/MenuItem.cs b/Perspex.Controls/MenuItem.cs index 72bee4959f..2643bca0c9 100644 --- a/Perspex.Controls/MenuItem.cs +++ b/Perspex.Controls/MenuItem.cs @@ -75,7 +75,7 @@ namespace Perspex.Controls RoutedEvent.Register(nameof(SubmenuOpened), RoutingStrategies.Bubble); /// - /// The default value for the property. + /// The default value for the property. /// private static readonly ItemsPanelTemplate DefaultPanel = new ItemsPanelTemplate(() => new StackPanel diff --git a/Perspex.Controls/Mixins/SelectableMixin.cs b/Perspex.Controls/Mixins/SelectableMixin.cs index 7d4ee0f5e1..e55dd7c769 100644 --- a/Perspex.Controls/Mixins/SelectableMixin.cs +++ b/Perspex.Controls/Mixins/SelectableMixin.cs @@ -15,7 +15,7 @@ namespace Perspex.Controls.Mixins /// /// /// - /// The adds behavior to a control which can be + /// The adds behavior to a control which can be /// selected. It adds the following behavior: /// /// @@ -38,7 +38,7 @@ namespace Perspex.Controls.Mixins public static class SelectableMixin { /// - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// /// The control type. /// The IsSelected property. diff --git a/Perspex.Controls/Parsers/GridLengthsParser.cs b/Perspex.Controls/Parsers/GridLengthsParser.cs index d9895019ce..64df91d723 100644 --- a/Perspex.Controls/Parsers/GridLengthsParser.cs +++ b/Perspex.Controls/Parsers/GridLengthsParser.cs @@ -10,7 +10,6 @@ namespace Perspex.Controls.Parsers using System.Collections.Generic; using System.Linq; - /// /// Parses a string of s for and /// . diff --git a/Perspex.Controls/Presenters/ContentPresenter.cs b/Perspex.Controls/Presenters/ContentPresenter.cs index b0b66dae26..e045ef74ae 100644 --- a/Perspex.Controls/Presenters/ContentPresenter.cs +++ b/Perspex.Controls/Presenters/ContentPresenter.cs @@ -6,6 +6,7 @@ namespace Perspex.Controls.Presenters { + using Perspex.Controls.Primitives; using Perspex.Controls.Templates; /// @@ -115,7 +116,6 @@ namespace Perspex.Controls.Presenters if (result.Parent == null) { ((ISetLogicalParent)result).SetParent((ILogical)logicalHost ?? this); - } logicalChildren.Remove(old); diff --git a/Perspex.Controls/Presenters/DeckPresenter.cs b/Perspex.Controls/Presenters/DeckPresenter.cs index b8a24c85e9..0f64fb1ae9 100644 --- a/Perspex.Controls/Presenters/DeckPresenter.cs +++ b/Perspex.Controls/Presenters/DeckPresenter.cs @@ -12,10 +12,9 @@ namespace Perspex.Controls.Presenters using System.Reactive.Linq; using System.Threading.Tasks; using Perspex.Animation; - using Perspex.Collections; using Perspex.Controls.Generators; using Perspex.Controls.Primitives; - using Templates; + using Perspex.Controls.Templates; using Perspex.Controls.Utils; /// diff --git a/Perspex.Controls/Presenters/IContentPresenter.cs b/Perspex.Controls/Presenters/IContentPresenter.cs index b460fc124f..4b82fdfdf5 100644 --- a/Perspex.Controls/Presenters/IContentPresenter.cs +++ b/Perspex.Controls/Presenters/IContentPresenter.cs @@ -6,8 +6,10 @@ namespace Perspex.Controls.Presenters { + using Perspex.Controls.Primitives; + /// - /// Interface for controls that present a single item of data inside a + /// Interface for controls that present a single item of data inside a /// template. /// public interface IContentPresenter : IPresenter diff --git a/Perspex.Controls/Presenters/IItemsPresenter.cs b/Perspex.Controls/Presenters/IItemsPresenter.cs index 0a0053a0f4..d463d45912 100644 --- a/Perspex.Controls/Presenters/IItemsPresenter.cs +++ b/Perspex.Controls/Presenters/IItemsPresenter.cs @@ -1,5 +1,5 @@ // ----------------------------------------------------------------------- -// +// // Copyright 2014 MIT Licence. See licence.md for more information. // // ----------------------------------------------------------------------- diff --git a/Perspex.Controls/Presenters/IPresenter.cs b/Perspex.Controls/Presenters/IPresenter.cs index 3de04e2af4..a191376205 100644 --- a/Perspex.Controls/Presenters/IPresenter.cs +++ b/Perspex.Controls/Presenters/IPresenter.cs @@ -6,6 +6,7 @@ namespace Perspex.Controls.Presenters { + using Perspex.Controls.Primitives; using Perspex.Styling; /// diff --git a/Perspex.Controls/Presenters/ItemsPresenter.cs b/Perspex.Controls/Presenters/ItemsPresenter.cs index 522e015241..cd14812e21 100644 --- a/Perspex.Controls/Presenters/ItemsPresenter.cs +++ b/Perspex.Controls/Presenters/ItemsPresenter.cs @@ -10,7 +10,7 @@ namespace Perspex.Controls.Presenters using System.Collections; using System.Collections.Specialized; using Perspex.Controls.Generators; - using Templates; + using Perspex.Controls.Templates; using Perspex.Input; using Perspex.Styling; diff --git a/Perspex.Controls/Presenters/TextPresenter.cs b/Perspex.Controls/Presenters/TextPresenter.cs index c384d74eec..90c08a0a22 100644 --- a/Perspex.Controls/Presenters/TextPresenter.cs +++ b/Perspex.Controls/Presenters/TextPresenter.cs @@ -105,8 +105,8 @@ namespace Perspex.Controls.Presenters var b = Math.Ceiling(charPos.Bottom) - 0.5; context.DrawLine( - new Pen(caretBrush, 1), - new Point(x, y), + new Pen(caretBrush, 1), + new Point(x, y), new Point(x, b)); } } diff --git a/Perspex.Controls/Primitives/AccessText.cs b/Perspex.Controls/Primitives/AccessText.cs index a6b8c60167..ce7d904735 100644 --- a/Perspex.Controls/Primitives/AccessText.cs +++ b/Perspex.Controls/Primitives/AccessText.cs @@ -161,7 +161,7 @@ namespace Perspex.Controls.Primitives } /// - /// Called when the property changes. + /// Called when the property changes. /// /// The new text. private void TextChanged(string text) diff --git a/Perspex.Controls/Primitives/AdornerLayer.cs b/Perspex.Controls/Primitives/AdornerLayer.cs index 59ddcc1309..1dc01d173c 100644 --- a/Perspex.Controls/Primitives/AdornerLayer.cs +++ b/Perspex.Controls/Primitives/AdornerLayer.cs @@ -7,7 +7,6 @@ namespace Perspex.Controls.Primitives { using System; - using System.Collections.Generic; using System.Collections.Specialized; using System.Linq; using Perspex.VisualTree; @@ -31,7 +30,7 @@ namespace Perspex.Controls.Primitives public AdornerLayer() { - this.Children.CollectionChanged += ChildrenCollectionChanged; + this.Children.CollectionChanged += this.ChildrenCollectionChanged; } public static Visual GetAdornedElement(Visual adorner) @@ -73,6 +72,18 @@ namespace Perspex.Controls.Primitives return finalSize; } + private static void AdornedElementChanged(PerspexPropertyChangedEventArgs e) + { + var adorner = (Visual)e.Sender; + var adorned = (Visual)e.NewValue; + var layer = adorner.GetVisualParent(); + + if (layer != null) + { + layer.UpdateAdornedElement(adorner, adorned); + } + } + private void ChildrenCollectionChanged(object sender, NotifyCollectionChangedEventArgs e) { switch (e.Action) @@ -119,18 +130,6 @@ namespace Perspex.Controls.Primitives } } - private static void AdornedElementChanged(PerspexPropertyChangedEventArgs e) - { - var adorner = (Visual)e.Sender; - var adorned = (Visual)e.NewValue; - var layer = adorner.GetVisualParent(); - - if (layer != null) - { - layer.UpdateAdornedElement(adorner, adorned); - } - } - private class AdornedElementInfo { public IDisposable Subscription { get; set; } diff --git a/Perspex.Controls/Primitives/SelectingItemsControl.cs b/Perspex.Controls/Primitives/SelectingItemsControl.cs index c1c9bf7454..235ddf483f 100644 --- a/Perspex.Controls/Primitives/SelectingItemsControl.cs +++ b/Perspex.Controls/Primitives/SelectingItemsControl.cs @@ -128,6 +128,7 @@ namespace Perspex.Controls.Primitives { this.SelectedIndex = 0; } + break; case NotifyCollectionChangedAction.Remove: diff --git a/Perspex.Controls/Primitives/Track.cs b/Perspex.Controls/Primitives/Track.cs index ae687b6d39..de644c9fbd 100644 --- a/Perspex.Controls/Primitives/Track.cs +++ b/Perspex.Controls/Primitives/Track.cs @@ -44,14 +44,14 @@ namespace Perspex.Controls.Primitives { if (val.Item1 != null) { - val.Item1.DragDelta -= ThumbDragged; + val.Item1.DragDelta -= this.ThumbDragged; } this.ClearVisualChildren(); if (val.Item2 != null) { - val.Item2.DragDelta += ThumbDragged; + val.Item2.DragDelta += this.ThumbDragged; this.AddVisualChild(val.Item2); } }); diff --git a/Perspex.Controls/Properties/AssemblyInfo.cs b/Perspex.Controls/Properties/AssemblyInfo.cs index 959688c305..0eea8075b6 100644 --- a/Perspex.Controls/Properties/AssemblyInfo.cs +++ b/Perspex.Controls/Properties/AssemblyInfo.cs @@ -8,7 +8,7 @@ using System.Reflection; using System.Resources; using System.Runtime.CompilerServices; -// General Information about an assembly is controlled through the following +// General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information // associated with an assembly. [assembly: AssemblyTitle("Perspex.Controls")] @@ -24,11 +24,11 @@ using System.Runtime.CompilerServices; // Version information for an assembly consists of the following four values: // // Major Version -// Minor Version +// Minor Version // Build Number // Revision // -// You can specify all the values or you can default the Build and Revision Numbers +// You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion("1.0.0.0")] diff --git a/Perspex.Controls/Shapes/Shape.cs b/Perspex.Controls/Shapes/Shape.cs index 3f296c6b00..1dd8792733 100644 --- a/Perspex.Controls/Shapes/Shape.cs +++ b/Perspex.Controls/Shapes/Shape.cs @@ -106,7 +106,7 @@ namespace Perspex.Controls.Shapes protected override Size MeasureOverride(Size availableSize) { - // This should probably use GetRenderBounds(strokeThickness) but then the calculations + // This should probably use GetRenderBounds(strokeThickness) but then the calculations // will multiply the stroke thickness as well, which isn't correct. Rect shapeBounds = this.DefiningGeometry.Bounds; Size shapeSize = new Size(shapeBounds.Right, shapeBounds.Bottom); diff --git a/Perspex.Controls/TabControl.cs b/Perspex.Controls/TabControl.cs index edaee58ecb..819f095ac2 100644 --- a/Perspex.Controls/TabControl.cs +++ b/Perspex.Controls/TabControl.cs @@ -38,7 +38,7 @@ namespace Perspex.Controls } /// - /// Gets the as a . + /// Gets the as a . /// public TabItem SelectedTab { @@ -69,7 +69,7 @@ namespace Perspex.Controls } /// - /// Called when the property changes. + /// Called when the property changes. /// /// The event args. private void SelectedIndexChanged(PerspexPropertyChangedEventArgs e) diff --git a/Perspex.Controls/Templates/TemplateExtensions.cs b/Perspex.Controls/Templates/TemplateExtensions.cs index d53c36540d..bb050b6cba 100644 --- a/Perspex.Controls/Templates/TemplateExtensions.cs +++ b/Perspex.Controls/Templates/TemplateExtensions.cs @@ -71,7 +71,7 @@ namespace Perspex.Controls.Templates if (visual != null) { - // TODO: This searches the whole descendent tree - it can stop when it exits the + // TODO: This searches the whole descendent tree - it can stop when it exits the // template. return visual.GetVisualDescendents() .OfType() diff --git a/Perspex.Controls/TextBox.cs b/Perspex.Controls/TextBox.cs index 59148088cb..cefef0d376 100644 --- a/Perspex.Controls/TextBox.cs +++ b/Perspex.Controls/TextBox.cs @@ -62,8 +62,8 @@ namespace Perspex.Controls .Select(x => x ? ScrollBarVisibility.Auto : ScrollBarVisibility.Hidden); this.Bind( - ScrollViewer.HorizontalScrollBarVisibilityProperty, - horizontalScrollBarVisibility, + ScrollViewer.HorizontalScrollBarVisibilityProperty, + horizontalScrollBarVisibility, BindingPriority.Style); } diff --git a/Perspex.Controls/ToolTip.cs b/Perspex.Controls/ToolTip.cs index 7d2289f712..9eab186cb2 100644 --- a/Perspex.Controls/ToolTip.cs +++ b/Perspex.Controls/ToolTip.cs @@ -17,9 +17,9 @@ namespace Perspex.Controls /// A tooltip control. /// /// - /// You will probably not want to create a control directly: if added to + /// You will probably not want to create a control directly: if added to /// the tree it will act as a simple styled to look like a tooltip. - /// To add a tooltip to a control, use the attached property, + /// To add a tooltip to a control, use the attached property, /// assigning the content that you want displayed. /// public class ToolTip : ContentControl @@ -42,7 +42,7 @@ namespace Perspex.Controls /// /// Observable fired when a tooltip should be displayed for a control. The output from this - /// observable is throttled and calls when the time + /// observable is throttled and calls when the time /// period expires. /// private static Subject show = new Subject(); diff --git a/Perspex.Controls/TopLevel.cs b/Perspex.Controls/TopLevel.cs index 78feabbdc5..52dde51d96 100644 --- a/Perspex.Controls/TopLevel.cs +++ b/Perspex.Controls/TopLevel.cs @@ -9,6 +9,7 @@ namespace Perspex.Controls using System; using System.Reactive.Disposables; using System.Reactive.Linq; + using Perspex.Controls.Primitives; using Perspex.Input; using Perspex.Input.Raw; using Perspex.Layout; @@ -16,8 +17,6 @@ namespace Perspex.Controls using Perspex.Rendering; using Perspex.Styling; using Perspex.Threading; - using Perspex.Controls.Primitives; - using Perspex.Interactivity; using Splat; /// @@ -164,20 +163,6 @@ namespace Perspex.Controls this.GetObservable(ClientSizeProperty).Skip(1).Subscribe(x => this.PlatformImpl.ClientSize = x); } - private static T TryGetService(IDependencyResolver resolver) where T : class - { - var result = resolver.GetService(); - - if (result == null) - { - System.Diagnostics.Debug.WriteLineIf( - result == null, - $"Could not create {typeof(T).Name} : maybe Application.RegisterServices() wasn't called?"); - } - - return result; - } - /// /// Fired when the window is activated. /// @@ -293,8 +278,8 @@ namespace Perspex.Controls /// A disposable used to finish the operation. /// /// When an auto-resize operation is in progress any resize events received will not be - /// cause the new size to be written to the and - /// properties. + /// cause the new size to be written to the and + /// properties. /// protected IDisposable BeginAutoSizing() { @@ -317,6 +302,27 @@ namespace Perspex.Controls return base.ArrangeOverride(finalSize); } + /// + /// Tries to get a service from an , throwing an + /// exception if not found. + /// + /// The service type. + /// The resolver. + /// The service. + private static T TryGetService(IDependencyResolver resolver) where T : class + { + var result = resolver.GetService(); + + if (result == null) + { + System.Diagnostics.Debug.WriteLineIf( + result == null, + $"Could not create {typeof(T).Name} : maybe Application.RegisterServices() wasn't called?"); + } + + return result; + } + /// /// Handles an activated notification from . /// diff --git a/Perspex.Controls/Utils/StringUtils.cs b/Perspex.Controls/Utils/StringUtils.cs index 0fbd3363a6..af9344d34c 100644 --- a/Perspex.Controls/Utils/StringUtils.cs +++ b/Perspex.Controls/Utils/StringUtils.cs @@ -24,7 +24,7 @@ namespace Perspex.Controls.Utils public static bool IsStartOfWord(string text, int index) { - // A 'word' starts with an AlphaNumeric or some punctuation symbols immediately + // A 'word' starts with an AlphaNumeric or some punctuation symbols immediately // preceeded by lwsp. if (index > 0 && !char.IsWhiteSpace(text[index - 1])) { diff --git a/Perspex.Controls/Window.cs b/Perspex.Controls/Window.cs index fc577d49cb..26ab6966f5 100644 --- a/Perspex.Controls/Window.cs +++ b/Perspex.Controls/Window.cs @@ -91,7 +91,7 @@ namespace Perspex.Controls var modal = this.PlatformImpl.ShowDialog(); var result = new TaskCompletionSource(); - Observable.FromEventPattern(this, nameof(Closed)) + Observable.FromEventPattern(this, nameof(this.Closed)) .Take(1) .Subscribe(_ => { diff --git a/Perspex.Diagnostics/DevTools.cs b/Perspex.Diagnostics/DevTools.cs index 64681a04ef..1356bd5e30 100644 --- a/Perspex.Diagnostics/DevTools.cs +++ b/Perspex.Diagnostics/DevTools.cs @@ -37,8 +37,8 @@ namespace Perspex.Diagnostics public static IDisposable Attach(Window window) { return window.AddHandler( - Window.KeyDownEvent, - WindowPreviewKeyDown, + Window.KeyDownEvent, + WindowPreviewKeyDown, Interactivity.RoutingStrategies.Tunnel); } diff --git a/Perspex.Diagnostics/Properties/AssemblyInfo.cs b/Perspex.Diagnostics/Properties/AssemblyInfo.cs index 65270a3446..d40e81bfb4 100644 --- a/Perspex.Diagnostics/Properties/AssemblyInfo.cs +++ b/Perspex.Diagnostics/Properties/AssemblyInfo.cs @@ -7,7 +7,7 @@ using System.Reflection; using System.Resources; -// General Information about an assembly is controlled through the following +// General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information // associated with an assembly. [assembly: AssemblyTitle("Perspex.Diagnostics")] @@ -23,11 +23,11 @@ using System.Resources; // Version information for an assembly consists of the following four values: // // Major Version -// Minor Version +// Minor Version // Build Number // Revision // -// You can specify all the values or you can default the Build and Revision Numbers +// You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion("1.0.0.0")] diff --git a/Perspex.Diagnostics/ViewModels/DevToolsViewModel.cs b/Perspex.Diagnostics/ViewModels/DevToolsViewModel.cs index 91ae0dc25e..19b31c3496 100644 --- a/Perspex.Diagnostics/ViewModels/DevToolsViewModel.cs +++ b/Perspex.Diagnostics/ViewModels/DevToolsViewModel.cs @@ -8,8 +8,8 @@ namespace Perspex.Diagnostics.ViewModels { using System; using Perspex.Controls; - using ReactiveUI; using Perspex.Input; + using ReactiveUI; internal class DevToolsViewModel : ReactiveObject { @@ -25,8 +25,8 @@ namespace Perspex.Diagnostics.ViewModels { this.WhenAnyValue(x => x.Root).Subscribe(x => { - this.LogicalTree = new LogicalTreeViewModel(root); - this.VisualTree = new VisualTreeViewModel(root); + this.LogicalTree = new LogicalTreeViewModel(this.root); + this.VisualTree = new VisualTreeViewModel(this.root); }); this.focusedControl = KeyboardDevice.Instance.WhenAnyValue(x => x.FocusedElement) diff --git a/Perspex.Diagnostics/Views/ControlDetailsView.cs b/Perspex.Diagnostics/Views/ControlDetailsView.cs index d73bd75ed7..a8c6f6c098 100644 --- a/Perspex.Diagnostics/Views/ControlDetailsView.cs +++ b/Perspex.Diagnostics/Views/ControlDetailsView.cs @@ -1,19 +1,18 @@ // ----------------------------------------------------------------------- -// +// // Copyright 2014 MIT Licence. See licence.md for more information. // // ----------------------------------------------------------------------- namespace Perspex.Diagnostics.Views { + using System; + using System.Collections.Generic; + using System.Reactive.Linq; using Perspex.Controls; using Perspex.Diagnostics.ViewModels; using Perspex.Styling; using ReactiveUI; - using System; - using System.Collections; - using System.Collections.Generic; - using System.Reactive.Linq; internal class ControlDetailsView : UserControl { diff --git a/Perspex.Diagnostics/Views/GridRepeater.cs b/Perspex.Diagnostics/Views/GridRepeater.cs index 7d494f0527..f830d71582 100644 --- a/Perspex.Diagnostics/Views/GridRepeater.cs +++ b/Perspex.Diagnostics/Views/GridRepeater.cs @@ -1,16 +1,15 @@ // ----------------------------------------------------------------------- -// +// // Copyright 2015 MIT Licence. See licence.md for more information. // // ----------------------------------------------------------------------- namespace Perspex.Diagnostics.Views { - using Perspex.Controls; - using Perspex.Controls.Templates; using System; using System.Collections; using System.Collections.Generic; + using Perspex.Controls; internal static class GridRepeater { diff --git a/Perspex.Diagnostics/Views/TreePage.cs b/Perspex.Diagnostics/Views/TreePage.cs index 4e498ba8f6..28e1c62987 100644 --- a/Perspex.Diagnostics/Views/TreePage.cs +++ b/Perspex.Diagnostics/Views/TreePage.cs @@ -1,5 +1,5 @@ // ----------------------------------------------------------------------- -// +// // Copyright 2014 MIT Licence. See licence.md for more information. // // ----------------------------------------------------------------------- diff --git a/Perspex.Input/FocusManager.cs b/Perspex.Input/FocusManager.cs index 1baa6b022f..864b18cd16 100644 --- a/Perspex.Input/FocusManager.cs +++ b/Perspex.Input/FocusManager.cs @@ -9,10 +9,9 @@ namespace Perspex.Input using System; using System.Collections.Generic; using System.Linq; + using Perspex.Interactivity; using Perspex.VisualTree; using Splat; - using Perspex.Interactivity; - /// /// Manages focus for the application. @@ -166,7 +165,7 @@ namespace Perspex.Input yield return scope; } - control = control.GetVisualParent() ?? + control = control.GetVisualParent() ?? ((control as IHostedVisualTreeRoot)?.Host as IInputElement); } } diff --git a/Perspex.Input/InputElement.cs b/Perspex.Input/InputElement.cs index bc83f47607..1f738e7d23 100644 --- a/Perspex.Input/InputElement.cs +++ b/Perspex.Input/InputElement.cs @@ -43,7 +43,7 @@ namespace Perspex.Input public static readonly RoutedEvent KeyDownEvent = RoutedEvent.Register( - "KeyDown", + "KeyDown", RoutingStrategies.Tunnel | RoutingStrategies.Bubble); public static readonly RoutedEvent KeyUpEvent = @@ -59,22 +59,22 @@ namespace Perspex.Input public static readonly RoutedEvent PointerMovedEvent = RoutedEvent.Register( - "PointerMove", + "PointerMove", RoutingStrategies.Tunnel | RoutingStrategies.Bubble); public static readonly RoutedEvent PointerPressedEvent = RoutedEvent.Register( - "PointerPressed", + "PointerPressed", RoutingStrategies.Tunnel | RoutingStrategies.Bubble); public static readonly RoutedEvent PointerReleasedEvent = RoutedEvent.Register( - "PointerReleased", + "PointerReleased", RoutingStrategies.Tunnel | RoutingStrategies.Bubble); public static readonly RoutedEvent PointerWheelChangedEvent = RoutedEvent.Register( - "PointerWheelChanged", + "PointerWheelChanged", RoutingStrategies.Tunnel | RoutingStrategies.Bubble); static InputElement() diff --git a/Perspex.Input/InputExtensions.cs b/Perspex.Input/InputExtensions.cs index 9ce9a35a0d..b886ae64fe 100644 --- a/Perspex.Input/InputExtensions.cs +++ b/Perspex.Input/InputExtensions.cs @@ -16,9 +16,9 @@ namespace Perspex.Input { Contract.Requires(element != null); - if (element.Bounds.Contains(p) && + if (element.Bounds.Contains(p) && element.IsVisible && - element.IsHitTestVisible && + element.IsHitTestVisible && element.IsEnabledCore) { p -= element.Bounds.Position; diff --git a/Perspex.Input/KeyboardNavigationMode.cs b/Perspex.Input/KeyboardNavigationMode.cs index b339d9f89c..2f8f8bd4c6 100644 --- a/Perspex.Input/KeyboardNavigationMode.cs +++ b/Perspex.Input/KeyboardNavigationMode.cs @@ -7,7 +7,7 @@ namespace Perspex.Input { /// - /// Defines the mode of keyboard traversal within a container when the tab or arrow keys are + /// Defines the mode of keyboard traversal within a container when the tab or arrow keys are /// pressed. /// public enum KeyboardNavigationMode diff --git a/Perspex.Input/MouseDevice.cs b/Perspex.Input/MouseDevice.cs index 3022acc0d2..592cfef876 100644 --- a/Perspex.Input/MouseDevice.cs +++ b/Perspex.Input/MouseDevice.cs @@ -222,8 +222,8 @@ namespace Perspex.Input private IInteractive GetSource(IVisual hit) { - return this.Captured ?? - (hit as IInteractive) ?? + return this.Captured ?? + (hit as IInteractive) ?? hit.GetSelfAndVisualAncestors().OfType().FirstOrDefault(); } diff --git a/Perspex.Input/Properties/AssemblyInfo.cs b/Perspex.Input/Properties/AssemblyInfo.cs index e14d648741..05bbfa7faa 100644 --- a/Perspex.Input/Properties/AssemblyInfo.cs +++ b/Perspex.Input/Properties/AssemblyInfo.cs @@ -7,7 +7,7 @@ using System.Reflection; using System.Resources; -// General Information about an assembly is controlled through the following +// General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information // associated with an assembly. [assembly: AssemblyTitle("Perspex.Input")] @@ -23,11 +23,11 @@ using System.Resources; // Version information for an assembly consists of the following four values: // // Major Version -// Minor Version +// Minor Version // Build Number // Revision // -// You can specify all the values or you can default the Build and Revision Numbers +// You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion("1.0.0.0")] diff --git a/Perspex.Input/Raw/RawKeyEventArgs.cs b/Perspex.Input/Raw/RawKeyEventArgs.cs index 7050375d6a..8f17c14410 100644 --- a/Perspex.Input/Raw/RawKeyEventArgs.cs +++ b/Perspex.Input/Raw/RawKeyEventArgs.cs @@ -15,10 +15,10 @@ namespace Perspex.Input.Raw public class RawKeyEventArgs : RawInputEventArgs { public RawKeyEventArgs( - IKeyboardDevice device, + IKeyboardDevice device, uint timestamp, - RawKeyEventType type, - Key key, + RawKeyEventType type, + Key key, string text) : base(device, timestamp) { diff --git a/Perspex.Interactive.UnitTests/Properties/AssemblyInfo.cs b/Perspex.Interactive.UnitTests/Properties/AssemblyInfo.cs index a3fb89a3cf..9ad584be6c 100644 --- a/Perspex.Interactive.UnitTests/Properties/AssemblyInfo.cs +++ b/Perspex.Interactive.UnitTests/Properties/AssemblyInfo.cs @@ -2,7 +2,7 @@ using System.Runtime.CompilerServices; using System.Runtime.InteropServices; -// General Information about an assembly is controlled through the following +// General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information // associated with an assembly. [assembly: AssemblyTitle("Perspex.Interactive.UnitTests")] @@ -14,8 +14,8 @@ using System.Runtime.InteropServices; [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] -// Setting ComVisible to false makes the types in this assembly not visible -// to COM components. If you need to access a type in this assembly from +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from // COM, set the ComVisible attribute to true on that type. [assembly: ComVisible(false)] @@ -25,11 +25,11 @@ using System.Runtime.InteropServices; // Version information for an assembly consists of the following four values: // // Major Version -// Minor Version +// Minor Version // Build Number // Revision // -// You can specify all the values or you can default the Build and Revision Numbers +// You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion("1.0.0.0")] diff --git a/Perspex.Interactivity/Properties/AssemblyInfo.cs b/Perspex.Interactivity/Properties/AssemblyInfo.cs index 8b86f5d47e..b19b7752d5 100644 --- a/Perspex.Interactivity/Properties/AssemblyInfo.cs +++ b/Perspex.Interactivity/Properties/AssemblyInfo.cs @@ -7,7 +7,7 @@ using System.Reflection; using System.Resources; -// General Information about an assembly is controlled through the following +// General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information // associated with an assembly. [assembly: AssemblyTitle("Perspex.Interactive")] @@ -23,11 +23,11 @@ using System.Resources; // Version information for an assembly consists of the following four values: // // Major Version -// Minor Version +// Minor Version // Build Number // Revision // -// You can specify all the values or you can default the Build and Revision Numbers +// You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion("1.0.0.0")] diff --git a/Perspex.Interactivity/RoutedEvent.cs b/Perspex.Interactivity/RoutedEvent.cs index a5e893c8b9..337180eff9 100644 --- a/Perspex.Interactivity/RoutedEvent.cs +++ b/Perspex.Interactivity/RoutedEvent.cs @@ -24,7 +24,7 @@ namespace Perspex.Interactivity private List subscriptions = new List(); public RoutedEvent( - string name, + string name, RoutingStrategies routingStrategies, Type eventArgsType, Type ownerType) @@ -40,28 +40,28 @@ namespace Perspex.Interactivity this.RoutingStrategies = routingStrategies; } - public Type EventArgsType - { - get; - private set; + public Type EventArgsType + { + get; + private set; } - public string Name - { - get; - private set; + public string Name + { + get; + private set; } - public Type OwnerType - { - get; - private set; + public Type OwnerType + { + get; + private set; } - public RoutingStrategies RoutingStrategies - { - get; - private set; + public RoutingStrategies RoutingStrategies + { + get; + private set; } public static RoutedEvent Register( @@ -77,7 +77,7 @@ namespace Perspex.Interactivity public static RoutedEvent Register( string name, RoutingStrategies routingStrategy, - Type ownerType) + Type ownerType) where TEventArgs : RoutedEventArgs { Contract.Requires(name != null); @@ -126,15 +126,15 @@ namespace Perspex.Interactivity public void AddClassHandler( Func> handler, - RoutingStrategies routes = RoutingStrategies.Direct | RoutingStrategies.Bubble) + RoutingStrategies routes = RoutingStrategies.Direct | RoutingStrategies.Bubble) where TTarget : class { this.AddClassHandler(typeof(TTarget), (s, e) => ClassHandlerAdapter(s, e, handler), routes); } private static void ClassHandlerAdapter( - object sender, - RoutedEventArgs e, + object sender, + RoutedEventArgs e, Func> handler) where TTarget : class { var target = sender as TTarget; diff --git a/Perspex.Layout/GlobalSuppressions.cs b/Perspex.Layout/GlobalSuppressions.cs new file mode 100644 index 0000000000..4f293bba02 --- /dev/null +++ b/Perspex.Layout/GlobalSuppressions.cs @@ -0,0 +1,14 @@ +// ----------------------------------------------------------------------- +// +// Copyright 2015 MIT Licence. See licence.md for more information. +// +// ----------------------------------------------------------------------- + +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage( + "StyleCop.CSharp.MaintainabilityRules", + "SA1401:Fields must be private", + Justification = "Routed event fields should not be private.")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage( + "StyleCop.CSharp.DocumentationRules", + "SA1609:Property documentation must have value", + Justification = "This rule is fscking pointless")] \ No newline at end of file diff --git a/Perspex.Layout/ILayoutManager.cs b/Perspex.Layout/ILayoutManager.cs index 4572926a18..dbf691e521 100644 --- a/Perspex.Layout/ILayoutManager.cs +++ b/Perspex.Layout/ILayoutManager.cs @@ -15,7 +15,7 @@ namespace Perspex.Layout /// /// Each layout root element such as a window has its own LayoutManager that is responsible /// for laying out its child controls. When a layout is required the - /// observable will fire and the root element should respond by calling + /// observable will fire and the root element should respond by calling /// at the earliest opportunity to carry out the layout. /// public interface ILayoutManager @@ -42,7 +42,7 @@ namespace Perspex.Layout /// Gets a value indicating whether a layout is queued. /// /// - /// Returns true when has been fired, but + /// Returns true when has been fired, but /// has not yet been called. /// bool LayoutQueued { get; } diff --git a/Perspex.Layout/LayoutManager.cs b/Perspex.Layout/LayoutManager.cs index 19a2146df8..e2bdaf8fba 100644 --- a/Perspex.Layout/LayoutManager.cs +++ b/Perspex.Layout/LayoutManager.cs @@ -8,12 +8,12 @@ namespace Perspex.Layout { using System; using System.Reactive; + using System.Reactive.Disposables; using System.Reactive.Subjects; using NGenerics.DataStructures.General; using Perspex.VisualTree; using Serilog; using Serilog.Core.Enrichers; - using System.Reactive.Disposables; /// /// Manages measuring and arranging of controls. @@ -21,7 +21,7 @@ namespace Perspex.Layout /// /// Each layout root element such as a window has its own LayoutManager that is responsible /// for laying out its child controls. When a layout is required the - /// observable will fire and the root element should respond by calling + /// observable will fire and the root element should respond by calling /// at the earliest opportunity to carry out the layout. /// public class LayoutManager : ILayoutManager @@ -108,7 +108,7 @@ namespace Perspex.Layout /// Gets a value indicating whether a layout is queued. /// /// - /// Returns true when has been fired, but + /// Returns true when has been fired, but /// has not yet been called. /// public bool LayoutQueued diff --git a/Perspex.Layout/Layoutable.cs b/Perspex.Layout/Layoutable.cs index d4e700984f..b600974ece 100644 --- a/Perspex.Layout/Layoutable.cs +++ b/Perspex.Layout/Layoutable.cs @@ -218,7 +218,7 @@ namespace Perspex.Layout throw new InvalidOperationException("Invalid Arrange rectangle."); } - // If the measure was invalidated during an arrange pass, wait for the measure pass to + // If the measure was invalidated during an arrange pass, wait for the measure pass to // be re-run. if (!this.IsMeasureValid) { diff --git a/Perspex.Layout/Properties/AssemblyInfo.cs b/Perspex.Layout/Properties/AssemblyInfo.cs index e7c7262ed9..38a14025b7 100644 --- a/Perspex.Layout/Properties/AssemblyInfo.cs +++ b/Perspex.Layout/Properties/AssemblyInfo.cs @@ -7,7 +7,7 @@ using System.Reflection; using System.Resources; -// General Information about an assembly is controlled through the following +// General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information // associated with an assembly. [assembly: AssemblyTitle("Perspex.Layout")] @@ -23,11 +23,11 @@ using System.Resources; // Version information for an assembly consists of the following four values: // // Major Version -// Minor Version +// Minor Version // Build Number // Revision // -// You can specify all the values or you can default the Build and Revision Numbers +// You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion("1.0.0.0")] diff --git a/Perspex.SceneGraph/IVisual.cs b/Perspex.SceneGraph/IVisual.cs index 7b9554c3ae..f626d97b70 100644 --- a/Perspex.SceneGraph/IVisual.cs +++ b/Perspex.SceneGraph/IVisual.cs @@ -8,6 +8,7 @@ namespace Perspex { using Perspex.Collections; using Perspex.Media; + using Perspex.VisualTree; /// /// Represents a node in the visual scene graph. diff --git a/Perspex.SceneGraph/Matrix.cs b/Perspex.SceneGraph/Matrix.cs index 4a510cf2c7..27cca586ad 100644 --- a/Perspex.SceneGraph/Matrix.cs +++ b/Perspex.SceneGraph/Matrix.cs @@ -94,6 +94,21 @@ namespace Perspex (left.offsetX * right.M12) + (left.offsetY * right.M22) + right.offsetY); } + public static Matrix operator -(Matrix matrix) + { + return matrix.Invert(); + } + + public static bool operator ==(Matrix matrix1, Matrix matrix2) + { + return matrix1.Equals(matrix2); + } + + public static bool operator !=(Matrix matrix1, Matrix matrix2) + { + return !matrix1.Equals(matrix2); + } + public static bool Equals(Matrix matrix1, Matrix matrix2) { return matrix1.Equals(matrix2); @@ -131,21 +146,6 @@ namespace Perspex return angle * 0.0174532925; } - public static Matrix operator -(Matrix matrix) - { - return matrix.Invert(); - } - - public static bool operator ==(Matrix matrix1, Matrix matrix2) - { - return matrix1.Equals(matrix2); - } - - public static bool operator !=(Matrix matrix1, Matrix matrix2) - { - return !matrix1.Equals(matrix2); - } - public bool Equals(Matrix value) { return this.m11 == value.M11 && diff --git a/Perspex.SceneGraph/Media/FormattedText.cs b/Perspex.SceneGraph/Media/FormattedText.cs index eff63ee8e4..0fbc3eb092 100644 --- a/Perspex.SceneGraph/Media/FormattedText.cs +++ b/Perspex.SceneGraph/Media/FormattedText.cs @@ -31,10 +31,10 @@ namespace Perspex.Media var platform = Locator.Current.GetService(); this.PlatformImpl = platform.CreateFormattedText( - text, - fontFamilyName, - fontSize, - fontStyle, + text, + fontFamilyName, + fontSize, + fontStyle, textAlignment, fontWeight); } @@ -122,4 +122,4 @@ namespace Perspex.Media this.PlatformImpl.SetForegroundBrush(brush, startIndex, count); } } -} +} diff --git a/Perspex.SceneGraph/Media/FormattedTextLine.cs b/Perspex.SceneGraph/Media/FormattedTextLine.cs index 01c22c2ae2..2b3f44030a 100644 --- a/Perspex.SceneGraph/Media/FormattedTextLine.cs +++ b/Perspex.SceneGraph/Media/FormattedTextLine.cs @@ -18,4 +18,4 @@ namespace Perspex.Media public double Height { get; private set; } } -} +} diff --git a/Perspex.SceneGraph/Media/IDrawingContext.cs b/Perspex.SceneGraph/Media/IDrawingContext.cs index 106b6ab3e5..ab24c6a8c7 100644 --- a/Perspex.SceneGraph/Media/IDrawingContext.cs +++ b/Perspex.SceneGraph/Media/IDrawingContext.cs @@ -14,8 +14,18 @@ namespace Perspex.Media /// public interface IDrawingContext : IDisposable { + /// + /// Gets the current transform of the drawing context. + /// Matrix CurrentTransform { get; } + /// + /// Draws a bitmap image. + /// + /// The bitmap image. + /// The opacity to draw with. + /// The rect in the image to draw. + /// The rect in the output to draw to. void DrawImage(IBitmap source, double opacity, Rect sourceRect, Rect destRect); /// @@ -23,7 +33,7 @@ namespace Perspex.Media /// /// The stroke pen. /// The first point of the line. - /// The second point of the line. + /// The second point of the line. void DrawLine(Pen pen, Point p1, Point p2); /// @@ -39,6 +49,7 @@ namespace Perspex.Media /// /// The pen. /// The rectangle bounds. + /// The corner radius. void DrawRectange(Pen pen, Rect rect, float cornerRadius = 0.0f); /// @@ -54,6 +65,7 @@ namespace Perspex.Media /// /// The brush. /// The rectangle bounds. + /// The corner radius. void FillRectange(Brush brush, Rect rect, float cornerRadius = 0.0f); /// diff --git a/Perspex.SceneGraph/Media/PathMarkupParser.cs b/Perspex.SceneGraph/Media/PathMarkupParser.cs index b0dd7b07fa..6aaeaf86d8 100644 --- a/Perspex.SceneGraph/Media/PathMarkupParser.cs +++ b/Perspex.SceneGraph/Media/PathMarkupParser.cs @@ -174,7 +174,7 @@ namespace Perspex.Media if (!Commands.TryGetValue(c, out command)) { - if ((char.IsDigit(c) || c == '.' || c == '+' || c == '-') && + if ((char.IsDigit(c) || c == '.' || c == '+' || c == '-') && (lastCommand != Command.None)) { return lastCommand; @@ -198,7 +198,7 @@ namespace Perspex.Media bool readPoint = false; bool readExponent = false; int i; - + while ((i = reader.Peek()) != -1) { char c = char.ToUpperInvariant((char)i); diff --git a/Perspex.SceneGraph/Media/SolidColorBrush.cs b/Perspex.SceneGraph/Media/SolidColorBrush.cs index 4210cdaa8c..5cfbfb94bd 100644 --- a/Perspex.SceneGraph/Media/SolidColorBrush.cs +++ b/Perspex.SceneGraph/Media/SolidColorBrush.cs @@ -32,10 +32,10 @@ namespace Perspex.Media /// /// Gets the color of the brush. /// - public Color Color - { - get; - private set; + public Color Color + { + get; + private set; } public override string ToString() diff --git a/Perspex.SceneGraph/Origin.cs b/Perspex.SceneGraph/Origin.cs index b1614d725f..948ee9df19 100644 --- a/Perspex.SceneGraph/Origin.cs +++ b/Perspex.SceneGraph/Origin.cs @@ -46,8 +46,8 @@ namespace Perspex public Point ToPixels(Size size) { - return this.unit == OriginUnit.Pixels ? - this.point : + return this.unit == OriginUnit.Pixels ? + this.point : new Point(this.point.X * size.Width, this.point.Y * size.Height); } } diff --git a/Perspex.SceneGraph/Platform/IPlatformRenderInterface.cs b/Perspex.SceneGraph/Platform/IPlatformRenderInterface.cs index d8fc4d7b11..7f7c1bb562 100644 --- a/Perspex.SceneGraph/Platform/IPlatformRenderInterface.cs +++ b/Perspex.SceneGraph/Platform/IPlatformRenderInterface.cs @@ -13,9 +13,9 @@ namespace Perspex.Platform IBitmapImpl CreateBitmap(int width, int height); IFormattedTextImpl CreateFormattedText( - string text, - string fontFamily, - double fontSize, + string text, + string fontFamily, + double fontSize, FontStyle fontStyle, TextAlignment textAlignment, FontWeight fontWeight); diff --git a/Perspex.SceneGraph/Point.cs b/Perspex.SceneGraph/Point.cs index af080d86c6..78186dba86 100644 --- a/Perspex.SceneGraph/Point.cs +++ b/Perspex.SceneGraph/Point.cs @@ -50,6 +50,15 @@ namespace Perspex get { return this.y; } } + /// + /// Converts the to a . + /// + /// The point. + public static implicit operator Vector(Point p) + { + return new Vector(p.x, p.y); + } + /// /// Checks for equality between two s. /// @@ -72,26 +81,56 @@ namespace Perspex return !(left == right); } + /// + /// Adds two points. + /// + /// The first point. + /// The second point. + /// A point that is the result of the addition. public static Point operator +(Point a, Point b) { return new Point(a.x + b.x, a.y + b.y); } + /// + /// Adds a vector to a point. + /// + /// The point. + /// The vector. + /// A point that is the result of the addition. public static Point operator +(Point a, Vector b) { return new Point(a.x + b.X, a.y + b.Y); } + /// + /// Subtracts two points. + /// + /// The first point. + /// The second point. + /// A point that is the result of the subtraction. public static Point operator -(Point a, Point b) { return new Point(a.x - b.x, a.y - b.y); } + /// + /// Subtracts a vector from a point. + /// + /// The point. + /// The vector. + /// A point that is the result of the subtraction. public static Point operator -(Point a, Vector b) { return new Point(a.x - b.X, a.y - b.Y); } + /// + /// Applies a matrix to a point. + /// + /// The point. + /// The matrix. + /// The resulting point. public static Point operator *(Point point, Matrix matrix) { return new Point( @@ -99,11 +138,13 @@ namespace Perspex (point.X * matrix.M12) + (point.Y * matrix.M22) + matrix.OffsetY); } - public static implicit operator Vector(Point p) - { - return new Vector(p.x, p.y); - } - + /// + /// Checks for equality between a point and an object. + /// + /// The object. + /// + /// True if is a point that equals the current point. + /// public override bool Equals(object obj) { if (obj is Point) @@ -115,6 +156,10 @@ namespace Perspex return false; } + /// + /// Returns a hash code for a . + /// + /// The hash code. public override int GetHashCode() { unchecked @@ -135,11 +180,21 @@ namespace Perspex return string.Format(CultureInfo.InvariantCulture, "{0}, {1}", this.x, this.y); } + /// + /// Returns a new point with the specified X coordinate. + /// + /// The X coordinate. + /// The new point. public Point WithX(double x) { return new Point(x, this.y); } + /// + /// Returns a new point with the specified Y coordinate. + /// + /// The Y coordinate. + /// The new point. public Point WithY(double y) { return new Point(this.x, y); diff --git a/Perspex.SceneGraph/Properties/AssemblyInfo.cs b/Perspex.SceneGraph/Properties/AssemblyInfo.cs index 7f7c0cd8e6..174909ca26 100644 --- a/Perspex.SceneGraph/Properties/AssemblyInfo.cs +++ b/Perspex.SceneGraph/Properties/AssemblyInfo.cs @@ -7,7 +7,7 @@ using System.Reflection; using System.Resources; -// General Information about an assembly is controlled through the following +// General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information // associated with an assembly. [assembly: AssemblyTitle("Perspex.SceneGraph")] @@ -23,11 +23,11 @@ using System.Resources; // Version information for an assembly consists of the following four values: // // Major Version -// Minor Version +// Minor Version // Build Number // Revision // -// You can specify all the values or you can default the Build and Revision Numbers +// You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion("1.0.0.0")] diff --git a/Perspex.SceneGraph/Rect.cs b/Perspex.SceneGraph/Rect.cs index 38eae3bd24..86c4b51ce5 100644 --- a/Perspex.SceneGraph/Rect.cs +++ b/Perspex.SceneGraph/Rect.cs @@ -77,8 +77,8 @@ namespace Perspex /// /// Initializes a new instance of the structure. /// - /// The top left position of the rectangle. - /// The bottom right position of the rectangle. + /// The top left position of the rectangle. + /// The bottom right position of the rectangle. public Rect(Point topLeft, Point bottomRight) { this.x = topLeft.X; @@ -369,11 +369,11 @@ namespace Perspex public override string ToString() { return string.Format( - CultureInfo.InvariantCulture, - "{0}, {1}, {2}, {3}", + CultureInfo.InvariantCulture, + "{0}, {1}, {2}, {3}", this.x, this.y, - this.width, + this.width, this.height); } } diff --git a/Perspex.SceneGraph/Rendering/RendererBase.cs b/Perspex.SceneGraph/Rendering/RendererBase.cs index e032f61826..ccd00736b6 100644 --- a/Perspex.SceneGraph/Rendering/RendererBase.cs +++ b/Perspex.SceneGraph/Rendering/RendererBase.cs @@ -19,7 +19,7 @@ namespace Perspex.Rendering public abstract class RendererBase : IRenderer { /// - /// Gets the number of times has been called. + /// Gets the number of times has been called. /// public int RenderCount { @@ -50,7 +50,7 @@ namespace Perspex.Rendering public abstract void Resize(int width, int height); /// - /// When overriden by a derived class creates an for a + /// When overriden by a derived class creates an for a /// rendering session. /// /// The handle to use to create the context. @@ -62,6 +62,8 @@ namespace Perspex.Rendering /// /// The visual to render. /// The drawing context. + /// The current translation. + /// The current transform. protected virtual void Render(IVisual visual, IDrawingContext context, Matrix translation, Matrix transform) { var opacity = visual.Opacity; diff --git a/Perspex.SceneGraph/Size.cs b/Perspex.SceneGraph/Size.cs index e25b82619e..e96dadf706 100644 --- a/Perspex.SceneGraph/Size.cs +++ b/Perspex.SceneGraph/Size.cs @@ -81,7 +81,7 @@ namespace Perspex /// /// Scales a size. /// - /// The size + /// The size /// The scaling factor. /// The scaled size. public static Size operator *(Size size, Vector scale) @@ -92,7 +92,7 @@ namespace Perspex /// /// Scales a size. /// - /// The size + /// The size /// The scaling factor. /// The scaled size. public static Size operator /(Size size, Vector scale) @@ -125,6 +125,13 @@ namespace Perspex Math.Max(0, this.height - thickness.Top - thickness.Bottom)); } + /// + /// Checks for equality between a size and an object. + /// + /// The object. + /// + /// True if is a size that equals the current size. + /// public override bool Equals(object obj) { if (obj is Size) @@ -136,6 +143,10 @@ namespace Perspex return false; } + /// + /// Returns a hash code for a . + /// + /// The hash code. public override int GetHashCode() { unchecked diff --git a/Perspex.SceneGraph/Thickness.cs b/Perspex.SceneGraph/Thickness.cs index dd61dde537..42e60b250c 100644 --- a/Perspex.SceneGraph/Thickness.cs +++ b/Perspex.SceneGraph/Thickness.cs @@ -45,7 +45,7 @@ namespace Perspex /// Initializes a new instance of the structure. /// /// The thickness on the left and right. - /// The thickness on the top and bottom. + /// The thickness on the top and bottom. public Thickness(double horizontal, double vertical) { Contract.Requires(horizontal >= 0); diff --git a/Perspex.SceneGraph/Vector.cs b/Perspex.SceneGraph/Vector.cs index 0053b49fe1..2bdca8dc1f 100644 --- a/Perspex.SceneGraph/Vector.cs +++ b/Perspex.SceneGraph/Vector.cs @@ -51,26 +51,47 @@ namespace Perspex get { return this.y; } } + /// + /// Converts the to a . + /// + /// The vector. + public static explicit operator Point(Vector a) + { + return new Point(a.x, a.y); + } + + /// + /// Negates a vector. + /// + /// The vector. + /// The negated vector. public static Vector operator -(Vector a) { return new Vector(-a.x, -a.y); } + /// + /// Adds two vectors. + /// + /// The first vector. + /// The second vector. + /// A vector that is the result of the addition. public static Vector operator +(Vector a, Vector b) { return new Vector(a.x + b.x, a.y + b.y); } + /// + /// Subtracts two vectors. + /// + /// The first vector. + /// The second vector. + /// A vector that is the result of the subtraction. public static Vector operator -(Vector a, Vector b) { return new Vector(a.x - b.x, a.y - b.y); } - public static explicit operator Point(Vector a) - { - return new Point(a.x, a.y); - } - /// /// Returns the string representation of the point. /// @@ -80,11 +101,21 @@ namespace Perspex return string.Format(CultureInfo.InvariantCulture, "{0}, {1}", this.x, this.y); } + /// + /// Returns a new vector with the specified X coordinate. + /// + /// The X coordinate. + /// The new vector. public Vector WithX(double x) { return new Vector(x, this.y); } + /// + /// Returns a new vector with the specified Y coordinate. + /// + /// The Y coordinate. + /// The new vector. public Vector WithY(double y) { return new Vector(this.x, y); diff --git a/Perspex.SceneGraph/Visual.cs b/Perspex.SceneGraph/Visual.cs index 98776e74e6..03473ce7bb 100644 --- a/Perspex.SceneGraph/Visual.cs +++ b/Perspex.SceneGraph/Visual.cs @@ -198,7 +198,6 @@ namespace Perspex get { return this.isAttachedToVisualTree; } } - /// /// Gets the scene graph node's child nodes. /// @@ -417,7 +416,8 @@ namespace Perspex } /// - /// Called when the event is fired. + /// Called when the 's event + /// is fired. /// /// The sender. /// The event args. @@ -508,7 +508,7 @@ namespace Perspex } /// - /// Calls the method for this control + /// Calls the method for this control /// and all of its visual descendents. /// /// The root of the visual tree. diff --git a/Perspex.SceneGraph/VisualTree/IHostedVisualTreeRoot.cs b/Perspex.SceneGraph/VisualTree/IHostedVisualTreeRoot.cs index e76ae5ebde..df1090497a 100644 --- a/Perspex.SceneGraph/VisualTree/IHostedVisualTreeRoot.cs +++ b/Perspex.SceneGraph/VisualTree/IHostedVisualTreeRoot.cs @@ -1,5 +1,5 @@ // ----------------------------------------------------------------------- -// +// // Copyright 2015 MIT Licence. See licence.md for more information. // // ----------------------------------------------------------------------- diff --git a/Perspex.Styling/Properties/AssemblyInfo.cs b/Perspex.Styling/Properties/AssemblyInfo.cs index dac22c3495..231f266bc9 100644 --- a/Perspex.Styling/Properties/AssemblyInfo.cs +++ b/Perspex.Styling/Properties/AssemblyInfo.cs @@ -7,7 +7,7 @@ using System.Reflection; using System.Resources; -// General Information about an assembly is controlled through the following +// General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information // associated with an assembly. [assembly: AssemblyTitle("Perspex.Styling")] @@ -23,11 +23,11 @@ using System.Resources; // Version information for an assembly consists of the following four values: // // Major Version -// Minor Version +// Minor Version // Build Number // Revision // -// You can specify all the values or you can default the Build and Revision Numbers +// You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion("1.0.0.0")] diff --git a/Perspex.Styling/Styling/INamed.cs b/Perspex.Styling/Styling/INamed.cs index 07bac0f0a2..003a826d8e 100644 --- a/Perspex.Styling/Styling/INamed.cs +++ b/Perspex.Styling/Styling/INamed.cs @@ -1,5 +1,5 @@ // ----------------------------------------------------------------------- -// +// // Copyright 2014 MIT Licence. See licence.md for more information. // // ----------------------------------------------------------------------- diff --git a/Perspex.Styling/Styling/Selector.cs b/Perspex.Styling/Styling/Selector.cs index 2fb0d12047..abd3cbaf2f 100644 --- a/Perspex.Styling/Styling/Selector.cs +++ b/Perspex.Styling/Styling/Selector.cs @@ -62,7 +62,7 @@ namespace Perspex.Styling { List> inputs = new List>(); Selector selector = this; - + while (selector != null) { if (selector.inTemplate && control.TemplatedParent == null) diff --git a/Perspex.Styling/Styling/SelectorMatch.cs b/Perspex.Styling/Styling/SelectorMatch.cs index f3246ea4ef..bf6bc12adc 100644 --- a/Perspex.Styling/Styling/SelectorMatch.cs +++ b/Perspex.Styling/Styling/SelectorMatch.cs @@ -12,8 +12,8 @@ namespace Perspex.Styling /// 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 + /// 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 /// category of selectors, the value of will be set but for the /// second, will be null and will @@ -44,7 +44,7 @@ namespace Perspex.Styling } /// - /// Gets the immedate result of the selector match, in the case of selectors that cannot + /// Gets the immedate result of the selector match, in the case of selectors that cannot /// change over time. /// public bool? ImmediateResult { get; } diff --git a/Perspex.Styling/Styling/Selectors.cs b/Perspex.Styling/Styling/Selectors.cs index 70dfb8a223..3a6024a38a 100644 --- a/Perspex.Styling/Styling/Selectors.cs +++ b/Perspex.Styling/Styling/Selectors.cs @@ -79,10 +79,10 @@ namespace Perspex.Styling Contract.Requires(previous != null); return new Selector( - previous, - x => MatchTemplate(x, previous), - " /deep/ ", - inTemplate: true, + previous, + x => MatchTemplate(x, previous), + " /deep/ ", + inTemplate: true, stopTraversal: true); } diff --git a/Perspex.Styling/Styling/StyleActivator.cs b/Perspex.Styling/Styling/StyleActivator.cs index 9bb406392a..17e17f185f 100644 --- a/Perspex.Styling/Styling/StyleActivator.cs +++ b/Perspex.Styling/Styling/StyleActivator.cs @@ -28,7 +28,7 @@ namespace Perspex.Styling private List> observers = new List>(); public StyleActivator( - IList> inputs, + IList> inputs, ActivatorMode mode = ActivatorMode.And) { int i = 0; @@ -97,7 +97,7 @@ namespace Perspex.Styling this.values[index] = value; bool current; - + switch (this.mode) { case ActivatorMode.And: @@ -121,10 +121,10 @@ namespace Perspex.Styling { // We can unsubscribe from everything if the completed observable: // - Is the only subscription. - // - Has finished on 'false' and we're in And mode + // - Has finished on 'false' and we're in And mode // - Has finished on 'true' and we're in Or mode var value = this.values[i]; - var unsubscribe = + var unsubscribe = (this.values.Length == 1) || (this.mode == ActivatorMode.And ? !value : value); diff --git a/Perspex.Styling/Styling/StyleBinding.cs b/Perspex.Styling/Styling/StyleBinding.cs index b9e7b8a35f..8d58cc3911 100644 --- a/Perspex.Styling/Styling/StyleBinding.cs +++ b/Perspex.Styling/Styling/StyleBinding.cs @@ -14,8 +14,9 @@ namespace Perspex.Styling /// /// /// This class takes an activator and a value. The activator is an observable which produces - /// a bool. When the activator produces true, this observable will produce . - /// When the activator produces false it will produce . + /// a bool. When the activator produces true, this observable will produce + /// . When the activator produces false it will produce + /// . /// internal class StyleBinding : ObservableBase, IDescription { diff --git a/Perspex.Themes.Default/ContentControlStyle.cs b/Perspex.Themes.Default/ContentControlStyle.cs index 95598422fb..a7bf43ce6b 100644 --- a/Perspex.Themes.Default/ContentControlStyle.cs +++ b/Perspex.Themes.Default/ContentControlStyle.cs @@ -31,7 +31,7 @@ namespace Perspex.Themes.Default private Control Template(ContentControl control) { return new ContentPresenter - { + { Name = "contentPresenter", [~ContentPresenter.ContentProperty] = control[~ContentControl.ContentProperty], }; diff --git a/Perspex.Themes.Default/DropDownStyle.cs b/Perspex.Themes.Default/DropDownStyle.cs index 3698bcad44..638da4cd5d 100644 --- a/Perspex.Themes.Default/DropDownStyle.cs +++ b/Perspex.Themes.Default/DropDownStyle.cs @@ -120,7 +120,8 @@ namespace Perspex.Themes.Default PlacementTarget = control, StaysOpen = false, [~~Popup.IsOpenProperty] = control[~~DropDown.IsDropDownOpenProperty], - [~Popup.MinWidthProperty] = control[~DropDown.BoundsProperty].Cast().Select(x => (object)x.Width), } + [~Popup.MinWidthProperty] = control[~DropDown.BoundsProperty].Cast().Select(x => (object)x.Width), + } }, }, }; diff --git a/Perspex.Themes.Default/Properties/AssemblyInfo.cs b/Perspex.Themes.Default/Properties/AssemblyInfo.cs index 83df8747d1..6f2bfac5eb 100644 --- a/Perspex.Themes.Default/Properties/AssemblyInfo.cs +++ b/Perspex.Themes.Default/Properties/AssemblyInfo.cs @@ -7,7 +7,7 @@ using System.Reflection; using System.Resources; -// General Information about an assembly is controlled through the following +// General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information // associated with an assembly. [assembly: AssemblyTitle("Perspex.Themes.Default")] @@ -23,11 +23,11 @@ using System.Resources; // Version information for an assembly consists of the following four values: // // Major Version -// Minor Version +// Minor Version // Build Number // Revision // -// You can specify all the values or you can default the Build and Revision Numbers +// You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion("1.0.0.0")] diff --git a/Tests/Perspex.Base.UnitTests/PerspexObjectTests_SetValue.cs b/Tests/Perspex.Base.UnitTests/PerspexObjectTests_SetValue.cs index 12f4cbb899..e279341487 100644 --- a/Tests/Perspex.Base.UnitTests/PerspexObjectTests_SetValue.cs +++ b/Tests/Perspex.Base.UnitTests/PerspexObjectTests_SetValue.cs @@ -203,7 +203,7 @@ namespace Perspex.Base.UnitTests public double Value { get; } - public static implicit operator double (ImplictDouble v) + public static implicit operator double(ImplictDouble v) { return v.Value; } diff --git a/Tests/Perspex.Base.UnitTests/PerspexPropertyTests.cs b/Tests/Perspex.Base.UnitTests/PerspexPropertyTests.cs index 793d3396f6..b52d77d5b8 100644 --- a/Tests/Perspex.Base.UnitTests/PerspexPropertyTests.cs +++ b/Tests/Perspex.Base.UnitTests/PerspexPropertyTests.cs @@ -118,7 +118,7 @@ namespace Perspex.Base.UnitTests private class Class1 : PerspexObject { - public static readonly PerspexProperty FooProperty = + public static readonly PerspexProperty FooProperty = PerspexProperty.Register("Foo", "default"); } diff --git a/Tests/Perspex.Base.UnitTests/PriorityValueTests.cs b/Tests/Perspex.Base.UnitTests/PriorityValueTests.cs index 4d4fc77026..5e7d36873b 100644 --- a/Tests/Perspex.Base.UnitTests/PriorityValueTests.cs +++ b/Tests/Perspex.Base.UnitTests/PriorityValueTests.cs @@ -177,7 +177,7 @@ namespace Perspex.Base.UnitTests var target = new PriorityValue("Test", typeof(string)); bool called = false; - target.Changed.Subscribe(value => called = (value.Item1 == PerspexProperty.UnsetValue && (string)value.Item2 == "foo")); + target.Changed.Subscribe(value => called = value.Item1 == PerspexProperty.UnsetValue && (string)value.Item2 == "foo"); target.Add(this.Single("foo"), 0); Assert.True(called); @@ -191,7 +191,7 @@ namespace Perspex.Base.UnitTests bool called = false; target.Add(subject, 0); - target.Changed.Subscribe(value => called = ((string)value.Item1 == "foo" && (string)value.Item2 == "bar")); + target.Changed.Subscribe(value => called = (string)value.Item1 == "foo" && (string)value.Item2 == "bar"); subject.OnNext("bar"); Assert.True(called); diff --git a/Tests/Perspex.Base.UnitTests/Properties/AssemblyInfo.cs b/Tests/Perspex.Base.UnitTests/Properties/AssemblyInfo.cs index 81a5f6d1c5..0f4f9696a7 100644 --- a/Tests/Perspex.Base.UnitTests/Properties/AssemblyInfo.cs +++ b/Tests/Perspex.Base.UnitTests/Properties/AssemblyInfo.cs @@ -2,7 +2,7 @@ using System.Runtime.CompilerServices; using System.Runtime.InteropServices; -// General Information about an assembly is controlled through the following +// General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information // associated with an assembly. [assembly: AssemblyTitle("Perspex.UnitTests")] @@ -14,8 +14,8 @@ using System.Runtime.InteropServices; [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] -// Setting ComVisible to false makes the types in this assembly not visible -// to COM components. If you need to access a type in this assembly from +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from // COM, set the ComVisible attribute to true on that type. [assembly: ComVisible(false)] @@ -25,11 +25,11 @@ using System.Runtime.InteropServices; // Version information for an assembly consists of the following four values: // // Major Version -// Minor Version +// Minor Version // Build Number // Revision // -// You can specify all the values or you can default the Build and Revision Numbers +// You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion("1.0.0.0")] diff --git a/Tests/Perspex.Controls.UnitTests/ContentControlTests.cs b/Tests/Perspex.Controls.UnitTests/ContentControlTests.cs index c7a59ba444..b51cd3b0d1 100644 --- a/Tests/Perspex.Controls.UnitTests/ContentControlTests.cs +++ b/Tests/Perspex.Controls.UnitTests/ContentControlTests.cs @@ -9,12 +9,11 @@ namespace Perspex.Controls.UnitTests using System; using System.Collections.Specialized; using System.Linq; + using LogicalTree; using Moq; using Perspex.Controls; using Perspex.Controls.Presenters; using Perspex.Controls.Templates; - using Perspex.Layout; - using LogicalTree; using Perspex.Platform; using Perspex.Styling; using Perspex.VisualTree; diff --git a/Tests/Perspex.Controls.UnitTests/Presenters/ScrollContentPresenterTests.cs b/Tests/Perspex.Controls.UnitTests/Presenters/ScrollContentPresenterTests.cs index 5bc702fc10..1116675c11 100644 --- a/Tests/Perspex.Controls.UnitTests/Presenters/ScrollContentPresenterTests.cs +++ b/Tests/Perspex.Controls.UnitTests/Presenters/ScrollContentPresenterTests.cs @@ -1,5 +1,5 @@ // ----------------------------------------------------------------------- -// +// // Copyright 2014 MIT Licence. See licence.md for more information. // // ----------------------------------------------------------------------- @@ -10,8 +10,8 @@ namespace Perspex.Controls.UnitTests.Presenters using System.Collections.Generic; using System.Reactive.Linq; using Perspex.Controls.Presenters; - using Xunit; using Perspex.Layout; + using Xunit; public class ScrollContentPresenterTests { @@ -21,11 +21,11 @@ namespace Perspex.Controls.UnitTests.Presenters Border content; var target = new ScrollContentPresenter { - Content = (content = new Border + Content = content = new Border { Padding = new Thickness(8), HorizontalAlignment = HorizontalAlignment.Left - }), + }, }; target.Measure(new Size(100, 100)); @@ -40,10 +40,10 @@ namespace Perspex.Controls.UnitTests.Presenters Border content; var target = new ScrollContentPresenter { - Content = (content = new Border + Content = content = new Border { Padding = new Thickness(8), - }), + }, }; target.Measure(new Size(100, 100)); @@ -58,11 +58,11 @@ namespace Perspex.Controls.UnitTests.Presenters Border content; var target = new ScrollContentPresenter { - Content = (content = new Border + Content = content = new Border { Padding = new Thickness(8), HorizontalAlignment = HorizontalAlignment.Right - }), + }, }; target.Measure(new Size(100, 100)); @@ -77,11 +77,11 @@ namespace Perspex.Controls.UnitTests.Presenters Border content; var target = new ScrollContentPresenter { - Content = (content = new Border + Content = content = new Border { Padding = new Thickness(8), VerticalAlignment = VerticalAlignment.Bottom, - }), + }, }; target.Measure(new Size(100, 100)); @@ -96,12 +96,12 @@ namespace Perspex.Controls.UnitTests.Presenters Border content; var target = new ScrollContentPresenter { - Content = (content = new Border + Content = content = new Border { Padding = new Thickness(8), HorizontalAlignment = HorizontalAlignment.Right, VerticalAlignment = VerticalAlignment.Top, - }), + }, }; target.Measure(new Size(100, 100)); @@ -116,7 +116,7 @@ namespace Perspex.Controls.UnitTests.Presenters TestControl content; var target = new ScrollContentPresenter { - Content = (content = new TestControl()), + Content = content = new TestControl(), }; target.Measure(new Size(100, 100)); @@ -131,11 +131,11 @@ namespace Perspex.Controls.UnitTests.Presenters Border content; var target = new ScrollContentPresenter { - Content = (content = new Border + Content = content = new Border { Width = 150, Height = 150, - }), + }, Offset = new Vector(25, 25), }; diff --git a/Tests/Perspex.Controls.UnitTests/Properties/AssemblyInfo.cs b/Tests/Perspex.Controls.UnitTests/Properties/AssemblyInfo.cs index 3f0c048257..5fa9d42212 100644 --- a/Tests/Perspex.Controls.UnitTests/Properties/AssemblyInfo.cs +++ b/Tests/Perspex.Controls.UnitTests/Properties/AssemblyInfo.cs @@ -2,7 +2,7 @@ using System.Runtime.CompilerServices; using System.Runtime.InteropServices; -// General Information about an assembly is controlled through the following +// General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information // associated with an assembly. [assembly: AssemblyTitle("Perspex.Controls.UnitTests")] @@ -14,8 +14,8 @@ using System.Runtime.InteropServices; [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] -// Setting ComVisible to false makes the types in this assembly not visible -// to COM components. If you need to access a type in this assembly from +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from // COM, set the ComVisible attribute to true on that type. [assembly: ComVisible(false)] @@ -25,11 +25,11 @@ using System.Runtime.InteropServices; // Version information for an assembly consists of the following four values: // // Major Version -// Minor Version +// Minor Version // Build Number // Revision // -// You can specify all the values or you can default the Build and Revision Numbers +// You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion("1.0.0.0")] diff --git a/Tests/Perspex.Controls.UnitTests/ScrollViewerTests.cs b/Tests/Perspex.Controls.UnitTests/ScrollViewerTests.cs index f701d5f559..a2e0ea15cc 100644 --- a/Tests/Perspex.Controls.UnitTests/ScrollViewerTests.cs +++ b/Tests/Perspex.Controls.UnitTests/ScrollViewerTests.cs @@ -13,7 +13,6 @@ namespace Perspex.Controls.UnitTests using Perspex.Controls.Templates; using Perspex.VisualTree; using Xunit; - using Perspex.Layout; public class ScrollViewerTests { diff --git a/Tests/Perspex.Controls.UnitTests/TabControlTests.cs b/Tests/Perspex.Controls.UnitTests/TabControlTests.cs index 145c0397bb..5f416cb0dc 100644 --- a/Tests/Perspex.Controls.UnitTests/TabControlTests.cs +++ b/Tests/Perspex.Controls.UnitTests/TabControlTests.cs @@ -6,13 +6,13 @@ namespace Perspex.Controls.UnitTests { + using System.Collections.ObjectModel; using System.Linq; using Perspex.Controls.Presenters; using Perspex.Controls.Primitives; using Perspex.Controls.Templates; using Perspex.LogicalTree; using Xunit; - using System.Collections.ObjectModel; public class TabControlTests { diff --git a/Tests/Perspex.Controls.UnitTests/TemplatedControlTests.cs b/Tests/Perspex.Controls.UnitTests/TemplatedControlTests.cs index b86af21db0..091c66d66b 100644 --- a/Tests/Perspex.Controls.UnitTests/TemplatedControlTests.cs +++ b/Tests/Perspex.Controls.UnitTests/TemplatedControlTests.cs @@ -23,8 +23,8 @@ namespace Perspex.Controls.UnitTests public void Template_Doesnt_Get_Executed_On_Set() { bool executed = false; - - var template = new ControlTemplate(_ => + + var template = new ControlTemplate(_ => { executed = true; return new Control(); @@ -155,7 +155,7 @@ namespace Perspex.Controls.UnitTests var root = new TestRoot { - Child = (target = new TestTemplatedControl + Child = target = new TestTemplatedControl { Template = new ControlTemplate(_ => { @@ -169,10 +169,9 @@ namespace Perspex.Controls.UnitTests } }; }), - }) + } }; - target.ApplyTemplate(); styler.Verify(x => x.ApplyStyles(It.IsAny()), Times.Once()); @@ -218,7 +217,7 @@ namespace Perspex.Controls.UnitTests { return new ContentPresenter { - Content = new TextBlock + Content = new TextBlock { } }; @@ -274,4 +273,3 @@ namespace Perspex.Controls.UnitTests } } } - diff --git a/Tests/Perspex.Controls.UnitTests/TestTemplatedControl.cs b/Tests/Perspex.Controls.UnitTests/TestTemplatedControl.cs index c3a297a895..b696ef5a47 100644 --- a/Tests/Perspex.Controls.UnitTests/TestTemplatedControl.cs +++ b/Tests/Perspex.Controls.UnitTests/TestTemplatedControl.cs @@ -1,5 +1,5 @@ // ----------------------------------------------------------------------- -// +// // Copyright 2014 MIT Licence. See licence.md for more information. // // ----------------------------------------------------------------------- @@ -12,7 +12,7 @@ namespace Perspex.Controls.UnitTests { public bool OnTemplateAppliedCalled { get; private set; } - public new void AddVisualChild(Visual visual) + public new void AddVisualChild(IVisual visual) { base.AddVisualChild(visual); } diff --git a/Tests/Perspex.Controls.UnitTests/TopLevelTests.cs b/Tests/Perspex.Controls.UnitTests/TopLevelTests.cs index 5beefc2d02..7a82ffecf9 100644 --- a/Tests/Perspex.Controls.UnitTests/TopLevelTests.cs +++ b/Tests/Perspex.Controls.UnitTests/TopLevelTests.cs @@ -295,10 +295,10 @@ namespace Perspex.Controls.UnitTests var target = new TestTopLevel(impl.Object); var input = new RawKeyEventArgs( - new Mock().Object, - 0, - RawKeyEventType.KeyDown, - Key.A, + new Mock().Object, + 0, + RawKeyEventType.KeyDown, + Key.A, "A"); impl.Object.Input(input); diff --git a/Tests/Perspex.Direct2D1.UnitTests/Controls/Shapes/PathTests.cs b/Tests/Perspex.Direct2D1.UnitTests/Controls/Shapes/PathTests.cs index 5dd1892358..4cb9316933 100644 --- a/Tests/Perspex.Direct2D1.UnitTests/Controls/Shapes/PathTests.cs +++ b/Tests/Perspex.Direct2D1.UnitTests/Controls/Shapes/PathTests.cs @@ -1,5 +1,5 @@ // ----------------------------------------------------------------------- -// +// // Copyright 2015 MIT Licence. See licence.md for more information. // // ----------------------------------------------------------------------- @@ -14,10 +14,10 @@ namespace Perspex.Direct2D1.UnitTests.Controls.Shapes public class PathTests { - private static readonly RectComparer compare = new RectComparer(); + private static readonly RectComparer Compare = new RectComparer(); [Fact] - void Should_Measure_Expander_Triangle_Correctly() + public void Should_Measure_Expander_Triangle_Correctly() { using (Locator.CurrentMutable.WithResolver()) { @@ -35,12 +35,12 @@ namespace Perspex.Direct2D1.UnitTests.Controls.Shapes target.Measure(new Size(100, 100)); target.Arrange(new Rect(0, 0, 100, 100)); - Assert.Equal(new Rect(0, 0, 4, 10), target.Bounds, compare); + Assert.Equal(new Rect(0, 0, 4, 10), target.Bounds, Compare); } } [Fact] - void Should_Measure_Expander_Triangle_With_Stroke_Correctly() + public void Should_Measure_Expander_Triangle_With_Stroke_Correctly() { using (Locator.CurrentMutable.WithResolver()) { @@ -69,7 +69,7 @@ namespace Perspex.Direct2D1.UnitTests.Controls.Shapes // // However Path.Measure doesn't correctly handle strokes currently, so testing for // the (incorrect) current output for now... - Assert.Equal(new Rect(0, 0, 4, 10), target.Bounds, compare); + Assert.Equal(new Rect(0, 0, 4, 10), target.Bounds, Compare); } } } diff --git a/Tests/Perspex.Direct2D1.UnitTests/Media/GeometryTests.cs b/Tests/Perspex.Direct2D1.UnitTests/Media/GeometryTests.cs index 9c1b018113..716d573746 100644 --- a/Tests/Perspex.Direct2D1.UnitTests/Media/GeometryTests.cs +++ b/Tests/Perspex.Direct2D1.UnitTests/Media/GeometryTests.cs @@ -12,10 +12,10 @@ namespace Perspex.Direct2D1.UnitTests.Media public class GeometryTests { - private static readonly RectComparer compare = new RectComparer(); + private static readonly RectComparer Compare = new RectComparer(); [Fact] - void Should_Measure_Expander_Triangle_Correctly() + public void Should_Measure_Expander_Triangle_Correctly() { using (Locator.CurrentMutable.WithResolver()) { @@ -23,12 +23,12 @@ namespace Perspex.Direct2D1.UnitTests.Media var target = StreamGeometry.Parse("M 0 2 L 4 6 L 0 10 Z"); - Assert.Equal(new Rect(0, 2, 4, 8), target.Bounds, compare); + Assert.Equal(new Rect(0, 2, 4, 8), target.Bounds, Compare); } } [Fact] - void Should_Measure_Expander_Triangle_With_Stroke_Correctly() + public void Should_Measure_Expander_Triangle_With_Stroke_Correctly() { using (Locator.CurrentMutable.WithResolver()) { @@ -36,7 +36,7 @@ namespace Perspex.Direct2D1.UnitTests.Media var target = StreamGeometry.Parse("M 0 2 L 4 6 L 0 10 Z"); - Assert.Equal(new Rect(-1, -0.414, 6.414, 12.828), target.GetRenderBounds(2), compare); + Assert.Equal(new Rect(-1, -0.414, 6.414, 12.828), target.GetRenderBounds(2), Compare); } } } diff --git a/Tests/Perspex.Direct2D1.UnitTests/Properties/AssemblyInfo.cs b/Tests/Perspex.Direct2D1.UnitTests/Properties/AssemblyInfo.cs index 4b45a17ce2..b8ef22a392 100644 --- a/Tests/Perspex.Direct2D1.UnitTests/Properties/AssemblyInfo.cs +++ b/Tests/Perspex.Direct2D1.UnitTests/Properties/AssemblyInfo.cs @@ -2,7 +2,7 @@ using System.Runtime.CompilerServices; using System.Runtime.InteropServices; -// General Information about an assembly is controlled through the following +// General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information // associated with an assembly. [assembly: AssemblyTitle("Perspex.Direct2D1.UnitTests")] @@ -14,8 +14,8 @@ using System.Runtime.InteropServices; [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] -// Setting ComVisible to false makes the types in this assembly not visible -// to COM components. If you need to access a type in this assembly from +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from // COM, set the ComVisible attribute to true on that type. [assembly: ComVisible(false)] @@ -25,11 +25,11 @@ using System.Runtime.InteropServices; // Version information for an assembly consists of the following four values: // // Major Version -// Minor Version +// Minor Version // Build Number // Revision // -// You can specify all the values or you can default the Build and Revision Numbers +// You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion("1.0.0.0")] diff --git a/Tests/Perspex.Input.UnitTests/Properties/AssemblyInfo.cs b/Tests/Perspex.Input.UnitTests/Properties/AssemblyInfo.cs index 0b681f4272..98fccd1d35 100644 --- a/Tests/Perspex.Input.UnitTests/Properties/AssemblyInfo.cs +++ b/Tests/Perspex.Input.UnitTests/Properties/AssemblyInfo.cs @@ -2,7 +2,7 @@ using System.Runtime.CompilerServices; using System.Runtime.InteropServices; -// General Information about an assembly is controlled through the following +// General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information // associated with an assembly. [assembly: AssemblyTitle("Perspex.Input.UnitTests")] @@ -14,8 +14,8 @@ using System.Runtime.InteropServices; [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] -// Setting ComVisible to false makes the types in this assembly not visible -// to COM components. If you need to access a type in this assembly from +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from // COM, set the ComVisible attribute to true on that type. [assembly: ComVisible(false)] @@ -25,11 +25,11 @@ using System.Runtime.InteropServices; // Version information for an assembly consists of the following four values: // // Major Version -// Minor Version +// Minor Version // Build Number // Revision // -// You can specify all the values or you can default the Build and Revision Numbers +// You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion("1.0.0.0")] diff --git a/Tests/Perspex.Layout.UnitTests/FullLayoutTests.cs b/Tests/Perspex.Layout.UnitTests/FullLayoutTests.cs index ca838e3c80..10098b92b6 100644 --- a/Tests/Perspex.Layout.UnitTests/FullLayoutTests.cs +++ b/Tests/Perspex.Layout.UnitTests/FullLayoutTests.cs @@ -1,5 +1,5 @@ // ----------------------------------------------------------------------- -// +// // Copyright 2014 MIT Licence. See licence.md for more information. // // ----------------------------------------------------------------------- @@ -39,20 +39,20 @@ namespace Perspex.Layout.UnitTests var window = new Window() { - Content = (border = new Border + Content = border = new Border { HorizontalAlignment = HorizontalAlignment.Center, VerticalAlignment = VerticalAlignment.Center, Child = new Border { - Child = (textBlock = new TextBlock + Child = textBlock = new TextBlock { Width = 400, Height = 400, Text = "Hello World!", - }), + }, } - }) + } }; window.LayoutManager.ExecuteLayoutPass(); @@ -79,20 +79,20 @@ namespace Perspex.Layout.UnitTests { Width = 800, Height = 600, - Content = (scrollViewer = new ScrollViewer + Content = scrollViewer = new ScrollViewer { Width = 200, Height = 200, CanScrollHorizontally = true, HorizontalAlignment = HorizontalAlignment.Center, VerticalAlignment = VerticalAlignment.Center, - Content = (textBlock = new TextBlock + Content = textBlock = new TextBlock { Width = 400, Height = 400, Text = "Hello World!", - }), - }) + }, + } }; window.LayoutManager.ExecuteLayoutPass(); diff --git a/Tests/Perspex.Layout.UnitTests/Properties/AssemblyInfo.cs b/Tests/Perspex.Layout.UnitTests/Properties/AssemblyInfo.cs index f5e6e51355..0c96fc7d42 100644 --- a/Tests/Perspex.Layout.UnitTests/Properties/AssemblyInfo.cs +++ b/Tests/Perspex.Layout.UnitTests/Properties/AssemblyInfo.cs @@ -2,7 +2,7 @@ using System.Runtime.CompilerServices; using System.Runtime.InteropServices; -// General Information about an assembly is controlled through the following +// General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information // associated with an assembly. [assembly: AssemblyTitle("Perspex.Layout.UnitTests")] @@ -14,8 +14,8 @@ using System.Runtime.InteropServices; [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] -// Setting ComVisible to false makes the types in this assembly not visible -// to COM components. If you need to access a type in this assembly from +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from // COM, set the ComVisible attribute to true on that type. [assembly: ComVisible(false)] @@ -25,11 +25,11 @@ using System.Runtime.InteropServices; // Version information for an assembly consists of the following four values: // // Major Version -// Minor Version +// Minor Version // Build Number // Revision // -// You can specify all the values or you can default the Build and Revision Numbers +// You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion("1.0.0.0")] diff --git a/Tests/Perspex.RenderTests/Properties/AssemblyInfo.cs b/Tests/Perspex.RenderTests/Properties/AssemblyInfo.cs index 16d3a8baa4..419be9bc57 100644 --- a/Tests/Perspex.RenderTests/Properties/AssemblyInfo.cs +++ b/Tests/Perspex.RenderTests/Properties/AssemblyInfo.cs @@ -2,7 +2,7 @@ using System.Runtime.CompilerServices; using System.Runtime.InteropServices; -// General Information about an assembly is controlled through the following +// General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information // associated with an assembly. [assembly: AssemblyTitle("Perspex.Direct2D1.RenderTests")] @@ -14,8 +14,8 @@ using System.Runtime.InteropServices; [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] -// Setting ComVisible to false makes the types in this assembly not visible -// to COM components. If you need to access a type in this assembly from +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from // COM, set the ComVisible attribute to true on that type. [assembly: ComVisible(false)] @@ -25,11 +25,11 @@ using System.Runtime.InteropServices; // Version information for an assembly consists of the following four values: // // Major Version -// Minor Version +// Minor Version // Build Number // Revision // -// You can specify all the values or you can default the Build and Revision Numbers +// You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion("1.0.0.0")] diff --git a/Tests/Perspex.RenderTests/Shapes/EllipseTests.cs b/Tests/Perspex.RenderTests/Shapes/EllipseTests.cs index 87a5bd3b7d..0029b61660 100644 --- a/Tests/Perspex.RenderTests/Shapes/EllipseTests.cs +++ b/Tests/Perspex.RenderTests/Shapes/EllipseTests.cs @@ -7,8 +7,8 @@ namespace Perspex.Direct2D1.RenderTests.Shapes { using Perspex.Controls; - using Perspex.Media; using Perspex.Controls.Shapes; + using Perspex.Media; using Xunit; public class EllipseTests : TestBase diff --git a/Tests/Perspex.RenderTests/Shapes/PathTests.cs b/Tests/Perspex.RenderTests/Shapes/PathTests.cs index 53a473f1ea..c415bef233 100644 --- a/Tests/Perspex.RenderTests/Shapes/PathTests.cs +++ b/Tests/Perspex.RenderTests/Shapes/PathTests.cs @@ -7,9 +7,9 @@ namespace Perspex.Direct2D1.RenderTests.Shapes { using Perspex.Controls; + using Perspex.Controls.Shapes; using Perspex.Layout; using Perspex.Media; - using Perspex.Controls.Shapes; using Xunit; public class PathTests : TestBase diff --git a/Tests/Perspex.RenderTests/Shapes/RectangleTests.cs b/Tests/Perspex.RenderTests/Shapes/RectangleTests.cs index 66aa8d0cb8..926796d1b6 100644 --- a/Tests/Perspex.RenderTests/Shapes/RectangleTests.cs +++ b/Tests/Perspex.RenderTests/Shapes/RectangleTests.cs @@ -7,8 +7,8 @@ namespace Perspex.Direct2D1.RenderTests.Shapes { using Perspex.Controls; - using Perspex.Media; using Perspex.Controls.Shapes; + using Perspex.Media; using Xunit; public class RectangleTests : TestBase diff --git a/Tests/Perspex.SceneGraph.UnitTests/Properties/AssemblyInfo.cs b/Tests/Perspex.SceneGraph.UnitTests/Properties/AssemblyInfo.cs index 372d2b3c81..ec709c4925 100644 --- a/Tests/Perspex.SceneGraph.UnitTests/Properties/AssemblyInfo.cs +++ b/Tests/Perspex.SceneGraph.UnitTests/Properties/AssemblyInfo.cs @@ -2,7 +2,7 @@ using System.Runtime.CompilerServices; using System.Runtime.InteropServices; -// General Information about an assembly is controlled through the following +// General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information // associated with an assembly. [assembly: AssemblyTitle("Perspex.SceneGraph.UnitTests")] @@ -14,8 +14,8 @@ using System.Runtime.InteropServices; [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] -// Setting ComVisible to false makes the types in this assembly not visible -// to COM components. If you need to access a type in this assembly from +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from // COM, set the ComVisible attribute to true on that type. [assembly: ComVisible(false)] @@ -25,11 +25,11 @@ using System.Runtime.InteropServices; // Version information for an assembly consists of the following four values: // // Major Version -// Minor Version +// Minor Version // Build Number // Revision // -// You can specify all the values or you can default the Build and Revision Numbers +// You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion("1.0.0.0")] diff --git a/Tests/Perspex.SceneGraph.UnitTests/TestRoot.cs b/Tests/Perspex.SceneGraph.UnitTests/TestRoot.cs index fda78ccd42..8a49cfe6f1 100644 --- a/Tests/Perspex.SceneGraph.UnitTests/TestRoot.cs +++ b/Tests/Perspex.SceneGraph.UnitTests/TestRoot.cs @@ -1,5 +1,5 @@ // ----------------------------------------------------------------------- -// +// // Copyright 2014 MIT Licence. See licence.md for more information. // // ----------------------------------------------------------------------- diff --git a/Tests/Perspex.SceneGraph.UnitTests/TestVisual.cs b/Tests/Perspex.SceneGraph.UnitTests/TestVisual.cs index ddd91adebe..869000802b 100644 --- a/Tests/Perspex.SceneGraph.UnitTests/TestVisual.cs +++ b/Tests/Perspex.SceneGraph.UnitTests/TestVisual.cs @@ -22,15 +22,15 @@ namespace Perspex.SceneGraph.UnitTests public class TestVisual : Visual { + public event EventHandler> AttachedToVisualTreeCalled; + + public event EventHandler> DetachedFromVisualTreeCalled; + public new PerspexObject InheritanceParent { get { return base.InheritanceParent; } } - public event EventHandler> AttachedToVisualTreeCalled; - - public event EventHandler> DetachedFromVisualTreeCalled; - public void AddChild(Visual v) { this.AddVisualChild(v); diff --git a/Tests/Perspex.SceneGraph.UnitTests/VisualTree/BoundsTrackerTests.cs b/Tests/Perspex.SceneGraph.UnitTests/VisualTree/BoundsTrackerTests.cs index 22328112bb..fad8f10534 100644 --- a/Tests/Perspex.SceneGraph.UnitTests/VisualTree/BoundsTrackerTests.cs +++ b/Tests/Perspex.SceneGraph.UnitTests/VisualTree/BoundsTrackerTests.cs @@ -1,5 +1,5 @@ // ----------------------------------------------------------------------- -// +// // Copyright 2015 MIT Licence. See licence.md for more information. // // ----------------------------------------------------------------------- @@ -28,11 +28,11 @@ namespace Perspex.SceneGraph.UnitTests.VisualTree Child = new Decorator { Padding = new Thickness(5), - Child = (control = new Rectangle + Child = control = new Rectangle { Width = 15, Height = 15, - }), + }, } }; diff --git a/Tests/Perspex.Styling.UnitTests/Properties/AssemblyInfo.cs b/Tests/Perspex.Styling.UnitTests/Properties/AssemblyInfo.cs index e40471be85..ba2385c5e5 100644 --- a/Tests/Perspex.Styling.UnitTests/Properties/AssemblyInfo.cs +++ b/Tests/Perspex.Styling.UnitTests/Properties/AssemblyInfo.cs @@ -2,7 +2,7 @@ using System.Runtime.CompilerServices; using System.Runtime.InteropServices; -// General Information about an assembly is controlled through the following +// General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information // associated with an assembly. [assembly: AssemblyTitle("Perspex.Styling.UnitTests")] @@ -14,8 +14,8 @@ using System.Runtime.InteropServices; [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] -// Setting ComVisible to false makes the types in this assembly not visible -// to COM components. If you need to access a type in this assembly from +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from // COM, set the ComVisible attribute to true on that type. [assembly: ComVisible(false)] @@ -25,11 +25,11 @@ using System.Runtime.InteropServices; // Version information for an assembly consists of the following four values: // // Major Version -// Minor Version +// Minor Version // Build Number // Revision // -// You can specify all the values or you can default the Build and Revision Numbers +// You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion("1.0.0.0")] diff --git a/Tests/Perspex.Styling.UnitTests/SelectorTests_Child.cs b/Tests/Perspex.Styling.UnitTests/SelectorTests_Child.cs index 9fc071a828..6794b8b41e 100644 --- a/Tests/Perspex.Styling.UnitTests/SelectorTests_Child.cs +++ b/Tests/Perspex.Styling.UnitTests/SelectorTests_Child.cs @@ -1,5 +1,5 @@ // ----------------------------------------------------------------------- -// +// // Copyright 2014 MIT Licence. See licence.md for more information. // // ----------------------------------------------------------------------- diff --git a/Tests/Perspex.Styling.UnitTests/SelectorTests_Class.cs b/Tests/Perspex.Styling.UnitTests/SelectorTests_Class.cs index aad7792ec0..45f51622f8 100644 --- a/Tests/Perspex.Styling.UnitTests/SelectorTests_Class.cs +++ b/Tests/Perspex.Styling.UnitTests/SelectorTests_Class.cs @@ -1,5 +1,5 @@ // ----------------------------------------------------------------------- -// +// // Copyright 2014 MIT Licence. See licence.md for more information. // // ----------------------------------------------------------------------- diff --git a/Tests/Perspex.Styling.UnitTests/SelectorTests_Multiple.cs b/Tests/Perspex.Styling.UnitTests/SelectorTests_Multiple.cs index 4522d50cae..0904032fc6 100644 --- a/Tests/Perspex.Styling.UnitTests/SelectorTests_Multiple.cs +++ b/Tests/Perspex.Styling.UnitTests/SelectorTests_Multiple.cs @@ -1,5 +1,5 @@ // ----------------------------------------------------------------------- -// +// // Copyright 2014 MIT Licence. See licence.md for more information. // // ----------------------------------------------------------------------- diff --git a/Tests/Perspex.Styling.UnitTests/SelectorTests_Name.cs b/Tests/Perspex.Styling.UnitTests/SelectorTests_Name.cs index e7921863b6..844a6e681a 100644 --- a/Tests/Perspex.Styling.UnitTests/SelectorTests_Name.cs +++ b/Tests/Perspex.Styling.UnitTests/SelectorTests_Name.cs @@ -1,5 +1,5 @@ // ----------------------------------------------------------------------- -// +// // Copyright 2014 MIT Licence. See licence.md for more information. // // ----------------------------------------------------------------------- diff --git a/Tests/Perspex.Styling.UnitTests/SelectorTests_OfType.cs b/Tests/Perspex.Styling.UnitTests/SelectorTests_OfType.cs index 1940556c48..a7b6e09685 100644 --- a/Tests/Perspex.Styling.UnitTests/SelectorTests_OfType.cs +++ b/Tests/Perspex.Styling.UnitTests/SelectorTests_OfType.cs @@ -1,5 +1,5 @@ // ----------------------------------------------------------------------- -// +// // Copyright 2014 MIT Licence. See licence.md for more information. // // ----------------------------------------------------------------------- diff --git a/Tests/Perspex.Styling.UnitTests/SelectorTests_PropertyEquals.cs b/Tests/Perspex.Styling.UnitTests/SelectorTests_PropertyEquals.cs index e81e36e1cd..96f696513d 100644 --- a/Tests/Perspex.Styling.UnitTests/SelectorTests_PropertyEquals.cs +++ b/Tests/Perspex.Styling.UnitTests/SelectorTests_PropertyEquals.cs @@ -1,5 +1,5 @@ // ----------------------------------------------------------------------- -// +// // Copyright 2014 MIT Licence. See licence.md for more information. // // ----------------------------------------------------------------------- diff --git a/Tests/Perspex.Styling.UnitTests/SelectorTests_Template.cs b/Tests/Perspex.Styling.UnitTests/SelectorTests_Template.cs index bc2058b0a1..ec6c92c402 100644 --- a/Tests/Perspex.Styling.UnitTests/SelectorTests_Template.cs +++ b/Tests/Perspex.Styling.UnitTests/SelectorTests_Template.cs @@ -1,5 +1,5 @@ // ----------------------------------------------------------------------- -// +// // Copyright 2014 MIT Licence. See licence.md for more information. // // ----------------------------------------------------------------------- diff --git a/Tests/Perspex.Styling.UnitTests/StyleActivatorTests.cs b/Tests/Perspex.Styling.UnitTests/StyleActivatorTests.cs index 9b9cf7c59e..7f96c0d73a 100644 --- a/Tests/Perspex.Styling.UnitTests/StyleActivatorTests.cs +++ b/Tests/Perspex.Styling.UnitTests/StyleActivatorTests.cs @@ -29,8 +29,8 @@ [Fact] public void Activator_And_Should_AND_Multiple_Inputs() { - var inputs = new[] - { + var inputs = new[] + { new TestSubject(false), new TestSubject(false), new TestSubject(true), @@ -54,8 +54,8 @@ [Fact] public void Activator_And_Should_Unsubscribe_All_When_Input_Completes_On_False() { - var inputs = new[] - { + var inputs = new[] + { new TestSubject(false), new TestSubject(false), new TestSubject(true), @@ -80,8 +80,8 @@ [Fact] public void Activator_And_Should_Not_Unsubscribe_All_When_Input_Completes_On_True() { - var inputs = new[] - { + var inputs = new[] + { new TestSubject(false), new TestSubject(false), new TestSubject(true), @@ -121,8 +121,8 @@ [Fact] public void Activator_Or_Should_OR_Multiple_Inputs() { - var inputs = new[] - { + var inputs = new[] + { new TestSubject(false), new TestSubject(false), new TestSubject(true), @@ -145,8 +145,8 @@ [Fact] public void Activator_Or_Should_Unsubscribe_All_When_Input_Completes_On_True() { - var inputs = new[] - { + var inputs = new[] + { new TestSubject(false), new TestSubject(false), new TestSubject(true), @@ -170,8 +170,8 @@ [Fact] public void Activator_Or_Should_Not_Unsubscribe_All_When_Input_Completes_On_False() { - var inputs = new[] - { + var inputs = new[] + { new TestSubject(false), new TestSubject(false), new TestSubject(true), diff --git a/Tests/Perspex.Styling.UnitTests/TestControlBase.cs b/Tests/Perspex.Styling.UnitTests/TestControlBase.cs index f71e1ef5bc..5bec5bb5c0 100644 --- a/Tests/Perspex.Styling.UnitTests/TestControlBase.cs +++ b/Tests/Perspex.Styling.UnitTests/TestControlBase.cs @@ -1,5 +1,5 @@ // ----------------------------------------------------------------------- -// +// // Copyright 2014 MIT Licence. See licence.md for more information. // // ----------------------------------------------------------------------- diff --git a/Tests/Perspex.Styling.UnitTests/TestObservable.cs b/Tests/Perspex.Styling.UnitTests/TestObservable.cs index 807c857321..88fb350f9e 100644 --- a/Tests/Perspex.Styling.UnitTests/TestObservable.cs +++ b/Tests/Perspex.Styling.UnitTests/TestObservable.cs @@ -1,5 +1,5 @@ // ----------------------------------------------------------------------- -// +// // Copyright 2014 MIT Licence. See licence.md for more information. // // ----------------------------------------------------------------------- diff --git a/Tests/Perspex.Styling.UnitTests/TestObserver.cs b/Tests/Perspex.Styling.UnitTests/TestObserver.cs index 4e8817f0ca..adbe92af7b 100644 --- a/Tests/Perspex.Styling.UnitTests/TestObserver.cs +++ b/Tests/Perspex.Styling.UnitTests/TestObserver.cs @@ -36,7 +36,7 @@ namespace Perspex.Styling.UnitTests } this.hasValue = false; - return value; + return this.value; } public void OnCompleted() diff --git a/Tests/Perspex.Styling.UnitTests/TestSelectors.cs b/Tests/Perspex.Styling.UnitTests/TestSelectors.cs index 44542609c3..6d7bce8f29 100644 --- a/Tests/Perspex.Styling.UnitTests/TestSelectors.cs +++ b/Tests/Perspex.Styling.UnitTests/TestSelectors.cs @@ -1,5 +1,5 @@ // ----------------------------------------------------------------------- -// +// // Copyright 2014 MIT Licence. See licence.md for more information. // // ----------------------------------------------------------------------- diff --git a/Tests/Perspex.Styling.UnitTests/TestSubject.cs b/Tests/Perspex.Styling.UnitTests/TestSubject.cs index d9356072db..5edc4d620c 100644 --- a/Tests/Perspex.Styling.UnitTests/TestSubject.cs +++ b/Tests/Perspex.Styling.UnitTests/TestSubject.cs @@ -53,7 +53,7 @@ namespace Perspex.Styling.UnitTests public IDisposable Subscribe(IObserver observer) { this.subscribers.Add(observer); - observer.OnNext(initial); + observer.OnNext(this.initial); return Disposable.Create(() => this.subscribers.Remove(observer)); } } diff --git a/Tests/Perspex.Styling.UnitTests/TestTemplatedControl.cs b/Tests/Perspex.Styling.UnitTests/TestTemplatedControl.cs index fcd5d9df6a..a8b6d8c7c5 100644 --- a/Tests/Perspex.Styling.UnitTests/TestTemplatedControl.cs +++ b/Tests/Perspex.Styling.UnitTests/TestTemplatedControl.cs @@ -1,5 +1,5 @@ // ----------------------------------------------------------------------- -// +// // Copyright 2014 MIT Licence. See licence.md for more information. // // ----------------------------------------------------------------------- diff --git a/Windows/Perspex.Direct2D1/Direct2D1Platform.cs b/Windows/Perspex.Direct2D1/Direct2D1Platform.cs index 1abeb40d45..8a385d9ed7 100644 --- a/Windows/Perspex.Direct2D1/Direct2D1Platform.cs +++ b/Windows/Perspex.Direct2D1/Direct2D1Platform.cs @@ -38,9 +38,9 @@ namespace Perspex.Direct2D1 } public IFormattedTextImpl CreateFormattedText( - string text, - string fontFamily, - double fontSize, + string text, + string fontFamily, + double fontSize, FontStyle fontStyle, TextAlignment textAlignment, FontWeight fontWeight) diff --git a/Windows/Perspex.Direct2D1/GlobalSuppressions.cs b/Windows/Perspex.Direct2D1/GlobalSuppressions.cs new file mode 100644 index 0000000000..3d080850f1 --- /dev/null +++ b/Windows/Perspex.Direct2D1/GlobalSuppressions.cs @@ -0,0 +1,14 @@ +// ----------------------------------------------------------------------- +// +// Copyright 2015 MIT Licence. See licence.md for more information. +// +// ----------------------------------------------------------------------- + +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage( + "StyleCop.CSharp.MaintainabilityRules", + "SA1401:Fields must be private", + Justification = "PerspexProperty fields should not be private.")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage( + "StyleCop.CSharp.DocumentationRules", + "SA1609:Property documentation must have value", + Justification = "This rule is fscking pointless")] \ No newline at end of file diff --git a/Windows/Perspex.Direct2D1/Media/DrawingContext.cs b/Windows/Perspex.Direct2D1/Media/DrawingContext.cs index b5d922cc5e..fce32ace29 100644 --- a/Windows/Perspex.Direct2D1/Media/DrawingContext.cs +++ b/Windows/Perspex.Direct2D1/Media/DrawingContext.cs @@ -43,10 +43,13 @@ namespace Perspex.Direct2D1.Media this.renderTarget.BeginDraw(); } + /// + /// Gets the current transform of the drawing context. + /// public Matrix CurrentTransform { get { return this.renderTarget.Transform.ToPerspex(); } - set { this.renderTarget.Transform = value.ToDirect2D(); } + private set { this.renderTarget.Transform = value.ToDirect2D(); } } /// @@ -57,9 +60,16 @@ namespace Perspex.Direct2D1.Media this.renderTarget.EndDraw(); } - public void DrawImage(IBitmap bitmap, double opacity, Rect sourceRect, Rect destRect) + /// + /// Draws a bitmap image. + /// + /// The bitmap image. + /// The opacity to draw with. + /// The rect in the image to draw. + /// The rect in the output to draw to. + public void DrawImage(IBitmap source, double opacity, Rect sourceRect, Rect destRect) { - BitmapImpl impl = (BitmapImpl)bitmap.PlatformImpl; + BitmapImpl impl = (BitmapImpl)source.PlatformImpl; Bitmap d2d = impl.GetDirect2DBitmap(this.renderTarget); this.renderTarget.DrawBitmap( d2d, @@ -74,7 +84,7 @@ namespace Perspex.Direct2D1.Media /// /// The stroke pen. /// The first point of the line. - /// The second point of the line. + /// The second point of the line. public void DrawLine(Pen pen, Perspex.Point p1, Perspex.Point p2) { if (pen != null) @@ -125,6 +135,7 @@ namespace Perspex.Direct2D1.Media /// /// The pen. /// The rectangle bounds. + /// The corner radius. public void DrawRectange(Pen pen, Rect rect, float cornerRadius) { using (var brush = pen.Brush.ToDirect2D(this.renderTarget)) @@ -162,6 +173,7 @@ namespace Perspex.Direct2D1.Media /// /// The brush. /// The rectangle bounds. + /// The corner radius. public void FillRectange(Perspex.Media.Brush brush, Rect rect, float cornerRadius) { using (var b = brush.ToDirect2D(this.renderTarget)) diff --git a/Windows/Perspex.Direct2D1/Media/FormattedTextImpl.cs b/Windows/Perspex.Direct2D1/Media/FormattedTextImpl.cs index b51cb627ea..ff96956e49 100644 --- a/Windows/Perspex.Direct2D1/Media/FormattedTextImpl.cs +++ b/Windows/Perspex.Direct2D1/Media/FormattedTextImpl.cs @@ -99,9 +99,9 @@ namespace Perspex.Direct2D1.Media float y; var result = this.TextLayout.HitTestTextPosition( - index, - false, - out x, + index, + false, + out x, out y); return new Rect(result.Left, result.Top, result.Width, result.Height); @@ -110,9 +110,9 @@ namespace Perspex.Direct2D1.Media public IEnumerable HitTestTextRange(int index, int length, Point origin) { var result = this.TextLayout.HitTestTextRange( - index, - length, - (float)origin.X, + index, + length, + (float)origin.X, (float)origin.Y); return result.Select(x => new Rect(x.Left, x.Top, x.Width, x.Height)); diff --git a/Windows/Perspex.Direct2D1/Media/GeometryImpl.cs b/Windows/Perspex.Direct2D1/Media/GeometryImpl.cs index 4fd2584e67..f93911d553 100644 --- a/Windows/Perspex.Direct2D1/Media/GeometryImpl.cs +++ b/Windows/Perspex.Direct2D1/Media/GeometryImpl.cs @@ -52,8 +52,8 @@ namespace Perspex.Direct2D1.Media { Factory factory = Locator.Current.GetService(); this.transformed = new TransformedGeometry( - factory, - this.DefiningGeometry, + factory, + this.DefiningGeometry, value.ToDirect2D()); } } diff --git a/Windows/Perspex.Direct2D1/Media/Imaging/BitmapImpl.cs b/Windows/Perspex.Direct2D1/Media/Imaging/BitmapImpl.cs index 7fedd1fab3..af09444545 100644 --- a/Windows/Perspex.Direct2D1/Media/Imaging/BitmapImpl.cs +++ b/Windows/Perspex.Direct2D1/Media/Imaging/BitmapImpl.cs @@ -32,9 +32,9 @@ namespace Perspex.Direct2D1.Media this.factory = factory; this.WicImpl = new Bitmap( factory, - width, - height, - PixelFormat.Format32bppPBGRA, + width, + height, + PixelFormat.Format32bppPBGRA, BitmapCreateCacheOption.CacheOnLoad); } diff --git a/Windows/Perspex.Direct2D1/Media/Imaging/RenderTargetBitmapImpl.cs b/Windows/Perspex.Direct2D1/Media/Imaging/RenderTargetBitmapImpl.cs index 16476a213c..f72c840b9b 100644 --- a/Windows/Perspex.Direct2D1/Media/Imaging/RenderTargetBitmapImpl.cs +++ b/Windows/Perspex.Direct2D1/Media/Imaging/RenderTargetBitmapImpl.cs @@ -16,20 +16,22 @@ namespace Perspex.Direct2D1.Media private WicRenderTarget target; public RenderTargetBitmapImpl( - ImagingFactory imagingFactory, + ImagingFactory imagingFactory, Factory d2dFactory, - int width, + int width, int height) : base(imagingFactory, width, height) { + var props = new RenderTargetProperties + { + DpiX = 96, + DpiY = 96, + }; + this.target = new WicRenderTarget( d2dFactory, this.WicImpl, - new RenderTargetProperties - { - DpiX = 96, - DpiY = 96, - }); + props); } public void Dispose() diff --git a/Windows/Perspex.Direct2D1/Media/PerspexTextRenderer.cs b/Windows/Perspex.Direct2D1/Media/PerspexTextRenderer.cs index f1f02cb1c3..3e6888fb64 100644 --- a/Windows/Perspex.Direct2D1/Media/PerspexTextRenderer.cs +++ b/Windows/Perspex.Direct2D1/Media/PerspexTextRenderer.cs @@ -37,17 +37,17 @@ namespace Perspex.Direct2D1.Media } public Result DrawGlyphRun( - object clientDrawingContext, - float baselineOriginX, - float baselineOriginY, - MeasuringMode measuringMode, - GlyphRun glyphRun, - GlyphRunDescription glyphRunDescription, + object clientDrawingContext, + float baselineOriginX, + float baselineOriginY, + MeasuringMode measuringMode, + GlyphRun glyphRun, + GlyphRunDescription glyphRunDescription, ComObject clientDrawingEffect) { var wrapper = clientDrawingEffect as BrushWrapper; - var brush = (wrapper == null) ? - this.foreground : + var brush = (wrapper == null) ? + this.foreground : wrapper.Brush.ToDirect2D(this.renderTarget); this.renderTarget.DrawGlyphRun( diff --git a/Windows/Perspex.Direct2D1/PrimitiveExtensions.cs b/Windows/Perspex.Direct2D1/PrimitiveExtensions.cs index 74b6609a2c..d28bd88cd6 100644 --- a/Windows/Perspex.Direct2D1/PrimitiveExtensions.cs +++ b/Windows/Perspex.Direct2D1/PrimitiveExtensions.cs @@ -38,6 +38,7 @@ namespace Perspex.Direct2D1 /// Converts a brush to Direct2D. /// /// The brush to convert. + /// The render target. /// The Direct2D brush. public static SharpDX.Direct2D1.Brush ToDirect2D(this Perspex.Media.Brush brush, RenderTarget target) { @@ -54,6 +55,12 @@ namespace Perspex.Direct2D1 } } + /// + /// Converts a pen to a Direct2D stroke style. + /// + /// The pen to convert. + /// The render target. + /// The Direct2D brush. public static StrokeStyle ToDirect2DStrokeStyle(this Perspex.Media.Pen pen, RenderTarget target) { if (pen.DashArray != null && pen.DashArray.Count > 0) @@ -104,7 +111,7 @@ namespace Perspex.Direct2D1 /// /// Converts a Direct2D to a Perspex . /// - /// + /// The matrix /// a . public static Perspex.Matrix ToPerspex(this Matrix3x2 matrix) { diff --git a/Windows/Perspex.Direct2D1/Properties/AssemblyInfo.cs b/Windows/Perspex.Direct2D1/Properties/AssemblyInfo.cs index b06e061b65..4f08391c0c 100644 --- a/Windows/Perspex.Direct2D1/Properties/AssemblyInfo.cs +++ b/Windows/Perspex.Direct2D1/Properties/AssemblyInfo.cs @@ -8,7 +8,7 @@ using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; -// General Information about an assembly is controlled through the following +// General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information // associated with an assembly. [assembly: AssemblyTitle("Perspex.Direct2D1")] @@ -20,8 +20,8 @@ using System.Runtime.InteropServices; [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] -// Setting ComVisible to false makes the types in this assembly not visible -// to COM components. If you need to access a type in this assembly from +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from // COM, set the ComVisible attribute to true on that type. [assembly: ComVisible(false)] @@ -31,11 +31,11 @@ using System.Runtime.InteropServices; // Version information for an assembly consists of the following four values: // // Major Version -// Minor Version +// Minor Version // Build Number // Revision // -// You can specify all the values or you can default the Build and Revision Numbers +// You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion("1.0.0.0")] diff --git a/Windows/Perspex.Win32/Interop/UnmanagedMethods.cs b/Windows/Perspex.Win32/Interop/UnmanagedMethods.cs index 8481b7affb..a8027513d8 100644 --- a/Windows/Perspex.Win32/Interop/UnmanagedMethods.cs +++ b/Windows/Perspex.Win32/Interop/UnmanagedMethods.cs @@ -14,6 +14,8 @@ namespace Perspex.Win32.Interop [SuppressMessage("Microsoft.StyleCop.CSharp.NamingRules", "SA1305:FieldNamesMustNotUseHungarianNotation", Justification = "Using Win32 naming for consistency.")] [SuppressMessage("Microsoft.StyleCop.CSharp.NamingRules", "SA1307:AccessibleFieldsMustBeginWithUpperCaseLetter", Justification = "Using Win32 naming for consistency.")] [SuppressMessage("Microsoft.StyleCop.CSharp.NamingRules", "SA1310:FieldNamesMustNotContainUnderscore", Justification = "Using Win32 naming for consistency.")] + [SuppressMessage("StyleCop.CSharp.DocumentationRules", "SA1600:Elements must be documented", Justification = "Look in Win32 docs.")] + [SuppressMessage("StyleCop.CSharp.DocumentationRules", "SA1602:Enumeration items must be documented", Justification = "Look in Win32 docs.")] internal static class UnmanagedMethods { public const int CW_USEDEFAULT = unchecked((int)0x80000000); @@ -222,33 +224,32 @@ namespace Perspex.Win32.Interop WS_TABSTOP = 0x10000, WS_VISIBLE = 0x10000000, WS_VSCROLL = 0x200000, - - WS_EX_DLGMODALFRAME = 0x00000001, - WS_EX_NOPARENTNOTIFY = 0x00000004, - WS_EX_TOPMOST = 0x00000008, - WS_EX_ACCEPTFILES = 0x00000010, - WS_EX_TRANSPARENT = 0x00000020, - WS_EX_MDICHILD = 0x00000040, - WS_EX_TOOLWINDOW = 0x00000080, - WS_EX_WINDOWEDGE = 0x00000100, - WS_EX_CLIENTEDGE = 0x00000200, - WS_EX_CONTEXTHELP = 0x00000400, - WS_EX_RIGHT = 0x00001000, - WS_EX_LEFT = 0x00000000, - WS_EX_RTLREADING = 0x00002000, - WS_EX_LTRREADING = 0x00000000, - WS_EX_LEFTSCROLLBAR = 0x00004000, - WS_EX_RIGHTSCROLLBAR = 0x00000000, - WS_EX_CONTROLPARENT = 0x00010000, - WS_EX_STATICEDGE = 0x00020000, - WS_EX_APPWINDOW = 0x00040000, - WS_EX_OVERLAPPEDWINDOW = (WS_EX_WINDOWEDGE | WS_EX_CLIENTEDGE), - WS_EX_PALETTEWINDOW = (WS_EX_WINDOWEDGE | WS_EX_TOOLWINDOW | WS_EX_TOPMOST), - WS_EX_LAYERED = 0x00080000, - WS_EX_NOINHERITLAYOUT = 0x00100000, - WS_EX_LAYOUTRTL = 0x00400000, - WS_EX_COMPOSITED = 0x02000000, - WS_EX_NOACTIVATE = 0x08000000 + WS_EX_DLGMODALFRAME = 0x00000001, + WS_EX_NOPARENTNOTIFY = 0x00000004, + WS_EX_TOPMOST = 0x00000008, + WS_EX_ACCEPTFILES = 0x00000010, + WS_EX_TRANSPARENT = 0x00000020, + WS_EX_MDICHILD = 0x00000040, + WS_EX_TOOLWINDOW = 0x00000080, + WS_EX_WINDOWEDGE = 0x00000100, + WS_EX_CLIENTEDGE = 0x00000200, + WS_EX_CONTEXTHELP = 0x00000400, + WS_EX_RIGHT = 0x00001000, + WS_EX_LEFT = 0x00000000, + WS_EX_RTLREADING = 0x00002000, + WS_EX_LTRREADING = 0x00000000, + WS_EX_LEFTSCROLLBAR = 0x00004000, + WS_EX_RIGHTSCROLLBAR = 0x00000000, + WS_EX_CONTROLPARENT = 0x00010000, + WS_EX_STATICEDGE = 0x00020000, + WS_EX_APPWINDOW = 0x00040000, + WS_EX_OVERLAPPEDWINDOW = WS_EX_WINDOWEDGE | WS_EX_CLIENTEDGE, + WS_EX_PALETTEWINDOW = WS_EX_WINDOWEDGE | WS_EX_TOOLWINDOW | WS_EX_TOPMOST, + WS_EX_LAYERED = 0x00080000, + WS_EX_NOINHERITLAYOUT = 0x00100000, + WS_EX_LAYOUTRTL = 0x00400000, + WS_EX_COMPOSITED = 0x02000000, + WS_EX_NOACTIVATE = 0x08000000 } public enum WindowsMessage : uint @@ -602,12 +603,12 @@ namespace Perspex.Win32.Interop [DllImport("user32.dll")] public static extern int ToUnicode( - uint virtualKeyCode, + uint virtualKeyCode, uint scanCode, byte[] keyboardState, [Out, MarshalAs(UnmanagedType.LPWStr, SizeConst = 64)] StringBuilder receivingBuffer, - int bufferSize, + int bufferSize, uint flags); [DllImport("user32.dll", SetLastError = true)] @@ -681,6 +682,6 @@ namespace Perspex.Win32.Interop public string lpszMenuName; public string lpszClassName; public IntPtr hIconSm; - } + } } } diff --git a/Windows/Perspex.Win32/PopupImpl.cs b/Windows/Perspex.Win32/PopupImpl.cs index 3674fb619a..5ec11e1c89 100644 --- a/Windows/Perspex.Win32/PopupImpl.cs +++ b/Windows/Perspex.Win32/PopupImpl.cs @@ -15,10 +15,10 @@ namespace Perspex.Win32 public void SetPosition(Point p) { UnmanagedMethods.SetWindowPos( - this.Handle.Handle, - IntPtr.Zero, - (int)p.X, - (int)p.Y, + this.Handle.Handle, + IntPtr.Zero, + (int)p.X, + (int)p.Y, 0, 0, UnmanagedMethods.SetWindowPosFlags.SWP_NOSIZE | UnmanagedMethods.SetWindowPosFlags.SWP_NOACTIVATE); diff --git a/Windows/Perspex.Win32/Properties/AssemblyInfo.cs b/Windows/Perspex.Win32/Properties/AssemblyInfo.cs index bb40ce91d3..db4f68b412 100644 --- a/Windows/Perspex.Win32/Properties/AssemblyInfo.cs +++ b/Windows/Perspex.Win32/Properties/AssemblyInfo.cs @@ -8,7 +8,7 @@ using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; -// General Information about an assembly is controlled through the following +// General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information // associated with an assembly. [assembly: AssemblyTitle("Perspex.Win32")] @@ -20,8 +20,8 @@ using System.Runtime.InteropServices; [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] -// Setting ComVisible to false makes the types in this assembly not visible -// to COM components. If you need to access a type in this assembly from +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from // COM, set the ComVisible attribute to true on that type. [assembly: ComVisible(false)] @@ -31,11 +31,11 @@ using System.Runtime.InteropServices; // Version information for an assembly consists of the following four values: // // Major Version -// Minor Version +// Minor Version // Build Number // Revision // -// You can specify all the values or you can default the Build and Revision Numbers +// You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion("1.0.0.0")] diff --git a/Windows/Perspex.Win32/Win32Platform.cs b/Windows/Perspex.Win32/Win32Platform.cs index 551e218b4c..6ae2a65940 100644 --- a/Windows/Perspex.Win32/Win32Platform.cs +++ b/Windows/Perspex.Win32/Win32Platform.cs @@ -75,8 +75,8 @@ namespace Perspex.Win32 public IDisposable StartTimer(TimeSpan interval, Action callback) { - UnmanagedMethods.TimerProc timerDelegate = (UnmanagedMethods.TimerProc) - ((hWnd, uMsg, nIDEvent, dwTime) => callback()); + UnmanagedMethods.TimerProc timerDelegate = + (hWnd, uMsg, nIDEvent, dwTime) => callback(); IntPtr handle = UnmanagedMethods.SetTimer( IntPtr.Zero, diff --git a/Windows/Perspex.Win32/WindowImpl.cs b/Windows/Perspex.Win32/WindowImpl.cs index 17a6b95c78..f4e8051590 100644 --- a/Windows/Perspex.Win32/WindowImpl.cs +++ b/Windows/Perspex.Win32/WindowImpl.cs @@ -6,11 +6,6 @@ namespace Perspex.Win32 { - using Perspex.Controls; - using Perspex.Input.Raw; - using Perspex.Platform; - using Perspex.Win32.Input; - using Perspex.Win32.Interop; using System; using System.Collections.Generic; using System.ComponentModel; @@ -19,6 +14,11 @@ namespace Perspex.Win32 using System.Reactive.Disposables; using System.Reactive.Linq; using System.Runtime.InteropServices; + using Perspex.Controls; + using Perspex.Input.Raw; + using Perspex.Platform; + using Perspex.Win32.Input; + using Perspex.Win32.Interop; public class WindowImpl : IWindowImpl { @@ -214,7 +214,7 @@ namespace Perspex.Win32 { case UnmanagedMethods.WindowsMessage.WM_ACTIVATE: var wa = (UnmanagedMethods.WindowActivate)((int)wParam & 0xffff); - + switch (wa) { case UnmanagedMethods.WindowActivate.WA_ACTIVE: