From 145411020b868f63bf4f2acd77d71011c7d67dec Mon Sep 17 00:00:00 2001 From: Steven Kirk Date: Tue, 8 Sep 2015 19:29:29 +0200 Subject: [PATCH] Ran .net core code formatter. --- Perspex.v2.ncrunchsolution | Bin 2006 -> 1836 bytes .../GridLengthTests.cs | 13 +- .../BinderTest.cs | 19 +- .../BindingDefinitionBuilder.cs | 32 +- .../ChangeBranchTest.cs | 19 +- .../DataContextChangeSynchronizerTest.cs | 73 +-- .../Properties/AssemblyInfo.cs | 5 +- .../PropertyMountPointTest.cs | 13 +- .../SampleModel/Level1.cs | 21 +- .../SampleModel/Level2.cs | 9 +- .../SampleModel/Level3.cs | 9 +- .../SampleModel/LogInViewModel.cs | 15 +- .../SampleModel/MainWindowViewModel.cs | 29 +- .../SampleModel/PropertyChangeNotifier.cs | 9 +- .../SampleModel/Repository.cs | 11 +- .../SampleModel/UserRepositoriesViewModel.cs | 23 +- .../SamplePerspexObject.cs | 3 + .../TypeProviderMock.cs | 35 +- .../ViewModelMock.cs | 19 +- .../XamlBindingTest.cs | 15 +- .../Media/BrushTests.cs | 13 +- .../Media/ColorTests.cs | 13 +- .../ThicknessTests.cs | 9 +- samples/TestApplication/App.cs | 13 +- samples/TestApplication/Program.cs | 31 +- .../Properties/AssemblyInfo.cs | 7 +- samples/XamlTestApplication/App.cs | 13 +- samples/XamlTestApplication/MainViewModel.cs | 25 +- samples/XamlTestApplication/Program.cs | 37 +- .../Properties/AssemblyInfo.cs | 7 +- .../XamlTestApplication/Views/MainWindow.cs | 25 +- src/Gtk/Perspex.Cairo/CairoExtensions.cs | 7 +- src/Gtk/Perspex.Cairo/CairoPlatform.cs | 29 +- src/Gtk/Perspex.Cairo/Media/DrawingContext.cs | 92 ++-- .../Perspex.Cairo/Media/FormattedTextImpl.cs | 35 +- .../Perspex.Cairo/Media/Imaging/BitmapImpl.cs | 10 +- .../Media/Imaging/RenderTargetBitmapImpl.cs | 10 +- .../Media/StreamGeometryContextImpl.cs | 44 +- .../Perspex.Cairo/Media/StreamGeometryImpl.cs | 40 +- .../Perspex.Cairo/Properties/AssemblyInfo.cs | 9 +- src/Gtk/Perspex.Cairo/Renderer.cs | 36 +- src/Gtk/Perspex.Gtk/AssetLoader.cs | 19 +- src/Gtk/Perspex.Gtk/ClipboardImpl.cs | 20 +- src/Gtk/Perspex.Gtk/CursorFactory.cs | 36 +- src/Gtk/Perspex.Gtk/GtkExtensions.cs | 7 +- src/Gtk/Perspex.Gtk/GtkPlatform.cs | 28 +- .../Perspex.Gtk/Input/GtkKeyboardDevice.cs | 33 +- src/Gtk/Perspex.Gtk/Input/GtkMouseDevice.cs | 19 +- src/Gtk/Perspex.Gtk/PopupImpl.cs | 18 +- .../Perspex.Gtk/Properties/AssemblyInfo.cs | 7 +- src/Gtk/Perspex.Gtk/WindowImpl.cs | 61 ++- .../Context/PerspexObjectAssembler.cs | 27 +- .../Context/PerspexParserFactory.cs | 27 +- .../Context/PerspexTypeRepository.cs | 27 +- .../Context/PerspexWiringContext.cs | 47 +- .../Context/PerspexXamlMember.cs | 19 +- .../Context/PerspexXamlMemberValuePlugin.cs | 37 +- .../Context/PerspexXamlType.cs | 23 +- .../Converters/BitmapConverter.cs | 15 +- .../Converters/BrushConverter.cs | 15 +- .../ColumnDefinitionsTypeConverter.cs | 15 +- .../Converters/GridLengthTypeConverter.cs | 15 +- .../Converters/RowDefinitionsTypeConverter.cs | 15 +- .../Converters/ThicknessConverter.cs | 13 +- .../ObservablePropertyBranch.cs | 47 +- .../ChangeTracking/PropertyMountPoint.cs | 23 +- .../ChangeTracking/PropertyPath.cs | 19 +- .../ChangeTracking/TargettedProperty.cs | 29 +- .../DataContextChangeSynchronizer.cs | 87 ++-- .../DataBinding/IPerspexPropertyBinder.cs | 9 +- .../DataBinding/PerspexPropertyBinder.cs | 31 +- .../DataBinding/SourceBindingEndpoint.cs | 11 +- .../DataBinding/TargetBindingEndpoint.cs | 7 +- .../DataBinding/XamlBinding.cs | 31 +- .../DataBinding/XamlBindingDefinition.cs | 35 +- .../MarkupExtensions/BindingExtension.cs | 17 +- .../MarkupExtensions/TypeExtension.cs | 17 +- .../Perspex.Markup.Xaml/PerspexXamlLoader.cs | 19 +- .../Properties/AssemblyInfo.cs | 7 +- .../Perspex.Markup.Xaml/Templates/Template.cs | 7 +- .../Templates/TemplateContent.cs | 27 +- .../Templates/TemplateLoader.cs | 11 +- .../Templates/XamlDataTemplate.cs | 15 +- src/NGenerics/Constants.cs | 5 +- .../Comparers/ComparisonComparer.cs | 74 +-- .../Comparers/KeyValuePairComparer.cs | 41 +- .../Comparers/ReverseComparer.cs | 29 +- src/NGenerics/DataStructures/General/Heap.cs | 139 +++--- .../DataStructures/General/HeapType.cs | 3 + src/NGenerics/DataStructures/General/IHeap.cs | 53 ++- src/NGenerics/DataStructures/Queues/IQueue.cs | 41 +- .../DataStructures/Queues/PriorityQueue.cs | 107 +++-- .../Queues/PriorityQueueType.cs | 3 + .../Trees/BinarySearchTreeBase.cs | 62 ++- .../DataStructures/Trees/BinaryTree.cs | 252 +++++----- .../DataStructures/Trees/ISearchTree.cs | 9 +- src/NGenerics/DataStructures/Trees/ITree.cs | 13 +- .../DataStructures/Trees/NodeColor.cs | 3 + .../DataStructures/Trees/RedBlackTree.cs | 120 +++-- .../Trees/RedBlackTreeDictionary.cs | 436 +++++++++--------- .../DataStructures/Trees/RedBlackTreeList.cs | 21 +- .../DataStructures/Trees/RedBlackTreeNode.cs | 53 ++- src/NGenerics/Patterns/Visitor/IVisitor.cs | 5 +- .../Patterns/Visitor/InOrderVisitor.cs | 5 +- .../Patterns/Visitor/KeyTrackingVisitor.cs | 11 +- .../Patterns/Visitor/OrderedVisitor.cs | 19 +- .../Patterns/Visitor/TrackingVisitor.cs | 14 +- .../Patterns/Visitor/ValueTrackingVisitor.cs | 11 +- src/NGenerics/Properties/AssemblyInfo.cs | 7 +- src/NGenerics/Util/Guard.cs | 3 + src/Perspex.Animation/Animatable.cs | 23 +- src/Perspex.Animation/Animate.cs | 21 +- src/Perspex.Animation/Animation.cs | 21 +- src/Perspex.Animation/AnimationExtensions.cs | 9 +- src/Perspex.Animation/Animation`1.cs | 21 +- src/Perspex.Animation/IEasing.cs | 7 +- src/Perspex.Animation/IEasing`1.cs | 7 +- src/Perspex.Animation/LinearDoubleEasing.cs | 7 +- src/Perspex.Animation/LinearEasing.cs | 9 +- .../Properties/AssemblyInfo.cs | 7 +- src/Perspex.Animation/PropertyTransition.cs | 9 +- src/Perspex.Animation/PropertyTransitions.cs | 9 +- src/Perspex.Application/Application.cs | 53 +-- .../Platform/IAssetLoader.cs | 11 +- .../Properties/AssemblyInfo.cs | 7 +- src/Perspex.Base/BindingDescriptor.cs | 11 +- src/Perspex.Base/Collections/IPerspexList.cs | 9 +- .../Collections/IPerspexReadOnlyList.cs | 13 +- .../Collections/PerspexDictionary.cs | 55 ++- src/Perspex.Base/Collections/PerspexList.cs | 71 ++- .../Collections/PerspexListExtensions.cs | 17 +- src/Perspex.Base/Contract.cs | 7 +- .../Diagnostics/PerspexObjectExtensions.cs | 4 +- .../Diagnostics/PerspexPropertyValue.cs | 4 +- src/Perspex.Base/IDescription.cs | 7 +- src/Perspex.Base/IObservablePropertyBag.cs | 9 +- src/Perspex.Base/IPropertyBag.cs | 7 +- src/Perspex.Base/PerspexObject.cs | 101 ++-- src/Perspex.Base/PerspexObjectExtensions.cs | 11 +- src/Perspex.Base/PerspexProperty.cs | 51 +- .../PerspexPropertyChangedEventArgs.cs | 7 +- src/Perspex.Base/PerspexProperty`1.cs | 9 +- src/Perspex.Base/Platform/IPlatformHandle.cs | 9 +- .../Platform/IPlatformThreadingInterface.cs | 9 +- src/Perspex.Base/Platform/PlatformHandle.cs | 9 +- src/Perspex.Base/PriorityBindingEntry.cs | 19 +- src/Perspex.Base/PriorityLevel.cs | 43 +- src/Perspex.Base/PriorityValue.cs | 71 ++- src/Perspex.Base/Properties/AssemblyInfo.cs | 7 +- .../Reactive/PerspexObservable.cs | 19 +- src/Perspex.Base/Threading/Dispatcher.cs | 29 +- .../Threading/DispatcherPriority.cs | 7 +- src/Perspex.Base/Threading/DispatcherTimer.cs | 45 +- src/Perspex.Base/Threading/MainLoop.cs | 43 +- .../Threading/PerspexScheduler.cs | 11 +- .../PerspexSynchronizationContext.cs | 18 +- src/Perspex.Base/Utilities/MathUtilities.cs | 15 +- src/Perspex.Base/Utilities/TypeUtilities.cs | 19 +- src/Perspex.Controls/Border.cs | 9 +- src/Perspex.Controls/Button.cs | 21 +- src/Perspex.Controls/CheckBox.cs | 9 +- src/Perspex.Controls/ColumnDefinition.cs | 7 +- src/Perspex.Controls/ColumnDefinitions.cs | 11 +- src/Perspex.Controls/ContentControl.cs | 19 +- src/Perspex.Controls/Control.cs | 101 ++-- src/Perspex.Controls/ControlExtensions.cs | 13 +- src/Perspex.Controls/Controls.cs | 11 +- src/Perspex.Controls/Deck.cs | 21 +- src/Perspex.Controls/Decorator.cs | 9 +- src/Perspex.Controls/DefinitionBase.cs | 7 +- src/Perspex.Controls/DropDown.cs | 39 +- .../Generators/IItemContainerGenerator.cs | 15 +- .../Generators/ITreeItemContainerGenerator.cs | 9 +- .../Generators/ItemContainerGenerator.cs | 43 +- .../Generators/ItemContainerGenerator`1.cs | 9 +- .../Generators/ItemContainers.cs | 9 +- .../Generators/TreeItemContainerGenerator.cs | 41 +- src/Perspex.Controls/Grid.cs | 189 ++++---- src/Perspex.Controls/GridLength.cs | 37 +- src/Perspex.Controls/GridSplitter.cs | 27 +- src/Perspex.Controls/IContentControl.cs | 8 +- src/Perspex.Controls/IControl.cs | 15 +- src/Perspex.Controls/IGlobalDataTemplates.cs | 9 +- src/Perspex.Controls/IHeadered.cs | 7 +- src/Perspex.Controls/IPanel.cs | 7 +- src/Perspex.Controls/IReparentingControl.cs | 9 +- src/Perspex.Controls/IReparentingHost.cs | 9 +- src/Perspex.Controls/ISelectable.cs | 9 +- src/Perspex.Controls/ISetLogicalParent.cs | 7 +- src/Perspex.Controls/Image.cs | 13 +- src/Perspex.Controls/ItemsControl.cs | 47 +- src/Perspex.Controls/ListBox.cs | 11 +- src/Perspex.Controls/ListBoxItem.cs | 9 +- src/Perspex.Controls/Menu.cs | 37 +- src/Perspex.Controls/MenuItem.cs | 63 ++- .../MenuItemAccessKeyHandler.cs | 39 +- .../Mixins/SelectableMixin.cs | 13 +- src/Perspex.Controls/Panel.cs | 37 +- src/Perspex.Controls/PlacementMode.cs | 7 +- src/Perspex.Controls/Platform/IPopupImpl.cs | 13 +- .../Platform/ITopLevelImpl.cs | 15 +- src/Perspex.Controls/Platform/IWindowImpl.cs | 9 +- .../Presenters/ContentPresenter.cs | 19 +- .../Presenters/DeckPresenter.cs | 47 +- .../Presenters/IContentPresenter.cs | 9 +- .../Presenters/IItemsPresenter.cs | 7 +- src/Perspex.Controls/Presenters/IPresenter.cs | 11 +- .../Presenters/ItemsPresenter.cs | 43 +- .../Presenters/ScrollContentPresenter.cs | 23 +- .../Presenters/TextPresenter.cs | 51 +- src/Perspex.Controls/Primitives/AccessText.cs | 33 +- .../Primitives/AdornerDecorator.cs | 7 +- .../Primitives/AdornerLayer.cs | 29 +- .../Primitives/HeaderedContentControl.cs | 7 +- .../Primitives/HeaderedItemsControl.cs | 7 +- .../Primitives/IScrollInfo.cs | 6 +- src/Perspex.Controls/Primitives/Popup.cs | 57 ++- src/Perspex.Controls/Primitives/PopupRoot.cs | 33 +- src/Perspex.Controls/Primitives/RangeBase.cs | 11 +- src/Perspex.Controls/Primitives/ScrollBar.cs | 13 +- .../Primitives/ScrollBarVisibility.cs | 7 +- .../Primitives/ScrollInfoAdapter.cs | 82 ++-- .../Primitives/SelectingItemsControl.cs | 27 +- src/Perspex.Controls/Primitives/TabStrip.cs | 15 +- .../Primitives/TemplatedControl.cs | 41 +- src/Perspex.Controls/Primitives/Thumb.cs | 27 +- .../Primitives/ToggleButton.cs | 11 +- src/Perspex.Controls/Primitives/Track.cs | 13 +- src/Perspex.Controls/ProgressBar.cs | 19 +- .../Properties/AssemblyInfo.cs | 7 +- src/Perspex.Controls/RadioButton.cs | 15 +- .../RequestBringIntoViewEventArgs.cs | 9 +- src/Perspex.Controls/RowDefinition.cs | 7 +- src/Perspex.Controls/RowDefinitions.cs | 11 +- src/Perspex.Controls/ScrollViewer.cs | 15 +- src/Perspex.Controls/Shapes/Ellipse.cs | 21 +- src/Perspex.Controls/Shapes/Path.cs | 11 +- src/Perspex.Controls/Shapes/Rectangle.cs | 21 +- src/Perspex.Controls/Shapes/Shape.cs | 33 +- src/Perspex.Controls/StackPanel.cs | 11 +- src/Perspex.Controls/TabControl.cs | 13 +- src/Perspex.Controls/TabItem.cs | 11 +- .../Templates/ControlTemplate.cs | 13 +- .../Templates/ControlTemplate`2.cs | 13 +- .../Templates/DataTemplate.cs | 17 +- .../Templates/DataTemplateExtensions.cs | 13 +- .../Templates/DataTemplate`1.cs | 9 +- .../Templates/DataTemplates.cs | 9 +- .../Templates/FuncTemplate`1.cs | 15 +- .../Templates/FuncTemplate`2.cs | 15 +- .../Templates/IControlTemplate.cs | 11 +- .../Templates/IDataTemplate.cs | 7 +- src/Perspex.Controls/Templates/ITemplate`1.cs | 7 +- src/Perspex.Controls/Templates/ITemplate`2.cs | 7 +- .../Templates/ITreeDataTemplate.cs | 9 +- .../Templates/TemplateExtensions.cs | 19 +- .../Templates/TreeDataTemplate.cs | 27 +- .../Templates/TreeDataTemplate`1.cs | 11 +- src/Perspex.Controls/TextBlock.cs | 33 +- src/Perspex.Controls/TextBox.cs | 74 ++- src/Perspex.Controls/TextWrapping.cs | 7 +- src/Perspex.Controls/ToolTip.cs | 53 +-- src/Perspex.Controls/TopLevel.cs | 91 ++-- src/Perspex.Controls/TreeView.cs | 21 +- src/Perspex.Controls/TreeViewItem.cs | 43 +- src/Perspex.Controls/UserControl.cs | 11 +- .../Utils/IEnumerableUtils.cs | 15 +- src/Perspex.Controls/Utils/StringUtils.cs | 9 +- src/Perspex.Controls/Window.cs | 33 +- src/Perspex.Diagnostics/Debug.cs | 19 +- src/Perspex.Diagnostics/DevTools.cs | 37 +- src/Perspex.Diagnostics/LogManager.cs | 21 +- .../Properties/AssemblyInfo.cs | 7 +- src/Perspex.Diagnostics/ViewLocator.cs | 13 +- .../ViewModels/ControlDetailsViewModel.cs | 15 +- .../ViewModels/DevToolsViewModel.cs | 51 +- .../ViewModels/LogicalTreeNode.cs | 13 +- .../ViewModels/LogicalTreeViewModel.cs | 25 +- .../ViewModels/PropertyDetails.cs | 29 +- .../ViewModels/TreeNode.cs | 23 +- .../ViewModels/VisualTreeNode.cs | 13 +- .../ViewModels/VisualTreeViewModel.cs | 25 +- .../Views/ControlDetailsView.cs | 27 +- src/Perspex.Diagnostics/Views/GridRepeater.cs | 15 +- .../Views/LogicalTreeView.cs | 25 +- src/Perspex.Diagnostics/Views/TreePage.cs | 31 +- .../Views/VisualTreeView.cs | 27 +- src/Perspex.Input/AccessKeyHandler.cs | 67 ++- src/Perspex.Input/Cursors.cs | 24 +- src/Perspex.Input/FocusManager.cs | 29 +- src/Perspex.Input/FocusNavigationDirection.cs | 7 +- src/Perspex.Input/GotFocusEventArgs.cs | 9 +- src/Perspex.Input/IAccessKeyHandler.cs | 7 +- src/Perspex.Input/ICloseable.cs | 9 +- src/Perspex.Input/IFocusManager.cs | 7 +- src/Perspex.Input/IFocusScope.cs | 7 +- src/Perspex.Input/IInputDevice.cs | 7 +- src/Perspex.Input/IInputElement.cs | 12 +- src/Perspex.Input/IInputManager.cs | 13 +- src/Perspex.Input/IInputRoot.cs | 7 +- src/Perspex.Input/IKeyboardDevice.cs | 11 +- .../IKeyboardNavigationHandler.cs | 7 +- src/Perspex.Input/IMainMenu.cs | 7 +- src/Perspex.Input/IMouseDevice.cs | 7 +- src/Perspex.Input/INavigableContainer.cs | 7 +- src/Perspex.Input/IPointerDevice.cs | 11 +- src/Perspex.Input/InputElement.cs | 17 +- src/Perspex.Input/InputExtensions.cs | 13 +- src/Perspex.Input/InputManager.cs | 31 +- src/Perspex.Input/Key.cs | 7 +- src/Perspex.Input/KeyEventArgs.cs | 11 +- src/Perspex.Input/KeyboardDevice.cs | 33 +- src/Perspex.Input/KeyboardNavigation.cs | 7 +- .../KeyboardNavigationHandler.cs | 19 +- src/Perspex.Input/KeyboardNavigationMode.cs | 7 +- src/Perspex.Input/MouseDevice.cs | 61 ++- .../Navigation/DirectionalNavigation.cs | 15 +- .../Navigation/FocusExtensions.cs | 7 +- src/Perspex.Input/Navigation/TabNavigation.cs | 15 +- src/Perspex.Input/NavigationMethod.cs | 7 +- src/Perspex.Input/Platform/IClipboard.cs | 17 +- .../Platform/IPlatformSettings.cs | 9 +- .../Platform/IStandardCursorFactory.cs | 19 +- src/Perspex.Input/PointerEventArgs.cs | 11 +- src/Perspex.Input/PointerPressEventArgs.cs | 7 +- src/Perspex.Input/PointerWheelEventArgs.cs | 7 +- src/Perspex.Input/Properties/AssemblyInfo.cs | 7 +- src/Perspex.Input/Raw/RawInputEventArgs.cs | 9 +- src/Perspex.Input/Raw/RawKeyEventArgs.cs | 9 +- src/Perspex.Input/Raw/RawMouseEventArgs.cs | 9 +- .../Raw/RawMouseWheelEventArgs.cs | 11 +- src/Perspex.Input/Raw/RawSizeEventArgs.cs | 9 +- .../Raw/RawTextInputEventArgs.cs | 6 +- src/Perspex.Input/TextInputEventArgs.cs | 5 +- src/Perspex.Input/VectorEventArgs.cs | 11 +- .../EventSubscription.cs | 9 +- src/Perspex.Interactivity/IInteractive.cs | 9 +- src/Perspex.Interactivity/Interactive.cs | 35 +- .../InteractiveExtensions.cs | 11 +- .../Properties/AssemblyInfo.cs | 7 +- src/Perspex.Interactivity/RoutedEvent.cs | 21 +- src/Perspex.Interactivity/RoutedEventArgs.cs | 9 +- src/Perspex.Layout/ILayoutManager.cs | 11 +- src/Perspex.Layout/ILayoutRoot.cs | 7 +- src/Perspex.Layout/ILayoutable.cs | 9 +- src/Perspex.Layout/LayoutHelper.cs | 9 +- src/Perspex.Layout/LayoutManager.cs | 99 ++-- src/Perspex.Layout/Layoutable.cs | 51 +- src/Perspex.Layout/Properties/AssemblyInfo.cs | 7 +- .../Properties/AssemblyInfo.cs | 7 +- src/Perspex.ReactiveUI/Registrations.cs | 3 + src/Perspex.SceneGraph/Animation/CrossFade.cs | 15 +- .../Animation/IPageTransition.cs | 9 +- src/Perspex.SceneGraph/Animation/PageSlide.cs | 17 +- src/Perspex.SceneGraph/IVisual.cs | 13 +- src/Perspex.SceneGraph/Matrix.cs | 77 ++-- src/Perspex.SceneGraph/Media/AlignmentX.cs | 7 +- src/Perspex.SceneGraph/Media/AlignmentY.cs | 7 +- src/Perspex.SceneGraph/Media/Brush.cs | 13 +- .../Media/BrushMappingMode.cs | 17 +- src/Perspex.SceneGraph/Media/Brushes.cs | 7 +- src/Perspex.SceneGraph/Media/Color.cs | 15 +- src/Perspex.SceneGraph/Media/Colors.cs | 7 +- .../Media/EllipseGeometry.cs | 13 +- src/Perspex.SceneGraph/Media/FontStyle.cs | 7 +- src/Perspex.SceneGraph/Media/FontWeight.cs | 7 +- src/Perspex.SceneGraph/Media/FormattedText.cs | 15 +- .../Media/FormattedTextLine.cs | 7 +- src/Perspex.SceneGraph/Media/Geometry.cs | 11 +- src/Perspex.SceneGraph/Media/GradientBrush.cs | 9 +- .../Media/GradientSpreadMethod.cs | 17 +- src/Perspex.SceneGraph/Media/GradientStop.cs | 5 +- .../Media/IDrawingContext.cs | 11 +- .../Media/Imaging/Bitmap.cs | 11 +- .../Media/Imaging/IBitmap.cs | 9 +- .../Media/Imaging/RenderTargetBitmap.cs | 13 +- .../Media/LinearGradientBrush.cs | 7 +- .../Media/MatrixTransform.cs | 9 +- .../Media/MediaExtensions.cs | 9 +- .../Media/PathMarkupParser.cs | 53 +-- src/Perspex.SceneGraph/Media/Pen.cs | 9 +- .../Media/RectangleGeometry.cs | 11 +- .../Media/RotateTransform.cs | 9 +- .../Media/SolidColorBrush.cs | 7 +- .../Media/StreamGeometry.cs | 11 +- .../Media/StreamGeometryContext.cs | 27 +- src/Perspex.SceneGraph/Media/Stretch.cs | 7 +- .../Media/SweepDirection.cs | 7 +- src/Perspex.SceneGraph/Media/TextAlignment.cs | 7 +- .../Media/TextHitTestResult.cs | 7 +- src/Perspex.SceneGraph/Media/TileBrush.cs | 7 +- src/Perspex.SceneGraph/Media/Transform.cs | 11 +- .../Media/TranslateTransform.cs | 9 +- src/Perspex.SceneGraph/Media/VisualBrush.cs | 7 +- src/Perspex.SceneGraph/Origin.cs | 25 +- .../Platform/IBitmapImpl.cs | 7 +- .../Platform/IFormattedTextImpl.cs | 13 +- .../Platform/IGeometryImpl.cs | 7 +- .../Platform/IPlatformRenderInterface.cs | 9 +- .../Platform/IRenderTargetBitmapImpl.cs | 9 +- src/Perspex.SceneGraph/Platform/IRenderer.cs | 9 +- .../Platform/IStreamGeometryContextImpl.cs | 11 +- .../Platform/IStreamGeometryImpl.cs | 7 +- src/Perspex.SceneGraph/Point.cs | 43 +- .../Properties/AssemblyInfo.cs | 7 +- src/Perspex.SceneGraph/Rect.cs | 121 +++-- src/Perspex.SceneGraph/RelativeRect.cs | 7 +- .../Rendering/IRenderManager.cs | 11 +- .../Rendering/IRenderRoot.cs | 9 +- .../Rendering/RenderManager.cs | 29 +- .../Rendering/RendererBase.cs | 15 +- src/Perspex.SceneGraph/Size.cs | 47 +- src/Perspex.SceneGraph/Thickness.cs | 43 +- src/Perspex.SceneGraph/Vector.cs | 37 +- src/Perspex.SceneGraph/Visual.cs | 89 ++-- .../VisualTree/BoundsTracker.cs | 15 +- .../VisualTree/IHostedVisualTreeRoot.cs | 7 +- .../VisualTree/IVisualTreeHost.cs | 7 +- .../VisualTree/TransformedBounds.cs | 9 +- .../VisualTree/VisualExtensions.cs | 13 +- src/Perspex.Styling/ILogical.cs | 11 +- .../LogicalTree/LogicalExtensions.cs | 13 +- .../Properties/AssemblyInfo.cs | 7 +- src/Perspex.Styling/Styling/Classes.cs | 71 ++- src/Perspex.Styling/Styling/IGlobalStyles.cs | 7 +- src/Perspex.Styling/Styling/INamed.cs | 7 +- src/Perspex.Styling/Styling/ISetter.cs | 9 +- src/Perspex.Styling/Styling/IStyle.cs | 7 +- src/Perspex.Styling/Styling/IStyleHost.cs | 7 +- src/Perspex.Styling/Styling/IStyleable.cs | 9 +- src/Perspex.Styling/Styling/IStyler.cs | 9 +- .../Styling/ITemplatedControl.cs | 9 +- .../Styling/ObservableSetter.cs | 9 +- src/Perspex.Styling/Styling/Selector.cs | 39 +- src/Perspex.Styling/Styling/SelectorMatch.cs | 9 +- src/Perspex.Styling/Styling/Selectors.cs | 15 +- src/Perspex.Styling/Styling/Setter.cs | 9 +- src/Perspex.Styling/Styling/Style.cs | 11 +- src/Perspex.Styling/Styling/StyleActivator.cs | 55 ++- src/Perspex.Styling/Styling/StyleBinding.cs | 23 +- src/Perspex.Styling/Styling/Styler.cs | 15 +- src/Perspex.Styling/Styling/Styles.cs | 9 +- src/Perspex.Themes.Default/ButtonStyle.cs | 25 +- src/Perspex.Themes.Default/CheckBoxStyle.cs | 23 +- .../ContentControlStyle.cs | 17 +- src/Perspex.Themes.Default/DeckStyle.cs | 17 +- src/Perspex.Themes.Default/DefaultTheme.cs | 9 +- src/Perspex.Themes.Default/DropDownStyle.cs | 29 +- .../FocusAdornerStyle.cs | 19 +- .../GridSplitterStyle.cs | 15 +- .../ItemsControlStyle.cs | 17 +- .../ListBoxItemStyle.cs | 19 +- src/Perspex.Themes.Default/ListBoxStyle.cs | 19 +- src/Perspex.Themes.Default/MenuItemStyle.cs | 33 +- src/Perspex.Themes.Default/MenuStyle.cs | 19 +- src/Perspex.Themes.Default/PopupRootStyle.cs | 19 +- .../ProgressBarStyle.cs | 27 +- .../Properties/AssemblyInfo.cs | 7 +- .../RadioButtonStyle.cs | 23 +- src/Perspex.Themes.Default/ScrollBarStyle.cs | 21 +- .../ScrollViewerStyle.cs | 19 +- src/Perspex.Themes.Default/TabControlStyle.cs | 19 +- src/Perspex.Themes.Default/TabItemStyle.cs | 19 +- src/Perspex.Themes.Default/TabStripStyle.cs | 19 +- src/Perspex.Themes.Default/TextBoxStyle.cs | 19 +- .../ToggleButtonStyle.cs | 23 +- src/Perspex.Themes.Default/ToolTipStyle.cs | 19 +- .../TreeViewItemStyle.cs | 25 +- src/Perspex.Themes.Default/TreeViewStyle.cs | 19 +- src/Perspex.Themes.Default/WindowStyle.cs | 19 +- src/Shared/SharedAssemblyInfo.cs | Bin 503 -> 1364 bytes .../Perspex.Direct2D1/Direct2D1Platform.cs | 40 +- src/Windows/Perspex.Direct2D1/Disposable.cs | 15 +- .../Perspex.Direct2D1/Media/BrushImpl.cs | 9 +- .../Perspex.Direct2D1/Media/BrushWrapper.cs | 11 +- .../Perspex.Direct2D1/Media/DrawingContext.cs | 86 ++-- .../Media/FormattedTextImpl.cs | 21 +- .../Perspex.Direct2D1/Media/GeometryImpl.cs | 33 +- .../Media/Imaging/BitmapImpl.cs | 33 +- .../Media/Imaging/RenderTargetBitmapImpl.cs | 21 +- .../Media/LinearGradientBrushImpl.cs | 21 +- .../Media/PerspexTextRenderer.cs | 37 +- .../Media/SolidColorBrushImpl.cs | 19 +- .../Media/StreamGeometryContextImpl.cs | 29 +- .../Media/StreamGeometryImpl.cs | 31 +- .../Media/VisualBrushImpl.cs | 15 +- .../Perspex.Direct2D1/PrimitiveExtensions.cs | 17 +- .../Properties/AssemblyInfo.cs | 7 +- src/Windows/Perspex.Direct2D1/Renderer.cs | 41 +- src/Windows/Perspex.Win32/AssetLoader.cs | 19 +- src/Windows/Perspex.Win32/ClipboardImpl.cs | 29 +- src/Windows/Perspex.Win32/CursorFactory.cs | 33 +- .../Embedding/EmbeddedWindowImpl.cs | 15 +- src/Windows/Perspex.Win32/Input/KeyInterop.cs | 23 +- .../Input/WindowsKeyboardDevice.cs | 27 +- .../Perspex.Win32/Input/WindowsMouseDevice.cs | 19 +- .../Perspex.Win32/Interop/UnmanagedMethods.cs | 21 +- .../Perspex.Win32/PlatformConstants.cs | 7 +- src/Windows/Perspex.Win32/PopupImpl.cs | 13 +- .../Perspex.Win32/Properties/AssemblyInfo.cs | 7 +- src/Windows/Perspex.Win32/Win32Platform.cs | 54 +-- src/Windows/Perspex.Win32/WindowImpl.cs | 136 +++--- .../Collections/CollectionChangedTracker.cs | 11 +- .../Collections/PerspexDictionaryTests.cs | 15 +- .../Collections/PerspexListTests.cs | 19 +- .../Collections/PropertyChangedTracker.cs | 13 +- .../PerspexObjectTests_Binding.cs | 15 +- .../PerspexObjectTests_GetObservable.cs | 13 +- .../PerspexObjectTests_GetValue.cs | 9 +- .../PerspexObjectTests_Inheritance.cs | 9 +- .../PerspexObjectTests_Metadata.cs | 15 +- .../PerspexObjectTests_SetValue.cs | 16 +- .../PerspexObjectTests_Validation.cs | 11 +- .../PerspexPropertyTests.cs | 11 +- .../PriorityValueTests.cs | 17 +- .../Properties/AssemblyInfo.cs | 7 +- .../Perspex.Controls.UnitTests/BorderTests.cs | 9 +- .../ContentControlTests.cs | 38 +- .../ContentPresenterTests.cs | 16 +- .../ControlTests.cs | 26 +- tests/Perspex.Controls.UnitTests/DeckTests.cs | 17 +- .../DecoratorTests.cs | 13 +- .../DropDownTests.cs | 32 +- .../ItemsControlTests.cs | 26 +- .../ListBoxTests.cs | 23 +- .../Mixins/SelectableMixinTests.cs | 13 +- .../Perspex.Controls.UnitTests/PanelTests.cs | 15 +- .../Presenters/DeckPresenterTests.cs | 15 +- .../Presenters/ItemsPresenterTests.cs | 26 +- .../Presenters/ScrollContentPresenterTests.cs | 19 +- .../Primitives/PopupTests.cs | 37 +- .../Primitives/RangeBaseTests.cs | 13 +- .../Primitives/ScrollBarTests.cs | 17 +- .../Primitives/SelectingItemsControlTests.cs | 25 +- .../SelectingItemsControlTests_AutoSelect.cs | 18 +- .../Primitives/TabStripTests.cs | 19 +- .../Primitives/TemplatedControlTests.cs | 29 +- .../Primitives/TrackTests.cs | 23 +- .../Properties/AssemblyInfo.cs | 7 +- .../ScrollViewerTests.cs | 21 +- .../TabControlTests.cs | 21 +- .../TemplatedControlTests.cs | 29 +- .../Templates/TemplateExtensionsTests.cs | 15 +- tests/Perspex.Controls.UnitTests/TestRoot.cs | 17 +- .../TestTemplatedControl.cs | 9 +- .../TopLevelTests.cs | 39 +- .../Controls/Shapes/PathTests.cs | 23 +- .../Media/GeometryTests.cs | 19 +- .../Properties/AssemblyInfo.cs | 7 +- .../RectComparer.cs | 8 +- .../KeyboardNavigationTests_Arrows.cs | 11 +- .../KeyboardNavigationTests_Tab.cs | 11 +- .../Properties/AssemblyInfo.cs | 7 +- .../InteractiveTests.cs | 19 +- .../Properties/AssemblyInfo.cs | 7 +- .../FullLayoutTests.cs | 45 +- .../Properties/AssemblyInfo.cs | 7 +- .../Controls/BorderTests.cs | Bin 11376 -> 23820 bytes .../Controls/ImageTests.cs | Bin 3037 -> 6546 bytes .../Media/LinearGradientBrushTests.cs | 23 +- .../Media/VisualBrushTests.cs | 17 +- .../Perspex.Direct2D1.RenderTests.csproj | 3 - .../Properties/AssemblyInfo.cs | Bin 205 -> 742 bytes .../Shapes/EllipseTests.cs | Bin 865 -> 2094 bytes tests/Perspex.RenderTests/Shapes/PathTests.cs | Bin 4597 -> 9706 bytes .../Shapes/RectangleTests.cs | Bin 1895 -> 4232 bytes tests/Perspex.RenderTests/TestBase.cs | Bin 2143 -> 4708 bytes .../Properties/AssemblyInfo.cs | 5 +- .../Perspex.SceneGraph.UnitTests/TestRoot.cs | 12 +- .../TestVisual.cs | 14 +- .../VisualTests.cs | 13 +- .../VisualTree/BoundsTrackerTests.cs | 25 +- .../Properties/AssemblyInfo.cs | 7 +- .../SelectorTests_Child.cs | 21 +- .../SelectorTests_Class.cs | 19 +- .../SelectorTests_Descendent.cs | 21 +- .../SelectorTests_Multiple.cs | 21 +- .../SelectorTests_Name.cs | 15 +- .../SelectorTests_OfType.cs | 15 +- .../SelectorTests_PropertyEquals.cs | 18 +- .../SelectorTests_Template.cs | 22 +- .../StyleActivatorTests.cs | 14 +- tests/Perspex.Styling.UnitTests/StyleTests.cs | 18 +- .../TestControlBase.cs | 10 +- .../TestObservable.cs | 11 +- .../Perspex.Styling.UnitTests/TestObserver.cs | 25 +- .../TestSelectors.cs | 9 +- .../Perspex.Styling.UnitTests/TestSubject.cs | 33 +- .../TestTemplatedControl.cs | 12 +- 589 files changed, 5670 insertions(+), 6918 deletions(-) diff --git a/Perspex.v2.ncrunchsolution b/Perspex.v2.ncrunchsolution index 11389bd8d2f4ef4fc17c3b498c5ac09ed1637b60..fe4feb2cb68b687b4720bc1a47cbec77763ab35f 100644 GIT binary patch delta 11 Scmcb{zlLvv3ESj*Y(D@TUj+F8 delta 182 zcmZ3(ca49830r*uLn1>mLpG31XGmozW{6=3W+-8(WXJ*XoEh>N3K;Yl92xR}@;N}! zDxhc)P?a8oArKpYu`WXrP_zW7!T<;@fF>kjsE=Vt0h(0;6bGq{0on+)Ns9=pQh-+H LFj!AEX8Q>MD>WpQ diff --git a/Tests/Perspex.Controls.UnitTests/GridLengthTests.cs b/Tests/Perspex.Controls.UnitTests/GridLengthTests.cs index 7433861814..0a0d6c5352 100644 --- a/Tests/Perspex.Controls.UnitTests/GridLengthTests.cs +++ b/Tests/Perspex.Controls.UnitTests/GridLengthTests.cs @@ -1,15 +1,12 @@ - - - - +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. +using System; +using System.Linq; +using Xunit; namespace Perspex.Controls.UnitTests { - using System; - using System.Linq; - using Xunit; - public class GridLengthTests { [Fact] diff --git a/Tests/Perspex.Markup.Xaml.UnitTests/BinderTest.cs b/Tests/Perspex.Markup.Xaml.UnitTests/BinderTest.cs index feea7342aa..4a421bce2f 100644 --- a/Tests/Perspex.Markup.Xaml.UnitTests/BinderTest.cs +++ b/Tests/Perspex.Markup.Xaml.UnitTests/BinderTest.cs @@ -1,14 +1,17 @@ -namespace Perspex.Xaml.Base.UnitTest -{ - using System; - using Moq; - using Markup.Xaml.DataBinding; - using OmniXaml.TypeConversion; - using Xunit; +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. + +using System; +using Moq; +using Perspex.Markup.Xaml.DataBinding; +using OmniXaml.TypeConversion; +using Xunit; +namespace Perspex.Xaml.Base.UnitTest +{ public class BinderTest { - [Fact] + [Fact] public void NullTarget_Throws() { var typeConverter = new Mock(); diff --git a/Tests/Perspex.Markup.Xaml.UnitTests/BindingDefinitionBuilder.cs b/Tests/Perspex.Markup.Xaml.UnitTests/BindingDefinitionBuilder.cs index 08c919341d..e968db3615 100644 --- a/Tests/Perspex.Markup.Xaml.UnitTests/BindingDefinitionBuilder.cs +++ b/Tests/Perspex.Markup.Xaml.UnitTests/BindingDefinitionBuilder.cs @@ -1,37 +1,39 @@ +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. + using System; +using Perspex.Controls; +using Perspex.Markup.Xaml.DataBinding; +using Perspex.Markup.Xaml.DataBinding.ChangeTracking; namespace Perspex.Xaml.Base.UnitTest { - using Controls; - using Markup.Xaml.DataBinding; - using Markup.Xaml.DataBinding.ChangeTracking; - public class BindingDefinitionBuilder { - private readonly BindingMode bindingMode; - private readonly PropertyPath sourcePropertyPath; - private Control target; - private PerspexProperty targetProperty; + private readonly BindingMode _bindingMode; + private readonly PropertyPath _sourcePropertyPath; + private Control _target; + private PerspexProperty _targetProperty; public BindingDefinitionBuilder() { - bindingMode = BindingMode.Default; - sourcePropertyPath = new PropertyPath(string.Empty); + _bindingMode = BindingMode.Default; + _sourcePropertyPath = new PropertyPath(string.Empty); } public BindingDefinitionBuilder WithNullTarget() { - target = null; + _target = null; return this; } public XamlBindingDefinition Build() { return new XamlBindingDefinition( - bindingMode: bindingMode, - sourcePropertyPath: sourcePropertyPath, - target: target, - targetProperty: targetProperty); + bindingMode: _bindingMode, + sourcePropertyPath: _sourcePropertyPath, + target: _target, + targetProperty: _targetProperty); } } } \ No newline at end of file diff --git a/Tests/Perspex.Markup.Xaml.UnitTests/ChangeBranchTest.cs b/Tests/Perspex.Markup.Xaml.UnitTests/ChangeBranchTest.cs index c9d1a51ead..202cfed999 100644 --- a/Tests/Perspex.Markup.Xaml.UnitTests/ChangeBranchTest.cs +++ b/Tests/Perspex.Markup.Xaml.UnitTests/ChangeBranchTest.cs @@ -1,10 +1,13 @@ -namespace Perspex.Xaml.Base.UnitTest -{ - using System; - using Markup.Xaml.DataBinding.ChangeTracking; - using SampleModel; - using Xunit; +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. + +using System; +using Perspex.Markup.Xaml.DataBinding.ChangeTracking; +using Perspex.Xaml.Base.UnitTest.SampleModel; +using Xunit; +namespace Perspex.Xaml.Base.UnitTest +{ public class ChangeBranchTest { [Fact] @@ -23,11 +26,11 @@ public void OnePathOnly() { var level1 = new Level1(); - + var branch = new ObservablePropertyBranch(level1, new PropertyPath("Text")); var newValue = "Hey now"; branch.Value = newValue; - + Assert.Equal(level1.Text, newValue); } diff --git a/Tests/Perspex.Markup.Xaml.UnitTests/DataContextChangeSynchronizerTest.cs b/Tests/Perspex.Markup.Xaml.UnitTests/DataContextChangeSynchronizerTest.cs index 1c8bb17cb7..f2f3d949a6 100644 --- a/Tests/Perspex.Markup.Xaml.UnitTests/DataContextChangeSynchronizerTest.cs +++ b/Tests/Perspex.Markup.Xaml.UnitTests/DataContextChangeSynchronizerTest.cs @@ -1,84 +1,87 @@ -namespace Perspex.Xaml.Base.UnitTest +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. + +using System; +using Perspex.Controls; +using GitHubClient.ViewModels; +using Perspex.Markup.Xaml.DataBinding; +using Perspex.Markup.Xaml.DataBinding.ChangeTracking; +using OmniXaml.Builder; +using OmniXaml.TypeConversion; +using OmniXaml.TypeConversion.BuiltInConverters; +using Perspex.Xaml.Base.UnitTest.SampleModel; +using Xunit; + +namespace Perspex.Xaml.Base.UnitTest { - using System; - using Controls; - using GitHubClient.ViewModels; - using Markup.Xaml.DataBinding; - using Markup.Xaml.DataBinding.ChangeTracking; - using OmniXaml.Builder; - using OmniXaml.TypeConversion; - using OmniXaml.TypeConversion.BuiltInConverters; - using SampleModel; - using Xunit; - public class DataContextChangeSynchronizerTest { - private TypeConverterProvider repo; - private SamplePerspexObject guiObject; - private ViewModelMock viewModel; + private TypeConverterProvider _repo; + private SamplePerspexObject _guiObject; + private ViewModelMock _viewModel; public DataContextChangeSynchronizerTest() { - repo = new TypeConverterProvider(); - guiObject = new SamplePerspexObject(); - viewModel = new ViewModelMock(); + _repo = new TypeConverterProvider(); + _guiObject = new SamplePerspexObject(); + _viewModel = new ViewModelMock(); } [Fact] public void SameTypesFromUIToModel() { - var synchronizer = new DataContextChangeSynchronizer(new DataContextChangeSynchronizer.BindingSource(new PropertyPath("IntProp"), viewModel), new DataContextChangeSynchronizer.BindingTarget(guiObject, SamplePerspexObject.IntProperty), repo); + var synchronizer = new DataContextChangeSynchronizer(new DataContextChangeSynchronizer.BindingSource(new PropertyPath("IntProp"), _viewModel), new DataContextChangeSynchronizer.BindingTarget(_guiObject, SamplePerspexObject.IntProperty), _repo); synchronizer.StartUpdatingSourceWhenTargetChanges(); const int someValue = 4; - guiObject.Int = someValue; + _guiObject.Int = someValue; - Assert.Equal(someValue, viewModel.IntProp); + Assert.Equal(someValue, _viewModel.IntProp); } [Fact] public void DifferentTypesFromUIToModel() { - var synchronizer = new DataContextChangeSynchronizer(new DataContextChangeSynchronizer.BindingSource(new PropertyPath("IntProp"), viewModel), new DataContextChangeSynchronizer.BindingTarget(guiObject, SamplePerspexObject.StringProperty), repo); + var synchronizer = new DataContextChangeSynchronizer(new DataContextChangeSynchronizer.BindingSource(new PropertyPath("IntProp"), _viewModel), new DataContextChangeSynchronizer.BindingTarget(_guiObject, SamplePerspexObject.StringProperty), _repo); synchronizer.StartUpdatingSourceWhenTargetChanges(); - guiObject.String = "2"; + _guiObject.String = "2"; - Assert.Equal(2, viewModel.IntProp); + Assert.Equal(2, _viewModel.IntProp); } [Fact] public void DifferentTypesAndNonConvertibleValueFromUIToModel() { - var synchronizer = new DataContextChangeSynchronizer(new DataContextChangeSynchronizer.BindingSource(new PropertyPath("IntProp"), viewModel), new DataContextChangeSynchronizer.BindingTarget(guiObject, SamplePerspexObject.StringProperty), repo); + var synchronizer = new DataContextChangeSynchronizer(new DataContextChangeSynchronizer.BindingSource(new PropertyPath("IntProp"), _viewModel), new DataContextChangeSynchronizer.BindingTarget(_guiObject, SamplePerspexObject.StringProperty), _repo); synchronizer.StartUpdatingSourceWhenTargetChanges(); - guiObject.String = ""; + _guiObject.String = ""; - Assert.Equal(default(int), viewModel.IntProp); + Assert.Equal(default(int), _viewModel.IntProp); } [Fact] public void DifferentTypesFromModelToUI() { - var synchronizer = new DataContextChangeSynchronizer(new DataContextChangeSynchronizer.BindingSource(new PropertyPath("IntProp"), viewModel), new DataContextChangeSynchronizer.BindingTarget(guiObject, SamplePerspexObject.StringProperty), repo); + var synchronizer = new DataContextChangeSynchronizer(new DataContextChangeSynchronizer.BindingSource(new PropertyPath("IntProp"), _viewModel), new DataContextChangeSynchronizer.BindingTarget(_guiObject, SamplePerspexObject.StringProperty), _repo); synchronizer.StartUpdatingTargetWhenSourceChanges(); - viewModel.IntProp = 2; - - Assert.Equal("2", guiObject.String); + _viewModel.IntProp = 2; + + Assert.Equal("2", _guiObject.String); } [Fact] public void SameTypesFromModelToUI() { - var synchronizer = new DataContextChangeSynchronizer(new DataContextChangeSynchronizer.BindingSource(new PropertyPath("IntProp"), viewModel), new DataContextChangeSynchronizer.BindingTarget(guiObject, SamplePerspexObject.IntProperty), repo); + var synchronizer = new DataContextChangeSynchronizer(new DataContextChangeSynchronizer.BindingSource(new PropertyPath("IntProp"), _viewModel), new DataContextChangeSynchronizer.BindingTarget(_guiObject, SamplePerspexObject.IntProperty), _repo); synchronizer.StartUpdatingTargetWhenSourceChanges(); - viewModel.IntProp = 2; + _viewModel.IntProp = 2; - Assert.Equal(2, guiObject.Int); + Assert.Equal(2, _guiObject.Int); } [Fact] @@ -87,7 +90,7 @@ var mainWindowViewModel = new MainWindowViewModel(); var contentControl = new ContentControl(); - var synchronizer = new DataContextChangeSynchronizer(new DataContextChangeSynchronizer.BindingSource(new PropertyPath("Content"), mainWindowViewModel), new DataContextChangeSynchronizer.BindingTarget(contentControl, ContentControl.ContentProperty), repo); + var synchronizer = new DataContextChangeSynchronizer(new DataContextChangeSynchronizer.BindingSource(new PropertyPath("Content"), mainWindowViewModel), new DataContextChangeSynchronizer.BindingTarget(contentControl, ContentControl.ContentProperty), _repo); synchronizer.StartUpdatingTargetWhenSourceChanges(); diff --git a/Tests/Perspex.Markup.Xaml.UnitTests/Properties/AssemblyInfo.cs b/Tests/Perspex.Markup.Xaml.UnitTests/Properties/AssemblyInfo.cs index 959388e56d..575bdbad2f 100644 --- a/Tests/Perspex.Markup.Xaml.UnitTests/Properties/AssemblyInfo.cs +++ b/Tests/Perspex.Markup.Xaml.UnitTests/Properties/AssemblyInfo.cs @@ -1,3 +1,6 @@ -using System.Reflection; +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. + +using System.Reflection; [assembly: AssemblyTitle("Perspex.Markup.Xaml.UnitTests")] \ No newline at end of file diff --git a/Tests/Perspex.Markup.Xaml.UnitTests/PropertyMountPointTest.cs b/Tests/Perspex.Markup.Xaml.UnitTests/PropertyMountPointTest.cs index c94d13037d..1b15094af5 100644 --- a/Tests/Perspex.Markup.Xaml.UnitTests/PropertyMountPointTest.cs +++ b/Tests/Perspex.Markup.Xaml.UnitTests/PropertyMountPointTest.cs @@ -1,9 +1,12 @@ -namespace Perspex.Xaml.Base.UnitTest -{ - using Markup.Xaml.DataBinding.ChangeTracking; - using System; - using Xunit; +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. + +using Perspex.Markup.Xaml.DataBinding.ChangeTracking; +using System; +using Xunit; +namespace Perspex.Xaml.Base.UnitTest +{ public class PropertyMountPointTest { [Fact] diff --git a/Tests/Perspex.Markup.Xaml.UnitTests/SampleModel/Level1.cs b/Tests/Perspex.Markup.Xaml.UnitTests/SampleModel/Level1.cs index ddc41ef2a0..e3ec6d96a3 100644 --- a/Tests/Perspex.Markup.Xaml.UnitTests/SampleModel/Level1.cs +++ b/Tests/Perspex.Markup.Xaml.UnitTests/SampleModel/Level1.cs @@ -1,39 +1,42 @@ +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. + using System; namespace Perspex.Xaml.Base.UnitTest.SampleModel { public class Level1 : PropertyChangeNotifier { - private Level2 level2 = new Level2(); - private DateTime dateTime; - private string text; + private Level2 _level2 = new Level2(); + private DateTime _dateTime; + private string _text; public Level2 Level2 { - get { return level2; } + get { return _level2; } set { - level2 = value; + _level2 = value; OnPropertyChanged(); } } public string Text { - get { return text; } + get { return _text; } set { - text = value; + _text = value; OnPropertyChanged(); } } public DateTime DateTime { - get { return dateTime; } + get { return _dateTime; } set { - dateTime = value; + _dateTime = value; OnPropertyChanged(); } } diff --git a/Tests/Perspex.Markup.Xaml.UnitTests/SampleModel/Level2.cs b/Tests/Perspex.Markup.Xaml.UnitTests/SampleModel/Level2.cs index 6a276dc923..0862309a97 100644 --- a/Tests/Perspex.Markup.Xaml.UnitTests/SampleModel/Level2.cs +++ b/Tests/Perspex.Markup.Xaml.UnitTests/SampleModel/Level2.cs @@ -1,15 +1,18 @@ +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. + namespace Perspex.Xaml.Base.UnitTest.SampleModel { public class Level2 : PropertyChangeNotifier { - private Level3 level3 = new Level3(); + private Level3 _level3 = new Level3(); public Level3 Level3 { - get { return level3; } + get { return _level3; } set { - level3 = value; + _level3 = value; OnPropertyChanged(); } } diff --git a/Tests/Perspex.Markup.Xaml.UnitTests/SampleModel/Level3.cs b/Tests/Perspex.Markup.Xaml.UnitTests/SampleModel/Level3.cs index 132d33ee89..c22e7c268c 100644 --- a/Tests/Perspex.Markup.Xaml.UnitTests/SampleModel/Level3.cs +++ b/Tests/Perspex.Markup.Xaml.UnitTests/SampleModel/Level3.cs @@ -1,15 +1,18 @@ +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. + namespace Perspex.Xaml.Base.UnitTest.SampleModel { public class Level3 : PropertyChangeNotifier { - private int property = 10; + private int _property = 10; public int Property { - get { return property; } + get { return _property; } set { - property = value; + _property = value; OnPropertyChanged(); } } diff --git a/Tests/Perspex.Markup.Xaml.UnitTests/SampleModel/LogInViewModel.cs b/Tests/Perspex.Markup.Xaml.UnitTests/SampleModel/LogInViewModel.cs index d2e6d72cb0..5029135415 100644 --- a/Tests/Perspex.Markup.Xaml.UnitTests/SampleModel/LogInViewModel.cs +++ b/Tests/Perspex.Markup.Xaml.UnitTests/SampleModel/LogInViewModel.cs @@ -1,16 +1,13 @@ - - - - +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. +using ReactiveUI; namespace Perspex.Xaml.Base.UnitTest.SampleModel { - using ReactiveUI; - public class LogInViewModel : ReactiveObject { - private string username; + private string _username; public LogInViewModel() { @@ -22,8 +19,8 @@ namespace Perspex.Xaml.Base.UnitTest.SampleModel public string Username { - get { return this.username; } - set { this.RaiseAndSetIfChanged(ref this.username, value); } + get { return _username; } + set { this.RaiseAndSetIfChanged(ref _username, value); } } public ReactiveCommand OkCommand diff --git a/Tests/Perspex.Markup.Xaml.UnitTests/SampleModel/MainWindowViewModel.cs b/Tests/Perspex.Markup.Xaml.UnitTests/SampleModel/MainWindowViewModel.cs index 14a01f54aa..c36b4ad8a7 100644 --- a/Tests/Perspex.Markup.Xaml.UnitTests/SampleModel/MainWindowViewModel.cs +++ b/Tests/Perspex.Markup.Xaml.UnitTests/SampleModel/MainWindowViewModel.cs @@ -1,20 +1,17 @@ - - - - +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. +using System; +using Perspex.Xaml.Base.UnitTest.SampleModel; +using ReactiveUI; namespace GitHubClient.ViewModels { - using System; - using Perspex.Xaml.Base.UnitTest.SampleModel; - using ReactiveUI; - public class MainWindowViewModel : ReactiveObject { - private object content; + private object _content; - private LogInViewModel login; + private LogInViewModel _login; public MainWindowViewModel() { @@ -23,21 +20,21 @@ namespace GitHubClient.ViewModels public object Content { - get { return this.content; } - set { this.RaiseAndSetIfChanged(ref this.content, value); } + get { return _content; } + set { this.RaiseAndSetIfChanged(ref _content, value); } } private void ShowLogin() { - this.login = new LogInViewModel(); - this.login.OkCommand.Subscribe(_ => this.ShowRepositories()); - this.Content = this.login; + _login = new LogInViewModel(); + _login.OkCommand.Subscribe(_ => this.ShowRepositories()); + this.Content = _login; } private void ShowRepositories() { var vm = new UserRepositoriesViewModel(); - var task = vm.Load(this.login.Username); + var task = vm.Load(_login.Username); this.Content = vm; } } diff --git a/Tests/Perspex.Markup.Xaml.UnitTests/SampleModel/PropertyChangeNotifier.cs b/Tests/Perspex.Markup.Xaml.UnitTests/SampleModel/PropertyChangeNotifier.cs index 10a8086a8c..c9dcebac85 100644 --- a/Tests/Perspex.Markup.Xaml.UnitTests/SampleModel/PropertyChangeNotifier.cs +++ b/Tests/Perspex.Markup.Xaml.UnitTests/SampleModel/PropertyChangeNotifier.cs @@ -1,8 +1,11 @@ +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. + +using System.ComponentModel; +using System.Runtime.CompilerServices; + namespace Perspex.Xaml.Base.UnitTest.SampleModel { - using System.ComponentModel; - using System.Runtime.CompilerServices; - public abstract class PropertyChangeNotifier : INotifyPropertyChanged { public event PropertyChangedEventHandler PropertyChanged; diff --git a/Tests/Perspex.Markup.Xaml.UnitTests/SampleModel/Repository.cs b/Tests/Perspex.Markup.Xaml.UnitTests/SampleModel/Repository.cs index fda8dd3ace..94d0dfa061 100644 --- a/Tests/Perspex.Markup.Xaml.UnitTests/SampleModel/Repository.cs +++ b/Tests/Perspex.Markup.Xaml.UnitTests/SampleModel/Repository.cs @@ -1,17 +1,20 @@ -namespace GitHubClient.ViewModels +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. + +namespace GitHubClient.ViewModels { public class Repository { - private readonly string name; + private readonly string _name; public Repository(string name) { - this.name = name; + _name = name; } public string Name { - get { return name; } + get { return _name; } } } } \ No newline at end of file diff --git a/Tests/Perspex.Markup.Xaml.UnitTests/SampleModel/UserRepositoriesViewModel.cs b/Tests/Perspex.Markup.Xaml.UnitTests/SampleModel/UserRepositoriesViewModel.cs index 425095ec03..2c73a055ed 100644 --- a/Tests/Perspex.Markup.Xaml.UnitTests/SampleModel/UserRepositoriesViewModel.cs +++ b/Tests/Perspex.Markup.Xaml.UnitTests/SampleModel/UserRepositoriesViewModel.cs @@ -1,29 +1,26 @@ - - - - +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. +using System.Collections.Generic; +using System.Threading.Tasks; +using GitHubClient.ViewModels; +using ReactiveUI; namespace Perspex.Xaml.Base.UnitTest.SampleModel { - using System.Collections.Generic; - using System.Threading.Tasks; - using GitHubClient.ViewModels; - using ReactiveUI; - public class UserRepositoriesViewModel : ReactiveObject { - private IReadOnlyList repositories; + private IReadOnlyList _repositories; public async Task Load(string username) - { + { this.Repositories = await new Task>(() => new List { new Repository("Blah"), new Repository("Bleh") }); } public IReadOnlyList Repositories { - get { return this.repositories; } - private set { this.RaiseAndSetIfChanged(ref this.repositories, value); } + get { return _repositories; } + private set { this.RaiseAndSetIfChanged(ref _repositories, value); } } } } \ No newline at end of file diff --git a/Tests/Perspex.Markup.Xaml.UnitTests/SamplePerspexObject.cs b/Tests/Perspex.Markup.Xaml.UnitTests/SamplePerspexObject.cs index c568be6585..16a233b586 100644 --- a/Tests/Perspex.Markup.Xaml.UnitTests/SamplePerspexObject.cs +++ b/Tests/Perspex.Markup.Xaml.UnitTests/SamplePerspexObject.cs @@ -1,3 +1,6 @@ +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. + using System; namespace Perspex.Xaml.Base.UnitTest diff --git a/Tests/Perspex.Markup.Xaml.UnitTests/TypeProviderMock.cs b/Tests/Perspex.Markup.Xaml.UnitTests/TypeProviderMock.cs index 2c0e1093cf..673369f641 100644 --- a/Tests/Perspex.Markup.Xaml.UnitTests/TypeProviderMock.cs +++ b/Tests/Perspex.Markup.Xaml.UnitTests/TypeProviderMock.cs @@ -1,21 +1,24 @@ -namespace Perspex.Xaml.Base.UnitTest -{ - using OmniXaml; - using System; +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. + +using OmniXaml; +using System; - class TypeProviderMock : ITypeProvider +namespace Perspex.Xaml.Base.UnitTest +{ + internal class TypeProviderMock : ITypeProvider { - private readonly string typeName; - private readonly string clrNamespace; - private readonly string assemblyName; - private readonly Type typeToReturn; + private readonly string _typeName; + private readonly string _clrNamespace; + private readonly string _assemblyName; + private readonly Type _typeToReturn; public TypeProviderMock(string typeName, string clrNamespace, string assemblyName, Type typeToReturn) { - this.typeName = typeName; - this.clrNamespace = clrNamespace; - this.assemblyName = assemblyName; - this.typeToReturn = typeToReturn; + _typeName = typeName; + _clrNamespace = clrNamespace; + _assemblyName = assemblyName; + _typeToReturn = typeToReturn; } public TypeProviderMock() @@ -24,10 +27,10 @@ public Type GetType(string typeName, string clrNamespace, string assemblyName) { - if (this.typeName == typeName && this.clrNamespace == clrNamespace && this.assemblyName == assemblyName) + if (_typeName == typeName && _clrNamespace == clrNamespace && _assemblyName == assemblyName) { - return typeToReturn; - } + return _typeToReturn; + } throw new TypeNotFoundException("The Type cannot be found"); } diff --git a/Tests/Perspex.Markup.Xaml.UnitTests/ViewModelMock.cs b/Tests/Perspex.Markup.Xaml.UnitTests/ViewModelMock.cs index dda8111ce1..4bdfe94e0e 100644 --- a/Tests/Perspex.Markup.Xaml.UnitTests/ViewModelMock.cs +++ b/Tests/Perspex.Markup.Xaml.UnitTests/ViewModelMock.cs @@ -1,29 +1,32 @@ -using System.ComponentModel; +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. + +using System.ComponentModel; using System.Runtime.CompilerServices; namespace Perspex.Xaml.Base.UnitTest { - class ViewModelMock : INotifyPropertyChanged + internal class ViewModelMock : INotifyPropertyChanged { - private string str; - private int intProp; + private string _str; + private int _intProp; public int IntProp { - get { return intProp; } + get { return _intProp; } set { - intProp = value; + _intProp = value; OnPropertyChanged(); } } public string StrProp { - get { return str; } + get { return _str; } set { - str = value; + _str = value; OnPropertyChanged(); } } diff --git a/Tests/Perspex.Markup.Xaml.UnitTests/XamlBindingTest.cs b/Tests/Perspex.Markup.Xaml.UnitTests/XamlBindingTest.cs index f5c59b1f1a..d7ee56245f 100644 --- a/Tests/Perspex.Markup.Xaml.UnitTests/XamlBindingTest.cs +++ b/Tests/Perspex.Markup.Xaml.UnitTests/XamlBindingTest.cs @@ -1,10 +1,13 @@ -namespace Perspex.Xaml.Base.UnitTest -{ - using Moq; - using Markup.Xaml.DataBinding; - using OmniXaml.TypeConversion; - using Xunit; +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. + +using Moq; +using Perspex.Markup.Xaml.DataBinding; +using OmniXaml.TypeConversion; +using Xunit; +namespace Perspex.Xaml.Base.UnitTest +{ public class XamlBindingTest { [Fact] diff --git a/Tests/Perspex.SceneGraph.UnitTests/Media/BrushTests.cs b/Tests/Perspex.SceneGraph.UnitTests/Media/BrushTests.cs index 6cf4d97c05..96d1d62040 100644 --- a/Tests/Perspex.SceneGraph.UnitTests/Media/BrushTests.cs +++ b/Tests/Perspex.SceneGraph.UnitTests/Media/BrushTests.cs @@ -1,15 +1,12 @@ - - - - +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. +using System; +using Perspex.Media; +using Xunit; namespace Perspex.SceneGraph.UnitTests.Media { - using System; - using Perspex.Media; - using Xunit; - public class BrushTests { [Fact] diff --git a/Tests/Perspex.SceneGraph.UnitTests/Media/ColorTests.cs b/Tests/Perspex.SceneGraph.UnitTests/Media/ColorTests.cs index b17bd120cb..4cb75e3fc4 100644 --- a/Tests/Perspex.SceneGraph.UnitTests/Media/ColorTests.cs +++ b/Tests/Perspex.SceneGraph.UnitTests/Media/ColorTests.cs @@ -1,15 +1,12 @@ - - - - +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. +using System; +using Perspex.Media; +using Xunit; namespace Perspex.SceneGraph.UnitTests.Media { - using System; - using Perspex.Media; - using Xunit; - public class ColorTests { [Fact] diff --git a/Tests/Perspex.SceneGraph.UnitTests/ThicknessTests.cs b/Tests/Perspex.SceneGraph.UnitTests/ThicknessTests.cs index ed2a89ae70..426c033bc4 100644 --- a/Tests/Perspex.SceneGraph.UnitTests/ThicknessTests.cs +++ b/Tests/Perspex.SceneGraph.UnitTests/ThicknessTests.cs @@ -1,13 +1,10 @@ - - - - +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. +using Xunit; namespace Perspex.SceneGraph.UnitTests.Media { - using Xunit; - public class ThicknessTests { [Fact] diff --git a/samples/TestApplication/App.cs b/samples/TestApplication/App.cs index b56a87f190..047a3b86c1 100644 --- a/samples/TestApplication/App.cs +++ b/samples/TestApplication/App.cs @@ -1,9 +1,12 @@ -namespace TestApplication -{ - using System; - using Perspex; - using Perspex.Themes.Default; +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. + +using System; +using Perspex; +using Perspex.Themes.Default; +namespace TestApplication +{ public class App : Application { public App() diff --git a/samples/TestApplication/Program.cs b/samples/TestApplication/Program.cs index 9eceafc90f..4abec52916 100644 --- a/samples/TestApplication/Program.cs +++ b/samples/TestApplication/Program.cs @@ -1,4 +1,7 @@ -using System; +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. + +using System; using System.Reactive.Linq; using Perspex; using Perspex.Animation; @@ -18,13 +21,13 @@ using ReactiveUI; namespace TestApplication { - class Item + internal class Item { public string Name { get; set; } public string Value { get; set; } } - class Node + internal class Node { public Node() { @@ -35,9 +38,9 @@ namespace TestApplication public PerspexList Children { get; set; } } - class Program + internal class Program { - private static PerspexList treeData = new PerspexList + private static PerspexList s_treeData = new PerspexList { new Node { @@ -75,7 +78,7 @@ namespace TestApplication }, }; - private static PerspexList listBoxData = new PerspexList + private static PerspexList s_listBoxData = new PerspexList { new Item { Name = "Item 1", Value = "Item 1 Value" }, new Item { Name = "Item 2", Value = "Item 2 Value" }, @@ -87,7 +90,7 @@ namespace TestApplication new Item { Name = "Item 8", Value = "Item 8 Value" }, }; - static void Main(string[] args) + private static void Main(string[] args) { //Log.Logger = new LoggerConfiguration() // .Filter.ByIncludingOnly(Matching.WithProperty("Area", "Layout")) @@ -264,7 +267,7 @@ namespace TestApplication var showDialog = ReactiveCommand.Create(); Button showDialogButton; - + var result = new TabItem { Header = "Buttons", @@ -356,7 +359,7 @@ namespace TestApplication close.Subscribe(x => dialog.Close(x)); - showDialogButton.Content = await dialog.ShowDialog(); + showDialogButton.Content = await dialog.ShowDialog(); }); return result; @@ -402,7 +405,7 @@ namespace TestApplication new TextBox { AcceptsReturn = true, - Text = "A wrapping text box. " + + Text = "A wrapping text box. " + "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Proin venenatis dui quis libero suscipit tincidunt. " + "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Proin venenatis dui quis libero suscipit tincidunt.", TextWrapping = TextWrapping.Wrap, @@ -488,17 +491,17 @@ namespace TestApplication new TreeView { Name = "treeView", - Items = treeData, + Items = s_treeData, }, (listBox = new ListBox { - Items = listBoxData, + Items = s_listBoxData, MaxHeight = 300, }), new DropDown { - Items = listBoxData, - SelectedItem = listBoxData[0], + Items = s_listBoxData, + SelectedItem = s_listBoxData[0], VerticalAlignment = VerticalAlignment.Center, } } diff --git a/samples/TestApplication/Properties/AssemblyInfo.cs b/samples/TestApplication/Properties/AssemblyInfo.cs index 5e8029017d..4560d26d17 100644 --- a/samples/TestApplication/Properties/AssemblyInfo.cs +++ b/samples/TestApplication/Properties/AssemblyInfo.cs @@ -1,4 +1,7 @@ -using System.Reflection; +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. + +using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; @@ -10,7 +13,7 @@ using System.Runtime.InteropServices; [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("TestApplication")] -[assembly: AssemblyCopyright("Copyright © 2013")] +[assembly: AssemblyCopyright("Copyright \u00A9 2013")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] diff --git a/samples/XamlTestApplication/App.cs b/samples/XamlTestApplication/App.cs index 4762a4892e..f11dd949ec 100644 --- a/samples/XamlTestApplication/App.cs +++ b/samples/XamlTestApplication/App.cs @@ -1,9 +1,12 @@ -namespace XamlTestApplication -{ - using System; - using Perspex; - using Perspex.Themes.Default; +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. + +using System; +using Perspex; +using Perspex.Themes.Default; +namespace XamlTestApplication +{ public class App : Application { public App() diff --git a/samples/XamlTestApplication/MainViewModel.cs b/samples/XamlTestApplication/MainViewModel.cs index 57db4848c1..450c8f422f 100644 --- a/samples/XamlTestApplication/MainViewModel.cs +++ b/samples/XamlTestApplication/MainViewModel.cs @@ -1,15 +1,18 @@ +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. + +using System.Collections.Generic; +using ReactiveUI; + namespace XamlTestApplication { - using System.Collections.Generic; - using ReactiveUI; - public class MainViewModel : ReactiveObject { - private string name; + private string _name; public MainViewModel() { - Name = "José Manuel"; + Name = "Jos\u00E9 Manuel"; People = new List { new Person("a little bit of Monica in my life"), @@ -24,8 +27,8 @@ namespace XamlTestApplication public string Name { - get { return name; } - set { this.RaiseAndSetIfChanged(ref name, value); } + get { return _name; } + set { this.RaiseAndSetIfChanged(ref _name, value); } } public List People { get; set; } @@ -33,17 +36,17 @@ namespace XamlTestApplication public class Person { - private string name; + private string _name; public Person(string name) { - this.name = name; + _name = name; } public string Name { - get { return name; } - set { name = value; } + get { return _name; } + set { _name = value; } } } } \ No newline at end of file diff --git a/samples/XamlTestApplication/Program.cs b/samples/XamlTestApplication/Program.cs index e24f228086..7559762ae9 100644 --- a/samples/XamlTestApplication/Program.cs +++ b/samples/XamlTestApplication/Program.cs @@ -1,22 +1,25 @@ -namespace XamlTestApplication +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. + +using System; +using System.Diagnostics; +using System.Windows.Threading; +using Perspex; +using Perspex.Collections; +using Perspex.Controls; +using Perspex.Controls.Templates; +using ReactiveUI; +using XamlTestApplication.Views; + +namespace XamlTestApplication { - using System; - using System.Diagnostics; - using System.Windows.Threading; - using Perspex; - using Perspex.Collections; - using Perspex.Controls; - using Perspex.Controls.Templates; - using ReactiveUI; - using Views; - - class Item + internal class Item { public string Name { get; set; } public string Value { get; set; } } - class Node + internal class Node { public Node() { @@ -27,9 +30,9 @@ public PerspexList Children { get; set; } } - class Program + internal class Program { - static void Main() + private static void Main() { var foo = Dispatcher.CurrentDispatcher; @@ -46,10 +49,10 @@ var testCommand = ReactiveCommand.Create(); testCommand.Subscribe(_ => Debug.WriteLine("Test command executed.")); - + var window = new MainWindow(); window.Show(); Application.Current.Run(window); - } + } } } diff --git a/samples/XamlTestApplication/Properties/AssemblyInfo.cs b/samples/XamlTestApplication/Properties/AssemblyInfo.cs index 5e8029017d..4560d26d17 100644 --- a/samples/XamlTestApplication/Properties/AssemblyInfo.cs +++ b/samples/XamlTestApplication/Properties/AssemblyInfo.cs @@ -1,4 +1,7 @@ -using System.Reflection; +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. + +using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; @@ -10,7 +13,7 @@ using System.Runtime.InteropServices; [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("TestApplication")] -[assembly: AssemblyCopyright("Copyright © 2013")] +[assembly: AssemblyCopyright("Copyright \u00A9 2013")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] diff --git a/samples/XamlTestApplication/Views/MainWindow.cs b/samples/XamlTestApplication/Views/MainWindow.cs index 18760d9601..d8e9da64ee 100644 --- a/samples/XamlTestApplication/Views/MainWindow.cs +++ b/samples/XamlTestApplication/Views/MainWindow.cs @@ -1,15 +1,18 @@ -namespace XamlTestApplication.Views -{ - using System; - using System.Globalization; - using System.IO; - using System.Reflection; - using System.Resources; - using OmniXaml; - using Perspex.Controls; - using Perspex.Diagnostics; - using Perspex.Markup.Xaml; +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. + +using System; +using System.Globalization; +using System.IO; +using System.Reflection; +using System.Resources; +using OmniXaml; +using Perspex.Controls; +using Perspex.Diagnostics; +using Perspex.Markup.Xaml; +namespace XamlTestApplication.Views +{ public class MainWindow : Window { public MainWindow() diff --git a/src/Gtk/Perspex.Cairo/CairoExtensions.cs b/src/Gtk/Perspex.Cairo/CairoExtensions.cs index cdcac5c1f1..1b9581d1f3 100644 --- a/src/Gtk/Perspex.Cairo/CairoExtensions.cs +++ b/src/Gtk/Perspex.Cairo/CairoExtensions.cs @@ -1,8 +1,5 @@ - - - - - +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. namespace Perspex.Cairo { diff --git a/src/Gtk/Perspex.Cairo/CairoPlatform.cs b/src/Gtk/Perspex.Cairo/CairoPlatform.cs index bda24c0dea..c4b2892cb9 100644 --- a/src/Gtk/Perspex.Cairo/CairoPlatform.cs +++ b/src/Gtk/Perspex.Cairo/CairoPlatform.cs @@ -1,28 +1,25 @@ - - - - +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. +using System; +using Perspex.Cairo.Media; +using Perspex.Cairo.Media.Imaging; +using Perspex.Media; +using Perspex.Platform; +using Splat; namespace Perspex.Cairo { - using System; using global::Cairo; - using Perspex.Cairo.Media; - using Perspex.Cairo.Media.Imaging; - using Perspex.Media; - using Perspex.Platform; - using Perspex.Threading; - using Splat; public class CairoPlatform : IPlatformRenderInterface { - private static CairoPlatform instance = new CairoPlatform(); + private static CairoPlatform s_instance = new CairoPlatform(); public static void Initialize() { var locator = Locator.CurrentMutable; - locator.Register(() => instance, typeof(IPlatformRenderInterface)); + locator.Register(() => s_instance, typeof(IPlatformRenderInterface)); } public IBitmapImpl CreateBitmap(int width, int height) @@ -31,9 +28,9 @@ namespace Perspex.Cairo } public IFormattedTextImpl CreateFormattedText( - string text, - string fontFamily, - double fontSize, + string text, + string fontFamily, + double fontSize, FontStyle fontStyle, TextAlignment textAlignment, Perspex.Media.FontWeight fontWeight) diff --git a/src/Gtk/Perspex.Cairo/Media/DrawingContext.cs b/src/Gtk/Perspex.Cairo/Media/DrawingContext.cs index 4e6e2043ad..be4cf32cd2 100644 --- a/src/Gtk/Perspex.Cairo/Media/DrawingContext.cs +++ b/src/Gtk/Perspex.Cairo/Media/DrawingContext.cs @@ -1,19 +1,15 @@ - - - +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. +using System; +using System.Reactive.Disposables; +using Perspex.Cairo.Media.Imaging; +using Perspex.Media; +using IBitmap = Perspex.Media.Imaging.IBitmap; namespace Perspex.Cairo.Media { - using System; - using System.Reactive.Disposables; - using Perspex.Cairo.Media.Imaging; - using Perspex.Media; - using Perspex.Platform; - using Splat; using Cairo = global::Cairo; - using IBitmap = Perspex.Media.Imaging.IBitmap; - using System.Collections.Generic; /// /// Draws using Direct2D1. @@ -23,15 +19,15 @@ namespace Perspex.Cairo.Media /// /// The cairo context. /// - private Cairo.Context context; - + private Cairo.Context _context; + /// /// Initializes a new instance of the class. /// /// The target surface. public DrawingContext(Cairo.Surface surface) { - this.context = new Cairo.Context(surface); + _context = new Cairo.Context(surface); this.CurrentTransform = Matrix.Identity; } @@ -41,7 +37,7 @@ namespace Perspex.Cairo.Media /// The GDK drawable. public DrawingContext(Gdk.Drawable drawable) { - this.context = Gdk.CairoHelper.Create(drawable); + _context = Gdk.CairoHelper.Create(drawable); this.CurrentTransform = Matrix.Identity; } @@ -56,7 +52,7 @@ namespace Perspex.Cairo.Media /// public void Dispose() { - this.context.Dispose(); + _context.Dispose(); } public void DrawImage(IBitmap bitmap, double opacity, Rect sourceRect, Rect destRect) @@ -66,12 +62,12 @@ namespace Perspex.Cairo.Media var scaleX = destRect.Size.Width / sourceRect.Size.Width; var scaleY = destRect.Size.Height / sourceRect.Size.Height; - this.context.Save(); - this.context.Scale(scaleX, scaleY); - this.context.SetSourceSurface(impl.Surface, (int)sourceRect.X, (int)sourceRect.Y); - this.context.Rectangle(sourceRect.ToCairo()); - this.context.Fill(); - this.context.Restore(); + _context.Save(); + _context.Scale(scaleX, scaleY); + _context.SetSourceSurface(impl.Surface, (int)sourceRect.X, (int)sourceRect.Y); + _context.Rectangle(sourceRect.ToCairo()); + _context.Fill(); + _context.Restore(); } /// @@ -83,12 +79,12 @@ namespace Perspex.Cairo.Media public void DrawLine(Pen pen, Perspex.Point p1, Perspex.Point p2) { var size = new Rect(p1, p2).Size; - + this.SetBrush(pen.Brush, size); - this.context.LineWidth = pen.Thickness; - this.context.MoveTo(p1.ToCairo()); - this.context.LineTo(p2.ToCairo()); - this.context.Stroke(); + _context.LineWidth = pen.Thickness; + _context.MoveTo(p1.ToCairo()); + _context.LineTo(p2.ToCairo()); + _context.Stroke(); } /// @@ -100,26 +96,26 @@ namespace Perspex.Cairo.Media public void DrawGeometry(Perspex.Media.Brush brush, Perspex.Media.Pen pen, Perspex.Media.Geometry geometry) { var impl = geometry.PlatformImpl as StreamGeometryImpl; - + using (var pop = this.PushTransform(impl.Transform)) { - this.context.AppendPath(impl.Path); - + _context.AppendPath(impl.Path); + if (brush != null) { this.SetBrush(brush, geometry.Bounds.Size); if (pen != null) - this.context.FillPreserve(); + _context.FillPreserve(); else - this.context.Fill(); + _context.Fill(); } if (pen != null) { this.SetPen(pen, geometry.Bounds.Size); - this.context.Stroke(); + _context.Stroke(); } } } @@ -132,8 +128,8 @@ namespace Perspex.Cairo.Media public void DrawRectange(Pen pen, Rect rect, float cornerRadius) { this.SetPen(pen, rect.Size); - this.context.Rectangle(rect.ToCairo()); - this.context.Stroke(); + _context.Rectangle(rect.ToCairo()); + _context.Stroke(); } /// @@ -146,9 +142,9 @@ namespace Perspex.Cairo.Media { var layout = ((FormattedTextImpl)text.PlatformImpl).Layout; this.SetBrush(foreground, new Size(0, 0)); - - this.context.MoveTo(origin.X, origin.Y); - Pango.CairoHelper.ShowLayout(this.context, layout); + + _context.MoveTo(origin.X, origin.Y); + Pango.CairoHelper.ShowLayout(_context, layout); } /// @@ -159,8 +155,8 @@ namespace Perspex.Cairo.Media public void FillRectange(Perspex.Media.Brush brush, Rect rect, float cornerRadius) { this.SetBrush(brush, rect.Size); - this.context.Rectangle(rect.ToCairo()); - this.context.Fill(); + _context.Rectangle(rect.ToCairo()); + _context.Fill(); } /// @@ -170,10 +166,10 @@ namespace Perspex.Cairo.Media /// A disposable used to undo the clip rectangle. public IDisposable PushClip(Rect clip) { - this.context.Rectangle(clip.ToCairo()); - this.context.Clip(); + _context.Rectangle(clip.ToCairo()); + _context.Clip(); - return Disposable.Create(() => this.context.ResetClip()); + return Disposable.Create(() => _context.ResetClip()); } /// @@ -194,11 +190,11 @@ namespace Perspex.Cairo.Media /// A disposable used to undo the transformation. public IDisposable PushTransform(Matrix matrix) { - this.context.Transform(matrix.ToCairo()); + _context.Transform(matrix.ToCairo()); return Disposable.Create(() => { - this.context.Transform(matrix.Invert().ToCairo()); + _context.Transform(matrix.Invert().ToCairo()); }); } @@ -209,7 +205,7 @@ namespace Perspex.Cairo.Media if (solid != null) { - this.context.SetSourceRGBA( + _context.SetSourceRGBA( solid.Color.R / 255.0, solid.Color.G / 255.0, solid.Color.B / 255.0, @@ -224,14 +220,14 @@ namespace Perspex.Cairo.Media g.Extend = Cairo.Extend.Pad; - this.context.SetSource(g); + _context.SetSource(g); } } private void SetPen(Pen pen, Size destinationSize) { this.SetBrush(pen.Brush, destinationSize); - this.context.LineWidth = pen.Thickness; + _context.LineWidth = pen.Thickness; } } } diff --git a/src/Gtk/Perspex.Cairo/Media/FormattedTextImpl.cs b/src/Gtk/Perspex.Cairo/Media/FormattedTextImpl.cs index d58be82c16..ff2ccd6750 100644 --- a/src/Gtk/Perspex.Cairo/Media/FormattedTextImpl.cs +++ b/src/Gtk/Perspex.Cairo/Media/FormattedTextImpl.cs @@ -1,18 +1,15 @@ - - - - +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. +using System; +using System.Collections.Generic; +using System.Linq; +using Perspex.Media; +using Perspex.Platform; +using Splat; namespace Perspex.Cairo.Media { - using System; - using System.Collections.Generic; - using System.Linq; - using Perspex.Media; - using Perspex.Platform; - using Splat; - public class FormattedTextImpl : IFormattedTextImpl { public FormattedTextImpl( @@ -33,21 +30,21 @@ namespace Perspex.Cairo.Media Style = (Pango.Style)fontStyle, Weight = fontWeight.ToCairo() }; - + this.Layout.Alignment = textAlignment.ToCairo(); } - private Size size; + private Size _size; public Size Constraint { get { - return size; + return _size; } set { - this.size = value; + _size = value; this.Layout.Width = Pango.Units.FromDouble(value.Width); } } @@ -95,12 +92,12 @@ namespace Perspex.Cairo.Media public IEnumerable HitTestTextRange(int index, int length) { var ranges = new List(); - + for (var i = 0; i < length; i++) { - ranges.Add(this.HitTestTextPosition(index+i)); + ranges.Add(this.HitTestTextPosition(index + i)); } - + return ranges; } @@ -109,7 +106,7 @@ namespace Perspex.Cairo.Media int width; int height; this.Layout.GetPixelSize(out width, out height); - + return new Size(width, height); } diff --git a/src/Gtk/Perspex.Cairo/Media/Imaging/BitmapImpl.cs b/src/Gtk/Perspex.Cairo/Media/Imaging/BitmapImpl.cs index de1f006bbb..49184b10e9 100644 --- a/src/Gtk/Perspex.Cairo/Media/Imaging/BitmapImpl.cs +++ b/src/Gtk/Perspex.Cairo/Media/Imaging/BitmapImpl.cs @@ -1,13 +1,11 @@ - - - - +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. +using System; +using Perspex.Platform; namespace Perspex.Cairo.Media.Imaging { - using System; - using Perspex.Platform; using Cairo = global::Cairo; public class BitmapImpl : IBitmapImpl diff --git a/src/Gtk/Perspex.Cairo/Media/Imaging/RenderTargetBitmapImpl.cs b/src/Gtk/Perspex.Cairo/Media/Imaging/RenderTargetBitmapImpl.cs index 4c523eba94..5863701f54 100644 --- a/src/Gtk/Perspex.Cairo/Media/Imaging/RenderTargetBitmapImpl.cs +++ b/src/Gtk/Perspex.Cairo/Media/Imaging/RenderTargetBitmapImpl.cs @@ -1,13 +1,11 @@ - - - - +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. +using System; +using Perspex.Platform; namespace Perspex.Cairo.Media.Imaging { - using System; - using Perspex.Platform; using Cairo = global::Cairo; public class RenderTargetBitmapImpl : BitmapImpl, IRenderTargetBitmapImpl diff --git a/src/Gtk/Perspex.Cairo/Media/StreamGeometryContextImpl.cs b/src/Gtk/Perspex.Cairo/Media/StreamGeometryContextImpl.cs index e57aac0b6a..f8fa901f2d 100644 --- a/src/Gtk/Perspex.Cairo/Media/StreamGeometryContextImpl.cs +++ b/src/Gtk/Perspex.Cairo/Media/StreamGeometryContextImpl.cs @@ -1,25 +1,23 @@ - - - - +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. +using System; +using System.Collections.Generic; +using Perspex.Media; +using Perspex.Platform; namespace Perspex.Cairo.Media { - using Perspex.Media; - using Perspex.Platform; - using System; - using System.Collections.Generic; using Cairo = global::Cairo; public class StreamGeometryContextImpl : IStreamGeometryContextImpl { - private StreamGeometryImpl impl; + private StreamGeometryImpl _impl; public StreamGeometryContextImpl(StreamGeometryImpl imp) { - this.impl = imp; - this.surf = new Cairo.ImageSurface(Cairo.Format.Argb32, 0, 0); - this.context = new Cairo.Context(this.surf); + _impl = imp; + _surf = new Cairo.ImageSurface(global::Cairo.Format.Argb32, 0, 0); + _context = new Cairo.Context(_surf); } public void ArcTo(Point point, Size size, double rotationAngle, bool isLargeArc, SweepDirection sweepDirection) @@ -28,36 +26,36 @@ namespace Perspex.Cairo.Media public void BeginFigure(Point startPoint, bool isFilled) { - this.context.MoveTo(startPoint.ToCairo()); + _context.MoveTo(startPoint.ToCairo()); } public void BezierTo(Point point1, Point point2, Point point3) { - this.context.CurveTo(point1.ToCairo(), point2.ToCairo(), point3.ToCairo()); + _context.CurveTo(point1.ToCairo(), point2.ToCairo(), point3.ToCairo()); } public void LineTo(Point point) { - this.context.LineTo(point.ToCairo()); + _context.LineTo(point.ToCairo()); } - private Cairo.Context context; - private Cairo.ImageSurface surf; + private Cairo.Context _context; + private Cairo.ImageSurface _surf; public void EndFigure(bool isClosed) { if (isClosed) - this.context.ClosePath(); + _context.ClosePath(); - var extents = this.context.StrokeExtents(); - this.impl.Bounds = new Rect(extents.X, extents.Y, extents.Width, extents.Height); - this.impl.Path = this.context.CopyPath(); + var extents = _context.StrokeExtents(); + _impl.Bounds = new Rect(extents.X, extents.Y, extents.Width, extents.Height); + _impl.Path = _context.CopyPath(); } public void Dispose() { - context.Dispose(); - surf.Dispose(); + _context.Dispose(); + _surf.Dispose(); } } } diff --git a/src/Gtk/Perspex.Cairo/Media/StreamGeometryImpl.cs b/src/Gtk/Perspex.Cairo/Media/StreamGeometryImpl.cs index f4089b288f..6415042b18 100644 --- a/src/Gtk/Perspex.Cairo/Media/StreamGeometryImpl.cs +++ b/src/Gtk/Perspex.Cairo/Media/StreamGeometryImpl.cs @@ -1,32 +1,30 @@ - - - - +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. +using System; +using Perspex.Media; +using Perspex.Platform; +using Splat; +using System.Collections.Generic; namespace Perspex.Cairo.Media { - using System; - using Perspex.Media; - using Perspex.Platform; using Cairo = global::Cairo; - using Splat; - using System.Collections.Generic; public class StreamGeometryImpl : IStreamGeometryImpl { public StreamGeometryImpl() { - this.impl = new StreamGeometryContextImpl(this); + _impl = new StreamGeometryContextImpl(this); } public StreamGeometryImpl(Cairo.Path path) { - this.impl = new StreamGeometryContextImpl(this); + _impl = new StreamGeometryContextImpl(this); this.Path = path; } - - public Cairo.Path Path + + public global::Cairo.Path Path { get; set; @@ -38,20 +36,20 @@ namespace Perspex.Cairo.Media set; } - private StreamGeometryContextImpl impl; + private StreamGeometryContextImpl _impl; - private Matrix transform = Matrix.Identity; + private Matrix _transform = Matrix.Identity; public Matrix Transform { - get { return this.transform; } + get { return _transform; } set { if (value != this.Transform) { - if (!value.IsIdentity) - { - this.transform = value; - } + if (!value.IsIdentity) + { + _transform = value; + } } } } @@ -68,7 +66,7 @@ namespace Perspex.Cairo.Media public IStreamGeometryContextImpl Open() { - return this.impl; + return _impl; } } } diff --git a/src/Gtk/Perspex.Cairo/Properties/AssemblyInfo.cs b/src/Gtk/Perspex.Cairo/Properties/AssemblyInfo.cs index 5dc59f0144..18361d7ad5 100644 --- a/src/Gtk/Perspex.Cairo/Properties/AssemblyInfo.cs +++ b/src/Gtk/Perspex.Cairo/Properties/AssemblyInfo.cs @@ -1,8 +1,5 @@ - - - - - +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. using System.Reflection; using System.Runtime.CompilerServices; @@ -16,7 +13,7 @@ using System.Runtime.InteropServices; [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("Perspex.Cairo")] -[assembly: AssemblyCopyright("Copyright © 2014")] +[assembly: AssemblyCopyright("Copyright \u00A9 2014")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] diff --git a/src/Gtk/Perspex.Cairo/Renderer.cs b/src/Gtk/Perspex.Cairo/Renderer.cs index 58bc1f3861..1959eb940e 100644 --- a/src/Gtk/Perspex.Cairo/Renderer.cs +++ b/src/Gtk/Perspex.Cairo/Renderer.cs @@ -1,27 +1,24 @@ - - - - +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. +using System; +using System.Runtime.InteropServices; +using Perspex.Cairo.Media; +using Perspex.Media; +using Perspex.Platform; +using Perspex.Rendering; namespace Perspex.Cairo { - using System; - using System.Runtime.InteropServices; using global::Cairo; - using Perspex.Cairo.Media; - using Perspex.Media; - using Perspex.Platform; - using Perspex.Rendering; - using Matrix = Perspex.Matrix; /// /// A cairo renderer. /// public class Renderer : RendererBase { - private Surface surface; - private Gdk.Window window; + private Surface _surface; + private Gdk.Window _window; /// /// Initializes a new instance of the class. @@ -35,7 +32,7 @@ namespace Perspex.Cairo public Renderer(ImageSurface surface) { - this.surface = surface; + _surface = surface; } /// @@ -47,7 +44,7 @@ namespace Perspex.Cairo { // Don't need to do anything here. } - + /// /// Creates a cairo surface that targets a platform-specific resource. @@ -56,16 +53,15 @@ namespace Perspex.Cairo /// A surface wrapped in an . protected override IDrawingContext CreateDrawingContext(IPlatformHandle handle) { - switch (handle.HandleDescriptor) { case "RTB": - return new DrawingContext(this.surface); + return new DrawingContext(_surface); case "GdkWindow": - if (this.window == null) - this.window = new Gdk.Window(handle.Handle); + if (_window == null) + _window = new Gdk.Window(handle.Handle); - return new DrawingContext(this.window); + return new DrawingContext(_window); default: throw new NotSupportedException(string.Format( "Don't know how to create a Cairo renderer from a '{0}' handle", diff --git a/src/Gtk/Perspex.Gtk/AssetLoader.cs b/src/Gtk/Perspex.Gtk/AssetLoader.cs index a875810b3c..d39b27d088 100644 --- a/src/Gtk/Perspex.Gtk/AssetLoader.cs +++ b/src/Gtk/Perspex.Gtk/AssetLoader.cs @@ -1,18 +1,15 @@ - - - - +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. +using System; +using System.Globalization; +using System.IO; +using System.Reflection; +using System.Resources; +using Perspex.Platform; namespace Perspex.Gtk { - using System; - using System.Globalization; - using System.IO; - using System.Reflection; - using System.Resources; - using Perspex.Platform; - /// /// Loads assets compiled into the application binary. /// diff --git a/src/Gtk/Perspex.Gtk/ClipboardImpl.cs b/src/Gtk/Perspex.Gtk/ClipboardImpl.cs index d220a0c6b5..e5cf15723d 100644 --- a/src/Gtk/Perspex.Gtk/ClipboardImpl.cs +++ b/src/Gtk/Perspex.Gtk/ClipboardImpl.cs @@ -1,14 +1,16 @@ -namespace Perspex.Gtk +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. + +using System; +using System.Threading.Tasks; +using Gdk; +using Perspex.Input.Platform; + +namespace Perspex.Gtk { - using Gdk; - using System; - using System.Collections.Generic; - using System.Linq; - using System.Text; - using System.Threading.Tasks; - using Perspex.Input.Platform; using Gtk = global::Gtk; - class ClipboardImpl : IClipboard + + internal class ClipboardImpl : IClipboard { private static Gtk.Clipboard GetClipboard() => Gtk.Clipboard.GetForDisplay(Gdk.Display.Default, new Atom(IntPtr.Zero)); diff --git a/src/Gtk/Perspex.Gtk/CursorFactory.cs b/src/Gtk/Perspex.Gtk/CursorFactory.cs index c3e90f578c..fe41b0c2db 100644 --- a/src/Gtk/Perspex.Gtk/CursorFactory.cs +++ b/src/Gtk/Perspex.Gtk/CursorFactory.cs @@ -1,15 +1,16 @@ -namespace Perspex.Gtk +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. + +using System.Collections.Generic; +using Gdk; +using Perspex.Input; +using Perspex.Platform; + +namespace Perspex.Gtk { - using System; - using System.Collections.Generic; - using System.Linq; - using System.Text; - using System.Threading.Tasks; - using Gdk; using Gtk = global::Gtk; - using Perspex.Input; - using Perspex.Platform; - class CursorFactory : IStandardCursorFactory + + internal class CursorFactory : IStandardCursorFactory { public static CursorFactory Instance { get; } = new CursorFactory(); @@ -17,7 +18,7 @@ { } - private static readonly Dictionary CursorTypeMapping = new Dictionary + private static readonly Dictionary s_cursorTypeMapping = new Dictionary { { StandardCursorType.AppStarting, CursorType.Watch }, @@ -36,10 +37,10 @@ { StandardCursorType.Help, Gtk.Stock.Help } }; - private static readonly Dictionary Cache = + private static readonly Dictionary s_cache = new Dictionary(); - Gdk.Cursor GetCursor(object desc) + private Gdk.Cursor GetCursor(object desc) { Gdk.Cursor rv; var name = desc as string; @@ -51,23 +52,22 @@ } else { - rv = new Gdk.Cursor((CursorType) desc); + rv = new Gdk.Cursor((CursorType)desc); } rv.Owned = false; return rv; - } public IPlatformHandle GetCursor(StandardCursorType cursorType) { IPlatformHandle rv; - if (!Cache.TryGetValue(cursorType, out rv)) + if (!s_cache.TryGetValue(cursorType, out rv)) { - Cache[cursorType] = + s_cache[cursorType] = rv = new PlatformHandle( - GetCursor(CursorTypeMapping[cursorType]).Handle, + GetCursor(s_cursorTypeMapping[cursorType]).Handle, "GTKCURSOR"); } diff --git a/src/Gtk/Perspex.Gtk/GtkExtensions.cs b/src/Gtk/Perspex.Gtk/GtkExtensions.cs index 7674347e88..691a17c391 100644 --- a/src/Gtk/Perspex.Gtk/GtkExtensions.cs +++ b/src/Gtk/Perspex.Gtk/GtkExtensions.cs @@ -1,8 +1,5 @@ - - - - - +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. namespace Perspex.Gtk { diff --git a/src/Gtk/Perspex.Gtk/GtkPlatform.cs b/src/Gtk/Perspex.Gtk/GtkPlatform.cs index fb23e28b22..ae0d45a38b 100644 --- a/src/Gtk/Perspex.Gtk/GtkPlatform.cs +++ b/src/Gtk/Perspex.Gtk/GtkPlatform.cs @@ -1,22 +1,20 @@ - - - - +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. +using System; +using System.Reactive.Disposables; +using Perspex.Input.Platform; +using Perspex.Input; +using Perspex.Platform; +using Splat; namespace Perspex.Gtk { - using System; - using System.Reactive.Disposables; - using Perspex.Input.Platform; - using Perspex.Input; - using Perspex.Platform; - using Splat; using Gtk = global::Gtk; public class GtkPlatform : IPlatformThreadingInterface, IPlatformSettings { - private static GtkPlatform instance = new GtkPlatform(); + private static GtkPlatform s_instance = new GtkPlatform(); public GtkPlatform() { @@ -42,11 +40,11 @@ namespace Perspex.Gtk var locator = Locator.CurrentMutable; locator.Register(() => new WindowImpl(), typeof(IWindowImpl)); locator.Register(() => new PopupImpl(), typeof(IPopupImpl)); - locator.Register(() => new ClipboardImpl(), typeof (IClipboard)); + locator.Register(() => new ClipboardImpl(), typeof(IClipboard)); locator.Register(() => CursorFactory.Instance, typeof(IStandardCursorFactory)); locator.Register(() => GtkKeyboardDevice.Instance, typeof(IKeyboardDevice)); - locator.Register(() => instance, typeof(IPlatformSettings)); - locator.Register(() => instance, typeof(IPlatformThreadingInterface)); + locator.Register(() => s_instance, typeof(IPlatformSettings)); + locator.Register(() => s_instance, typeof(IPlatformThreadingInterface)); locator.RegisterConstant(new AssetLoader(), typeof(IAssetLoader)); } @@ -64,7 +62,7 @@ namespace Perspex.Gtk { var result = true; var handle = GLib.Timeout.Add( - (uint)interval.TotalMilliseconds, + (uint)interval.TotalMilliseconds, () => { tick(); diff --git a/src/Gtk/Perspex.Gtk/Input/GtkKeyboardDevice.cs b/src/Gtk/Perspex.Gtk/Input/GtkKeyboardDevice.cs index 89f9bf3884..dfad9907dc 100644 --- a/src/Gtk/Perspex.Gtk/Input/GtkKeyboardDevice.cs +++ b/src/Gtk/Perspex.Gtk/Input/GtkKeyboardDevice.cs @@ -1,30 +1,27 @@ - - - - +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. +using System; +using System.Collections.Generic; +using System.Reflection; +using Perspex.Input; namespace Perspex.Gtk { - using System; - using System.Collections.Generic; - using System.Reflection; - using Perspex.Input; - public class GtkKeyboardDevice : KeyboardDevice { - private static GtkKeyboardDevice instance; - private static readonly Dictionary NameDic = new Dictionary(); + private static GtkKeyboardDevice s_instance; + private static readonly Dictionary s_nameDic = new Dictionary(); static GtkKeyboardDevice() { - instance = new GtkKeyboardDevice(); - foreach (var f in typeof (Gdk.Key).GetFields(BindingFlags.Public | BindingFlags.Static)) + s_instance = new GtkKeyboardDevice(); + foreach (var f in typeof(Gdk.Key).GetFields(BindingFlags.Public | BindingFlags.Static)) { - var key = (Gdk.Key) f.GetValue(null); - if(NameDic.ContainsKey(key)) + var key = (Gdk.Key)f.GetValue(null); + if (s_nameDic.ContainsKey(key)) continue; - NameDic[key] = f.Name; + s_nameDic[key] = f.Name; } } @@ -34,7 +31,7 @@ namespace Perspex.Gtk public static new GtkKeyboardDevice Instance { - get { return instance; } + get { return s_instance; } } public static Perspex.Input.Key ConvertKey(Gdk.Key key) @@ -47,7 +44,7 @@ namespace Perspex.Gtk else { string s; - if (!NameDic.TryGetValue(key, out s)) + if (!s_nameDic.TryGetValue(key, out s)) s = "Unknown"; Perspex.Input.Key result; diff --git a/src/Gtk/Perspex.Gtk/Input/GtkMouseDevice.cs b/src/Gtk/Perspex.Gtk/Input/GtkMouseDevice.cs index b136d522ef..fb62dcd295 100644 --- a/src/Gtk/Perspex.Gtk/Input/GtkMouseDevice.cs +++ b/src/Gtk/Perspex.Gtk/Input/GtkMouseDevice.cs @@ -1,21 +1,18 @@ - - - - +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. +using Perspex.Input; namespace Perspex.Gtk { - using Perspex.Input; - public class GtkMouseDevice : MouseDevice { - private static GtkMouseDevice instance; + private static GtkMouseDevice s_instance; - private Point clientPosition; + private Point _clientPosition; static GtkMouseDevice() { - instance = new GtkMouseDevice(); + s_instance = new GtkMouseDevice(); } private GtkMouseDevice() @@ -24,12 +21,12 @@ namespace Perspex.Gtk public static new GtkMouseDevice Instance { - get { return instance; } + get { return s_instance; } } internal void SetClientPosition(Point p) { - this.clientPosition = p; + _clientPosition = p; } } } \ No newline at end of file diff --git a/src/Gtk/Perspex.Gtk/PopupImpl.cs b/src/Gtk/Perspex.Gtk/PopupImpl.cs index 50c147cbd3..27b0caf2ef 100644 --- a/src/Gtk/Perspex.Gtk/PopupImpl.cs +++ b/src/Gtk/Perspex.Gtk/PopupImpl.cs @@ -1,22 +1,18 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. + +using Gtk; +using Perspex.Platform; namespace Perspex.Gtk { - using System; - using Perspex.Platform; - using global::Gtk; - public class PopupImpl : WindowImpl, IPopupImpl { public PopupImpl() : base(WindowType.Popup) - { + { } - + public void SetPosition(Point p) { this.Move((int)p.X, (int)p.Y); diff --git a/src/Gtk/Perspex.Gtk/Properties/AssemblyInfo.cs b/src/Gtk/Perspex.Gtk/Properties/AssemblyInfo.cs index 2242fab189..46f447c301 100644 --- a/src/Gtk/Perspex.Gtk/Properties/AssemblyInfo.cs +++ b/src/Gtk/Perspex.Gtk/Properties/AssemblyInfo.cs @@ -1,8 +1,5 @@ - - - - - +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. using System.Reflection; using System.Runtime.CompilerServices; diff --git a/src/Gtk/Perspex.Gtk/WindowImpl.cs b/src/Gtk/Perspex.Gtk/WindowImpl.cs index f2230474b3..bb374043b6 100644 --- a/src/Gtk/Perspex.Gtk/WindowImpl.cs +++ b/src/Gtk/Perspex.Gtk/WindowImpl.cs @@ -1,35 +1,32 @@ - - - - - +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. +using System; +using System.Reactive.Disposables; using Gdk; +using Perspex.Controls; +using Perspex.Input.Raw; +using Perspex.Platform; using Perspex.Input; +using Action = System.Action; namespace Perspex.Gtk { - using System; - using System.Threading.Tasks; - using Perspex.Controls; - using Perspex.Input.Raw; - using Perspex.Platform; using Gtk = global::Gtk; - using System.Reactive.Disposables; public class WindowImpl : Gtk.Window, IWindowImpl { - private TopLevel owner; + private TopLevel _owner; - private IPlatformHandle windowHandle; + private IPlatformHandle _windowHandle; - private Size clientSize; + private Size _clientSize; - private Gtk.IMContext imContext; + private Gtk.IMContext _imContext; - private uint lastKeyEventTimestamp; + private uint _lastKeyEventTimestamp; - private static readonly Gdk.Cursor DefaultCursor = new Gdk.Cursor(CursorType.LeftPtr); + private static readonly Gdk.Cursor s_defaultCursor = new Gdk.Cursor(CursorType.LeftPtr); public WindowImpl() : base(Gtk.WindowType.Toplevel) @@ -49,9 +46,9 @@ namespace Perspex.Gtk this.Events = Gdk.EventMask.PointerMotionMask | Gdk.EventMask.ButtonPressMask | Gdk.EventMask.ButtonReleaseMask; - this.windowHandle = new PlatformHandle(this.Handle, "GtkWindow"); - this.imContext = new Gtk.IMMulticontext(); - this.imContext.Commit += ImContext_Commit; + _windowHandle = new PlatformHandle(this.Handle, "GtkWindow"); + _imContext = new Gtk.IMMulticontext(); + _imContext.Commit += ImContext_Commit; } public Size ClientSize @@ -62,7 +59,7 @@ namespace Perspex.Gtk IPlatformHandle ITopLevelImpl.Handle { - get { return this.windowHandle; } + get { return _windowHandle; } } public Action Activated { get; set; } @@ -93,13 +90,13 @@ namespace Perspex.Gtk { int x, y; this.GdkWindow.GetDeskrelativeOrigin(out x, out y); - + return new Point(point.X + x, point.Y + y); } public void SetOwner(TopLevel owner) { - this.owner = owner; + _owner = owner; } public void SetTitle(string title) @@ -110,7 +107,7 @@ namespace Perspex.Gtk public void SetCursor(IPlatformHandle cursor) { - GdkWindow.Cursor = cursor != null ? new Gdk.Cursor(cursor.Handle) : DefaultCursor; + GdkWindow.Cursor = cursor != null ? new Gdk.Cursor(cursor.Handle) : s_defaultCursor; } public IDisposable ShowDialog() @@ -144,7 +141,7 @@ namespace Perspex.Gtk var e = new RawMouseEventArgs( GtkMouseDevice.Instance, evnt.Time, - this.owner, + _owner, RawMouseEventType.LeftButtonDown, new Point(evnt.X, evnt.Y), GetModifierKeys(evnt.State)); this.Input(e); @@ -156,7 +153,7 @@ namespace Perspex.Gtk var e = new RawMouseEventArgs( GtkMouseDevice.Instance, evnt.Time, - this.owner, + _owner, RawMouseEventType.LeftButtonUp, new Point(evnt.X, evnt.Y), GetModifierKeys(evnt.State)); this.Input(e); @@ -166,8 +163,8 @@ namespace Perspex.Gtk protected override bool OnConfigureEvent(Gdk.EventConfigure evnt) { var newSize = new Size(evnt.Width, evnt.Height); - - if (newSize != this.clientSize) + + if (newSize != _clientSize) { this.Resized(newSize); } @@ -182,8 +179,8 @@ namespace Perspex.Gtk private bool ProcessKeyEvent(Gdk.EventKey evnt) { - this.lastKeyEventTimestamp = evnt.Time; - if (this.imContext.FilterKeypress(evnt)) + _lastKeyEventTimestamp = evnt.Time; + if (_imContext.FilterKeypress(evnt)) return true; var e = new RawKeyEventArgs( GtkKeyboardDevice.Instance, @@ -200,7 +197,7 @@ namespace Perspex.Gtk private void ImContext_Commit(object o, Gtk.CommitArgs args) { - this.Input(new RawTextInputEventArgs(GtkKeyboardDevice.Instance, this.lastKeyEventTimestamp, args.Str)); + this.Input(new RawTextInputEventArgs(GtkKeyboardDevice.Instance, _lastKeyEventTimestamp, args.Str)); } protected override bool OnExposeEvent(Gdk.EventExpose evnt) @@ -223,7 +220,7 @@ namespace Perspex.Gtk var e = new RawMouseEventArgs( GtkMouseDevice.Instance, evnt.Time, - this.owner, + _owner, RawMouseEventType.Move, position, GetModifierKeys(evnt.State)); this.Input(e); diff --git a/src/Markup/Perspex.Markup.Xaml/Context/PerspexObjectAssembler.cs b/src/Markup/Perspex.Markup.Xaml/Context/PerspexObjectAssembler.cs index e631a70c37..fc44abb5b9 100644 --- a/src/Markup/Perspex.Markup.Xaml/Context/PerspexObjectAssembler.cs +++ b/src/Markup/Perspex.Markup.Xaml/Context/PerspexObjectAssembler.cs @@ -1,19 +1,16 @@ - - - - +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. +using System; +using OmniXaml; +using OmniXaml.ObjectAssembler; +using Perspex.Markup.Xaml.Templates; namespace Perspex.Markup.Xaml.Context { - using System; - using OmniXaml; - using OmniXaml.ObjectAssembler; - using Templates; - public class PerspexObjectAssembler : IObjectAssembler { - private readonly TemplateHostingObjectAssembler objectAssembler; + private readonly TemplateHostingObjectAssembler _objectAssembler; public PerspexObjectAssembler(IWiringContext wiringContext, ObjectAssemblerSettings objectAssemblerSettings = null) { @@ -21,24 +18,24 @@ namespace Perspex.Markup.Xaml.Context mapping.Map(template => template.Content, new TemplateLoader()); var assembler = new ObjectAssembler(wiringContext, new TopDownMemberValueContext(), objectAssemblerSettings); - this.objectAssembler = new TemplateHostingObjectAssembler(assembler, mapping); + _objectAssembler = new TemplateHostingObjectAssembler(assembler, mapping); } - public object Result => this.objectAssembler.Result; + public object Result => _objectAssembler.Result; public EventHandler XamlSetValueHandler { get; set; } - public IWiringContext WiringContext => this.objectAssembler.WiringContext; + public IWiringContext WiringContext => _objectAssembler.WiringContext; public void Process(XamlInstruction node) { - this.objectAssembler.Process(node); + _objectAssembler.Process(node); } public void OverrideInstance(object instance) { - this.objectAssembler.OverrideInstance(instance); + _objectAssembler.OverrideInstance(instance); } } } \ No newline at end of file diff --git a/src/Markup/Perspex.Markup.Xaml/Context/PerspexParserFactory.cs b/src/Markup/Perspex.Markup.Xaml/Context/PerspexParserFactory.cs index bb6705a599..920880d054 100644 --- a/src/Markup/Perspex.Markup.Xaml/Context/PerspexParserFactory.cs +++ b/src/Markup/Perspex.Markup.Xaml/Context/PerspexParserFactory.cs @@ -1,19 +1,16 @@ +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. - - - - +using OmniXaml; +using OmniXaml.ObjectAssembler; +using OmniXaml.Parsers.ProtoParser; +using OmniXaml.Parsers.XamlInstructions; namespace Perspex.Markup.Xaml.Context { - using OmniXaml; - using OmniXaml.ObjectAssembler; - using OmniXaml.Parsers.ProtoParser; - using OmniXaml.Parsers.XamlInstructions; - public class PerspexParserFactory : IXamlParserFactory { - private readonly IWiringContext wiringContext; + private readonly IWiringContext _wiringContext; public PerspexParserFactory() : this(new TypeFactory()) @@ -22,7 +19,7 @@ namespace Perspex.Markup.Xaml.Context public PerspexParserFactory(ITypeFactory typeFactory) { - this.wiringContext = new PerspexWiringContext(typeFactory); + _wiringContext = new PerspexWiringContext(typeFactory); } public IXamlParser CreateForReadingFree() @@ -34,10 +31,10 @@ namespace Perspex.Markup.Xaml.Context private IXamlParser CreateParser(IObjectAssembler objectAssemblerForUndefinedRoot) { - var xamlInstructionParser = new OrderAwareXamlInstructionParser(new XamlInstructionParser(this.wiringContext)); + var xamlInstructionParser = new OrderAwareXamlInstructionParser(new XamlInstructionParser(_wiringContext)); var phaseParserKit = new PhaseParserKit( - new XamlProtoInstructionParser(this.wiringContext), + new XamlProtoInstructionParser(_wiringContext), xamlInstructionParser, objectAssemblerForUndefinedRoot); @@ -46,7 +43,7 @@ namespace Perspex.Markup.Xaml.Context private IObjectAssembler GetObjectAssemblerForUndefinedRoot() { - return new ObjectAssembler(this.wiringContext, new TopDownMemberValueContext()); + return new ObjectAssembler(_wiringContext, new TopDownMemberValueContext()); } public IXamlParser CreateForReadingSpecificInstance(object rootInstance) @@ -58,7 +55,7 @@ namespace Perspex.Markup.Xaml.Context private IObjectAssembler GetObjectAssemblerForSpecificRoot(object rootInstance) { - return new PerspexObjectAssembler(this.wiringContext, new ObjectAssemblerSettings { RootInstance = rootInstance }); + return new PerspexObjectAssembler(_wiringContext, new ObjectAssemblerSettings { RootInstance = rootInstance }); } } } \ No newline at end of file diff --git a/src/Markup/Perspex.Markup.Xaml/Context/PerspexTypeRepository.cs b/src/Markup/Perspex.Markup.Xaml/Context/PerspexTypeRepository.cs index 0b2c8e2891..9635720149 100644 --- a/src/Markup/Perspex.Markup.Xaml/Context/PerspexTypeRepository.cs +++ b/src/Markup/Perspex.Markup.Xaml/Context/PerspexTypeRepository.cs @@ -1,35 +1,32 @@ +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. - - - - +using System; +using Glass; +using OmniXaml; +using OmniXaml.Typing; +using Perspex.Markup.Xaml.DataBinding; namespace Perspex.Markup.Xaml.Context { - using System; - using DataBinding; - using Glass; - using OmniXaml; - using OmniXaml.Typing; - public class PerspexTypeRepository : XamlTypeRepository { - private readonly ITypeFactory typeFactory; - private readonly IPerspexPropertyBinder propertyBinder; + private readonly ITypeFactory _typeFactory; + private readonly IPerspexPropertyBinder _propertyBinder; public PerspexTypeRepository(IXamlNamespaceRegistry xamlNamespaceRegistry, ITypeFactory typeFactory, ITypeFeatureProvider featureProvider, IPerspexPropertyBinder propertyBinder) : base(xamlNamespaceRegistry, typeFactory, featureProvider) { - this.typeFactory = typeFactory; - this.propertyBinder = propertyBinder; + _typeFactory = typeFactory; + _propertyBinder = propertyBinder; } public override XamlType GetXamlType(Type type) { Guard.ThrowIfNull(type, nameof(type)); - return new PerspexXamlType(type, this, this.typeFactory, this.FeatureProvider, this.propertyBinder); + return new PerspexXamlType(type, this, _typeFactory, this.FeatureProvider, _propertyBinder); } } } \ No newline at end of file diff --git a/src/Markup/Perspex.Markup.Xaml/Context/PerspexWiringContext.cs b/src/Markup/Perspex.Markup.Xaml/Context/PerspexWiringContext.cs index adbed2ad9b..7ab5758f41 100644 --- a/src/Markup/Perspex.Markup.Xaml/Context/PerspexWiringContext.cs +++ b/src/Markup/Perspex.Markup.Xaml/Context/PerspexWiringContext.cs @@ -1,30 +1,27 @@ - - - - - +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. + +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Reflection; +using Glass; +using OmniXaml; +using OmniXaml.Builder; +using OmniXaml.TypeConversion; +using OmniXaml.Typing; +using Perspex.Controls; +using Perspex.Markup.Xaml.Templates; +using Perspex.Markup.Xaml.Converters; +using Perspex.Markup.Xaml.DataBinding; +using Perspex.Markup.Xaml.MarkupExtensions; +using Perspex.Media; +using Perspex.Media.Imaging; namespace Perspex.Markup.Xaml.Context { - using System.Collections.Generic; - using System.Collections.ObjectModel; - using System.Reflection; - using Controls; - using Converters; - using DataBinding; - using Glass; - using MarkupExtensions; - using Media; - using Media.Imaging; - using OmniXaml; - using OmniXaml.Builder; - using OmniXaml.TypeConversion; - using OmniXaml.Typing; - using Templates; - public class PerspexWiringContext : IWiringContext { - private readonly WiringContext context; + private readonly WiringContext _context; private const string PerspexNs = "https://github.com/grokys/Perspex"; public PerspexWiringContext(ITypeFactory typeFactory) @@ -35,7 +32,7 @@ namespace Perspex.Markup.Xaml.Context var perspexPropertyBinder = new PerspexPropertyBinder(featureProvider.ConverterProvider); var xamlTypeRepository = new PerspexTypeRepository(xamlNamespaceRegistry, typeFactory, featureProvider, perspexPropertyBinder); var typeContext = new TypeContext(xamlTypeRepository, xamlNamespaceRegistry, typeFactory); - this.context = new WiringContext(typeContext, featureProvider); + _context = new WiringContext(typeContext, featureProvider); } private static XamlNamespaceRegistry CreateXamlNamespaceRegistry() @@ -114,8 +111,8 @@ namespace Perspex.Markup.Xaml.Context return contentPropertyProvider; } - public ITypeContext TypeContext => this.context.TypeContext; + public ITypeContext TypeContext => _context.TypeContext; - public ITypeFeatureProvider FeatureProvider => this.context.FeatureProvider; + public ITypeFeatureProvider FeatureProvider => _context.FeatureProvider; } } \ No newline at end of file diff --git a/src/Markup/Perspex.Markup.Xaml/Context/PerspexXamlMember.cs b/src/Markup/Perspex.Markup.Xaml/Context/PerspexXamlMember.cs index 26d3eba7bf..dc4c4cbde2 100644 --- a/src/Markup/Perspex.Markup.Xaml/Context/PerspexXamlMember.cs +++ b/src/Markup/Perspex.Markup.Xaml/Context/PerspexXamlMember.cs @@ -1,18 +1,15 @@ +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. - - - - +using Perspex.Markup.Xaml.DataBinding; +using OmniXaml; +using OmniXaml.Typing; namespace Perspex.Markup.Xaml.Context { - using DataBinding; - using OmniXaml; - using OmniXaml.Typing; - public class PerspexXamlMember : XamlMember { - private readonly IPerspexPropertyBinder propertyBinder; + private readonly IPerspexPropertyBinder _propertyBinder; public PerspexXamlMember(string name, XamlType owner, @@ -21,12 +18,12 @@ namespace Perspex.Markup.Xaml.Context IPerspexPropertyBinder propertyBinder) : base(name, owner, xamlTypeRepository, featureProvider) { - this.propertyBinder = propertyBinder; + _propertyBinder = propertyBinder; } protected override IXamlMemberValuePlugin LookupXamlMemberValueConnector() { - return new PerspexXamlMemberValuePlugin(this, this.propertyBinder); + return new PerspexXamlMemberValuePlugin(this, _propertyBinder); } public override string ToString() diff --git a/src/Markup/Perspex.Markup.Xaml/Context/PerspexXamlMemberValuePlugin.cs b/src/Markup/Perspex.Markup.Xaml/Context/PerspexXamlMemberValuePlugin.cs index 58fdbb8d6e..4f9dc54db5 100644 --- a/src/Markup/Perspex.Markup.Xaml/Context/PerspexXamlMemberValuePlugin.cs +++ b/src/Markup/Perspex.Markup.Xaml/Context/PerspexXamlMemberValuePlugin.cs @@ -1,27 +1,24 @@ +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. - - - - +using System; +using System.Reactive.Linq; +using Glass; +using OmniXaml.Typing; +using Perspex.Controls; +using Perspex.Markup.Xaml.DataBinding; namespace Perspex.Markup.Xaml.Context { - using System; - using System.Reactive.Linq; - using Controls; - using DataBinding; - using Glass; - using OmniXaml.Typing; - public class PerspexXamlMemberValuePlugin : MemberValuePlugin { - private readonly XamlMember xamlMember; - private readonly IPerspexPropertyBinder propertyBinder; + private readonly XamlMember _xamlMember; + private readonly IPerspexPropertyBinder _propertyBinder; public PerspexXamlMemberValuePlugin(XamlMember xamlMember, IPerspexPropertyBinder propertyBinder) : base(xamlMember) { - this.xamlMember = xamlMember; - this.propertyBinder = propertyBinder; + _xamlMember = xamlMember; + _propertyBinder = propertyBinder; } public override void SetValue(object instance, object value) @@ -63,7 +60,7 @@ namespace Perspex.Markup.Xaml.Context private void HandleXamlBindingDefinition(XamlBindingDefinition xamlBindingDefinition) { PerspexObject subjectObject = xamlBindingDefinition.Target; - this.propertyBinder.Create(xamlBindingDefinition); + _propertyBinder.Create(xamlBindingDefinition); var observableForDataContext = subjectObject.GetObservable(Control.DataContextProperty); observableForDataContext.Where(o => o != null).Subscribe(_ => this.BindToDataContextWhenItsSet(xamlBindingDefinition)); @@ -74,7 +71,7 @@ namespace Perspex.Markup.Xaml.Context var target = definition.Target; var dataContext = target.DataContext; - var binding = this.propertyBinder.GetBinding(target, definition.TargetProperty); + var binding = _propertyBinder.GetBinding(target, definition.TargetProperty); binding.BindToDataContext(dataContext); } @@ -83,8 +80,8 @@ namespace Perspex.Markup.Xaml.Context { get { - var underlyingType = this.xamlMember.DeclaringType.UnderlyingType; - var name = this.xamlMember.Name + "Property"; + var underlyingType = _xamlMember.DeclaringType.UnderlyingType; + var name = _xamlMember.Name + "Property"; var value = ReflectionExtensions.GetValueOfStaticField(underlyingType, name); return value as PerspexProperty; @@ -100,7 +97,7 @@ namespace Perspex.Markup.Xaml.Context public override string ToString() { - return $"{{Perspex Value Connector for member {this.xamlMember}}}"; + return $"{{Perspex Value Connector for member {_xamlMember}}}"; } } } \ No newline at end of file diff --git a/src/Markup/Perspex.Markup.Xaml/Context/PerspexXamlType.cs b/src/Markup/Perspex.Markup.Xaml/Context/PerspexXamlType.cs index 742acb7dbc..350d34a00f 100644 --- a/src/Markup/Perspex.Markup.Xaml/Context/PerspexXamlType.cs +++ b/src/Markup/Perspex.Markup.Xaml/Context/PerspexXamlType.cs @@ -1,19 +1,16 @@ +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. - - - - +using System; +using OmniXaml; +using OmniXaml.Typing; +using Perspex.Markup.Xaml.DataBinding; namespace Perspex.Markup.Xaml.Context { - using System; - using DataBinding; - using OmniXaml; - using OmniXaml.Typing; - public class PerspexXamlType : XamlType { - private readonly IPerspexPropertyBinder propertyBinder; + private readonly IPerspexPropertyBinder _propertyBinder; public PerspexXamlType(Type type, IXamlTypeRepository typeRepository, @@ -21,14 +18,14 @@ namespace Perspex.Markup.Xaml.Context ITypeFeatureProvider featureProvider, IPerspexPropertyBinder propertyBinder) : base(type, typeRepository, typeFactory, featureProvider) { - this.propertyBinder = propertyBinder; + _propertyBinder = propertyBinder; } - protected IPerspexPropertyBinder PropertyBinder => this.propertyBinder; + protected IPerspexPropertyBinder PropertyBinder => _propertyBinder; protected override XamlMember LookupMember(string name) { - return new PerspexXamlMember(name, this, this.TypeRepository, this.FeatureProvider, this.propertyBinder); + return new PerspexXamlMember(name, this, this.TypeRepository, this.FeatureProvider, _propertyBinder); } public override string ToString() diff --git a/src/Markup/Perspex.Markup.Xaml/Converters/BitmapConverter.cs b/src/Markup/Perspex.Markup.Xaml/Converters/BitmapConverter.cs index 7c73f4205e..392da12630 100644 --- a/src/Markup/Perspex.Markup.Xaml/Converters/BitmapConverter.cs +++ b/src/Markup/Perspex.Markup.Xaml/Converters/BitmapConverter.cs @@ -1,16 +1,13 @@ +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. - - - - +using System; +using System.Globalization; +using OmniXaml.TypeConversion; +using Perspex.Media.Imaging; namespace Perspex.Markup.Xaml.Converters { - using System; - using System.Globalization; - using Media.Imaging; - using OmniXaml.TypeConversion; - public class BitmapConverter : ITypeConverter { public bool CanConvertFrom(IXamlTypeConverterContext context, Type sourceType) diff --git a/src/Markup/Perspex.Markup.Xaml/Converters/BrushConverter.cs b/src/Markup/Perspex.Markup.Xaml/Converters/BrushConverter.cs index d5cf685186..d734caf37a 100644 --- a/src/Markup/Perspex.Markup.Xaml/Converters/BrushConverter.cs +++ b/src/Markup/Perspex.Markup.Xaml/Converters/BrushConverter.cs @@ -1,16 +1,13 @@ +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. - - - - +using System; +using System.Globalization; +using OmniXaml.TypeConversion; +using Perspex.Media; namespace Perspex.Markup.Xaml.Converters { - using System; - using System.Globalization; - using Media; - using OmniXaml.TypeConversion; - public class BrushConverter : ITypeConverter { public bool CanConvertFrom(IXamlTypeConverterContext context, Type sourceType) diff --git a/src/Markup/Perspex.Markup.Xaml/Converters/ColumnDefinitionsTypeConverter.cs b/src/Markup/Perspex.Markup.Xaml/Converters/ColumnDefinitionsTypeConverter.cs index d84f552ab6..bbb1034200 100644 --- a/src/Markup/Perspex.Markup.Xaml/Converters/ColumnDefinitionsTypeConverter.cs +++ b/src/Markup/Perspex.Markup.Xaml/Converters/ColumnDefinitionsTypeConverter.cs @@ -1,16 +1,13 @@ - - - - +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. +using System; +using System.Globalization; +using OmniXaml.TypeConversion; +using Perspex.Controls; namespace Perspex.Markup.Xaml.Converters { - using System; - using System.Globalization; - using Controls; - using OmniXaml.TypeConversion; - public class ColumnDefinitionsTypeConverter : ITypeConverter { public bool CanConvertFrom(IXamlTypeConverterContext context, Type sourceType) diff --git a/src/Markup/Perspex.Markup.Xaml/Converters/GridLengthTypeConverter.cs b/src/Markup/Perspex.Markup.Xaml/Converters/GridLengthTypeConverter.cs index 2cf98dcf00..731af9465d 100644 --- a/src/Markup/Perspex.Markup.Xaml/Converters/GridLengthTypeConverter.cs +++ b/src/Markup/Perspex.Markup.Xaml/Converters/GridLengthTypeConverter.cs @@ -1,16 +1,13 @@ - - - - +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. +using System; +using System.Globalization; +using OmniXaml.TypeConversion; +using Perspex.Controls; namespace Perspex.Markup.Xaml.Converters { - using System; - using System.Globalization; - using Controls; - using OmniXaml.TypeConversion; - public class GridLengthTypeConverter : ITypeConverter { public bool CanConvertFrom(IXamlTypeConverterContext context, Type sourceType) diff --git a/src/Markup/Perspex.Markup.Xaml/Converters/RowDefinitionsTypeConverter.cs b/src/Markup/Perspex.Markup.Xaml/Converters/RowDefinitionsTypeConverter.cs index a9aa0e5409..bb3ed8978b 100644 --- a/src/Markup/Perspex.Markup.Xaml/Converters/RowDefinitionsTypeConverter.cs +++ b/src/Markup/Perspex.Markup.Xaml/Converters/RowDefinitionsTypeConverter.cs @@ -1,16 +1,13 @@ - - - - +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. +using System; +using System.Globalization; +using OmniXaml.TypeConversion; +using Perspex.Controls; namespace Perspex.Markup.Xaml.Converters { - using System; - using System.Globalization; - using Controls; - using OmniXaml.TypeConversion; - public class RowDefinitionsTypeConverter : ITypeConverter { public bool CanConvertFrom(IXamlTypeConverterContext context, Type sourceType) diff --git a/src/Markup/Perspex.Markup.Xaml/Converters/ThicknessConverter.cs b/src/Markup/Perspex.Markup.Xaml/Converters/ThicknessConverter.cs index d5db52c53d..a001913711 100644 --- a/src/Markup/Perspex.Markup.Xaml/Converters/ThicknessConverter.cs +++ b/src/Markup/Perspex.Markup.Xaml/Converters/ThicknessConverter.cs @@ -1,15 +1,12 @@ - - - - +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. +using System; +using System.Globalization; +using OmniXaml.TypeConversion; namespace Perspex.Markup.Xaml.Converters { - using System; - using System.Globalization; - using OmniXaml.TypeConversion; - public class ThicknessConverter : ITypeConverter { public bool CanConvertFrom(IXamlTypeConverterContext context, Type sourceType) diff --git a/src/Markup/Perspex.Markup.Xaml/DataBinding/ChangeTracking/ObservablePropertyBranch.cs b/src/Markup/Perspex.Markup.Xaml/DataBinding/ChangeTracking/ObservablePropertyBranch.cs index 82b57f059c..b4eb4e4fed 100644 --- a/src/Markup/Perspex.Markup.Xaml/DataBinding/ChangeTracking/ObservablePropertyBranch.cs +++ b/src/Markup/Perspex.Markup.Xaml/DataBinding/ChangeTracking/ObservablePropertyBranch.cs @@ -1,33 +1,30 @@ +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. - - - - +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Linq; +using System.Reactive.Linq; +using System.Reflection; +using Glass; namespace Perspex.Markup.Xaml.DataBinding.ChangeTracking { - using System; - using System.Collections.Generic; - using System.ComponentModel; - using System.Linq; - using System.Reactive.Linq; - using System.Reflection; - using Glass; - public class ObservablePropertyBranch { - private readonly object instance; - private readonly PropertyPath propertyPath; - private readonly PropertyMountPoint mountPoint; + private readonly object _instance; + private readonly PropertyPath _propertyPath; + private readonly PropertyMountPoint _mountPoint; public ObservablePropertyBranch(object instance, PropertyPath propertyPath) { Guard.ThrowIfNull(instance, nameof(instance)); Guard.ThrowIfNull(propertyPath, nameof(propertyPath)); - this.instance = instance; - this.propertyPath = propertyPath; - this.mountPoint = new PropertyMountPoint(instance, propertyPath); + _instance = instance; + _propertyPath = propertyPath; + _mountPoint = new PropertyMountPoint(instance, propertyPath); var properties = this.GetPropertiesThatRaiseNotifications(); this.Values = this.CreateUnifiedObservableFromNodes(properties); } @@ -45,12 +42,12 @@ namespace Perspex.Markup.Xaml.DataBinding.ChangeTracking parentOnPropertyChanged => subscription.Parent.PropertyChanged += parentOnPropertyChanged, parentOnPropertyChanged => subscription.Parent.PropertyChanged -= parentOnPropertyChanged) .Where(pattern => pattern.EventArgs.PropertyName == subscription.PropertyName) - .Select(pattern => this.mountPoint.Value); + .Select(pattern => _mountPoint.Value); } private IEnumerable GetPropertiesThatRaiseNotifications() { - return this.GetSubscriptionsRecursive(this.instance, this.propertyPath, 0); + return this.GetSubscriptionsRecursive(_instance, _propertyPath, 0); } private IEnumerable GetSubscriptionsRecursive(object current, PropertyPath propertyPath, int i) @@ -66,13 +63,13 @@ namespace Perspex.Markup.Xaml.DataBinding.ChangeTracking var nextPropertyName = propertyPath.Chunks[i]; subscriptions.Add(new PropertyDefinition(inpc, nextPropertyName)); - if (i < this.propertyPath.Chunks.Length) + if (i < _propertyPath.Chunks.Length) { var currentObjectTypeInfo = current.GetType().GetTypeInfo(); var nextProperty = currentObjectTypeInfo.GetDeclaredProperty(nextPropertyName); var nextInstance = nextProperty.GetValue(current); - if (i < this.propertyPath.Chunks.Length - 1) + if (i < _propertyPath.Chunks.Length - 1) { subscriptions.AddRange(this.GetSubscriptionsRecursive(nextInstance, propertyPath, i + 1)); } @@ -85,16 +82,16 @@ namespace Perspex.Markup.Xaml.DataBinding.ChangeTracking { get { - return this.mountPoint.Value; + return _mountPoint.Value; } set { - this.mountPoint.Value = value; + _mountPoint.Value = value; } } - public Type Type => this.mountPoint.ProperyType; + public Type Type => _mountPoint.ProperyType; private class PropertyDefinition { diff --git a/src/Markup/Perspex.Markup.Xaml/DataBinding/ChangeTracking/PropertyMountPoint.cs b/src/Markup/Perspex.Markup.Xaml/DataBinding/ChangeTracking/PropertyMountPoint.cs index 6a0df20cf3..8ea903fa55 100644 --- a/src/Markup/Perspex.Markup.Xaml/DataBinding/ChangeTracking/PropertyMountPoint.cs +++ b/src/Markup/Perspex.Markup.Xaml/DataBinding/ChangeTracking/PropertyMountPoint.cs @@ -1,25 +1,22 @@ - - - - +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. +using System; +using System.Reflection; +using Glass; namespace Perspex.Markup.Xaml.DataBinding.ChangeTracking { - using System; - using System.Reflection; - using Glass; - public class PropertyMountPoint { - private readonly TargettedProperty referencedTargettedProperty; + private readonly TargettedProperty _referencedTargettedProperty; public PropertyMountPoint(object origin, PropertyPath propertyPath) { Guard.ThrowIfNull(origin, nameof(origin)); Guard.ThrowIfNull(propertyPath, nameof(propertyPath)); - this.referencedTargettedProperty = GetReferencedPropertyInfo(origin, propertyPath, 0); + _referencedTargettedProperty = GetReferencedPropertyInfo(origin, propertyPath, 0); } private static TargettedProperty GetReferencedPropertyInfo(object current, PropertyPath propertyPath, int level) @@ -41,15 +38,15 @@ namespace Perspex.Markup.Xaml.DataBinding.ChangeTracking { get { - return this.referencedTargettedProperty.Value; + return _referencedTargettedProperty.Value; } set { - this.referencedTargettedProperty.Value = value; + _referencedTargettedProperty.Value = value; } } - public Type ProperyType => this.referencedTargettedProperty.PropertyType; + public Type ProperyType => _referencedTargettedProperty.PropertyType; } } \ No newline at end of file diff --git a/src/Markup/Perspex.Markup.Xaml/DataBinding/ChangeTracking/PropertyPath.cs b/src/Markup/Perspex.Markup.Xaml/DataBinding/ChangeTracking/PropertyPath.cs index ed17a53dab..3558645b1b 100644 --- a/src/Markup/Perspex.Markup.Xaml/DataBinding/ChangeTracking/PropertyPath.cs +++ b/src/Markup/Perspex.Markup.Xaml/DataBinding/ChangeTracking/PropertyPath.cs @@ -1,29 +1,26 @@ - - - - - +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. namespace Perspex.Markup.Xaml.DataBinding.ChangeTracking { public class PropertyPath { - private string[] chunks; + private string[] _chunks; private PropertyPath(PropertyPath propertyPath) { - this.chunks = propertyPath.Chunks; + _chunks = propertyPath.Chunks; } public PropertyPath(string path) { - this.chunks = path.Split('.'); + _chunks = path.Split('.'); } public string[] Chunks { - get { return this.chunks; } - set { this.chunks = value; } + get { return _chunks; } + set { _chunks = value; } } public PropertyPath Clone() @@ -33,7 +30,7 @@ namespace Perspex.Markup.Xaml.DataBinding.ChangeTracking public override string ToString() { - return string.Join(".", this.chunks); + return string.Join(".", _chunks); } } } \ No newline at end of file diff --git a/src/Markup/Perspex.Markup.Xaml/DataBinding/ChangeTracking/TargettedProperty.cs b/src/Markup/Perspex.Markup.Xaml/DataBinding/ChangeTracking/TargettedProperty.cs index 7ee71493a5..fec5edc904 100644 --- a/src/Markup/Perspex.Markup.Xaml/DataBinding/ChangeTracking/TargettedProperty.cs +++ b/src/Markup/Perspex.Markup.Xaml/DataBinding/ChangeTracking/TargettedProperty.cs @@ -1,44 +1,41 @@ +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. - - - - +using System; +using System.Reflection; +using Glass; namespace Perspex.Markup.Xaml.DataBinding.ChangeTracking { - using System; - using System.Reflection; - using Glass; - internal class TargettedProperty { - private readonly object instance; - private readonly PropertyInfo propertyInfo; + private readonly object _instance; + private readonly PropertyInfo _propertyInfo; public TargettedProperty(object instance, PropertyInfo propertyInfo) { Guard.ThrowIfNull(instance, nameof(instance)); Guard.ThrowIfNull(propertyInfo, nameof(propertyInfo)); - this.instance = instance; - this.propertyInfo = propertyInfo; + _instance = instance; + _propertyInfo = propertyInfo; } public object Value { get { - return this.propertyInfo.GetValue(this.instance); + return _propertyInfo.GetValue(_instance); } set { - this.propertyInfo.SetValue(this.instance, value); + _propertyInfo.SetValue(_instance, value); } } - public Type PropertyType => this.propertyInfo.PropertyType; + public Type PropertyType => _propertyInfo.PropertyType; - public string Name => this.propertyInfo.Name; + public string Name => _propertyInfo.Name; } } \ No newline at end of file diff --git a/src/Markup/Perspex.Markup.Xaml/DataBinding/DataContextChangeSynchronizer.cs b/src/Markup/Perspex.Markup.Xaml/DataBinding/DataContextChangeSynchronizer.cs index 71fcf75e13..924398c48d 100644 --- a/src/Markup/Perspex.Markup.Xaml/DataBinding/DataContextChangeSynchronizer.cs +++ b/src/Markup/Perspex.Markup.Xaml/DataBinding/DataContextChangeSynchronizer.cs @@ -1,98 +1,95 @@ +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. - - - - +using System; +using System.Globalization; +using System.Reactive.Linq; +using System.Reflection; +using Glass; +using OmniXaml.TypeConversion; +using Perspex.Markup.Xaml.DataBinding.ChangeTracking; namespace Perspex.Markup.Xaml.DataBinding { - using System; - using System.Globalization; - using System.Reactive.Linq; - using System.Reflection; - using ChangeTracking; - using Glass; - using OmniXaml.TypeConversion; - public class DataContextChangeSynchronizer { - private readonly BindingTarget bindingTarget; - private readonly ITypeConverter targetPropertyTypeConverter; - private readonly TargetBindingEndpoint bindingEndpoint; - private readonly ObservablePropertyBranch sourceEndpoint; + private readonly BindingTarget _bindingTarget; + private readonly ITypeConverter _targetPropertyTypeConverter; + private readonly TargetBindingEndpoint _bindingEndpoint; + private readonly ObservablePropertyBranch _sourceEndpoint; public DataContextChangeSynchronizer(BindingSource bindingSource, BindingTarget bindingTarget, ITypeConverterProvider typeConverterProvider) { - this.bindingTarget = bindingTarget; + _bindingTarget = bindingTarget; Guard.ThrowIfNull(bindingTarget.Object, nameof(bindingTarget.Object)); Guard.ThrowIfNull(bindingTarget.Property, nameof(bindingTarget.Property)); Guard.ThrowIfNull(bindingSource.SourcePropertyPath, nameof(bindingSource.SourcePropertyPath)); Guard.ThrowIfNull(bindingSource.Source, nameof(bindingSource.Source)); Guard.ThrowIfNull(typeConverterProvider, nameof(typeConverterProvider)); - this.bindingEndpoint = new TargetBindingEndpoint(bindingTarget.Object, bindingTarget.Property); - this.sourceEndpoint = new ObservablePropertyBranch(bindingSource.Source, bindingSource.SourcePropertyPath); - this.targetPropertyTypeConverter = typeConverterProvider.GetTypeConverter(bindingTarget.Property.PropertyType); + _bindingEndpoint = new TargetBindingEndpoint(bindingTarget.Object, bindingTarget.Property); + _sourceEndpoint = new ObservablePropertyBranch(bindingSource.Source, bindingSource.SourcePropertyPath); + _targetPropertyTypeConverter = typeConverterProvider.GetTypeConverter(bindingTarget.Property.PropertyType); } public class BindingTarget { - private readonly PerspexObject obj; - private readonly PerspexProperty property; + private readonly PerspexObject _obj; + private readonly PerspexProperty _property; public BindingTarget(PerspexObject @object, PerspexProperty property) { - this.obj = @object; - this.property = property; + _obj = @object; + _property = property; } - public PerspexObject Object => obj; + public PerspexObject Object => _obj; - public PerspexProperty Property => property; + public PerspexProperty Property => _property; public object Value { - get { return obj.GetValue(property); } - set { obj.SetValue(property, value); } + get { return _obj.GetValue(_property); } + set { _obj.SetValue(_property, value); } } } public class BindingSource { - private readonly PropertyPath sourcePropertyPath; - private readonly object source; + private readonly PropertyPath _sourcePropertyPath; + private readonly object _source; public BindingSource(PropertyPath sourcePropertyPath, object source) { - this.sourcePropertyPath = sourcePropertyPath; - this.source = source; + _sourcePropertyPath = sourcePropertyPath; + _source = source; } - public PropertyPath SourcePropertyPath => this.sourcePropertyPath; + public PropertyPath SourcePropertyPath => _sourcePropertyPath; - public object Source => source; + public object Source => _source; } public void StartUpdatingTargetWhenSourceChanges() { // TODO: commenting out this line will make the existing value to be skipped from the SourceValues. This is not supposed to happen. Is it? - bindingTarget.Value = ConvertedValue(sourceEndpoint.Value, bindingTarget.Property.PropertyType); + _bindingTarget.Value = ConvertedValue(_sourceEndpoint.Value, _bindingTarget.Property.PropertyType); // We use the native Bind method from PerspexObject to subscribe to the SourceValues observable - this.bindingTarget.Object.Bind(this.bindingTarget.Property, this.SourceValues); + _bindingTarget.Object.Bind(_bindingTarget.Property, this.SourceValues); } public void StartUpdatingSourceWhenTargetChanges() { // We subscribe to the TargetValues and each time we have a new value, we update the source with it - this.TargetValues.Subscribe(newValue => this.sourceEndpoint.Value = newValue); + this.TargetValues.Subscribe(newValue => _sourceEndpoint.Value = newValue); } private IObservable SourceValues { get { - return this.sourceEndpoint.Values.Select(originalValue => this.ConvertedValue(originalValue, this.bindingTarget.Property.PropertyType)); + return _sourceEndpoint.Values.Select(originalValue => this.ConvertedValue(originalValue, _bindingTarget.Property.PropertyType)); } } @@ -100,8 +97,8 @@ namespace Perspex.Markup.Xaml.DataBinding { get { - return this.bindingEndpoint.Object - .GetObservable(this.bindingEndpoint.Property).Select(o => this.ConvertedValue(o, this.sourceEndpoint.Type)); + return _bindingEndpoint.Object + .GetObservable(_bindingEndpoint.Property).Select(o => this.ConvertedValue(o, _sourceEndpoint.Type)); } } @@ -109,8 +106,8 @@ namespace Perspex.Markup.Xaml.DataBinding { get { - var sourceTypeInfo = this.sourceEndpoint.Type.GetTypeInfo(); - var targetTypeInfo = this.bindingEndpoint.Property.PropertyType.GetTypeInfo(); + var sourceTypeInfo = _sourceEndpoint.Type.GetTypeInfo(); + var targetTypeInfo = _bindingEndpoint.Property.PropertyType.GetTypeInfo(); var compatible = targetTypeInfo.IsAssignableFrom(sourceTypeInfo); return compatible; } @@ -137,11 +134,11 @@ namespace Perspex.Markup.Xaml.DataBinding return true; } - if (this.targetPropertyTypeConverter != null) + if (_targetPropertyTypeConverter != null) { - if (this.targetPropertyTypeConverter.CanConvertTo(null, targetType)) + if (_targetPropertyTypeConverter.CanConvertTo(null, targetType)) { - object convertedValue = this.targetPropertyTypeConverter.ConvertTo( + object convertedValue = _targetPropertyTypeConverter.ConvertTo( null, CultureInfo.InvariantCulture, originalValue, diff --git a/src/Markup/Perspex.Markup.Xaml/DataBinding/IPerspexPropertyBinder.cs b/src/Markup/Perspex.Markup.Xaml/DataBinding/IPerspexPropertyBinder.cs index 403715684d..d7879dc29b 100644 --- a/src/Markup/Perspex.Markup.Xaml/DataBinding/IPerspexPropertyBinder.cs +++ b/src/Markup/Perspex.Markup.Xaml/DataBinding/IPerspexPropertyBinder.cs @@ -1,13 +1,10 @@ - - - - +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. +using System.Collections.Generic; namespace Perspex.Markup.Xaml.DataBinding { - using System.Collections.Generic; - public interface IPerspexPropertyBinder { XamlBinding GetBinding(PerspexObject po, PerspexProperty pp); diff --git a/src/Markup/Perspex.Markup.Xaml/DataBinding/PerspexPropertyBinder.cs b/src/Markup/Perspex.Markup.Xaml/DataBinding/PerspexPropertyBinder.cs index 5dc732d564..27f93d53e9 100644 --- a/src/Markup/Perspex.Markup.Xaml/DataBinding/PerspexPropertyBinder.cs +++ b/src/Markup/Perspex.Markup.Xaml/DataBinding/PerspexPropertyBinder.cs @@ -1,36 +1,33 @@ - - - - +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. +using System; +using System.Collections.Generic; +using System.Linq; +using OmniXaml.TypeConversion; namespace Perspex.Markup.Xaml.DataBinding { - using System; - using System.Collections.Generic; - using System.Linq; - using OmniXaml.TypeConversion; - public class PerspexPropertyBinder : IPerspexPropertyBinder { - private readonly ITypeConverterProvider typeConverterProvider; + private readonly ITypeConverterProvider _typeConverterProvider; - private readonly HashSet bindings; + private readonly HashSet _bindings; public PerspexPropertyBinder(ITypeConverterProvider typeConverterProvider) { - this.typeConverterProvider = typeConverterProvider; - this.bindings = new HashSet(); + _typeConverterProvider = typeConverterProvider; + _bindings = new HashSet(); } public XamlBinding GetBinding(PerspexObject po, PerspexProperty pp) { - return this.bindings.First(xamlBinding => xamlBinding.Target == po && xamlBinding.TargetProperty == pp); + return _bindings.First(xamlBinding => xamlBinding.Target == po && xamlBinding.TargetProperty == pp); } public IEnumerable GetBindings(PerspexObject source) { - return from binding in this.bindings + return from binding in _bindings where binding.Target == source select binding; } @@ -47,7 +44,7 @@ namespace Perspex.Markup.Xaml.DataBinding throw new InvalidOperationException(); } - var binding = new XamlBinding(this.typeConverterProvider) + var binding = new XamlBinding(_typeConverterProvider) { BindingMode = xamlBinding.BindingMode, SourcePropertyPath = xamlBinding.SourcePropertyPath, @@ -55,7 +52,7 @@ namespace Perspex.Markup.Xaml.DataBinding TargetProperty = xamlBinding.TargetProperty }; - this.bindings.Add(binding); + _bindings.Add(binding); return binding; } } diff --git a/src/Markup/Perspex.Markup.Xaml/DataBinding/SourceBindingEndpoint.cs b/src/Markup/Perspex.Markup.Xaml/DataBinding/SourceBindingEndpoint.cs index bea3d78521..6abe4527b7 100644 --- a/src/Markup/Perspex.Markup.Xaml/DataBinding/SourceBindingEndpoint.cs +++ b/src/Markup/Perspex.Markup.Xaml/DataBinding/SourceBindingEndpoint.cs @@ -1,14 +1,11 @@ +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. - - - - +using System; +using System.ComponentModel; namespace Perspex.Markup.Xaml.DataBinding { - using System; - using System.ComponentModel; - public class SourceBindingEndpoint { public Type PropertyType { get; } diff --git a/src/Markup/Perspex.Markup.Xaml/DataBinding/TargetBindingEndpoint.cs b/src/Markup/Perspex.Markup.Xaml/DataBinding/TargetBindingEndpoint.cs index 5a1f8a0f7b..ce65a080a3 100644 --- a/src/Markup/Perspex.Markup.Xaml/DataBinding/TargetBindingEndpoint.cs +++ b/src/Markup/Perspex.Markup.Xaml/DataBinding/TargetBindingEndpoint.cs @@ -1,8 +1,5 @@ - - - - - +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. namespace Perspex.Markup.Xaml.DataBinding { diff --git a/src/Markup/Perspex.Markup.Xaml/DataBinding/XamlBinding.cs b/src/Markup/Perspex.Markup.Xaml/DataBinding/XamlBinding.cs index 78dbc93a83..34504ef9da 100644 --- a/src/Markup/Perspex.Markup.Xaml/DataBinding/XamlBinding.cs +++ b/src/Markup/Perspex.Markup.Xaml/DataBinding/XamlBinding.cs @@ -1,24 +1,21 @@ - - - - +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. +using System; +using System.Diagnostics; +using OmniXaml.TypeConversion; +using Perspex.Markup.Xaml.DataBinding.ChangeTracking; namespace Perspex.Markup.Xaml.DataBinding { - using System; - using System.Diagnostics; - using ChangeTracking; - using OmniXaml.TypeConversion; - public class XamlBinding { - private readonly ITypeConverterProvider typeConverterProvider; - private DataContextChangeSynchronizer changeSynchronizer; + private readonly ITypeConverterProvider _typeConverterProvider; + private DataContextChangeSynchronizer _changeSynchronizer; public XamlBinding(ITypeConverterProvider typeConverterProvider) { - this.typeConverterProvider = typeConverterProvider; + _typeConverterProvider = typeConverterProvider; } public PerspexObject Target { get; set; } @@ -41,22 +38,22 @@ namespace Perspex.Markup.Xaml.DataBinding var bindingSource = new DataContextChangeSynchronizer.BindingSource(this.SourcePropertyPath, dataContext); var bindingTarget = new DataContextChangeSynchronizer.BindingTarget(this.Target, this.TargetProperty); - this.changeSynchronizer = new DataContextChangeSynchronizer(bindingSource, bindingTarget, this.typeConverterProvider); + _changeSynchronizer = new DataContextChangeSynchronizer(bindingSource, bindingTarget, _typeConverterProvider); if (this.BindingMode == BindingMode.TwoWay) { - this.changeSynchronizer.StartUpdatingTargetWhenSourceChanges(); - this.changeSynchronizer.StartUpdatingSourceWhenTargetChanges(); + _changeSynchronizer.StartUpdatingTargetWhenSourceChanges(); + _changeSynchronizer.StartUpdatingSourceWhenTargetChanges(); } if (this.BindingMode == BindingMode.OneWay) { - this.changeSynchronizer.StartUpdatingTargetWhenSourceChanges(); + _changeSynchronizer.StartUpdatingTargetWhenSourceChanges(); } if (this.BindingMode == BindingMode.OneWayToSource) { - this.changeSynchronizer.StartUpdatingSourceWhenTargetChanges(); + _changeSynchronizer.StartUpdatingSourceWhenTargetChanges(); } } catch (Exception e) diff --git a/src/Markup/Perspex.Markup.Xaml/DataBinding/XamlBindingDefinition.cs b/src/Markup/Perspex.Markup.Xaml/DataBinding/XamlBindingDefinition.cs index 6337edb27e..7851a0cb95 100644 --- a/src/Markup/Perspex.Markup.Xaml/DataBinding/XamlBindingDefinition.cs +++ b/src/Markup/Perspex.Markup.Xaml/DataBinding/XamlBindingDefinition.cs @@ -1,35 +1,32 @@ - - - - +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. +using Perspex.Controls; +using Perspex.Markup.Xaml.DataBinding.ChangeTracking; namespace Perspex.Markup.Xaml.DataBinding { - using ChangeTracking; - using Controls; - public class XamlBindingDefinition { - private PropertyPath sourcePropertyPath; - private BindingMode bindingMode; - private readonly Control target; - private readonly PerspexProperty targetProperty; + private PropertyPath _sourcePropertyPath; + private BindingMode _bindingMode; + private readonly Control _target; + private readonly PerspexProperty _targetProperty; public XamlBindingDefinition(Control target, PerspexProperty targetProperty, PropertyPath sourcePropertyPath, BindingMode bindingMode) { - this.target = target; - this.targetProperty = targetProperty; - this.sourcePropertyPath = sourcePropertyPath; - this.bindingMode = bindingMode; + _target = target; + _targetProperty = targetProperty; + _sourcePropertyPath = sourcePropertyPath; + _bindingMode = bindingMode; } - public Control Target => this.target; + public Control Target => _target; - public PerspexProperty TargetProperty => this.targetProperty; + public PerspexProperty TargetProperty => _targetProperty; - public PropertyPath SourcePropertyPath => this.sourcePropertyPath; + public PropertyPath SourcePropertyPath => _sourcePropertyPath; - public BindingMode BindingMode => this.bindingMode; + public BindingMode BindingMode => _bindingMode; } } \ No newline at end of file diff --git a/src/Markup/Perspex.Markup.Xaml/MarkupExtensions/BindingExtension.cs b/src/Markup/Perspex.Markup.Xaml/MarkupExtensions/BindingExtension.cs index ba620aa983..62cd89ce0c 100644 --- a/src/Markup/Perspex.Markup.Xaml/MarkupExtensions/BindingExtension.cs +++ b/src/Markup/Perspex.Markup.Xaml/MarkupExtensions/BindingExtension.cs @@ -1,17 +1,14 @@ +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. - - - - +using System.Linq; +using OmniXaml; +using Perspex.Controls; +using Perspex.Markup.Xaml.DataBinding; +using Perspex.Markup.Xaml.DataBinding.ChangeTracking; namespace Perspex.Markup.Xaml.MarkupExtensions { - using System.Linq; - using Controls; - using DataBinding; - using DataBinding.ChangeTracking; - using OmniXaml; - public class BindingExtension : MarkupExtension { public BindingExtension() diff --git a/src/Markup/Perspex.Markup.Xaml/MarkupExtensions/TypeExtension.cs b/src/Markup/Perspex.Markup.Xaml/MarkupExtensions/TypeExtension.cs index e813f6ae31..4145731f1b 100644 --- a/src/Markup/Perspex.Markup.Xaml/MarkupExtensions/TypeExtension.cs +++ b/src/Markup/Perspex.Markup.Xaml/MarkupExtensions/TypeExtension.cs @@ -1,17 +1,14 @@ - - - - +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. +using System; +using Glass; +using OmniXaml; +using OmniXaml.Attributes; +using OmniXaml.Typing; namespace Perspex.Markup.Xaml.MarkupExtensions { - using System; - using Glass; - using OmniXaml; - using OmniXaml.Attributes; - using OmniXaml.Typing; - [ContentProperty("TargetType")] public class TypeExtension : MarkupExtension { diff --git a/src/Markup/Perspex.Markup.Xaml/PerspexXamlLoader.cs b/src/Markup/Perspex.Markup.Xaml/PerspexXamlLoader.cs index d845ccff17..96764872bf 100644 --- a/src/Markup/Perspex.Markup.Xaml/PerspexXamlLoader.cs +++ b/src/Markup/Perspex.Markup.Xaml/PerspexXamlLoader.cs @@ -1,18 +1,15 @@ - - - - +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. +using System; +using System.Reflection; +using OmniXaml; +using Perspex.Markup.Xaml.Context; +using Perspex.Platform; +using Splat; namespace Perspex.Markup.Xaml { - using System; - using System.Reflection; - using OmniXaml; - using Perspex.Markup.Xaml.Context; - using Platform; - using Splat; - /// /// Loads XAML for a perspex application. /// diff --git a/src/Markup/Perspex.Markup.Xaml/Properties/AssemblyInfo.cs b/src/Markup/Perspex.Markup.Xaml/Properties/AssemblyInfo.cs index 90dc3b515c..eea5e0803d 100644 --- a/src/Markup/Perspex.Markup.Xaml/Properties/AssemblyInfo.cs +++ b/src/Markup/Perspex.Markup.Xaml/Properties/AssemblyInfo.cs @@ -1,8 +1,5 @@ - - - - - +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. using System.Reflection; diff --git a/src/Markup/Perspex.Markup.Xaml/Templates/Template.cs b/src/Markup/Perspex.Markup.Xaml/Templates/Template.cs index 152e1a7f90..e09a83cbea 100644 --- a/src/Markup/Perspex.Markup.Xaml/Templates/Template.cs +++ b/src/Markup/Perspex.Markup.Xaml/Templates/Template.cs @@ -1,8 +1,5 @@ - - - - - +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. namespace Perspex.Markup.Xaml.Templates { diff --git a/src/Markup/Perspex.Markup.Xaml/Templates/TemplateContent.cs b/src/Markup/Perspex.Markup.Xaml/Templates/TemplateContent.cs index ac601fde8c..a9c255d61b 100644 --- a/src/Markup/Perspex.Markup.Xaml/Templates/TemplateContent.cs +++ b/src/Markup/Perspex.Markup.Xaml/Templates/TemplateContent.cs @@ -1,32 +1,29 @@ +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. - - - - +using System.Collections.Generic; +using OmniXaml; +using Perspex.Controls; +using Perspex.Markup.Xaml.Context; namespace Perspex.Markup.Xaml.Templates { - using System.Collections.Generic; - using Context; - using OmniXaml; - using Perspex.Controls; - public class TemplateContent { - private readonly IEnumerable nodes; - private readonly IWiringContext context; + private readonly IEnumerable _nodes; + private readonly IWiringContext _context; public TemplateContent(IEnumerable nodes, IWiringContext context) { - this.nodes = nodes; - this.context = context; + _nodes = nodes; + _context = context; } public Control Load() { - var assembler = new PerspexObjectAssembler(this.context); + var assembler = new PerspexObjectAssembler(_context); - foreach (var xamlNode in this.nodes) + foreach (var xamlNode in _nodes) { assembler.Process(xamlNode); } diff --git a/src/Markup/Perspex.Markup.Xaml/Templates/TemplateLoader.cs b/src/Markup/Perspex.Markup.Xaml/Templates/TemplateLoader.cs index dfe1a28ad1..2c93e3f61d 100644 --- a/src/Markup/Perspex.Markup.Xaml/Templates/TemplateLoader.cs +++ b/src/Markup/Perspex.Markup.Xaml/Templates/TemplateLoader.cs @@ -1,14 +1,11 @@ +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. - - - - +using System.Collections.Generic; +using OmniXaml; namespace Perspex.Markup.Xaml.Templates { - using System.Collections.Generic; - using OmniXaml; - public class TemplateLoader : IDeferredLoader { public object Load(IEnumerable nodes, IWiringContext context) diff --git a/src/Markup/Perspex.Markup.Xaml/Templates/XamlDataTemplate.cs b/src/Markup/Perspex.Markup.Xaml/Templates/XamlDataTemplate.cs index 2037a8f83f..872f5ea191 100644 --- a/src/Markup/Perspex.Markup.Xaml/Templates/XamlDataTemplate.cs +++ b/src/Markup/Perspex.Markup.Xaml/Templates/XamlDataTemplate.cs @@ -1,16 +1,13 @@ +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. - - - - +using System; +using OmniXaml.Attributes; +using Perspex.Controls; +using Perspex.Controls.Templates; namespace Perspex.Markup.Xaml.Templates { - using System; - using Controls.Templates; - using OmniXaml.Attributes; - using Perspex.Controls; - [ContentProperty("Content")] public class XamlDataTemplate : IDataTemplate { diff --git a/src/NGenerics/Constants.cs b/src/NGenerics/Constants.cs index 929c879ecd..0d7597bab4 100644 --- a/src/NGenerics/Constants.cs +++ b/src/NGenerics/Constants.cs @@ -1,3 +1,6 @@ +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. + /* Copyright 2007-2013 The NGenerics Team (https://github.com/ngenerics/ngenerics/wiki/Team) @@ -9,7 +12,7 @@ namespace NGenerics { - static class Constants + internal static class Constants { public const string NotEnoughSpaceInTheTargetArray = "Not enough space in the target array."; } diff --git a/src/NGenerics/DataStructures/Comparers/ComparisonComparer.cs b/src/NGenerics/DataStructures/Comparers/ComparisonComparer.cs index 8ba462c107..aee2fd48d1 100644 --- a/src/NGenerics/DataStructures/Comparers/ComparisonComparer.cs +++ b/src/NGenerics/DataStructures/Comparers/ComparisonComparer.cs @@ -1,3 +1,6 @@ +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. + /* Copyright 2007-2013 The NGenerics Team (https://github.com/ngenerics/ngenerics/wiki/Team) @@ -20,59 +23,58 @@ namespace NGenerics.Comparers /// The type of the objects to compare. //[Serializable] public sealed class ComparisonComparer : IComparer - { - #region Globals + { + #region Globals + + private Comparison _comparison; - private Comparison comparison; + #endregion - #endregion + #region Construction - #region Construction - /// The comparison. /// is a null reference (Nothing in Visual Basic). - public ComparisonComparer(Comparison comparison) - { + public ComparisonComparer(Comparison comparison) + { Guard.ArgumentNotNull(comparison, "comparison"); - this.comparison = comparison; - } + _comparison = comparison; + } - #endregion + #endregion - #region Public Members + #region Public Members - /// - /// Gets or sets the comparison used in this comparer. - /// + /// + /// Gets or sets the comparison used in this comparer. + /// /// The comparison used in this comparer. /// is a null reference (Nothing in Visual Basic). - public Comparison Comparison - { - get - { - return comparison; - } - set - { - + public Comparison Comparison + { + get + { + return _comparison; + } + set + { Guard.ArgumentNotNull(value, "value"); - comparison = value; - } - } + _comparison = value; + } + } - #endregion + #endregion - #region IComparer Members + #region IComparer Members - /// - public int Compare(T x, T y) - { - return comparison(x, y); - } + /// + public int Compare(T x, T y) + { + return _comparison(x, y); + } - #endregion - } + #endregion + } } \ No newline at end of file diff --git a/src/NGenerics/DataStructures/Comparers/KeyValuePairComparer.cs b/src/NGenerics/DataStructures/Comparers/KeyValuePairComparer.cs index 3cf39a1766..8b7a258f39 100644 --- a/src/NGenerics/DataStructures/Comparers/KeyValuePairComparer.cs +++ b/src/NGenerics/DataStructures/Comparers/KeyValuePairComparer.cs @@ -1,4 +1,7 @@ -/* +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. + +/* Copyright 2007-2013 The NGenerics Team (https://github.com/ngenerics/ngenerics/wiki/Team) @@ -11,18 +14,19 @@ using System; using System.Collections.Generic; -namespace NGenerics.Comparers { +namespace NGenerics.Comparers +{ /// /// A comparer for comparing keys for the KeyValuePair class. /// /// The key type. /// The value type. //[Serializable] - public class KeyValuePairComparer : IComparer> { - + public class KeyValuePairComparer : IComparer> + { #region Globals - private readonly IComparer comparer; + private readonly IComparer _comparer; #endregion @@ -31,22 +35,23 @@ namespace NGenerics.Comparers { /// /// Initializes a new instance of the class. /// - public KeyValuePairComparer() { - comparer = Comparer.Default; + public KeyValuePairComparer() + { + _comparer = Comparer.Default; } /// /// Initializes a new instance of the class. /// /// The comparer. - public KeyValuePairComparer(IComparer comparer) { - + public KeyValuePairComparer(IComparer comparer) + { if (comparer == null) { throw new ArgumentNullException("comparer"); } - this.comparer = comparer; + _comparer = comparer; } /// @@ -55,11 +60,12 @@ namespace NGenerics.Comparers { /// The comparison. public KeyValuePairComparer(Comparison comparison) { - if (comparison == null) { + if (comparison == null) + { throw new ArgumentNullException("comparison"); } - comparer = new ComparisonComparer(comparison); + _comparer = new ComparisonComparer(comparison); } #endregion @@ -67,8 +73,9 @@ namespace NGenerics.Comparers { #region IComparer> Members /// - public int Compare(KeyValuePair x, KeyValuePair y) { - return comparer.Compare(x.Key, y.Key); + public int Compare(KeyValuePair x, KeyValuePair y) + { + return _comparer.Compare(x.Key, y.Key); } #endregion @@ -76,11 +83,11 @@ namespace NGenerics.Comparers { #region IComparer Members /// - public int Compare(TKey x, TKey y) { - return comparer.Compare(x, y); + public int Compare(TKey x, TKey y) + { + return _comparer.Compare(x, y); } #endregion - } } \ No newline at end of file diff --git a/src/NGenerics/DataStructures/Comparers/ReverseComparer.cs b/src/NGenerics/DataStructures/Comparers/ReverseComparer.cs index 0b7f91b62d..fbfa55cc25 100644 --- a/src/NGenerics/DataStructures/Comparers/ReverseComparer.cs +++ b/src/NGenerics/DataStructures/Comparers/ReverseComparer.cs @@ -1,3 +1,6 @@ +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. + /* Copyright 2007-2013 The NGenerics Team (https://github.com/ngenerics/ngenerics/wiki/Team) @@ -14,16 +17,16 @@ using NGenerics.Util; namespace NGenerics.Comparers { - /// - /// A comparer that wraps the IComparable interface to reproduce the opposite comparison result. - /// - /// The type of the objects to compare. + /// + /// A comparer that wraps the IComparable interface to reproduce the opposite comparison result. + /// + /// The type of the objects to compare. //[Serializable] public sealed class ReverseComparer : IComparer { #region Globals - private IComparer comparerToUse; + private IComparer _comparerToUse; #endregion @@ -31,27 +34,26 @@ namespace NGenerics.Comparers /// public ReverseComparer() { - comparerToUse = Comparer.Default; + _comparerToUse = Comparer.Default; } - + /// The comparer to reverse. /// is a null reference (Nothing in Visual Basic). public ReverseComparer(IComparer comparer) { - Guard.ArgumentNotNull(comparer, "comparer"); - comparerToUse = comparer; + _comparerToUse = comparer; } #endregion #region IComparer Members - /// + /// public int Compare(T x, T y) { - return (comparerToUse.Compare(y, x)); + return (_comparerToUse.Compare(y, x)); } #endregion @@ -67,14 +69,13 @@ namespace NGenerics.Comparers { get { - return comparerToUse; + return _comparerToUse; } set { - Guard.ArgumentNotNull(value, "value"); - comparerToUse = value; + _comparerToUse = value; } } diff --git a/src/NGenerics/DataStructures/General/Heap.cs b/src/NGenerics/DataStructures/General/Heap.cs index 0e00b3d1b8..09c1e0f342 100644 --- a/src/NGenerics/DataStructures/General/Heap.cs +++ b/src/NGenerics/DataStructures/General/Heap.cs @@ -1,3 +1,6 @@ +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. + /* Copyright 2007-2013 The NGenerics Team (https://github.com/ngenerics/ngenerics/wiki/Team) @@ -28,10 +31,10 @@ namespace NGenerics.DataStructures.General { #region Globals - const string heapIsEmpty = "The heap is empty."; - private readonly List data; - private readonly IComparer comparerToUse; - private readonly HeapType thisType; + private const string heapIsEmpty = "The heap is empty."; + private readonly List _data; + private readonly IComparer _comparerToUse; + private readonly HeapType _thisType; #endregion @@ -70,7 +73,7 @@ namespace NGenerics.DataStructures.General /// The type of heap. /// The comparer. /// is not either or . - public Heap(HeapType type, Comparison comparer) : this(type, new ComparisonComparer(comparer)){} + public Heap(HeapType type, Comparison comparer) : this(type, new ComparisonComparer(comparer)) { } /// /// Initializes a new instance of the class. @@ -102,11 +105,11 @@ namespace NGenerics.DataStructures.General throw new ArgumentOutOfRangeException("type"); } - thisType = type; + _thisType = type; - data = new List {default(T)}; + _data = new List { default(T) }; - comparerToUse = type == HeapType.Minimum ? comparer : new ReverseComparer(comparer); + _comparerToUse = type == HeapType.Minimum ? comparer : new ReverseComparer(comparer); } @@ -124,11 +127,11 @@ namespace NGenerics.DataStructures.General { throw new ArgumentOutOfRangeException("type"); } - thisType = type; + _thisType = type; - data = new List(capacity) {default(T)}; + _data = new List(capacity) { default(T) }; - comparerToUse = type == HeapType.Minimum ? comparer : new ReverseComparer(comparer); + _comparerToUse = type == HeapType.Minimum ? comparer : new ReverseComparer(comparer); } #endregion @@ -136,7 +139,7 @@ namespace NGenerics.DataStructures.General #region Public Members - /// + /// /// /// /// @@ -154,12 +157,12 @@ namespace NGenerics.DataStructures.General #endregion - return data[1]; + return _data[1]; } } - /// + /// /// /// /// @@ -176,9 +179,9 @@ namespace NGenerics.DataStructures.General #endregion // The minimum item to return. - var minimum = data[1]; + var minimum = _data[1]; - RemoveRootItem(minimum); + RemoveRootItem(minimum); return minimum; } @@ -193,10 +196,9 @@ namespace NGenerics.DataStructures.General /// protected virtual void RemoveRootItem(T item) { - // The last item in the heap - var last = data[Count]; - data.RemoveAt(Count); + var last = _data[Count]; + _data.RemoveAt(Count); // If there's still items left in this heap, re-heapify it. if (Count > 0) @@ -204,28 +206,27 @@ namespace NGenerics.DataStructures.General // Re-heapify the binary tree to conform to the heap property var counter = 1; - while ((counter * 2) < (data.Count)) + while ((counter * 2) < (_data.Count)) { var child = counter * 2; - if (((child + 1) < (data.Count)) && - (comparerToUse.Compare(data[child + 1], data[child]) < 0)) + if (((child + 1) < (_data.Count)) && + (_comparerToUse.Compare(_data[child + 1], _data[child]) < 0)) { child++; } - if (comparerToUse.Compare(last, data[child]) <= 0) + if (_comparerToUse.Compare(last, _data[child]) <= 0) { break; } - data[counter] = data[child]; + _data[counter] = _data[child]; counter = child; } - data[counter] = last; + _data[counter] = last; } - } @@ -242,7 +243,7 @@ namespace NGenerics.DataStructures.General { get { - return thisType; + return _thisType; } } @@ -250,9 +251,9 @@ namespace NGenerics.DataStructures.General #region ICollection Members - - /// + + /// /// /// /// @@ -265,19 +266,19 @@ namespace NGenerics.DataStructures.General } } - - /// + + /// /// /// /// /// public bool Contains(T item) { - return data.Contains(item); + return _data.Contains(item); } - /// + /// /// /// /// @@ -295,13 +296,13 @@ namespace NGenerics.DataStructures.General #endregion - for (var i = 1; i < data.Count; i++) + for (var i = 1; i < _data.Count; i++) { - array[arrayIndex++] = data[i]; + array[arrayIndex++] = _data[i]; } } - /// + /// /// /// /// @@ -310,18 +311,18 @@ namespace NGenerics.DataStructures.General { get { - return data.Count - 1; + return _data.Count - 1; } } - /// + /// /// /// /// /// public void Add(T item) { - AddItem(item); + AddItem(item); } /// @@ -333,24 +334,24 @@ namespace NGenerics.DataStructures.General /// Derived classes can override this method to change the behavior of the method. /// protected virtual void AddItem(T item) - { - // Add a dummy to the end of the list (it will be replaced) - data.Add(default(T)); + { + // Add a dummy to the end of the list (it will be replaced) + _data.Add(default(T)); - var counter = data.Count - 1; + var counter = _data.Count - 1; + + while ((counter > 1) && (_comparerToUse.Compare(_data[counter / 2], item) > 0)) + { + _data[counter] = _data[counter / 2]; + counter = counter / 2; + } - while ((counter > 1) && (comparerToUse.Compare(data[counter / 2], item) > 0)) - { - data[counter] = data[counter / 2]; - counter = counter / 2; - } + _data[counter] = item; + } - data[counter] = item; - } - - /// + /// /// Always. [SuppressMessage("Microsoft.Design", "CA1033:InterfaceMethodsShouldBeCallableByChildTypes")] bool ICollection.Remove(T item) @@ -370,38 +371,38 @@ namespace NGenerics.DataStructures.General /// public IEnumerator GetEnumerator() { - for (var i = 1; i < data.Count; i++) + for (var i = 1; i < _data.Count; i++) { - yield return data[i]; + yield return _data[i]; } } - /// + /// /// /// /// /// public void Clear() { - ClearItems(); + ClearItems(); + } + /// + /// Clears all the objects in this instance. + /// + /// + /// Notes to Inheritors: + /// Derived classes can override this method to change the behavior of the method. + /// + protected virtual void ClearItems() + { + _data.RemoveRange(1, _data.Count - 1); // Clears all objects in this instance except the first dummy one. } - /// - /// Clears all the objects in this instance. - /// - /// - /// Notes to Inheritors: - /// Derived classes can override this method to change the behavior of the method. - /// - protected virtual void ClearItems() - { - data.RemoveRange(1, data.Count - 1); // Clears all objects in this instance except the first dummy one. - } #endregion #region ICollection Members - /// + /// /// /// /// @@ -418,7 +419,7 @@ namespace NGenerics.DataStructures.General #region IEnumerable Members - /// + /// IEnumerator IEnumerable.GetEnumerator() { return GetEnumerator(); diff --git a/src/NGenerics/DataStructures/General/HeapType.cs b/src/NGenerics/DataStructures/General/HeapType.cs index ba961f1d2b..5622bdb10c 100644 --- a/src/NGenerics/DataStructures/General/HeapType.cs +++ b/src/NGenerics/DataStructures/General/HeapType.cs @@ -1,3 +1,6 @@ +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. + /* Copyright 2007-2013 The NGenerics Team (https://github.com/ngenerics/ngenerics/wiki/Team) diff --git a/src/NGenerics/DataStructures/General/IHeap.cs b/src/NGenerics/DataStructures/General/IHeap.cs index 2758af6391..c8db163f01 100644 --- a/src/NGenerics/DataStructures/General/IHeap.cs +++ b/src/NGenerics/DataStructures/General/IHeap.cs @@ -1,4 +1,7 @@ -/* +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. + +/* Copyright 2007-2013 The NGenerics Team (https://github.com/ngenerics/ngenerics/wiki/Team) @@ -12,30 +15,30 @@ using System; namespace NGenerics.DataStructures.General { - /// - /// An interface for the data structure. - /// - /// The type of elements in the heap. - public interface IHeap - { - /// - /// Adds the specified item. - /// - /// The item. - void Add(T item); + /// + /// An interface for the data structure. + /// + /// The type of elements in the heap. + public interface IHeap + { + /// + /// Adds the specified item. + /// + /// The item. + void Add(T item); - /// - /// Removes the root and returns it. - /// - /// The root of the . - /// The is empty. - T RemoveRoot(); + /// + /// Removes the root and returns it. + /// + /// The root of the . + /// The is empty. + T RemoveRoot(); - /// - /// Gets the root. - /// - /// The root. - /// The is empty. - T Root { get; } - } + /// + /// Gets the root. + /// + /// The root. + /// The is empty. + T Root { get; } + } } diff --git a/src/NGenerics/DataStructures/Queues/IQueue.cs b/src/NGenerics/DataStructures/Queues/IQueue.cs index a113d42f13..e1e6df809d 100644 --- a/src/NGenerics/DataStructures/Queues/IQueue.cs +++ b/src/NGenerics/DataStructures/Queues/IQueue.cs @@ -1,3 +1,6 @@ +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. + /* Copyright 2007-2013 The NGenerics Team (https://github.com/ngenerics/ngenerics/wiki/Team) @@ -19,25 +22,25 @@ namespace NGenerics.DataStructures.Queues /// The type of the elements in the queue. [SuppressMessage("Microsoft.Naming", "CA1711:IdentifiersShouldNotHaveIncorrectSuffix")] public interface IQueue - { - /// - /// Enqueues the item at the back of the queue. - /// - /// The item. - void Enqueue(T item); + { + /// + /// Enqueues the item at the back of the queue. + /// + /// The item. + void Enqueue(T item); - /// - /// Dequeues the item at the front of the queue. - /// - /// The item at the front of the queue. - /// The is empty. - T Dequeue(); + /// + /// Dequeues the item at the front of the queue. + /// + /// The item at the front of the queue. + /// The is empty. + T Dequeue(); - /// - /// Peeks at the item in the front of the queue, without removing it. - /// - /// The item at the front of the queue. - /// The is empty. - T Peek(); - } + /// + /// Peeks at the item in the front of the queue, without removing it. + /// + /// The item at the front of the queue. + /// The is empty. + T Peek(); + } } diff --git a/src/NGenerics/DataStructures/Queues/PriorityQueue.cs b/src/NGenerics/DataStructures/Queues/PriorityQueue.cs index 662ae39bae..4358fe16a6 100644 --- a/src/NGenerics/DataStructures/Queues/PriorityQueue.cs +++ b/src/NGenerics/DataStructures/Queues/PriorityQueue.cs @@ -1,3 +1,6 @@ +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. + /* Copyright 2007-2013 The NGenerics Team (https://github.com/ngenerics/ngenerics/wiki/Team) @@ -27,15 +30,15 @@ namespace NGenerics.DataStructures.Queues /// The type of the priority in the . /// The type of the elements in the . [SuppressMessage("Microsoft.Naming", "CA1710:IdentifiersShouldHaveCorrectSuffix")] - [SuppressMessage("Microsoft.Naming", "CA1711:IdentifiersShouldNotHaveIncorrectSuffix")] + [SuppressMessage("Microsoft.Naming", "CA1711:IdentifiersShouldNotHaveIncorrectSuffix")] //[Serializable] - public class PriorityQueue : ICollection, IQueue + public class PriorityQueue : ICollection, IQueue { #region Globals - private readonly RedBlackTreeList tree; - private TPriority defaultPriority; - private readonly PriorityQueueType queueType; + private readonly RedBlackTreeList _tree; + private TPriority _defaultPriority; + private readonly PriorityQueueType _queueType; #endregion @@ -47,17 +50,19 @@ namespace NGenerics.DataStructures.Queues /// /// public PriorityQueue(PriorityQueueType queueType) : - this(queueType, Comparer.Default) { - + this(queueType, Comparer.Default) + { } /// - public PriorityQueue(PriorityQueueType queueType, IComparer comparer) { - if ((queueType != PriorityQueueType.Minimum) && (queueType != PriorityQueueType.Maximum)) { + public PriorityQueue(PriorityQueueType queueType, IComparer comparer) + { + if ((queueType != PriorityQueueType.Minimum) && (queueType != PriorityQueueType.Maximum)) + { throw new ArgumentOutOfRangeException("queueType"); } - this.queueType = queueType; - tree = new RedBlackTreeList(comparer); + _queueType = queueType; + _tree = new RedBlackTreeList(comparer); } /// @@ -67,8 +72,8 @@ namespace NGenerics.DataStructures.Queues /// The comparison. /// public PriorityQueue(PriorityQueueType queueType, Comparison comparison) : - this(queueType, new ComparisonComparer(comparison)) { - + this(queueType, new ComparisonComparer(comparison)) + { } #endregion @@ -187,7 +192,7 @@ namespace NGenerics.DataStructures.Queues /// public IEnumerator GetEnumerator() { - return tree.GetValueEnumerator(); + return _tree.GetValueEnumerator(); } #endregion @@ -208,7 +213,7 @@ namespace NGenerics.DataStructures.Queues /// public bool Contains(TValue item) { - return tree.ContainsValue(item); + return _tree.ContainsValue(item); } /// @@ -230,7 +235,7 @@ namespace NGenerics.DataStructures.Queues #endregion - foreach (var association in tree) + foreach (var association in _tree) { var items = association.Value; @@ -248,7 +253,7 @@ namespace NGenerics.DataStructures.Queues /// public void Add(TValue item) { - Add(item, defaultPriority); + Add(item, _defaultPriority); } /// @@ -285,7 +290,7 @@ namespace NGenerics.DataStructures.Queues [SuppressMessage("Microsoft.Design", "CA1024:UsePropertiesWhereAppropriate")] public IEnumerator> GetKeyEnumerator() { - return tree.GetKeyEnumerator(); + return _tree.GetKeyEnumerator(); } /// @@ -334,7 +339,7 @@ namespace NGenerics.DataStructures.Queues if (association.Value.Count == 0) { - tree.Remove(association.Key); + _tree.Remove(association.Key); } Count--; @@ -351,11 +356,11 @@ namespace NGenerics.DataStructures.Queues { get { - return defaultPriority; + return _defaultPriority; } set { - defaultPriority = value; + _defaultPriority = value; } } @@ -369,7 +374,7 @@ namespace NGenerics.DataStructures.Queues public bool Remove(TValue item, out TPriority priority) { return RemoveItem(item, out priority); - } + } /// /// Removes the item. /// @@ -383,7 +388,7 @@ namespace NGenerics.DataStructures.Queues [SuppressMessage("Microsoft.Design", "CA1021:AvoidOutParameters", MessageId = "1#")] protected virtual bool RemoveItem(TValue item, out TPriority priority) { - var removed = tree.Remove(item, out priority); + var removed = _tree.Remove(item, out priority); if (removed) { @@ -392,7 +397,7 @@ namespace NGenerics.DataStructures.Queues return removed; } - + /// /// Removes the items with the specified priority. /// @@ -400,8 +405,8 @@ namespace NGenerics.DataStructures.Queues /// true if the priority exists in the and has been removed; otherwise false. public bool RemovePriorityGroup(TPriority priority) { - return RemoveItems(priority); - } + return RemoveItems(priority); + } /// /// Removes the items from the collection with the specified priority. @@ -409,30 +414,30 @@ namespace NGenerics.DataStructures.Queues /// The priority to search for. /// An indication of whether items were found having the specified priority. protected virtual bool RemoveItems(TPriority priority) - { - LinkedList items; - - if (tree.TryGetValue(priority, out items)) - { - tree.Remove(priority); - Count -= items.Count; - return true; - } - - return false; - } - - /// + { + LinkedList items; + + if (_tree.TryGetValue(priority, out items)) + { + _tree.Remove(priority); + Count -= items.Count; + return true; + } + + return false; + } + + /// /// Removes the items with the specified priority. /// /// The priority. /// The items with the specified priority. public IList GetPriorityGroup(TPriority priority) - { - LinkedList items; + { + LinkedList items; - return tree.TryGetValue(priority, out items) ? new List(items) : new List(); - } + return _tree.TryGetValue(priority, out items) ? new List(items) : new List(); + } /// @@ -465,7 +470,7 @@ namespace NGenerics.DataStructures.Queues { LinkedList currentValues; - if (tree.TryGetValue(priority, out currentValues)) + if (_tree.TryGetValue(priority, out currentValues)) { for (var i = 0; i < items.Count; i++) { @@ -475,7 +480,7 @@ namespace NGenerics.DataStructures.Queues else { currentValues = new LinkedList(items); - tree.Add(priority, currentValues); + _tree.Add(priority, currentValues); } } @@ -496,7 +501,7 @@ namespace NGenerics.DataStructures.Queues { LinkedList list; - if (tree.TryGetValue(priority, out list)) + if (_tree.TryGetValue(priority, out list)) { list.AddLast(item); } @@ -504,7 +509,7 @@ namespace NGenerics.DataStructures.Queues { list = new LinkedList(); list.AddLast(item); - tree.Add(priority, list); + _tree.Add(priority, list); } Count++; @@ -519,7 +524,7 @@ namespace NGenerics.DataStructures.Queues /// protected virtual void ClearItems() { - tree.Clear(); + _tree.Clear(); Count = 0; } @@ -532,7 +537,7 @@ namespace NGenerics.DataStructures.Queues /// private void CheckTreeNotEmpty() { - if (tree.Count == 0) + if (_tree.Count == 0) { throw new InvalidOperationException("The Priority Queue is empty."); } @@ -549,7 +554,7 @@ namespace NGenerics.DataStructures.Queues #endregion - return queueType == PriorityQueueType.Maximum ? tree.Maximum : tree.Minimum; + return _queueType == PriorityQueueType.Maximum ? _tree.Maximum : _tree.Minimum; } #endregion diff --git a/src/NGenerics/DataStructures/Queues/PriorityQueueType.cs b/src/NGenerics/DataStructures/Queues/PriorityQueueType.cs index 8c87d87811..94ee9a2dd9 100644 --- a/src/NGenerics/DataStructures/Queues/PriorityQueueType.cs +++ b/src/NGenerics/DataStructures/Queues/PriorityQueueType.cs @@ -1,3 +1,6 @@ +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. + /* Copyright 2007-2013 The NGenerics Team (https://github.com/ngenerics/ngenerics/wiki/Team) diff --git a/src/NGenerics/DataStructures/Trees/BinarySearchTreeBase.cs b/src/NGenerics/DataStructures/Trees/BinarySearchTreeBase.cs index ea2c44ff34..14b6e1f37a 100644 --- a/src/NGenerics/DataStructures/Trees/BinarySearchTreeBase.cs +++ b/src/NGenerics/DataStructures/Trees/BinarySearchTreeBase.cs @@ -1,4 +1,7 @@ -/* +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. + +/* Copyright 2007-2013 The NGenerics Team (https://github.com/ngenerics/ngenerics/wiki/Team) @@ -18,7 +21,6 @@ using NGenerics.Util; namespace NGenerics.DataStructures.Trees { - /// /// A base class for Binary Search Trees that store a single value in each node. /// @@ -26,12 +28,11 @@ namespace NGenerics.DataStructures.Trees //[Serializable] public abstract class BinarySearchTreeBase : ISearchTree { - #region Globals internal const string alreadyContainedInTheTree = "The item is already contained in the tree."; - private BinaryTree tree; - private readonly IComparer comparer; + private BinaryTree _tree; + private readonly IComparer _comparer; #endregion @@ -52,7 +53,7 @@ namespace NGenerics.DataStructures.Trees /// protected BinarySearchTreeBase() { - comparer = Comparer.Default; + _comparer = Comparer.Default; } /// @@ -63,7 +64,7 @@ namespace NGenerics.DataStructures.Trees protected BinarySearchTreeBase(IComparer comparer) { Guard.ArgumentNotNull(comparer, "comparer"); - this.comparer = comparer; + _comparer = comparer; } /// @@ -73,7 +74,7 @@ namespace NGenerics.DataStructures.Trees protected BinarySearchTreeBase(Comparison comparison) { Guard.ArgumentNotNull(comparison, "comparison"); - comparer = new ComparisonComparer(comparison); + _comparer = new ComparisonComparer(comparison); } #endregion @@ -88,7 +89,7 @@ namespace NGenerics.DataStructures.Trees { get { - return comparer; + return _comparer; } } @@ -106,16 +107,16 @@ namespace NGenerics.DataStructures.Trees [SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures")] protected virtual BinaryTree FindNode(T item) { - if (tree == null) + if (_tree == null) { return null; } - var currentNode = tree; + var currentNode = _tree; while (currentNode != null) { - var nodeResult = comparer.Compare(item, currentNode.Data); + var nodeResult = _comparer.Compare(item, currentNode.Data); if (nodeResult == 0) { @@ -137,12 +138,12 @@ namespace NGenerics.DataStructures.Trees /// The item if found, else null. protected virtual BinaryTree FindNode(TSearch value, CustomComparison customComparison) { - if (tree == null) + if (_tree == null) { return null; } - var currentNode = tree; + var currentNode = _tree; while (currentNode != null) { @@ -182,11 +183,11 @@ namespace NGenerics.DataStructures.Trees { #region Debug - Debug.Assert(tree != null); + Debug.Assert(_tree != null); #endregion - return FindMaximumNode(tree); + return FindMaximumNode(_tree); } @@ -199,11 +200,11 @@ namespace NGenerics.DataStructures.Trees { #region Debug - Debug.Assert(tree != null); + Debug.Assert(_tree != null); #endregion - return FindMinimumNode(tree); + return FindMinimumNode(_tree); } /// @@ -264,11 +265,11 @@ namespace NGenerics.DataStructures.Trees { get { - return tree; + return _tree; } set { - tree = value; + _tree = value; } } @@ -343,18 +344,13 @@ namespace NGenerics.DataStructures.Trees return FindMaximumNode().Data; } - } - - - - - /// + } /// [SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures")] public void DepthFirstTraversal(OrderedVisitor visitor) { Guard.ArgumentNotNull(visitor, "visitor"); - VisitNode(tree, visitor); + VisitNode(_tree, visitor); } /// @@ -362,12 +358,12 @@ namespace NGenerics.DataStructures.Trees [SuppressMessage("Microsoft.Design", "CA1024:UsePropertiesWhereAppropriate")] public IEnumerator GetOrderedEnumerator() { - if (tree != null) + if (_tree != null) { var trackingVisitor = new TrackingVisitor(); var inOrderVisitor = new InOrderVisitor(trackingVisitor); - tree.DepthFirstTraversal(inOrderVisitor); + _tree.DepthFirstTraversal(inOrderVisitor); var trackingList = trackingVisitor.TrackingList; @@ -423,7 +419,7 @@ namespace NGenerics.DataStructures.Trees /// protected virtual void ClearItems() { - tree = null; + _tree = null; Count = 0; } @@ -457,11 +453,11 @@ namespace NGenerics.DataStructures.Trees [SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures")] public IEnumerator GetEnumerator() { - if (tree != null) + if (_tree != null) { var stack = new Stack>(); - stack.Push(tree); + stack.Push(_tree); while (stack.Count > 0) { @@ -528,7 +524,7 @@ namespace NGenerics.DataStructures.Trees #endregion - foreach (var association in tree) + foreach (var association in _tree) { array[arrayIndex++] = association; } diff --git a/src/NGenerics/DataStructures/Trees/BinaryTree.cs b/src/NGenerics/DataStructures/Trees/BinaryTree.cs index f1bda540c1..7d6a70f45b 100644 --- a/src/NGenerics/DataStructures/Trees/BinaryTree.cs +++ b/src/NGenerics/DataStructures/Trees/BinaryTree.cs @@ -1,3 +1,6 @@ +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. + /* Copyright 2007-2013 The NGenerics Team (https://github.com/ngenerics/ngenerics/wiki/Team) @@ -27,72 +30,72 @@ namespace NGenerics.DataStructures.Trees { #region Globals - private BinaryTree leftSubtree; - private BinaryTree rightSubtree; - private T data; + private BinaryTree _leftSubtree; + private BinaryTree _rightSubtree; + private T _data; - #endregion + #endregion - #region Construction + #region Construction - /// The data contained in this node. - public BinaryTree(T data) : this(data, null, null) { } + /// The data contained in this node. + public BinaryTree(T data) : this(data, null, null) { } - /// The data. - /// The data of the left subtree. - /// The data of the right subtree. - public BinaryTree(T data, T left, T right) : this(data, new BinaryTree(left), new BinaryTree(right)) { } + /// The data. + /// The data of the left subtree. + /// The data of the right subtree. + public BinaryTree(T data, T left, T right) : this(data, new BinaryTree(left), new BinaryTree(right)) { } - /// The data contained in this node. - /// The left subtree. - /// The right subtree. - public BinaryTree(T data, BinaryTree left, BinaryTree right) - : this(data, left, right, true) - { - } + /// The data contained in this node. + /// The left subtree. + /// The right subtree. + public BinaryTree(T data, BinaryTree left, BinaryTree right) + : this(data, left, right, true) + { + } - /// The data contained in this node. - /// The left subtree. - /// The right subtree. - /// to validate ; otherwise . - internal BinaryTree(T data, BinaryTree left, BinaryTree right, bool validateData) - { - #region Validation + /// The data contained in this node. + /// The left subtree. + /// The right subtree. + /// to validate ; otherwise . + internal BinaryTree(T data, BinaryTree left, BinaryTree right, bool validateData) + { + #region Validation - //TODO: probably not the most efficient way of doing this but SplayTree needs to use a BinaryTree with null data. - if (validateData) - { - Guard.ArgumentNotNull(data, "data"); - } + //TODO: probably not the most efficient way of doing this but SplayTree needs to use a BinaryTree with null data. + if (validateData) + { + Guard.ArgumentNotNull(data, "data"); + } - #endregion + #endregion - leftSubtree = left; + _leftSubtree = left; - if (left != null) - { - left.Parent = this; - } + if (left != null) + { + left.Parent = this; + } - rightSubtree = right; + _rightSubtree = right; - if (right != null) - { - right.Parent = this; - } + if (right != null) + { + right.Parent = this; + } - this.data = data; - } + _data = data; + } - #endregion + #endregion #region ICollection Members - /// + /// public bool IsEmpty { get @@ -101,16 +104,16 @@ namespace NGenerics.DataStructures.Trees } } - /// + /// public bool IsFull { get { - return (leftSubtree != null) && (rightSubtree != null); + return (_leftSubtree != null) && (_rightSubtree != null); } } - /// + /// public bool Contains(T item) { foreach (var thisItem in this) @@ -124,7 +127,7 @@ namespace NGenerics.DataStructures.Trees return false; } - /// + /// public void CopyTo(T[] array, int arrayIndex) { Guard.ArgumentNotNull(array, "array"); @@ -144,19 +147,19 @@ namespace NGenerics.DataStructures.Trees } } - /// + /// public int Count { get { var count = 0; - if (leftSubtree != null) + if (_leftSubtree != null) { count++; } - if (rightSubtree != null) + if (_rightSubtree != null) { count++; } @@ -165,27 +168,27 @@ namespace NGenerics.DataStructures.Trees } } - /// + /// public void Add(T item) { AddItem(new BinaryTree(item)); } - /// + /// public bool Remove(T item) { - if (leftSubtree != null) + if (_leftSubtree != null) { - if (leftSubtree.data.Equals(item)) + if (_leftSubtree._data.Equals(item)) { RemoveLeft(); return true; } } - if (rightSubtree != null) + if (_rightSubtree != null) { - if (rightSubtree.data.Equals(item)) + if (_rightSubtree._data.Equals(item)) { RemoveRight(); return true; @@ -202,18 +205,18 @@ namespace NGenerics.DataStructures.Trees /// A value indicating whether the child was found (and removed) from this tree. public bool Remove(BinaryTree child) { - if (leftSubtree != null) + if (_leftSubtree != null) { - if (leftSubtree == child) + if (_leftSubtree == child) { RemoveLeft(); return true; } } - if (rightSubtree != null) + if (_rightSubtree != null) { - if (rightSubtree == child) + if (_rightSubtree == child) { RemoveRight(); return true; @@ -241,31 +244,31 @@ namespace NGenerics.DataStructures.Trees yield return tree.Data; - if (tree.leftSubtree != null) + if (tree._leftSubtree != null) { - stack.Push(tree.leftSubtree); + stack.Push(tree._leftSubtree); } - if (tree.rightSubtree != null) + if (tree._rightSubtree != null) { - stack.Push(tree.rightSubtree); + stack.Push(tree._rightSubtree); } } } - /// + /// public virtual void Clear() { - if (leftSubtree != null) + if (_leftSubtree != null) { - leftSubtree.Parent = null; - leftSubtree = null; + _leftSubtree.Parent = null; + _leftSubtree = null; } - if (rightSubtree != null) + if (_rightSubtree != null) { - rightSubtree.Parent = null; - rightSubtree = null; + _rightSubtree.Parent = null; + _rightSubtree = null; } } @@ -273,31 +276,31 @@ namespace NGenerics.DataStructures.Trees #region ITree Members - /// + /// void ITree.Add(ITree child) { AddItem((BinaryTree)child); } - /// + /// ITree ITree.GetChild(int index) { return GetChild(index); } - /// + /// bool ITree.Remove(ITree child) { return Remove((BinaryTree)child); } - /// + /// ITree ITree.FindNode(Predicate condition) { return FindNode(condition); } - /// + /// ITree ITree.Parent { get @@ -331,10 +334,10 @@ namespace NGenerics.DataStructures.Trees { return this; } - - if (leftSubtree != null) + + if (_leftSubtree != null) { - var ret = leftSubtree.FindNode(condition); + var ret = _leftSubtree.FindNode(condition); if (ret != null) { @@ -342,9 +345,9 @@ namespace NGenerics.DataStructures.Trees } } - if (rightSubtree != null) + if (_rightSubtree != null) { - var ret = rightSubtree.FindNode(condition); + var ret = _rightSubtree.FindNode(condition); if (ret != null) { @@ -364,11 +367,11 @@ namespace NGenerics.DataStructures.Trees { get { - return leftSubtree; + return _leftSubtree; } set { - if (leftSubtree != null) + if (_leftSubtree != null) { RemoveLeft(); } @@ -383,7 +386,7 @@ namespace NGenerics.DataStructures.Trees value.Parent = this; } - leftSubtree = value; + _leftSubtree = value; } } @@ -396,12 +399,11 @@ namespace NGenerics.DataStructures.Trees { get { - return rightSubtree; + return _rightSubtree; } set { - - if (rightSubtree != null) + if (_rightSubtree != null) { RemoveRight(); } @@ -416,16 +418,16 @@ namespace NGenerics.DataStructures.Trees value.Parent = this; } - rightSubtree = value; + _rightSubtree = value; } } - /// + /// public virtual T Data { get { - return data; + return _data; } set { @@ -435,11 +437,11 @@ namespace NGenerics.DataStructures.Trees #endregion - data = value; + _data = value; } } - /// + /// public int Degree { get @@ -459,14 +461,14 @@ namespace NGenerics.DataStructures.Trees switch (index) { case 0: - return leftSubtree; + return _leftSubtree; case 1: - return rightSubtree; + return _rightSubtree; default: throw new ArgumentOutOfRangeException("index"); } } - /// + /// public virtual int Height { get @@ -475,7 +477,7 @@ namespace NGenerics.DataStructures.Trees { return 0; } - + return 1 + FindMaximumChildHeight(); } } @@ -494,21 +496,21 @@ namespace NGenerics.DataStructures.Trees { return; } - + // Preorder visit orderedVisitor.VisitPreOrder(Data); - if (leftSubtree != null) + if (_leftSubtree != null) { - leftSubtree.DepthFirstTraversal(orderedVisitor); + _leftSubtree.DepthFirstTraversal(orderedVisitor); } // In-order visit - orderedVisitor.VisitInOrder(data); + orderedVisitor.VisitInOrder(_data); - if (rightSubtree != null) + if (_rightSubtree != null) { - rightSubtree.DepthFirstTraversal(orderedVisitor); + _rightSubtree.DepthFirstTraversal(orderedVisitor); } // PostOrder visit @@ -551,7 +553,7 @@ namespace NGenerics.DataStructures.Trees } - /// + /// public virtual bool IsLeafNode { get @@ -565,10 +567,10 @@ namespace NGenerics.DataStructures.Trees /// public virtual void RemoveLeft() { - if (leftSubtree != null) + if (_leftSubtree != null) { - leftSubtree.Parent = null; - leftSubtree = null; + _leftSubtree.Parent = null; + _leftSubtree = null; } } @@ -577,10 +579,10 @@ namespace NGenerics.DataStructures.Trees /// public virtual void RemoveRight() { - if (rightSubtree != null) + if (_rightSubtree != null) { - rightSubtree.Parent = null; - rightSubtree = null; + _rightSubtree.Parent = null; + _rightSubtree = null; } } @@ -595,8 +597,8 @@ namespace NGenerics.DataStructures.Trees { Guard.ArgumentNotNull(subtree, "subtree"); - AddItem(subtree); - } + AddItem(subtree); + } /// /// Adds an item to the . @@ -608,24 +610,24 @@ namespace NGenerics.DataStructures.Trees /// protected virtual void AddItem(BinaryTree subtree) { - if (leftSubtree == null) + if (_leftSubtree == null) { if (subtree.Parent != null) { subtree.Parent.Remove(subtree); } - leftSubtree = subtree; + _leftSubtree = subtree; subtree.Parent = this; } - else if (rightSubtree == null) + else if (_rightSubtree == null) { if (subtree.Parent != null) { subtree.Parent.Remove(subtree); } - rightSubtree = subtree; + _rightSubtree = subtree; subtree.Parent = this; } else @@ -648,14 +650,14 @@ namespace NGenerics.DataStructures.Trees var leftHeight = 0; var rightHeight = 0; - if (leftSubtree != null) + if (_leftSubtree != null) { - leftHeight = leftSubtree.Height; + leftHeight = _leftSubtree.Height; } - if (rightSubtree != null) + if (_rightSubtree != null) { - rightHeight = rightSubtree.Height; + rightHeight = _rightSubtree.Height; } return leftHeight > rightHeight ? leftHeight : rightHeight; @@ -680,7 +682,7 @@ namespace NGenerics.DataStructures.Trees #region ICollection Members - /// + /// public bool IsReadOnly { get @@ -693,7 +695,7 @@ namespace NGenerics.DataStructures.Trees #region IEnumerable Members - /// + /// IEnumerator IEnumerable.GetEnumerator() { return GetEnumerator(); @@ -703,10 +705,10 @@ namespace NGenerics.DataStructures.Trees #region Object Members - /// + /// public override string ToString() { - return data.ToString(); + return _data.ToString(); } #endregion diff --git a/src/NGenerics/DataStructures/Trees/ISearchTree.cs b/src/NGenerics/DataStructures/Trees/ISearchTree.cs index c9f5fb0534..08cc31ddfa 100644 --- a/src/NGenerics/DataStructures/Trees/ISearchTree.cs +++ b/src/NGenerics/DataStructures/Trees/ISearchTree.cs @@ -1,4 +1,7 @@ -/* +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. + +/* Copyright 2007-2013 The NGenerics Team (https://github.com/ngenerics/ngenerics/wiki/Team) @@ -15,13 +18,13 @@ using NGenerics.Patterns.Visitor; namespace NGenerics.DataStructures.Trees { - /// /// An interface for Search Trees that mimic a dictionary. /// /// The type of element to hold in the tree. [SuppressMessage("Microsoft.Naming", "CA1710:IdentifiersShouldHaveCorrectSuffix")] - public interface ISearchTree : ICollection { + public interface ISearchTree : ICollection + { /// /// Gets the largest item in the tree. /// diff --git a/src/NGenerics/DataStructures/Trees/ITree.cs b/src/NGenerics/DataStructures/Trees/ITree.cs index c80d8e8604..7d2f7d134a 100644 --- a/src/NGenerics/DataStructures/Trees/ITree.cs +++ b/src/NGenerics/DataStructures/Trees/ITree.cs @@ -1,4 +1,7 @@ -/* +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. + +/* Copyright 2007-2013 The NGenerics Team (https://github.com/ngenerics/ngenerics/wiki/Team) @@ -9,12 +12,14 @@ using System; -namespace NGenerics.DataStructures.Trees { +namespace NGenerics.DataStructures.Trees +{ /// /// An interface for the tree data structure /// /// The type of elements in the tree. - public interface ITree { + public interface ITree + { /// /// Adds the specified child to the tree. /// @@ -72,6 +77,6 @@ namespace NGenerics.DataStructures.Trees { /// Gets the parent of the current node. /// /// The parent of the current node. - ITree Parent { get;} + ITree Parent { get; } } } diff --git a/src/NGenerics/DataStructures/Trees/NodeColor.cs b/src/NGenerics/DataStructures/Trees/NodeColor.cs index 1164b1b509..839c1fbe0e 100644 --- a/src/NGenerics/DataStructures/Trees/NodeColor.cs +++ b/src/NGenerics/DataStructures/Trees/NodeColor.cs @@ -1,3 +1,6 @@ +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. + /* Copyright 2007-2013 The NGenerics Team (https://github.com/ngenerics/ngenerics/wiki/Team) diff --git a/src/NGenerics/DataStructures/Trees/RedBlackTree.cs b/src/NGenerics/DataStructures/Trees/RedBlackTree.cs index 422155aa4a..a2c76971c5 100644 --- a/src/NGenerics/DataStructures/Trees/RedBlackTree.cs +++ b/src/NGenerics/DataStructures/Trees/RedBlackTree.cs @@ -1,4 +1,7 @@ -/* +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. + +/* Copyright 2007-2013 The NGenerics Team (https://github.com/ngenerics/ngenerics/wiki/Team) @@ -17,32 +20,36 @@ using System; using System.Collections.Generic; using System.Diagnostics.CodeAnalysis; -namespace NGenerics.DataStructures.Trees { +namespace NGenerics.DataStructures.Trees +{ /// /// An implementation of a Red-Black tree. /// /// The type of element to keep in the tree. [SuppressMessage("Microsoft.Naming", "CA1710:IdentifiersShouldHaveCorrectSuffix")] //[Serializable] - public class RedBlackTree : BinarySearchTreeBase { - + public class RedBlackTree : BinarySearchTreeBase + { #region Construction - + /// - public RedBlackTree() { + public RedBlackTree() + { // Do nothing - the default Comparer will be used by the base class. } /// public RedBlackTree(IComparer comparer) - : base(comparer) { + : base(comparer) + { // Do nothing else. } /// public RedBlackTree(Comparison comparison) - : base(comparison) { + : base(comparison) + { // Do nothing else. } @@ -54,10 +61,12 @@ namespace NGenerics.DataStructures.Trees { /// Adds an element with the provided key and value to the . /// /// The item. - protected override void AddItem(T item) { + protected override void AddItem(T item) + { #region Validation - if (Equals(item, null)) { + if (Equals(item, null)) + { throw new ArgumentNullException("item"); } @@ -78,8 +87,10 @@ namespace NGenerics.DataStructures.Trees { /// true if the element is successfully removed; otherwise, false. This method also returns false if key was not found in the original . /// /// - protected override bool RemoveItem(T item) { - if (Tree != null) { + protected override bool RemoveItem(T item) + { + if (Tree != null) + { var startNode = new RedBlackTreeNode(default(T)); var childNode = startNode; @@ -90,7 +101,8 @@ namespace NGenerics.DataStructures.Trees { var direction = true; - while (childNode[direction] != null) { + while (childNode[direction] != null) + { var lastDirection = direction; var grandParent = parent; @@ -99,29 +111,41 @@ namespace NGenerics.DataStructures.Trees { var comparisonValue = Comparer.Compare(childNode.Data, item); - if (comparisonValue == 0) { + if (comparisonValue == 0) + { foundNode = childNode; } direction = comparisonValue < 0; - if ((IsBlack(childNode)) && (IsBlack(childNode[direction]))) { - if (IsRed(childNode[!direction])) { + if ((IsBlack(childNode)) && (IsBlack(childNode[direction]))) + { + if (IsRed(childNode[!direction])) + { parent = parent[lastDirection] = SingleRotation(childNode, direction); - } else if (IsBlack(childNode[direction])) { + } + else if (IsBlack(childNode[direction])) + { var sibling = parent[!lastDirection]; - if (sibling != null) { - if ((IsBlack(sibling.Left)) && (IsBlack(sibling.Right))) { + if (sibling != null) + { + if ((IsBlack(sibling.Left)) && (IsBlack(sibling.Right))) + { parent.Color = NodeColor.Black; sibling.Color = NodeColor.Red; childNode.Color = NodeColor.Red; - } else { + } + else + { var parentDirection = grandParent.Right == parent; - if (IsRed(sibling[lastDirection])) { + if (IsRed(sibling[lastDirection])) + { grandParent[parentDirection] = DoubleRotation(parent, lastDirection); - } else if (IsRed(sibling[!lastDirection])) { + } + else if (IsRed(sibling[!lastDirection])) + { grandParent[parentDirection] = SingleRotation(parent, lastDirection); } @@ -134,18 +158,21 @@ namespace NGenerics.DataStructures.Trees { } } - if (foundNode != null) { + if (foundNode != null) + { foundNode.Data = childNode.Data; parent[parent.Right == childNode] = childNode[childNode.Left == null]; } Tree = startNode.Right; - if (Tree != null) { + if (Tree != null) + { ((RedBlackTreeNode)Tree).Color = NodeColor.Black; } - if (foundNode != null) { + if (foundNode != null) + { return true; } } @@ -164,7 +191,8 @@ namespace NGenerics.DataStructures.Trees { /// /// true if the specified node is red; otherwise, false. /// - private static bool IsRed(RedBlackTreeNode node) { + private static bool IsRed(RedBlackTreeNode node) + { return (node != null) && (node.Color == NodeColor.Red); } @@ -175,7 +203,8 @@ namespace NGenerics.DataStructures.Trees { /// /// true if the specified node is black; otherwise, false. /// - private static bool IsBlack(RedBlackTreeNode node) { + private static bool IsBlack(RedBlackTreeNode node) + { return (node == null) || (node.Color == NodeColor.Black); } @@ -185,28 +214,41 @@ namespace NGenerics.DataStructures.Trees { /// The start node. /// The item. /// The node created in the insertion. - private RedBlackTreeNode InsertNode(RedBlackTreeNode node, T item) { - if (node == null) { + private RedBlackTreeNode InsertNode(RedBlackTreeNode node, T item) + { + if (node == null) + { node = new RedBlackTreeNode(item); - } else if (Comparer.Compare(item, node.Data) != 0) { + } + else if (Comparer.Compare(item, node.Data) != 0) + { var direction = Comparer.Compare(node.Data, item) < 0; node[direction] = InsertNode(node[direction], item); - if (IsRed(node[direction])) { - if (IsRed(node[!direction])) { + if (IsRed(node[direction])) + { + if (IsRed(node[!direction])) + { node.Color = NodeColor.Red; node.Left.Color = NodeColor.Black; node.Right.Color = NodeColor.Black; - } else { - if (IsRed(node[direction][direction])) { + } + else + { + if (IsRed(node[direction][direction])) + { node = SingleRotation(node, !direction); - } else if (IsRed(node[direction][!direction])) { + } + else if (IsRed(node[direction][!direction])) + { node = DoubleRotation(node, !direction); } } } - } else { + } + else + { throw new ArgumentException(alreadyContainedInTheTree); } @@ -219,7 +261,8 @@ namespace NGenerics.DataStructures.Trees { /// The node on which to focus the rotation. /// The direction of the rotation. If direction is equal to true, a right rotation is performed. Other wise, a left rotation. /// The new root of the cluster. - private static RedBlackTreeNode SingleRotation(RedBlackTreeNode node, bool direction) { + private static RedBlackTreeNode SingleRotation(RedBlackTreeNode node, bool direction) + { var childSibling = node[!direction]; node[!direction] = childSibling[direction]; @@ -237,7 +280,8 @@ namespace NGenerics.DataStructures.Trees { /// The node on which to focus the rotation. /// The direction of the rotation. If direction is equal to true, a right rotation is performed. Other wise, a left rotation. /// The new root of the cluster. - private static RedBlackTreeNode DoubleRotation(RedBlackTreeNode node, bool direction) { + private static RedBlackTreeNode DoubleRotation(RedBlackTreeNode node, bool direction) + { node[!direction] = SingleRotation(node[!direction], !direction); return SingleRotation(node, direction); } diff --git a/src/NGenerics/DataStructures/Trees/RedBlackTreeDictionary.cs b/src/NGenerics/DataStructures/Trees/RedBlackTreeDictionary.cs index de0d677d07..812fb0fa8b 100644 --- a/src/NGenerics/DataStructures/Trees/RedBlackTreeDictionary.cs +++ b/src/NGenerics/DataStructures/Trees/RedBlackTreeDictionary.cs @@ -1,3 +1,6 @@ +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. + /* Copyright 2007-2013 The NGenerics Team (https://github.com/ngenerics/ngenerics/wiki/Team) @@ -22,222 +25,227 @@ using NGenerics.Patterns.Visitor; namespace NGenerics.DataStructures.Trees { - /// - /// An implementation of a Red-Black tree. - /// - /// The type of the keys in the . - /// The type of the values in the . - [SuppressMessage("Microsoft.Naming", "CA1710:IdentifiersShouldHaveCorrectSuffix")] + /// + /// An implementation of a Red-Black tree. + /// + /// The type of the keys in the . + /// The type of the values in the . + [SuppressMessage("Microsoft.Naming", "CA1710:IdentifiersShouldHaveCorrectSuffix")] #if (!SILVERLIGHT && !WINDOWSPHONE) //[Serializable] #endif public class RedBlackTree : RedBlackTree>, IDictionary // BinarySearchTreeBase - { - #region Construction - /// - public RedBlackTree() : base(new KeyValuePairComparer()) - { - // Do nothing - the default Comparer will be used by the base class. - } - - - /// - public RedBlackTree(IComparer comparer) - : base(new KeyValuePairComparer(comparer)) - { - // Do nothing else. - } - - /// - public RedBlackTree(Comparison comparison) - : base(new KeyValuePairComparer(comparison)) - { - // Do nothing else. - } - - #endregion - - #region Private Members - - private RedBlackTreeNode> FindNode(TKey key) - { - return base.FindNode(new KeyValuePair(key, default(TValue))) as RedBlackTreeNode>; - } - - private bool Contains(KeyValuePair item, bool checkValue) { - var node = FindNode(item); - - if ((node != null) && !checkValue) { - return true; - } - - return node != null && Equals(item.Value, node.Data.Value); - } - - #endregion - - #region IDictionary Members - - /// - /// Removes the element with the specified key from the . - /// - /// The key of the element to remove. - /// - /// true if the element is successfully removed; otherwise, false. This method also returns false if was not found in the original . - /// - /// - /// is null. - /// - /// - /// The is read-only. - /// - public bool Remove(TKey key) { - return Remove(new KeyValuePair(key, default(TValue))); - } - - /// - /// Adds an element with the provided key and value to the . - /// - /// The object to use as the key of the element to add. - /// The object to use as the value of the element to add. - /// - /// is null. - /// - /// - /// An element with the same key already exists in the . - /// - /// - /// The is read-only. - /// - public void Add(TKey key, TValue value) { - - if (Equals(key, null)) - { - throw new ArgumentNullException("key"); - } - - Add(new KeyValuePair(key, value)); - } - - /// - /// Determines whether the contains an element with the specified key. - /// - /// The key to locate in the . - /// - /// true if the contains an element with the key; otherwise, false. - /// - /// - /// is null. - /// - public bool ContainsKey(TKey key) { - return Contains(new KeyValuePair(key, default(TValue)), false); - } - - /// - /// Gets an containing the keys of the . - /// - /// - /// - /// - /// - /// - public ICollection Keys - { - get - { - // Get the keys in sorted order - var visitor = new KeyTrackingVisitor(); - var inOrderVisitor = new InOrderVisitor>(visitor); - DepthFirstTraversal(inOrderVisitor); - return new ReadOnlyCollection(visitor.TrackingList); - } - } - - - /// - /// - /// - /// - /// - public bool TryGetValue(TKey key, out TValue value) - { - var node = FindNode(new KeyValuePair(key, default(TValue))); - - if (node == null) - { - value = default(TValue); - return false; - } - - value = node.Data.Value; - return true; - } - - /// - /// Gets an containing the values in the . - /// - /// - /// - /// - /// - /// - public ICollection Values - { - get - { - var visitor = new ValueTrackingVisitor(); - var inOrderVisitor = new InOrderVisitor>(visitor); - - DepthFirstTraversal(inOrderVisitor); - - return new ReadOnlyCollection(visitor.TrackingList); - } - } - - - /// - /// Gets or sets the value with the specified key. - /// - /// The key of the item to set or get. - public TValue this[TKey key] - { - get - { - var node = FindNode(key); - - if (node == null) - { - throw new KeyNotFoundException("key"); - } - - return node.Data.Value; - } - set - { - var node = FindNode(key); - - if (node == null) - { - throw new KeyNotFoundException("key"); - } - - node.Data = new KeyValuePair(key, value); - } - } - - #endregion - - #region ICollection> Members - - /// - /// - /// - /// - /// - public override bool Contains(KeyValuePair item) { - return Contains(item, true); - } - - #endregion - } + { + #region Construction + /// + public RedBlackTree() : base(new KeyValuePairComparer()) + { + // Do nothing - the default Comparer will be used by the base class. + } + + + /// + public RedBlackTree(IComparer comparer) + : base(new KeyValuePairComparer(comparer)) + { + // Do nothing else. + } + + /// + public RedBlackTree(Comparison comparison) + : base(new KeyValuePairComparer(comparison)) + { + // Do nothing else. + } + + #endregion + + #region Private Members + + private RedBlackTreeNode> FindNode(TKey key) + { + return base.FindNode(new KeyValuePair(key, default(TValue))) as RedBlackTreeNode>; + } + + private bool Contains(KeyValuePair item, bool checkValue) + { + var node = FindNode(item); + + if ((node != null) && !checkValue) + { + return true; + } + + return node != null && Equals(item.Value, node.Data.Value); + } + + #endregion + + #region IDictionary Members + + /// + /// Removes the element with the specified key from the . + /// + /// The key of the element to remove. + /// + /// true if the element is successfully removed; otherwise, false. This method also returns false if was not found in the original . + /// + /// + /// is null. + /// + /// + /// The is read-only. + /// + public bool Remove(TKey key) + { + return Remove(new KeyValuePair(key, default(TValue))); + } + + /// + /// Adds an element with the provided key and value to the . + /// + /// The object to use as the key of the element to add. + /// The object to use as the value of the element to add. + /// + /// is null. + /// + /// + /// An element with the same key already exists in the . + /// + /// + /// The is read-only. + /// + public void Add(TKey key, TValue value) + { + if (Equals(key, null)) + { + throw new ArgumentNullException("key"); + } + + Add(new KeyValuePair(key, value)); + } + + /// + /// Determines whether the contains an element with the specified key. + /// + /// The key to locate in the . + /// + /// true if the contains an element with the key; otherwise, false. + /// + /// + /// is null. + /// + public bool ContainsKey(TKey key) + { + return Contains(new KeyValuePair(key, default(TValue)), false); + } + + /// + /// Gets an containing the keys of the . + /// + /// + /// + /// + /// + /// + public ICollection Keys + { + get + { + // Get the keys in sorted order + var visitor = new KeyTrackingVisitor(); + var inOrderVisitor = new InOrderVisitor>(visitor); + DepthFirstTraversal(inOrderVisitor); + return new ReadOnlyCollection(visitor.TrackingList); + } + } + + + /// + /// + /// + /// + /// + public bool TryGetValue(TKey key, out TValue value) + { + var node = FindNode(new KeyValuePair(key, default(TValue))); + + if (node == null) + { + value = default(TValue); + return false; + } + + value = node.Data.Value; + return true; + } + + /// + /// Gets an containing the values in the . + /// + /// + /// + /// + /// + /// + public ICollection Values + { + get + { + var visitor = new ValueTrackingVisitor(); + var inOrderVisitor = new InOrderVisitor>(visitor); + + DepthFirstTraversal(inOrderVisitor); + + return new ReadOnlyCollection(visitor.TrackingList); + } + } + + + /// + /// Gets or sets the value with the specified key. + /// + /// The key of the item to set or get. + public TValue this[TKey key] + { + get + { + var node = FindNode(key); + + if (node == null) + { + throw new KeyNotFoundException("key"); + } + + return node.Data.Value; + } + set + { + var node = FindNode(key); + + if (node == null) + { + throw new KeyNotFoundException("key"); + } + + node.Data = new KeyValuePair(key, value); + } + } + + #endregion + + #region ICollection> Members + + /// + /// + /// + /// + /// + public override bool Contains(KeyValuePair item) + { + return Contains(item, true); + } + + #endregion + } } \ No newline at end of file diff --git a/src/NGenerics/DataStructures/Trees/RedBlackTreeList.cs b/src/NGenerics/DataStructures/Trees/RedBlackTreeList.cs index 3f88cb1cad..7a4c64168d 100644 --- a/src/NGenerics/DataStructures/Trees/RedBlackTreeList.cs +++ b/src/NGenerics/DataStructures/Trees/RedBlackTreeList.cs @@ -1,3 +1,6 @@ +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. + /* Copyright 2007-2013 The NGenerics Team (https://github.com/ngenerics/ngenerics/wiki/Team) @@ -34,24 +37,27 @@ namespace NGenerics.DataStructures.Trees /// Initializes a new instance of the class. /// /// - public RedBlackTreeList() { + public RedBlackTreeList() + { // Do nothing else. } /// public RedBlackTreeList(IComparer comparer) - : base(comparer) { + : base(comparer) + { // Do nothing else. } /// public RedBlackTreeList(Comparison comparison) - : base(comparison) { + : base(comparison) + { // Do nothing else. } #endregion - + #region Public Members /// @@ -153,7 +159,8 @@ namespace NGenerics.DataStructures.Trees var foundKey = default(TKey); var ret = TraverseItems( - delegate(TKey itemKey, LinkedList list) { + delegate (TKey itemKey, LinkedList list) + { if (list.Remove(value)) { if (list.Count == 0) @@ -200,12 +207,12 @@ namespace NGenerics.DataStructures.Trees while (stack.Count > 0) { var currentNode = stack.Pop(); - + if (shouldStop(currentNode.Data.Key, currentNode.Data.Value)) { return true; } - + if (currentNode.Left != null) { stack.Push(currentNode.Left); diff --git a/src/NGenerics/DataStructures/Trees/RedBlackTreeNode.cs b/src/NGenerics/DataStructures/Trees/RedBlackTreeNode.cs index 5823f85306..02d6cf837a 100644 --- a/src/NGenerics/DataStructures/Trees/RedBlackTreeNode.cs +++ b/src/NGenerics/DataStructures/Trees/RedBlackTreeNode.cs @@ -1,4 +1,7 @@ -/* +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. + +/* Copyright 2007-2013 The NGenerics Team (https://github.com/ngenerics/ngenerics/wiki/Team) @@ -9,17 +12,19 @@ -using System;using System.Diagnostics.CodeAnalysis; +using System; +using System.Diagnostics.CodeAnalysis; -namespace NGenerics.DataStructures.Trees { +namespace NGenerics.DataStructures.Trees +{ /// /// A container class, used for the RedBlackTree. /// /// The type of element. //[Serializable] [SuppressMessage("Microsoft.Naming", "CA1710:IdentifiersShouldHaveCorrectSuffix")] - internal class RedBlackTreeNode : BinaryTree { - + internal class RedBlackTreeNode : BinaryTree + { #region Construction /// @@ -27,7 +32,8 @@ namespace NGenerics.DataStructures.Trees { /// /// The data contained in this node. internal RedBlackTreeNode(T data) - : base(data) { + : base(data) + { Color = NodeColor.Red; } @@ -45,14 +51,20 @@ namespace NGenerics.DataStructures.Trees { /// Gets or sets the with the specified direction. /// /// - internal RedBlackTreeNode this[bool direction] { - get { + internal RedBlackTreeNode this[bool direction] + { + get + { return direction ? Right : Left; } - set { - if (direction) { + set + { + if (direction) + { Right = value; - } else { + } + else + { Left = value; } } @@ -62,11 +74,14 @@ namespace NGenerics.DataStructures.Trees { /// Gets or sets the left subtree. /// /// The left subtree. - internal new RedBlackTreeNode Left { - get { + internal new RedBlackTreeNode Left + { + get + { return (RedBlackTreeNode)base.Left; } - set { + set + { base.Left = value; } } @@ -75,15 +90,17 @@ namespace NGenerics.DataStructures.Trees { /// Gets or sets the right subtree. /// /// The right subtree. - internal new RedBlackTreeNode Right { - get { + internal new RedBlackTreeNode Right + { + get + { return (RedBlackTreeNode)base.Right; } - set { + set + { base.Right = value; } } - #endregion } diff --git a/src/NGenerics/Patterns/Visitor/IVisitor.cs b/src/NGenerics/Patterns/Visitor/IVisitor.cs index d9460e51a9..acaf2ff110 100644 --- a/src/NGenerics/Patterns/Visitor/IVisitor.cs +++ b/src/NGenerics/Patterns/Visitor/IVisitor.cs @@ -1,4 +1,7 @@ -/* +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. + +/* Copyright 2007-2013 The NGenerics Team (https://github.com/ngenerics/ngenerics/wiki/Team) diff --git a/src/NGenerics/Patterns/Visitor/InOrderVisitor.cs b/src/NGenerics/Patterns/Visitor/InOrderVisitor.cs index 12ba98e55e..de65c9cd92 100644 --- a/src/NGenerics/Patterns/Visitor/InOrderVisitor.cs +++ b/src/NGenerics/Patterns/Visitor/InOrderVisitor.cs @@ -1,3 +1,6 @@ +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. + /* Copyright 2007-2013 The NGenerics Team (https://github.com/ngenerics/ngenerics/wiki/Team) @@ -24,7 +27,7 @@ namespace NGenerics.Patterns.Visitor #endregion #region OrderedVisitor Members - + /// /// Visits the object in post order. /// diff --git a/src/NGenerics/Patterns/Visitor/KeyTrackingVisitor.cs b/src/NGenerics/Patterns/Visitor/KeyTrackingVisitor.cs index d03f935fe3..d644695ca8 100644 --- a/src/NGenerics/Patterns/Visitor/KeyTrackingVisitor.cs +++ b/src/NGenerics/Patterns/Visitor/KeyTrackingVisitor.cs @@ -1,3 +1,6 @@ +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. + /* Copyright 2007-2013 The NGenerics Team (https://github.com/ngenerics/ngenerics/wiki/Team) @@ -21,7 +24,7 @@ namespace NGenerics.Patterns.Visitor { #region Globals - private readonly List tracks; + private readonly List _tracks; #endregion @@ -30,7 +33,7 @@ namespace NGenerics.Patterns.Visitor /// public KeyTrackingVisitor() { - tracks = new List(); + _tracks = new List(); } #endregion @@ -45,7 +48,7 @@ namespace NGenerics.Patterns.Visitor { get { - return tracks; + return _tracks; } } @@ -57,7 +60,7 @@ namespace NGenerics.Patterns.Visitor /// public void Visit(KeyValuePair obj) { - tracks.Add(obj.Key); + _tracks.Add(obj.Key); } /// diff --git a/src/NGenerics/Patterns/Visitor/OrderedVisitor.cs b/src/NGenerics/Patterns/Visitor/OrderedVisitor.cs index 881c4bfda1..9cf3171f55 100644 --- a/src/NGenerics/Patterns/Visitor/OrderedVisitor.cs +++ b/src/NGenerics/Patterns/Visitor/OrderedVisitor.cs @@ -1,3 +1,6 @@ +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. + /* Copyright 2007-2013 The NGenerics Team (https://github.com/ngenerics/ngenerics/wiki/Team) @@ -23,7 +26,7 @@ namespace NGenerics.Patterns.Visitor { #region Globals - private readonly IVisitor visitorToUse; + private readonly IVisitor _visitorToUse; #endregion @@ -35,7 +38,7 @@ namespace NGenerics.Patterns.Visitor { Guard.ArgumentNotNull(visitorToUse, "visitorToUse"); - this.visitorToUse = visitorToUse; + _visitorToUse = visitorToUse; } #endregion @@ -53,7 +56,7 @@ namespace NGenerics.Patterns.Visitor { get { - return visitorToUse.HasCompleted; + return _visitorToUse.HasCompleted; } } @@ -64,7 +67,7 @@ namespace NGenerics.Patterns.Visitor [SuppressMessage("Microsoft.Naming", "CA1702:CompoundWordsShouldBeCasedCorrectly", MessageId = "PreOrder")] public virtual void VisitPreOrder(T obj) { - visitorToUse.Visit(obj); + _visitorToUse.Visit(obj); } /// @@ -73,7 +76,7 @@ namespace NGenerics.Patterns.Visitor /// The obj. public virtual void VisitPostOrder(T obj) { - visitorToUse.Visit(obj); + _visitorToUse.Visit(obj); } /// @@ -82,12 +85,12 @@ namespace NGenerics.Patterns.Visitor /// The obj. public virtual void VisitInOrder(T obj) { - visitorToUse.Visit(obj); + _visitorToUse.Visit(obj); } /// public void Visit(T obj) { - visitorToUse.Visit(obj); + _visitorToUse.Visit(obj); } #endregion @@ -102,7 +105,7 @@ namespace NGenerics.Patterns.Visitor { get { - return visitorToUse; + return _visitorToUse; } } diff --git a/src/NGenerics/Patterns/Visitor/TrackingVisitor.cs b/src/NGenerics/Patterns/Visitor/TrackingVisitor.cs index 17d4c67fa4..f07df9cc22 100644 --- a/src/NGenerics/Patterns/Visitor/TrackingVisitor.cs +++ b/src/NGenerics/Patterns/Visitor/TrackingVisitor.cs @@ -1,3 +1,6 @@ +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. + /* Copyright 2007-2013 The NGenerics Team (https://github.com/ngenerics/ngenerics/wiki/Team) @@ -22,7 +25,7 @@ namespace NGenerics.Patterns.Visitor { #region Globals - private readonly List tracks; + private readonly List _tracks; #endregion @@ -32,7 +35,7 @@ namespace NGenerics.Patterns.Visitor /// public TrackingVisitor() { - tracks = new List(); + _tracks = new List(); } #endregion @@ -41,11 +44,12 @@ namespace NGenerics.Patterns.Visitor /// public void Visit(T obj) { - tracks.Add(obj); + _tracks.Add(obj); } /// - public bool HasCompleted { + public bool HasCompleted + { get { return false; @@ -64,7 +68,7 @@ namespace NGenerics.Patterns.Visitor { get { - return tracks; + return _tracks; } } diff --git a/src/NGenerics/Patterns/Visitor/ValueTrackingVisitor.cs b/src/NGenerics/Patterns/Visitor/ValueTrackingVisitor.cs index 01d79e6617..3e7bf91628 100644 --- a/src/NGenerics/Patterns/Visitor/ValueTrackingVisitor.cs +++ b/src/NGenerics/Patterns/Visitor/ValueTrackingVisitor.cs @@ -1,3 +1,6 @@ +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. + /* Copyright 2007-2013 The NGenerics Team (https://github.com/ngenerics/ngenerics/wiki/Team) @@ -21,7 +24,7 @@ namespace NGenerics.Patterns.Visitor { #region Globals - private readonly List tracks; + private readonly List _tracks; #endregion @@ -31,7 +34,7 @@ namespace NGenerics.Patterns.Visitor /// public ValueTrackingVisitor() { - tracks = new List(); + _tracks = new List(); } #endregion @@ -46,7 +49,7 @@ namespace NGenerics.Patterns.Visitor { get { - return tracks; + return _tracks; } } @@ -58,7 +61,7 @@ namespace NGenerics.Patterns.Visitor /// public void Visit(KeyValuePair obj) { - tracks.Add(obj.Value); + _tracks.Add(obj.Value); } /// diff --git a/src/NGenerics/Properties/AssemblyInfo.cs b/src/NGenerics/Properties/AssemblyInfo.cs index f36d08c227..5bd5019cf6 100644 --- a/src/NGenerics/Properties/AssemblyInfo.cs +++ b/src/NGenerics/Properties/AssemblyInfo.cs @@ -1,4 +1,7 @@ -using System.Resources; +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. + +using System.Resources; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; @@ -11,7 +14,7 @@ using System.Runtime.InteropServices; [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("NGenerics")] -[assembly: AssemblyCopyright("Copyright © 2014")] +[assembly: AssemblyCopyright("Copyright \u00A9 2014")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] [assembly: NeutralResourcesLanguage("en")] diff --git a/src/NGenerics/Util/Guard.cs b/src/NGenerics/Util/Guard.cs index 89f70a7cba..20bccf4a58 100644 --- a/src/NGenerics/Util/Guard.cs +++ b/src/NGenerics/Util/Guard.cs @@ -1,3 +1,6 @@ +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. + /* Copyright 2007-2013 The NGenerics Team (https://github.com/ngenerics/ngenerics/wiki/Team) diff --git a/src/Perspex.Animation/Animatable.cs b/src/Perspex.Animation/Animatable.cs index 59767ccf18..33c7f611ad 100644 --- a/src/Perspex.Animation/Animatable.cs +++ b/src/Perspex.Animation/Animatable.cs @@ -1,13 +1,10 @@ - - - - +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. +using System.Linq; namespace Perspex.Animation { - using System.Linq; - /// /// Base class for control which can have property transitions. /// @@ -16,7 +13,7 @@ namespace Perspex.Animation /// /// The property transitions for the control. /// - private PropertyTransitions propertyTransitions; + private PropertyTransitions _propertyTransitions; /// /// Gets or sets the property transitions for the control. @@ -28,17 +25,17 @@ namespace Perspex.Animation { get { - if (this.propertyTransitions == null) + if (_propertyTransitions == null) { - this.propertyTransitions = new PropertyTransitions(); + _propertyTransitions = new PropertyTransitions(); } - return this.propertyTransitions; + return _propertyTransitions; } set { - this.propertyTransitions = value; + _propertyTransitions = value; } } @@ -49,9 +46,9 @@ namespace Perspex.Animation /// The event args. protected override void OnPropertyChanged(PerspexPropertyChangedEventArgs e) { - if (e.Priority != BindingPriority.Animation && this.propertyTransitions != null) + if (e.Priority != BindingPriority.Animation && _propertyTransitions != null) { - var match = this.propertyTransitions.FirstOrDefault(x => x.Property == e.Property); + var match = _propertyTransitions.FirstOrDefault(x => x.Property == e.Property); if (match != null) { diff --git a/src/Perspex.Animation/Animate.cs b/src/Perspex.Animation/Animate.cs index 07171c2388..d25746e8c6 100644 --- a/src/Perspex.Animation/Animate.cs +++ b/src/Perspex.Animation/Animate.cs @@ -1,17 +1,14 @@ - - - - +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. +using System; +using System.Diagnostics; +using System.Linq; +using System.Reactive.Linq; +using Perspex.Threading; namespace Perspex.Animation { - using System; - using System.Diagnostics; - using System.Linq; - using System.Reactive.Linq; - using Perspex.Threading; - /// /// Utilities for creating animations. /// @@ -25,7 +22,7 @@ namespace Perspex.Animation /// /// The time span of each frame. /// - private static readonly TimeSpan Tick = TimeSpan.FromSeconds(1.0 / FramesPerSecond); + private static readonly TimeSpan s_tick = TimeSpan.FromSeconds(1.0 / FramesPerSecond); /// /// Initializes static members of the class. @@ -34,7 +31,7 @@ namespace Perspex.Animation { Stopwatch = new Stopwatch(); Stopwatch.Start(); - Timer = Observable.Interval(Tick, PerspexScheduler.Instance) + Timer = Observable.Interval(s_tick, PerspexScheduler.Instance) .Select(_ => Stopwatch.Elapsed) .Publish() .RefCount(); diff --git a/src/Perspex.Animation/Animation.cs b/src/Perspex.Animation/Animation.cs index 4bcec91607..60c05bde2e 100644 --- a/src/Perspex.Animation/Animation.cs +++ b/src/Perspex.Animation/Animation.cs @@ -1,13 +1,10 @@ - - - - +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. +using System; namespace Perspex.Animation { - using System; - /// /// Tracks the progress of an animation. /// @@ -16,12 +13,12 @@ namespace Perspex.Animation /// /// The animation being tracked. /// - private IObservable inner; + private IObservable _inner; /// /// The disposable used to cancel the animation. /// - private IDisposable subscription; + private IDisposable _subscription; /// /// Initializes a new instance of the class. @@ -30,8 +27,8 @@ namespace Perspex.Animation /// A disposable used to cancel the animation. public Animation(IObservable inner, IDisposable subscription) { - this.inner = inner; - this.subscription = subscription; + _inner = inner; + _subscription = subscription; } /// @@ -39,7 +36,7 @@ namespace Perspex.Animation /// public void Dispose() { - this.subscription.Dispose(); + _subscription.Dispose(); } /// @@ -52,7 +49,7 @@ namespace Perspex.Animation /// public IDisposable Subscribe(IObserver observer) { - return this.inner.Subscribe(observer); + return _inner.Subscribe(observer); } } } diff --git a/src/Perspex.Animation/AnimationExtensions.cs b/src/Perspex.Animation/AnimationExtensions.cs index f4fda67e71..e78de91219 100644 --- a/src/Perspex.Animation/AnimationExtensions.cs +++ b/src/Perspex.Animation/AnimationExtensions.cs @@ -1,13 +1,10 @@ - - - - +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. +using System; namespace Perspex.Animation { - using System; - /// /// Defines animation extension methods. /// diff --git a/src/Perspex.Animation/Animation`1.cs b/src/Perspex.Animation/Animation`1.cs index a59382d0e9..9f6d2a9498 100644 --- a/src/Perspex.Animation/Animation`1.cs +++ b/src/Perspex.Animation/Animation`1.cs @@ -1,13 +1,10 @@ - - - - +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. +using System; namespace Perspex.Animation { - using System; - /// /// Tracks the progress of an animation. /// @@ -17,12 +14,12 @@ namespace Perspex.Animation /// /// The animation being tracked. /// - private IObservable inner; + private IObservable _inner; /// /// The disposable used to cancel the animation. /// - private IDisposable subscription; + private IDisposable _subscription; /// /// Initializes a new instance of the class. @@ -31,8 +28,8 @@ namespace Perspex.Animation /// A disposable used to cancel the animation. public Animation(IObservable inner, IDisposable subscription) { - this.inner = inner; - this.subscription = subscription; + _inner = inner; + _subscription = subscription; } /// @@ -40,7 +37,7 @@ namespace Perspex.Animation /// public void Dispose() { - this.subscription.Dispose(); + _subscription.Dispose(); } /// @@ -53,7 +50,7 @@ namespace Perspex.Animation /// public IDisposable Subscribe(IObserver observer) { - return this.inner.Subscribe(observer); + return _inner.Subscribe(observer); } } } diff --git a/src/Perspex.Animation/IEasing.cs b/src/Perspex.Animation/IEasing.cs index b317ea6f2e..34dab15f9f 100644 --- a/src/Perspex.Animation/IEasing.cs +++ b/src/Perspex.Animation/IEasing.cs @@ -1,8 +1,5 @@ - - - - - +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. namespace Perspex.Animation { diff --git a/src/Perspex.Animation/IEasing`1.cs b/src/Perspex.Animation/IEasing`1.cs index a906471fec..aa042d188d 100644 --- a/src/Perspex.Animation/IEasing`1.cs +++ b/src/Perspex.Animation/IEasing`1.cs @@ -1,8 +1,5 @@ - - - - - +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. namespace Perspex.Animation { diff --git a/src/Perspex.Animation/LinearDoubleEasing.cs b/src/Perspex.Animation/LinearDoubleEasing.cs index 39f3537d9b..8f7842d701 100644 --- a/src/Perspex.Animation/LinearDoubleEasing.cs +++ b/src/Perspex.Animation/LinearDoubleEasing.cs @@ -1,8 +1,5 @@ - - - - - +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. namespace Perspex.Animation { diff --git a/src/Perspex.Animation/LinearEasing.cs b/src/Perspex.Animation/LinearEasing.cs index 2f58cba63b..716ed2e6f5 100644 --- a/src/Perspex.Animation/LinearEasing.cs +++ b/src/Perspex.Animation/LinearEasing.cs @@ -1,13 +1,10 @@ - - - - +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. +using System; namespace Perspex.Animation { - using System; - /// /// Returns a linear for the specified type. /// diff --git a/src/Perspex.Animation/Properties/AssemblyInfo.cs b/src/Perspex.Animation/Properties/AssemblyInfo.cs index 186eab3c37..a359255e83 100644 --- a/src/Perspex.Animation/Properties/AssemblyInfo.cs +++ b/src/Perspex.Animation/Properties/AssemblyInfo.cs @@ -1,8 +1,5 @@ - - - - - +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. using System.Reflection; diff --git a/src/Perspex.Animation/PropertyTransition.cs b/src/Perspex.Animation/PropertyTransition.cs index 712d9cdd9c..3f8d667993 100644 --- a/src/Perspex.Animation/PropertyTransition.cs +++ b/src/Perspex.Animation/PropertyTransition.cs @@ -1,13 +1,10 @@ - - - - +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. +using System; namespace Perspex.Animation { - using System; - /// /// Defines how a property should be animated using a transition. /// diff --git a/src/Perspex.Animation/PropertyTransitions.cs b/src/Perspex.Animation/PropertyTransitions.cs index d770751d71..ab2fbc68c3 100644 --- a/src/Perspex.Animation/PropertyTransitions.cs +++ b/src/Perspex.Animation/PropertyTransitions.cs @@ -1,13 +1,10 @@ - - - - +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. +using Perspex.Collections; namespace Perspex.Animation { - using Perspex.Collections; - /// /// A collection of definitions. /// diff --git a/src/Perspex.Application/Application.cs b/src/Perspex.Application/Application.cs index e31cbbad19..f0383db181 100644 --- a/src/Perspex.Application/Application.cs +++ b/src/Perspex.Application/Application.cs @@ -1,24 +1,21 @@ - - - - - +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. + +using System; +using System.Reflection; +using System.Threading; +using Perspex.Controls; +using Perspex.Controls.Templates; +using Perspex.Input; +using Perspex.Input.Platform; +using Perspex.Layout; +using Perspex.Rendering; +using Perspex.Styling; +using Perspex.Threading; +using Splat; namespace Perspex { - using System; - using System.Reflection; - using System.Threading; - using Perspex.Controls; - using Perspex.Controls.Templates; - using Perspex.Input; - using Perspex.Input.Platform; - using Perspex.Layout; - using Perspex.Rendering; - using Perspex.Styling; - using Perspex.Threading; - using Splat; - /// /// Encapsulates a Perspex application. /// @@ -40,15 +37,15 @@ namespace Perspex /// /// The application-global data templates. /// - private DataTemplates dataTemplates; + private DataTemplates _dataTemplates; - private readonly Lazy clipboard = - new Lazy(() => (IClipboard) Locator.Current.GetService(typeof(IClipboard))); + private readonly Lazy _clipboard = + new Lazy(() => (IClipboard)Locator.Current.GetService(typeof(IClipboard))); /// /// The styler that will be used to apply styles to controls. /// - private Styler styler = new Styler(); + private Styler _styler = new Styler(); /// /// Initializes a new instance of the class. @@ -85,17 +82,17 @@ namespace Perspex { get { - if (this.dataTemplates == null) + if (_dataTemplates == null) { - this.dataTemplates = new DataTemplates(); + _dataTemplates = new DataTemplates(); } - return this.dataTemplates; + return _dataTemplates; } set { - this.dataTemplates = value; + _dataTemplates = value; } } @@ -123,7 +120,7 @@ namespace Perspex private set; } - public IClipboard Clipboard => this.clipboard.Value; + public IClipboard Clipboard => _clipboard.Value; /// /// Gets the application's global styles. @@ -166,7 +163,7 @@ namespace Perspex Locator.CurrentMutable.Register(() => this.FocusManager, typeof(IFocusManager)); Locator.CurrentMutable.Register(() => this.InputManager, typeof(IInputManager)); Locator.CurrentMutable.Register(() => new KeyboardNavigationHandler(), typeof(IKeyboardNavigationHandler)); - Locator.CurrentMutable.Register(() => this.styler, typeof(IStyler)); + Locator.CurrentMutable.Register(() => _styler, typeof(IStyler)); Locator.CurrentMutable.Register(() => new LayoutManager(), typeof(ILayoutManager)); Locator.CurrentMutable.Register(() => new RenderManager(), typeof(IRenderManager)); } diff --git a/src/Perspex.Application/Platform/IAssetLoader.cs b/src/Perspex.Application/Platform/IAssetLoader.cs index 4e796ce72f..96e0aad475 100644 --- a/src/Perspex.Application/Platform/IAssetLoader.cs +++ b/src/Perspex.Application/Platform/IAssetLoader.cs @@ -1,14 +1,11 @@ - - - - +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. +using System; +using System.IO; namespace Perspex.Platform { - using System; - using System.IO; - /// /// Loads assets compiled into the application binary. /// diff --git a/src/Perspex.Application/Properties/AssemblyInfo.cs b/src/Perspex.Application/Properties/AssemblyInfo.cs index e0f5877222..d3675d8478 100644 --- a/src/Perspex.Application/Properties/AssemblyInfo.cs +++ b/src/Perspex.Application/Properties/AssemblyInfo.cs @@ -1,8 +1,5 @@ - - - - - +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. using System.Reflection; diff --git a/src/Perspex.Base/BindingDescriptor.cs b/src/Perspex.Base/BindingDescriptor.cs index 64d9fe1445..fbeb670a71 100644 --- a/src/Perspex.Base/BindingDescriptor.cs +++ b/src/Perspex.Base/BindingDescriptor.cs @@ -1,14 +1,11 @@ - - - - +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. +using System; +using System.Reactive; namespace Perspex { - using System; - using System.Reactive; - /// /// Defines possible binding modes. /// diff --git a/src/Perspex.Base/Collections/IPerspexList.cs b/src/Perspex.Base/Collections/IPerspexList.cs index 8d1db05e11..90278a6044 100644 --- a/src/Perspex.Base/Collections/IPerspexList.cs +++ b/src/Perspex.Base/Collections/IPerspexList.cs @@ -1,13 +1,10 @@ - - - - +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. +using System.Collections.Generic; namespace Perspex.Collections { - using System.Collections.Generic; - /// /// A notiftying list. /// diff --git a/src/Perspex.Base/Collections/IPerspexReadOnlyList.cs b/src/Perspex.Base/Collections/IPerspexReadOnlyList.cs index f38756c506..6507c8002d 100644 --- a/src/Perspex.Base/Collections/IPerspexReadOnlyList.cs +++ b/src/Perspex.Base/Collections/IPerspexReadOnlyList.cs @@ -1,15 +1,12 @@ - - - - +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. +using System.Collections.Generic; +using System.Collections.Specialized; +using System.ComponentModel; namespace Perspex.Collections { - using System.Collections.Generic; - using System.Collections.Specialized; - using System.ComponentModel; - /// /// A read-only notiftying list. /// diff --git a/src/Perspex.Base/Collections/PerspexDictionary.cs b/src/Perspex.Base/Collections/PerspexDictionary.cs index 9735cc092d..cd8b4d6337 100644 --- a/src/Perspex.Base/Collections/PerspexDictionary.cs +++ b/src/Perspex.Base/Collections/PerspexDictionary.cs @@ -1,18 +1,15 @@ - - - - +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.Specialized; +using System.ComponentModel; +using System.Linq; namespace Perspex.Collections { - using System; - using System.Collections; - using System.Collections.Generic; - using System.Collections.Specialized; - using System.ComponentModel; - using System.Linq; - /// /// A notifying dictionary. /// @@ -22,14 +19,14 @@ namespace Perspex.Collections INotifyCollectionChanged, INotifyPropertyChanged { - private Dictionary inner; + private Dictionary _inner; /// /// Initializes a new instance of the class. /// public PerspexDictionary() { - this.inner = new Dictionary(); + _inner = new Dictionary(); } /// @@ -45,7 +42,7 @@ namespace Perspex.Collections /// public int Count { - get { return this.inner.Count; } + get { return _inner.Count; } } /// @@ -57,13 +54,13 @@ namespace Perspex.Collections /// public ICollection Keys { - get { return this.inner.Keys; } + get { return _inner.Keys; } } /// public ICollection Values { - get { return this.inner.Values; } + get { return _inner.Values; } } /// @@ -75,14 +72,14 @@ namespace Perspex.Collections { get { - return this.inner[key]; + return _inner[key]; } set { TValue old; - bool replace = this.inner.TryGetValue(key, out old); - this.inner[key] = value; + bool replace = _inner.TryGetValue(key, out old); + _inner[key] = value; if (replace) { @@ -110,16 +107,16 @@ namespace Perspex.Collections /// public void Add(TKey key, TValue value) { - this.inner.Add(key, value); + _inner.Add(key, value); this.NotifyAdd(key, value); } /// public void Clear() { - var old = this.inner; + var old = _inner; - this.inner = new Dictionary(); + _inner = new Dictionary(); if (this.PropertyChanged != null) { @@ -140,19 +137,19 @@ namespace Perspex.Collections /// public bool ContainsKey(TKey key) { - return this.inner.ContainsKey(key); + return _inner.ContainsKey(key); } /// public void CopyTo(KeyValuePair[] array, int arrayIndex) { - ((IDictionary)this.inner).CopyTo(array, arrayIndex); + ((IDictionary)_inner).CopyTo(array, arrayIndex); } /// public IEnumerator> GetEnumerator() { - return this.inner.GetEnumerator(); + return _inner.GetEnumerator(); } /// @@ -160,7 +157,7 @@ namespace Perspex.Collections { TValue value; - if (this.inner.TryGetValue(key, out value)) + if (_inner.TryGetValue(key, out value)) { if (this.PropertyChanged != null) { @@ -188,13 +185,13 @@ namespace Perspex.Collections /// public bool TryGetValue(TKey key, out TValue value) { - return this.inner.TryGetValue(key, out value); + return _inner.TryGetValue(key, out value); } /// IEnumerator IEnumerable.GetEnumerator() { - return this.inner.GetEnumerator(); + return _inner.GetEnumerator(); } /// @@ -206,7 +203,7 @@ namespace Perspex.Collections /// bool ICollection>.Contains(KeyValuePair item) { - return this.inner.Contains(item); + return _inner.Contains(item); } /// diff --git a/src/Perspex.Base/Collections/PerspexList.cs b/src/Perspex.Base/Collections/PerspexList.cs index d8fa1f59eb..4498fd8af7 100644 --- a/src/Perspex.Base/Collections/PerspexList.cs +++ b/src/Perspex.Base/Collections/PerspexList.cs @@ -1,18 +1,15 @@ - - - - +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.Specialized; +using System.ComponentModel; +using System.Linq; namespace Perspex.Collections { - using System; - using System.Collections; - using System.Collections.Generic; - using System.Collections.Specialized; - using System.ComponentModel; - using System.Linq; - /// /// A notifying list. /// @@ -25,7 +22,7 @@ namespace Perspex.Collections /// public class PerspexList : IPerspexList, IList, INotifyCollectionChanged, INotifyPropertyChanged { - private List inner; + private List _inner; /// /// Initializes a new instance of the class. @@ -41,7 +38,7 @@ namespace Perspex.Collections /// The initial items for the collection. public PerspexList(IEnumerable items) { - this.inner = new List(items); + _inner = new List(items); } /// @@ -50,7 +47,7 @@ namespace Perspex.Collections /// The initial items for the collection. public PerspexList(params T[] items) { - this.inner = new List(items); + _inner = new List(items); } /// @@ -68,7 +65,7 @@ namespace Perspex.Collections /// public int Count { - get { return this.inner.Count; } + get { return _inner.Count; } } /// @@ -86,7 +83,7 @@ namespace Perspex.Collections /// int ICollection.Count { - get { return this.inner.Count; } + get { return _inner.Count; } } /// @@ -116,13 +113,13 @@ namespace Perspex.Collections { get { - return this.inner[index]; + return _inner[index]; } set { - T old = this.inner[index]; - this.inner[index] = value; + T old = _inner[index]; + _inner[index] = value; if (this.CollectionChanged != null) { @@ -152,8 +149,8 @@ namespace Perspex.Collections /// The item. public void Add(T item) { - int index = this.inner.Count; - this.inner.Add(item); + int index = _inner.Count; + _inner.Add(item); this.NotifyAdd(new[] { item }, index); } @@ -165,8 +162,8 @@ namespace Perspex.Collections { Contract.Requires(items != null); - int index = this.inner.Count; - this.inner.AddRange(items); + int index = _inner.Count; + _inner.AddRange(items); this.NotifyAdd((items as IList) ?? items.ToList(), index); } @@ -175,8 +172,8 @@ namespace Perspex.Collections /// public void Clear() { - var old = this.inner; - this.inner = new List(); + var old = _inner; + _inner = new List(); this.NotifyRemove(old, 0); } @@ -187,7 +184,7 @@ namespace Perspex.Collections /// True if the collection contains the item; otherwise false. public bool Contains(T item) { - return this.inner.Contains(item); + return _inner.Contains(item); } /// @@ -197,7 +194,7 @@ namespace Perspex.Collections /// The first index of the array to copy to. public void CopyTo(T[] array, int arrayIndex) { - this.inner.CopyTo(array, arrayIndex); + _inner.CopyTo(array, arrayIndex); } /// @@ -206,7 +203,7 @@ namespace Perspex.Collections /// An . public IEnumerator GetEnumerator() { - return this.inner.GetEnumerator(); + return _inner.GetEnumerator(); } /// @@ -218,7 +215,7 @@ namespace Perspex.Collections /// public int IndexOf(T item) { - return this.inner.IndexOf(item); + return _inner.IndexOf(item); } /// @@ -228,7 +225,7 @@ namespace Perspex.Collections /// The item. public void Insert(int index, T item) { - this.inner.Insert(index, item); + _inner.Insert(index, item); this.NotifyAdd(new[] { item }, index); } @@ -241,7 +238,7 @@ namespace Perspex.Collections { Contract.Requires(items != null); - this.inner.InsertRange(index, items); + _inner.InsertRange(index, items); this.NotifyAdd((items as IList) ?? items.ToList(), index); } @@ -252,11 +249,11 @@ namespace Perspex.Collections /// True if the item was found and removed, otherwise false. public bool Remove(T item) { - int index = this.inner.IndexOf(item); + int index = _inner.IndexOf(item); if (index != -1) { - this.inner.RemoveAt(index); + _inner.RemoveAt(index); this.NotifyRemove(new[] { item }, index); return true; } @@ -287,8 +284,8 @@ namespace Perspex.Collections /// The index. public void RemoveAt(int index) { - T item = this.inner[index]; - this.inner.RemoveAt(index); + T item = _inner[index]; + _inner.RemoveAt(index); this.NotifyRemove(new[] { item }, index); } @@ -339,13 +336,13 @@ namespace Perspex.Collections /// void ICollection.CopyTo(Array array, int index) { - this.inner.CopyTo((T[])array, index); + _inner.CopyTo((T[])array, index); } /// IEnumerator IEnumerable.GetEnumerator() { - return this.inner.GetEnumerator(); + return _inner.GetEnumerator(); } /// diff --git a/src/Perspex.Base/Collections/PerspexListExtensions.cs b/src/Perspex.Base/Collections/PerspexListExtensions.cs index d54ff4594c..27973ecabe 100644 --- a/src/Perspex.Base/Collections/PerspexListExtensions.cs +++ b/src/Perspex.Base/Collections/PerspexListExtensions.cs @@ -1,17 +1,14 @@ - - - - +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. +using System; +using System.Collections.Generic; +using System.Collections.Specialized; +using System.ComponentModel; +using System.Reactive.Disposables; namespace Perspex.Collections { - using System; - using System.Collections.Generic; - using System.Collections.Specialized; - using System.ComponentModel; - using System.Reactive.Disposables; - /// /// Defines extension methods for working with s. /// diff --git a/src/Perspex.Base/Contract.cs b/src/Perspex.Base/Contract.cs index 796a50ea62..fb568841ca 100644 --- a/src/Perspex.Base/Contract.cs +++ b/src/Perspex.Base/Contract.cs @@ -1,8 +1,5 @@ - - - - - +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. namespace Perspex { diff --git a/src/Perspex.Base/Diagnostics/PerspexObjectExtensions.cs b/src/Perspex.Base/Diagnostics/PerspexObjectExtensions.cs index 114c17e7ec..ccfc37279c 100644 --- a/src/Perspex.Base/Diagnostics/PerspexObjectExtensions.cs +++ b/src/Perspex.Base/Diagnostics/PerspexObjectExtensions.cs @@ -1,4 +1,6 @@ - +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. + namespace Perspex.Diagnostics { /// diff --git a/src/Perspex.Base/Diagnostics/PerspexPropertyValue.cs b/src/Perspex.Base/Diagnostics/PerspexPropertyValue.cs index cf44ceb54d..976506cb5c 100644 --- a/src/Perspex.Base/Diagnostics/PerspexPropertyValue.cs +++ b/src/Perspex.Base/Diagnostics/PerspexPropertyValue.cs @@ -1,4 +1,6 @@ - +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. + namespace Perspex.Diagnostics { /// diff --git a/src/Perspex.Base/IDescription.cs b/src/Perspex.Base/IDescription.cs index 01f1eafc82..5bb7640fea 100644 --- a/src/Perspex.Base/IDescription.cs +++ b/src/Perspex.Base/IDescription.cs @@ -1,8 +1,5 @@ - - - - - +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. namespace Perspex { diff --git a/src/Perspex.Base/IObservablePropertyBag.cs b/src/Perspex.Base/IObservablePropertyBag.cs index 56e78ba42b..3bc8e41178 100644 --- a/src/Perspex.Base/IObservablePropertyBag.cs +++ b/src/Perspex.Base/IObservablePropertyBag.cs @@ -1,13 +1,10 @@ - - - - +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. +using System; namespace Perspex { - using System; - /// /// Interface for getting/setting bindings on an object. /// diff --git a/src/Perspex.Base/IPropertyBag.cs b/src/Perspex.Base/IPropertyBag.cs index 56b78ea6fe..68b1b6fed8 100644 --- a/src/Perspex.Base/IPropertyBag.cs +++ b/src/Perspex.Base/IPropertyBag.cs @@ -1,8 +1,5 @@ - - - - - +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. namespace Perspex { diff --git a/src/Perspex.Base/PerspexObject.cs b/src/Perspex.Base/PerspexObject.cs index ea8c4fec60..9f3c1015a6 100644 --- a/src/Perspex.Base/PerspexObject.cs +++ b/src/Perspex.Base/PerspexObject.cs @@ -1,23 +1,20 @@ - - - - - +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. + +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Linq; +using System.Reactive.Disposables; +using System.Reactive.Linq; +using System.Reflection; +using Perspex.Reactive; +using Perspex.Utilities; +using Serilog; +using Serilog.Core.Enrichers; namespace Perspex { - using System; - using System.Collections.Generic; - using System.ComponentModel; - using System.Linq; - using System.Reactive.Disposables; - using System.Reactive.Linq; - using System.Reflection; - using Perspex.Reactive; - using Perspex.Utilities; - using Serilog; - using Serilog.Core.Enrichers; - /// /// The priority of a binding. /// @@ -71,36 +68,36 @@ namespace Perspex /// /// The registered properties by type. /// - private static Dictionary> registered = + private static Dictionary> s_registered = new Dictionary>(); /// /// The parent object that inherited values are inherited from. /// - private PerspexObject inheritanceParent; + private PerspexObject _inheritanceParent; /// /// The set values/bindings on this object. /// - private Dictionary values = + private Dictionary _values = new Dictionary(); /// /// Event handler for implementation. /// - private PropertyChangedEventHandler inpcChanged; + private PropertyChangedEventHandler _inpcChanged; /// /// A serilog logger for logging property events. /// - private ILogger propertyLog; + private ILogger _propertyLog; /// /// Initializes a new instance of the class. /// public PerspexObject() { - this.propertyLog = Log.ForContext(new[] + _propertyLog = Log.ForContext(new[] { new PropertyEnricher("Area", "Property"), new PropertyEnricher("SourceContext", this.GetType()), @@ -130,8 +127,8 @@ namespace Perspex /// event PropertyChangedEventHandler INotifyPropertyChanged.PropertyChanged { - add { this.inpcChanged += value; } - remove { this.inpcChanged -= value; } + add { _inpcChanged += value; } + remove { _inpcChanged -= value; } } /// @@ -145,16 +142,16 @@ namespace Perspex { get { - return this.inheritanceParent; + return _inheritanceParent; } set { - if (this.inheritanceParent != value) + if (_inheritanceParent != value) { - if (this.inheritanceParent != null) + if (_inheritanceParent != null) { - this.inheritanceParent.PropertyChanged -= this.ParentPropertyChanged; + _inheritanceParent.PropertyChanged -= this.ParentPropertyChanged; } var inherited = (from property in GetProperties(this.GetType()) @@ -165,7 +162,7 @@ namespace Perspex Value = this.GetValue(property), }).ToList(); - this.inheritanceParent = value; + _inheritanceParent = value; foreach (var i in inherited) { @@ -177,9 +174,9 @@ namespace Perspex } } - if (this.inheritanceParent != null) + if (_inheritanceParent != null) { - this.inheritanceParent.PropertyChanged += this.ParentPropertyChanged; + _inheritanceParent.PropertyChanged += this.ParentPropertyChanged; } } } @@ -258,7 +255,7 @@ namespace Perspex { List list; - if (registered.TryGetValue(type, out list)) + if (s_registered.TryGetValue(type, out list)) { foreach (PerspexProperty p in list) { @@ -286,10 +283,10 @@ namespace Perspex List list; - if (!registered.TryGetValue(type, out list)) + if (!s_registered.TryGetValue(type, out list)) { list = new List(); - registered.Add(type, list); + s_registered.Add(type, list); } if (!list.Contains(property)) @@ -397,7 +394,7 @@ namespace Perspex PriorityValue value; - if (this.values.TryGetValue(property, out value)) + if (_values.TryGetValue(property, out value)) { result = value.Value; } @@ -441,7 +438,7 @@ namespace Perspex { List list; - if (registered.TryGetValue(type, out list)) + if (s_registered.TryGetValue(type, out list)) { foreach (var p in list) { @@ -462,7 +459,7 @@ namespace Perspex { Contract.Requires(property != null); - return this.values.ContainsKey(property); + return _values.ContainsKey(property); } /// @@ -478,7 +475,7 @@ namespace Perspex { List list; - if (registered.TryGetValue(type, out list)) + if (s_registered.TryGetValue(type, out list)) { if (list.Contains(property)) { @@ -524,7 +521,7 @@ namespace Perspex value?.GetType().FullName ?? "(null)")); } - if (!this.values.TryGetValue(property, out v)) + if (!_values.TryGetValue(property, out v)) { if (value == PerspexProperty.UnsetValue) { @@ -532,10 +529,10 @@ namespace Perspex } v = this.CreatePriorityValue(property); - this.values.Add(property, v); + _values.Add(property, v); } - this.propertyLog.Verbose( + _propertyLog.Verbose( "Set {Property} to {$Value} with priority {Priority}", property, value, @@ -587,13 +584,13 @@ namespace Perspex this.GetType())); } - if (!this.values.TryGetValue(property, out v)) + if (!_values.TryGetValue(property, out v)) { v = this.CreatePriorityValue(property); - this.values.Add(property, v); + _values.Add(property, v); } - this.propertyLog.Verbose( + _propertyLog.Verbose( "Bound {Property} to {Binding} with priority {Priority}", property, source, @@ -654,7 +651,7 @@ namespace Perspex { PriorityValue value; - if (this.values.TryGetValue(property, out value)) + if (_values.TryGetValue(property, out value)) { value.Revalidate(); } @@ -666,7 +663,7 @@ namespace Perspex /// A collection of property/value tuples. internal IDictionary GetSetValues() { - return this.values; + return _values; } /// @@ -723,7 +720,7 @@ namespace Perspex { this.RaisePropertyChanged(property, oldValue, newValue, (BindingPriority)result.ValuePriority); - this.propertyLog.Verbose( + _propertyLog.Verbose( "{Property} changed from {$Old} to {$Value} with priority {Priority}", property, oldValue, @@ -742,9 +739,9 @@ namespace Perspex /// The default value. private object GetDefaultValue(PerspexProperty property) { - if (property.Inherits && this.inheritanceParent != null) + if (property.Inherits && _inheritanceParent != null) { - return this.inheritanceParent.GetValue(property); + return _inheritanceParent.GetValue(property); } else { @@ -810,10 +807,10 @@ namespace Perspex this.PropertyChanged(this, e); } - if (this.inpcChanged != null) + if (_inpcChanged != null) { PropertyChangedEventArgs e2 = new PropertyChangedEventArgs(property.Name); - this.inpcChanged(this, e2); + _inpcChanged(this, e2); } } } diff --git a/src/Perspex.Base/PerspexObjectExtensions.cs b/src/Perspex.Base/PerspexObjectExtensions.cs index b590e2428b..c690d30996 100644 --- a/src/Perspex.Base/PerspexObjectExtensions.cs +++ b/src/Perspex.Base/PerspexObjectExtensions.cs @@ -1,14 +1,11 @@ - - - - +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. +using System; +using System.Reactive.Linq; namespace Perspex { - using System; - using System.Reactive.Linq; - /// /// Provides extension methods for and related classes. /// diff --git a/src/Perspex.Base/PerspexProperty.cs b/src/Perspex.Base/PerspexProperty.cs index d8b46bac81..6c378d2f15 100644 --- a/src/Perspex.Base/PerspexProperty.cs +++ b/src/Perspex.Base/PerspexProperty.cs @@ -1,17 +1,14 @@ - - - - +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. +using System; +using System.Collections.Generic; +using System.Reactive.Subjects; +using System.Reflection; +using Perspex.Utilities; namespace Perspex { - using System; - using System.Collections.Generic; - using System.Reactive.Subjects; - using System.Reflection; - using Perspex.Utilities; - /// /// A perspex property. /// @@ -28,22 +25,22 @@ namespace Perspex /// /// The default values for the property, by type. /// - private Dictionary defaultValues = new Dictionary(); + private Dictionary _defaultValues = new Dictionary(); /// /// Observable fired when this property changes on any . /// - private Subject initialized = new Subject(); + private Subject _initialized = new Subject(); /// /// Observable fired when this property changes on any . /// - private Subject changed = new Subject(); + private Subject _changed = new Subject(); /// /// The validation functions for the property, by type. /// - private Dictionary> validation = + private Dictionary> _validation = new Dictionary>(); /// @@ -74,14 +71,14 @@ namespace Perspex this.Name = name; this.PropertyType = valueType; this.OwnerType = ownerType; - this.defaultValues.Add(ownerType, defaultValue); + _defaultValues.Add(ownerType, defaultValue); this.Inherits = inherits; this.DefaultBindingMode = defaultBindingMode; this.IsAttached = isAttached; if (validate != null) { - this.validation.Add(ownerType, validate); + _validation.Add(ownerType, validate); } } @@ -149,7 +146,7 @@ namespace Perspex /// public IObservable Initialized { - get { return this.initialized; } + get { return _initialized; } } /// @@ -162,7 +159,7 @@ namespace Perspex /// public IObservable Changed { - get { return this.changed; } + get { return _changed; } } /// @@ -330,7 +327,7 @@ namespace Perspex { object result; - if (this.defaultValues.TryGetValue(type, out result)) + if (_defaultValues.TryGetValue(type, out result)) { return result; } @@ -338,7 +335,7 @@ namespace Perspex type = type.GetTypeInfo().BaseType; } - return this.defaultValues[this.OwnerType]; + return _defaultValues[this.OwnerType]; } /// @@ -356,7 +353,7 @@ namespace Perspex { Func result; - if (this.validation.TryGetValue(type, out result)) + if (_validation.TryGetValue(type, out result)) { return result; } @@ -405,12 +402,12 @@ namespace Perspex defaultValue.GetType().FullName)); } - if (this.defaultValues.ContainsKey(type)) + if (_defaultValues.ContainsKey(type)) { throw new InvalidOperationException("Default value is already set for this property."); } - this.defaultValues.Add(type, defaultValue); + _defaultValues.Add(type, defaultValue); } /// @@ -422,12 +419,12 @@ namespace Perspex { Contract.Requires(type != null); - if (this.validation.ContainsKey(type)) + if (_validation.ContainsKey(type)) { throw new InvalidOperationException("Validation is already set for this property."); } - this.validation.Add(type, validation); + _validation.Add(type, validation); } /// @@ -445,7 +442,7 @@ namespace Perspex /// The observable arguments. internal void NotifyInitialized(PerspexPropertyChangedEventArgs e) { - this.initialized.OnNext(e); + _initialized.OnNext(e); } /// @@ -454,7 +451,7 @@ namespace Perspex /// The observable arguments. internal void NotifyChanged(PerspexPropertyChangedEventArgs e) { - this.changed.OnNext(e); + _changed.OnNext(e); } /// diff --git a/src/Perspex.Base/PerspexPropertyChangedEventArgs.cs b/src/Perspex.Base/PerspexPropertyChangedEventArgs.cs index b576e9db40..af12611868 100644 --- a/src/Perspex.Base/PerspexPropertyChangedEventArgs.cs +++ b/src/Perspex.Base/PerspexPropertyChangedEventArgs.cs @@ -1,8 +1,5 @@ - - - - - +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. namespace Perspex { diff --git a/src/Perspex.Base/PerspexProperty`1.cs b/src/Perspex.Base/PerspexProperty`1.cs index 7e62a8f783..5ebe84dd38 100644 --- a/src/Perspex.Base/PerspexProperty`1.cs +++ b/src/Perspex.Base/PerspexProperty`1.cs @@ -1,13 +1,10 @@ - - - - +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. +using System; namespace Perspex { - using System; - /// /// A typed perspex property. /// diff --git a/src/Perspex.Base/Platform/IPlatformHandle.cs b/src/Perspex.Base/Platform/IPlatformHandle.cs index 014bb57f44..234e4598a4 100644 --- a/src/Perspex.Base/Platform/IPlatformHandle.cs +++ b/src/Perspex.Base/Platform/IPlatformHandle.cs @@ -1,13 +1,10 @@ - - - - +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. +using System; namespace Perspex.Platform { - using System; - /// /// Represents a platform-specific handle. /// diff --git a/src/Perspex.Base/Platform/IPlatformThreadingInterface.cs b/src/Perspex.Base/Platform/IPlatformThreadingInterface.cs index b72d8d6448..2410cf5a28 100644 --- a/src/Perspex.Base/Platform/IPlatformThreadingInterface.cs +++ b/src/Perspex.Base/Platform/IPlatformThreadingInterface.cs @@ -1,13 +1,10 @@ - - - - +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. +using System; namespace Perspex.Platform { - using System; - /// /// Provides platform-specific services relating to threading. /// diff --git a/src/Perspex.Base/Platform/PlatformHandle.cs b/src/Perspex.Base/Platform/PlatformHandle.cs index adf148fd9d..e2fe81c0ce 100644 --- a/src/Perspex.Base/Platform/PlatformHandle.cs +++ b/src/Perspex.Base/Platform/PlatformHandle.cs @@ -1,13 +1,10 @@ - - - - +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. +using System; namespace Perspex.Platform { - using System; - /// /// Represents a platform-specific handle. /// diff --git a/src/Perspex.Base/PriorityBindingEntry.cs b/src/Perspex.Base/PriorityBindingEntry.cs index 1cc6f8b970..6d9a77b3cf 100644 --- a/src/Perspex.Base/PriorityBindingEntry.cs +++ b/src/Perspex.Base/PriorityBindingEntry.cs @@ -1,13 +1,10 @@ - - - - +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. +using System; namespace Perspex { - using System; - /// /// A registered binding in a . /// @@ -16,7 +13,7 @@ namespace Perspex /// /// The binding subscription. /// - private IDisposable subscription; + private IDisposable _subscription; /// /// Initializes a new instance of the class. @@ -75,7 +72,7 @@ namespace Perspex Contract.Requires(changed != null); Contract.Requires(completed != null); - if (this.subscription != null) + if (_subscription != null) { throw new Exception("PriorityValue.Entry.Start() called more than once."); } @@ -88,7 +85,7 @@ namespace Perspex this.Description = ((IDescription)binding).Description; } - this.subscription = binding.Subscribe( + _subscription = binding.Subscribe( value => { this.Value = value; @@ -102,9 +99,9 @@ namespace Perspex /// public void Dispose() { - if (this.subscription != null) + if (_subscription != null) { - this.subscription.Dispose(); + _subscription.Dispose(); } } } diff --git a/src/Perspex.Base/PriorityLevel.cs b/src/Perspex.Base/PriorityLevel.cs index 0a29fd16a2..e45f78f5bb 100644 --- a/src/Perspex.Base/PriorityLevel.cs +++ b/src/Perspex.Base/PriorityLevel.cs @@ -1,15 +1,12 @@ - - - - +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. +using System; +using System.Collections.Generic; +using System.Reactive.Disposables; namespace Perspex { - using System; - using System.Collections.Generic; - using System.Reactive.Disposables; - /// /// Determines how the current binding is selected for a . /// @@ -53,19 +50,19 @@ namespace Perspex /// /// Method called when current value changes. /// - private Action changed; + private Action _changed; /// /// The current direct value. /// - private object directValue; + private object _directValue; /// /// The index of the next . /// - private int nextIndex; + private int _nextIndex; - private LevelPrecedenceMode mode; + private LevelPrecedenceMode _mode; /// /// Initializes a new instance of the class. @@ -80,10 +77,10 @@ namespace Perspex { Contract.Requires(changed != null); - this.mode = mode; - this.changed = changed; + _mode = mode; + _changed = changed; this.Priority = priority; - this.Value = this.directValue = PerspexProperty.UnsetValue; + this.Value = _directValue = PerspexProperty.UnsetValue; this.ActiveBindingIndex = -1; this.Bindings = new LinkedList(); } @@ -100,13 +97,13 @@ namespace Perspex { get { - return this.directValue; + return _directValue; } set { - this.Value = this.directValue = value; - this.changed(this); + this.Value = _directValue = value; + _changed(this); } } @@ -135,7 +132,7 @@ namespace Perspex { Contract.Requires(binding != null); - var entry = new PriorityBindingEntry(this.nextIndex++); + var entry = new PriorityBindingEntry(_nextIndex++); var node = this.Bindings.AddFirst(entry); entry.Start(binding, this.Changed, this.Completed); @@ -157,13 +154,13 @@ namespace Perspex /// The entry that changed. private void Changed(PriorityBindingEntry entry) { - if (this.mode == LevelPrecedenceMode.Latest || entry.Index >= this.ActiveBindingIndex) + if (_mode == LevelPrecedenceMode.Latest || entry.Index >= this.ActiveBindingIndex) { if (entry.Value != PerspexProperty.UnsetValue) { this.Value = entry.Value; this.ActiveBindingIndex = entry.Index; - this.changed(this); + _changed(this); } else { @@ -197,14 +194,14 @@ namespace Perspex { this.Value = binding.Value; this.ActiveBindingIndex = binding.Index; - this.changed(this); + _changed(this); return; } } this.Value = this.DirectValue; this.ActiveBindingIndex = -1; - this.changed(this); + _changed(this); } } } diff --git a/src/Perspex.Base/PriorityValue.cs b/src/Perspex.Base/PriorityValue.cs index e9c38056e3..ae8d96efe6 100644 --- a/src/Perspex.Base/PriorityValue.cs +++ b/src/Perspex.Base/PriorityValue.cs @@ -1,18 +1,15 @@ - - - - +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. +using System; +using System.Collections.Generic; +using System.Linq; +using System.Reactive.Subjects; +using System.Text; +using Perspex.Utilities; namespace Perspex { - using System; - using System.Collections.Generic; - using System.Linq; - using System.Reactive.Subjects; - using System.Text; - using Perspex.Utilities; - /// /// Maintains a list of prioritised bindings together with a current value. /// @@ -30,32 +27,32 @@ namespace Perspex /// /// The name of the property. /// - private string name; + private string _name; /// /// The value type. /// - private Type valueType; + private Type _valueType; /// /// The currently registered bindings organised by priority. /// - private Dictionary levels = new Dictionary(); + private Dictionary _levels = new Dictionary(); /// /// The changed observable. /// - private Subject> changed = new Subject>(); + private Subject> _changed = new Subject>(); /// /// The current value. /// - private object value; + private object _value; /// /// The function used to validate the value, if any. /// - private Func validate; + private Func _validate; /// /// Initializes a new instance of the class. @@ -65,11 +62,11 @@ namespace Perspex /// An optional validation function. public PriorityValue(string name, Type valueType, Func validate = null) { - this.name = name; - this.valueType = valueType; - this.value = PerspexProperty.UnsetValue; + _name = name; + _valueType = valueType; + _value = PerspexProperty.UnsetValue; this.ValuePriority = int.MaxValue; - this.validate = validate; + _validate = validate; } /// @@ -80,7 +77,7 @@ namespace Perspex /// public IObservable> Changed { - get { return this.changed; } + get { return _changed; } } /// @@ -88,7 +85,7 @@ namespace Perspex /// public object Value { - get { return this.value; } + get { return _value; } } /// @@ -129,7 +126,7 @@ namespace Perspex /// An enumerable collection of bindings. public IEnumerable GetBindings() { - foreach (var level in this.levels) + foreach (var level in _levels) { foreach (var binding in level.Value.Bindings) { @@ -148,7 +145,7 @@ namespace Perspex var b = new StringBuilder(); var first = true; - foreach (var level in this.levels) + foreach (var level in _levels) { if (!first) { @@ -183,11 +180,11 @@ namespace Perspex /// public void Revalidate() { - if (this.validate != null) + if (_validate != null) { PriorityLevel level; - if (this.levels.TryGetValue(this.ValuePriority, out level)) + if (_levels.TryGetValue(this.ValuePriority, out level)) { this.UpdateValue(level.Value, level.Priority); } @@ -204,11 +201,11 @@ namespace Perspex { PriorityLevel result; - if (!this.levels.TryGetValue(priority, out result)) + if (!_levels.TryGetValue(priority, out result)) { var mode = (LevelPrecedenceMode)(priority % 2); result = new PriorityLevel(priority, mode, this.ValueChanged); - this.levels.Add(priority, result); + _levels.Add(priority, result); } return result; @@ -221,25 +218,25 @@ namespace Perspex /// The priority level that the value came from. private void UpdateValue(object value, int priority) { - if (!TypeUtilities.TryCast(this.valueType, value, out value)) + if (!TypeUtilities.TryCast(_valueType, value, out value)) { throw new InvalidOperationException(string.Format( "Invalid value for Property '{0}': {1} ({2})", - this.name, + _name, value, value?.GetType().FullName ?? "(null)")); } - var old = this.value; + var old = _value; - if (this.validate != null) + if (_validate != null) { - value = this.validate(value); + value = _validate(value); } this.ValuePriority = priority; - this.value = value; - this.changed.OnNext(Tuple.Create(old, this.value)); + _value = value; + _changed.OnNext(Tuple.Create(old, _value)); } /// @@ -256,7 +253,7 @@ namespace Perspex } else { - foreach (var i in this.levels.Values.OrderBy(x => x.Priority)) + foreach (var i in _levels.Values.OrderBy(x => x.Priority)) { if (i.Value != PerspexProperty.UnsetValue) { diff --git a/src/Perspex.Base/Properties/AssemblyInfo.cs b/src/Perspex.Base/Properties/AssemblyInfo.cs index 3d2a2711cd..44faed797a 100644 --- a/src/Perspex.Base/Properties/AssemblyInfo.cs +++ b/src/Perspex.Base/Properties/AssemblyInfo.cs @@ -1,8 +1,5 @@ - - - - - +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. using System.Reflection; using System.Runtime.CompilerServices; diff --git a/src/Perspex.Base/Reactive/PerspexObservable.cs b/src/Perspex.Base/Reactive/PerspexObservable.cs index ed16e4da1a..2db2b52632 100644 --- a/src/Perspex.Base/Reactive/PerspexObservable.cs +++ b/src/Perspex.Base/Reactive/PerspexObservable.cs @@ -1,22 +1,19 @@ - - - - +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. +using System; +using System.Reactive; +using System.Reactive.Disposables; namespace Perspex.Reactive { - using System; - using System.Reactive; - using System.Reactive.Disposables; - /// /// An with an additional description. /// /// The type of the elements in the sequence. public sealed class PerspexObservable : ObservableBase, IDescription { - private readonly Func, IDisposable> subscribe; + private readonly Func, IDisposable> _subscribe; /// /// Initializes a new instance of the class. @@ -30,7 +27,7 @@ namespace Perspex.Reactive throw new ArgumentNullException("subscribe"); } - this.subscribe = subscribe; + _subscribe = subscribe; this.Description = description; } @@ -42,7 +39,7 @@ namespace Perspex.Reactive /// protected override IDisposable SubscribeCore(IObserver observer) { - return this.subscribe(observer) ?? Disposable.Empty; + return _subscribe(observer) ?? Disposable.Empty; } } } \ No newline at end of file diff --git a/src/Perspex.Base/Threading/Dispatcher.cs b/src/Perspex.Base/Threading/Dispatcher.cs index 4d7020a757..23d3dfc595 100644 --- a/src/Perspex.Base/Threading/Dispatcher.cs +++ b/src/Perspex.Base/Threading/Dispatcher.cs @@ -1,16 +1,13 @@ - - - - +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. +using System; +using System.Threading; +using System.Threading.Tasks; +using Perspex.Win32.Threading; namespace Perspex.Threading { - using System; - using System.Threading; - using System.Threading.Tasks; - using Perspex.Win32.Threading; - /// /// Provides services for managing work items on a thread. /// @@ -20,9 +17,9 @@ namespace Perspex.Threading /// public class Dispatcher { - private static Dispatcher instance = new Dispatcher(); + private static Dispatcher s_instance = new Dispatcher(); - private MainLoop mainLoop = new MainLoop(); + private MainLoop _mainLoop = new MainLoop(); /// /// Initializes a new instance of the class. @@ -36,7 +33,7 @@ namespace Perspex.Threading /// public static Dispatcher UIThread { - get { return instance; } + get { return s_instance; } } /// @@ -47,7 +44,7 @@ namespace Perspex.Threading /// public void MainLoop(CancellationToken cancellationToken) { - this.mainLoop.Run(cancellationToken); + _mainLoop.Run(cancellationToken); } /// @@ -55,7 +52,7 @@ namespace Perspex.Threading /// public void RunJobs() { - this.mainLoop.RunJobs(); + _mainLoop.RunJobs(); } /// @@ -66,7 +63,7 @@ namespace Perspex.Threading /// A task that can be used to track the method's execution. public Task InvokeAsync(Action action, DispatcherPriority priority = DispatcherPriority.Normal) { - return this.mainLoop.InvokeAsync(action, priority); + return _mainLoop.InvokeAsync(action, priority); } /// @@ -76,7 +73,7 @@ namespace Perspex.Threading /// The priority with which to invoke the method. internal void Post(Action action, DispatcherPriority priority = DispatcherPriority.Normal) { - this.mainLoop.Post(action, priority); + _mainLoop.Post(action, priority); } } } \ No newline at end of file diff --git a/src/Perspex.Base/Threading/DispatcherPriority.cs b/src/Perspex.Base/Threading/DispatcherPriority.cs index 532f95b462..a53d25b4f0 100644 --- a/src/Perspex.Base/Threading/DispatcherPriority.cs +++ b/src/Perspex.Base/Threading/DispatcherPriority.cs @@ -1,8 +1,5 @@ - - - - - +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. namespace Perspex.Threading { diff --git a/src/Perspex.Base/Threading/DispatcherTimer.cs b/src/Perspex.Base/Threading/DispatcherTimer.cs index 165ff8b396..25c028e831 100644 --- a/src/Perspex.Base/Threading/DispatcherTimer.cs +++ b/src/Perspex.Base/Threading/DispatcherTimer.cs @@ -1,33 +1,30 @@ - - - - +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. +using System; +using System.Reactive.Disposables; +using Perspex.Platform; +using Splat; namespace Perspex.Threading { - using System; - using System.Reactive.Disposables; - using Perspex.Platform; - using Splat; - /// /// A timer that uses a to fire at a specified interval. /// public class DispatcherTimer { - private IDisposable timer; + private IDisposable _timer; - private DispatcherPriority priority; + private DispatcherPriority _priority; - private TimeSpan interval; + private TimeSpan _interval; /// /// Initializes a new instance of the class. /// public DispatcherTimer() { - this.priority = DispatcherPriority.Normal; + _priority = DispatcherPriority.Normal; this.Dispatcher = Dispatcher.UIThread; } @@ -37,7 +34,7 @@ namespace Perspex.Threading /// The priority to use. public DispatcherTimer(DispatcherPriority priority) { - this.priority = priority; + _priority = priority; this.Dispatcher = Dispatcher.UIThread; } @@ -48,7 +45,7 @@ namespace Perspex.Threading /// The dispatcher to use. public DispatcherTimer(DispatcherPriority priority, Dispatcher dispatcher) { - this.priority = priority; + _priority = priority; this.Dispatcher = dispatcher; } @@ -61,7 +58,7 @@ namespace Perspex.Threading /// The event to call when the timer ticks. public DispatcherTimer(TimeSpan interval, DispatcherPriority priority, EventHandler callback, Dispatcher dispatcher) { - this.priority = priority; + _priority = priority; this.Dispatcher = dispatcher; this.Interval = interval; this.Tick += callback; @@ -72,7 +69,7 @@ namespace Perspex.Threading /// ~DispatcherTimer() { - if (this.timer != null) + if (_timer != null) { this.Stop(); } @@ -99,14 +96,14 @@ namespace Perspex.Threading { get { - return this.interval; + return _interval; } set { bool enabled = this.IsEnabled; this.Stop(); - this.interval = value; + _interval = value; this.IsEnabled = enabled; } } @@ -118,7 +115,7 @@ namespace Perspex.Threading { get { - return this.timer != null; + return _timer != null; } set @@ -181,7 +178,7 @@ namespace Perspex.Threading if (!this.IsEnabled) { IPlatformThreadingInterface threading = Locator.Current.GetService(); - this.timer = threading.StartTimer(this.Interval, this.InternalTick); + _timer = threading.StartTimer(this.Interval, this.InternalTick); } } @@ -193,8 +190,8 @@ namespace Perspex.Threading if (this.IsEnabled) { IPlatformThreadingInterface threading = Locator.Current.GetService(); - this.timer.Dispose(); - this.timer = null; + _timer.Dispose(); + _timer = null; } } @@ -203,7 +200,7 @@ namespace Perspex.Threading /// private void InternalTick() { - this.Dispatcher.Post(this.RaiseTick, this.priority); + this.Dispatcher.Post(this.RaiseTick, _priority); } /// diff --git a/src/Perspex.Base/Threading/MainLoop.cs b/src/Perspex.Base/Threading/MainLoop.cs index 8fb60955d7..e8cd63d583 100644 --- a/src/Perspex.Base/Threading/MainLoop.cs +++ b/src/Perspex.Base/Threading/MainLoop.cs @@ -1,27 +1,24 @@ - - - - +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. +using System; +using System.Threading; +using System.Threading.Tasks; +using NGenerics.DataStructures.Queues; +using Perspex.Platform; +using Perspex.Threading; +using Splat; namespace Perspex.Win32.Threading { - using System; - using System.Threading; - using System.Threading.Tasks; - using NGenerics.DataStructures.Queues; - using Perspex.Platform; - using Perspex.Threading; - using Splat; - /// /// A main loop in a . /// internal class MainLoop { - private static IPlatformThreadingInterface platform; + private static IPlatformThreadingInterface s_platform; - private PriorityQueue queue = + private PriorityQueue _queue = new PriorityQueue(PriorityQueueType.Maximum); /// @@ -29,7 +26,7 @@ namespace Perspex.Win32.Threading /// static MainLoop() { - platform = Locator.Current.GetService(); + s_platform = Locator.Current.GetService(); } /// @@ -44,7 +41,7 @@ namespace Perspex.Win32.Threading { RunJobs(); - platform.ProcessMessage(); + s_platform.ProcessMessage(); } } @@ -55,17 +52,17 @@ namespace Perspex.Win32.Threading { Job job = null; - while (job != null || this.queue.Count > 0) + while (job != null || _queue.Count > 0) { if (job == null) { - lock (this.queue) + lock (_queue) { - job = this.queue.Dequeue(); + job = _queue.Dequeue(); } } - if (job.Priority < DispatcherPriority.Input && platform.HasMessages()) + if (job.Priority < DispatcherPriority.Input && s_platform.HasMessages()) { break; } @@ -117,11 +114,11 @@ namespace Perspex.Win32.Threading private void AddJob(Job job) { - lock (this.queue) + lock (_queue) { - this.queue.Add(job, job.Priority); + _queue.Add(job, job.Priority); } - platform.Wake(); + s_platform.Wake(); } /// diff --git a/src/Perspex.Base/Threading/PerspexScheduler.cs b/src/Perspex.Base/Threading/PerspexScheduler.cs index 668cec3df3..568baf12cb 100644 --- a/src/Perspex.Base/Threading/PerspexScheduler.cs +++ b/src/Perspex.Base/Threading/PerspexScheduler.cs @@ -1,14 +1,11 @@ - - - - +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. +using System; +using System.Reactive.Concurrency; namespace Perspex.Threading { - using System; - using System.Reactive.Concurrency; - /// /// A reactive scheduler that uses Perspex's . /// diff --git a/src/Perspex.Base/Threading/PerspexSynchronizationContext.cs b/src/Perspex.Base/Threading/PerspexSynchronizationContext.cs index 40bbfc801c..c1922b6f28 100644 --- a/src/Perspex.Base/Threading/PerspexSynchronizationContext.cs +++ b/src/Perspex.Base/Threading/PerspexSynchronizationContext.cs @@ -1,13 +1,15 @@ -namespace Perspex.Threading -{ - using System; - using System.Collections.Generic; - using System.Linq; - using System.Text; - using System.Threading.Tasks; - using System.Threading; +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Threading; +namespace Perspex.Threading +{ /// /// SynchronizationContext to be used on main thread /// diff --git a/src/Perspex.Base/Utilities/MathUtilities.cs b/src/Perspex.Base/Utilities/MathUtilities.cs index c2796e515c..81837e5de1 100644 --- a/src/Perspex.Base/Utilities/MathUtilities.cs +++ b/src/Perspex.Base/Utilities/MathUtilities.cs @@ -1,16 +1,13 @@ - - - - +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. +using System; +using System.Collections.Generic; +using System.Linq; +using System.Reflection; namespace Perspex.Utilities { - using System; - using System.Collections.Generic; - using System.Linq; - using System.Reflection; - /// /// Provides math utilities not provided in System.Math. /// diff --git a/src/Perspex.Base/Utilities/TypeUtilities.cs b/src/Perspex.Base/Utilities/TypeUtilities.cs index 71c8e4b6d2..376496eb3b 100644 --- a/src/Perspex.Base/Utilities/TypeUtilities.cs +++ b/src/Perspex.Base/Utilities/TypeUtilities.cs @@ -1,22 +1,19 @@ - - - - +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. +using System; +using System.Collections.Generic; +using System.Linq; +using System.Reflection; namespace Perspex.Utilities { - using System; - using System.Collections.Generic; - using System.Linq; - using System.Reflection; - /// /// Provides utilities for working with types at runtime. /// internal static class TypeUtilities { - private static readonly Dictionary> Conversions = new Dictionary>() + private static readonly Dictionary> s_conversions = new Dictionary>() { { typeof(decimal), new List { typeof(sbyte), typeof(byte), typeof(short), typeof(ushort), typeof(int), typeof(uint), typeof(long), typeof(ulong), typeof(char) } }, { typeof(double), new List { typeof(sbyte), typeof(byte), typeof(short), typeof(ushort), typeof(int), typeof(uint), typeof(long), typeof(ulong), typeof(char), typeof(float) } }, @@ -59,7 +56,7 @@ namespace Perspex.Utilities result = value; return true; } - else if (Conversions.ContainsKey(to) && Conversions[to].Contains(from)) + else if (s_conversions.ContainsKey(to) && s_conversions[to].Contains(from)) { result = Convert.ChangeType(value, to); return true; diff --git a/src/Perspex.Controls/Border.cs b/src/Perspex.Controls/Border.cs index bd3ee5da46..b1482eeb88 100644 --- a/src/Perspex.Controls/Border.cs +++ b/src/Perspex.Controls/Border.cs @@ -1,13 +1,10 @@ - - - - +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. +using Perspex.Media; namespace Perspex.Controls { - using Perspex.Media; - /// /// A control which decorates a child with a border and background. /// diff --git a/src/Perspex.Controls/Button.cs b/src/Perspex.Controls/Button.cs index 2a775b513b..b7057d1290 100644 --- a/src/Perspex.Controls/Button.cs +++ b/src/Perspex.Controls/Button.cs @@ -1,19 +1,16 @@ - - - - +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. +using System; +using System.Linq; +using System.Windows.Input; +using Perspex.Input; +using Perspex.Interactivity; +using Perspex.Rendering; +using Perspex.VisualTree; namespace Perspex.Controls { - using System; - using System.Linq; - using System.Windows.Input; - using Perspex.Input; - using Perspex.Interactivity; - using Perspex.Rendering; - using Perspex.VisualTree; - /// /// Defines how a reacts to clicks. /// diff --git a/src/Perspex.Controls/CheckBox.cs b/src/Perspex.Controls/CheckBox.cs index 9108c486ba..0456a380e1 100644 --- a/src/Perspex.Controls/CheckBox.cs +++ b/src/Perspex.Controls/CheckBox.cs @@ -1,13 +1,10 @@ - - - - +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. +using Perspex.Controls.Primitives; namespace Perspex.Controls { - using Perspex.Controls.Primitives; - /// /// A check box control. /// diff --git a/src/Perspex.Controls/ColumnDefinition.cs b/src/Perspex.Controls/ColumnDefinition.cs index e26010bf76..39bdb5eeb5 100644 --- a/src/Perspex.Controls/ColumnDefinition.cs +++ b/src/Perspex.Controls/ColumnDefinition.cs @@ -1,8 +1,5 @@ - - - - - +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. namespace Perspex.Controls { diff --git a/src/Perspex.Controls/ColumnDefinitions.cs b/src/Perspex.Controls/ColumnDefinitions.cs index cb72170355..0163120d20 100644 --- a/src/Perspex.Controls/ColumnDefinitions.cs +++ b/src/Perspex.Controls/ColumnDefinitions.cs @@ -1,14 +1,11 @@ - - - - +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. +using System.Linq; +using Perspex.Collections; namespace Perspex.Controls { - using System.Linq; - using Perspex.Collections; - /// /// A collection of s. /// diff --git a/src/Perspex.Controls/ContentControl.cs b/src/Perspex.Controls/ContentControl.cs index b27224ca42..86a833e64f 100644 --- a/src/Perspex.Controls/ContentControl.cs +++ b/src/Perspex.Controls/ContentControl.cs @@ -1,18 +1,15 @@ - - - - +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. +using System; +using Perspex.Collections; +using Perspex.Controls.Presenters; +using Perspex.Controls.Primitives; +using Perspex.Controls.Templates; +using Perspex.Layout; namespace Perspex.Controls { - using System; - using Perspex.Collections; - using Perspex.Controls.Presenters; - using Perspex.Controls.Primitives; - using Perspex.Controls.Templates; - using Perspex.Layout; - /// /// Displays according to a . /// diff --git a/src/Perspex.Controls/Control.cs b/src/Perspex.Controls/Control.cs index e9f921688f..c40e988108 100644 --- a/src/Perspex.Controls/Control.cs +++ b/src/Perspex.Controls/Control.cs @@ -1,24 +1,21 @@ - - - - - +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. + +using System; +using System.Linq; +using System.Reactive.Linq; +using Perspex.Collections; +using Perspex.Controls.Primitives; +using Perspex.Controls.Templates; +using Perspex.Input; +using Perspex.Interactivity; +using Perspex.LogicalTree; +using Perspex.Rendering; +using Perspex.Styling; +using Splat; namespace Perspex.Controls { - using System; - using System.Linq; - using System.Reactive.Linq; - using Perspex.Collections; - using Perspex.Controls.Primitives; - using Perspex.Controls.Templates; - using Perspex.Input; - using Perspex.Interactivity; - using Perspex.LogicalTree; - using Perspex.Rendering; - using Perspex.Styling; - using Splat; - /// /// Base class for Perspex controls. /// @@ -70,17 +67,17 @@ namespace Perspex.Controls public static readonly RoutedEvent RequestBringIntoViewEvent = RoutedEvent.Register("RequestBringIntoView", RoutingStrategies.Bubble); - private Classes classes = new Classes(); + private Classes _classes = new Classes(); - private DataTemplates dataTemplates; + private DataTemplates _dataTemplates; - private IControl focusAdorner; + private IControl _focusAdorner; - private string id; + private string _id; - private IPerspexList logicalChildren; + private IPerspexList _logicalChildren; - private Styles styles; + private Styles _styles; /// /// Initializes static members of the class. @@ -112,15 +109,15 @@ namespace Perspex.Controls { get { - return this.classes; + return _classes; } set { - if (this.classes != value) + if (_classes != value) { - this.classes.Clear(); - this.classes.Add(value); + _classes.Clear(); + _classes.Add(value); } } } @@ -158,17 +155,17 @@ namespace Perspex.Controls { get { - if (this.dataTemplates == null) + if (_dataTemplates == null) { - this.dataTemplates = new DataTemplates(); + _dataTemplates = new DataTemplates(); } - return this.dataTemplates; + return _dataTemplates; } set { - this.dataTemplates = value; + _dataTemplates = value; } } @@ -183,12 +180,12 @@ namespace Perspex.Controls { get { - return this.id; + return _id; } set { - if (this.id != null) + if (_id != null) { throw new InvalidOperationException("ID already set."); } @@ -198,7 +195,7 @@ namespace Perspex.Controls throw new InvalidOperationException("Cannot set ID : control already added to tree."); } - this.id = value; + _id = value; } } @@ -214,17 +211,17 @@ namespace Perspex.Controls { get { - if (this.styles == null) + if (_styles == null) { - this.styles = new Styles(); + _styles = new Styles(); } - return this.styles; + return _styles; } set { - this.styles = value; + _styles = value; } } @@ -291,12 +288,12 @@ namespace Perspex.Controls { get { - if (this.logicalChildren == null) + if (_logicalChildren == null) { - this.logicalChildren = new PerspexList(); + _logicalChildren = new PerspexList(); } - return this.logicalChildren; + return _logicalChildren; } } @@ -375,20 +372,20 @@ namespace Perspex.Controls if (adornerLayer != null) { - if (this.focusAdorner == null) + if (_focusAdorner == null) { var template = this.GetValue(FocusAdornerProperty); if (template != null) { - this.focusAdorner = template.Build(); + _focusAdorner = template.Build(); } } - if (this.focusAdorner != null) + if (_focusAdorner != null) { - AdornerLayer.SetAdornedElement((Visual)this.focusAdorner, this); - adornerLayer.Children.Add(this.focusAdorner); + AdornerLayer.SetAdornedElement((Visual)_focusAdorner, this); + adornerLayer.Children.Add(_focusAdorner); } } } @@ -399,11 +396,11 @@ namespace Perspex.Controls { base.OnLostFocus(e); - if (this.focusAdorner != null) + if (_focusAdorner != null) { - var adornerLayer = this.focusAdorner.Parent as Panel; - adornerLayer.Children.Remove(this.focusAdorner); - this.focusAdorner = null; + var adornerLayer = _focusAdorner.Parent as Panel; + adornerLayer.Children.Remove(_focusAdorner); + _focusAdorner = null; } } @@ -422,7 +419,7 @@ namespace Perspex.Controls /// The logical children to use. protected void RedirectLogicalChildren(IPerspexList collection) { - this.logicalChildren = collection; + _logicalChildren = collection; } } } diff --git a/src/Perspex.Controls/ControlExtensions.cs b/src/Perspex.Controls/ControlExtensions.cs index 466e88fef2..0c3831289f 100644 --- a/src/Perspex.Controls/ControlExtensions.cs +++ b/src/Perspex.Controls/ControlExtensions.cs @@ -1,15 +1,12 @@ - - - - +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. +using System.Linq; +using Perspex.LogicalTree; +using Perspex.Styling; namespace Perspex.Controls { - using System.Linq; - using Perspex.LogicalTree; - using Perspex.Styling; - /// /// Adds common functionality to . /// diff --git a/src/Perspex.Controls/Controls.cs b/src/Perspex.Controls/Controls.cs index 5e58ee4730..a7435259da 100644 --- a/src/Perspex.Controls/Controls.cs +++ b/src/Perspex.Controls/Controls.cs @@ -1,14 +1,11 @@ - - - - +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. +using System.Collections.Generic; +using Perspex.Collections; namespace Perspex.Controls { - using System.Collections.Generic; - using Perspex.Collections; - /// /// A collection of s. /// diff --git a/src/Perspex.Controls/Deck.cs b/src/Perspex.Controls/Deck.cs index 7f64851c7c..740971d20f 100644 --- a/src/Perspex.Controls/Deck.cs +++ b/src/Perspex.Controls/Deck.cs @@ -1,17 +1,14 @@ - - - - +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. +using Perspex.Animation; +using Perspex.Controls.Primitives; +using Perspex.Controls.Templates; +using Perspex.Controls.Utils; +using Perspex.Input; namespace Perspex.Controls { - using Perspex.Animation; - using Perspex.Controls.Primitives; - using Perspex.Controls.Templates; - using Perspex.Controls.Utils; - using Perspex.Input; - /// /// An items control that displays its items as pages that fill the control. /// @@ -26,7 +23,7 @@ namespace Perspex.Controls /// /// The default value of for . /// - private static readonly ITemplate PanelTemplate = + private static readonly ITemplate s_panelTemplate = new FuncTemplate(() => new Panel()); /// @@ -35,7 +32,7 @@ namespace Perspex.Controls static Deck() { AutoSelectProperty.OverrideDefaultValue(true); - ItemsPanelProperty.OverrideDefaultValue(PanelTemplate); + ItemsPanelProperty.OverrideDefaultValue(s_panelTemplate); } /// diff --git a/src/Perspex.Controls/Decorator.cs b/src/Perspex.Controls/Decorator.cs index 77cf4f0415..7cacc0f516 100644 --- a/src/Perspex.Controls/Decorator.cs +++ b/src/Perspex.Controls/Decorator.cs @@ -1,13 +1,10 @@ - - - - +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. +using Perspex.Collections; namespace Perspex.Controls { - using Perspex.Collections; - /// /// Base class for controls which decorate a single child control. /// diff --git a/src/Perspex.Controls/DefinitionBase.cs b/src/Perspex.Controls/DefinitionBase.cs index a1834416bf..0ffa26fbef 100644 --- a/src/Perspex.Controls/DefinitionBase.cs +++ b/src/Perspex.Controls/DefinitionBase.cs @@ -1,8 +1,5 @@ - - - - - +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. namespace Perspex.Controls { diff --git a/src/Perspex.Controls/DropDown.cs b/src/Perspex.Controls/DropDown.cs index 1d2c35185c..29a452111b 100644 --- a/src/Perspex.Controls/DropDown.cs +++ b/src/Perspex.Controls/DropDown.cs @@ -1,22 +1,19 @@ - - - - - +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. + +using System; +using System.Linq; +using Perspex.Controls.Generators; +using Perspex.Controls.Primitives; +using Perspex.Controls.Shapes; +using Perspex.Controls.Templates; +using Perspex.Input; +using Perspex.Layout; +using Perspex.Media; +using Perspex.VisualTree; namespace Perspex.Controls { - using System; - using System.Linq; - using Generators; - using Perspex.Controls.Primitives; - using Perspex.Controls.Shapes; - using Perspex.Controls.Templates; - using Perspex.Input; - using Perspex.Layout; - using Perspex.Media; - using Perspex.VisualTree; - public class DropDown : SelectingItemsControl, IContentControl { public static readonly PerspexProperty ContentProperty = @@ -34,7 +31,7 @@ namespace Perspex.Controls public static readonly PerspexProperty SelectionBoxItemProperty = PerspexProperty.Register("SelectionBoxItem"); - private Popup popup; + private Popup _popup; static DropDown() { @@ -117,13 +114,13 @@ namespace Perspex.Controls protected override void OnTemplateApplied() { - if (this.popup != null) + if (_popup != null) { - this.popup.Opened -= this.PopupOpened; + _popup.Opened -= this.PopupOpened; } - this.popup = this.GetTemplateChild("popup"); - this.popup.Opened += this.PopupOpened; + _popup = this.GetTemplateChild("popup"); + _popup.Opened += this.PopupOpened; } private void PopupOpened(object sender, EventArgs e) diff --git a/src/Perspex.Controls/Generators/IItemContainerGenerator.cs b/src/Perspex.Controls/Generators/IItemContainerGenerator.cs index c835b8778a..d613c89d64 100644 --- a/src/Perspex.Controls/Generators/IItemContainerGenerator.cs +++ b/src/Perspex.Controls/Generators/IItemContainerGenerator.cs @@ -1,16 +1,13 @@ - - - - +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. +using System; +using System.Collections; +using System.Collections.Generic; +using Perspex.Controls.Templates; namespace Perspex.Controls.Generators { - using System; - using System.Collections; - using System.Collections.Generic; - using Templates; - /// /// Creates containers for items and maintains a list of created containers. /// diff --git a/src/Perspex.Controls/Generators/ITreeItemContainerGenerator.cs b/src/Perspex.Controls/Generators/ITreeItemContainerGenerator.cs index f08e5e1ef6..0555fd436f 100644 --- a/src/Perspex.Controls/Generators/ITreeItemContainerGenerator.cs +++ b/src/Perspex.Controls/Generators/ITreeItemContainerGenerator.cs @@ -1,13 +1,10 @@ - - - - +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. +using System.Collections.Generic; namespace Perspex.Controls.Generators { - using System.Collections.Generic; - /// /// Creates containers for tree items and maintains a list of created containers. /// diff --git a/src/Perspex.Controls/Generators/ItemContainerGenerator.cs b/src/Perspex.Controls/Generators/ItemContainerGenerator.cs index d1d1b28504..daba73aa3a 100644 --- a/src/Perspex.Controls/Generators/ItemContainerGenerator.cs +++ b/src/Perspex.Controls/Generators/ItemContainerGenerator.cs @@ -1,26 +1,23 @@ - - - - +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. +using System; +using System.Collections; +using System.Collections.Generic; +using System.Linq; +using System.Reactive.Subjects; +using Perspex.Controls.Templates; namespace Perspex.Controls.Generators { - using System; - using System.Collections; - using System.Collections.Generic; - using System.Linq; - using System.Reactive.Subjects; - using Perspex.Controls.Templates; - /// /// Creates containers for items and maintains a list of created containers. /// public class ItemContainerGenerator : IItemContainerGenerator { - private Dictionary containers = new Dictionary(); + private Dictionary _containers = new Dictionary(); - private Subject containersInitialized = new Subject(); + private Subject _containersInitialized = new Subject(); /// /// Initializes a new instance of the class. @@ -34,7 +31,7 @@ namespace Perspex.Controls.Generators /// /// Signalled whenever new containers are initialized. /// - public IObservable ContainersInitialized => this.containersInitialized; + public IObservable ContainersInitialized => _containersInitialized; /// /// Gets the owner control. @@ -67,7 +64,7 @@ namespace Perspex.Controls.Generators } this.AddContainers(startingIndex, result); - this.containersInitialized.OnNext(new ItemContainers(startingIndex, result)); + _containersInitialized.OnNext(new ItemContainers(startingIndex, result)); return result.Where(x => x != null).ToList(); } @@ -87,12 +84,12 @@ namespace Perspex.Controls.Generators for (int i = startingIndex; i < startingIndex + count; ++i) { - var container = this.containers[i]; + var container = _containers[i]; if (container != null) { result.Add(container); - this.containers.Remove(i); + _containers.Remove(i); } } @@ -105,8 +102,8 @@ namespace Perspex.Controls.Generators /// The removed controls. public IList ClearContainers() { - var result = this.containers; - this.containers = new Dictionary(); + var result = _containers; + _containers = new Dictionary(); return result.Values.ToList(); } @@ -118,7 +115,7 @@ namespace Perspex.Controls.Generators public IControl ContainerFromIndex(int index) { IControl result; - this.containers.TryGetValue(index, out result); + _containers.TryGetValue(index, out result); return result; } @@ -129,7 +126,7 @@ namespace Perspex.Controls.Generators /// The index of the container or -1 if not found. public int IndexFromContainer(IControl container) { - foreach (var i in this.containers) + foreach (var i in _containers) { if (i.Value == container) { @@ -175,9 +172,9 @@ namespace Perspex.Controls.Generators foreach (var c in container) { - if (!this.containers.ContainsKey(index)) + if (!_containers.ContainsKey(index)) { - this.containers[index] = c; + _containers[index] = c; } else { diff --git a/src/Perspex.Controls/Generators/ItemContainerGenerator`1.cs b/src/Perspex.Controls/Generators/ItemContainerGenerator`1.cs index 1087b86b51..19ebaabb1d 100644 --- a/src/Perspex.Controls/Generators/ItemContainerGenerator`1.cs +++ b/src/Perspex.Controls/Generators/ItemContainerGenerator`1.cs @@ -1,13 +1,10 @@ - - - - +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. +using Perspex.Controls.Templates; namespace Perspex.Controls.Generators { - using Perspex.Controls.Templates; - /// /// Creates containers for items and maintains a list of created containers. /// diff --git a/src/Perspex.Controls/Generators/ItemContainers.cs b/src/Perspex.Controls/Generators/ItemContainers.cs index fcd571d2a6..37e242aff4 100644 --- a/src/Perspex.Controls/Generators/ItemContainers.cs +++ b/src/Perspex.Controls/Generators/ItemContainers.cs @@ -1,13 +1,10 @@ - - - - +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. +using System.Collections.Generic; namespace Perspex.Controls.Generators { - using System.Collections.Generic; - /// /// Holds details about a set of item containers in an . /// diff --git a/src/Perspex.Controls/Generators/TreeItemContainerGenerator.cs b/src/Perspex.Controls/Generators/TreeItemContainerGenerator.cs index 3704a39b12..66fbefbb17 100644 --- a/src/Perspex.Controls/Generators/TreeItemContainerGenerator.cs +++ b/src/Perspex.Controls/Generators/TreeItemContainerGenerator.cs @@ -1,27 +1,24 @@ - - - - +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. +using System; +using System.Collections; +using System.Collections.Generic; +using System.Linq; +using System.Reactive.Subjects; +using Perspex.Controls.Templates; namespace Perspex.Controls.Generators { - using System; - using System.Collections; - using System.Collections.Generic; - using System.Linq; - using System.Reactive.Subjects; - using Perspex.Controls.Templates; - /// /// Creates containers for tree items and maintains a list of created containers. /// /// The type of the container. public class TreeItemContainerGenerator : ITreeItemContainerGenerator where T : TreeViewItem, new() { - private Dictionary containers = new Dictionary(); + private Dictionary _containers = new Dictionary(); - private Subject containersInitialized = new Subject(); + private Subject _containersInitialized = new Subject(); /// /// Initializes a new instance of the class. @@ -35,7 +32,7 @@ namespace Perspex.Controls.Generators /// /// Signalled whenever new containers are initialized. /// - public IObservable ContainersInitialized => this.containersInitialized; + public IObservable ContainersInitialized => _containersInitialized; /// /// Gets the owner control. @@ -61,11 +58,11 @@ namespace Perspex.Controls.Generators foreach (var item in items) { var container = this.CreateContainer(item, itemTemplate); - this.containers.Add(item, container); + _containers.Add(item, container); result.Add(container); } - this.containersInitialized.OnNext(new ItemContainers(startingIndex, result)); + _containersInitialized.OnNext(new ItemContainers(startingIndex, result)); return result.Where(x => x != null).ToList(); } @@ -86,7 +83,7 @@ namespace Perspex.Controls.Generators { T container; - if (this.containers.TryGetValue(item, out container)) + if (_containers.TryGetValue(item, out container)) { this.Remove(container, result); } @@ -130,7 +127,7 @@ namespace Perspex.Controls.Generators /// The containers. public IEnumerable GetAllContainers() { - return this.containers.Values; + return _containers.Values; } /// @@ -151,7 +148,7 @@ namespace Perspex.Controls.Generators public IControl ContainerFromItem(object item) { T result; - this.containers.TryGetValue(item, out result); + _containers.TryGetValue(item, out result); return result; } @@ -213,7 +210,7 @@ namespace Perspex.Controls.Generators { T childContainer; - if (this.containers.TryGetValue(childItem, out childContainer)) + if (_containers.TryGetValue(childItem, out childContainer)) { this.Remove(childContainer, removed); } @@ -221,11 +218,11 @@ namespace Perspex.Controls.Generators } // TODO: Dual index. - var i = this.containers.FirstOrDefault(x => x.Value == container); + var i = _containers.FirstOrDefault(x => x.Value == container); if (i.Key != null) { - this.containers.Remove(i.Key); + _containers.Remove(i.Key); } } } diff --git a/src/Perspex.Controls/Grid.cs b/src/Perspex.Controls/Grid.cs index 7aaeb8bfe1..1d2f36c62f 100644 --- a/src/Perspex.Controls/Grid.cs +++ b/src/Perspex.Controls/Grid.cs @@ -1,16 +1,13 @@ - - - - +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. +using System; +using System.Collections.Generic; +using System.Linq; +using Perspex.Collections; namespace Perspex.Controls { - using System; - using System.Collections.Generic; - using System.Linq; - using Perspex.Collections; - /// /// Lays out child controls according to a grid. /// @@ -40,13 +37,13 @@ namespace Perspex.Controls public static readonly PerspexProperty RowSpanProperty = PerspexProperty.RegisterAttached("RowSpan", 1); - private ColumnDefinitions columnDefinitions; + private ColumnDefinitions _columnDefinitions; - private RowDefinitions rowDefinitions; + private RowDefinitions _rowDefinitions; - private Segment[,] rowMatrix; + private Segment[,] _rowMatrix; - private Segment[,] colMatrix; + private Segment[,] _colMatrix; /// /// Gets or sets the columns definitions for the grid. @@ -55,23 +52,23 @@ namespace Perspex.Controls { get { - if (this.columnDefinitions == null) + if (_columnDefinitions == null) { this.ColumnDefinitions = new ColumnDefinitions(); } - return this.columnDefinitions; + return _columnDefinitions; } set { - if (this.columnDefinitions != null) + if (_columnDefinitions != null) { throw new NotSupportedException("Reassigning ColumnDefinitions not yet implemented."); } - this.columnDefinitions = value; - this.columnDefinitions.TrackItemPropertyChanged(_ => this.InvalidateMeasure()); + _columnDefinitions = value; + _columnDefinitions.TrackItemPropertyChanged(_ => this.InvalidateMeasure()); } } @@ -82,23 +79,23 @@ namespace Perspex.Controls { get { - if (this.rowDefinitions == null) + if (_rowDefinitions == null) { this.RowDefinitions = new RowDefinitions(); } - return this.rowDefinitions; + return _rowDefinitions; } set { - if (this.rowDefinitions != null) + if (_rowDefinitions != null) { throw new NotSupportedException("Reassigning RowDefinitions not yet implemented."); } - this.rowDefinitions = value; - this.rowDefinitions.TrackItemPropertyChanged(_ => this.InvalidateMeasure()); + _rowDefinitions = value; + _rowDefinitions.TrackItemPropertyChanged(_ => this.InvalidateMeasure()); } } @@ -212,8 +209,8 @@ namespace Perspex.Controls if (emptyRows) { - this.rowMatrix[0, 0] = new Segment(0, 0, double.PositiveInfinity, GridUnitType.Star); - this.rowMatrix[0, 0].Stars = 1.0; + _rowMatrix[0, 0] = new Segment(0, 0, double.PositiveInfinity, GridUnitType.Star); + _rowMatrix[0, 0].Stars = 1.0; totalStarsY += 1.0; } else @@ -224,31 +221,31 @@ namespace Perspex.Controls GridLength height = rowdef.Height; rowdef.ActualHeight = double.PositiveInfinity; - this.rowMatrix[i, i] = new Segment(0, rowdef.MinHeight, rowdef.MaxHeight, height.GridUnitType); + _rowMatrix[i, i] = new Segment(0, rowdef.MinHeight, rowdef.MaxHeight, height.GridUnitType); if (height.GridUnitType == GridUnitType.Pixel) { - this.rowMatrix[i, i].OfferedSize = Clamp(height.Value, this.rowMatrix[i, i].Min, this.rowMatrix[i, i].Max); - this.rowMatrix[i, i].DesiredSize = this.rowMatrix[i, i].OfferedSize; - rowdef.ActualHeight = this.rowMatrix[i, i].OfferedSize; + _rowMatrix[i, i].OfferedSize = Clamp(height.Value, _rowMatrix[i, i].Min, _rowMatrix[i, i].Max); + _rowMatrix[i, i].DesiredSize = _rowMatrix[i, i].OfferedSize; + rowdef.ActualHeight = _rowMatrix[i, i].OfferedSize; } else if (height.GridUnitType == GridUnitType.Star) { - this.rowMatrix[i, i].Stars = height.Value; + _rowMatrix[i, i].Stars = height.Value; totalStarsY += height.Value; } else if (height.GridUnitType == GridUnitType.Auto) { - this.rowMatrix[i, i].OfferedSize = Clamp(0, this.rowMatrix[i, i].Min, this.rowMatrix[i, i].Max); - this.rowMatrix[i, i].DesiredSize = this.rowMatrix[i, i].OfferedSize; + _rowMatrix[i, i].OfferedSize = Clamp(0, _rowMatrix[i, i].Min, _rowMatrix[i, i].Max); + _rowMatrix[i, i].DesiredSize = _rowMatrix[i, i].OfferedSize; } } } if (emptyCols) { - this.colMatrix[0, 0] = new Segment(0, 0, double.PositiveInfinity, GridUnitType.Star); - this.colMatrix[0, 0].Stars = 1.0; + _colMatrix[0, 0] = new Segment(0, 0, double.PositiveInfinity, GridUnitType.Star); + _colMatrix[0, 0].Stars = 1.0; totalStarsX += 1.0; } else @@ -259,23 +256,23 @@ namespace Perspex.Controls GridLength width = coldef.Width; coldef.ActualWidth = double.PositiveInfinity; - this.colMatrix[i, i] = new Segment(0, coldef.MinWidth, coldef.MaxWidth, width.GridUnitType); + _colMatrix[i, i] = new Segment(0, coldef.MinWidth, coldef.MaxWidth, width.GridUnitType); if (width.GridUnitType == GridUnitType.Pixel) { - this.colMatrix[i, i].OfferedSize = Clamp(width.Value, this.colMatrix[i, i].Min, this.colMatrix[i, i].Max); - this.colMatrix[i, i].DesiredSize = this.colMatrix[i, i].OfferedSize; - coldef.ActualWidth = this.colMatrix[i, i].OfferedSize; + _colMatrix[i, i].OfferedSize = Clamp(width.Value, _colMatrix[i, i].Min, _colMatrix[i, i].Max); + _colMatrix[i, i].DesiredSize = _colMatrix[i, i].OfferedSize; + coldef.ActualWidth = _colMatrix[i, i].OfferedSize; } else if (width.GridUnitType == GridUnitType.Star) { - this.colMatrix[i, i].Stars = width.Value; + _colMatrix[i, i].Stars = width.Value; totalStarsX += width.Value; } else if (width.GridUnitType == GridUnitType.Auto) { - this.colMatrix[i, i].OfferedSize = Clamp(0, this.colMatrix[i, i].Min, this.colMatrix[i, i].Max); - this.colMatrix[i, i].DesiredSize = this.colMatrix[i, i].OfferedSize; + _colMatrix[i, i].OfferedSize = Clamp(0, _colMatrix[i, i].Min, _colMatrix[i, i].Max); + _colMatrix[i, i].DesiredSize = _colMatrix[i, i].OfferedSize; } } } @@ -289,7 +286,7 @@ namespace Perspex.Controls // Pre-process the grid children so that we know what types of elements we have so // we can apply our special measuring rules. - GridWalker gridWalker = new GridWalker(this, this.rowMatrix, this.colMatrix); + GridWalker gridWalker = new GridWalker(this, _rowMatrix, _colMatrix); for (int i = 0; i < 6; i++) { @@ -326,14 +323,14 @@ namespace Perspex.Controls for (int r = row; r < row + rowspan; r++) { - starRow |= this.rowMatrix[r, r].Type == GridUnitType.Star; - autoRow |= this.rowMatrix[r, r].Type == GridUnitType.Auto; + starRow |= _rowMatrix[r, r].Type == GridUnitType.Star; + autoRow |= _rowMatrix[r, r].Type == GridUnitType.Auto; } for (int c = col; c < col + colspan; c++) { - starCol |= this.colMatrix[c, c].Type == GridUnitType.Star; - autoCol |= this.colMatrix[c, c].Type == GridUnitType.Auto; + starCol |= _colMatrix[c, c].Type == GridUnitType.Star; + autoCol |= _colMatrix[c, c].Type == GridUnitType.Auto; } // This series of if statements checks whether or not we should measure @@ -412,12 +409,12 @@ namespace Perspex.Controls for (int r = row; r < row + rowspan; r++) { - childSizeY += this.rowMatrix[r, r].OfferedSize; + childSizeY += _rowMatrix[r, r].OfferedSize; } for (int c = col; c < col + colspan; c++) { - childSizeX += this.colMatrix[c, c].OfferedSize; + childSizeX += _colMatrix[c, c].OfferedSize; } child.Measure(new Size(childSizeX, childSizeY)); @@ -431,12 +428,12 @@ namespace Perspex.Controls // elements off the end of the list. if (!starAuto) { - node = new GridNode(this.rowMatrix, row + rowspan - 1, row, desired.Height); + node = new GridNode(_rowMatrix, row + rowspan - 1, row, desired.Height); separatorIndex = sizes.IndexOf(separator); sizes.Insert(node.Row == node.Column ? separatorIndex + 1 : separatorIndex, node); } - node = new GridNode(this.colMatrix, col + colspan - 1, col, desired.Width); + node = new GridNode(_colMatrix, col + colspan - 1, col, desired.Width); separatorIndex = sizes.IndexOf(separator); sizes.Insert(node.Row == node.Column ? separatorIndex + 1 : separatorIndex, node); @@ -467,12 +464,12 @@ namespace Perspex.Controls for (int c = 0; c < colCount; c++) { - gridSizeX += this.colMatrix[c, c].DesiredSize; + gridSizeX += _colMatrix[c, c].DesiredSize; } for (int r = 0; r < rowCount; r++) { - gridSizeY += this.rowMatrix[r, r].DesiredSize; + gridSizeY += _rowMatrix[r, r].DesiredSize; } return new Size(gridSizeX, gridSizeY); @@ -487,8 +484,8 @@ namespace Perspex.Controls { int colCount = this.ColumnDefinitions.Count; int rowCount = this.RowDefinitions.Count; - int colMatrixDim = this.colMatrix.GetLength(0); - int rowMatrixDim = this.rowMatrix.GetLength(0); + int colMatrixDim = _colMatrix.GetLength(0); + int rowMatrixDim = _rowMatrix.GetLength(0); this.RestoreMeasureResults(); @@ -497,14 +494,14 @@ namespace Perspex.Controls for (int c = 0; c < colMatrixDim; c++) { - this.colMatrix[c, c].OfferedSize = this.colMatrix[c, c].DesiredSize; - totalConsumedX += this.colMatrix[c, c].OfferedSize; + _colMatrix[c, c].OfferedSize = _colMatrix[c, c].DesiredSize; + totalConsumedX += _colMatrix[c, c].OfferedSize; } for (int r = 0; r < rowMatrixDim; r++) { - this.rowMatrix[r, r].OfferedSize = this.rowMatrix[r, r].DesiredSize; - totalConsumedY += this.rowMatrix[r, r].OfferedSize; + _rowMatrix[r, r].OfferedSize = _rowMatrix[r, r].DesiredSize; + totalConsumedY += _rowMatrix[r, r].OfferedSize; } if (totalConsumedX != finalSize.Width) @@ -519,12 +516,12 @@ namespace Perspex.Controls for (int c = 0; c < colCount; c++) { - this.ColumnDefinitions[c].ActualWidth = this.colMatrix[c, c].OfferedSize; + this.ColumnDefinitions[c].ActualWidth = _colMatrix[c, c].OfferedSize; } for (int r = 0; r < rowCount; r++) { - this.RowDefinitions[r].ActualHeight = this.rowMatrix[r, r].OfferedSize; + this.RowDefinitions[r].ActualHeight = _rowMatrix[r, r].OfferedSize; } foreach (Control child in this.Children) @@ -541,22 +538,22 @@ namespace Perspex.Controls for (int c = 0; c < col; c++) { - childFinalX += this.colMatrix[c, c].OfferedSize; + childFinalX += _colMatrix[c, c].OfferedSize; } for (int c = col; c < col + colspan; c++) { - childFinalW += this.colMatrix[c, c].OfferedSize; + childFinalW += _colMatrix[c, c].OfferedSize; } for (int r = 0; r < row; r++) { - childFinalY += this.rowMatrix[r, r].OfferedSize; + childFinalY += _rowMatrix[r, r].OfferedSize; } for (int r = row; r < row + rowspan; r++) { - childFinalH += this.rowMatrix[r, r].OfferedSize; + childFinalH += _rowMatrix[r, r].OfferedSize; } child.Arrange(new Rect(childFinalX, childFinalY, childFinalW, childFinalH)); @@ -583,43 +580,43 @@ namespace Perspex.Controls private void CreateMatrices(int rowCount, int colCount) { - if (this.rowMatrix == null || this.colMatrix == null || - this.rowMatrix.GetLength(0) != rowCount || - this.colMatrix.GetLength(0) != colCount) + if (_rowMatrix == null || _colMatrix == null || + _rowMatrix.GetLength(0) != rowCount || + _colMatrix.GetLength(0) != colCount) { - this.rowMatrix = new Segment[rowCount, rowCount]; - this.colMatrix = new Segment[colCount, colCount]; + _rowMatrix = new Segment[rowCount, rowCount]; + _colMatrix = new Segment[colCount, colCount]; } } private void ExpandStarCols(Size availableSize) { - int matrixCount = this.colMatrix.GetLength(0); + int matrixCount = _colMatrix.GetLength(0); int columnsCount = this.ColumnDefinitions.Count; double width = availableSize.Width; for (int i = 0; i < matrixCount; i++) { - if (this.colMatrix[i, i].Type == GridUnitType.Star) + if (_colMatrix[i, i].Type == GridUnitType.Star) { - this.colMatrix[i, i].OfferedSize = 0; + _colMatrix[i, i].OfferedSize = 0; } else { - width = Math.Max(width - this.colMatrix[i, i].OfferedSize, 0); + width = Math.Max(width - _colMatrix[i, i].OfferedSize, 0); } } - this.AssignSize(this.colMatrix, 0, matrixCount - 1, ref width, GridUnitType.Star, false); + this.AssignSize(_colMatrix, 0, matrixCount - 1, ref width, GridUnitType.Star, false); width = Math.Max(0, width); if (columnsCount > 0) { for (int i = 0; i < matrixCount; i++) { - if (this.colMatrix[i, i].Type == GridUnitType.Star) + if (_colMatrix[i, i].Type == GridUnitType.Star) { - this.ColumnDefinitions[i].ActualWidth = this.colMatrix[i, i].OfferedSize; + this.ColumnDefinitions[i].ActualWidth = _colMatrix[i, i].OfferedSize; } } } @@ -627,7 +624,7 @@ namespace Perspex.Controls private void ExpandStarRows(Size availableSize) { - int matrixCount = this.rowMatrix.GetLength(0); + int matrixCount = _rowMatrix.GetLength(0); int rowCount = this.RowDefinitions.Count; double height = availableSize.Height; @@ -636,25 +633,25 @@ namespace Perspex.Controls // available size when there are Mins and Maxs applied. for (int i = 0; i < matrixCount; i++) { - if (this.rowMatrix[i, i].Type == GridUnitType.Star) + if (_rowMatrix[i, i].Type == GridUnitType.Star) { - this.rowMatrix[i, i].OfferedSize = 0.0; + _rowMatrix[i, i].OfferedSize = 0.0; } else { - height = Math.Max(height - this.rowMatrix[i, i].OfferedSize, 0); + height = Math.Max(height - _rowMatrix[i, i].OfferedSize, 0); } } - this.AssignSize(this.rowMatrix, 0, matrixCount - 1, ref height, GridUnitType.Star, false); + this.AssignSize(_rowMatrix, 0, matrixCount - 1, ref height, GridUnitType.Star, false); if (rowCount > 0) { for (int i = 0; i < matrixCount; i++) { - if (this.rowMatrix[i, i].Type == GridUnitType.Star) + if (_rowMatrix[i, i].Type == GridUnitType.Star) { - this.RowDefinitions[i].ActualHeight = this.rowMatrix[i, i].OfferedSize; + this.RowDefinitions[i].ActualHeight = _rowMatrix[i, i].OfferedSize; } } } @@ -722,7 +719,7 @@ namespace Perspex.Controls // the widths of the ColumnDefinitions. for (int i = 0; i < 2; i++) { - Segment[,] matrix = i == 0 ? this.rowMatrix : this.colMatrix; + Segment[,] matrix = i == 0 ? _rowMatrix : _colMatrix; int count = i == 0 ? rowCount : colCount; for (int row = count - 1; row >= 0; row--) @@ -772,30 +769,30 @@ namespace Perspex.Controls } } - int rowMatrixDim = this.rowMatrix.GetLength(0); - int colMatrixDim = this.colMatrix.GetLength(0); + int rowMatrixDim = _rowMatrix.GetLength(0); + int colMatrixDim = _colMatrix.GetLength(0); for (int r = 0; r < rowMatrixDim; r++) { - this.rowMatrix[r, r].OfferedSize = this.rowMatrix[r, r].DesiredSize; + _rowMatrix[r, r].OfferedSize = _rowMatrix[r, r].DesiredSize; } for (int c = 0; c < colMatrixDim; c++) { - this.colMatrix[c, c].OfferedSize = this.colMatrix[c, c].DesiredSize; + _colMatrix[c, c].OfferedSize = _colMatrix[c, c].DesiredSize; } } private void SaveMeasureResults() { - int rowMatrixDim = this.rowMatrix.GetLength(0); - int colMatrixDim = this.colMatrix.GetLength(0); + int rowMatrixDim = _rowMatrix.GetLength(0); + int colMatrixDim = _colMatrix.GetLength(0); for (int i = 0; i < rowMatrixDim; i++) { for (int j = 0; j < rowMatrixDim; j++) { - this.rowMatrix[i, j].OriginalSize = this.rowMatrix[i, j].OfferedSize; + _rowMatrix[i, j].OriginalSize = _rowMatrix[i, j].OfferedSize; } } @@ -803,21 +800,21 @@ namespace Perspex.Controls { for (int j = 0; j < colMatrixDim; j++) { - this.colMatrix[i, j].OriginalSize = this.colMatrix[i, j].OfferedSize; + _colMatrix[i, j].OriginalSize = _colMatrix[i, j].OfferedSize; } } } private void RestoreMeasureResults() { - int rowMatrixDim = this.rowMatrix.GetLength(0); - int colMatrixDim = this.colMatrix.GetLength(0); + int rowMatrixDim = _rowMatrix.GetLength(0); + int colMatrixDim = _colMatrix.GetLength(0); for (int i = 0; i < rowMatrixDim; i++) { for (int j = 0; j < rowMatrixDim; j++) { - this.rowMatrix[i, j].OfferedSize = this.rowMatrix[i, j].OriginalSize; + _rowMatrix[i, j].OfferedSize = _rowMatrix[i, j].OriginalSize; } } @@ -825,7 +822,7 @@ namespace Perspex.Controls { for (int j = 0; j < colMatrixDim; j++) { - this.colMatrix[i, j].OfferedSize = this.colMatrix[i, j].OriginalSize; + _colMatrix[i, j].OfferedSize = _colMatrix[i, j].OriginalSize; } } } diff --git a/src/Perspex.Controls/GridLength.cs b/src/Perspex.Controls/GridLength.cs index b6510f16a5..49c1d8eed7 100644 --- a/src/Perspex.Controls/GridLength.cs +++ b/src/Perspex.Controls/GridLength.cs @@ -1,15 +1,12 @@ - - - - +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. +using System; +using System.Collections.Generic; +using System.Linq; namespace Perspex.Controls { - using System; - using System.Collections.Generic; - using System.Linq; - /// /// Defines the valid units for a . /// @@ -36,9 +33,9 @@ namespace Perspex.Controls /// public struct GridLength : IEquatable { - private GridUnitType type; + private GridUnitType _type; - private double value; + private double _value; /// /// Initializes a new instance of the struct. @@ -66,8 +63,8 @@ namespace Perspex.Controls throw new ArgumentException("Invalid value", "type"); } - this.type = type; - this.value = value; + _type = type; + _value = value; } /// @@ -84,7 +81,7 @@ namespace Perspex.Controls /// public GridUnitType GridUnitType { - get { return this.type; } + get { return _type; } } /// @@ -92,7 +89,7 @@ namespace Perspex.Controls /// public bool IsAbsolute { - get { return this.type == GridUnitType.Pixel; } + get { return _type == GridUnitType.Pixel; } } /// @@ -100,7 +97,7 @@ namespace Perspex.Controls /// public bool IsAuto { - get { return this.type == GridUnitType.Auto; } + get { return _type == GridUnitType.Auto; } } /// @@ -108,7 +105,7 @@ namespace Perspex.Controls /// public bool IsStar { - get { return this.type == GridUnitType.Star; } + get { return _type == GridUnitType.Star; } } /// @@ -116,7 +113,7 @@ namespace Perspex.Controls /// public double Value { - get { return this.value; } + get { return _value; } } /// @@ -127,7 +124,7 @@ namespace Perspex.Controls /// True if the structures are equal, otherwise false. public static bool operator ==(GridLength a, GridLength b) { - return (a.IsAuto && b.IsAuto) || (a.value == b.value && a.type == b.type); + return (a.IsAuto && b.IsAuto) || (a._value == b._value && a._type == b._type); } /// @@ -177,7 +174,7 @@ namespace Perspex.Controls /// The hash code. public override int GetHashCode() { - return this.value.GetHashCode() ^ this.type.GetHashCode(); + return _value.GetHashCode() ^ _type.GetHashCode(); } /// @@ -191,7 +188,7 @@ namespace Perspex.Controls return "Auto"; } - string s = this.value.ToString(); + string s = _value.ToString(); return this.IsStar ? s + "*" : s; } diff --git a/src/Perspex.Controls/GridSplitter.cs b/src/Perspex.Controls/GridSplitter.cs index 70be6e88b4..ef61a455ae 100644 --- a/src/Perspex.Controls/GridSplitter.cs +++ b/src/Perspex.Controls/GridSplitter.cs @@ -1,20 +1,17 @@ - - - - +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. +using System; +using Perspex.Controls.Primitives; +using Perspex.Input; +using Perspex.Rendering; +using Perspex.VisualTree; namespace Perspex.Controls { - using System; - using Perspex.Controls.Primitives; - using Perspex.Input; - using Perspex.Rendering; - using Perspex.VisualTree; - public class GridSplitter : Thumb { - private Grid grid; + private Grid _grid; /// /// Initializes a new instance of the class. @@ -28,10 +25,10 @@ namespace Perspex.Controls { int col = this.GetValue(Grid.ColumnProperty); - if (this.grid != null && col > 0) + if (_grid != null && col > 0) { - this.grid.ColumnDefinitions[col - 1].Width = new GridLength( - this.grid.ColumnDefinitions[col - 1].ActualWidth + e.Vector.X, + _grid.ColumnDefinitions[col - 1].Width = new GridLength( + _grid.ColumnDefinitions[col - 1].ActualWidth + e.Vector.X, GridUnitType.Pixel); } } @@ -39,7 +36,7 @@ namespace Perspex.Controls protected override void OnAttachedToVisualTree(IRenderRoot root) { base.OnAttachedToVisualTree(root); - this.grid = this.GetVisualParent(); + _grid = this.GetVisualParent(); } } } diff --git a/src/Perspex.Controls/IContentControl.cs b/src/Perspex.Controls/IContentControl.cs index 3bf0d61ac7..cc2c4a3fea 100644 --- a/src/Perspex.Controls/IContentControl.cs +++ b/src/Perspex.Controls/IContentControl.cs @@ -1,12 +1,10 @@ - - - +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. +using Perspex.Layout; namespace Perspex.Controls { - using Perspex.Layout; - /// /// Defines a control that displays according to a /// . diff --git a/src/Perspex.Controls/IControl.cs b/src/Perspex.Controls/IControl.cs index abbdfa0876..21cb044d0a 100644 --- a/src/Perspex.Controls/IControl.cs +++ b/src/Perspex.Controls/IControl.cs @@ -1,16 +1,13 @@ - - - - +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. +using Perspex.Controls.Templates; +using Perspex.Input; +using Perspex.Layout; +using Perspex.Styling; namespace Perspex.Controls { - using Perspex.Controls.Templates; - using Perspex.Input; - using Perspex.Layout; - using Perspex.Styling; - /// /// Interface for Perspex controls. /// diff --git a/src/Perspex.Controls/IGlobalDataTemplates.cs b/src/Perspex.Controls/IGlobalDataTemplates.cs index 405dcd654c..0ab3951039 100644 --- a/src/Perspex.Controls/IGlobalDataTemplates.cs +++ b/src/Perspex.Controls/IGlobalDataTemplates.cs @@ -1,13 +1,10 @@ - - - - +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. +using Perspex.Controls.Templates; namespace Perspex.Controls { - using Perspex.Controls.Templates; - /// /// Defines the application-global data templates. /// diff --git a/src/Perspex.Controls/IHeadered.cs b/src/Perspex.Controls/IHeadered.cs index 1ded1ca55e..944ac104e1 100644 --- a/src/Perspex.Controls/IHeadered.cs +++ b/src/Perspex.Controls/IHeadered.cs @@ -1,8 +1,5 @@ - - - - - +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. namespace Perspex.Controls { diff --git a/src/Perspex.Controls/IPanel.cs b/src/Perspex.Controls/IPanel.cs index 36fe4ea486..c1ce8d5f51 100644 --- a/src/Perspex.Controls/IPanel.cs +++ b/src/Perspex.Controls/IPanel.cs @@ -1,8 +1,5 @@ - - - - - +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. namespace Perspex.Controls { diff --git a/src/Perspex.Controls/IReparentingControl.cs b/src/Perspex.Controls/IReparentingControl.cs index 1cccc2124e..a7d4b46e64 100644 --- a/src/Perspex.Controls/IReparentingControl.cs +++ b/src/Perspex.Controls/IReparentingControl.cs @@ -1,13 +1,10 @@ - - - - +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. +using Perspex.Collections; namespace Perspex.Controls { - using Perspex.Collections; - /// /// A control that can make its visual children the logical children of another control. /// diff --git a/src/Perspex.Controls/IReparentingHost.cs b/src/Perspex.Controls/IReparentingHost.cs index 5e6dce8426..99dcf7d4f1 100644 --- a/src/Perspex.Controls/IReparentingHost.cs +++ b/src/Perspex.Controls/IReparentingHost.cs @@ -1,13 +1,10 @@ - - - - +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. +using Perspex.Collections; namespace Perspex.Controls { - using Perspex.Collections; - /// /// A control that can use the visual children of another control as its logical children. /// diff --git a/src/Perspex.Controls/ISelectable.cs b/src/Perspex.Controls/ISelectable.cs index 41c6be3fda..742d15d2da 100644 --- a/src/Perspex.Controls/ISelectable.cs +++ b/src/Perspex.Controls/ISelectable.cs @@ -1,13 +1,10 @@ - - - - +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. +using Perspex.Controls.Primitives; namespace Perspex.Controls { - using Perspex.Controls.Primitives; - /// /// Interface for objects that are selectable. /// diff --git a/src/Perspex.Controls/ISetLogicalParent.cs b/src/Perspex.Controls/ISetLogicalParent.cs index 0eabc8187b..8ead31b4c6 100644 --- a/src/Perspex.Controls/ISetLogicalParent.cs +++ b/src/Perspex.Controls/ISetLogicalParent.cs @@ -1,8 +1,5 @@ - - - - - +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. namespace Perspex.Controls { diff --git a/src/Perspex.Controls/Image.cs b/src/Perspex.Controls/Image.cs index 26b69c8f68..e7db5ad81a 100644 --- a/src/Perspex.Controls/Image.cs +++ b/src/Perspex.Controls/Image.cs @@ -1,15 +1,12 @@ - - - - +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. +using System; +using Perspex.Media; +using Perspex.Media.Imaging; namespace Perspex.Controls { - using System; - using Perspex.Media; - using Perspex.Media.Imaging; - /// /// Displays a image. /// diff --git a/src/Perspex.Controls/ItemsControl.cs b/src/Perspex.Controls/ItemsControl.cs index 07f614e44c..926642b4e4 100644 --- a/src/Perspex.Controls/ItemsControl.cs +++ b/src/Perspex.Controls/ItemsControl.cs @@ -1,25 +1,22 @@ - - - - - +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. + +using System; +using System.Collections; +using System.Collections.ObjectModel; +using System.Collections.Specialized; +using System.Diagnostics.CodeAnalysis; +using System.Linq; +using Perspex.Collections; +using Perspex.Controls.Generators; +using Perspex.Controls.Presenters; +using Perspex.Controls.Primitives; +using Perspex.Controls.Templates; +using Perspex.Controls.Utils; +using Perspex.Styling; namespace Perspex.Controls { - using System; - using System.Collections; - using System.Collections.ObjectModel; - using System.Collections.Specialized; - using System.Diagnostics.CodeAnalysis; - using System.Linq; - using Perspex.Collections; - using Perspex.Controls.Generators; - using Perspex.Controls.Presenters; - using Perspex.Controls.Primitives; - using Perspex.Controls.Templates; - using Perspex.Controls.Utils; - using Perspex.Styling; - /// /// Displays a collection of items. /// @@ -29,7 +26,7 @@ namespace Perspex.Controls /// The default value for the property. /// [SuppressMessage("Microsoft.StyleCop.CSharp.NamingRules", "SA1202:ElementsMustBeOrderedByAccess", Justification = "Needs to be before or a NullReferenceException is thrown.")] - private static readonly FuncTemplate DefaultPanel = + private static readonly FuncTemplate s_defaultPanel = new FuncTemplate(() => new StackPanel()); /// @@ -42,9 +39,9 @@ namespace Perspex.Controls /// Defines the property. /// public static readonly PerspexProperty> ItemsPanelProperty = - PerspexProperty.Register>("ItemsPanel", defaultValue: DefaultPanel); + PerspexProperty.Register>("ItemsPanel", defaultValue: s_defaultPanel); - private IItemContainerGenerator itemContainerGenerator; + private IItemContainerGenerator _itemContainerGenerator; /// /// Initializes static members of the class. @@ -70,12 +67,12 @@ namespace Perspex.Controls { get { - if (this.itemContainerGenerator == null) + if (_itemContainerGenerator == null) { - this.itemContainerGenerator = this.CreateItemContainerGenerator(); + _itemContainerGenerator = this.CreateItemContainerGenerator(); } - return this.itemContainerGenerator; + return _itemContainerGenerator; } } diff --git a/src/Perspex.Controls/ListBox.cs b/src/Perspex.Controls/ListBox.cs index fbd593bc2d..50eee6a7db 100644 --- a/src/Perspex.Controls/ListBox.cs +++ b/src/Perspex.Controls/ListBox.cs @@ -1,14 +1,11 @@ - - - - +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. +using Perspex.Controls.Generators; +using Perspex.Controls.Primitives; namespace Perspex.Controls { - using Perspex.Controls.Generators; - using Perspex.Controls.Primitives; - public class ListBox : SelectingItemsControl { protected override IItemContainerGenerator CreateItemContainerGenerator() diff --git a/src/Perspex.Controls/ListBoxItem.cs b/src/Perspex.Controls/ListBoxItem.cs index 71524b51e1..281ce0446e 100644 --- a/src/Perspex.Controls/ListBoxItem.cs +++ b/src/Perspex.Controls/ListBoxItem.cs @@ -1,13 +1,10 @@ - - - - +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. +using Perspex.Controls.Mixins; namespace Perspex.Controls { - using Perspex.Controls.Mixins; - /// /// A selectable item in a . /// diff --git a/src/Perspex.Controls/Menu.cs b/src/Perspex.Controls/Menu.cs index 114c0cb0e9..e8146ee2d4 100644 --- a/src/Perspex.Controls/Menu.cs +++ b/src/Perspex.Controls/Menu.cs @@ -1,21 +1,18 @@ - - - - - +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. + +using System; +using System.Linq; +using System.Reactive.Disposables; +using Perspex.Controls.Primitives; +using Perspex.Controls.Templates; +using Perspex.Input; +using Perspex.Interactivity; +using Perspex.LogicalTree; +using Perspex.Rendering; namespace Perspex.Controls { - using System; - using System.Linq; - using System.Reactive.Disposables; - using Perspex.Controls.Primitives; - using Perspex.Controls.Templates; - using Perspex.Input; - using Perspex.Interactivity; - using Perspex.LogicalTree; - using Perspex.Rendering; - /// /// A top-level menu control. /// @@ -24,7 +21,7 @@ namespace Perspex.Controls /// /// Defines the default items panel used by a . /// - private static readonly ITemplate DefaultPanel = + private static readonly ITemplate s_defaultPanel = new FuncTemplate(() => new StackPanel { Orientation = Orientation.Horizontal }); /// @@ -36,14 +33,14 @@ namespace Perspex.Controls /// /// Tracks event handlers added to the root of the visual tree. /// - private IDisposable subscription; + private IDisposable _subscription; /// /// Initializes static members of the class. /// static Menu() { - ItemsPanelProperty.OverrideDefaultValue(typeof(Menu), DefaultPanel); + ItemsPanelProperty.OverrideDefaultValue(typeof(Menu), s_defaultPanel); MenuItem.ClickEvent.AddClassHandler(x => x.OnMenuClick); MenuItem.SubmenuOpenedEvent.AddClassHandler(x => x.OnSubmenuOpened); } @@ -112,7 +109,7 @@ namespace Perspex.Controls this.TopLevelPreviewPointerPress, RoutingStrategies.Tunnel); - this.subscription = new CompositeDisposable( + _subscription = new CompositeDisposable( pointerPress, Disposable.Create(() => topLevel.Deactivated -= this.Deactivated)); @@ -131,7 +128,7 @@ namespace Perspex.Controls protected override void OnDetachedFromVisualTree(IRenderRoot oldRoot) { base.OnDetachedFromVisualTree(oldRoot); - this.subscription.Dispose(); + _subscription.Dispose(); } /// diff --git a/src/Perspex.Controls/MenuItem.cs b/src/Perspex.Controls/MenuItem.cs index 7aa5cc96d1..9c5758284f 100644 --- a/src/Perspex.Controls/MenuItem.cs +++ b/src/Perspex.Controls/MenuItem.cs @@ -1,26 +1,23 @@ - - - - - +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. + +using System; +using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; +using System.Linq; +using System.Windows.Input; +using Perspex.Controls.Mixins; +using Perspex.Controls.Presenters; +using Perspex.Controls.Primitives; +using Perspex.Controls.Templates; +using Perspex.Input; +using Perspex.Interactivity; +using Perspex.Threading; +using Perspex.VisualTree; +using Splat; namespace Perspex.Controls { - using System; - using System.Collections.Generic; - using System.Diagnostics.CodeAnalysis; - using System.Linq; - using System.Windows.Input; - using Perspex.Controls.Mixins; - using Perspex.Controls.Presenters; - using Perspex.Controls.Primitives; - using Perspex.Controls.Templates; - using Perspex.Input; - using Perspex.Interactivity; - using Perspex.Threading; - using Perspex.VisualTree; - using Splat; - /// /// A menu item control. /// @@ -77,7 +74,7 @@ namespace Perspex.Controls /// /// The default value for the property. /// - private static readonly ITemplate DefaultPanel = + private static readonly ITemplate s_defaultPanel = new FuncTemplate(() => new StackPanel { [KeyboardNavigation.DirectionalNavigationProperty] = KeyboardNavigationMode.Cycle, @@ -86,12 +83,12 @@ namespace Perspex.Controls /// /// The timer used to display submenus. /// - private IDisposable submenuTimer; + private IDisposable _submenuTimer; /// /// The submenu popup. /// - private Popup popup; + private Popup _popup; /// /// Initializes static members of the class. @@ -100,7 +97,7 @@ namespace Perspex.Controls { SelectableMixin.Attach(IsSelectedProperty); FocusableProperty.OverrideDefaultValue(true); - ItemsPanelProperty.OverrideDefaultValue(DefaultPanel); + ItemsPanelProperty.OverrideDefaultValue(s_defaultPanel); ClickEvent.AddClassHandler(x => x.OnClick); SubmenuOpenedEvent.AddClassHandler(x => x.OnSubmenuOpened); IsSubMenuOpenProperty.Changed.AddClassHandler(x => x.SubMenuOpenChanged); @@ -302,7 +299,7 @@ namespace Perspex.Controls } else if (this.HasSubMenu && !this.IsSubMenuOpen) { - this.submenuTimer = DispatcherTimer.Run( + _submenuTimer = DispatcherTimer.Run( () => this.IsSubMenuOpen = true, TimeSpan.FromMilliseconds(400)); } @@ -316,10 +313,10 @@ namespace Perspex.Controls { base.OnPointerLeave(e); - if (this.submenuTimer != null) + if (_submenuTimer != null) { - this.submenuTimer.Dispose(); - this.submenuTimer = null; + _submenuTimer.Dispose(); + _submenuTimer = null; } } @@ -374,11 +371,11 @@ namespace Perspex.Controls { base.OnTemplateApplied(); - this.popup = this.GetTemplateChild("popup"); - this.popup.DependencyResolver = DependencyResolver.Instance; - this.popup.PopupRootCreated += this.PopupRootCreated; - this.popup.Opened += this.PopupOpened; - this.popup.Closed += this.PopupClosed; + _popup = this.GetTemplateChild("popup"); + _popup.DependencyResolver = DependencyResolver.Instance; + _popup.PopupRootCreated += this.PopupRootCreated; + _popup.Opened += this.PopupOpened; + _popup.Closed += this.PopupClosed; } /// diff --git a/src/Perspex.Controls/MenuItemAccessKeyHandler.cs b/src/Perspex.Controls/MenuItemAccessKeyHandler.cs index 03c53d4a1c..e5705657f4 100644 --- a/src/Perspex.Controls/MenuItemAccessKeyHandler.cs +++ b/src/Perspex.Controls/MenuItemAccessKeyHandler.cs @@ -1,17 +1,14 @@ - - - - +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. +using System; +using System.Collections.Generic; +using System.Linq; +using Perspex.Input; +using Perspex.Interactivity; namespace Perspex.Controls { - using System; - using System.Collections.Generic; - using System.Linq; - using Perspex.Input; - using Perspex.Interactivity; - /// /// Handles access keys within a /// @@ -20,12 +17,12 @@ namespace Perspex.Controls /// /// The registered access keys. /// - private List> registered = new List>(); + private List> _registered = new List>(); /// /// The window to which the handler belongs. /// - private IInputRoot owner; + private IInputRoot _owner; /// /// Gets or sets the window's main menu. @@ -46,14 +43,14 @@ namespace Perspex.Controls { Contract.Requires(owner != null); - if (this.owner != null) + if (_owner != null) { throw new InvalidOperationException("AccessKeyHandler owner has already been set."); } - this.owner = owner; + _owner = owner; - this.owner.AddHandler(InputElement.TextInputEvent, this.OnTextInput); + _owner.AddHandler(InputElement.TextInputEvent, this.OnTextInput); } /// @@ -63,14 +60,14 @@ namespace Perspex.Controls /// The input element. public void Register(char accessKey, IInputElement element) { - var existing = this.registered.FirstOrDefault(x => x.Item2 == element); + var existing = _registered.FirstOrDefault(x => x.Item2 == element); if (existing != null) { - this.registered.Remove(existing); + _registered.Remove(existing); } - this.registered.Add(Tuple.Create(accessKey.ToString().ToUpper(), element)); + _registered.Add(Tuple.Create(accessKey.ToString().ToUpper(), element)); } /// @@ -79,9 +76,9 @@ namespace Perspex.Controls /// The input element. public void Unregister(IInputElement element) { - foreach (var i in this.registered.Where(x => x.Item2 == element).ToList()) + foreach (var i in _registered.Where(x => x.Item2 == element).ToList()) { - this.registered.Remove(i); + _registered.Remove(i); } } @@ -95,7 +92,7 @@ namespace Perspex.Controls if (!string.IsNullOrWhiteSpace(e.Text)) { var text = e.Text.ToUpper(); - var focus = this.registered + var focus = _registered .Where(x => x.Item1 == text && x.Item2.IsEffectivelyVisible) .FirstOrDefault()?.Item2; diff --git a/src/Perspex.Controls/Mixins/SelectableMixin.cs b/src/Perspex.Controls/Mixins/SelectableMixin.cs index 561f1890c1..b4160218dc 100644 --- a/src/Perspex.Controls/Mixins/SelectableMixin.cs +++ b/src/Perspex.Controls/Mixins/SelectableMixin.cs @@ -1,15 +1,12 @@ - - - - +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. +using System; +using Perspex.Interactivity; +using Perspex.Controls.Primitives; namespace Perspex.Controls.Mixins { - using System; - using Perspex.Interactivity; - using Primitives; - /// /// Adds selectable functionality to control classes. /// diff --git a/src/Perspex.Controls/Panel.cs b/src/Perspex.Controls/Panel.cs index 7d03a61600..efb7554dc5 100644 --- a/src/Perspex.Controls/Panel.cs +++ b/src/Perspex.Controls/Panel.cs @@ -1,17 +1,14 @@ - - - - +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. +using System; +using System.Collections.Generic; +using System.Collections.Specialized; +using System.Linq; +using Perspex.Collections; namespace Perspex.Controls { - using System; - using System.Collections.Generic; - using System.Collections.Specialized; - using System.Linq; - using Perspex.Collections; - /// /// Base class for controls that can contain multiple children. /// @@ -21,17 +18,17 @@ namespace Perspex.Controls /// public class Panel : Control, IReparentingControl, IPanel { - private Controls children = new Controls(); + private Controls _children = new Controls(); - private ILogical childLogicalParent; + private ILogical _childLogicalParent; /// /// Initializes a new instance of the class. /// public Panel() { - this.children.CollectionChanged += this.ChildrenChanged; - this.childLogicalParent = this; + _children.CollectionChanged += this.ChildrenChanged; + _childLogicalParent = this; } /// @@ -47,7 +44,7 @@ namespace Perspex.Controls { get { - return this.children; + return _children; } set @@ -55,8 +52,8 @@ namespace Perspex.Controls Contract.Requires(value != null); this.ClearVisualChildren(); - this.children.Clear(); - this.children.AddRange(value); + _children.Clear(); + _children.AddRange(value); } } @@ -75,7 +72,7 @@ namespace Perspex.Controls Contract.Requires(logicalParent != null); Contract.Requires(children != null); - this.childLogicalParent = logicalParent; + _childLogicalParent = logicalParent; this.RedirectLogicalChildren(children); foreach (var control in this.Children) @@ -104,7 +101,7 @@ namespace Perspex.Controls /// The controls. private void SetLogicalParent(IEnumerable controls) { - var parent = this.childLogicalParent as Control; + var parent = _childLogicalParent as Control; foreach (var control in controls) { @@ -143,7 +140,7 @@ namespace Perspex.Controls this.ClearLogicalParent(controls); this.LogicalChildren.Clear(); this.ClearVisualChildren(); - this.AddVisualChildren(this.children); + this.AddVisualChildren(_children); break; } diff --git a/src/Perspex.Controls/PlacementMode.cs b/src/Perspex.Controls/PlacementMode.cs index b4c815a6ac..cf65f29c63 100644 --- a/src/Perspex.Controls/PlacementMode.cs +++ b/src/Perspex.Controls/PlacementMode.cs @@ -1,8 +1,5 @@ - - - - - +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. namespace Perspex.Controls { diff --git a/src/Perspex.Controls/Platform/IPopupImpl.cs b/src/Perspex.Controls/Platform/IPopupImpl.cs index 010b714928..087177ea0c 100644 --- a/src/Perspex.Controls/Platform/IPopupImpl.cs +++ b/src/Perspex.Controls/Platform/IPopupImpl.cs @@ -1,15 +1,12 @@ - - - - +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. +using System; +using Perspex.Controls; +using Perspex.Input.Raw; namespace Perspex.Platform { - using System; - using Perspex.Controls; - using Perspex.Input.Raw; - public interface IPopupImpl : ITopLevelImpl { void SetPosition(Point p); diff --git a/src/Perspex.Controls/Platform/ITopLevelImpl.cs b/src/Perspex.Controls/Platform/ITopLevelImpl.cs index 49928d6b13..116e029505 100644 --- a/src/Perspex.Controls/Platform/ITopLevelImpl.cs +++ b/src/Perspex.Controls/Platform/ITopLevelImpl.cs @@ -1,16 +1,13 @@ - - - - +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. +using System; +using Perspex.Controls; +using Perspex.Input; +using Perspex.Input.Raw; namespace Perspex.Platform { - using System; - using Perspex.Controls; - using Perspex.Input; - using Perspex.Input.Raw; - public interface ITopLevelImpl : IDisposable { Size ClientSize { get; set; } diff --git a/src/Perspex.Controls/Platform/IWindowImpl.cs b/src/Perspex.Controls/Platform/IWindowImpl.cs index 7b3a846483..934daa01a6 100644 --- a/src/Perspex.Controls/Platform/IWindowImpl.cs +++ b/src/Perspex.Controls/Platform/IWindowImpl.cs @@ -1,13 +1,10 @@ - - - - +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. +using System; namespace Perspex.Platform { - using System; - /// /// Defines a platform-specific window implementation. /// diff --git a/src/Perspex.Controls/Presenters/ContentPresenter.cs b/src/Perspex.Controls/Presenters/ContentPresenter.cs index b41a5f561e..7aaadc47ff 100644 --- a/src/Perspex.Controls/Presenters/ContentPresenter.cs +++ b/src/Perspex.Controls/Presenters/ContentPresenter.cs @@ -1,14 +1,11 @@ - - - - +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. +using Perspex.Controls.Primitives; +using Perspex.Controls.Templates; namespace Perspex.Controls.Presenters { - using Perspex.Controls.Primitives; - using Perspex.Controls.Templates; - /// /// Presents a single item of data inside a template. /// @@ -26,7 +23,7 @@ namespace Perspex.Controls.Presenters public static readonly PerspexProperty ContentProperty = ContentControl.ContentProperty.AddOwner(); - private bool createdChild; + private bool _createdChild; /// /// Initializes static members of the class. @@ -57,7 +54,7 @@ namespace Perspex.Controls.Presenters /// public override sealed void ApplyTemplate() { - if (!this.createdChild) + if (!_createdChild) { this.CreateChild(); } @@ -89,7 +86,7 @@ namespace Perspex.Controls.Presenters /// The event args. private void ContentChanged(PerspexPropertyChangedEventArgs e) { - this.createdChild = false; + _createdChild = false; this.InvalidateMeasure(); } @@ -122,7 +119,7 @@ namespace Perspex.Controls.Presenters logicalChildren.Add(result); } - this.createdChild = true; + _createdChild = true; } } } diff --git a/src/Perspex.Controls/Presenters/DeckPresenter.cs b/src/Perspex.Controls/Presenters/DeckPresenter.cs index 9b7f1c95d0..28945f8ee6 100644 --- a/src/Perspex.Controls/Presenters/DeckPresenter.cs +++ b/src/Perspex.Controls/Presenters/DeckPresenter.cs @@ -1,22 +1,19 @@ - - - - - +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. + +using System; +using System.Collections; +using System.Linq; +using System.Reactive.Linq; +using System.Threading.Tasks; +using Perspex.Animation; +using Perspex.Controls.Generators; +using Perspex.Controls.Primitives; +using Perspex.Controls.Templates; +using Perspex.Controls.Utils; namespace Perspex.Controls.Presenters { - using System; - using System.Collections; - using System.Linq; - using System.Reactive.Linq; - using System.Threading.Tasks; - using Perspex.Animation; - using Perspex.Controls.Generators; - using Perspex.Controls.Primitives; - using Perspex.Controls.Templates; - using Perspex.Controls.Utils; - /// /// Displays pages inside an . /// @@ -46,9 +43,9 @@ namespace Perspex.Controls.Presenters public static readonly PerspexProperty TransitionProperty = Deck.TransitionProperty.AddOwner(); - private bool createdPanel; + private bool _createdPanel; - private IItemContainerGenerator generator; + private IItemContainerGenerator _generator; /// /// Initializes static members of the class. @@ -66,23 +63,23 @@ namespace Perspex.Controls.Presenters { get { - if (this.generator == null) + if (_generator == null) { var i = this.TemplatedParent as ItemsControl; - this.generator = i?.ItemContainerGenerator ?? new ItemContainerGenerator(this); + _generator = i?.ItemContainerGenerator ?? new ItemContainerGenerator(this); } - return this.generator; + return _generator; } set { - if (this.generator != null) + if (_generator != null) { throw new InvalidOperationException("ItemContainerGenerator is already set."); } - this.generator = value; + _generator = value; } } @@ -134,7 +131,7 @@ namespace Perspex.Controls.Presenters /// public override sealed void ApplyTemplate() { - if (!this.createdPanel) + if (!_createdPanel) { this.CreatePanel(); } @@ -160,7 +157,7 @@ namespace Perspex.Controls.Presenters logicalHost.LogicalChildren); } - this.createdPanel = true; + _createdPanel = true; var task = this.MoveToPage(-1, this.SelectedIndex); } diff --git a/src/Perspex.Controls/Presenters/IContentPresenter.cs b/src/Perspex.Controls/Presenters/IContentPresenter.cs index 5283c2f100..f9c85870ab 100644 --- a/src/Perspex.Controls/Presenters/IContentPresenter.cs +++ b/src/Perspex.Controls/Presenters/IContentPresenter.cs @@ -1,13 +1,10 @@ - - - - +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. +using Perspex.Controls.Primitives; namespace Perspex.Controls.Presenters { - using Perspex.Controls.Primitives; - /// /// Interface for controls that present a single item of data inside a /// template. diff --git a/src/Perspex.Controls/Presenters/IItemsPresenter.cs b/src/Perspex.Controls/Presenters/IItemsPresenter.cs index 22547d26fd..eb8ed446f5 100644 --- a/src/Perspex.Controls/Presenters/IItemsPresenter.cs +++ b/src/Perspex.Controls/Presenters/IItemsPresenter.cs @@ -1,8 +1,5 @@ - - - - - +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. namespace Perspex.Controls.Presenters { diff --git a/src/Perspex.Controls/Presenters/IPresenter.cs b/src/Perspex.Controls/Presenters/IPresenter.cs index 0a4b573f2e..88245174df 100644 --- a/src/Perspex.Controls/Presenters/IPresenter.cs +++ b/src/Perspex.Controls/Presenters/IPresenter.cs @@ -1,14 +1,11 @@ - - - - +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. +using Perspex.Controls.Primitives; +using Perspex.Styling; namespace Perspex.Controls.Presenters { - using Perspex.Controls.Primitives; - using Perspex.Styling; - /// /// Interface for presenters such as and /// . diff --git a/src/Perspex.Controls/Presenters/ItemsPresenter.cs b/src/Perspex.Controls/Presenters/ItemsPresenter.cs index 8722ba2db5..3c871076f5 100644 --- a/src/Perspex.Controls/Presenters/ItemsPresenter.cs +++ b/src/Perspex.Controls/Presenters/ItemsPresenter.cs @@ -1,19 +1,16 @@ - - - - +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. +using System; +using System.Collections; +using System.Collections.Specialized; +using Perspex.Controls.Generators; +using Perspex.Controls.Templates; +using Perspex.Input; +using Perspex.Styling; namespace Perspex.Controls.Presenters { - using System; - using System.Collections; - using System.Collections.Specialized; - using Perspex.Controls.Generators; - using Perspex.Controls.Templates; - using Perspex.Input; - using Perspex.Styling; - /// /// Displays items inside an . /// @@ -31,9 +28,9 @@ namespace Perspex.Controls.Presenters public static readonly PerspexProperty> ItemsPanelProperty = ItemsControl.ItemsPanelProperty.AddOwner(); - private bool createdPanel; + private bool _createdPanel; - private IItemContainerGenerator generator; + private IItemContainerGenerator _generator; /// /// Initializes static members of the class. @@ -61,23 +58,23 @@ namespace Perspex.Controls.Presenters { get { - if (this.generator == null) + if (_generator == null) { var i = this.TemplatedParent as ItemsControl; - this.generator = i?.ItemContainerGenerator ?? new ItemContainerGenerator(this); + _generator = i?.ItemContainerGenerator ?? new ItemContainerGenerator(this); } - return this.generator; + return _generator; } set { - if (this.generator != null) + if (_generator != null) { throw new InvalidOperationException("ItemContainerGenerator is already set."); } - this.generator = value; + _generator = value; } } @@ -111,7 +108,7 @@ namespace Perspex.Controls.Presenters /// public override sealed void ApplyTemplate() { - if (!this.createdPanel) + if (!_createdPanel) { this.CreatePanel(); } @@ -162,7 +159,7 @@ namespace Perspex.Controls.Presenters KeyboardNavigation.SetTabNavigation( (InputElement)this.Panel, KeyboardNavigation.GetTabNavigation(this)); - this.createdPanel = true; + _createdPanel = true; this.CreateItemsAndListenForChanges(this.Items); } @@ -192,7 +189,7 @@ namespace Perspex.Controls.Presenters /// The event args. private void ItemsChanged(PerspexPropertyChangedEventArgs e) { - if (this.createdPanel) + if (_createdPanel) { var generator = this.ItemContainerGenerator; @@ -223,7 +220,7 @@ namespace Perspex.Controls.Presenters /// The event args. private void ItemsCollectionChanged(object sender, NotifyCollectionChangedEventArgs e) { - if (this.createdPanel) + if (_createdPanel) { var generator = this.ItemContainerGenerator; diff --git a/src/Perspex.Controls/Presenters/ScrollContentPresenter.cs b/src/Perspex.Controls/Presenters/ScrollContentPresenter.cs index 060041cd85..49c6a6c612 100644 --- a/src/Perspex.Controls/Presenters/ScrollContentPresenter.cs +++ b/src/Perspex.Controls/Presenters/ScrollContentPresenter.cs @@ -1,17 +1,14 @@ - - - - +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. +using System; +using System.Linq; +using Perspex.Input; +using Perspex.Layout; +using Perspex.VisualTree; namespace Perspex.Controls.Presenters { - using System; - using System.Linq; - using Perspex.Input; - using Perspex.Layout; - using Perspex.VisualTree; - public class ScrollContentPresenter : ContentPresenter, IPresenter { public static readonly PerspexProperty ExtentProperty = @@ -26,7 +23,7 @@ namespace Perspex.Controls.Presenters public static readonly PerspexProperty CanScrollHorizontallyProperty = PerspexProperty.Register("CanScrollHorizontally", true); - private Size measuredExtent; + private Size _measuredExtent; static ScrollContentPresenter() { @@ -77,7 +74,7 @@ namespace Perspex.Controls.Presenters content.Measure(measureSize); var size = content.DesiredSize; - this.measuredExtent = size; + _measuredExtent = size; return size.Constrain(availableSize); } else @@ -91,7 +88,7 @@ namespace Perspex.Controls.Presenters var child = this.GetVisualChildren().SingleOrDefault() as ILayoutable; this.Viewport = finalSize; - this.Extent = this.measuredExtent; + this.Extent = _measuredExtent; if (child != null) { diff --git a/src/Perspex.Controls/Presenters/TextPresenter.cs b/src/Perspex.Controls/Presenters/TextPresenter.cs index 662f168ebc..e50052d224 100644 --- a/src/Perspex.Controls/Presenters/TextPresenter.cs +++ b/src/Perspex.Controls/Presenters/TextPresenter.cs @@ -1,18 +1,15 @@ - - - - +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. +using System; +using System.Linq; +using System.Reactive.Linq; +using Perspex.Media; +using Perspex.Threading; +using Perspex.VisualTree; namespace Perspex.Controls.Presenters { - using System; - using System.Linq; - using System.Reactive.Linq; - using Perspex.Media; - using Perspex.Threading; - using Perspex.VisualTree; - public class TextPresenter : TextBlock { public static readonly PerspexProperty CaretIndexProperty = @@ -24,19 +21,19 @@ namespace Perspex.Controls.Presenters public static readonly PerspexProperty SelectionEndProperty = TextBox.SelectionEndProperty.AddOwner(); - private DispatcherTimer caretTimer; + private DispatcherTimer _caretTimer; - private bool caretBlink; + private bool _caretBlink; - private IObservable canScrollHorizontally; + private IObservable _canScrollHorizontally; public TextPresenter() { - this.caretTimer = new DispatcherTimer(); - this.caretTimer.Interval = TimeSpan.FromMilliseconds(500); - this.caretTimer.Tick += this.CaretTimerTick; + _caretTimer = new DispatcherTimer(); + _caretTimer.Interval = TimeSpan.FromMilliseconds(500); + _caretTimer.Tick += this.CaretTimerTick; - this.canScrollHorizontally = this.GetObservable(TextWrappingProperty) + _canScrollHorizontally = this.GetObservable(TextWrappingProperty) .Select(x => x == TextWrapping.NoWrap); Observable.Merge( @@ -98,7 +95,7 @@ namespace Perspex.Controls.Presenters var charPos = this.FormattedText.HitTestTextPosition(this.CaretIndex); Brush caretBrush = Brushes.Black; - if (this.caretBlink) + if (_caretBlink) { var x = Math.Floor(charPos.X) + 0.5; var y = Math.Floor(charPos.Y) + 0.5; @@ -114,15 +111,15 @@ namespace Perspex.Controls.Presenters public void ShowCaret() { - this.caretBlink = true; - this.caretTimer.Start(); + _caretBlink = true; + _caretTimer.Start(); this.InvalidateVisual(); } public void HideCaret() { - this.caretBlink = false; - this.caretTimer.Stop(); + _caretBlink = false; + _caretTimer.Stop(); this.InvalidateVisual(); } @@ -130,9 +127,9 @@ namespace Perspex.Controls.Presenters { if (this.GetVisualParent() != null) { - this.caretBlink = true; - this.caretTimer.Stop(); - this.caretTimer.Start(); + _caretBlink = true; + _caretTimer.Stop(); + _caretTimer.Start(); this.InvalidateVisual(); var rect = this.FormattedText.HitTestTextPosition(caretIndex); @@ -182,7 +179,7 @@ namespace Perspex.Controls.Presenters private void CaretTimerTick(object sender, EventArgs e) { - this.caretBlink = !this.caretBlink; + _caretBlink = !_caretBlink; this.InvalidateVisual(); } } diff --git a/src/Perspex.Controls/Primitives/AccessText.cs b/src/Perspex.Controls/Primitives/AccessText.cs index 855d22180b..073790a0ed 100644 --- a/src/Perspex.Controls/Primitives/AccessText.cs +++ b/src/Perspex.Controls/Primitives/AccessText.cs @@ -1,16 +1,13 @@ - - - - +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. +using System; +using Perspex.Input; +using Perspex.Media; +using Perspex.Rendering; namespace Perspex.Controls.Primitives { - using System; - using Perspex.Input; - using Perspex.Media; - using Perspex.Rendering; - /// /// A text block that displays a character prefixed with an underscore as an access key. /// @@ -25,7 +22,7 @@ namespace Perspex.Controls.Primitives /// /// The access key handler for the current window. /// - private IAccessKeyHandler accessKeys; + private IAccessKeyHandler _accessKeys; /// /// Initializes static members of the class. @@ -118,11 +115,11 @@ namespace Perspex.Controls.Primitives protected override void OnAttachedToVisualTree(IRenderRoot root) { base.OnAttachedToVisualTree(root); - this.accessKeys = (root as IInputRoot)?.AccessKeyHandler; + _accessKeys = (root as IInputRoot)?.AccessKeyHandler; - if (this.accessKeys != null && this.AccessKey != 0) + if (_accessKeys != null && this.AccessKey != 0) { - this.accessKeys.Register(this.AccessKey, this); + _accessKeys.Register(this.AccessKey, this); } } @@ -134,10 +131,10 @@ namespace Perspex.Controls.Primitives { base.OnDetachedFromVisualTree(root); - if (this.accessKeys != null && this.AccessKey != 0) + if (_accessKeys != null && this.AccessKey != 0) { - this.accessKeys.Unregister(this); - this.accessKeys = null; + _accessKeys.Unregister(this); + _accessKeys = null; } } @@ -180,9 +177,9 @@ namespace Perspex.Controls.Primitives this.AccessKey = key; - if (this.accessKeys != null && this.AccessKey != 0) + if (_accessKeys != null && this.AccessKey != 0) { - this.accessKeys.Register(this.AccessKey, this); + _accessKeys.Register(this.AccessKey, this); } } } diff --git a/src/Perspex.Controls/Primitives/AdornerDecorator.cs b/src/Perspex.Controls/Primitives/AdornerDecorator.cs index cfd7c3cbcb..d369003eed 100644 --- a/src/Perspex.Controls/Primitives/AdornerDecorator.cs +++ b/src/Perspex.Controls/Primitives/AdornerDecorator.cs @@ -1,8 +1,5 @@ - - - - - +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. namespace Perspex.Controls.Primitives { diff --git a/src/Perspex.Controls/Primitives/AdornerLayer.cs b/src/Perspex.Controls/Primitives/AdornerLayer.cs index 4a6fc09084..0cec3d3650 100644 --- a/src/Perspex.Controls/Primitives/AdornerLayer.cs +++ b/src/Perspex.Controls/Primitives/AdornerLayer.cs @@ -1,26 +1,23 @@ - - - - +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. +using System; +using System.Collections.Specialized; +using System.Linq; +using Perspex.VisualTree; namespace Perspex.Controls.Primitives { - using System; - using System.Collections.Specialized; - using System.Linq; - using Perspex.VisualTree; - // TODO: Need to track position of adorned elements and move the adorner if they move. public class AdornerLayer : Panel { public static PerspexProperty AdornedElementProperty = PerspexProperty.RegisterAttached("AdornedElement"); - private static PerspexProperty AdornedElementInfoProperty = + private static PerspexProperty s_adornedElementInfoProperty = PerspexProperty.RegisterAttached("AdornedElementInfo"); - private BoundsTracker tracker = new BoundsTracker(); + private BoundsTracker _tracker = new BoundsTracker(); static AdornerLayer() { @@ -57,7 +54,7 @@ namespace Perspex.Controls.Primitives foreach (var child in this.Children) { - var info = (AdornedElementInfo)child.GetValue(AdornedElementInfoProperty); + var info = (AdornedElementInfo)child.GetValue(s_adornedElementInfoProperty); if (info != null) { @@ -102,7 +99,7 @@ namespace Perspex.Controls.Primitives private void UpdateAdornedElement(Visual adorner, Visual adorned) { - var info = adorner.GetValue(AdornedElementInfoProperty); + var info = adorner.GetValue(s_adornedElementInfoProperty); if (info != null) { @@ -110,7 +107,7 @@ namespace Perspex.Controls.Primitives if (adorned == null) { - adorner.ClearValue(AdornedElementInfoProperty); + adorner.ClearValue(s_adornedElementInfoProperty); } } @@ -119,10 +116,10 @@ namespace Perspex.Controls.Primitives if (info == null) { info = new AdornedElementInfo(); - adorner.SetValue(AdornedElementInfoProperty, info); + adorner.SetValue(s_adornedElementInfoProperty, info); } - info.Subscription = this.tracker.Track(adorned).Subscribe(x => + info.Subscription = _tracker.Track(adorned).Subscribe(x => { info.Bounds = x; this.InvalidateArrange(); diff --git a/src/Perspex.Controls/Primitives/HeaderedContentControl.cs b/src/Perspex.Controls/Primitives/HeaderedContentControl.cs index a1acfdfda0..c2592f8622 100644 --- a/src/Perspex.Controls/Primitives/HeaderedContentControl.cs +++ b/src/Perspex.Controls/Primitives/HeaderedContentControl.cs @@ -1,8 +1,5 @@ - - - - - +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. namespace Perspex.Controls.Primitives { diff --git a/src/Perspex.Controls/Primitives/HeaderedItemsControl.cs b/src/Perspex.Controls/Primitives/HeaderedItemsControl.cs index b33d1ad3f8..64bbbd798e 100644 --- a/src/Perspex.Controls/Primitives/HeaderedItemsControl.cs +++ b/src/Perspex.Controls/Primitives/HeaderedItemsControl.cs @@ -1,8 +1,5 @@ - - - - - +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. namespace Perspex.Controls.Primitives { diff --git a/src/Perspex.Controls/Primitives/IScrollInfo.cs b/src/Perspex.Controls/Primitives/IScrollInfo.cs index 2d4c101a81..59dbc085e6 100644 --- a/src/Perspex.Controls/Primitives/IScrollInfo.cs +++ b/src/Perspex.Controls/Primitives/IScrollInfo.cs @@ -1,4 +1,7 @@ -using System; +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. + +using System; using System.Collections.Generic; using System.Linq; using System.Text; @@ -6,7 +9,6 @@ using System.Threading.Tasks; namespace Perspex.Controls.Primitives { - public interface IScrollInfoBase { /// diff --git a/src/Perspex.Controls/Primitives/Popup.cs b/src/Perspex.Controls/Primitives/Popup.cs index 62937d49f7..e49cd6a213 100644 --- a/src/Perspex.Controls/Primitives/Popup.cs +++ b/src/Perspex.Controls/Primitives/Popup.cs @@ -1,17 +1,14 @@ - - - - +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. +using System; +using Perspex.Interactivity; +using Perspex.Rendering; +using Perspex.VisualTree; +using Splat; namespace Perspex.Controls.Primitives { - using System; - using Perspex.Interactivity; - using Perspex.Rendering; - using Perspex.VisualTree; - using Splat; - /// /// Displays a popup window. /// @@ -50,12 +47,12 @@ namespace Perspex.Controls.Primitives /// /// The root of the popup. /// - private PopupRoot popupRoot; + private PopupRoot _popupRoot; /// /// The top level control of the Popup's visual tree. /// - private TopLevel topLevel; + private TopLevel _topLevel; /// /// Initializes static members of the class. @@ -135,7 +132,7 @@ namespace Perspex.Controls.Primitives /// public PopupRoot PopupRoot { - get { return this.popupRoot; } + get { return _popupRoot; } } /// @@ -153,7 +150,7 @@ namespace Perspex.Controls.Primitives /// IVisual IVisualTreeHost.Root { - get { return this.popupRoot; } + get { return _popupRoot; } } /// @@ -161,9 +158,9 @@ namespace Perspex.Controls.Primitives /// public void Open() { - if (this.popupRoot == null) + if (_popupRoot == null) { - this.popupRoot = new PopupRoot(this.DependencyResolver) + _popupRoot = new PopupRoot(this.DependencyResolver) { [~PopupRoot.ContentProperty] = this[~ChildProperty], [~PopupRoot.WidthProperty] = this[~WidthProperty], @@ -174,21 +171,21 @@ namespace Perspex.Controls.Primitives [~PopupRoot.MaxHeightProperty] = this[~MaxHeightProperty], }; - ((ISetLogicalParent)this.popupRoot).SetParent(this); + ((ISetLogicalParent)_popupRoot).SetParent(this); } - this.popupRoot.SetPosition(this.GetPosition()); - this.popupRoot.AddHandler(PopupRoot.PointerPressedEvent, this.MaybeClose, RoutingStrategies.Bubble, true); + _popupRoot.SetPosition(this.GetPosition()); + _popupRoot.AddHandler(PopupRoot.PointerPressedEvent, this.MaybeClose, RoutingStrategies.Bubble, true); - if (this.topLevel != null) + if (_topLevel != null) { - this.topLevel.Deactivated += this.MaybeClose; - this.topLevel.AddHandler(TopLevel.PointerPressedEvent, this.MaybeClose, RoutingStrategies.Tunnel); + _topLevel.Deactivated += this.MaybeClose; + _topLevel.AddHandler(TopLevel.PointerPressedEvent, this.MaybeClose, RoutingStrategies.Tunnel); } this.PopupRootCreated?.Invoke(this, EventArgs.Empty); - this.popupRoot.Show(); + _popupRoot.Show(); this.IsOpen = true; this.Opened?.Invoke(this, EventArgs.Empty); } @@ -198,12 +195,12 @@ namespace Perspex.Controls.Primitives /// public void Close() { - if (this.popupRoot != null) + if (_popupRoot != null) { - this.popupRoot.PointerPressed -= this.MaybeClose; - this.topLevel.RemoveHandler(TopLevel.PointerPressedEvent, this.MaybeClose); - this.topLevel.Deactivated -= this.MaybeClose; - this.popupRoot.Hide(); + this._popupRoot.PointerPressed -= this.MaybeClose; + _topLevel.RemoveHandler(TopLevel.PointerPressedEvent, this.MaybeClose); + _topLevel.Deactivated -= this.MaybeClose; + _popupRoot.Hide(); } this.IsOpen = false; @@ -227,7 +224,7 @@ namespace Perspex.Controls.Primitives protected override void OnAttachedToVisualTree(IRenderRoot root) { base.OnAttachedToVisualTree(root); - this.topLevel = root as TopLevel; + _topLevel = root as TopLevel; } /// @@ -237,7 +234,7 @@ namespace Perspex.Controls.Primitives protected override void OnDetachedFromVisualTree(IRenderRoot root) { base.OnDetachedFromVisualTree(root); - this.topLevel = null; + _topLevel = null; } /// diff --git a/src/Perspex.Controls/Primitives/PopupRoot.cs b/src/Perspex.Controls/Primitives/PopupRoot.cs index c2bee37151..f142fcbf12 100644 --- a/src/Perspex.Controls/Primitives/PopupRoot.cs +++ b/src/Perspex.Controls/Primitives/PopupRoot.cs @@ -1,26 +1,23 @@ - - - - - +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. + +using System; +using Perspex.Collections; +using Perspex.Controls.Presenters; +using Perspex.Interactivity; +using Perspex.Media; +using Perspex.Platform; +using Perspex.VisualTree; +using Splat; namespace Perspex.Controls.Primitives { - using System; - using Collections; - using Perspex.Controls.Presenters; - using Perspex.Interactivity; - using Perspex.Media; - using Perspex.Platform; - using Perspex.VisualTree; - using Splat; - /// /// The root window of a . /// public class PopupRoot : TopLevel, IInteractive, IHostedVisualTreeRoot { - private IDisposable presenterSubscription; + private IDisposable _presenterSubscription; /// /// Initializes static members of the class. @@ -112,10 +109,10 @@ namespace Perspex.Controls.Primitives if (this.Parent.TemplatedParent != null) { - if (this.presenterSubscription != null) + if (_presenterSubscription != null) { - this.presenterSubscription.Dispose(); - this.presenterSubscription = null; + _presenterSubscription.Dispose(); + _presenterSubscription = null; } var presenter = this.Presenter; diff --git a/src/Perspex.Controls/Primitives/RangeBase.cs b/src/Perspex.Controls/Primitives/RangeBase.cs index ddea00bc80..ce282971be 100644 --- a/src/Perspex.Controls/Primitives/RangeBase.cs +++ b/src/Perspex.Controls/Primitives/RangeBase.cs @@ -1,14 +1,11 @@ - - - - +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. +using System; +using Perspex.Utilities; namespace Perspex.Controls.Primitives { - using System; - using Perspex.Utilities; - /// /// Base class for controls that display a value within a range. /// diff --git a/src/Perspex.Controls/Primitives/ScrollBar.cs b/src/Perspex.Controls/Primitives/ScrollBar.cs index 34b9ddddd4..59400e234f 100644 --- a/src/Perspex.Controls/Primitives/ScrollBar.cs +++ b/src/Perspex.Controls/Primitives/ScrollBar.cs @@ -1,15 +1,12 @@ - - - - +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. +using System; +using System.Reactive; +using System.Reactive.Linq; namespace Perspex.Controls.Primitives { - using System; - using System.Reactive; - using System.Reactive.Linq; - /// /// A scrollbar control. /// diff --git a/src/Perspex.Controls/Primitives/ScrollBarVisibility.cs b/src/Perspex.Controls/Primitives/ScrollBarVisibility.cs index 31556b1df3..715ace5df0 100644 --- a/src/Perspex.Controls/Primitives/ScrollBarVisibility.cs +++ b/src/Perspex.Controls/Primitives/ScrollBarVisibility.cs @@ -1,8 +1,5 @@ - - - - - +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. namespace Perspex.Controls.Primitives { diff --git a/src/Perspex.Controls/Primitives/ScrollInfoAdapter.cs b/src/Perspex.Controls/Primitives/ScrollInfoAdapter.cs index 0817e779f2..8ea94f6fb6 100644 --- a/src/Perspex.Controls/Primitives/ScrollInfoAdapter.cs +++ b/src/Perspex.Controls/Primitives/ScrollInfoAdapter.cs @@ -1,124 +1,126 @@ -namespace Perspex.Controls.Primitives +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. + +namespace Perspex.Controls.Primitives { public class ScrollInfoAdapter : IScrollInfo { - private readonly IScrollInfoBase nfo; + private readonly IScrollInfoBase _nfo; public ScrollInfoAdapter(IScrollInfoBase nfo) { - this.nfo = nfo; + _nfo = nfo; } public ScrollViewer ScrollOwner { - get { return this.nfo.ScrollOwner; } - set { this.nfo.ScrollOwner = value; } + get { return _nfo.ScrollOwner; } + set { _nfo.ScrollOwner = value; } } - public double ExtentWidth => (this.nfo as IHorizontalScrollInfo)?.ExtentWidth ?? 0; + public double ExtentWidth => (_nfo as IHorizontalScrollInfo)?.ExtentWidth ?? 0; - public double ViewportWidth => (this.nfo as IHorizontalScrollInfo)?.ViewportWidth ?? 0; + public double ViewportWidth => (_nfo as IHorizontalScrollInfo)?.ViewportWidth ?? 0; - public double ExtentHeight => (this.nfo as IVerticalScrollInfo)?.ExtentHeight ?? 0; + public double ExtentHeight => (_nfo as IVerticalScrollInfo)?.ExtentHeight ?? 0; - public double ViewportHeight => (this.nfo as IVerticalScrollInfo)?.ViewportHeight ?? 0; + public double ViewportHeight => (_nfo as IVerticalScrollInfo)?.ViewportHeight ?? 0; - private double horizontalOffset; + private double _horizontalOffset; public double HorizontalOffset { get { - return (this.nfo as IHorizontalScrollInfo)?.HorizontalOffset ?? this.horizontalOffset; + return (_nfo as IHorizontalScrollInfo)?.HorizontalOffset ?? _horizontalOffset; } set { - var info = (this.nfo as IHorizontalScrollInfo); + var info = (_nfo as IHorizontalScrollInfo); if (info == null) - this.horizontalOffset = value; + _horizontalOffset = value; else info.HorizontalOffset = value; } } - private double verticalOffset; + private double _verticalOffset; public double VerticalOffset { get { - return (this.nfo as IVerticalScrollInfo)?.VerticalOffset ?? this.verticalOffset; + return (_nfo as IVerticalScrollInfo)?.VerticalOffset ?? _verticalOffset; } set { - var info = (this.nfo as IVerticalScrollInfo); + var info = (_nfo as IVerticalScrollInfo); if (info == null) - this.verticalOffset = value; + _verticalOffset = value; else info.VerticalOffset = value; } } - - public void LineLeft() => (this.nfo as IHorizontalScrollInfo)?.LineLeft(); - public void LineRight() => (this.nfo as IHorizontalScrollInfo)?.LineRight(); + public void LineLeft() => (_nfo as IHorizontalScrollInfo)?.LineLeft(); + + public void LineRight() => (_nfo as IHorizontalScrollInfo)?.LineRight(); - public void MouseWheelLeft() => (this.nfo as IHorizontalScrollInfo)?.MouseWheelLeft(); + public void MouseWheelLeft() => (_nfo as IHorizontalScrollInfo)?.MouseWheelLeft(); - public void MouseWheelRight() => (this.nfo as IHorizontalScrollInfo)?.MouseWheelRight(); + public void MouseWheelRight() => (_nfo as IHorizontalScrollInfo)?.MouseWheelRight(); - public void PageLeft() => (this.nfo as IHorizontalScrollInfo)?.PageLeft(); + public void PageLeft() => (_nfo as IHorizontalScrollInfo)?.PageLeft(); - public Rect MakeVisible(Visual visual, Rect rectangle) => this.nfo.MakeVisible(visual, rectangle); + public Rect MakeVisible(Visual visual, Rect rectangle) => _nfo.MakeVisible(visual, rectangle); - public void PageRight() => (this.nfo as IHorizontalScrollInfo)?.PageRight(); + public void PageRight() => (_nfo as IHorizontalScrollInfo)?.PageRight(); - public void LineDown() => (this.nfo as IVerticalScrollInfo)?.LineDown(); + public void LineDown() => (_nfo as IVerticalScrollInfo)?.LineDown(); - public void LineUp() => (this.nfo as IVerticalScrollInfo)?.LineUp(); + public void LineUp() => (_nfo as IVerticalScrollInfo)?.LineUp(); - public void MouseWheelDown() => (this.nfo as IVerticalScrollInfo)?.MouseWheelDown(); + public void MouseWheelDown() => (_nfo as IVerticalScrollInfo)?.MouseWheelDown(); - public void MouseWheelUp() => (this.nfo as IVerticalScrollInfo)?.MouseWheelUp(); + public void MouseWheelUp() => (_nfo as IVerticalScrollInfo)?.MouseWheelUp(); - public void PageDown() => (this.nfo as IVerticalScrollInfo)?.PageDown(); + public void PageDown() => (_nfo as IVerticalScrollInfo)?.PageDown(); - public void PageUp() => (this.nfo as IVerticalScrollInfo)?.PageUp(); + public void PageUp() => (_nfo as IVerticalScrollInfo)?.PageUp(); - private bool canVerticallyScroll; + private bool _canVerticallyScroll; public bool CanVerticallyScroll { get { - return (this.nfo as IVerticalScrollInfo)?.CanVerticallyScroll ?? this.canVerticallyScroll; + return (_nfo as IVerticalScrollInfo)?.CanVerticallyScroll ?? _canVerticallyScroll; } set { - var info = (this.nfo as IVerticalScrollInfo); + var info = (_nfo as IVerticalScrollInfo); if (info == null) - this.canVerticallyScroll = value; + _canVerticallyScroll = value; else info.CanVerticallyScroll = value; } } - private bool canHorizontallyScroll; + private bool _canHorizontallyScroll; public bool CanHorizontallyScroll { get { - return (this.nfo as IHorizontalScrollInfo)?.CanHorizontallyScroll ?? this.canHorizontallyScroll; + return (_nfo as IHorizontalScrollInfo)?.CanHorizontallyScroll ?? _canHorizontallyScroll; } set { - var info = (this.nfo as IHorizontalScrollInfo); + var info = (_nfo as IHorizontalScrollInfo); if (info == null) - this.canHorizontallyScroll = value; + _canHorizontallyScroll = value; else info.CanHorizontallyScroll = value; } } - } } diff --git a/src/Perspex.Controls/Primitives/SelectingItemsControl.cs b/src/Perspex.Controls/Primitives/SelectingItemsControl.cs index 27cad43cbb..62cd26c791 100644 --- a/src/Perspex.Controls/Primitives/SelectingItemsControl.cs +++ b/src/Perspex.Controls/Primitives/SelectingItemsControl.cs @@ -1,21 +1,18 @@ - - - - - +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. + +using System; +using System.Collections; +using System.Collections.Specialized; +using System.Linq; +using Perspex.Controls.Generators; +using Perspex.Input; +using Perspex.Interactivity; +using Perspex.Styling; +using Perspex.VisualTree; namespace Perspex.Controls.Primitives { - using System; - using System.Collections; - using System.Collections.Specialized; - using System.Linq; - using Perspex.Controls.Generators; - using Perspex.Input; - using Perspex.Interactivity; - using Perspex.Styling; - using Perspex.VisualTree; - /// /// An that maintains a selection. /// diff --git a/src/Perspex.Controls/Primitives/TabStrip.cs b/src/Perspex.Controls/Primitives/TabStrip.cs index d88dedd390..8702e7c864 100644 --- a/src/Perspex.Controls/Primitives/TabStrip.cs +++ b/src/Perspex.Controls/Primitives/TabStrip.cs @@ -1,16 +1,13 @@ - - - - +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. +using System; +using System.Linq; +using System.Reactive.Linq; +using Perspex.Controls.Generators; namespace Perspex.Controls.Primitives { - using System; - using System.Linq; - using System.Reactive.Linq; - using Perspex.Controls.Generators; - public class TabStrip : SelectingItemsControl { public static readonly PerspexProperty SelectedTabProperty = diff --git a/src/Perspex.Controls/Primitives/TemplatedControl.cs b/src/Perspex.Controls/Primitives/TemplatedControl.cs index cd237d3238..53364f3a28 100644 --- a/src/Perspex.Controls/Primitives/TemplatedControl.cs +++ b/src/Perspex.Controls/Primitives/TemplatedControl.cs @@ -1,21 +1,18 @@ - - - - - +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. + +using System; +using System.Linq; +using Perspex.Controls.Presenters; +using Perspex.Controls.Templates; +using Perspex.Media; +using Perspex.Styling; +using Perspex.VisualTree; +using Serilog; +using Serilog.Core.Enrichers; namespace Perspex.Controls.Primitives { - using System; - using System.Linq; - using Perspex.Controls.Presenters; - using Perspex.Controls.Templates; - using Perspex.Media; - using Perspex.Styling; - using Perspex.VisualTree; - using Serilog; - using Serilog.Core.Enrichers; - /// /// A lookless control whose visual appearance is defined by its . /// @@ -75,9 +72,9 @@ namespace Perspex.Controls.Primitives public static readonly PerspexProperty TemplateProperty = PerspexProperty.Register("Template"); - private bool templateApplied; + private bool _templateApplied; - private ILogger templateLog; + private ILogger _templateLog; /// /// Initializes static members of the class. @@ -87,7 +84,7 @@ namespace Perspex.Controls.Primitives TemplateProperty.Changed.Subscribe(e => { var templatedControl = (TemplatedControl)e.Sender; - templatedControl.templateApplied = false; + templatedControl._templateApplied = false; templatedControl.InvalidateMeasure(); }); } @@ -97,7 +94,7 @@ namespace Perspex.Controls.Primitives /// public TemplatedControl() { - this.templateLog = Log.ForContext(new[] + _templateLog = Log.ForContext(new[] { new PropertyEnricher("Area", "Template"), new PropertyEnricher("SourceContext", this.GetType()), @@ -189,13 +186,13 @@ namespace Perspex.Controls.Primitives /// public sealed override void ApplyTemplate() { - if (!this.templateApplied) + if (!_templateApplied) { this.ClearVisualChildren(); if (this.Template != null) { - this.templateLog.Verbose("Creating control template"); + _templateLog.Verbose("Creating control template"); var child = this.Template.Build(this); @@ -213,7 +210,7 @@ namespace Perspex.Controls.Primitives this.OnTemplateApplied(); } - this.templateApplied = true; + _templateApplied = true; } } diff --git a/src/Perspex.Controls/Primitives/Thumb.cs b/src/Perspex.Controls/Primitives/Thumb.cs index 9cdadcfe96..7f3b0d9632 100644 --- a/src/Perspex.Controls/Primitives/Thumb.cs +++ b/src/Perspex.Controls/Primitives/Thumb.cs @@ -1,15 +1,12 @@ - - - - +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. +using System; +using Perspex.Input; +using Perspex.Interactivity; namespace Perspex.Controls.Primitives { - using System; - using Perspex.Input; - using Perspex.Interactivity; - public class Thumb : TemplatedControl { public static readonly RoutedEvent DragStartedEvent = @@ -21,7 +18,7 @@ namespace Perspex.Controls.Primitives public static readonly RoutedEvent DragCompletedEvent = RoutedEvent.Register("DragCompleted", RoutingStrategies.Bubble); - private Point? lastPoint; + private Point? _lastPoint; static Thumb() { @@ -62,12 +59,12 @@ namespace Perspex.Controls.Primitives protected override void OnPointerMoved(PointerEventArgs e) { - if (this.lastPoint.HasValue) + if (_lastPoint.HasValue) { var ev = new VectorEventArgs { RoutedEvent = DragDeltaEvent, - Vector = e.GetPosition(this) - this.lastPoint.Value, + Vector = e.GetPosition(this) - _lastPoint.Value, }; this.RaiseEvent(ev); @@ -77,12 +74,12 @@ namespace Perspex.Controls.Primitives protected override void OnPointerPressed(PointerPressEventArgs e) { e.Device.Capture(this); - this.lastPoint = e.GetPosition(this); + _lastPoint = e.GetPosition(this); var ev = new VectorEventArgs { RoutedEvent = DragStartedEvent, - Vector = (Vector)this.lastPoint, + Vector = (Vector)_lastPoint, }; this.RaiseEvent(ev); @@ -90,10 +87,10 @@ namespace Perspex.Controls.Primitives protected override void OnPointerReleased(PointerEventArgs e) { - if (this.lastPoint.HasValue) + if (_lastPoint.HasValue) { e.Device.Capture(null); - this.lastPoint = null; + _lastPoint = null; var ev = new VectorEventArgs { diff --git a/src/Perspex.Controls/Primitives/ToggleButton.cs b/src/Perspex.Controls/Primitives/ToggleButton.cs index dbc88052f4..5237a75cc9 100644 --- a/src/Perspex.Controls/Primitives/ToggleButton.cs +++ b/src/Perspex.Controls/Primitives/ToggleButton.cs @@ -1,14 +1,11 @@ - - - - +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. +using System; +using Perspex.Interactivity; namespace Perspex.Controls.Primitives { - using System; - using Perspex.Interactivity; - public class ToggleButton : Button { public static readonly PerspexProperty IsCheckedProperty = diff --git a/src/Perspex.Controls/Primitives/Track.cs b/src/Perspex.Controls/Primitives/Track.cs index 99ae3e1a32..642d2efa95 100644 --- a/src/Perspex.Controls/Primitives/Track.cs +++ b/src/Perspex.Controls/Primitives/Track.cs @@ -1,15 +1,12 @@ - - - - +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. +using System; +using Perspex.Input; +using Perspex.Interactivity; namespace Perspex.Controls.Primitives { - using System; - using Perspex.Input; - using Perspex.Interactivity; - public class Track : Control { public static readonly PerspexProperty MinimumProperty = diff --git a/src/Perspex.Controls/ProgressBar.cs b/src/Perspex.Controls/ProgressBar.cs index e4c6f1a94a..391e451074 100644 --- a/src/Perspex.Controls/ProgressBar.cs +++ b/src/Perspex.Controls/ProgressBar.cs @@ -1,20 +1,17 @@ - - - - +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. +using Perspex.Controls.Primitives; +using Perspex.Controls.Templates; namespace Perspex.Controls { - using Perspex.Controls.Primitives; - using Perspex.Controls.Templates; - /// /// A control used to indicate the progress of an operation. /// public class ProgressBar : RangeBase { - private Border indicator; + private Border _indicator; static ProgressBar() { @@ -24,15 +21,15 @@ namespace Perspex.Controls /// protected override void OnTemplateApplied() { - this.indicator = this.GetTemplateChild("PART_Indicator"); + _indicator = this.GetTemplateChild("PART_Indicator"); } private void ValueChanged(PerspexPropertyChangedEventArgs e) { - if (this.indicator != null) + if (_indicator != null) { double percent = this.Maximum == this.Minimum ? 1.0 : ((double)e.NewValue - this.Minimum) / (this.Maximum - this.Minimum); - this.indicator.Width = this.Bounds.Width * percent; + _indicator.Width = this.Bounds.Width * percent; } } } diff --git a/src/Perspex.Controls/Properties/AssemblyInfo.cs b/src/Perspex.Controls/Properties/AssemblyInfo.cs index 685f8211c4..479c2fc91b 100644 --- a/src/Perspex.Controls/Properties/AssemblyInfo.cs +++ b/src/Perspex.Controls/Properties/AssemblyInfo.cs @@ -1,8 +1,5 @@ - - - - - +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. using System.Reflection; using System.Runtime.CompilerServices; diff --git a/src/Perspex.Controls/RadioButton.cs b/src/Perspex.Controls/RadioButton.cs index fd3fbebc04..726b463ef6 100644 --- a/src/Perspex.Controls/RadioButton.cs +++ b/src/Perspex.Controls/RadioButton.cs @@ -1,16 +1,13 @@ - - - - +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. +using System; +using System.Linq; +using Perspex.Controls.Primitives; +using Perspex.VisualTree; namespace Perspex.Controls { - using System; - using System.Linq; - using Perspex.Controls.Primitives; - using Perspex.VisualTree; - public class RadioButton : ToggleButton { public RadioButton() diff --git a/src/Perspex.Controls/RequestBringIntoViewEventArgs.cs b/src/Perspex.Controls/RequestBringIntoViewEventArgs.cs index 4a8cd57d82..da8d49a840 100644 --- a/src/Perspex.Controls/RequestBringIntoViewEventArgs.cs +++ b/src/Perspex.Controls/RequestBringIntoViewEventArgs.cs @@ -1,13 +1,10 @@ - - - - +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. +using Perspex.Interactivity; namespace Perspex.Controls { - using Perspex.Interactivity; - public class RequestBringIntoViewEventArgs : RoutedEventArgs { public IVisual TargetObject { get; set; } diff --git a/src/Perspex.Controls/RowDefinition.cs b/src/Perspex.Controls/RowDefinition.cs index c77429d176..432836e8d9 100644 --- a/src/Perspex.Controls/RowDefinition.cs +++ b/src/Perspex.Controls/RowDefinition.cs @@ -1,8 +1,5 @@ - - - - - +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. namespace Perspex.Controls { diff --git a/src/Perspex.Controls/RowDefinitions.cs b/src/Perspex.Controls/RowDefinitions.cs index 0bdcf52690..8e97fe0369 100644 --- a/src/Perspex.Controls/RowDefinitions.cs +++ b/src/Perspex.Controls/RowDefinitions.cs @@ -1,14 +1,11 @@ - - - - +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. +using System.Linq; +using Perspex.Collections; namespace Perspex.Controls { - using System.Linq; - using Perspex.Collections; - /// /// A collection of s. /// diff --git a/src/Perspex.Controls/ScrollViewer.cs b/src/Perspex.Controls/ScrollViewer.cs index 7ecdd1e99f..1acca0762d 100644 --- a/src/Perspex.Controls/ScrollViewer.cs +++ b/src/Perspex.Controls/ScrollViewer.cs @@ -1,16 +1,13 @@ - - - - +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. +using System; +using System.Reactive.Linq; +using Perspex.Controls.Presenters; +using Perspex.Controls.Primitives; namespace Perspex.Controls { - using System; - using System.Reactive.Linq; - using Perspex.Controls.Presenters; - using Perspex.Controls.Primitives; - public class ScrollViewer : ContentControl { public static readonly PerspexProperty ExtentProperty = diff --git a/src/Perspex.Controls/Shapes/Ellipse.cs b/src/Perspex.Controls/Shapes/Ellipse.cs index 36bdad80e8..b45b818e61 100644 --- a/src/Perspex.Controls/Shapes/Ellipse.cs +++ b/src/Perspex.Controls/Shapes/Ellipse.cs @@ -1,31 +1,28 @@ - - - - +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. +using Perspex.Media; namespace Perspex.Controls.Shapes { - using Perspex.Media; - public class Ellipse : Shape { - private Geometry geometry; + private Geometry _geometry; - private Size geometrySize; + private Size _geometrySize; public override Geometry DefiningGeometry { get { - if (this.geometry == null || this.geometrySize != this.Bounds.Size) + if (_geometry == null || _geometrySize != this.Bounds.Size) { var rect = new Rect(this.Bounds.Size).Deflate(this.StrokeThickness); - this.geometry = new EllipseGeometry(rect); - this.geometrySize = this.Bounds.Size; + _geometry = new EllipseGeometry(rect); + _geometrySize = this.Bounds.Size; } - return this.geometry; + return _geometry; } } diff --git a/src/Perspex.Controls/Shapes/Path.cs b/src/Perspex.Controls/Shapes/Path.cs index 3e95e3e9e0..824e06195c 100644 --- a/src/Perspex.Controls/Shapes/Path.cs +++ b/src/Perspex.Controls/Shapes/Path.cs @@ -1,14 +1,11 @@ - - - - +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. +using System; +using Perspex.Media; namespace Perspex.Controls.Shapes { - using System; - using Perspex.Media; - public class Path : Shape { public static readonly PerspexProperty DataProperty = diff --git a/src/Perspex.Controls/Shapes/Rectangle.cs b/src/Perspex.Controls/Shapes/Rectangle.cs index 6159aad09e..0699ac06ee 100644 --- a/src/Perspex.Controls/Shapes/Rectangle.cs +++ b/src/Perspex.Controls/Shapes/Rectangle.cs @@ -1,31 +1,28 @@ - - - - +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. +using Perspex.Media; namespace Perspex.Controls.Shapes { - using Perspex.Media; - public class Rectangle : Shape { - private Geometry geometry; + private Geometry _geometry; - private Size geometrySize; + private Size _geometrySize; public override Geometry DefiningGeometry { get { - if (this.geometry == null || this.geometrySize != this.Bounds.Size) + if (_geometry == null || _geometrySize != this.Bounds.Size) { var rect = new Rect(this.Bounds.Size).Deflate(this.StrokeThickness); - this.geometry = new RectangleGeometry(rect); - this.geometrySize = this.Bounds.Size; + _geometry = new RectangleGeometry(rect); + _geometrySize = this.Bounds.Size; } - return this.geometry; + return _geometry; } } diff --git a/src/Perspex.Controls/Shapes/Shape.cs b/src/Perspex.Controls/Shapes/Shape.cs index c07aa0e70c..eef9074143 100644 --- a/src/Perspex.Controls/Shapes/Shape.cs +++ b/src/Perspex.Controls/Shapes/Shape.cs @@ -1,16 +1,13 @@ - - - - +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. +using System; +using Perspex.Collections; +using Perspex.Controls; +using Perspex.Media; namespace Perspex.Controls.Shapes { - using System; - using Perspex.Collections; - using Perspex.Controls; - using Perspex.Media; - public abstract class Shape : Control { public static readonly PerspexProperty FillProperty = @@ -28,9 +25,9 @@ namespace Perspex.Controls.Shapes public static readonly PerspexProperty StrokeThicknessProperty = PerspexProperty.Register("StrokeThickness"); - private Matrix transform = Matrix.Identity; + private Matrix _transform = Matrix.Identity; - private Geometry renderedGeometry; + private Geometry _renderedGeometry; static Shape() { @@ -56,16 +53,16 @@ namespace Perspex.Controls.Shapes { get { - if (this.renderedGeometry == null) + if (_renderedGeometry == null) { if (this.DefiningGeometry != null) { - this.renderedGeometry = this.DefiningGeometry.Clone(); - this.renderedGeometry.Transform = new MatrixTransform(this.transform); + _renderedGeometry = this.DefiningGeometry.Clone(); + _renderedGeometry.Transform = new MatrixTransform(_transform); } } - return this.renderedGeometry; + return _renderedGeometry; } } @@ -181,10 +178,10 @@ namespace Perspex.Controls.Shapes var t = translate * Matrix.CreateScale(sx, sy); - if (this.transform != t) + if (_transform != t) { - this.transform = t; - this.renderedGeometry = null; + _transform = t; + _renderedGeometry = null; } return new Size(shapeSize.Width * sx, shapeSize.Height * sy); diff --git a/src/Perspex.Controls/StackPanel.cs b/src/Perspex.Controls/StackPanel.cs index 026c852419..2f574727c3 100644 --- a/src/Perspex.Controls/StackPanel.cs +++ b/src/Perspex.Controls/StackPanel.cs @@ -1,14 +1,11 @@ - - - - +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. +using System; +using Perspex.Input; namespace Perspex.Controls { - using System; - using Perspex.Input; - /// /// Defines vertical or horizontal orientation. /// diff --git a/src/Perspex.Controls/TabControl.cs b/src/Perspex.Controls/TabControl.cs index 9810999f4e..5ed3ffcef0 100644 --- a/src/Perspex.Controls/TabControl.cs +++ b/src/Perspex.Controls/TabControl.cs @@ -1,15 +1,12 @@ - - - - +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. +using Perspex.Animation; +using Perspex.Controls.Presenters; +using Perspex.Controls.Primitives; namespace Perspex.Controls { - using Perspex.Animation; - using Perspex.Controls.Presenters; - using Perspex.Controls.Primitives; - /// /// A tab control that displays a tab strip along with the content of the selected tab. /// diff --git a/src/Perspex.Controls/TabItem.cs b/src/Perspex.Controls/TabItem.cs index c7cb186040..2929d2df84 100644 --- a/src/Perspex.Controls/TabItem.cs +++ b/src/Perspex.Controls/TabItem.cs @@ -1,14 +1,11 @@ - - - - +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. +using Perspex.Controls.Mixins; +using Perspex.Controls.Primitives; namespace Perspex.Controls { - using Mixins; - using Perspex.Controls.Primitives; - /// /// An item in a or . /// diff --git a/src/Perspex.Controls/Templates/ControlTemplate.cs b/src/Perspex.Controls/Templates/ControlTemplate.cs index 69254a879c..692059e4b2 100644 --- a/src/Perspex.Controls/Templates/ControlTemplate.cs +++ b/src/Perspex.Controls/Templates/ControlTemplate.cs @@ -1,15 +1,12 @@ - - - - +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. +using System; +using Perspex.Controls.Primitives; +using Perspex.Styling; namespace Perspex.Controls.Templates { - using System; - using Perspex.Controls.Primitives; - using Perspex.Styling; - /// /// A template for a . /// diff --git a/src/Perspex.Controls/Templates/ControlTemplate`2.cs b/src/Perspex.Controls/Templates/ControlTemplate`2.cs index fcadb0fff5..cc521a55fe 100644 --- a/src/Perspex.Controls/Templates/ControlTemplate`2.cs +++ b/src/Perspex.Controls/Templates/ControlTemplate`2.cs @@ -1,15 +1,12 @@ - - - - +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. +using System; +using Perspex.Controls.Primitives; +using Perspex.Styling; namespace Perspex.Controls.Templates { - using System; - using Perspex.Controls.Primitives; - using Styling; - /// /// A template for a . /// diff --git a/src/Perspex.Controls/Templates/DataTemplate.cs b/src/Perspex.Controls/Templates/DataTemplate.cs index 69bb84ccea..14d50941d4 100644 --- a/src/Perspex.Controls/Templates/DataTemplate.cs +++ b/src/Perspex.Controls/Templates/DataTemplate.cs @@ -1,14 +1,11 @@ - - - - +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. +using System; +using System.Reflection; namespace Perspex.Controls.Templates { - using System; - using System.Reflection; - /// /// Builds a control for a piece of data. /// @@ -23,7 +20,7 @@ namespace Perspex.Controls.Templates /// /// The implementation of the method. /// - private Func match; + private Func _match; /// /// Initializes a new instance of the class. @@ -51,7 +48,7 @@ namespace Perspex.Controls.Templates { Contract.Requires(match != null); - this.match = match; + _match = match; } /// @@ -63,7 +60,7 @@ namespace Perspex.Controls.Templates /// public bool Match(object data) { - return this.match(data); + return _match(data); } /// diff --git a/src/Perspex.Controls/Templates/DataTemplateExtensions.cs b/src/Perspex.Controls/Templates/DataTemplateExtensions.cs index 7b8520afef..3fd09024cf 100644 --- a/src/Perspex.Controls/Templates/DataTemplateExtensions.cs +++ b/src/Perspex.Controls/Templates/DataTemplateExtensions.cs @@ -1,15 +1,12 @@ - - - - +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. +using System.Linq; +using Perspex.LogicalTree; +using Splat; namespace Perspex.Controls.Templates { - using System.Linq; - using Perspex.LogicalTree; - using Splat; - /// /// Defines extension methods for working with s. /// diff --git a/src/Perspex.Controls/Templates/DataTemplate`1.cs b/src/Perspex.Controls/Templates/DataTemplate`1.cs index 56768aa34e..ba8a56b8d1 100644 --- a/src/Perspex.Controls/Templates/DataTemplate`1.cs +++ b/src/Perspex.Controls/Templates/DataTemplate`1.cs @@ -1,13 +1,10 @@ - - - - +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. +using System; namespace Perspex.Controls.Templates { - using System; - /// /// Builds a control for a piece of data of specified type. /// diff --git a/src/Perspex.Controls/Templates/DataTemplates.cs b/src/Perspex.Controls/Templates/DataTemplates.cs index 37446e6581..cc0bc24792 100644 --- a/src/Perspex.Controls/Templates/DataTemplates.cs +++ b/src/Perspex.Controls/Templates/DataTemplates.cs @@ -1,13 +1,10 @@ - - - - +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. +using Perspex.Collections; namespace Perspex.Controls.Templates { - using Perspex.Collections; - /// /// A collection of s. /// diff --git a/src/Perspex.Controls/Templates/FuncTemplate`1.cs b/src/Perspex.Controls/Templates/FuncTemplate`1.cs index 0565fd4363..5a01795809 100644 --- a/src/Perspex.Controls/Templates/FuncTemplate`1.cs +++ b/src/Perspex.Controls/Templates/FuncTemplate`1.cs @@ -1,20 +1,17 @@ - - - - +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. +using System; namespace Perspex.Controls.Templates { - using System; - /// /// Creates a control from a . /// /// The type of control. public class FuncTemplate : ITemplate where TControl : IControl { - private Func func; + private Func _func; /// /// Initializes a new instance of the class. @@ -24,7 +21,7 @@ namespace Perspex.Controls.Templates { Contract.Requires(func != null); - this.func = func; + _func = func; } /// @@ -35,7 +32,7 @@ namespace Perspex.Controls.Templates /// public TControl Build() { - return this.func(); + return _func(); } } } \ No newline at end of file diff --git a/src/Perspex.Controls/Templates/FuncTemplate`2.cs b/src/Perspex.Controls/Templates/FuncTemplate`2.cs index 5f2adfdb0b..a465e6a01e 100644 --- a/src/Perspex.Controls/Templates/FuncTemplate`2.cs +++ b/src/Perspex.Controls/Templates/FuncTemplate`2.cs @@ -1,13 +1,10 @@ - - - - +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. +using System; namespace Perspex.Controls.Templates { - using System; - /// /// Creates a control from a . /// @@ -16,7 +13,7 @@ namespace Perspex.Controls.Templates public class FuncTemplate : ITemplate where TControl : IControl { - private Func func; + private Func _func; /// /// Initializes a new instance of the class. @@ -26,7 +23,7 @@ namespace Perspex.Controls.Templates { Contract.Requires(func != null); - this.func = func; + _func = func; } /// @@ -38,7 +35,7 @@ namespace Perspex.Controls.Templates /// public TControl Build(TParam param) { - return this.func(param); + return _func(param); } } } \ No newline at end of file diff --git a/src/Perspex.Controls/Templates/IControlTemplate.cs b/src/Perspex.Controls/Templates/IControlTemplate.cs index 2c036ea5a4..4adc194f93 100644 --- a/src/Perspex.Controls/Templates/IControlTemplate.cs +++ b/src/Perspex.Controls/Templates/IControlTemplate.cs @@ -1,14 +1,11 @@ - - - - +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. +using Perspex.Controls.Primitives; +using Perspex.Styling; namespace Perspex.Controls.Templates { - using Perspex.Controls.Primitives; - using Perspex.Styling; - /// /// Interface representing a template used to build a . /// diff --git a/src/Perspex.Controls/Templates/IDataTemplate.cs b/src/Perspex.Controls/Templates/IDataTemplate.cs index 4f22110ece..c5834d4b5a 100644 --- a/src/Perspex.Controls/Templates/IDataTemplate.cs +++ b/src/Perspex.Controls/Templates/IDataTemplate.cs @@ -1,8 +1,5 @@ - - - - - +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. namespace Perspex.Controls.Templates { diff --git a/src/Perspex.Controls/Templates/ITemplate`1.cs b/src/Perspex.Controls/Templates/ITemplate`1.cs index 961339fd1f..d7fbddf006 100644 --- a/src/Perspex.Controls/Templates/ITemplate`1.cs +++ b/src/Perspex.Controls/Templates/ITemplate`1.cs @@ -1,8 +1,5 @@ - - - - - +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. namespace Perspex.Controls { diff --git a/src/Perspex.Controls/Templates/ITemplate`2.cs b/src/Perspex.Controls/Templates/ITemplate`2.cs index 680634bb09..0af2293ea9 100644 --- a/src/Perspex.Controls/Templates/ITemplate`2.cs +++ b/src/Perspex.Controls/Templates/ITemplate`2.cs @@ -1,8 +1,5 @@ - - - - - +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. namespace Perspex.Controls.Templates { diff --git a/src/Perspex.Controls/Templates/ITreeDataTemplate.cs b/src/Perspex.Controls/Templates/ITreeDataTemplate.cs index 17972d73cd..ca967f60a4 100644 --- a/src/Perspex.Controls/Templates/ITreeDataTemplate.cs +++ b/src/Perspex.Controls/Templates/ITreeDataTemplate.cs @@ -1,13 +1,10 @@ - - - - +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. +using System.Collections; namespace Perspex.Controls.Templates { - using System.Collections; - /// /// Interface representing a template used to build hierachical data. /// diff --git a/src/Perspex.Controls/Templates/TemplateExtensions.cs b/src/Perspex.Controls/Templates/TemplateExtensions.cs index 898fe3d0bb..e4e61c722f 100644 --- a/src/Perspex.Controls/Templates/TemplateExtensions.cs +++ b/src/Perspex.Controls/Templates/TemplateExtensions.cs @@ -1,18 +1,15 @@ - - - - +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. +using System; +using System.Collections.Generic; +using System.Linq; +using Perspex.Controls; +using Perspex.Styling; +using Perspex.VisualTree; namespace Perspex.Controls.Templates { - using System; - using System.Collections.Generic; - using System.Linq; - using Perspex.Controls; - using Perspex.Styling; - using Perspex.VisualTree; - public static class TemplateExtensions { public static IReparentingHost FindReparentingHost(this IControl control) diff --git a/src/Perspex.Controls/Templates/TreeDataTemplate.cs b/src/Perspex.Controls/Templates/TreeDataTemplate.cs index 99c5ec0c98..2d7312b928 100644 --- a/src/Perspex.Controls/Templates/TreeDataTemplate.cs +++ b/src/Perspex.Controls/Templates/TreeDataTemplate.cs @@ -1,23 +1,20 @@ - - - - +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. +using System; +using System.Collections; +using System.Reflection; namespace Perspex.Controls.Templates { - using System; - using System.Collections; - using System.Reflection; - /// /// A template used to build hierachical data. /// public class TreeDataTemplate : DataTemplate, ITreeDataTemplate { - private Func itemsSelector; + private Func _itemsSelector; - private Func isExpanded; + private Func _isExpanded; /// /// Initializes a new instance of the class. @@ -80,7 +77,7 @@ namespace Perspex.Controls.Templates Func itemsSelector) : this(match, build, itemsSelector, _ => false) { - this.itemsSelector = itemsSelector; + _itemsSelector = itemsSelector; } /// @@ -106,8 +103,8 @@ namespace Perspex.Controls.Templates Func isExpanded) : base(match, build) { - this.itemsSelector = itemsSelector; - this.isExpanded = isExpanded; + _itemsSelector = itemsSelector; + _isExpanded = isExpanded; } /// @@ -117,7 +114,7 @@ namespace Perspex.Controls.Templates /// True if the item should be initially expanded, otherwise false. public bool IsExpanded(object item) { - return this?.isExpanded(item) ?? false; + return this?._isExpanded(item) ?? false; } /// @@ -127,7 +124,7 @@ namespace Perspex.Controls.Templates /// The child items, or null if no child items. public IEnumerable ItemsSelector(object item) { - return this?.itemsSelector(item); + return this?._itemsSelector(item); } /// diff --git a/src/Perspex.Controls/Templates/TreeDataTemplate`1.cs b/src/Perspex.Controls/Templates/TreeDataTemplate`1.cs index a7705ece61..b8c0f3df7e 100644 --- a/src/Perspex.Controls/Templates/TreeDataTemplate`1.cs +++ b/src/Perspex.Controls/Templates/TreeDataTemplate`1.cs @@ -1,14 +1,11 @@ - - - - +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. +using System; +using System.Collections; namespace Perspex.Controls.Templates { - using System; - using System.Collections; - /// /// A template used to build hierachical data. /// diff --git a/src/Perspex.Controls/TextBlock.cs b/src/Perspex.Controls/TextBlock.cs index 877025993a..411ca77a86 100644 --- a/src/Perspex.Controls/TextBlock.cs +++ b/src/Perspex.Controls/TextBlock.cs @@ -1,16 +1,13 @@ - - - - +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. +using System; +using System.Reactive; +using System.Reactive.Linq; +using Perspex.Media; namespace Perspex.Controls { - using System; - using System.Reactive; - using System.Reactive.Linq; - using Perspex.Media; - /// /// A control that displays a block of text. /// @@ -85,12 +82,12 @@ namespace Perspex.Controls /// /// The formatted text used for rendering. /// - private FormattedText formattedText; + private FormattedText _formattedText; /// /// Stores the last constraint passed to MeasureOverride. /// - private Size constraint; + private Size _constraint; /// /// Initializes static members of the class. @@ -186,12 +183,12 @@ namespace Perspex.Controls { get { - if (this.formattedText == null) + if (_formattedText == null) { - this.formattedText = this.CreateFormattedText(this.constraint); + _formattedText = this.CreateFormattedText(_constraint); } - return this.formattedText; + return _formattedText; } } @@ -253,11 +250,11 @@ namespace Perspex.Controls /// protected void InvalidateFormattedText() { - if (this.formattedText != null) + if (_formattedText != null) { - this.constraint = this.formattedText.Constraint; - this.formattedText.Dispose(); - this.formattedText = null; + _constraint = _formattedText.Constraint; + _formattedText.Dispose(); + _formattedText = null; } this.InvalidateMeasure(); diff --git a/src/Perspex.Controls/TextBox.cs b/src/Perspex.Controls/TextBox.cs index 8a1f97ed6a..ec42109ee0 100644 --- a/src/Perspex.Controls/TextBox.cs +++ b/src/Perspex.Controls/TextBox.cs @@ -1,26 +1,22 @@ - - - - - +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. using Perspex.Input.Platform; using Splat; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Reactive.Linq; +using Perspex.Controls.Presenters; +using Perspex.Controls.Primitives; +using Perspex.Controls.Templates; +using Perspex.Controls.Utils; +using Perspex.Input; +using Perspex.Interactivity; +using Perspex.Media; namespace Perspex.Controls { - using System; - using System.Collections.Generic; - using System.Linq; - using System.Reactive.Linq; - using Perspex.Controls.Presenters; - using Perspex.Controls.Primitives; - using Perspex.Controls.Templates; - using Perspex.Controls.Utils; - using Perspex.Input; - using Perspex.Interactivity; - using Perspex.Media; - public class TextBox : TemplatedControl { public static readonly PerspexProperty AcceptsReturnProperty = @@ -44,7 +40,7 @@ namespace Perspex.Controls public static readonly PerspexProperty TextWrappingProperty = TextBlock.TextWrappingProperty.AddOwner(); - private TextPresenter presenter; + private TextPresenter _presenter; static TextBox() { @@ -114,14 +110,14 @@ namespace Perspex.Controls protected override void OnTemplateApplied() { - this.presenter = this.GetTemplateChild("textPresenter"); - this.presenter.Cursor = new Cursor(StandardCursorType.Ibeam); + _presenter = this.GetTemplateChild("textPresenter"); + _presenter.Cursor = new Cursor(StandardCursorType.Ibeam); } protected override void OnGotFocus(GotFocusEventArgs e) { base.OnGotFocus(e); - this.presenter.ShowCaret(); + _presenter.ShowCaret(); } protected override void OnLostFocus(RoutedEventArgs e) @@ -129,7 +125,7 @@ namespace Perspex.Controls base.OnLostFocus(e); this.SelectionStart = 0; this.SelectionEnd = 0; - this.presenter.HideCaret(); + _presenter.HideCaret(); } protected override void OnTextInput(TextInputEventArgs e) @@ -138,7 +134,7 @@ namespace Perspex.Controls } private void HandleTextInput(string input) - { + { string text = this.Text ?? string.Empty; int caretIndex = this.CaretIndex; if (!string.IsNullOrEmpty(input)) @@ -152,15 +148,15 @@ namespace Perspex.Controls } } - async void Copy() + private async void Copy() { - await ((IClipboard) Locator.Current.GetService(typeof (IClipboard))) + await ((IClipboard)Locator.Current.GetService(typeof(IClipboard))) .SetTextAsync(this.GetSelection()); } - async void Paste() + private async void Paste() { - var text = await ((IClipboard) Locator.Current.GetService(typeof (IClipboard))).GetTextAsync(); + var text = await ((IClipboard)Locator.Current.GetService(typeof(IClipboard))).GetTextAsync(); if (text == null) { return; @@ -286,10 +282,10 @@ namespace Perspex.Controls protected override void OnPointerPressed(PointerPressEventArgs e) { - if (e.Source == this.presenter) + if (e.Source == _presenter) { - var point = e.GetPosition(this.presenter); - var index = this.CaretIndex = this.presenter.GetCaretIndex(point); + var point = e.GetPosition(_presenter); + var index = this.CaretIndex = _presenter.GetCaretIndex(point); var text = this.Text; switch (e.ClickCount) @@ -311,23 +307,23 @@ namespace Perspex.Controls break; } - e.Device.Capture(this.presenter); + e.Device.Capture(_presenter); e.Handled = true; } } protected override void OnPointerMoved(PointerEventArgs e) { - if (e.Device.Captured == this.presenter) + if (e.Device.Captured == _presenter) { - var point = e.GetPosition(this.presenter); - this.CaretIndex = this.SelectionEnd = this.presenter.GetCaretIndex(point); + var point = e.GetPosition(_presenter); + this.CaretIndex = this.SelectionEnd = _presenter.GetCaretIndex(point); } } protected override void OnPointerReleased(PointerEventArgs e) { - if (e.Device.Captured == this.presenter) + if (e.Device.Captured == _presenter) { e.Device.Capture(null); } @@ -362,7 +358,7 @@ namespace Perspex.Controls private void MoveVertical(int count, ModifierKeys modifiers) { - var formattedText = this.presenter.FormattedText; + var formattedText = _presenter.FormattedText; var lines = formattedText.GetLines().ToList(); var caretIndex = this.CaretIndex; var lineIndex = this.GetLine(caretIndex, lines) + count; @@ -389,7 +385,7 @@ namespace Perspex.Controls } else { - var lines = this.presenter.FormattedText.GetLines(); + var lines = _presenter.FormattedText.GetLines(); var pos = 0; foreach (var line in lines) @@ -419,7 +415,7 @@ namespace Perspex.Controls } else { - var lines = this.presenter.FormattedText.GetLines(); + var lines = _presenter.FormattedText.GetLines(); var pos = 0; foreach (var line in lines) @@ -479,7 +475,7 @@ namespace Perspex.Controls { return ""; } - return this.Text.Substring(start, end - start); + return this.Text.Substring(start, end - start); } private int GetLine(int caretIndex, IList lines) diff --git a/src/Perspex.Controls/TextWrapping.cs b/src/Perspex.Controls/TextWrapping.cs index b5abf47c6f..268f069327 100644 --- a/src/Perspex.Controls/TextWrapping.cs +++ b/src/Perspex.Controls/TextWrapping.cs @@ -1,8 +1,5 @@ - - - - - +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. namespace Perspex.Controls { diff --git a/src/Perspex.Controls/ToolTip.cs b/src/Perspex.Controls/ToolTip.cs index 24c1f96863..a65d2c58e3 100644 --- a/src/Perspex.Controls/ToolTip.cs +++ b/src/Perspex.Controls/ToolTip.cs @@ -1,18 +1,15 @@ - - - - +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. +using System; +using System.Reactive.Linq; +using System.Reactive.Subjects; +using Perspex.Controls.Primitives; +using Perspex.Input; +using Perspex.Threading; namespace Perspex.Controls { - using System; - using System.Reactive.Linq; - using System.Reactive.Subjects; - using Perspex.Controls.Primitives; - using Perspex.Input; - using Perspex.Threading; - /// /// A tooltip control. /// @@ -33,19 +30,19 @@ namespace Perspex.Controls /// /// The popup window used to display the active tooltip. /// - private static PopupRoot popup; + private static PopupRoot s_popup; /// /// The control that the currently visible tooltip is attached to. /// - private static Control current; + private static Control s_current; /// /// Observable fired when a tooltip should be displayed for a control. The output from this /// observable is throttled and calls when the time /// period expires. /// - private static Subject show = new Subject(); + private static Subject s_show = new Subject(); /// /// Initializes static members of the class. @@ -53,7 +50,7 @@ namespace Perspex.Controls static ToolTip() { TipProperty.Changed.Subscribe(TipChanged); - show.Throttle(TimeSpan.FromSeconds(0.5), PerspexScheduler.Instance).Subscribe(ShowToolTip); + s_show.Throttle(TimeSpan.FromSeconds(0.5), PerspexScheduler.Instance).Subscribe(ShowToolTip); } /// @@ -107,24 +104,24 @@ namespace Perspex.Controls { if (control != null) { - if (popup == null) + if (s_popup == null) { - popup = new PopupRoot + s_popup = new PopupRoot { Content = new ToolTip(), }; - ((ISetLogicalParent)popup).SetParent(control); + ((ISetLogicalParent)s_popup).SetParent(control); } var cp = MouseDevice.Instance?.GetPosition(control); var position = control.PointToScreen(cp.HasValue ? cp.Value : new Point(0, 0)) + new Vector(0, 22); - ((ToolTip)popup.Content).Content = GetTip(control); - popup.SetPosition(position); - popup.Show(); + ((ToolTip)s_popup.Content).Content = GetTip(control); + s_popup.SetPosition(position); + s_popup.Show(); - current = control; + s_current = control; } } @@ -135,8 +132,8 @@ namespace Perspex.Controls /// The event args. private static void ControlPointerEnter(object sender, PointerEventArgs e) { - current = (Control)sender; - show.OnNext(current); + s_current = (Control)sender; + s_show.OnNext(s_current); } /// @@ -148,14 +145,14 @@ namespace Perspex.Controls { var control = (Control)sender; - if (control == current) + if (control == s_current) { - if (popup != null && popup.IsVisible) + if (s_popup != null && s_popup.IsVisible) { - popup.Hide(); + s_popup.Hide(); } - show.OnNext(null); + s_show.OnNext(null); } } } diff --git a/src/Perspex.Controls/TopLevel.cs b/src/Perspex.Controls/TopLevel.cs index 330d24038e..ca71c59e8b 100644 --- a/src/Perspex.Controls/TopLevel.cs +++ b/src/Perspex.Controls/TopLevel.cs @@ -1,24 +1,21 @@ - - - - - +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. + +using System; +using System.Reactive.Disposables; +using System.Reactive.Linq; +using Perspex.Controls.Primitives; +using Perspex.Input; +using Perspex.Input.Raw; +using Perspex.Layout; +using Perspex.Platform; +using Perspex.Rendering; +using Perspex.Styling; +using Perspex.Threading; +using Splat; 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; - using Perspex.Platform; - using Perspex.Rendering; - using Perspex.Styling; - using Perspex.Threading; - using Splat; - /// /// Base class for top-level windows. /// @@ -50,32 +47,32 @@ namespace Perspex.Controls /// /// The dispatcher for the window. /// - private Dispatcher dispatcher; + private Dispatcher _dispatcher; /// /// The render manager for the window.s /// - private IRenderManager renderManager; + private IRenderManager _renderManager; /// /// The window renderer. /// - private IRenderer renderer; + private IRenderer _renderer; /// /// The input manager for the window. /// - private IInputManager inputManager; + private IInputManager _inputManager; /// /// The access key handler for the window. /// - private IAccessKeyHandler accessKeyHandler; + private IAccessKeyHandler _accessKeyHandler; /// /// The access keyboard navigation handler for the window. /// - private IKeyboardNavigationHandler keyboardNavigationHandler; + private IKeyboardNavigationHandler _keyboardNavigationHandler; /// /// Initializes static members of the class. @@ -114,11 +111,11 @@ namespace Perspex.Controls dependencyResolver = dependencyResolver ?? Locator.Current; var renderInterface = TryGetService(dependencyResolver); var styler = TryGetService(dependencyResolver); - this.accessKeyHandler = TryGetService(dependencyResolver); - this.inputManager = TryGetService(dependencyResolver); - this.keyboardNavigationHandler = TryGetService(dependencyResolver); + _accessKeyHandler = TryGetService(dependencyResolver); + _inputManager = TryGetService(dependencyResolver); + _keyboardNavigationHandler = TryGetService(dependencyResolver); this.LayoutManager = TryGetService(dependencyResolver); - this.renderManager = TryGetService(dependencyResolver); + _renderManager = TryGetService(dependencyResolver); this.PlatformImpl.SetOwner(this); this.PlatformImpl.Activated = this.HandleActivated; @@ -130,11 +127,11 @@ namespace Perspex.Controls Size clientSize = this.ClientSize = this.PlatformImpl.ClientSize; - this.dispatcher = Dispatcher.UIThread; + _dispatcher = Dispatcher.UIThread; if (renderInterface != null) { - this.renderer = renderInterface.CreateRenderer(this.PlatformImpl.Handle, clientSize.Width, clientSize.Height); + _renderer = renderInterface.CreateRenderer(this.PlatformImpl.Handle, clientSize.Width, clientSize.Height); } if (this.LayoutManager != null) @@ -144,19 +141,19 @@ namespace Perspex.Controls this.LayoutManager.LayoutCompleted.Subscribe(_ => this.HandleLayoutCompleted()); } - if (this.renderManager != null) + if (_renderManager != null) { - this.renderManager.RenderNeeded.Subscribe(_ => this.HandleRenderNeeded()); + _renderManager.RenderNeeded.Subscribe(_ => this.HandleRenderNeeded()); } - if (this.keyboardNavigationHandler != null) + if (_keyboardNavigationHandler != null) { - this.keyboardNavigationHandler.SetOwner(this); + _keyboardNavigationHandler.SetOwner(this); } - if (this.accessKeyHandler != null) + if (_accessKeyHandler != null) { - this.accessKeyHandler.SetOwner(this); + _accessKeyHandler.SetOwner(this); } styler?.ApplyStyles(this); @@ -223,7 +220,7 @@ namespace Perspex.Controls /// IRenderer IRenderRoot.Renderer { - get { return this.renderer; } + get { return _renderer; } } /// @@ -231,7 +228,7 @@ namespace Perspex.Controls /// IRenderManager IRenderRoot.RenderManager { - get { return this.renderManager; } + get { return _renderManager; } } /// @@ -239,7 +236,7 @@ namespace Perspex.Controls /// IAccessKeyHandler IInputRoot.AccessKeyHandler { - get { return this.accessKeyHandler; } + get { return _accessKeyHandler; } } /// @@ -247,7 +244,7 @@ namespace Perspex.Controls /// IKeyboardNavigationHandler IInputRoot.KeyboardNavigationHandler { - get { return this.keyboardNavigationHandler; } + get { return _keyboardNavigationHandler; } } /// @@ -338,7 +335,7 @@ namespace Perspex.Controls } this.ClientSize = clientSize; - this.renderer.Resize((int)clientSize.Width, (int)clientSize.Height); + _renderer.Resize((int)clientSize.Width, (int)clientSize.Height); this.LayoutManager.ExecuteLayoutPass(); this.PlatformImpl.Invalidate(new Rect(clientSize)); } @@ -414,7 +411,7 @@ namespace Perspex.Controls /// The event args. private void HandleInput(RawInputEventArgs e) { - this.inputManager.Process(e); + _inputManager.Process(e); } /// @@ -422,7 +419,7 @@ namespace Perspex.Controls /// private void HandleLayoutNeeded() { - this.dispatcher.InvokeAsync(this.LayoutManager.ExecuteLayoutPass, DispatcherPriority.Render); + _dispatcher.InvokeAsync(this.LayoutManager.ExecuteLayoutPass, DispatcherPriority.Render); } /// @@ -430,7 +427,7 @@ namespace Perspex.Controls /// private void HandleLayoutCompleted() { - this.renderManager?.InvalidateRender(this); + _renderManager?.InvalidateRender(this); } /// @@ -438,7 +435,7 @@ namespace Perspex.Controls /// private void HandleRenderNeeded() { - this.dispatcher.InvokeAsync( + _dispatcher.InvokeAsync( () => this.PlatformImpl.Invalidate(new Rect(this.ClientSize)), DispatcherPriority.Render); } @@ -450,8 +447,8 @@ namespace Perspex.Controls /// An optional platform-specific handle. private void HandlePaint(Rect rect, IPlatformHandle handle) { - this.renderer.Render(this, handle); - this.renderManager.RenderFinished(); + _renderer.Render(this, handle); + _renderManager.RenderFinished(); } } } diff --git a/src/Perspex.Controls/TreeView.cs b/src/Perspex.Controls/TreeView.cs index 36c1ba5585..9539fb5810 100644 --- a/src/Perspex.Controls/TreeView.cs +++ b/src/Perspex.Controls/TreeView.cs @@ -1,19 +1,16 @@ - - - - +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. +using System; +using System.Collections; +using System.Collections.Generic; +using System.Linq; +using Perspex.Controls.Generators; +using Perspex.Input; +using Perspex.VisualTree; namespace Perspex.Controls { - using System; - using System.Collections; - using System.Collections.Generic; - using System.Linq; - using Perspex.Controls.Generators; - using Perspex.Input; - using Perspex.VisualTree; - public class TreeView : ItemsControl { public static readonly PerspexProperty SelectedItemProperty = diff --git a/src/Perspex.Controls/TreeViewItem.cs b/src/Perspex.Controls/TreeViewItem.cs index 71780e1937..5fc6b6de72 100644 --- a/src/Perspex.Controls/TreeViewItem.cs +++ b/src/Perspex.Controls/TreeViewItem.cs @@ -1,21 +1,18 @@ - - - - - +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. + +using System; +using System.Linq; +using Perspex.Controls.Mixins; +using Perspex.Controls.Generators; +using Perspex.Controls.Primitives; +using Perspex.Controls.Templates; +using Perspex.Input; +using Perspex.Rendering; +using Perspex.VisualTree; namespace Perspex.Controls { - using System; - using System.Linq; - using Mixins; - using Perspex.Controls.Generators; - using Perspex.Controls.Primitives; - using Perspex.Controls.Templates; - using Perspex.Input; - using Perspex.Rendering; - using Perspex.VisualTree; - /// /// An item in a . /// @@ -33,13 +30,13 @@ namespace Perspex.Controls public static readonly PerspexProperty IsSelectedProperty = ListBoxItem.IsSelectedProperty.AddOwner(); - private static readonly ITemplate DefaultPanel = + private static readonly ITemplate s_defaultPanel = new FuncTemplate(() => new StackPanel { [KeyboardNavigation.DirectionalNavigationProperty] = KeyboardNavigationMode.Continue, }); - private TreeView treeView; + private TreeView _treeView; /// /// Initializes static members of the class. @@ -48,7 +45,7 @@ namespace Perspex.Controls { SelectableMixin.Attach(IsSelectedProperty); FocusableProperty.OverrideDefaultValue(true); - ItemsPanelProperty.OverrideDefaultValue(DefaultPanel); + ItemsPanelProperty.OverrideDefaultValue(s_defaultPanel); } /// @@ -72,14 +69,14 @@ namespace Perspex.Controls /// protected override IItemContainerGenerator CreateItemContainerGenerator() { - if (this.treeView == null) + if (_treeView == null) { throw new InvalidOperationException( "Cannot get the ItemContainerGenerator for a TreeViewItem " + "before it is added to a TreeView."); } - return this.treeView.ItemContainerGenerator; + return _treeView.ItemContainerGenerator; } /// @@ -89,16 +86,16 @@ namespace Perspex.Controls if (this.GetVisualParent() != null) { - this.treeView = this.GetVisualAncestors().OfType().FirstOrDefault(); + _treeView = this.GetVisualAncestors().OfType().FirstOrDefault(); - if (this.treeView == null) + if (_treeView == null) { throw new InvalidOperationException("TreeViewItems must be added to a TreeView."); } } else { - this.treeView = null; + _treeView = null; } } diff --git a/src/Perspex.Controls/UserControl.cs b/src/Perspex.Controls/UserControl.cs index a230339494..21e2280a6d 100644 --- a/src/Perspex.Controls/UserControl.cs +++ b/src/Perspex.Controls/UserControl.cs @@ -1,14 +1,11 @@ - - - - +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. +using System; +using Perspex.Styling; namespace Perspex.Controls { - using System; - using Perspex.Styling; - public class UserControl : ContentControl, IStyleable { Type IStyleable.StyleKey diff --git a/src/Perspex.Controls/Utils/IEnumerableUtils.cs b/src/Perspex.Controls/Utils/IEnumerableUtils.cs index f2a010734f..5039b73bb9 100644 --- a/src/Perspex.Controls/Utils/IEnumerableUtils.cs +++ b/src/Perspex.Controls/Utils/IEnumerableUtils.cs @@ -1,16 +1,13 @@ - - - - +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. +using System; +using System.Collections; +using System.Globalization; +using System.Linq; namespace Perspex.Controls.Utils { - using System; - using System.Collections; - using System.Globalization; - using System.Linq; - internal static class IEnumerableUtils { public static bool Contains(this IEnumerable items, object item) diff --git a/src/Perspex.Controls/Utils/StringUtils.cs b/src/Perspex.Controls/Utils/StringUtils.cs index fb400895b5..6c69085874 100644 --- a/src/Perspex.Controls/Utils/StringUtils.cs +++ b/src/Perspex.Controls/Utils/StringUtils.cs @@ -1,13 +1,10 @@ - - - - +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. +using System.Globalization; namespace Perspex.Controls.Utils { - using System.Globalization; - internal static class StringUtils { private enum CharClass diff --git a/src/Perspex.Controls/Window.cs b/src/Perspex.Controls/Window.cs index 40a6a48588..daee64a6fa 100644 --- a/src/Perspex.Controls/Window.cs +++ b/src/Perspex.Controls/Window.cs @@ -1,20 +1,17 @@ - - - - - +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. + +using System; +using System.Reactive.Linq; +using System.Threading.Tasks; +using Perspex.Input; +using Perspex.Media; +using Perspex.Platform; +using Perspex.Styling; +using Splat; namespace Perspex.Controls { - using System; - using System.Reactive.Linq; - using System.Threading.Tasks; - using Perspex.Input; - using Perspex.Media; - using Perspex.Platform; - using Perspex.Styling; - using Splat; - /// /// Determines how a will size itself to fit its content. /// @@ -58,7 +55,7 @@ namespace Perspex.Controls public static readonly PerspexProperty TitleProperty = PerspexProperty.Register(nameof(Title), "Window"); - private object dialogResult; + private object _dialogResult; /// /// Initializes static members of the class. @@ -123,12 +120,12 @@ namespace Perspex.Controls /// The dialog result. /// /// When the window is shown with the method, the - /// resulting task will produce the value when the window + /// resulting task will produce the value when the window /// is closed. /// public void Close(object dialogResult) { - this.dialogResult = dialogResult; + _dialogResult = dialogResult; this.Close(); } @@ -190,7 +187,7 @@ namespace Perspex.Controls .Subscribe(_ => { modal.Dispose(); - result.SetResult((TResult)this.dialogResult); + result.SetResult((TResult)_dialogResult); }); return result.Task; diff --git a/src/Perspex.Diagnostics/Debug.cs b/src/Perspex.Diagnostics/Debug.cs index 45ded95575..d5362c3257 100644 --- a/src/Perspex.Diagnostics/Debug.cs +++ b/src/Perspex.Diagnostics/Debug.cs @@ -1,18 +1,15 @@ - - - - +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Perspex.Controls; namespace Perspex.Diagnostics { - using System; - using System.Collections.Generic; - using System.Linq; - using System.Text; - using System.Threading.Tasks; - using Perspex.Controls; - public static class Debug { public static string PrintVisualTree(IVisual visual) diff --git a/src/Perspex.Diagnostics/DevTools.cs b/src/Perspex.Diagnostics/DevTools.cs index 22edb26426..d92c53d79c 100644 --- a/src/Perspex.Diagnostics/DevTools.cs +++ b/src/Perspex.Diagnostics/DevTools.cs @@ -1,29 +1,26 @@ - - - - +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. +using System; +using System.Reactive.Linq; +using Perspex.Controls; +using Perspex.Diagnostics.ViewModels; +using Perspex.Input; +using ReactiveUI; namespace Perspex.Diagnostics { - using System; - using System.Reactive.Linq; - using Perspex.Controls; - using Perspex.Diagnostics.ViewModels; - using Perspex.Input; - using ReactiveUI; - public class DevTools : Decorator { public static readonly PerspexProperty RootProperty = PerspexProperty.Register("Root"); - private DevToolsViewModel viewModel; + private DevToolsViewModel _viewModel; public DevTools() { - this.viewModel = new DevToolsViewModel(); - this.GetObservable(RootProperty).Subscribe(x => this.viewModel.Root = x); + _viewModel = new DevToolsViewModel(); + this.GetObservable(RootProperty).Subscribe(x => _viewModel.Root = x); this.InitializeComponent(); } @@ -67,7 +64,7 @@ namespace Perspex.Diagnostics this.Child = new Grid { RowDefinitions = new RowDefinitions("*,Auto"), - Children = new Controls + Children = new Perspex.Controls.Controls { new TabControl { @@ -76,12 +73,12 @@ namespace Perspex.Diagnostics new TabItem { Header = "Logical Tree", - [!TabItem.ContentProperty] = this.viewModel.WhenAnyValue(x => x.LogicalTree), + [!TabItem.ContentProperty] = _viewModel.WhenAnyValue(x => x.LogicalTree), }, new TabItem { Header = "Visual Tree", - [!TabItem.ContentProperty] = this.viewModel.WhenAnyValue(x => x.VisualTree), + [!TabItem.ContentProperty] = _viewModel.WhenAnyValue(x => x.VisualTree), } }, }, @@ -90,7 +87,7 @@ namespace Perspex.Diagnostics Orientation = Orientation.Horizontal, Gap = 4, [Grid.RowProperty] = 1, - Children = new Controls + Children = new Perspex.Controls.Controls { new TextBlock { @@ -98,7 +95,7 @@ namespace Perspex.Diagnostics }, new TextBlock { - [!TextBlock.TextProperty] = this.viewModel + [!TextBlock.TextProperty] = _viewModel .WhenAnyValue(x => x.FocusedControl) .Select(x => x?.GetType().Name ?? "(null)") }, @@ -108,7 +105,7 @@ namespace Perspex.Diagnostics }, new TextBlock { - [!TextBlock.TextProperty] = this.viewModel + [!TextBlock.TextProperty] = _viewModel .WhenAnyValue(x => x.PointerOverElement) .Select(x => x?.GetType().Name ?? "(null)") } diff --git a/src/Perspex.Diagnostics/LogManager.cs b/src/Perspex.Diagnostics/LogManager.cs index 3032c2aa2e..642b26d504 100644 --- a/src/Perspex.Diagnostics/LogManager.cs +++ b/src/Perspex.Diagnostics/LogManager.cs @@ -1,29 +1,26 @@ - - - - +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. +using System; +using Perspex.Layout; +using Splat; namespace Perspex.Diagnostics { - using System; - using Perspex.Layout; - using Splat; - public class LogManager : ILogManager { - private static LogManager instance; + private static LogManager s_instance; public static LogManager Instance { get { - if (instance == null) + if (s_instance == null) { - instance = new LogManager(); + s_instance = new LogManager(); } - return instance; + return s_instance; } } diff --git a/src/Perspex.Diagnostics/Properties/AssemblyInfo.cs b/src/Perspex.Diagnostics/Properties/AssemblyInfo.cs index 2f39014fcf..97bfb22b25 100644 --- a/src/Perspex.Diagnostics/Properties/AssemblyInfo.cs +++ b/src/Perspex.Diagnostics/Properties/AssemblyInfo.cs @@ -1,8 +1,5 @@ - - - - - +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. using System.Reflection; diff --git a/src/Perspex.Diagnostics/ViewLocator.cs b/src/Perspex.Diagnostics/ViewLocator.cs index 8fa507c1d5..618d944f62 100644 --- a/src/Perspex.Diagnostics/ViewLocator.cs +++ b/src/Perspex.Diagnostics/ViewLocator.cs @@ -1,15 +1,12 @@ - - - - +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. +using System; +using Perspex.Controls; +using Perspex.Controls.Templates; namespace Perspex.Diagnostics { - using System; - using Perspex.Controls; - using Perspex.Controls.Templates; - internal class ViewLocator : IDataTemplate { public IControl Build(object data) diff --git a/src/Perspex.Diagnostics/ViewModels/ControlDetailsViewModel.cs b/src/Perspex.Diagnostics/ViewModels/ControlDetailsViewModel.cs index d80bb3a828..07e013c1a7 100644 --- a/src/Perspex.Diagnostics/ViewModels/ControlDetailsViewModel.cs +++ b/src/Perspex.Diagnostics/ViewModels/ControlDetailsViewModel.cs @@ -1,16 +1,13 @@ - - - - +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. +using System.Collections.Generic; +using System.Linq; +using Perspex.Controls; +using ReactiveUI; namespace Perspex.Diagnostics.ViewModels { - using System.Collections.Generic; - using System.Linq; - using Perspex.Controls; - using ReactiveUI; - internal class ControlDetailsViewModel : ReactiveObject { public ControlDetailsViewModel(Control control) diff --git a/src/Perspex.Diagnostics/ViewModels/DevToolsViewModel.cs b/src/Perspex.Diagnostics/ViewModels/DevToolsViewModel.cs index 8365d6cfbd..fcbc488781 100644 --- a/src/Perspex.Diagnostics/ViewModels/DevToolsViewModel.cs +++ b/src/Perspex.Diagnostics/ViewModels/DevToolsViewModel.cs @@ -1,42 +1,39 @@ - - - - +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. +using System; +using System.Reactive.Linq; +using Perspex.Controls; +using Perspex.Input; +using ReactiveUI; namespace Perspex.Diagnostics.ViewModels { - using System; - using System.Reactive.Linq; - using Perspex.Controls; - using Perspex.Input; - using ReactiveUI; - internal class DevToolsViewModel : ReactiveObject { - private Control root; + private Control _root; - private LogicalTreeViewModel logicalTree; + private LogicalTreeViewModel _logicalTree; - private VisualTreeViewModel visualTree; + private VisualTreeViewModel _visualTree; - private ObservableAsPropertyHelper focusedControl; + private ObservableAsPropertyHelper _focusedControl; - private ObservableAsPropertyHelper pointerOverElement; + private ObservableAsPropertyHelper _pointerOverElement; public DevToolsViewModel() { this.WhenAnyValue(x => x.Root).Subscribe(x => { - this.LogicalTree = new LogicalTreeViewModel(this.root); - this.VisualTree = new VisualTreeViewModel(this.root); + this.LogicalTree = new LogicalTreeViewModel(_root); + this.VisualTree = new VisualTreeViewModel(_root); }); - this.focusedControl = KeyboardDevice.Instance + _focusedControl = KeyboardDevice.Instance .WhenAnyValue(x => x.FocusedElement) .ToProperty(this, x => x.FocusedControl); - this.pointerOverElement = this.WhenAnyValue(x => x.Root, x => x as TopLevel) + _pointerOverElement = this.WhenAnyValue(x => x.Root, x => x as TopLevel) .Select(x => x?.GetObservable(TopLevel.PointerOverElementProperty) ?? Observable.Empty()) .Switch() .ToProperty(this, x => x.PointerOverElement); @@ -44,30 +41,30 @@ namespace Perspex.Diagnostics.ViewModels public Control Root { - get { return this.root; } - set { this.RaiseAndSetIfChanged(ref this.root, value); } + get { return _root; } + set { this.RaiseAndSetIfChanged(ref _root, value); } } public LogicalTreeViewModel LogicalTree { - get { return this.logicalTree; } - private set { this.RaiseAndSetIfChanged(ref this.logicalTree, value); } + get { return _logicalTree; } + private set { this.RaiseAndSetIfChanged(ref _logicalTree, value); } } public VisualTreeViewModel VisualTree { - get { return this.visualTree; } - private set { this.RaiseAndSetIfChanged(ref this.visualTree, value); } + get { return _visualTree; } + private set { this.RaiseAndSetIfChanged(ref _visualTree, value); } } public IInputElement FocusedControl { - get { return this.focusedControl.Value; } + get { return _focusedControl.Value; } } public IInputElement PointerOverElement { - get { return this.pointerOverElement.Value; } + get { return _pointerOverElement.Value; } } } } diff --git a/src/Perspex.Diagnostics/ViewModels/LogicalTreeNode.cs b/src/Perspex.Diagnostics/ViewModels/LogicalTreeNode.cs index ba22bd44f2..f2500e803e 100644 --- a/src/Perspex.Diagnostics/ViewModels/LogicalTreeNode.cs +++ b/src/Perspex.Diagnostics/ViewModels/LogicalTreeNode.cs @@ -1,15 +1,12 @@ - - - - +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. +using System; +using Perspex.Controls; +using ReactiveUI; namespace Perspex.Diagnostics.ViewModels { - using System; - using Perspex.Controls; - using ReactiveUI; - internal class LogicalTreeNode : TreeNode { public LogicalTreeNode(ILogical logical) diff --git a/src/Perspex.Diagnostics/ViewModels/LogicalTreeViewModel.cs b/src/Perspex.Diagnostics/ViewModels/LogicalTreeViewModel.cs index 63ce479605..375d1148ec 100644 --- a/src/Perspex.Diagnostics/ViewModels/LogicalTreeViewModel.cs +++ b/src/Perspex.Diagnostics/ViewModels/LogicalTreeViewModel.cs @@ -1,25 +1,22 @@ - - - - +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. +using System.Reactive.Linq; +using Perspex.Controls; +using ReactiveUI; namespace Perspex.Diagnostics.ViewModels { - using System.Reactive.Linq; - using Perspex.Controls; - using ReactiveUI; - internal class LogicalTreeViewModel : ReactiveObject { - private LogicalTreeNode selected; + private LogicalTreeNode _selected; - private ObservableAsPropertyHelper details; + private ObservableAsPropertyHelper _details; public LogicalTreeViewModel(Control root) { this.Nodes = LogicalTreeNode.Create(root); - this.details = this.WhenAnyValue(x => x.SelectedNode) + _details = this.WhenAnyValue(x => x.SelectedNode) .Select(x => x != null ? new ControlDetailsViewModel(x.Control) : null) .ToProperty(this, x => x.Details); } @@ -28,13 +25,13 @@ namespace Perspex.Diagnostics.ViewModels public LogicalTreeNode SelectedNode { - get { return this.selected; } - set { this.RaiseAndSetIfChanged(ref this.selected, value); } + get { return _selected; } + set { this.RaiseAndSetIfChanged(ref _selected, value); } } public ControlDetailsViewModel Details { - get { return this.details.Value; } + get { return _details.Value; } } } } diff --git a/src/Perspex.Diagnostics/ViewModels/PropertyDetails.cs b/src/Perspex.Diagnostics/ViewModels/PropertyDetails.cs index e38c7b9358..f90da20f9d 100644 --- a/src/Perspex.Diagnostics/ViewModels/PropertyDetails.cs +++ b/src/Perspex.Diagnostics/ViewModels/PropertyDetails.cs @@ -1,21 +1,18 @@ - - - - +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. +using System; +using ReactiveUI; namespace Perspex.Diagnostics.ViewModels { - using System; - using ReactiveUI; - internal class PropertyDetails : ReactiveObject { - private object value; + private object _value; - private string priority; + private string _priority; - private string diagnostic; + private string _diagnostic; public PropertyDetails(PerspexObject o, PerspexProperty property) { @@ -42,20 +39,20 @@ namespace Perspex.Diagnostics.ViewModels public string Priority { - get { return this.priority; } - private set { this.RaiseAndSetIfChanged(ref this.priority, value); } + get { return _priority; } + private set { this.RaiseAndSetIfChanged(ref _priority, value); } } public string Diagnostic { - get { return this.diagnostic; } - private set { this.RaiseAndSetIfChanged(ref this.diagnostic, value); } + get { return _diagnostic; } + private set { this.RaiseAndSetIfChanged(ref _diagnostic, value); } } public object Value { - get { return this.value; } - private set { this.RaiseAndSetIfChanged(ref this.value, value); } + get { return _value; } + private set { this.RaiseAndSetIfChanged(ref _value, value); } } } } diff --git a/src/Perspex.Diagnostics/ViewModels/TreeNode.cs b/src/Perspex.Diagnostics/ViewModels/TreeNode.cs index 32034c87c3..bbacb1650f 100644 --- a/src/Perspex.Diagnostics/ViewModels/TreeNode.cs +++ b/src/Perspex.Diagnostics/ViewModels/TreeNode.cs @@ -1,20 +1,17 @@ - - - - +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. +using System; +using System.Reactive; +using System.Reactive.Linq; +using Perspex.Controls; +using ReactiveUI; namespace Perspex.Diagnostics.ViewModels { - using System; - using System.Reactive; - using System.Reactive.Linq; - using Perspex.Controls; - using ReactiveUI; - internal class TreeNode : ReactiveObject { - private string classes; + private string _classes; public TreeNode(Control control) { @@ -44,8 +41,8 @@ namespace Perspex.Diagnostics.ViewModels public string Classes { - get { return this.classes; } - private set { this.RaiseAndSetIfChanged(ref this.classes, value); } + get { return _classes; } + private set { this.RaiseAndSetIfChanged(ref _classes, value); } } public string Type diff --git a/src/Perspex.Diagnostics/ViewModels/VisualTreeNode.cs b/src/Perspex.Diagnostics/ViewModels/VisualTreeNode.cs index efa0f94709..222130961c 100644 --- a/src/Perspex.Diagnostics/ViewModels/VisualTreeNode.cs +++ b/src/Perspex.Diagnostics/ViewModels/VisualTreeNode.cs @@ -1,15 +1,12 @@ - - - - +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. +using Perspex.Controls; +using Perspex.VisualTree; +using ReactiveUI; namespace Perspex.Diagnostics.ViewModels { - using Perspex.Controls; - using Perspex.VisualTree; - using ReactiveUI; - internal class VisualTreeNode : TreeNode { public VisualTreeNode(IVisual visual) diff --git a/src/Perspex.Diagnostics/ViewModels/VisualTreeViewModel.cs b/src/Perspex.Diagnostics/ViewModels/VisualTreeViewModel.cs index 678974f91b..68d4f83ba1 100644 --- a/src/Perspex.Diagnostics/ViewModels/VisualTreeViewModel.cs +++ b/src/Perspex.Diagnostics/ViewModels/VisualTreeViewModel.cs @@ -1,25 +1,22 @@ - - - - +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. +using System.Reactive.Linq; +using Perspex.Controls; +using ReactiveUI; namespace Perspex.Diagnostics.ViewModels { - using System.Reactive.Linq; - using Perspex.Controls; - using ReactiveUI; - internal class VisualTreeViewModel : ReactiveObject { - private VisualTreeNode selected; + private VisualTreeNode _selected; - private ObservableAsPropertyHelper details; + private ObservableAsPropertyHelper _details; public VisualTreeViewModel(Control root) { this.Nodes = VisualTreeNode.Create(root); - this.details = this.WhenAnyValue(x => x.SelectedNode) + _details = this.WhenAnyValue(x => x.SelectedNode) .Select(x => x != null ? new ControlDetailsViewModel(x.Control) : null) .ToProperty(this, x => x.Details); } @@ -28,13 +25,13 @@ namespace Perspex.Diagnostics.ViewModels public VisualTreeNode SelectedNode { - get { return this.selected; } - set { this.RaiseAndSetIfChanged(ref this.selected, value); } + get { return _selected; } + set { this.RaiseAndSetIfChanged(ref _selected, value); } } public ControlDetailsViewModel Details { - get { return this.details.Value; } + get { return _details.Value; } } } } diff --git a/src/Perspex.Diagnostics/Views/ControlDetailsView.cs b/src/Perspex.Diagnostics/Views/ControlDetailsView.cs index 8b29ed2cf1..159863bd88 100644 --- a/src/Perspex.Diagnostics/Views/ControlDetailsView.cs +++ b/src/Perspex.Diagnostics/Views/ControlDetailsView.cs @@ -1,22 +1,19 @@ - - - - +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. +using System; +using System.Collections.Generic; +using System.Reactive.Linq; +using Perspex.Controls; +using Perspex.Diagnostics.ViewModels; +using Perspex.Styling; +using ReactiveUI; 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; - internal class ControlDetailsView : UserControl { - private static readonly PerspexProperty ViewModelProperty = + private static readonly PerspexProperty s_viewModelProperty = PerspexProperty.Register("ViewModel"); public ControlDetailsView() @@ -28,8 +25,8 @@ namespace Perspex.Diagnostics.Views public ControlDetailsViewModel ViewModel { - get { return this.GetValue(ViewModelProperty); } - private set { this.SetValue(ViewModelProperty, value); } + get { return this.GetValue(s_viewModelProperty); } + private set { this.SetValue(s_viewModelProperty, value); } } private void InitializeComponent() diff --git a/src/Perspex.Diagnostics/Views/GridRepeater.cs b/src/Perspex.Diagnostics/Views/GridRepeater.cs index f9a7331e9e..1189f11455 100644 --- a/src/Perspex.Diagnostics/Views/GridRepeater.cs +++ b/src/Perspex.Diagnostics/Views/GridRepeater.cs @@ -1,16 +1,13 @@ - - - - +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. +using System; +using System.Collections; +using System.Collections.Generic; +using Perspex.Controls; namespace Perspex.Diagnostics.Views { - using System; - using System.Collections; - using System.Collections.Generic; - using Perspex.Controls; - internal static class GridRepeater { public static readonly PerspexProperty ItemsProperty = diff --git a/src/Perspex.Diagnostics/Views/LogicalTreeView.cs b/src/Perspex.Diagnostics/Views/LogicalTreeView.cs index 6574cadb71..1fba60735e 100644 --- a/src/Perspex.Diagnostics/Views/LogicalTreeView.cs +++ b/src/Perspex.Diagnostics/Views/LogicalTreeView.cs @@ -1,21 +1,20 @@ - - - - +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. +using System; +using System.Reactive.Linq; +using Perspex.Controls; +using Perspex.Controls.Templates; +using Perspex.Diagnostics.ViewModels; +using ReactiveUI; namespace Perspex.Diagnostics.Views { - using System; - using System.Reactive.Linq; - using Perspex.Controls; - using Perspex.Controls.Templates; - using Perspex.Diagnostics.ViewModels; - using ReactiveUI; + using Controls = Perspex.Controls.Controls; internal class LogicalTreeView : TreePage { - private static readonly PerspexProperty ViewModelProperty = + private static readonly PerspexProperty s_viewModelProperty = PerspexProperty.Register("ViewModel"); public LogicalTreeView() @@ -27,8 +26,8 @@ namespace Perspex.Diagnostics.Views public LogicalTreeViewModel ViewModel { - get { return this.GetValue(ViewModelProperty); } - private set { this.SetValue(ViewModelProperty, value); } + get { return this.GetValue(s_viewModelProperty); } + private set { this.SetValue(s_viewModelProperty, value); } } private void InitializeComponent() diff --git a/src/Perspex.Diagnostics/Views/TreePage.cs b/src/Perspex.Diagnostics/Views/TreePage.cs index 242816b156..996e404907 100644 --- a/src/Perspex.Diagnostics/Views/TreePage.cs +++ b/src/Perspex.Diagnostics/Views/TreePage.cs @@ -1,21 +1,18 @@ - - - - +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. +using Perspex.Controls; +using Perspex.Controls.Primitives; +using Perspex.Controls.Shapes; +using Perspex.Diagnostics.ViewModels; +using Perspex.Input; +using Perspex.Media; namespace Perspex.Diagnostics.Views { - using Perspex.Controls; - using Perspex.Controls.Primitives; - using Perspex.Controls.Shapes; - using Perspex.Diagnostics.ViewModels; - using Perspex.Input; - using Perspex.Media; - internal class TreePage : UserControl { - private Control adorner; + private Control _adorner; protected void AddAdorner(object sender, PointerEventArgs e) { @@ -24,22 +21,22 @@ namespace Perspex.Diagnostics.Views if (layer != null) { - this.adorner = new Rectangle + _adorner = new Rectangle { Fill = new SolidColorBrush(0x80a0c5e8), [AdornerLayer.AdornedElementProperty] = node.Control, }; - layer.Children.Add(this.adorner); + layer.Children.Add(_adorner); } } protected void RemoveAdorner(object sender, PointerEventArgs e) { - if (this.adorner != null) + if (_adorner != null) { - ((Panel)this.adorner.Parent).Children.Remove(this.adorner); - this.adorner = null; + ((Panel)_adorner.Parent).Children.Remove(_adorner); + _adorner = null; } } } diff --git a/src/Perspex.Diagnostics/Views/VisualTreeView.cs b/src/Perspex.Diagnostics/Views/VisualTreeView.cs index bdae4a397d..09e9fea987 100644 --- a/src/Perspex.Diagnostics/Views/VisualTreeView.cs +++ b/src/Perspex.Diagnostics/Views/VisualTreeView.cs @@ -1,22 +1,21 @@ - - - - +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. +using System; +using System.Reactive.Linq; +using Perspex.Controls; +using Perspex.Controls.Templates; +using Perspex.Diagnostics.ViewModels; +using Perspex.Media; +using ReactiveUI; namespace Perspex.Diagnostics.Views { - using System; - using System.Reactive.Linq; - using Perspex.Controls; - using Perspex.Controls.Templates; - using Perspex.Diagnostics.ViewModels; - using Perspex.Media; - using ReactiveUI; + using Controls = Perspex.Controls.Controls; internal class VisualTreeView : TreePage { - private static readonly PerspexProperty ViewModelProperty = + private static readonly PerspexProperty s_viewModelProperty = PerspexProperty.Register("ViewModel"); public VisualTreeView() @@ -28,8 +27,8 @@ namespace Perspex.Diagnostics.Views public VisualTreeViewModel ViewModel { - get { return this.GetValue(ViewModelProperty); } - private set { this.SetValue(ViewModelProperty, value); } + get { return this.GetValue(s_viewModelProperty); } + private set { this.SetValue(s_viewModelProperty, value); } } private void InitializeComponent() diff --git a/src/Perspex.Input/AccessKeyHandler.cs b/src/Perspex.Input/AccessKeyHandler.cs index 1ab083451f..d4963de9fc 100644 --- a/src/Perspex.Input/AccessKeyHandler.cs +++ b/src/Perspex.Input/AccessKeyHandler.cs @@ -1,17 +1,14 @@ - - - - +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. +using System; +using System.Collections.Generic; +using System.Linq; +using Perspex.Interactivity; +using Perspex.VisualTree; namespace Perspex.Input { - using System; - using System.Collections.Generic; - using System.Linq; - using Perspex.Interactivity; - using Perspex.VisualTree; - /// /// Handles access keys for a window. /// @@ -29,22 +26,22 @@ namespace Perspex.Input /// /// The registered access keys. /// - private List> registered = new List>(); + private List> _registered = new List>(); /// /// The window to which the handler belongs. /// - private IInputRoot owner; + private IInputRoot _owner; /// /// Whether access keys are currently being shown; /// - private bool showingAccessKeys; + private bool _showingAccessKeys; /// /// Whether to ignore the Alt KeyUp event. /// - private bool ignoreAltUp; + private bool _ignoreAltUp; /// /// Gets or sets the window's main menu. @@ -62,17 +59,17 @@ namespace Perspex.Input { Contract.Requires(owner != null); - if (this.owner != null) + if (_owner != null) { throw new InvalidOperationException("AccessKeyHandler owner has already been set."); } - this.owner = owner; + _owner = owner; - this.owner.AddHandler(InputElement.KeyDownEvent, this.OnPreviewKeyDown, RoutingStrategies.Tunnel); - this.owner.AddHandler(InputElement.KeyDownEvent, this.OnKeyDown, RoutingStrategies.Bubble); - this.owner.AddHandler(InputElement.KeyUpEvent, this.OnPreviewKeyUp, RoutingStrategies.Tunnel); - this.owner.AddHandler(InputElement.PointerPressedEvent, this.OnPreviewPointerPressed, RoutingStrategies.Tunnel); + _owner.AddHandler(InputElement.KeyDownEvent, this.OnPreviewKeyDown, RoutingStrategies.Tunnel); + _owner.AddHandler(InputElement.KeyDownEvent, this.OnKeyDown, RoutingStrategies.Bubble); + _owner.AddHandler(InputElement.KeyUpEvent, this.OnPreviewKeyUp, RoutingStrategies.Tunnel); + _owner.AddHandler(InputElement.PointerPressedEvent, this.OnPreviewPointerPressed, RoutingStrategies.Tunnel); } /// @@ -82,14 +79,14 @@ namespace Perspex.Input /// The input element. public void Register(char accessKey, IInputElement element) { - var existing = this.registered.FirstOrDefault(x => x.Item2 == element); + var existing = _registered.FirstOrDefault(x => x.Item2 == element); if (existing != null) { - this.registered.Remove(existing); + _registered.Remove(existing); } - this.registered.Add(Tuple.Create(accessKey.ToString().ToUpper(), element)); + _registered.Add(Tuple.Create(accessKey.ToString().ToUpper(), element)); } /// @@ -98,9 +95,9 @@ namespace Perspex.Input /// The input element. public void Unregister(IInputElement element) { - foreach (var i in this.registered.Where(x => x.Item2 == element).ToList()) + foreach (var i in _registered.Where(x => x.Item2 == element).ToList()) { - this.registered.Remove(i); + _registered.Remove(i); } } @@ -117,13 +114,13 @@ namespace Perspex.Input { // When Alt is pressed without a main menu, or with a closed main menu, show // access key markers in the window (i.e. "_File"). - this.owner.ShowAccessKeys = this.showingAccessKeys = true; + _owner.ShowAccessKeys = _showingAccessKeys = true; } else { // If the Alt key is pressed and the main menu is open, close the main menu. this.CloseMenu(); - this.ignoreAltUp = true; + _ignoreAltUp = true; } // We always handle the Alt key. @@ -151,7 +148,7 @@ namespace Perspex.Input // If any other key is pressed with the Alt key held down, or the main menu is open, // find all controls who have registered that access key. var text = e.Key.ToString().ToUpper(); - var matches = this.registered + var matches = _registered .Where(x => x.Item1 == text && x.Item2.IsEffectivelyVisible) .Select(x => x.Item2); @@ -182,11 +179,11 @@ namespace Perspex.Input switch (e.Key) { case Key.LeftAlt: - if (this.ignoreAltUp) + if (_ignoreAltUp) { - this.ignoreAltUp = false; + _ignoreAltUp = false; } - else if (this.showingAccessKeys && this.MainMenu != null) + else if (_showingAccessKeys && this.MainMenu != null) { this.MainMenu.Open(); e.Handled = true; @@ -195,7 +192,7 @@ namespace Perspex.Input break; case Key.F10: - this.owner.ShowAccessKeys = this.showingAccessKeys = true; + _owner.ShowAccessKeys = _showingAccessKeys = true; this.MainMenu.Open(); e.Handled = true; break; @@ -209,9 +206,9 @@ namespace Perspex.Input /// The event args. protected virtual void OnPreviewPointerPressed(object sender, PointerEventArgs e) { - if (this.showingAccessKeys) + if (_showingAccessKeys) { - this.owner.ShowAccessKeys = false; + _owner.ShowAccessKeys = false; } } @@ -221,7 +218,7 @@ namespace Perspex.Input private void CloseMenu() { this.MainMenu.Close(); - this.owner.ShowAccessKeys = this.showingAccessKeys = false; + _owner.ShowAccessKeys = _showingAccessKeys = false; } } } diff --git a/src/Perspex.Input/Cursors.cs b/src/Perspex.Input/Cursors.cs index 2262317aaa..1275f44512 100644 --- a/src/Perspex.Input/Cursors.cs +++ b/src/Perspex.Input/Cursors.cs @@ -1,13 +1,16 @@ -namespace Perspex.Input +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. + +using Splat; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Perspex.Platform; + +namespace Perspex.Input { - using Splat; - using System; - using System.Collections.Generic; - using System.Linq; - using System.Text; - using System.Threading.Tasks; - using Perspex.Platform; - /* ========================================================================================= NOTE: Cursors are NOT disposable and are cached in platform implementation. @@ -34,7 +37,6 @@ // We might enable them later, preferably, by loading pixmax direclty from theme with fallback image // SizeNorthWestSouthEast, // SizeNorthEastSouthWest, - } public class Cursor @@ -48,7 +50,7 @@ public Cursor(StandardCursorType cursorType) : this( - ((IStandardCursorFactory) Locator.Current.GetService(typeof(IStandardCursorFactory))).GetCursor( + ((IStandardCursorFactory)Locator.Current.GetService(typeof(IStandardCursorFactory))).GetCursor( cursorType)) { } diff --git a/src/Perspex.Input/FocusManager.cs b/src/Perspex.Input/FocusManager.cs index a3f9d5598d..7300a9b358 100644 --- a/src/Perspex.Input/FocusManager.cs +++ b/src/Perspex.Input/FocusManager.cs @@ -1,18 +1,15 @@ - - - - +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. +using System; +using System.Collections.Generic; +using System.Linq; +using Perspex.Interactivity; +using Perspex.VisualTree; +using Splat; namespace Perspex.Input { - using System; - using System.Collections.Generic; - using System.Linq; - using Perspex.Interactivity; - using Perspex.VisualTree; - using Splat; - /// /// Manages focus for the application. /// @@ -21,7 +18,7 @@ namespace Perspex.Input /// /// The focus scopes in which the focus is currently defined. /// - private Dictionary focusScopes = + private Dictionary _focusScopes = new Dictionary(); /// @@ -85,7 +82,7 @@ namespace Perspex.Input { IInputElement element; - if (this.focusScopes.TryGetValue(scope, out element)) + if (_focusScopes.TryGetValue(scope, out element)) { this.Focus(element, method); break; @@ -111,7 +108,7 @@ namespace Perspex.Input { Contract.Requires(scope != null); - this.focusScopes[scope] = element; + _focusScopes[scope] = element; if (this.Scope == scope) { @@ -129,13 +126,13 @@ namespace Perspex.Input IInputElement e; - if (!this.focusScopes.TryGetValue(scope, out e)) + if (!_focusScopes.TryGetValue(scope, out e)) { // TODO: Make this do something useful, i.e. select the first focusable // control, select a control that the user has specified to have default // focus etc. e = scope as IInputElement; - this.focusScopes.Add(scope, e); + _focusScopes.Add(scope, e); } this.Scope = scope; diff --git a/src/Perspex.Input/FocusNavigationDirection.cs b/src/Perspex.Input/FocusNavigationDirection.cs index 291bddb4c2..f4f98b9ec5 100644 --- a/src/Perspex.Input/FocusNavigationDirection.cs +++ b/src/Perspex.Input/FocusNavigationDirection.cs @@ -1,8 +1,5 @@ - - - - - +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. namespace Perspex.Input { diff --git a/src/Perspex.Input/GotFocusEventArgs.cs b/src/Perspex.Input/GotFocusEventArgs.cs index 8e9ec825d8..492ea75074 100644 --- a/src/Perspex.Input/GotFocusEventArgs.cs +++ b/src/Perspex.Input/GotFocusEventArgs.cs @@ -1,13 +1,10 @@ - - - - +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. +using Perspex.Interactivity; namespace Perspex.Input { - using Perspex.Interactivity; - /// /// Holds arguments for a . /// diff --git a/src/Perspex.Input/IAccessKeyHandler.cs b/src/Perspex.Input/IAccessKeyHandler.cs index 177b5cf613..061b217426 100644 --- a/src/Perspex.Input/IAccessKeyHandler.cs +++ b/src/Perspex.Input/IAccessKeyHandler.cs @@ -1,8 +1,5 @@ - - - - - +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. namespace Perspex.Input { diff --git a/src/Perspex.Input/ICloseable.cs b/src/Perspex.Input/ICloseable.cs index bcc4535de8..4ea2e3249d 100644 --- a/src/Perspex.Input/ICloseable.cs +++ b/src/Perspex.Input/ICloseable.cs @@ -1,13 +1,10 @@ - - - - +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. +using System; namespace Perspex.Input { - using System; - public interface ICloseable { event EventHandler Closed; diff --git a/src/Perspex.Input/IFocusManager.cs b/src/Perspex.Input/IFocusManager.cs index f60daba9ec..c813c82338 100644 --- a/src/Perspex.Input/IFocusManager.cs +++ b/src/Perspex.Input/IFocusManager.cs @@ -1,8 +1,5 @@ - - - - - +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. namespace Perspex.Input { diff --git a/src/Perspex.Input/IFocusScope.cs b/src/Perspex.Input/IFocusScope.cs index 8578083cd5..e6f2c847b2 100644 --- a/src/Perspex.Input/IFocusScope.cs +++ b/src/Perspex.Input/IFocusScope.cs @@ -1,8 +1,5 @@ - - - - - +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. namespace Perspex.Input { diff --git a/src/Perspex.Input/IInputDevice.cs b/src/Perspex.Input/IInputDevice.cs index b5d747295e..5116043dec 100644 --- a/src/Perspex.Input/IInputDevice.cs +++ b/src/Perspex.Input/IInputDevice.cs @@ -1,8 +1,5 @@ - - - - - +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. namespace Perspex.Input { diff --git a/src/Perspex.Input/IInputElement.cs b/src/Perspex.Input/IInputElement.cs index 3f5e0d9dd6..c2ae73e3c5 100644 --- a/src/Perspex.Input/IInputElement.cs +++ b/src/Perspex.Input/IInputElement.cs @@ -1,16 +1,12 @@ - - - - - +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. using System.Diagnostics.Contracts; +using System; +using Perspex.Interactivity; namespace Perspex.Input { - using System; - using Perspex.Interactivity; - /// /// Defines input-related functionality for a control. /// diff --git a/src/Perspex.Input/IInputManager.cs b/src/Perspex.Input/IInputManager.cs index e0fcbede39..4f61f8f756 100644 --- a/src/Perspex.Input/IInputManager.cs +++ b/src/Perspex.Input/IInputManager.cs @@ -1,15 +1,12 @@ - - - - +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. +using System; +using Perspex.Input.Raw; +using Perspex.Layout; namespace Perspex.Input { - using System; - using Perspex.Input.Raw; - using Perspex.Layout; - public interface IInputManager { IObservable RawEventReceived { get; } diff --git a/src/Perspex.Input/IInputRoot.cs b/src/Perspex.Input/IInputRoot.cs index d03622d6f2..631e23b78e 100644 --- a/src/Perspex.Input/IInputRoot.cs +++ b/src/Perspex.Input/IInputRoot.cs @@ -1,8 +1,5 @@ - - - - - +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. namespace Perspex.Input { diff --git a/src/Perspex.Input/IKeyboardDevice.cs b/src/Perspex.Input/IKeyboardDevice.cs index 03956b57b4..40c790e270 100644 --- a/src/Perspex.Input/IKeyboardDevice.cs +++ b/src/Perspex.Input/IKeyboardDevice.cs @@ -1,13 +1,10 @@ - - - - +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. +using System; namespace Perspex.Input { - using System; - [Flags] public enum ModifierKeys { @@ -29,7 +26,7 @@ namespace Perspex.Input public interface IKeyboardDevice : IInputDevice { IInputElement FocusedElement { get; } - + void SetFocusedElement(IInputElement element, NavigationMethod method); } } diff --git a/src/Perspex.Input/IKeyboardNavigationHandler.cs b/src/Perspex.Input/IKeyboardNavigationHandler.cs index f971c096e4..fd79e941b6 100644 --- a/src/Perspex.Input/IKeyboardNavigationHandler.cs +++ b/src/Perspex.Input/IKeyboardNavigationHandler.cs @@ -1,8 +1,5 @@ - - - - - +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. namespace Perspex.Input { diff --git a/src/Perspex.Input/IMainMenu.cs b/src/Perspex.Input/IMainMenu.cs index e45a535912..afe954c78a 100644 --- a/src/Perspex.Input/IMainMenu.cs +++ b/src/Perspex.Input/IMainMenu.cs @@ -1,8 +1,5 @@ - - - - - +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. namespace Perspex.Input { diff --git a/src/Perspex.Input/IMouseDevice.cs b/src/Perspex.Input/IMouseDevice.cs index 2036b15c45..9b5a7281b3 100644 --- a/src/Perspex.Input/IMouseDevice.cs +++ b/src/Perspex.Input/IMouseDevice.cs @@ -1,8 +1,5 @@ - - - - - +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. namespace Perspex.Input { diff --git a/src/Perspex.Input/INavigableContainer.cs b/src/Perspex.Input/INavigableContainer.cs index 1d9c5dcca1..7e65dd1d44 100644 --- a/src/Perspex.Input/INavigableContainer.cs +++ b/src/Perspex.Input/INavigableContainer.cs @@ -1,8 +1,5 @@ - - - - - +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. namespace Perspex.Input { diff --git a/src/Perspex.Input/IPointerDevice.cs b/src/Perspex.Input/IPointerDevice.cs index 45cd942419..8af791b745 100644 --- a/src/Perspex.Input/IPointerDevice.cs +++ b/src/Perspex.Input/IPointerDevice.cs @@ -1,14 +1,11 @@ - - - - +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. +using System; +using Perspex.Interactivity; namespace Perspex.Input { - using System; - using Perspex.Interactivity; - public interface IPointerDevice : IInputDevice { IInputElement Captured { get; } diff --git a/src/Perspex.Input/InputElement.cs b/src/Perspex.Input/InputElement.cs index 2af2f723dc..b1c196ab98 100644 --- a/src/Perspex.Input/InputElement.cs +++ b/src/Perspex.Input/InputElement.cs @@ -1,17 +1,14 @@ - - - - +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. +using System; +using System.Linq; +using Perspex.Interactivity; +using Perspex.Rendering; +using Perspex.VisualTree; namespace Perspex.Input { - using System; - using System.Linq; - using Perspex.Interactivity; - using Perspex.Rendering; - using Perspex.VisualTree; - /// /// Implements input-related functionality for a control. /// diff --git a/src/Perspex.Input/InputExtensions.cs b/src/Perspex.Input/InputExtensions.cs index f9fc0c923d..f53ecc5524 100644 --- a/src/Perspex.Input/InputExtensions.cs +++ b/src/Perspex.Input/InputExtensions.cs @@ -1,15 +1,12 @@ - - - - +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. +using System; +using System.Collections.Generic; +using System.Linq; namespace Perspex.Input { - using System; - using System.Collections.Generic; - using System.Linq; - public static class InputExtensions { public static IEnumerable GetInputElementsAt(this IInputElement element, Point p) diff --git a/src/Perspex.Input/InputManager.cs b/src/Perspex.Input/InputManager.cs index 1a5aa9a3f2..21fbd6e4cb 100644 --- a/src/Perspex.Input/InputManager.cs +++ b/src/Perspex.Input/InputManager.cs @@ -1,34 +1,31 @@ - - - - +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. +using System; +using System.Collections.Generic; +using System.Linq; +using System.Reactive.Subjects; +using Perspex.Input.Raw; +using Splat; namespace Perspex.Input { - using System; - using System.Collections.Generic; - using System.Linq; - using System.Reactive.Subjects; - using Perspex.Input.Raw; - using Splat; - public class InputManager : IInputManager { - private Subject rawEventReceived = new Subject(); + private Subject _rawEventReceived = new Subject(); - private Subject postProcess = new Subject(); + private Subject _postProcess = new Subject(); public static IInputManager Instance => Locator.Current.GetService(); - public IObservable RawEventReceived => this.rawEventReceived; + public IObservable RawEventReceived => _rawEventReceived; - public IObservable PostProcess => this.postProcess; + public IObservable PostProcess => _postProcess; public void Process(RawInputEventArgs e) { - this.rawEventReceived.OnNext(e); - this.postProcess.OnNext(e); + _rawEventReceived.OnNext(e); + _postProcess.OnNext(e); } } } diff --git a/src/Perspex.Input/Key.cs b/src/Perspex.Input/Key.cs index 315927f18d..88abaf8294 100644 --- a/src/Perspex.Input/Key.cs +++ b/src/Perspex.Input/Key.cs @@ -1,8 +1,5 @@ - - - - - +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. namespace Perspex.Input { diff --git a/src/Perspex.Input/KeyEventArgs.cs b/src/Perspex.Input/KeyEventArgs.cs index 4ddea5d9ca..54f420a71c 100644 --- a/src/Perspex.Input/KeyEventArgs.cs +++ b/src/Perspex.Input/KeyEventArgs.cs @@ -1,14 +1,11 @@ - - - - +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. +using System; +using Perspex.Interactivity; namespace Perspex.Input { - using System; - using Perspex.Interactivity; - public class KeyEventArgs : RoutedEventArgs { public IKeyboardDevice Device { get; set; } diff --git a/src/Perspex.Input/KeyboardDevice.cs b/src/Perspex.Input/KeyboardDevice.cs index 6cc022ae4d..93b945c665 100644 --- a/src/Perspex.Input/KeyboardDevice.cs +++ b/src/Perspex.Input/KeyboardDevice.cs @@ -1,23 +1,20 @@ - - - - - +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. + +using System; +using System.ComponentModel; +using System.Linq; +using System.Reactive.Linq; +using System.Runtime.CompilerServices; +using Perspex.Input.Raw; +using Perspex.Interactivity; +using Splat; namespace Perspex.Input { - using System; - using System.ComponentModel; - using System.Linq; - using System.Reactive.Linq; - using System.Runtime.CompilerServices; - using Perspex.Input.Raw; - using Perspex.Interactivity; - using Splat; - public abstract class KeyboardDevice : IKeyboardDevice, INotifyPropertyChanged { - private IInputElement focusedElement; + private IInputElement _focusedElement; public KeyboardDevice() { @@ -48,16 +45,16 @@ namespace Perspex.Input { get { - return this.focusedElement; + return _focusedElement; } private set { - this.focusedElement = value; + _focusedElement = value; this.RaisePropertyChanged(); } } - + public void SetFocusedElement(IInputElement element, NavigationMethod method) { if (element != this.FocusedElement) diff --git a/src/Perspex.Input/KeyboardNavigation.cs b/src/Perspex.Input/KeyboardNavigation.cs index 86d81a720a..a0c84a8cba 100644 --- a/src/Perspex.Input/KeyboardNavigation.cs +++ b/src/Perspex.Input/KeyboardNavigation.cs @@ -1,8 +1,5 @@ - - - - - +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. namespace Perspex.Input { diff --git a/src/Perspex.Input/KeyboardNavigationHandler.cs b/src/Perspex.Input/KeyboardNavigationHandler.cs index 52b1c2a104..72690ecf9b 100644 --- a/src/Perspex.Input/KeyboardNavigationHandler.cs +++ b/src/Perspex.Input/KeyboardNavigationHandler.cs @@ -1,14 +1,11 @@ - - - - +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. +using System; +using Perspex.Input.Navigation; namespace Perspex.Input { - using System; - using Perspex.Input.Navigation; - /// /// Handles keyboard navigation for a window. /// @@ -17,7 +14,7 @@ namespace Perspex.Input /// /// The window to which the handler belongs. /// - private IInputRoot owner; + private IInputRoot _owner; /// /// Sets the owner of the keyboard navigation handler. @@ -30,14 +27,14 @@ namespace Perspex.Input { Contract.Requires(owner != null); - if (this.owner != null) + if (_owner != null) { throw new InvalidOperationException("AccessKeyHandler owner has already been set."); } - this.owner = owner; + _owner = owner; - this.owner.AddHandler(InputElement.KeyDownEvent, this.OnKeyDown); + _owner.AddHandler(InputElement.KeyDownEvent, this.OnKeyDown); } /// diff --git a/src/Perspex.Input/KeyboardNavigationMode.cs b/src/Perspex.Input/KeyboardNavigationMode.cs index 52b3667e11..7a66d18aaf 100644 --- a/src/Perspex.Input/KeyboardNavigationMode.cs +++ b/src/Perspex.Input/KeyboardNavigationMode.cs @@ -1,8 +1,5 @@ - - - - - +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. namespace Perspex.Input { diff --git a/src/Perspex.Input/MouseDevice.cs b/src/Perspex.Input/MouseDevice.cs index 3aff530e31..2d8544b12d 100644 --- a/src/Perspex.Input/MouseDevice.cs +++ b/src/Perspex.Input/MouseDevice.cs @@ -1,30 +1,27 @@ - - - - - +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. + +using System; +using System.Collections.Generic; +using System.Linq; +using System.Reactive.Linq; +using Perspex.Input.Raw; +using Perspex.Interactivity; +using Perspex.Platform; +using Perspex.VisualTree; +using Splat; namespace Perspex.Input { - using System; - using System.Collections.Generic; - using System.Linq; - using System.Reactive.Linq; - using Perspex.Input.Raw; - using Perspex.Interactivity; - using Perspex.Platform; - using Perspex.VisualTree; - using Splat; - public abstract class MouseDevice : IMouseDevice { - private int clickCount; + private int _clickCount; - private Rect lastClickRect; + private Rect _lastClickRect; - private uint lastClickTime; + private uint _lastClickTime; - private List pointerOvers = new List(); + private List _pointerOvers = new List(); public MouseDevice() { @@ -119,14 +116,14 @@ namespace Perspex.Input var settings = Locator.Current.GetService(); var doubleClickTime = settings.DoubleClickTime.TotalMilliseconds; - if (!this.lastClickRect.Contains(p) || timestamp - this.lastClickTime > doubleClickTime) + if (!_lastClickRect.Contains(p) || timestamp - _lastClickTime > doubleClickTime) { - this.clickCount = 0; + _clickCount = 0; } - ++this.clickCount; - this.lastClickTime = timestamp; - this.lastClickRect = new Rect(p, new Size()) + ++_clickCount; + _lastClickTime = timestamp; + _lastClickRect = new Rect(p, new Size()) .Inflate(new Thickness(settings.DoubleClickSize.Width / 2, settings.DoubleClickSize.Height / 2)); var e = new PointerPressEventArgs @@ -134,7 +131,7 @@ namespace Perspex.Input Device = this, RoutedEvent = InputElement.PointerPressedEvent, Source = source, - ClickCount = this.clickCount, + ClickCount = _clickCount, }; source.RaiseEvent(e); @@ -195,7 +192,7 @@ namespace Perspex.Input } } - private void MouseWheel(IMouseDevice device, IInputRoot root, Point p, Vector delta) + private void MouseWheel(IMouseDevice device, IInputRoot root, Point p, Vector delta) { var hit = this.HitTest(root, p); @@ -230,7 +227,7 @@ namespace Perspex.Input private void ClearPointerOver(IPointerDevice device, IInputRoot root) { - foreach (var control in this.pointerOvers.ToList()) + foreach (var control in _pointerOvers.ToList()) { PointerEventArgs e = new PointerEventArgs { @@ -239,7 +236,7 @@ namespace Perspex.Input Source = control, }; - this.pointerOvers.Remove(control); + _pointerOvers.Remove(control); control.RaiseEvent(e); } @@ -250,7 +247,7 @@ namespace Perspex.Input { IEnumerable hits = element.GetInputElementsAt(p); - foreach (var control in this.pointerOvers.Except(hits).ToList()) + foreach (var control in _pointerOvers.Except(hits).ToList()) { PointerEventArgs e = new PointerEventArgs { @@ -259,11 +256,11 @@ namespace Perspex.Input Source = control, }; - this.pointerOvers.Remove(control); + _pointerOvers.Remove(control); control.RaiseEvent(e); } - foreach (var control in hits.Except(this.pointerOvers)) + foreach (var control in hits.Except(_pointerOvers)) { PointerEventArgs e = new PointerEventArgs { @@ -272,7 +269,7 @@ namespace Perspex.Input Source = control, }; - this.pointerOvers.Add(control); + _pointerOvers.Add(control); control.RaiseEvent(e); } diff --git a/src/Perspex.Input/Navigation/DirectionalNavigation.cs b/src/Perspex.Input/Navigation/DirectionalNavigation.cs index 0eaca0e9a8..3a3e1354b6 100644 --- a/src/Perspex.Input/Navigation/DirectionalNavigation.cs +++ b/src/Perspex.Input/Navigation/DirectionalNavigation.cs @@ -1,16 +1,13 @@ - - - - +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. +using System; +using System.Collections.Generic; +using System.Linq; +using Perspex.VisualTree; namespace Perspex.Input.Navigation { - using System; - using System.Collections.Generic; - using System.Linq; - using Perspex.VisualTree; - /// /// The implementation for default directional navigation. /// diff --git a/src/Perspex.Input/Navigation/FocusExtensions.cs b/src/Perspex.Input/Navigation/FocusExtensions.cs index 1004d5c39c..1d1db7d6c6 100644 --- a/src/Perspex.Input/Navigation/FocusExtensions.cs +++ b/src/Perspex.Input/Navigation/FocusExtensions.cs @@ -1,8 +1,5 @@ - - - - - +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. namespace Perspex.Input.Navigation { diff --git a/src/Perspex.Input/Navigation/TabNavigation.cs b/src/Perspex.Input/Navigation/TabNavigation.cs index e2e92a2486..97091fffde 100644 --- a/src/Perspex.Input/Navigation/TabNavigation.cs +++ b/src/Perspex.Input/Navigation/TabNavigation.cs @@ -1,16 +1,13 @@ - - - - +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. +using System; +using System.Collections.Generic; +using System.Linq; +using Perspex.VisualTree; namespace Perspex.Input.Navigation { - using System; - using System.Collections.Generic; - using System.Linq; - using Perspex.VisualTree; - /// /// The implementation for default tab navigation. /// diff --git a/src/Perspex.Input/NavigationMethod.cs b/src/Perspex.Input/NavigationMethod.cs index c248cc3ed1..071cd4217a 100644 --- a/src/Perspex.Input/NavigationMethod.cs +++ b/src/Perspex.Input/NavigationMethod.cs @@ -1,8 +1,5 @@ - - - - - +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. namespace Perspex.Input { diff --git a/src/Perspex.Input/Platform/IClipboard.cs b/src/Perspex.Input/Platform/IClipboard.cs index 9db769835d..c7c3f4666b 100644 --- a/src/Perspex.Input/Platform/IClipboard.cs +++ b/src/Perspex.Input/Platform/IClipboard.cs @@ -1,11 +1,14 @@ -namespace Perspex.Input.Platform -{ - using System; - using System.Collections.Generic; - using System.Linq; - using System.Text; - using System.Threading.Tasks; +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. + +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +namespace Perspex.Input.Platform +{ public interface IClipboard { Task GetTextAsync(); diff --git a/src/Perspex.Input/Platform/IPlatformSettings.cs b/src/Perspex.Input/Platform/IPlatformSettings.cs index 5ab9c3506c..d269d01c1c 100644 --- a/src/Perspex.Input/Platform/IPlatformSettings.cs +++ b/src/Perspex.Input/Platform/IPlatformSettings.cs @@ -1,13 +1,10 @@ - - - - +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. +using System; namespace Perspex.Platform { - using System; - public interface IPlatformSettings { Size DoubleClickSize { get; } diff --git a/src/Perspex.Input/Platform/IStandardCursorFactory.cs b/src/Perspex.Input/Platform/IStandardCursorFactory.cs index 7a18b60857..7900397680 100644 --- a/src/Perspex.Input/Platform/IStandardCursorFactory.cs +++ b/src/Perspex.Input/Platform/IStandardCursorFactory.cs @@ -1,12 +1,15 @@ -namespace Perspex.Platform -{ - using System; - using System.Collections.Generic; - using System.Linq; - using System.Text; - using System.Threading.Tasks; - using Perspex.Input; +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. + +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Perspex.Input; +namespace Perspex.Platform +{ public interface IStandardCursorFactory { IPlatformHandle GetCursor(StandardCursorType cursorType); diff --git a/src/Perspex.Input/PointerEventArgs.cs b/src/Perspex.Input/PointerEventArgs.cs index a161fa4eb7..87901b80e2 100644 --- a/src/Perspex.Input/PointerEventArgs.cs +++ b/src/Perspex.Input/PointerEventArgs.cs @@ -1,14 +1,11 @@ - - - - +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. +using System; +using Perspex.Interactivity; namespace Perspex.Input { - using System; - using Perspex.Interactivity; - public class PointerEventArgs : RoutedEventArgs { public IPointerDevice Device { get; set; } diff --git a/src/Perspex.Input/PointerPressEventArgs.cs b/src/Perspex.Input/PointerPressEventArgs.cs index 215456ad60..bd77886484 100644 --- a/src/Perspex.Input/PointerPressEventArgs.cs +++ b/src/Perspex.Input/PointerPressEventArgs.cs @@ -1,8 +1,5 @@ - - - - - +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. namespace Perspex.Input { diff --git a/src/Perspex.Input/PointerWheelEventArgs.cs b/src/Perspex.Input/PointerWheelEventArgs.cs index ae381d34e7..0be89e1ec6 100644 --- a/src/Perspex.Input/PointerWheelEventArgs.cs +++ b/src/Perspex.Input/PointerWheelEventArgs.cs @@ -1,8 +1,5 @@ - - - - - +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. namespace Perspex.Input { diff --git a/src/Perspex.Input/Properties/AssemblyInfo.cs b/src/Perspex.Input/Properties/AssemblyInfo.cs index 42d929c312..04e306ea17 100644 --- a/src/Perspex.Input/Properties/AssemblyInfo.cs +++ b/src/Perspex.Input/Properties/AssemblyInfo.cs @@ -1,8 +1,5 @@ - - - - - +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. using System.Reflection; diff --git a/src/Perspex.Input/Raw/RawInputEventArgs.cs b/src/Perspex.Input/Raw/RawInputEventArgs.cs index 237a433e49..f5b7ead9d7 100644 --- a/src/Perspex.Input/Raw/RawInputEventArgs.cs +++ b/src/Perspex.Input/Raw/RawInputEventArgs.cs @@ -1,13 +1,10 @@ - - - - +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. +using System; namespace Perspex.Input.Raw { - using System; - public class RawInputEventArgs : EventArgs { public RawInputEventArgs(IInputDevice device, uint timestamp) diff --git a/src/Perspex.Input/Raw/RawKeyEventArgs.cs b/src/Perspex.Input/Raw/RawKeyEventArgs.cs index fe58fe05c0..7db0fdd680 100644 --- a/src/Perspex.Input/Raw/RawKeyEventArgs.cs +++ b/src/Perspex.Input/Raw/RawKeyEventArgs.cs @@ -1,8 +1,5 @@ - -// -// Copyright 2014 Tricycle. All rights reserved. - - +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. namespace Perspex.Input.Raw { @@ -29,7 +26,7 @@ namespace Perspex.Input.Raw public Key Key { get; set; } public ModifierKeys Modifiers { get; set; } - + public RawKeyEventType Type { get; set; } } } diff --git a/src/Perspex.Input/Raw/RawMouseEventArgs.cs b/src/Perspex.Input/Raw/RawMouseEventArgs.cs index c68bb31776..07359d56a5 100644 --- a/src/Perspex.Input/Raw/RawMouseEventArgs.cs +++ b/src/Perspex.Input/Raw/RawMouseEventArgs.cs @@ -1,13 +1,10 @@ - - - - +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. +using System; namespace Perspex.Input.Raw { - using System; - public enum RawMouseEventType { LeaveWindow, diff --git a/src/Perspex.Input/Raw/RawMouseWheelEventArgs.cs b/src/Perspex.Input/Raw/RawMouseWheelEventArgs.cs index 785232db57..86a5abca92 100644 --- a/src/Perspex.Input/Raw/RawMouseWheelEventArgs.cs +++ b/src/Perspex.Input/Raw/RawMouseWheelEventArgs.cs @@ -1,14 +1,11 @@ - - - - +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. +using System; +using Perspex.Layout; namespace Perspex.Input.Raw { - using System; - using Perspex.Layout; - public class RawMouseWheelEventArgs : RawMouseEventArgs { public RawMouseWheelEventArgs( diff --git a/src/Perspex.Input/Raw/RawSizeEventArgs.cs b/src/Perspex.Input/Raw/RawSizeEventArgs.cs index 982de48e24..0e9f04e55d 100644 --- a/src/Perspex.Input/Raw/RawSizeEventArgs.cs +++ b/src/Perspex.Input/Raw/RawSizeEventArgs.cs @@ -1,13 +1,10 @@ - - - - +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. +using System; namespace Perspex.Input.Raw { - using System; - public class RawSizeEventArgs : EventArgs { public RawSizeEventArgs(Size size) diff --git a/src/Perspex.Input/Raw/RawTextInputEventArgs.cs b/src/Perspex.Input/Raw/RawTextInputEventArgs.cs index 6739bd718d..810f9599a2 100644 --- a/src/Perspex.Input/Raw/RawTextInputEventArgs.cs +++ b/src/Perspex.Input/Raw/RawTextInputEventArgs.cs @@ -1,8 +1,10 @@ -namespace Perspex.Input.Raw +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. + +namespace Perspex.Input.Raw { public class RawTextInputEventArgs : RawInputEventArgs { - public string Text { get; set; } public RawTextInputEventArgs(IKeyboardDevice device, uint timestamp, string text) : base(device, timestamp) diff --git a/src/Perspex.Input/TextInputEventArgs.cs b/src/Perspex.Input/TextInputEventArgs.cs index 0639e1d1cf..0db1e6ae1f 100644 --- a/src/Perspex.Input/TextInputEventArgs.cs +++ b/src/Perspex.Input/TextInputEventArgs.cs @@ -1,4 +1,7 @@ -using System; +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. + +using System; using System.Collections.Generic; using System.Linq; using System.Text; diff --git a/src/Perspex.Input/VectorEventArgs.cs b/src/Perspex.Input/VectorEventArgs.cs index b311741456..78b7eccdd0 100644 --- a/src/Perspex.Input/VectorEventArgs.cs +++ b/src/Perspex.Input/VectorEventArgs.cs @@ -1,14 +1,11 @@ - - - - +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. +using System; +using Perspex.Interactivity; namespace Perspex.Input { - using System; - using Perspex.Interactivity; - public class VectorEventArgs : RoutedEventArgs { public Vector Vector { get; set; } diff --git a/src/Perspex.Interactivity/EventSubscription.cs b/src/Perspex.Interactivity/EventSubscription.cs index e6b0a7891a..a9de5f0b82 100644 --- a/src/Perspex.Interactivity/EventSubscription.cs +++ b/src/Perspex.Interactivity/EventSubscription.cs @@ -1,13 +1,10 @@ - - - - +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. +using System; namespace Perspex.Interactivity { - using System; - internal class EventSubscription { public Delegate Handler { get; set; } diff --git a/src/Perspex.Interactivity/IInteractive.cs b/src/Perspex.Interactivity/IInteractive.cs index 6b1425fe48..a7c0e87a72 100644 --- a/src/Perspex.Interactivity/IInteractive.cs +++ b/src/Perspex.Interactivity/IInteractive.cs @@ -1,13 +1,10 @@ - - - - +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. +using System; namespace Perspex.Interactivity { - using System; - /// /// Interface for objects that raise routed events. /// diff --git a/src/Perspex.Interactivity/Interactive.cs b/src/Perspex.Interactivity/Interactive.cs index dd19a6172e..b0df3865bf 100644 --- a/src/Perspex.Interactivity/Interactive.cs +++ b/src/Perspex.Interactivity/Interactive.cs @@ -1,26 +1,23 @@ - - - - - +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. + +using System; +using System.Collections.Generic; +using System.Linq; +using System.Reactive; +using System.Reactive.Disposables; +using System.Reactive.Linq; +using Perspex.Layout; +using Perspex.VisualTree; namespace Perspex.Interactivity { - using System; - using System.Collections.Generic; - using System.Linq; - using System.Reactive; - using System.Reactive.Disposables; - using System.Reactive.Linq; - using Perspex.Layout; - using Perspex.VisualTree; - /// /// Base class for objects that raise routed events. /// public class Interactive : Layoutable, IInteractive { - private Dictionary> eventHandlers = + private Dictionary> _eventHandlers = new Dictionary>(); /// @@ -50,10 +47,10 @@ namespace Perspex.Interactivity List subscriptions; - if (!this.eventHandlers.TryGetValue(routedEvent, out subscriptions)) + if (!_eventHandlers.TryGetValue(routedEvent, out subscriptions)) { subscriptions = new List(); - this.eventHandlers.Add(routedEvent, subscriptions); + _eventHandlers.Add(routedEvent, subscriptions); } var sub = new EventSubscription @@ -98,7 +95,7 @@ namespace Perspex.Interactivity List subscriptions; - if (this.eventHandlers.TryGetValue(routedEvent, out subscriptions)) + if (_eventHandlers.TryGetValue(routedEvent, out subscriptions)) { subscriptions.RemoveAll(x => x.Handler == handler); } @@ -187,7 +184,7 @@ namespace Perspex.Interactivity List subscriptions; - if (this.eventHandlers.TryGetValue(e.RoutedEvent, out subscriptions)) + if (_eventHandlers.TryGetValue(e.RoutedEvent, out subscriptions)) { foreach (var sub in subscriptions.ToList()) { diff --git a/src/Perspex.Interactivity/InteractiveExtensions.cs b/src/Perspex.Interactivity/InteractiveExtensions.cs index 2bc8b5319b..5f9a75e5bc 100644 --- a/src/Perspex.Interactivity/InteractiveExtensions.cs +++ b/src/Perspex.Interactivity/InteractiveExtensions.cs @@ -1,14 +1,11 @@ - - - - +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. +using System.Collections.Generic; +using System.Linq; namespace Perspex.Interactivity { - using System.Collections.Generic; - using System.Linq; - /// /// Provides extension methods for the interface. /// diff --git a/src/Perspex.Interactivity/Properties/AssemblyInfo.cs b/src/Perspex.Interactivity/Properties/AssemblyInfo.cs index 3de1efdcf9..3359d16f4f 100644 --- a/src/Perspex.Interactivity/Properties/AssemblyInfo.cs +++ b/src/Perspex.Interactivity/Properties/AssemblyInfo.cs @@ -1,8 +1,5 @@ - - - - - +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. using System.Reflection; diff --git a/src/Perspex.Interactivity/RoutedEvent.cs b/src/Perspex.Interactivity/RoutedEvent.cs index 341c453faf..b3c871f761 100644 --- a/src/Perspex.Interactivity/RoutedEvent.cs +++ b/src/Perspex.Interactivity/RoutedEvent.cs @@ -1,16 +1,13 @@ - - - - +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. +using System; +using System.Collections.Generic; +using System.Linq.Expressions; +using System.Reflection; namespace Perspex.Interactivity { - using System; - using System.Collections.Generic; - using System.Linq.Expressions; - using System.Reflection; - [Flags] public enum RoutingStrategies { @@ -21,7 +18,7 @@ namespace Perspex.Interactivity public class RoutedEvent { - private List subscriptions = new List(); + private List _subscriptions = new List(); public RoutedEvent( string name, @@ -87,7 +84,7 @@ namespace Perspex.Interactivity public void AddClassHandler(Type type, EventHandler handler, RoutingStrategies routes) { - this.subscriptions.Add(new ClassEventSubscription + _subscriptions.Add(new ClassEventSubscription { TargetType = type, Handler = handler, @@ -97,7 +94,7 @@ namespace Perspex.Interactivity internal void InvokeClassHandlers(object sender, RoutedEventArgs e) { - foreach (var sub in this.subscriptions) + foreach (var sub in _subscriptions) { if (sub.TargetType.GetTypeInfo().IsAssignableFrom(sender.GetType().GetTypeInfo()) && ((e.Route == RoutingStrategies.Direct) || (e.Route & sub.Routes) != 0) && diff --git a/src/Perspex.Interactivity/RoutedEventArgs.cs b/src/Perspex.Interactivity/RoutedEventArgs.cs index 46670cd2dd..0f24af5d93 100644 --- a/src/Perspex.Interactivity/RoutedEventArgs.cs +++ b/src/Perspex.Interactivity/RoutedEventArgs.cs @@ -1,13 +1,10 @@ - - - - +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. +using System; namespace Perspex.Interactivity { - using System; - public class RoutedEventArgs : EventArgs { public RoutedEventArgs() diff --git a/src/Perspex.Layout/ILayoutManager.cs b/src/Perspex.Layout/ILayoutManager.cs index 8ec113dac3..e32701bfec 100644 --- a/src/Perspex.Layout/ILayoutManager.cs +++ b/src/Perspex.Layout/ILayoutManager.cs @@ -1,14 +1,11 @@ - - - - +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. +using System; +using System.Reactive; namespace Perspex.Layout { - using System; - using System.Reactive; - /// /// Manages measuring and arranging of controls. /// diff --git a/src/Perspex.Layout/ILayoutRoot.cs b/src/Perspex.Layout/ILayoutRoot.cs index d3188121db..a8de921794 100644 --- a/src/Perspex.Layout/ILayoutRoot.cs +++ b/src/Perspex.Layout/ILayoutRoot.cs @@ -1,8 +1,5 @@ - - - - - +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. namespace Perspex.Layout { diff --git a/src/Perspex.Layout/ILayoutable.cs b/src/Perspex.Layout/ILayoutable.cs index 3f1965ad3a..a72488ee5c 100644 --- a/src/Perspex.Layout/ILayoutable.cs +++ b/src/Perspex.Layout/ILayoutable.cs @@ -1,8 +1,5 @@ - - - - - +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. namespace Perspex.Layout { @@ -24,7 +21,7 @@ namespace Perspex.Layout /// /// Gets the height of the element. /// - double Height { get; } + double Height { get; } /// /// Gets the minimum width of the element. diff --git a/src/Perspex.Layout/LayoutHelper.cs b/src/Perspex.Layout/LayoutHelper.cs index 31d0a9917c..98ce73dd85 100644 --- a/src/Perspex.Layout/LayoutHelper.cs +++ b/src/Perspex.Layout/LayoutHelper.cs @@ -1,13 +1,10 @@ - - - - +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. +using System; namespace Perspex.Layout { - using System; - /// /// Provides helper methods needed for layout. /// diff --git a/src/Perspex.Layout/LayoutManager.cs b/src/Perspex.Layout/LayoutManager.cs index 484bc4f56b..50fc4baf47 100644 --- a/src/Perspex.Layout/LayoutManager.cs +++ b/src/Perspex.Layout/LayoutManager.cs @@ -1,20 +1,17 @@ - - - - - +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. + +using System; +using System.Reactive; +using System.Reactive.Disposables; +using System.Reactive.Subjects; +using NGenerics.DataStructures.General; +using Perspex.VisualTree; +using Serilog; +using Serilog.Core.Enrichers; 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; - /// /// Manages measuring and arranging of controls. /// @@ -34,52 +31,52 @@ namespace Perspex.Layout /// /// Called when a layout is needed. /// - private Subject layoutNeeded; + private Subject _layoutNeeded; /// /// Called when a layout is completed. /// - private Subject layoutCompleted; + private Subject _layoutCompleted; /// /// Whether a measure is needed on the next layout pass. /// - private bool measureNeeded = true; + private bool _measureNeeded = true; /// /// The controls that need to be measured, sorted by distance to layout root. /// - private Heap toMeasure = new Heap(HeapType.Minimum); + private Heap _toMeasure = new Heap(HeapType.Minimum); /// /// The controls that need to be arranged, sorted by distance to layout root. /// - private Heap toArrange = new Heap(HeapType.Minimum); + private Heap _toArrange = new Heap(HeapType.Minimum); /// /// Prevents re-entrancy. /// - private bool running; + private bool _running; /// /// The logger to use. /// - private ILogger log; + private ILogger _log; /// /// Initializes a new instance of the class. /// public LayoutManager() { - this.log = Log.ForContext(new[] + _log = Log.ForContext(new[] { new PropertyEnricher("Area", "Layout"), new PropertyEnricher("SourceContext", this.GetType()), new PropertyEnricher("Id", this.GetHashCode()), }); - this.layoutNeeded = new Subject(); - this.layoutCompleted = new Subject(); + _layoutNeeded = new Subject(); + _layoutCompleted = new Subject(); } /// @@ -97,12 +94,12 @@ namespace Perspex.Layout /// /// Gets an observable that is fired when a layout pass is needed. /// - public IObservable LayoutNeeded => this.layoutNeeded; + public IObservable LayoutNeeded => _layoutNeeded; /// /// Gets an observable that is fired when a layout pass is completed. /// - public IObservable LayoutCompleted => this.layoutCompleted; + public IObservable LayoutCompleted => _layoutCompleted; /// /// Gets a value indicating whether a layout is queued. @@ -122,44 +119,44 @@ namespace Perspex.Layout /// public void ExecuteLayoutPass() { - if (this.running) + if (_running) { return; } - using (Disposable.Create(() => this.running = false)) + using (Disposable.Create(() => _running = false)) { - this.running = true; + _running = true; this.LayoutQueued = false; - this.log.Information( + _log.Information( "Started layout pass. To measure: {Measure} To arrange: {Arrange}", - this.toMeasure.Count, - this.toArrange.Count); + _toMeasure.Count, + _toArrange.Count); var stopwatch = new System.Diagnostics.Stopwatch(); stopwatch.Start(); for (int i = 0; i < MaxTries; ++i) { - if (this.measureNeeded) + if (_measureNeeded) { this.ExecuteMeasure(); - this.measureNeeded = false; + _measureNeeded = false; } this.ExecuteArrange(); - if (this.toMeasure.Count == 0) + if (_toMeasure.Count == 0) { break; } } stopwatch.Stop(); - this.log.Information("Layout pass finised in {Time}", stopwatch.Elapsed); + _log.Information("Layout pass finised in {Time}", stopwatch.Elapsed); - this.layoutCompleted.OnNext(Unit.Default); + _layoutCompleted.OnNext(Unit.Default); } } @@ -171,15 +168,15 @@ namespace Perspex.Layout public void InvalidateMeasure(ILayoutable control, int distance) { var item = new Item(control, distance); - this.toMeasure.Add(item); - this.toArrange.Add(item); + _toMeasure.Add(item); + _toArrange.Add(item); - this.measureNeeded = true; + _measureNeeded = true; if (!this.LayoutQueued) { IVisual visual = control as IVisual; - this.layoutNeeded.OnNext(Unit.Default); + _layoutNeeded.OnNext(Unit.Default); this.LayoutQueued = true; } } @@ -191,12 +188,12 @@ namespace Perspex.Layout /// The control's distance from the layout root. public void InvalidateArrange(ILayoutable control, int distance) { - this.toArrange.Add(new Item(control, distance)); + _toArrange.Add(new Item(control, distance)); if (!this.LayoutQueued) { IVisual visual = control as IVisual; - this.layoutNeeded.OnNext(Unit.Default); + _layoutNeeded.OnNext(Unit.Default); this.LayoutQueued = true; } } @@ -208,9 +205,9 @@ namespace Perspex.Layout { for (int i = 0; i < MaxTries; ++i) { - var measure = this.toMeasure; + var measure = _toMeasure; - this.toMeasure = new Heap(HeapType.Minimum); + _toMeasure = new Heap(HeapType.Minimum); if (!this.Root.IsMeasureValid) { @@ -241,7 +238,7 @@ namespace Perspex.Layout } } - if (this.toMeasure.Count == 0) + if (_toMeasure.Count == 0) { break; } @@ -255,16 +252,16 @@ namespace Perspex.Layout { for (int i = 0; i < MaxTries; ++i) { - var arrange = this.toArrange; + var arrange = _toArrange; - this.toArrange = new Heap(HeapType.Minimum); + _toArrange = new Heap(HeapType.Minimum); if (!this.Root.IsArrangeValid && this.Root.IsMeasureValid) { this.Root.Arrange(new Rect(this.Root.DesiredSize)); } - if (this.toMeasure.Count > 0) + if (_toMeasure.Count > 0) { return; } @@ -287,7 +284,7 @@ namespace Perspex.Layout control.Arrange(control.PreviousArrange.Value, true); } - if (this.toMeasure.Count > 0) + if (_toMeasure.Count > 0) { return; } @@ -295,7 +292,7 @@ namespace Perspex.Layout } } - if (this.toArrange.Count == 0) + if (_toArrange.Count == 0) { break; } diff --git a/src/Perspex.Layout/Layoutable.cs b/src/Perspex.Layout/Layoutable.cs index f00b6cc415..22bc596341 100644 --- a/src/Perspex.Layout/Layoutable.cs +++ b/src/Perspex.Layout/Layoutable.cs @@ -1,17 +1,14 @@ - - - - +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. +using System; +using System.Linq; +using Perspex.VisualTree; +using Serilog; +using Serilog.Core.Enrichers; namespace Perspex.Layout { - using System; - using System.Linq; - using Perspex.VisualTree; - using Serilog; - using Serilog.Core.Enrichers; - /// /// Defines how a control aligns itself horizontally in its parent control. /// @@ -129,11 +126,11 @@ namespace Perspex.Layout public static readonly PerspexProperty UseLayoutRoundingProperty = PerspexProperty.Register(nameof(UseLayoutRounding), defaultValue: true, inherits: true); - private Size? previousMeasure; + private Size? _previousMeasure; - private Rect? previousArrange; + private Rect? _previousArrange; - private ILogger layoutLog; + private ILogger _layoutLog; /// /// Initializes static members of the class. @@ -157,7 +154,7 @@ namespace Perspex.Layout /// public Layoutable() { - this.layoutLog = Log.ForContext(new[] + _layoutLog = Log.ForContext(new[] { new PropertyEnricher("Area", "Layout"), new PropertyEnricher("SourceContext", this.GetType()), @@ -288,7 +285,7 @@ namespace Perspex.Layout /// Size? ILayoutable.PreviousMeasure { - get { return this.previousMeasure; } + get { return _previousMeasure; } } /// @@ -296,7 +293,7 @@ namespace Perspex.Layout /// Rect? ILayoutable.PreviousArrange { - get { return this.previousArrange; } + get { return _previousArrange; } } /// @@ -321,7 +318,7 @@ namespace Perspex.Layout throw new InvalidOperationException("Cannot call Measure using a size with NaN values."); } - if (force || !this.IsMeasureValid || this.previousMeasure != availableSize) + if (force || !this.IsMeasureValid || _previousMeasure != availableSize) { this.IsMeasureValid = true; @@ -333,9 +330,9 @@ namespace Perspex.Layout } this.DesiredSize = desiredSize; - this.previousMeasure = availableSize; + _previousMeasure = availableSize; - this.layoutLog.Verbose("Measure requested {DesiredSize}", this.DesiredSize); + _layoutLog.Verbose("Measure requested {DesiredSize}", this.DesiredSize); } } @@ -361,13 +358,13 @@ namespace Perspex.Layout return; } - if (force || !this.IsArrangeValid || this.previousArrange != rect) + if (force || !this.IsArrangeValid || _previousArrange != rect) { - this.layoutLog.Verbose("Arrange to {Rect} ", rect); + _layoutLog.Verbose("Arrange to {Rect} ", rect); this.IsArrangeValid = true; this.ArrangeCore(rect); - this.previousArrange = rect; + _previousArrange = rect; } } @@ -380,13 +377,13 @@ namespace Perspex.Layout if (this.IsMeasureValid) { - this.layoutLog.Verbose("Invalidated measure"); + _layoutLog.Verbose("Invalidated measure"); } this.IsMeasureValid = false; this.IsArrangeValid = false; - this.previousMeasure = null; - this.previousArrange = null; + _previousMeasure = null; + _previousArrange = null; if (parent != null && IsResizable(parent)) { @@ -412,11 +409,11 @@ namespace Perspex.Layout if (this.IsArrangeValid) { - this.layoutLog.Verbose("Arrange measure"); + _layoutLog.Verbose("Arrange measure"); } this.IsArrangeValid = false; - this.previousArrange = null; + _previousArrange = null; if (root != null && root.Item1.LayoutManager != null) { diff --git a/src/Perspex.Layout/Properties/AssemblyInfo.cs b/src/Perspex.Layout/Properties/AssemblyInfo.cs index 6ac16c774a..fee09dbf85 100644 --- a/src/Perspex.Layout/Properties/AssemblyInfo.cs +++ b/src/Perspex.Layout/Properties/AssemblyInfo.cs @@ -1,8 +1,5 @@ - - - - - +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. using System.Reflection; diff --git a/src/Perspex.ReactiveUI/Properties/AssemblyInfo.cs b/src/Perspex.ReactiveUI/Properties/AssemblyInfo.cs index cee918a3f3..4db49d865e 100644 --- a/src/Perspex.ReactiveUI/Properties/AssemblyInfo.cs +++ b/src/Perspex.ReactiveUI/Properties/AssemblyInfo.cs @@ -1,4 +1,7 @@ -using System.Resources; +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. + +using System.Resources; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; @@ -11,7 +14,7 @@ using System.Runtime.InteropServices; [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("Perspex.ReactiveUI")] -[assembly: AssemblyCopyright("Copyright © 2015")] +[assembly: AssemblyCopyright("Copyright \u00A9 2015")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] [assembly: NeutralResourcesLanguage("en")] diff --git a/src/Perspex.ReactiveUI/Registrations.cs b/src/Perspex.ReactiveUI/Registrations.cs index 699d02d87f..5005921e6c 100644 --- a/src/Perspex.ReactiveUI/Registrations.cs +++ b/src/Perspex.ReactiveUI/Registrations.cs @@ -1,3 +1,6 @@ +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. + using System; using System.Reactive.Concurrency; using System.Threading; diff --git a/src/Perspex.SceneGraph/Animation/CrossFade.cs b/src/Perspex.SceneGraph/Animation/CrossFade.cs index d7ac64579d..a69b6616aa 100644 --- a/src/Perspex.SceneGraph/Animation/CrossFade.cs +++ b/src/Perspex.SceneGraph/Animation/CrossFade.cs @@ -1,16 +1,13 @@ - - - - +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. +using System; +using System.Collections.Generic; +using System.Reactive.Threading.Tasks; +using System.Threading.Tasks; namespace Perspex.Animation { - using System; - using System.Collections.Generic; - using System.Reactive.Threading.Tasks; - using System.Threading.Tasks; - /// /// Defines a cross-fade animation between two s. /// diff --git a/src/Perspex.SceneGraph/Animation/IPageTransition.cs b/src/Perspex.SceneGraph/Animation/IPageTransition.cs index 59b5a3a87a..50274734b9 100644 --- a/src/Perspex.SceneGraph/Animation/IPageTransition.cs +++ b/src/Perspex.SceneGraph/Animation/IPageTransition.cs @@ -1,13 +1,10 @@ - - - - +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. +using System.Threading.Tasks; namespace Perspex.Animation { - using System.Threading.Tasks; - /// /// Interface for animations that transition between two pages. /// diff --git a/src/Perspex.SceneGraph/Animation/PageSlide.cs b/src/Perspex.SceneGraph/Animation/PageSlide.cs index 9531f512f7..0f16d1df74 100644 --- a/src/Perspex.SceneGraph/Animation/PageSlide.cs +++ b/src/Perspex.SceneGraph/Animation/PageSlide.cs @@ -1,17 +1,14 @@ - - - - +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. +using System; +using System.Collections.Generic; +using System.Reactive.Threading.Tasks; +using System.Threading.Tasks; +using Perspex.Media; namespace Perspex.Animation { - using System; - using System.Collections.Generic; - using System.Reactive.Threading.Tasks; - using System.Threading.Tasks; - using Perspex.Media; - /// /// Transitions between two pages by sliding them horizontally. /// diff --git a/src/Perspex.SceneGraph/IVisual.cs b/src/Perspex.SceneGraph/IVisual.cs index 2efba73102..559ac21745 100644 --- a/src/Perspex.SceneGraph/IVisual.cs +++ b/src/Perspex.SceneGraph/IVisual.cs @@ -1,15 +1,12 @@ - - - - +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. +using Perspex.Collections; +using Perspex.Media; +using Perspex.VisualTree; namespace Perspex { - using Perspex.Collections; - using Perspex.Media; - using Perspex.VisualTree; - /// /// Represents a node in the visual scene graph. /// diff --git a/src/Perspex.SceneGraph/Matrix.cs b/src/Perspex.SceneGraph/Matrix.cs index 0e7e90e66a..7ef65872e0 100644 --- a/src/Perspex.SceneGraph/Matrix.cs +++ b/src/Perspex.SceneGraph/Matrix.cs @@ -1,25 +1,22 @@ - - - - +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. +using System; +using System.Globalization; namespace Perspex { - using System; - using System.Globalization; - /// /// A 2x3 matrix. /// public struct Matrix { - private double m11; - private double m12; - private double m21; - private double m22; - private double m31; - private double m32; + private double _m11; + private double _m12; + private double _m21; + private double _m22; + private double _m31; + private double _m32; /// /// Initializes a new instance of the struct. @@ -38,12 +35,12 @@ namespace Perspex double offsetX, double offsetY) { - this.m11 = m11; - this.m12 = m12; - this.m21 = m21; - this.m22 = m22; - this.m31 = offsetX; - this.m32 = offsetY; + _m11 = m11; + _m12 = m12; + _m21 = m21; + _m22 = m22; + _m31 = offsetX; + _m32 = offsetY; } /// @@ -67,7 +64,7 @@ namespace Perspex /// public double M11 { - get { return this.m11; } + get { return _m11; } } /// @@ -75,7 +72,7 @@ namespace Perspex /// public double M12 { - get { return this.m12; } + get { return _m12; } } /// @@ -83,7 +80,7 @@ namespace Perspex /// public double M21 { - get { return this.m21; } + get { return _m21; } } /// @@ -91,7 +88,7 @@ namespace Perspex /// public double M22 { - get { return this.m22; } + get { return _m22; } } /// @@ -99,7 +96,7 @@ namespace Perspex /// public double M31 { - get { return this.m31; } + get { return _m31; } } /// @@ -107,7 +104,7 @@ namespace Perspex /// public double M32 { - get { return this.m32; } + get { return _m32; } } /// @@ -123,8 +120,8 @@ namespace Perspex (value1.M11 * value2.M12) + (value1.M12 * value2.M22), (value1.M21 * value2.M11) + (value1.M22 * value2.M21), (value1.M21 * value2.M12) + (value1.M22 * value2.M22), - (value1.m31 * value2.M11) + (value1.m32 * value2.M21) + value2.m31, - (value1.m31 * value2.M12) + (value1.m32 * value2.M22) + value2.m32); + (value1._m31 * value2.M11) + (value1._m32 * value2.M21) + value2._m31, + (value1._m31 * value2.M12) + (value1._m32 * value2.M22) + value2._m32); } /// @@ -233,7 +230,7 @@ namespace Perspex /// public double GetDeterminant() { - return (this.m11 * this.m22) - (this.m12 * this.m21); + return (_m11 * _m22) - (_m12 * _m21); } /// @@ -243,12 +240,12 @@ namespace Perspex /// True if this matrix is equal to other; False otherwise. public bool Equals(Matrix other) { - return this.m11 == other.M11 && - this.m12 == other.M12 && - this.m21 == other.M21 && - this.m22 == other.M22 && - this.m31 == other.M31 && - this.m32 == other.M32; + return _m11 == other.M11 && + _m12 == other.M12 && + _m21 == other.M21 && + _m22 == other.M22 && + _m31 == other.M31 && + _m32 == other.M32; } /// @@ -309,12 +306,12 @@ namespace Perspex double d = this.GetDeterminant(); return new Matrix( - this.m22 / d, - -this.m12 / d, - -this.m21 / d, - this.m11 / d, - ((this.m21 * this.m32) - (this.m22 * this.m31)) / d, - ((this.m12 * this.m31) - (this.m11 * this.m32)) / d); + _m22 / d, + -_m12 / d, + -_m21 / d, + _m11 / d, + ((_m21 * _m32) - (_m22 * _m31)) / d, + ((_m12 * _m31) - (_m11 * _m32)) / d); } } } \ No newline at end of file diff --git a/src/Perspex.SceneGraph/Media/AlignmentX.cs b/src/Perspex.SceneGraph/Media/AlignmentX.cs index 96a06012f0..570e73f7ab 100644 --- a/src/Perspex.SceneGraph/Media/AlignmentX.cs +++ b/src/Perspex.SceneGraph/Media/AlignmentX.cs @@ -1,8 +1,5 @@ - - - - - +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. namespace Perspex.Media { diff --git a/src/Perspex.SceneGraph/Media/AlignmentY.cs b/src/Perspex.SceneGraph/Media/AlignmentY.cs index a80961ab88..019a9acc14 100644 --- a/src/Perspex.SceneGraph/Media/AlignmentY.cs +++ b/src/Perspex.SceneGraph/Media/AlignmentY.cs @@ -1,8 +1,5 @@ - - - - - +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. namespace Perspex.Media { diff --git a/src/Perspex.SceneGraph/Media/Brush.cs b/src/Perspex.SceneGraph/Media/Brush.cs index 1d48ccfc60..875bf1ea1c 100644 --- a/src/Perspex.SceneGraph/Media/Brush.cs +++ b/src/Perspex.SceneGraph/Media/Brush.cs @@ -1,15 +1,12 @@ - - - - +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. +using System; +using System.Linq; +using System.Reflection; namespace Perspex.Media { - using System; - using System.Linq; - using System.Reflection; - /// /// Describes how an area is painted. /// diff --git a/src/Perspex.SceneGraph/Media/BrushMappingMode.cs b/src/Perspex.SceneGraph/Media/BrushMappingMode.cs index a453f81d85..89d413571e 100644 --- a/src/Perspex.SceneGraph/Media/BrushMappingMode.cs +++ b/src/Perspex.SceneGraph/Media/BrushMappingMode.cs @@ -1,11 +1,14 @@ -namespace Perspex.Media -{ - using System; - using System.Collections.Generic; - using System.Linq; - using System.Text; - using System.Threading.Tasks; +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. + +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +namespace Perspex.Media +{ public enum BrushMappingMode { Absolute, diff --git a/src/Perspex.SceneGraph/Media/Brushes.cs b/src/Perspex.SceneGraph/Media/Brushes.cs index 4ab8471e3c..6f563f1c33 100644 --- a/src/Perspex.SceneGraph/Media/Brushes.cs +++ b/src/Perspex.SceneGraph/Media/Brushes.cs @@ -1,8 +1,5 @@ - - - - - +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. namespace Perspex.Media { diff --git a/src/Perspex.SceneGraph/Media/Color.cs b/src/Perspex.SceneGraph/Media/Color.cs index 8025652b90..34cc3c97ac 100644 --- a/src/Perspex.SceneGraph/Media/Color.cs +++ b/src/Perspex.SceneGraph/Media/Color.cs @@ -1,16 +1,13 @@ +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. - - - - +using System; +using System.Globalization; +using System.Linq; +using System.Reflection; namespace Perspex.Media { - using System; - using System.Globalization; - using System.Linq; - using System.Reflection; - /// /// An ARGB color. /// diff --git a/src/Perspex.SceneGraph/Media/Colors.cs b/src/Perspex.SceneGraph/Media/Colors.cs index 836de49f6b..d717a2dd16 100644 --- a/src/Perspex.SceneGraph/Media/Colors.cs +++ b/src/Perspex.SceneGraph/Media/Colors.cs @@ -1,8 +1,5 @@ - - - - - +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. namespace Perspex.Media { diff --git a/src/Perspex.SceneGraph/Media/EllipseGeometry.cs b/src/Perspex.SceneGraph/Media/EllipseGeometry.cs index ebc8b64703..9a830f5706 100644 --- a/src/Perspex.SceneGraph/Media/EllipseGeometry.cs +++ b/src/Perspex.SceneGraph/Media/EllipseGeometry.cs @@ -1,15 +1,12 @@ - - - - +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. +using System; +using Perspex.Platform; +using Splat; namespace Perspex.Media { - using System; - using Perspex.Platform; - using Splat; - /// /// Represents the geometry of an ellipse or circle. /// diff --git a/src/Perspex.SceneGraph/Media/FontStyle.cs b/src/Perspex.SceneGraph/Media/FontStyle.cs index d68ee57ae7..95ddf6b748 100644 --- a/src/Perspex.SceneGraph/Media/FontStyle.cs +++ b/src/Perspex.SceneGraph/Media/FontStyle.cs @@ -1,8 +1,5 @@ - - - - - +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. namespace Perspex.Media { diff --git a/src/Perspex.SceneGraph/Media/FontWeight.cs b/src/Perspex.SceneGraph/Media/FontWeight.cs index eda5d9ac83..9ac582f40a 100644 --- a/src/Perspex.SceneGraph/Media/FontWeight.cs +++ b/src/Perspex.SceneGraph/Media/FontWeight.cs @@ -1,8 +1,5 @@ - - - - - +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. namespace Perspex.Media { diff --git a/src/Perspex.SceneGraph/Media/FormattedText.cs b/src/Perspex.SceneGraph/Media/FormattedText.cs index a659f1ad18..90f03063ef 100644 --- a/src/Perspex.SceneGraph/Media/FormattedText.cs +++ b/src/Perspex.SceneGraph/Media/FormattedText.cs @@ -1,16 +1,13 @@ - - - - +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. +using System; +using System.Collections.Generic; +using Perspex.Platform; +using Splat; namespace Perspex.Media { - using System; - using System.Collections.Generic; - using Perspex.Platform; - using Splat; - /// /// Represents a piece of text with formatting. /// diff --git a/src/Perspex.SceneGraph/Media/FormattedTextLine.cs b/src/Perspex.SceneGraph/Media/FormattedTextLine.cs index f07a7b7d0c..29247bddb9 100644 --- a/src/Perspex.SceneGraph/Media/FormattedTextLine.cs +++ b/src/Perspex.SceneGraph/Media/FormattedTextLine.cs @@ -1,8 +1,5 @@ - - - - - +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. namespace Perspex.Media { diff --git a/src/Perspex.SceneGraph/Media/Geometry.cs b/src/Perspex.SceneGraph/Media/Geometry.cs index 0e8de696f8..641190337a 100644 --- a/src/Perspex.SceneGraph/Media/Geometry.cs +++ b/src/Perspex.SceneGraph/Media/Geometry.cs @@ -1,14 +1,11 @@ - - - - +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. +using System; +using Perspex.Platform; namespace Perspex.Media { - using System; - using Perspex.Platform; - /// /// Defines a geometric shape. /// diff --git a/src/Perspex.SceneGraph/Media/GradientBrush.cs b/src/Perspex.SceneGraph/Media/GradientBrush.cs index 5c63b66242..82505e5847 100644 --- a/src/Perspex.SceneGraph/Media/GradientBrush.cs +++ b/src/Perspex.SceneGraph/Media/GradientBrush.cs @@ -1,7 +1,10 @@ -namespace Perspex.Media -{ - using System.Collections.Generic; +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. + +using System.Collections.Generic; +namespace Perspex.Media +{ public abstract class GradientBrush : Brush { public static readonly PerspexProperty MappingModeProperty = diff --git a/src/Perspex.SceneGraph/Media/GradientSpreadMethod.cs b/src/Perspex.SceneGraph/Media/GradientSpreadMethod.cs index 78ba87b05a..4ac690a854 100644 --- a/src/Perspex.SceneGraph/Media/GradientSpreadMethod.cs +++ b/src/Perspex.SceneGraph/Media/GradientSpreadMethod.cs @@ -1,11 +1,14 @@ -namespace Perspex.Media -{ - using System; - using System.Collections.Generic; - using System.Linq; - using System.Text; - using System.Threading.Tasks; +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. + +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +namespace Perspex.Media +{ public enum GradientSpreadMethod { Pad, diff --git a/src/Perspex.SceneGraph/Media/GradientStop.cs b/src/Perspex.SceneGraph/Media/GradientStop.cs index 9dbbe610ef..7b236db9fb 100644 --- a/src/Perspex.SceneGraph/Media/GradientStop.cs +++ b/src/Perspex.SceneGraph/Media/GradientStop.cs @@ -1,4 +1,7 @@ -namespace Perspex.Media +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. + +namespace Perspex.Media { /// /// GradientStop diff --git a/src/Perspex.SceneGraph/Media/IDrawingContext.cs b/src/Perspex.SceneGraph/Media/IDrawingContext.cs index 3b0f71d9b3..081df56d11 100644 --- a/src/Perspex.SceneGraph/Media/IDrawingContext.cs +++ b/src/Perspex.SceneGraph/Media/IDrawingContext.cs @@ -1,14 +1,11 @@ - - - - +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. +using System; +using Perspex.Media.Imaging; namespace Perspex.Media { - using System; - using Perspex.Media.Imaging; - /// /// Defines the interface through which drawing occurs. /// diff --git a/src/Perspex.SceneGraph/Media/Imaging/Bitmap.cs b/src/Perspex.SceneGraph/Media/Imaging/Bitmap.cs index ba835b71fa..4b946f5ed2 100644 --- a/src/Perspex.SceneGraph/Media/Imaging/Bitmap.cs +++ b/src/Perspex.SceneGraph/Media/Imaging/Bitmap.cs @@ -1,14 +1,11 @@ - - - - +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. +using Perspex.Platform; +using Splat; namespace Perspex.Media.Imaging { - using Perspex.Platform; - using Splat; - /// /// Holds a bitmap image. /// diff --git a/src/Perspex.SceneGraph/Media/Imaging/IBitmap.cs b/src/Perspex.SceneGraph/Media/Imaging/IBitmap.cs index d42449cee7..ac677b2abb 100644 --- a/src/Perspex.SceneGraph/Media/Imaging/IBitmap.cs +++ b/src/Perspex.SceneGraph/Media/Imaging/IBitmap.cs @@ -1,13 +1,10 @@ - - - - +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. +using Perspex.Platform; namespace Perspex.Media.Imaging { - using Perspex.Platform; - /// /// Represents a bitmap image. /// diff --git a/src/Perspex.SceneGraph/Media/Imaging/RenderTargetBitmap.cs b/src/Perspex.SceneGraph/Media/Imaging/RenderTargetBitmap.cs index bc4381f0ce..55a1c67cfd 100644 --- a/src/Perspex.SceneGraph/Media/Imaging/RenderTargetBitmap.cs +++ b/src/Perspex.SceneGraph/Media/Imaging/RenderTargetBitmap.cs @@ -1,15 +1,12 @@ - - - - +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. +using System; +using Perspex.Platform; +using Splat; namespace Perspex.Media.Imaging { - using System; - using Perspex.Platform; - using Splat; - /// /// A bitmap that holds the rendering of a . /// diff --git a/src/Perspex.SceneGraph/Media/LinearGradientBrush.cs b/src/Perspex.SceneGraph/Media/LinearGradientBrush.cs index 3a63a39506..32a92c619c 100644 --- a/src/Perspex.SceneGraph/Media/LinearGradientBrush.cs +++ b/src/Perspex.SceneGraph/Media/LinearGradientBrush.cs @@ -1,9 +1,12 @@ -namespace Perspex.Media +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. + +namespace Perspex.Media { public class LinearGradientBrush : GradientBrush { public static readonly PerspexProperty StartPointProperty = -PerspexProperty.Register(nameof(StartPoint), new Point(0,0)); +PerspexProperty.Register(nameof(StartPoint), new Point(0, 0)); public static readonly PerspexProperty EndPointProperty = PerspexProperty.Register(nameof(EndPoint), new Point(0, 0)); diff --git a/src/Perspex.SceneGraph/Media/MatrixTransform.cs b/src/Perspex.SceneGraph/Media/MatrixTransform.cs index c6241e9459..46c5c008a2 100644 --- a/src/Perspex.SceneGraph/Media/MatrixTransform.cs +++ b/src/Perspex.SceneGraph/Media/MatrixTransform.cs @@ -1,13 +1,10 @@ - - - - +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. +using System; namespace Perspex.Media { - using System; - /// /// Transforms an according to a . /// diff --git a/src/Perspex.SceneGraph/Media/MediaExtensions.cs b/src/Perspex.SceneGraph/Media/MediaExtensions.cs index 17fb359e37..e7369fe832 100644 --- a/src/Perspex.SceneGraph/Media/MediaExtensions.cs +++ b/src/Perspex.SceneGraph/Media/MediaExtensions.cs @@ -1,13 +1,10 @@ - - - - +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. +using System; namespace Perspex.Media { - using System; - /// /// Provides extension methods for Perspex media. /// diff --git a/src/Perspex.SceneGraph/Media/PathMarkupParser.cs b/src/Perspex.SceneGraph/Media/PathMarkupParser.cs index 57c28f783c..90a3067b87 100644 --- a/src/Perspex.SceneGraph/Media/PathMarkupParser.cs +++ b/src/Perspex.SceneGraph/Media/PathMarkupParser.cs @@ -1,23 +1,20 @@ - - - - +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. +using System; +using System.Collections.Generic; +using System.Globalization; +using System.IO; +using System.Text; namespace Perspex.Media { - using System; - using System.Collections.Generic; - using System.Globalization; - using System.IO; - using System.Text; - /// /// Parses a path markup string. /// public class PathMarkupParser { - private static readonly Dictionary Commands = new Dictionary + private static readonly Dictionary s_commands = new Dictionary { { 'F', Command.FillRule }, { 'f', Command.FillRule }, @@ -35,9 +32,9 @@ namespace Perspex.Media { 'z', Command.Close }, }; - private StreamGeometry geometry; + private StreamGeometry _geometry; - private StreamGeometryContext context; + private StreamGeometryContext _context; /// /// Initializes a new instance of the class. @@ -46,8 +43,8 @@ namespace Perspex.Media /// The context for . public PathMarkupParser(StreamGeometry geometry, StreamGeometryContext context) { - this.geometry = geometry; - this.context = context; + _geometry = geometry; + _context = context; } /// @@ -98,7 +95,7 @@ namespace Perspex.Media case Command.MoveRelative: if (openFigure) { - this.context.EndFigure(false); + _context.EndFigure(false); } if (command == Command.Move) @@ -110,38 +107,38 @@ namespace Perspex.Media point = ReadRelativePoint(reader, point); } - this.context.BeginFigure(point, true); + _context.BeginFigure(point, true); openFigure = true; break; case Command.Line: point = ReadPoint(reader); - this.context.LineTo(point); + _context.LineTo(point); break; case Command.LineRelative: point = ReadRelativePoint(reader, point); - this.context.LineTo(point); + _context.LineTo(point); break; case Command.HorizontalLine: point = point.WithX(ReadDouble(reader)); - this.context.LineTo(point); + _context.LineTo(point); break; case Command.HorizontalLineRelative: point = new Point(point.X + ReadDouble(reader), point.Y); - this.context.LineTo(point); + _context.LineTo(point); break; case Command.VerticalLine: point = point.WithY(ReadDouble(reader)); - this.context.LineTo(point); + _context.LineTo(point); break; case Command.VerticalLineRelative: point = new Point(point.X, point.Y + ReadDouble(reader)); - this.context.LineTo(point); + _context.LineTo(point); break; case Command.CubicBezierCurve: @@ -149,12 +146,12 @@ namespace Perspex.Media Point point1 = ReadPoint(reader); Point point2 = ReadPoint(reader); point = ReadPoint(reader); - this.context.BezierTo(point1, point2, point); + _context.BezierTo(point1, point2, point); break; } case Command.Close: - this.context.EndFigure(true); + _context.EndFigure(true); openFigure = false; break; @@ -167,7 +164,7 @@ namespace Perspex.Media if (openFigure) { - this.context.EndFigure(false); + _context.EndFigure(false); } } } @@ -187,7 +184,7 @@ namespace Perspex.Media char c = (char)i; Command command = Command.None; - if (!Commands.TryGetValue(c, out command)) + if (!s_commands.TryGetValue(c, out command)) { if ((char.IsDigit(c) || c == '.' || c == '+' || c == '-') && (lastCommand != Command.None)) @@ -203,7 +200,7 @@ namespace Perspex.Media reader.Read(); return command; } - } + } private static double ReadDouble(TextReader reader) { diff --git a/src/Perspex.SceneGraph/Media/Pen.cs b/src/Perspex.SceneGraph/Media/Pen.cs index f0156bff63..b6ddef2121 100644 --- a/src/Perspex.SceneGraph/Media/Pen.cs +++ b/src/Perspex.SceneGraph/Media/Pen.cs @@ -1,13 +1,10 @@ - - - - +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. +using System.Collections.Generic; namespace Perspex.Media { - using System.Collections.Generic; - /// /// Describes how a stroke is drawn. /// diff --git a/src/Perspex.SceneGraph/Media/RectangleGeometry.cs b/src/Perspex.SceneGraph/Media/RectangleGeometry.cs index 540f0ff499..75ffe675bc 100644 --- a/src/Perspex.SceneGraph/Media/RectangleGeometry.cs +++ b/src/Perspex.SceneGraph/Media/RectangleGeometry.cs @@ -1,14 +1,11 @@ - - - - +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. +using Perspex.Platform; +using Splat; namespace Perspex.Media { - using Perspex.Platform; - using Splat; - /// /// Represents the geometry of a rectangle. /// diff --git a/src/Perspex.SceneGraph/Media/RotateTransform.cs b/src/Perspex.SceneGraph/Media/RotateTransform.cs index 058a1edbf9..030b61452a 100644 --- a/src/Perspex.SceneGraph/Media/RotateTransform.cs +++ b/src/Perspex.SceneGraph/Media/RotateTransform.cs @@ -1,13 +1,10 @@ - - - - +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. +using System; namespace Perspex.Media { - using System; - /// /// Rotates an . /// diff --git a/src/Perspex.SceneGraph/Media/SolidColorBrush.cs b/src/Perspex.SceneGraph/Media/SolidColorBrush.cs index 54ae52100c..b44935cb40 100644 --- a/src/Perspex.SceneGraph/Media/SolidColorBrush.cs +++ b/src/Perspex.SceneGraph/Media/SolidColorBrush.cs @@ -1,8 +1,5 @@ - - - - - +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. namespace Perspex.Media { diff --git a/src/Perspex.SceneGraph/Media/StreamGeometry.cs b/src/Perspex.SceneGraph/Media/StreamGeometry.cs index 387771c20b..ecbc5a1758 100644 --- a/src/Perspex.SceneGraph/Media/StreamGeometry.cs +++ b/src/Perspex.SceneGraph/Media/StreamGeometry.cs @@ -1,14 +1,11 @@ - - - - +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. +using Perspex.Platform; +using Splat; namespace Perspex.Media { - using Perspex.Platform; - using Splat; - /// /// Represents the geometry of an arbitrarily complex shape. /// diff --git a/src/Perspex.SceneGraph/Media/StreamGeometryContext.cs b/src/Perspex.SceneGraph/Media/StreamGeometryContext.cs index bd0fe4d3ad..7fa2723fe0 100644 --- a/src/Perspex.SceneGraph/Media/StreamGeometryContext.cs +++ b/src/Perspex.SceneGraph/Media/StreamGeometryContext.cs @@ -1,14 +1,11 @@ - - - - +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. +using System; +using Perspex.Platform; namespace Perspex.Media { - using System; - using Perspex.Platform; - /// /// Describes a geometry using drawing commands. /// @@ -20,7 +17,7 @@ namespace Perspex.Media /// TODO: This class is just a wrapper around IStreamGeometryContextImpl: is it needed? public class StreamGeometryContext : IDisposable { - private IStreamGeometryContextImpl impl; + private IStreamGeometryContextImpl _impl; /// /// Initializes a new instance of the class. @@ -28,7 +25,7 @@ namespace Perspex.Media /// The platform-specific implementation. public StreamGeometryContext(IStreamGeometryContextImpl impl) { - this.impl = impl; + _impl = impl; } /// @@ -43,7 +40,7 @@ namespace Perspex.Media /// public void ArcTo(Point point, Size size, double rotationAngle, bool isLargeArc, SweepDirection sweepDirection) { - this.impl.ArcTo(point, size, rotationAngle, isLargeArc, sweepDirection); + _impl.ArcTo(point, size, rotationAngle, isLargeArc, sweepDirection); } /// @@ -53,7 +50,7 @@ namespace Perspex.Media /// Whether the figure is filled. public void BeginFigure(Point startPoint, bool isFilled) { - this.impl.BeginFigure(startPoint, isFilled); + _impl.BeginFigure(startPoint, isFilled); } /// @@ -64,7 +61,7 @@ namespace Perspex.Media /// The destination point for the end of the curve. public void BezierTo(Point point1, Point point2, Point point3) { - this.impl.BezierTo(point1, point2, point3); + _impl.BezierTo(point1, point2, point3); } /// @@ -73,7 +70,7 @@ namespace Perspex.Media /// The destination point. public void LineTo(Point point) { - this.impl.LineTo(point); + _impl.LineTo(point); } /// @@ -82,7 +79,7 @@ namespace Perspex.Media /// Whether the figure is closed. public void EndFigure(bool isClosed) { - this.impl.EndFigure(isClosed); + _impl.EndFigure(isClosed); } /// @@ -90,7 +87,7 @@ namespace Perspex.Media /// public void Dispose() { - this.impl.Dispose(); + _impl.Dispose(); } } } diff --git a/src/Perspex.SceneGraph/Media/Stretch.cs b/src/Perspex.SceneGraph/Media/Stretch.cs index f83fe4d5fe..0bbcdad526 100644 --- a/src/Perspex.SceneGraph/Media/Stretch.cs +++ b/src/Perspex.SceneGraph/Media/Stretch.cs @@ -1,8 +1,5 @@ - - - - - +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. namespace Perspex.Media { diff --git a/src/Perspex.SceneGraph/Media/SweepDirection.cs b/src/Perspex.SceneGraph/Media/SweepDirection.cs index b7dc636d58..1f9a0b9966 100644 --- a/src/Perspex.SceneGraph/Media/SweepDirection.cs +++ b/src/Perspex.SceneGraph/Media/SweepDirection.cs @@ -1,8 +1,5 @@ - - - - - +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. namespace Perspex.Media { diff --git a/src/Perspex.SceneGraph/Media/TextAlignment.cs b/src/Perspex.SceneGraph/Media/TextAlignment.cs index 06835fbfc9..bb772832dd 100644 --- a/src/Perspex.SceneGraph/Media/TextAlignment.cs +++ b/src/Perspex.SceneGraph/Media/TextAlignment.cs @@ -1,8 +1,5 @@ - - - - - +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. namespace Perspex.Media { diff --git a/src/Perspex.SceneGraph/Media/TextHitTestResult.cs b/src/Perspex.SceneGraph/Media/TextHitTestResult.cs index 6ddc7387cc..7be427060e 100644 --- a/src/Perspex.SceneGraph/Media/TextHitTestResult.cs +++ b/src/Perspex.SceneGraph/Media/TextHitTestResult.cs @@ -1,8 +1,5 @@ - - - - - +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. namespace Perspex.Media { diff --git a/src/Perspex.SceneGraph/Media/TileBrush.cs b/src/Perspex.SceneGraph/Media/TileBrush.cs index 431849bb2d..64b1953d58 100644 --- a/src/Perspex.SceneGraph/Media/TileBrush.cs +++ b/src/Perspex.SceneGraph/Media/TileBrush.cs @@ -1,8 +1,5 @@ - - - - - +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. namespace Perspex.Media { diff --git a/src/Perspex.SceneGraph/Media/Transform.cs b/src/Perspex.SceneGraph/Media/Transform.cs index 5c49382c57..f4a4217d33 100644 --- a/src/Perspex.SceneGraph/Media/Transform.cs +++ b/src/Perspex.SceneGraph/Media/Transform.cs @@ -1,14 +1,11 @@ - - - - +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. +using System; +using Perspex.Animation; namespace Perspex.Media { - using System; - using Perspex.Animation; - /// /// Represents a transform on an . /// diff --git a/src/Perspex.SceneGraph/Media/TranslateTransform.cs b/src/Perspex.SceneGraph/Media/TranslateTransform.cs index d89345ba55..e1b97ebc4d 100644 --- a/src/Perspex.SceneGraph/Media/TranslateTransform.cs +++ b/src/Perspex.SceneGraph/Media/TranslateTransform.cs @@ -1,13 +1,10 @@ - - - - +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. +using System; namespace Perspex.Media { - using System; - /// /// Translates (moves) an . /// diff --git a/src/Perspex.SceneGraph/Media/VisualBrush.cs b/src/Perspex.SceneGraph/Media/VisualBrush.cs index c1eb156544..29e3b0d35c 100644 --- a/src/Perspex.SceneGraph/Media/VisualBrush.cs +++ b/src/Perspex.SceneGraph/Media/VisualBrush.cs @@ -1,8 +1,5 @@ - - - - - +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. namespace Perspex.Media { diff --git a/src/Perspex.SceneGraph/Origin.cs b/src/Perspex.SceneGraph/Origin.cs index 7955f29aa3..cc40c299dd 100644 --- a/src/Perspex.SceneGraph/Origin.cs +++ b/src/Perspex.SceneGraph/Origin.cs @@ -1,8 +1,5 @@ - - - - - +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. namespace Perspex { @@ -32,9 +29,9 @@ namespace Perspex /// public static readonly Origin Default = new Origin(0.5, 0.5, OriginUnit.Percent); - private Point point; + private Point _point; - private OriginUnit unit; + private OriginUnit _unit; /// /// Initializes a new instance of the struct. @@ -54,8 +51,8 @@ namespace Perspex /// The origin unit. public Origin(Point point, OriginUnit unit) { - this.point = point; - this.unit = unit; + _point = point; + _unit = unit; } /// @@ -63,7 +60,7 @@ namespace Perspex /// public Point Point { - get { return this.point; } + get { return _point; } } /// @@ -71,7 +68,7 @@ namespace Perspex /// public OriginUnit Unit { - get { return this.unit; } + get { return _unit; } } /// @@ -81,9 +78,9 @@ namespace Perspex /// The origin point in pixels. public Point ToPixels(Size size) { - return this.unit == OriginUnit.Pixels ? - this.point : - new Point(this.point.X * size.Width, this.point.Y * size.Height); + return _unit == OriginUnit.Pixels ? + _point : + new Point(_point.X * size.Width, _point.Y * size.Height); } } } diff --git a/src/Perspex.SceneGraph/Platform/IBitmapImpl.cs b/src/Perspex.SceneGraph/Platform/IBitmapImpl.cs index e2aba52fd6..714a0c2cac 100644 --- a/src/Perspex.SceneGraph/Platform/IBitmapImpl.cs +++ b/src/Perspex.SceneGraph/Platform/IBitmapImpl.cs @@ -1,8 +1,5 @@ - - - - - +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. namespace Perspex.Platform { diff --git a/src/Perspex.SceneGraph/Platform/IFormattedTextImpl.cs b/src/Perspex.SceneGraph/Platform/IFormattedTextImpl.cs index 1368a51b66..85a674c330 100644 --- a/src/Perspex.SceneGraph/Platform/IFormattedTextImpl.cs +++ b/src/Perspex.SceneGraph/Platform/IFormattedTextImpl.cs @@ -1,15 +1,12 @@ - - - - +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. +using System; +using System.Collections.Generic; +using Perspex.Media; namespace Perspex.Platform { - using System; - using System.Collections.Generic; - using Perspex.Media; - /// /// Defines the platform-specific interface for . /// diff --git a/src/Perspex.SceneGraph/Platform/IGeometryImpl.cs b/src/Perspex.SceneGraph/Platform/IGeometryImpl.cs index edcd379b53..5805f5ce7e 100644 --- a/src/Perspex.SceneGraph/Platform/IGeometryImpl.cs +++ b/src/Perspex.SceneGraph/Platform/IGeometryImpl.cs @@ -1,8 +1,5 @@ - - - - - +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. namespace Perspex.Platform { diff --git a/src/Perspex.SceneGraph/Platform/IPlatformRenderInterface.cs b/src/Perspex.SceneGraph/Platform/IPlatformRenderInterface.cs index 58c8f93c7a..a7ce8e2abf 100644 --- a/src/Perspex.SceneGraph/Platform/IPlatformRenderInterface.cs +++ b/src/Perspex.SceneGraph/Platform/IPlatformRenderInterface.cs @@ -1,13 +1,10 @@ - - - - +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. +using Perspex.Media; namespace Perspex.Platform { - using Perspex.Media; - /// /// Defines the main platform-specific interface for the rendering subsystem. /// diff --git a/src/Perspex.SceneGraph/Platform/IRenderTargetBitmapImpl.cs b/src/Perspex.SceneGraph/Platform/IRenderTargetBitmapImpl.cs index d45375f4d3..9e1b0e6cdd 100644 --- a/src/Perspex.SceneGraph/Platform/IRenderTargetBitmapImpl.cs +++ b/src/Perspex.SceneGraph/Platform/IRenderTargetBitmapImpl.cs @@ -1,13 +1,10 @@ - - - - +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. +using System; namespace Perspex.Platform { - using System; - /// /// Defines the platform-specific interface for a /// . diff --git a/src/Perspex.SceneGraph/Platform/IRenderer.cs b/src/Perspex.SceneGraph/Platform/IRenderer.cs index 66c7c872e4..e1e0f31e21 100644 --- a/src/Perspex.SceneGraph/Platform/IRenderer.cs +++ b/src/Perspex.SceneGraph/Platform/IRenderer.cs @@ -1,13 +1,10 @@ - - - - +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. +using System; namespace Perspex.Platform { - using System; - /// /// Defines a renderer. /// diff --git a/src/Perspex.SceneGraph/Platform/IStreamGeometryContextImpl.cs b/src/Perspex.SceneGraph/Platform/IStreamGeometryContextImpl.cs index ebf5199462..dd42bddd46 100644 --- a/src/Perspex.SceneGraph/Platform/IStreamGeometryContextImpl.cs +++ b/src/Perspex.SceneGraph/Platform/IStreamGeometryContextImpl.cs @@ -1,14 +1,11 @@ - - - - +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. +using System; +using Perspex.Media; namespace Perspex.Platform { - using System; - using Perspex.Media; - /// /// Describes a geometry using drawing commands. /// diff --git a/src/Perspex.SceneGraph/Platform/IStreamGeometryImpl.cs b/src/Perspex.SceneGraph/Platform/IStreamGeometryImpl.cs index 9eaba0c7d5..d1dabf2c89 100644 --- a/src/Perspex.SceneGraph/Platform/IStreamGeometryImpl.cs +++ b/src/Perspex.SceneGraph/Platform/IStreamGeometryImpl.cs @@ -1,8 +1,5 @@ - - - - - +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. namespace Perspex.Platform { diff --git a/src/Perspex.SceneGraph/Point.cs b/src/Perspex.SceneGraph/Point.cs index 9c25cd0c8b..e2ceadd7a8 100644 --- a/src/Perspex.SceneGraph/Point.cs +++ b/src/Perspex.SceneGraph/Point.cs @@ -1,13 +1,10 @@ - - - - +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. +using System.Globalization; namespace Perspex { - using System.Globalization; - /// /// Defines a point. /// @@ -16,12 +13,12 @@ namespace Perspex /// /// The X position. /// - private double x; + private double _x; /// /// The Y position. /// - private double y; + private double _y; /// /// Initializes a new instance of the structure. @@ -30,8 +27,8 @@ namespace Perspex /// The Y position. public Point(double x, double y) { - this.x = x; - this.y = y; + _x = x; + _y = y; } /// @@ -39,7 +36,7 @@ namespace Perspex /// public double X { - get { return this.x; } + get { return _x; } } /// @@ -47,7 +44,7 @@ namespace Perspex /// public double Y { - get { return this.y; } + get { return _y; } } /// @@ -56,7 +53,7 @@ namespace Perspex /// The point. public static implicit operator Vector(Point p) { - return new Vector(p.x, p.y); + return new Vector(p._x, p._y); } /// @@ -66,7 +63,7 @@ namespace Perspex /// The negated point. public static Point operator -(Point a) { - return new Point(-a.x, -a.y); + return new Point(-a._x, -a._y); } /// @@ -99,7 +96,7 @@ namespace Perspex /// 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); + return new Point(a._x + b._x, a._y + b._y); } /// @@ -110,7 +107,7 @@ namespace Perspex /// 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); + return new Point(a._x + b.X, a._y + b.Y); } /// @@ -121,7 +118,7 @@ namespace Perspex /// 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); + return new Point(a._x - b._x, a._y - b._y); } /// @@ -132,7 +129,7 @@ namespace Perspex /// 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); + return new Point(a._x - b.X, a._y - b.Y); } /// @@ -175,8 +172,8 @@ namespace Perspex unchecked { int hash = 17; - hash = (hash * 23) + this.x.GetHashCode(); - hash = (hash * 23) + this.y.GetHashCode(); + hash = (hash * 23) + _x.GetHashCode(); + hash = (hash * 23) + _y.GetHashCode(); return hash; } } @@ -187,7 +184,7 @@ namespace Perspex /// The string representation of the point. public override string ToString() { - return string.Format(CultureInfo.InvariantCulture, "{0}, {1}", this.x, this.y); + return string.Format(CultureInfo.InvariantCulture, "{0}, {1}", _x, _y); } /// @@ -197,7 +194,7 @@ namespace Perspex /// The new point. public Point WithX(double x) { - return new Point(x, this.y); + return new Point(x, _y); } /// @@ -207,7 +204,7 @@ namespace Perspex /// The new point. public Point WithY(double y) { - return new Point(this.x, y); + return new Point(_x, y); } } } diff --git a/src/Perspex.SceneGraph/Properties/AssemblyInfo.cs b/src/Perspex.SceneGraph/Properties/AssemblyInfo.cs index 346eaff430..b12ae9e9d4 100644 --- a/src/Perspex.SceneGraph/Properties/AssemblyInfo.cs +++ b/src/Perspex.SceneGraph/Properties/AssemblyInfo.cs @@ -1,8 +1,5 @@ - - - - - +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. using System.Reflection; diff --git a/src/Perspex.SceneGraph/Rect.cs b/src/Perspex.SceneGraph/Rect.cs index f07475b1c3..c261c26c20 100644 --- a/src/Perspex.SceneGraph/Rect.cs +++ b/src/Perspex.SceneGraph/Rect.cs @@ -1,14 +1,11 @@ - - - - +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. +using System; +using System.Globalization; namespace Perspex { - using System; - using System.Globalization; - /// /// Defines a rectangle. /// @@ -17,22 +14,22 @@ namespace Perspex /// /// The X position. /// - private double x; + private double _x; /// /// The Y position. /// - private double y; + private double _y; /// /// The width. /// - private double width; + private double _width; /// /// The height. /// - private double height; + private double _height; /// /// Initializes a new instance of the structure. @@ -43,10 +40,10 @@ namespace Perspex /// The height. public Rect(double x, double y, double width, double height) { - this.x = x; - this.y = y; - this.width = width; - this.height = height; + _x = x; + _y = y; + _width = width; + _height = height; } /// @@ -55,10 +52,10 @@ namespace Perspex /// The size of the rectangle. public Rect(Size size) { - this.x = 0; - this.y = 0; - this.width = size.Width; - this.height = size.Height; + _x = 0; + _y = 0; + _width = size.Width; + _height = size.Height; } /// @@ -68,10 +65,10 @@ namespace Perspex /// The size of the rectangle. public Rect(Point position, Size size) { - this.x = position.X; - this.y = position.Y; - this.width = size.Width; - this.height = size.Height; + _x = position.X; + _y = position.Y; + _width = size.Width; + _height = size.Height; } /// @@ -81,10 +78,10 @@ namespace Perspex /// The bottom right position of the rectangle. public Rect(Point topLeft, Point bottomRight) { - this.x = topLeft.X; - this.y = topLeft.Y; - this.width = bottomRight.X - topLeft.X; - this.height = bottomRight.Y - topLeft.Y; + _x = topLeft.X; + _y = topLeft.Y; + _width = bottomRight.X - topLeft.X; + _height = bottomRight.Y - topLeft.Y; } /// @@ -92,7 +89,7 @@ namespace Perspex /// public double X { - get { return this.x; } + get { return _x; } } /// @@ -100,7 +97,7 @@ namespace Perspex /// public double Y { - get { return this.y; } + get { return _y; } } /// @@ -108,7 +105,7 @@ namespace Perspex /// public double Width { - get { return this.width; } + get { return _width; } } /// @@ -116,7 +113,7 @@ namespace Perspex /// public double Height { - get { return this.height; } + get { return _height; } } /// @@ -124,7 +121,7 @@ namespace Perspex /// public Point Position { - get { return new Point(this.x, this.y); } + get { return new Point(_x, _y); } } /// @@ -132,7 +129,7 @@ namespace Perspex /// public Size Size { - get { return new Size(this.width, this.height); } + get { return new Size(_width, _height); } } /// @@ -140,7 +137,7 @@ namespace Perspex /// public double Right { - get { return this.x + this.width; } + get { return _x + _width; } } /// @@ -148,7 +145,7 @@ namespace Perspex /// public double Bottom { - get { return this.y + this.height; } + get { return _y + _height; } } /// @@ -156,7 +153,7 @@ namespace Perspex /// public Point TopLeft { - get { return new Point(this.x, this.y); } + get { return new Point(_x, _y); } } /// @@ -164,7 +161,7 @@ namespace Perspex /// public Point TopRight { - get { return new Point(this.Right, this.y); } + get { return new Point(this.Right, _y); } } /// @@ -172,7 +169,7 @@ namespace Perspex /// public Point BottomLeft { - get { return new Point(this.x, this.Bottom); } + get { return new Point(_x, this.Bottom); } } /// @@ -188,7 +185,7 @@ namespace Perspex /// public Point Center { - get { return new Point(this.x + (this.width / 2), this.y + (this.height / 2)); } + get { return new Point(_x + (_width / 2), _y + (_height / 2)); } } /// @@ -196,7 +193,7 @@ namespace Perspex /// public bool IsEmpty { - get { return this.width == 0 && this.height == 0; } + get { return _width == 0 && _height == 0; } } /// @@ -229,10 +226,10 @@ namespace Perspex /// The scaled rectangle. public static Rect operator *(Rect rect, Vector scale) { - double centerX = rect.x + (rect.width / 2); - double centerY = rect.y + (rect.height / 2); - double width = rect.width * scale.X; - double height = rect.height * scale.Y; + double centerX = rect._x + (rect._width / 2); + double centerY = rect._y + (rect._height / 2); + double width = rect._width * scale.X; + double height = rect._height * scale.Y; return new Rect( centerX - (width / 2), centerY - (height / 2), @@ -259,10 +256,10 @@ namespace Perspex /// The scaled rectangle. public static Rect operator /(Rect rect, Vector scale) { - double centerX = rect.x + (rect.width / 2); - double centerY = rect.y + (rect.height / 2); - double width = rect.width / scale.X; - double height = rect.height / scale.Y; + double centerX = rect._x + (rect._width / 2); + double centerY = rect._y + (rect._height / 2); + double width = rect._width / scale.X; + double height = rect._height / scale.Y; return new Rect( centerX - (width / 2), centerY - (height / 2), @@ -277,8 +274,8 @@ namespace Perspex /// true if the point is in the bounds of the rectangle; otherwise false. public bool Contains(Point p) { - return p.X >= this.x && p.X < this.x + this.width && - p.Y >= this.y && p.Y < this.y + this.height; + return p.X >= _x && p.X < _x + _width && + p.Y >= _y && p.Y < _y + _height; } /// @@ -289,10 +286,10 @@ namespace Perspex public Rect CenterIn(Rect rect) { return new Rect( - this.x + ((this.width - rect.width) / 2), - this.y + ((this.height - rect.height) / 2), - rect.width, - rect.height); + _x + ((_width - rect._width) / 2), + _y + ((_height - rect._height) / 2), + rect._width, + rect._height); } /// @@ -313,7 +310,7 @@ namespace Perspex public Rect Inflate(Thickness thickness) { return new Rect( - new Point(this.x - thickness.Left, this.y - thickness.Top), + new Point(_x - thickness.Left, _y - thickness.Top), this.Size.Inflate(thickness)); } @@ -337,7 +334,7 @@ namespace Perspex public Rect Deflate(Thickness thickness) { return new Rect( - new Point(this.x + thickness.Left, this.y + thickness.Top), + new Point(_x + thickness.Left, _y + thickness.Top), this.Size.Deflate(thickness)); } @@ -380,8 +377,8 @@ namespace Perspex /// The intersection. public Rect Intersect(Rect rect) { - double x = Math.Max(this.x, rect.x); - double y = Math.Max(this.y, rect.y); + double x = Math.Max(_x, rect._x); + double y = Math.Max(_y, rect._y); double width = Math.Min(this.Right, rect.Right) - x; double height = Math.Min(this.Bottom, rect.Bottom) - y; @@ -408,10 +405,10 @@ namespace Perspex return string.Format( CultureInfo.InvariantCulture, "{0}, {1}, {2}, {3}", - this.x, - this.y, - this.width, - this.height); + _x, + _y, + _width, + _height); } } } diff --git a/src/Perspex.SceneGraph/RelativeRect.cs b/src/Perspex.SceneGraph/RelativeRect.cs index b2f5a3d9f5..37eb5b3b25 100644 --- a/src/Perspex.SceneGraph/RelativeRect.cs +++ b/src/Perspex.SceneGraph/RelativeRect.cs @@ -1,8 +1,5 @@ - - - - - +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. namespace Perspex { diff --git a/src/Perspex.SceneGraph/Rendering/IRenderManager.cs b/src/Perspex.SceneGraph/Rendering/IRenderManager.cs index 4be752581c..cb03a8a19a 100644 --- a/src/Perspex.SceneGraph/Rendering/IRenderManager.cs +++ b/src/Perspex.SceneGraph/Rendering/IRenderManager.cs @@ -1,14 +1,11 @@ - - - - +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. +using System; +using System.Reactive; namespace Perspex.Rendering { - using System; - using System.Reactive; - /// /// Defines the interface for a . /// diff --git a/src/Perspex.SceneGraph/Rendering/IRenderRoot.cs b/src/Perspex.SceneGraph/Rendering/IRenderRoot.cs index 587be6763c..a6f5846f75 100644 --- a/src/Perspex.SceneGraph/Rendering/IRenderRoot.cs +++ b/src/Perspex.SceneGraph/Rendering/IRenderRoot.cs @@ -1,13 +1,10 @@ - - - - +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. +using Perspex.Platform; namespace Perspex.Rendering { - using Perspex.Platform; - /// /// Represents the root of a renderable tree. /// diff --git a/src/Perspex.SceneGraph/Rendering/RenderManager.cs b/src/Perspex.SceneGraph/Rendering/RenderManager.cs index 29c7217794..44737db9c1 100644 --- a/src/Perspex.SceneGraph/Rendering/RenderManager.cs +++ b/src/Perspex.SceneGraph/Rendering/RenderManager.cs @@ -1,30 +1,27 @@ - - - - +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. +using System; +using System.Reactive; +using System.Reactive.Subjects; namespace Perspex.Rendering { - using System; - using System.Reactive; - using System.Reactive.Subjects; - /// /// Schedules the rendering of a tree. /// public class RenderManager : IRenderManager { - private Subject renderNeeded = new Subject(); + private Subject _renderNeeded = new Subject(); - private bool renderQueued; + private bool _renderQueued; /// /// Gets an observable that is fired whenever a render is required. /// public IObservable RenderNeeded { - get { return this.renderNeeded; } + get { return _renderNeeded; } } /// @@ -32,7 +29,7 @@ namespace Perspex.Rendering /// public bool RenderQueued { - get { return this.renderQueued; } + get { return _renderQueued; } } /// @@ -41,10 +38,10 @@ namespace Perspex.Rendering /// The visual. public void InvalidateRender(IVisual visual) { - if (!this.renderQueued) + if (!_renderQueued) { - this.renderNeeded.OnNext(Unit.Default); - this.renderQueued = true; + _renderNeeded.OnNext(Unit.Default); + _renderQueued = true; } } @@ -53,7 +50,7 @@ namespace Perspex.Rendering /// public void RenderFinished() { - this.renderQueued = false; + _renderQueued = false; } } } diff --git a/src/Perspex.SceneGraph/Rendering/RendererBase.cs b/src/Perspex.SceneGraph/Rendering/RendererBase.cs index 5522925e03..c2ffbf13bf 100644 --- a/src/Perspex.SceneGraph/Rendering/RendererBase.cs +++ b/src/Perspex.SceneGraph/Rendering/RendererBase.cs @@ -1,16 +1,13 @@ - - - - +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. +using System; +using System.Linq; +using Perspex.Media; +using Perspex.Platform; namespace Perspex.Rendering { - using System; - using System.Linq; - using Perspex.Media; - using Perspex.Platform; - /// /// Base class for standard renderers. /// diff --git a/src/Perspex.SceneGraph/Size.cs b/src/Perspex.SceneGraph/Size.cs index 7a76a5c6df..de4fc31399 100644 --- a/src/Perspex.SceneGraph/Size.cs +++ b/src/Perspex.SceneGraph/Size.cs @@ -1,14 +1,11 @@ - - - - +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. +using System; +using System.Globalization; namespace Perspex { - using System; - using System.Globalization; - /// /// Defines a size. /// @@ -22,12 +19,12 @@ namespace Perspex /// /// The width. /// - private double width; + private double _width; /// /// The height. /// - private double height; + private double _height; /// /// Initializes a new instance of the structure. @@ -36,8 +33,8 @@ namespace Perspex /// The height. public Size(double width, double height) { - this.width = width; - this.height = height; + _width = width; + _height = height; } /// @@ -45,7 +42,7 @@ namespace Perspex /// public double Width { - get { return this.width; } + get { return _width; } } /// @@ -53,7 +50,7 @@ namespace Perspex /// public double Height { - get { return this.height; } + get { return _height; } } /// @@ -64,7 +61,7 @@ namespace Perspex /// True if the sizes are equal; otherwise false. public static bool operator ==(Size left, Size right) { - return left.width == right.width && left.height == right.height; + return left._width == right._width && left._height == right._height; } /// @@ -86,7 +83,7 @@ namespace Perspex /// The scaled size. public static Size operator *(Size size, Vector scale) { - return new Size(size.width * scale.X, size.height * scale.Y); + return new Size(size._width * scale.X, size._height * scale.Y); } /// @@ -97,7 +94,7 @@ namespace Perspex /// The scaled size. public static Size operator /(Size size, Vector scale) { - return new Size(size.width / scale.X, size.height / scale.Y); + return new Size(size._width / scale.X, size._height / scale.Y); } /// @@ -108,8 +105,8 @@ namespace Perspex public Size Constrain(Size constraint) { return new Size( - Math.Min(this.width, constraint.width), - Math.Min(this.height, constraint.height)); + Math.Min(_width, constraint._width), + Math.Min(_height, constraint._height)); } /// @@ -121,8 +118,8 @@ namespace Perspex public Size Deflate(Thickness thickness) { return new Size( - Math.Max(0, this.width - thickness.Left - thickness.Right), - Math.Max(0, this.height - thickness.Top - thickness.Bottom)); + Math.Max(0, _width - thickness.Left - thickness.Right), + Math.Max(0, _height - thickness.Top - thickness.Bottom)); } /// @@ -166,8 +163,8 @@ namespace Perspex public Size Inflate(Thickness thickness) { return new Size( - this.width + thickness.Left + thickness.Right, - this.height + thickness.Top + thickness.Bottom); + _width + thickness.Left + thickness.Right, + _height + thickness.Top + thickness.Bottom); } /// @@ -177,7 +174,7 @@ namespace Perspex /// The new . public Size WithWidth(double width) { - return new Size(width, this.height); + return new Size(width, _height); } /// @@ -187,7 +184,7 @@ namespace Perspex /// The new . public Size WithHeight(double height) { - return new Size(this.width, height); + return new Size(_width, height); } /// @@ -196,7 +193,7 @@ namespace Perspex /// The string representation of the size. public override string ToString() { - return string.Format(CultureInfo.InvariantCulture, "{0}, {1}", this.width, this.height); + return string.Format(CultureInfo.InvariantCulture, "{0}, {1}", _width, _height); } } } diff --git a/src/Perspex.SceneGraph/Thickness.cs b/src/Perspex.SceneGraph/Thickness.cs index 3a1895865b..88f16dc669 100644 --- a/src/Perspex.SceneGraph/Thickness.cs +++ b/src/Perspex.SceneGraph/Thickness.cs @@ -1,14 +1,11 @@ - - - - +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. +using System; +using System.Linq; namespace Perspex { - using System; - using System.Linq; - /// /// Describes the thickness of a frame around a rectangle. /// @@ -17,22 +14,22 @@ namespace Perspex /// /// The thickness on the left. /// - private double left; + private double _left; /// /// The thickness on the top. /// - private double top; + private double _top; /// /// The thickness on the right. /// - private double right; + private double _right; /// /// The thickness on the bottom. /// - private double bottom; + private double _bottom; /// /// Initializes a new instance of the structure. @@ -42,7 +39,7 @@ namespace Perspex { Contract.Requires(uniformLength >= 0); - this.left = this.top = this.right = this.bottom = uniformLength; + _left = _top = _right = _bottom = uniformLength; } /// @@ -55,8 +52,8 @@ namespace Perspex Contract.Requires(horizontal >= 0); Contract.Requires(vertical >= 0); - this.left = this.right = horizontal; - this.top = this.bottom = vertical; + _left = _right = horizontal; + _top = _bottom = vertical; } /// @@ -73,10 +70,10 @@ namespace Perspex Contract.Requires(right >= 0); Contract.Requires(bottom >= 0); - this.left = left; - this.top = top; - this.right = right; - this.bottom = bottom; + _left = left; + _top = top; + _right = right; + _bottom = bottom; } /// @@ -84,7 +81,7 @@ namespace Perspex /// public double Left { - get { return this.left; } + get { return _left; } } /// @@ -92,7 +89,7 @@ namespace Perspex /// public double Top { - get { return this.top; } + get { return _top; } } /// @@ -100,7 +97,7 @@ namespace Perspex /// public double Right { - get { return this.right; } + get { return _right; } } /// @@ -108,7 +105,7 @@ namespace Perspex /// public double Bottom { - get { return this.bottom; } + get { return _bottom; } } /// @@ -231,7 +228,7 @@ namespace Perspex /// The string representation of the thickness. public override string ToString() { - return string.Format("{0},{1},{2},{3}", this.left, this.top, this.right, this.bottom); + return string.Format("{0},{1},{2},{3}", _left, _top, _right, _bottom); } } } diff --git a/src/Perspex.SceneGraph/Vector.cs b/src/Perspex.SceneGraph/Vector.cs index 3ebf963eec..c8a5e3dc07 100644 --- a/src/Perspex.SceneGraph/Vector.cs +++ b/src/Perspex.SceneGraph/Vector.cs @@ -1,14 +1,11 @@ - - - - +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. +using System; +using System.Globalization; namespace Perspex { - using System; - using System.Globalization; - /// /// Defines a vector. /// @@ -17,12 +14,12 @@ namespace Perspex /// /// The X vector. /// - private double x; + private double _x; /// /// The Y vector. /// - private double y; + private double _y; /// /// Initializes a new instance of the structure. @@ -31,8 +28,8 @@ namespace Perspex /// The Y vector. public Vector(double x, double y) { - this.x = x; - this.y = y; + _x = x; + _y = y; } /// @@ -40,7 +37,7 @@ namespace Perspex /// public double X { - get { return this.x; } + get { return _x; } } /// @@ -48,7 +45,7 @@ namespace Perspex /// public double Y { - get { return this.y; } + get { return _y; } } /// @@ -57,7 +54,7 @@ namespace Perspex /// The vector. public static explicit operator Point(Vector a) { - return new Point(a.x, a.y); + return new Point(a._x, a._y); } /// @@ -67,7 +64,7 @@ namespace Perspex /// The negated vector. public static Vector operator -(Vector a) { - return new Vector(-a.x, -a.y); + return new Vector(-a._x, -a._y); } /// @@ -78,7 +75,7 @@ namespace Perspex /// 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); + return new Vector(a._x + b._x, a._y + b._y); } /// @@ -89,7 +86,7 @@ namespace Perspex /// 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); + return new Vector(a._x - b._x, a._y - b._y); } /// @@ -98,7 +95,7 @@ namespace Perspex /// The string representation of the point. public override string ToString() { - return string.Format(CultureInfo.InvariantCulture, "{0}, {1}", this.x, this.y); + return string.Format(CultureInfo.InvariantCulture, "{0}, {1}", _x, _y); } /// @@ -108,7 +105,7 @@ namespace Perspex /// The new vector. public Vector WithX(double x) { - return new Vector(x, this.y); + return new Vector(x, _y); } /// @@ -118,7 +115,7 @@ namespace Perspex /// The new vector. public Vector WithY(double y) { - return new Vector(this.x, y); + return new Vector(_x, y); } } } diff --git a/src/Perspex.SceneGraph/Visual.cs b/src/Perspex.SceneGraph/Visual.cs index 1d0d172188..6676243693 100644 --- a/src/Perspex.SceneGraph/Visual.cs +++ b/src/Perspex.SceneGraph/Visual.cs @@ -1,25 +1,22 @@ - - - - - +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. + +using System; +using System.Collections.Generic; +using System.Collections.Specialized; +using System.Linq; +using System.Reactive.Linq; +using Perspex.Animation; +using Perspex.Collections; +using Perspex.Media; +using Perspex.Platform; +using Perspex.Rendering; +using Perspex.VisualTree; +using Serilog; +using Serilog.Core.Enrichers; namespace Perspex { - using System; - using System.Collections.Generic; - using System.Collections.Specialized; - using System.Linq; - using System.Reactive.Linq; - using Perspex.Animation; - using Perspex.Collections; - using Perspex.Media; - using Perspex.Platform; - using Perspex.Rendering; - using Perspex.VisualTree; - using Serilog; - using Serilog.Core.Enrichers; - /// /// Base class for controls that provides rendering and related visual properties. /// @@ -76,22 +73,22 @@ namespace Perspex /// /// Holds the children of the visual. /// - private PerspexList visualChildren; + private PerspexList _visualChildren; /// /// Holds the parent of the visual. /// - private Visual visualParent; + private Visual _visualParent; /// /// Whether the element is attached to the visual tree. /// - private bool isAttachedToVisualTree; + private bool _isAttachedToVisualTree; /// /// The logger for visual-level events. /// - private ILogger visualLogger; + private ILogger _visualLogger; /// /// Initializes static members of the class. @@ -108,15 +105,15 @@ namespace Perspex /// public Visual() { - this.visualLogger = Log.ForContext(new[] + _visualLogger = Log.ForContext(new[] { new PropertyEnricher("Area", "Visual"), new PropertyEnricher("SourceContext", this.GetType()), new PropertyEnricher("Id", this.GetHashCode()), }); - this.visualChildren = new PerspexList(); - this.visualChildren.CollectionChanged += this.VisualChildrenChanged; + _visualChildren = new PerspexList(); + _visualChildren.CollectionChanged += this.VisualChildrenChanged; } /// @@ -195,7 +192,7 @@ namespace Perspex /// bool IVisual.IsAttachedToVisualTree { - get { return this.isAttachedToVisualTree; } + get { return _isAttachedToVisualTree; } } /// @@ -203,7 +200,7 @@ namespace Perspex /// IPerspexReadOnlyList IVisual.VisualChildren { - get { return this.visualChildren; } + get { return _visualChildren; } } /// @@ -213,7 +210,7 @@ namespace Perspex { get { - return this.visualParent; + return _visualParent; } } @@ -288,7 +285,7 @@ namespace Perspex { Contract.Requires(visual != null); - this.visualChildren.Add(visual); + _visualChildren.Add(visual); } /// @@ -299,7 +296,7 @@ namespace Perspex { Contract.Requires(visuals != null); - this.visualChildren.AddRange(visuals); + _visualChildren.AddRange(visuals); } /// @@ -307,7 +304,7 @@ namespace Perspex /// protected void ClearVisualChildren() { - this.visualChildren.Clear(); + _visualChildren.Clear(); } /// @@ -318,7 +315,7 @@ namespace Perspex { Contract.Requires(visual != null); - this.visualChildren.Remove(visual); + _visualChildren.Remove(visual); } /// @@ -331,7 +328,7 @@ namespace Perspex foreach (var v in visuals) { - this.visualChildren.Remove(v); + _visualChildren.Remove(v); } } @@ -432,9 +429,9 @@ namespace Perspex /// The visual parent. private void SetVisualParent(Visual value) { - if (this.visualParent != value) + if (_visualParent != value) { - var old = this.visualParent; + var old = _visualParent; var oldRoot = this.GetVisualAncestors().OfType().FirstOrDefault(); var newRoot = default(IRenderRoot); @@ -443,7 +440,7 @@ namespace Perspex newRoot = value.GetSelfAndVisualAncestors().OfType().FirstOrDefault(); } - this.visualParent = value; + _visualParent = value; if (oldRoot != null) { @@ -458,7 +455,7 @@ namespace Perspex } /// - /// Called when the collection changes. + /// Called when the collection changes. /// /// The sender. /// The event args. @@ -493,14 +490,14 @@ namespace Perspex /// The root of the visual tree. private void NotifyAttachedToVisualTree(IRenderRoot root) { - this.visualLogger.Verbose("Attached to visual tree"); + _visualLogger.Verbose("Attached to visual tree"); - this.isAttachedToVisualTree = true; + _isAttachedToVisualTree = true; this.OnAttachedToVisualTree(root); - if (this.visualChildren != null) + if (_visualChildren != null) { - foreach (Visual child in this.visualChildren.OfType()) + foreach (Visual child in _visualChildren.OfType()) { child.NotifyAttachedToVisualTree(root); } @@ -514,14 +511,14 @@ namespace Perspex /// The root of the visual tree. private void NotifyDetachedFromVisualTree(IRenderRoot root) { - this.visualLogger.Verbose("Detached from visual tree"); + _visualLogger.Verbose("Detached from visual tree"); - this.isAttachedToVisualTree = false; + _isAttachedToVisualTree = false; this.OnDetachedFromVisualTree(root); - if (this.visualChildren != null) + if (_visualChildren != null) { - foreach (Visual child in this.visualChildren.OfType()) + foreach (Visual child in _visualChildren.OfType()) { child.NotifyDetachedFromVisualTree(root); } diff --git a/src/Perspex.SceneGraph/VisualTree/BoundsTracker.cs b/src/Perspex.SceneGraph/VisualTree/BoundsTracker.cs index 29608e9229..eea2711c69 100644 --- a/src/Perspex.SceneGraph/VisualTree/BoundsTracker.cs +++ b/src/Perspex.SceneGraph/VisualTree/BoundsTracker.cs @@ -1,16 +1,13 @@ - - - - +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. +using System; +using System.Collections.Generic; +using System.Linq; +using System.Reactive.Linq; namespace Perspex.VisualTree { - using System; - using System.Collections.Generic; - using System.Linq; - using System.Reactive.Linq; - /// /// Tracks the bounds of a control. /// diff --git a/src/Perspex.SceneGraph/VisualTree/IHostedVisualTreeRoot.cs b/src/Perspex.SceneGraph/VisualTree/IHostedVisualTreeRoot.cs index 8c4d9a428e..60021f1c8d 100644 --- a/src/Perspex.SceneGraph/VisualTree/IHostedVisualTreeRoot.cs +++ b/src/Perspex.SceneGraph/VisualTree/IHostedVisualTreeRoot.cs @@ -1,8 +1,5 @@ - - - - - +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. namespace Perspex.VisualTree { diff --git a/src/Perspex.SceneGraph/VisualTree/IVisualTreeHost.cs b/src/Perspex.SceneGraph/VisualTree/IVisualTreeHost.cs index f12fae9c3e..b1647773d2 100644 --- a/src/Perspex.SceneGraph/VisualTree/IVisualTreeHost.cs +++ b/src/Perspex.SceneGraph/VisualTree/IVisualTreeHost.cs @@ -1,8 +1,5 @@ - - - - - +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. namespace Perspex.VisualTree { diff --git a/src/Perspex.SceneGraph/VisualTree/TransformedBounds.cs b/src/Perspex.SceneGraph/VisualTree/TransformedBounds.cs index f055bba491..96db2d98c3 100644 --- a/src/Perspex.SceneGraph/VisualTree/TransformedBounds.cs +++ b/src/Perspex.SceneGraph/VisualTree/TransformedBounds.cs @@ -1,8 +1,5 @@ - - - - - +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. namespace Perspex.VisualTree { @@ -37,6 +34,6 @@ namespace Perspex.VisualTree /// /// Gets the control's transform. /// - public Matrix Transform { get; } + public Matrix Transform { get; } } } diff --git a/src/Perspex.SceneGraph/VisualTree/VisualExtensions.cs b/src/Perspex.SceneGraph/VisualTree/VisualExtensions.cs index f71369a726..14b24ba041 100644 --- a/src/Perspex.SceneGraph/VisualTree/VisualExtensions.cs +++ b/src/Perspex.SceneGraph/VisualTree/VisualExtensions.cs @@ -1,15 +1,12 @@ - - - - +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. +using System; +using System.Collections.Generic; +using System.Linq; namespace Perspex.VisualTree { - using System; - using System.Collections.Generic; - using System.Linq; - /// /// Provides extension methods for working with visual tree. /// diff --git a/src/Perspex.Styling/ILogical.cs b/src/Perspex.Styling/ILogical.cs index 7dd5a18da6..a62e309021 100644 --- a/src/Perspex.Styling/ILogical.cs +++ b/src/Perspex.Styling/ILogical.cs @@ -1,13 +1,10 @@ - - - - +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. +using Perspex.Collections; namespace Perspex { - using Perspex.Collections; - /// /// Represents a node in the logical tree. /// @@ -21,6 +18,6 @@ namespace Perspex /// /// Gets the logical children. /// - IPerspexReadOnlyList LogicalChildren { get; } + IPerspexReadOnlyList LogicalChildren { get; } } } diff --git a/src/Perspex.Styling/LogicalTree/LogicalExtensions.cs b/src/Perspex.Styling/LogicalTree/LogicalExtensions.cs index ba86e96902..d134330036 100644 --- a/src/Perspex.Styling/LogicalTree/LogicalExtensions.cs +++ b/src/Perspex.Styling/LogicalTree/LogicalExtensions.cs @@ -1,15 +1,12 @@ - - - - +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. +using System; +using System.Collections.Generic; +using System.Linq; namespace Perspex.LogicalTree { - using System; - using System.Collections.Generic; - using System.Linq; - public static class LogicalExtensions { public static IEnumerable GetLogicalAncestors(this ILogical logical) diff --git a/src/Perspex.Styling/Properties/AssemblyInfo.cs b/src/Perspex.Styling/Properties/AssemblyInfo.cs index d164c14165..3dbe71ef35 100644 --- a/src/Perspex.Styling/Properties/AssemblyInfo.cs +++ b/src/Perspex.Styling/Properties/AssemblyInfo.cs @@ -1,8 +1,5 @@ - - - - - +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. using System.Reflection; diff --git a/src/Perspex.Styling/Styling/Classes.cs b/src/Perspex.Styling/Styling/Classes.cs index 385bdad786..ada5c2520b 100644 --- a/src/Perspex.Styling/Styling/Classes.cs +++ b/src/Perspex.Styling/Styling/Classes.cs @@ -1,52 +1,49 @@ - - - - +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.Specialized; +using System.Linq; +using System.Reactive; +using System.Reactive.Subjects; namespace Perspex.Styling { - using System; - using System.Collections; - using System.Collections.Generic; - using System.Collections.Specialized; - using System.Linq; - using System.Reactive; - using System.Reactive.Subjects; - public class Classes : ICollection, INotifyCollectionChanged { - private List inner; + private List _inner; - private Subject beforeChanged + private Subject _beforeChanged = new Subject(); - private Subject changed + private Subject _changed = new Subject(); - private Subject afterChanged + private Subject _afterChanged = new Subject(); public Classes() { - this.inner = new List(); + _inner = new List(); } public Classes(params string[] classes) { - this.inner = new List(classes); + _inner = new List(classes); } public Classes(IEnumerable classes) { - this.inner = new List(classes); + _inner = new List(classes); } public event NotifyCollectionChangedEventHandler CollectionChanged; public int Count { - get { return this.inner.Count; } + get { return _inner.Count; } } public bool IsReadOnly @@ -56,17 +53,17 @@ namespace Perspex.Styling public IObservable BeforeChanged { - get { return this.beforeChanged; } + get { return _beforeChanged; } } public IObservable Changed { - get { return this.changed; } + get { return _changed; } } public IObservable AfterChanged { - get { return this.afterChanged; } + get { return _afterChanged; } } public void Add(string item) @@ -81,14 +78,14 @@ namespace Perspex.Styling public void Add(IEnumerable items) { - items = items.Except(this.inner); + items = items.Except(_inner); NotifyCollectionChangedEventArgs e = new NotifyCollectionChangedEventArgs( NotifyCollectionChangedAction.Add, items); - this.beforeChanged.OnNext(e); - this.inner.AddRange(items); + _beforeChanged.OnNext(e); + _inner.AddRange(items); this.RaiseChanged(e); } @@ -97,24 +94,24 @@ namespace Perspex.Styling NotifyCollectionChangedEventArgs e = new NotifyCollectionChangedEventArgs( NotifyCollectionChangedAction.Reset); - this.beforeChanged.OnNext(e); - this.inner.Clear(); + _beforeChanged.OnNext(e); + _inner.Clear(); this.RaiseChanged(e); } public bool Contains(string item) { - return this.inner.Contains(item); + return _inner.Contains(item); } public void CopyTo(string[] array, int arrayIndex) { - this.inner.CopyTo(array, arrayIndex); + _inner.CopyTo(array, arrayIndex); } public IEnumerator GetEnumerator() { - return this.inner.GetEnumerator(); + return _inner.GetEnumerator(); } public override string ToString() @@ -124,7 +121,7 @@ namespace Perspex.Styling IEnumerator IEnumerable.GetEnumerator() { - return this.inner.GetEnumerator(); + return _inner.GetEnumerator(); } public bool Remove(string item) @@ -139,7 +136,7 @@ namespace Perspex.Styling public bool Remove(IEnumerable items) { - items = items.Intersect(this.inner); + items = items.Intersect(_inner); if (items.Any()) { @@ -147,11 +144,11 @@ namespace Perspex.Styling NotifyCollectionChangedAction.Remove, items); - this.beforeChanged.OnNext(e); + _beforeChanged.OnNext(e); foreach (string item in items) { - this.inner.Remove(item); + _inner.Remove(item); } this.RaiseChanged(e); @@ -170,8 +167,8 @@ namespace Perspex.Styling this.CollectionChanged(this, e); } - this.changed.OnNext(e); - this.afterChanged.OnNext(e); + _changed.OnNext(e); + _afterChanged.OnNext(e); } } } diff --git a/src/Perspex.Styling/Styling/IGlobalStyles.cs b/src/Perspex.Styling/Styling/IGlobalStyles.cs index b24722f52d..ef246f9b84 100644 --- a/src/Perspex.Styling/Styling/IGlobalStyles.cs +++ b/src/Perspex.Styling/Styling/IGlobalStyles.cs @@ -1,8 +1,5 @@ - - - - - +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. namespace Perspex.Styling { diff --git a/src/Perspex.Styling/Styling/INamed.cs b/src/Perspex.Styling/Styling/INamed.cs index 489c3e96a4..bd5b806d7e 100644 --- a/src/Perspex.Styling/Styling/INamed.cs +++ b/src/Perspex.Styling/Styling/INamed.cs @@ -1,8 +1,5 @@ - - - - - +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. namespace Perspex.Styling { diff --git a/src/Perspex.Styling/Styling/ISetter.cs b/src/Perspex.Styling/Styling/ISetter.cs index 2520efca3e..b249f78d7b 100644 --- a/src/Perspex.Styling/Styling/ISetter.cs +++ b/src/Perspex.Styling/Styling/ISetter.cs @@ -1,7 +1,10 @@ -namespace Perspex.Styling -{ - using System; +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. + +using System; +namespace Perspex.Styling +{ /// /// Represents a setter for a . /// diff --git a/src/Perspex.Styling/Styling/IStyle.cs b/src/Perspex.Styling/Styling/IStyle.cs index 25f9ac0da8..e8821349dd 100644 --- a/src/Perspex.Styling/Styling/IStyle.cs +++ b/src/Perspex.Styling/Styling/IStyle.cs @@ -1,8 +1,5 @@ - - - - - +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. namespace Perspex.Styling { diff --git a/src/Perspex.Styling/Styling/IStyleHost.cs b/src/Perspex.Styling/Styling/IStyleHost.cs index a5476ef7ed..cb0da117fb 100644 --- a/src/Perspex.Styling/Styling/IStyleHost.cs +++ b/src/Perspex.Styling/Styling/IStyleHost.cs @@ -1,8 +1,5 @@ - - - - - +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. namespace Perspex.Styling { diff --git a/src/Perspex.Styling/Styling/IStyleable.cs b/src/Perspex.Styling/Styling/IStyleable.cs index 7802e41987..c28e96f184 100644 --- a/src/Perspex.Styling/Styling/IStyleable.cs +++ b/src/Perspex.Styling/Styling/IStyleable.cs @@ -1,13 +1,10 @@ - - - - +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. +using System; namespace Perspex.Styling { - using System; - /// /// Interface for styleable elements. /// diff --git a/src/Perspex.Styling/Styling/IStyler.cs b/src/Perspex.Styling/Styling/IStyler.cs index c7e2f68fa9..6ae4786b80 100644 --- a/src/Perspex.Styling/Styling/IStyler.cs +++ b/src/Perspex.Styling/Styling/IStyler.cs @@ -1,13 +1,10 @@ - - - - +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. +using System; namespace Perspex.Styling { - using System; - public interface IStyler { void ApplyStyles(IStyleable control); diff --git a/src/Perspex.Styling/Styling/ITemplatedControl.cs b/src/Perspex.Styling/Styling/ITemplatedControl.cs index 13810985fb..a31d834e5a 100644 --- a/src/Perspex.Styling/Styling/ITemplatedControl.cs +++ b/src/Perspex.Styling/Styling/ITemplatedControl.cs @@ -1,13 +1,10 @@ - - - - +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. +using System; namespace Perspex.Styling { - using System; - public interface ITemplatedControl { /// diff --git a/src/Perspex.Styling/Styling/ObservableSetter.cs b/src/Perspex.Styling/Styling/ObservableSetter.cs index 9c7b0d7baa..7fa0c1c64a 100644 --- a/src/Perspex.Styling/Styling/ObservableSetter.cs +++ b/src/Perspex.Styling/Styling/ObservableSetter.cs @@ -1,13 +1,10 @@ - - - - +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. +using System; namespace Perspex.Styling { - using System; - /// /// A setter for a whose source is an observable. /// diff --git a/src/Perspex.Styling/Styling/Selector.cs b/src/Perspex.Styling/Styling/Selector.cs index 7dd13ff148..e39fd16df6 100644 --- a/src/Perspex.Styling/Styling/Selector.cs +++ b/src/Perspex.Styling/Styling/Selector.cs @@ -1,27 +1,24 @@ - - - - +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. +using System; +using System.Collections.Generic; namespace Perspex.Styling { - using System; - using System.Collections.Generic; - public class Selector { - private Func evaluate; + private Func _evaluate; - private bool inTemplate; + private bool _inTemplate; - private bool stopTraversal; + private bool _stopTraversal; - private string description; + private string _description; public Selector() { - this.evaluate = _ => SelectorMatch.True; + _evaluate = _ => SelectorMatch.True; } public Selector( @@ -35,10 +32,10 @@ namespace Perspex.Styling Contract.Requires(previous != null); this.Previous = previous; - this.evaluate = evaluate; + _evaluate = evaluate; this.SelectorString = selectorString; - this.inTemplate = inTemplate || previous.inTemplate; - this.stopTraversal = stopTraversal; + _inTemplate = inTemplate || previous._inTemplate; + _stopTraversal = stopTraversal; } public Selector Previous @@ -55,7 +52,7 @@ namespace Perspex.Styling public Selector MovePrevious() { - return this.stopTraversal ? null : this.Previous; + return _stopTraversal ? null : this.Previous; } public SelectorMatch Match(IStyleable control) @@ -65,12 +62,12 @@ namespace Perspex.Styling while (selector != null) { - if (selector.inTemplate && control.TemplatedParent == null) + if (selector._inTemplate && control.TemplatedParent == null) { return SelectorMatch.False; } - var match = selector.evaluate(control); + var match = selector._evaluate(control); if (match.ImmediateResult == false) { @@ -96,7 +93,7 @@ namespace Perspex.Styling public override string ToString() { - if (this.description == null) + if (_description == null) { string result = string.Empty; @@ -105,10 +102,10 @@ namespace Perspex.Styling result = this.Previous.ToString(); } - this.description = result + this.SelectorString; + _description = result + this.SelectorString; } - return this.description; + return _description; } } } diff --git a/src/Perspex.Styling/Styling/SelectorMatch.cs b/src/Perspex.Styling/Styling/SelectorMatch.cs index 48ca84cfd1..e1f77d0914 100644 --- a/src/Perspex.Styling/Styling/SelectorMatch.cs +++ b/src/Perspex.Styling/Styling/SelectorMatch.cs @@ -1,13 +1,10 @@ - - - - +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. +using System; namespace Perspex.Styling { - using System; - /// /// Holds the result of a match. /// diff --git a/src/Perspex.Styling/Styling/Selectors.cs b/src/Perspex.Styling/Styling/Selectors.cs index 20a39db87e..84f92a375b 100644 --- a/src/Perspex.Styling/Styling/Selectors.cs +++ b/src/Perspex.Styling/Styling/Selectors.cs @@ -1,16 +1,13 @@ - - - - +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. +using System; +using System.Collections.Generic; +using System.Reactive.Linq; +using System.Reflection; namespace Perspex.Styling { - using System; - using System.Collections.Generic; - using System.Reactive.Linq; - using System.Reflection; - public static class Selectors { public static Selector Child(this Selector previous) diff --git a/src/Perspex.Styling/Styling/Setter.cs b/src/Perspex.Styling/Styling/Setter.cs index 8132f67b29..73dcf8f1dd 100644 --- a/src/Perspex.Styling/Styling/Setter.cs +++ b/src/Perspex.Styling/Styling/Setter.cs @@ -1,13 +1,10 @@ - - - - +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. +using System; namespace Perspex.Styling { - using System; - /// /// A setter for a . /// diff --git a/src/Perspex.Styling/Styling/Style.cs b/src/Perspex.Styling/Styling/Style.cs index 70943233f8..8038e723cc 100644 --- a/src/Perspex.Styling/Styling/Style.cs +++ b/src/Perspex.Styling/Styling/Style.cs @@ -1,14 +1,11 @@ - - - - +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. +using System; +using System.Collections.Generic; namespace Perspex.Styling { - using System; - using System.Collections.Generic; - /// /// Defines a style. /// diff --git a/src/Perspex.Styling/Styling/StyleActivator.cs b/src/Perspex.Styling/Styling/StyleActivator.cs index 43e00b9772..071229b828 100644 --- a/src/Perspex.Styling/Styling/StyleActivator.cs +++ b/src/Perspex.Styling/Styling/StyleActivator.cs @@ -1,16 +1,13 @@ - - - - +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. +using System; +using System.Collections.Generic; +using System.Linq; +using System.Reactive.Disposables; namespace Perspex.Styling { - using System; - using System.Collections.Generic; - using System.Linq; - using System.Reactive.Disposables; - public enum ActivatorMode { And, @@ -19,13 +16,13 @@ namespace Perspex.Styling public class StyleActivator : IObservable, IDisposable { - private ActivatorMode mode; + private ActivatorMode _mode; - private bool[] values; + private bool[] _values; - private List subscriptions = new List(); + private List _subscriptions = new List(); - private List> observers = new List>(); + private List> _observers = new List>(); public StyleActivator( IList> inputs, @@ -33,8 +30,8 @@ namespace Perspex.Styling { int i = 0; - this.mode = mode; - this.values = new bool[inputs.Count]; + _mode = mode; + _values = new bool[inputs.Count]; foreach (IObservable input in inputs) { @@ -44,7 +41,7 @@ namespace Perspex.Styling x => this.Update(capturedIndex, x), x => this.Finish(capturedIndex), () => this.Finish(capturedIndex)); - this.subscriptions.Add(subscription); + _subscriptions.Add(subscription); ++i; } } @@ -63,12 +60,12 @@ namespace Perspex.Styling public void Dispose() { - foreach (IObserver observer in this.observers) + foreach (IObserver observer in _observers) { observer.OnCompleted(); } - foreach (IDisposable subscription in this.subscriptions) + foreach (IDisposable subscription in _subscriptions) { subscription.Dispose(); } @@ -87,24 +84,24 @@ namespace Perspex.Styling } else { - this.observers.Add(observer); - return Disposable.Create(() => this.observers.Remove(observer)); + _observers.Add(observer); + return Disposable.Create(() => _observers.Remove(observer)); } } private void Update(int index, bool value) { - this.values[index] = value; + _values[index] = value; bool current; - switch (this.mode) + switch (_mode) { case ActivatorMode.And: - current = this.values.All(x => x); + current = _values.All(x => x); break; case ActivatorMode.Or: - current = this.values.Any(x => x); + current = _values.Any(x => x); break; default: throw new InvalidOperationException("Invalid Activator mode."); @@ -123,14 +120,14 @@ namespace Perspex.Styling // - Is the only subscription. // - 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 value = _values[i]; var unsubscribe = - (this.values.Length == 1) || - (this.mode == ActivatorMode.And ? !value : value); + (_values.Length == 1) || + (_mode == ActivatorMode.And ? !value : value); if (unsubscribe) { - foreach (IDisposable subscription in this.subscriptions) + foreach (IDisposable subscription in _subscriptions) { subscription.Dispose(); } @@ -141,7 +138,7 @@ namespace Perspex.Styling private void Push(bool value) { - foreach (IObserver observer in this.observers) + foreach (IObserver observer in _observers) { observer.OnNext(value); } diff --git a/src/Perspex.Styling/Styling/StyleBinding.cs b/src/Perspex.Styling/Styling/StyleBinding.cs index 8a7b542674..4a8b705748 100644 --- a/src/Perspex.Styling/Styling/StyleBinding.cs +++ b/src/Perspex.Styling/Styling/StyleBinding.cs @@ -1,15 +1,12 @@ - - - - +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. +using System; +using System.Reactive; +using System.Reactive.Linq; namespace Perspex.Styling { - using System; - using System.Reactive; - using System.Reactive.Linq; - /// /// Provides an observable for a style. /// @@ -25,7 +22,7 @@ namespace Perspex.Styling /// /// The activator. /// - private IObservable activator; + private IObservable _activator; /// /// Initializes a new instance of the class. @@ -38,7 +35,7 @@ namespace Perspex.Styling object activatedValue, string description) { - this.activator = activator; + _activator = activator; this.ActivatedValue = activatedValue; this.Description = description; } @@ -54,7 +51,7 @@ namespace Perspex.Styling IObservable source, string description) { - this.activator = activator; + _activator = activator; this.Description = description; this.Source = source; } @@ -95,7 +92,7 @@ namespace Perspex.Styling if (this.Source == null) { - return this.activator.Subscribe( + return _activator.Subscribe( active => observer.OnNext(active ? this.ActivatedValue : PerspexProperty.UnsetValue), observer.OnError, observer.OnCompleted); @@ -103,7 +100,7 @@ namespace Perspex.Styling else { return Observable - .CombineLatest(this.activator, this.Source, (x, y) => new { Active = x, Value = y }) + .CombineLatest(_activator, this.Source, (x, y) => new { Active = x, Value = y }) .Subscribe(x => observer.OnNext(x.Active ? x.Value : PerspexProperty.UnsetValue)); } } diff --git a/src/Perspex.Styling/Styling/Styler.cs b/src/Perspex.Styling/Styling/Styler.cs index 2c1a2751cd..1c184a8e88 100644 --- a/src/Perspex.Styling/Styling/Styler.cs +++ b/src/Perspex.Styling/Styling/Styler.cs @@ -1,16 +1,13 @@ - - - - +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. +using System; +using System.Linq; +using Perspex.VisualTree; +using Splat; namespace Perspex.Styling { - using System; - using System.Linq; - using Perspex.VisualTree; - using Splat; - public class Styler : IStyler { public void ApplyStyles(IStyleable control) diff --git a/src/Perspex.Styling/Styling/Styles.cs b/src/Perspex.Styling/Styling/Styles.cs index 5245578756..2ebf858cd6 100644 --- a/src/Perspex.Styling/Styling/Styles.cs +++ b/src/Perspex.Styling/Styling/Styles.cs @@ -1,13 +1,10 @@ - - - - +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. +using Perspex.Collections; namespace Perspex.Styling { - using Perspex.Collections; - public class Styles : PerspexList, IStyle { public void Attach(IStyleable control) diff --git a/src/Perspex.Themes.Default/ButtonStyle.cs b/src/Perspex.Themes.Default/ButtonStyle.cs index cfb063d5f6..018d63e055 100644 --- a/src/Perspex.Themes.Default/ButtonStyle.cs +++ b/src/Perspex.Themes.Default/ButtonStyle.cs @@ -1,21 +1,18 @@ - - - - +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. +using System.Linq; +using Perspex.Collections; +using Perspex.Controls; +using Perspex.Controls.Presenters; +using Perspex.Controls.Shapes; +using Perspex.Controls.Templates; +using Perspex.Layout; +using Perspex.Media; +using Perspex.Styling; namespace Perspex.Themes.Default { - using System.Linq; - using Perspex.Collections; - using Perspex.Controls; - using Perspex.Controls.Presenters; - using Perspex.Controls.Shapes; - using Perspex.Controls.Templates; - using Perspex.Layout; - using Perspex.Media; - using Perspex.Styling; - /// /// The default style for the control. /// diff --git a/src/Perspex.Themes.Default/CheckBoxStyle.cs b/src/Perspex.Themes.Default/CheckBoxStyle.cs index 2f60352bb5..39f3238bb2 100644 --- a/src/Perspex.Themes.Default/CheckBoxStyle.cs +++ b/src/Perspex.Themes.Default/CheckBoxStyle.cs @@ -1,19 +1,18 @@ - - - - +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. +using System.Linq; +using Perspex.Controls; +using Perspex.Controls.Presenters; +using Perspex.Controls.Shapes; +using Perspex.Controls.Templates; +using Perspex.Layout; +using Perspex.Media; +using Perspex.Styling; namespace Perspex.Themes.Default { - using System.Linq; - using Perspex.Controls; - using Perspex.Controls.Presenters; - using Perspex.Controls.Shapes; - using Perspex.Controls.Templates; - using Perspex.Layout; - using Perspex.Media; - using Perspex.Styling; + using Controls = Perspex.Controls.Controls; /// /// The default style for the control. diff --git a/src/Perspex.Themes.Default/ContentControlStyle.cs b/src/Perspex.Themes.Default/ContentControlStyle.cs index 75b5b43f9a..b27dff90e9 100644 --- a/src/Perspex.Themes.Default/ContentControlStyle.cs +++ b/src/Perspex.Themes.Default/ContentControlStyle.cs @@ -1,17 +1,14 @@ - - - - +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. +using System.Linq; +using Perspex.Controls; +using Perspex.Controls.Presenters; +using Perspex.Controls.Templates; +using Perspex.Styling; namespace Perspex.Themes.Default { - using System.Linq; - using Perspex.Controls; - using Perspex.Controls.Presenters; - using Perspex.Controls.Templates; - using Perspex.Styling; - /// /// The default style for the control. /// diff --git a/src/Perspex.Themes.Default/DeckStyle.cs b/src/Perspex.Themes.Default/DeckStyle.cs index c596fc423e..2e38fa4495 100644 --- a/src/Perspex.Themes.Default/DeckStyle.cs +++ b/src/Perspex.Themes.Default/DeckStyle.cs @@ -1,17 +1,14 @@ - - - - +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. +using System.Linq; +using Perspex.Controls; +using Perspex.Controls.Presenters; +using Perspex.Controls.Templates; +using Perspex.Styling; namespace Perspex.Themes.Default { - using System.Linq; - using Perspex.Controls; - using Perspex.Controls.Presenters; - using Perspex.Controls.Templates; - using Perspex.Styling; - /// /// The default style for the control. /// diff --git a/src/Perspex.Themes.Default/DefaultTheme.cs b/src/Perspex.Themes.Default/DefaultTheme.cs index 9132f60c09..d90cf139de 100644 --- a/src/Perspex.Themes.Default/DefaultTheme.cs +++ b/src/Perspex.Themes.Default/DefaultTheme.cs @@ -1,13 +1,10 @@ - - - - +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. +using Perspex.Styling; namespace Perspex.Themes.Default { - using Perspex.Styling; - /// /// The default Perspex theme. /// diff --git a/src/Perspex.Themes.Default/DropDownStyle.cs b/src/Perspex.Themes.Default/DropDownStyle.cs index c4f7e24389..93bb82d9db 100644 --- a/src/Perspex.Themes.Default/DropDownStyle.cs +++ b/src/Perspex.Themes.Default/DropDownStyle.cs @@ -1,22 +1,21 @@ - - - - +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. +using System.Linq; +using System.Reactive.Linq; +using Perspex.Collections; +using Perspex.Controls; +using Perspex.Controls.Presenters; +using Perspex.Controls.Primitives; +using Perspex.Controls.Shapes; +using Perspex.Controls.Templates; +using Perspex.Layout; +using Perspex.Media; +using Perspex.Styling; namespace Perspex.Themes.Default { - using System.Linq; - using System.Reactive.Linq; - using Collections; - using Perspex.Controls; - using Perspex.Controls.Presenters; - using Perspex.Controls.Primitives; - using Perspex.Controls.Shapes; - using Perspex.Controls.Templates; - using Perspex.Layout; - using Perspex.Media; - using Perspex.Styling; + using Controls = Perspex.Controls.Controls; /// /// The default style for the control. diff --git a/src/Perspex.Themes.Default/FocusAdornerStyle.cs b/src/Perspex.Themes.Default/FocusAdornerStyle.cs index 3655cfa4a7..dfbed7522d 100644 --- a/src/Perspex.Themes.Default/FocusAdornerStyle.cs +++ b/src/Perspex.Themes.Default/FocusAdornerStyle.cs @@ -1,18 +1,15 @@ - - - - +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. +using Perspex.Collections; +using Perspex.Controls; +using Perspex.Controls.Shapes; +using Perspex.Controls.Templates; +using Perspex.Media; +using Perspex.Styling; namespace Perspex.Themes.Default { - using Perspex.Collections; - using Perspex.Controls; - using Perspex.Controls.Shapes; - using Perspex.Controls.Templates; - using Perspex.Media; - using Perspex.Styling; - /// /// The default style for a focus adorner. /// diff --git a/src/Perspex.Themes.Default/GridSplitterStyle.cs b/src/Perspex.Themes.Default/GridSplitterStyle.cs index b00caf9d30..6550d23d20 100644 --- a/src/Perspex.Themes.Default/GridSplitterStyle.cs +++ b/src/Perspex.Themes.Default/GridSplitterStyle.cs @@ -1,16 +1,13 @@ - - - - +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. +using System.Linq; +using Perspex.Controls; +using Perspex.Controls.Templates; +using Perspex.Styling; namespace Perspex.Themes.Default { - using System.Linq; - using Perspex.Controls; - using Perspex.Controls.Templates; - using Perspex.Styling; - /// /// The default style for the control. /// diff --git a/src/Perspex.Themes.Default/ItemsControlStyle.cs b/src/Perspex.Themes.Default/ItemsControlStyle.cs index 9bb59db0f8..505bb9152f 100644 --- a/src/Perspex.Themes.Default/ItemsControlStyle.cs +++ b/src/Perspex.Themes.Default/ItemsControlStyle.cs @@ -1,17 +1,14 @@ - - - - +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. +using System.Linq; +using Perspex.Controls; +using Perspex.Controls.Presenters; +using Perspex.Controls.Templates; +using Perspex.Styling; namespace Perspex.Themes.Default { - using System.Linq; - using Perspex.Controls; - using Perspex.Controls.Presenters; - using Perspex.Controls.Templates; - using Perspex.Styling; - /// /// The default style for the control. /// diff --git a/src/Perspex.Themes.Default/ListBoxItemStyle.cs b/src/Perspex.Themes.Default/ListBoxItemStyle.cs index 579a9f01f8..0174c7ffef 100644 --- a/src/Perspex.Themes.Default/ListBoxItemStyle.cs +++ b/src/Perspex.Themes.Default/ListBoxItemStyle.cs @@ -1,18 +1,15 @@ - - - - +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. +using System.Linq; +using Perspex.Controls; +using Perspex.Controls.Presenters; +using Perspex.Controls.Templates; +using Perspex.Media; +using Perspex.Styling; namespace Perspex.Themes.Default { - using System.Linq; - using Perspex.Controls; - using Perspex.Controls.Presenters; - using Perspex.Controls.Templates; - using Perspex.Media; - using Perspex.Styling; - /// /// The default style for the control. /// diff --git a/src/Perspex.Themes.Default/ListBoxStyle.cs b/src/Perspex.Themes.Default/ListBoxStyle.cs index 53147cc656..43cba41c28 100644 --- a/src/Perspex.Themes.Default/ListBoxStyle.cs +++ b/src/Perspex.Themes.Default/ListBoxStyle.cs @@ -1,18 +1,15 @@ - - - - +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. +using System.Linq; +using Perspex.Controls; +using Perspex.Controls.Presenters; +using Perspex.Controls.Templates; +using Perspex.Media; +using Perspex.Styling; namespace Perspex.Themes.Default { - using System.Linq; - using Perspex.Controls; - using Perspex.Controls.Presenters; - using Perspex.Controls.Templates; - using Perspex.Media; - using Perspex.Styling; - /// /// The default style for the control. /// diff --git a/src/Perspex.Themes.Default/MenuItemStyle.cs b/src/Perspex.Themes.Default/MenuItemStyle.cs index 5711b6ad8a..11c7124a67 100644 --- a/src/Perspex.Themes.Default/MenuItemStyle.cs +++ b/src/Perspex.Themes.Default/MenuItemStyle.cs @@ -1,28 +1,27 @@ - - - - +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. +using System.Linq; +using Perspex.Controls; +using Perspex.Controls.Presenters; +using Perspex.Controls.Primitives; +using Perspex.Controls.Shapes; +using Perspex.Controls.Templates; +using Perspex.Input; +using Perspex.Layout; +using Perspex.Media; +using Perspex.Styling; namespace Perspex.Themes.Default { - using System.Linq; - using Perspex.Controls; - using Perspex.Controls.Presenters; - using Perspex.Controls.Primitives; - using Perspex.Controls.Shapes; - using Perspex.Controls.Templates; - using Perspex.Input; - using Perspex.Layout; - using Perspex.Media; - using Perspex.Styling; + using Controls = Perspex.Controls.Controls; /// /// The default style for the control. /// public class MenuItemStyle : Styles { - private static readonly DataTemplate AccessKeyDataTemplate = + private static readonly DataTemplate s_accessKeyDataTemplate = new DataTemplate(x => new AccessText { Text = x }); /// @@ -97,7 +96,7 @@ namespace Perspex.Themes.Default { DataTemplates = new DataTemplates { - AccessKeyDataTemplate, + s_accessKeyDataTemplate, }, [~ContentPresenter.ContentProperty] = control[~MenuItem.HeaderProperty], [~ContentPresenter.MarginProperty] = control[~MenuItem.PaddingProperty], @@ -198,7 +197,7 @@ namespace Perspex.Themes.Default { DataTemplates = new DataTemplates { - AccessKeyDataTemplate, + s_accessKeyDataTemplate, }, VerticalAlignment = VerticalAlignment.Center, [~ContentPresenter.ContentProperty] = control[~MenuItem.HeaderProperty], diff --git a/src/Perspex.Themes.Default/MenuStyle.cs b/src/Perspex.Themes.Default/MenuStyle.cs index 5292f591ed..f7a3889276 100644 --- a/src/Perspex.Themes.Default/MenuStyle.cs +++ b/src/Perspex.Themes.Default/MenuStyle.cs @@ -1,18 +1,15 @@ - - - - +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. +using System.Linq; +using Perspex.Controls; +using Perspex.Controls.Presenters; +using Perspex.Controls.Templates; +using Perspex.Input; +using Perspex.Styling; namespace Perspex.Themes.Default { - using System.Linq; - using Perspex.Controls; - using Perspex.Controls.Presenters; - using Perspex.Controls.Templates; - using Perspex.Input; - using Perspex.Styling; - /// /// The default style for the control. /// diff --git a/src/Perspex.Themes.Default/PopupRootStyle.cs b/src/Perspex.Themes.Default/PopupRootStyle.cs index 1f96eda41c..a05ca970ac 100644 --- a/src/Perspex.Themes.Default/PopupRootStyle.cs +++ b/src/Perspex.Themes.Default/PopupRootStyle.cs @@ -1,18 +1,15 @@ - - - - +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. +using System.Linq; +using Perspex.Controls; +using Perspex.Controls.Presenters; +using Perspex.Controls.Primitives; +using Perspex.Controls.Templates; +using Perspex.Styling; namespace Perspex.Themes.Default { - using System.Linq; - using Perspex.Controls; - using Perspex.Controls.Presenters; - using Perspex.Controls.Primitives; - using Perspex.Controls.Templates; - using Perspex.Styling; - /// /// The default style for the control. /// diff --git a/src/Perspex.Themes.Default/ProgressBarStyle.cs b/src/Perspex.Themes.Default/ProgressBarStyle.cs index 2fb38c3364..8a24bc099b 100644 --- a/src/Perspex.Themes.Default/ProgressBarStyle.cs +++ b/src/Perspex.Themes.Default/ProgressBarStyle.cs @@ -1,21 +1,20 @@ - - - - +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. +using System.Linq; +using System.Reactive.Linq; +using Perspex.Controls; +using Perspex.Controls.Presenters; +using Perspex.Controls.Primitives; +using Perspex.Controls.Shapes; +using Perspex.Controls.Templates; +using Perspex.Layout; +using Perspex.Media; +using Perspex.Styling; namespace Perspex.Themes.Default { - using System.Linq; - using System.Reactive.Linq; - using Perspex.Controls; - using Perspex.Controls.Presenters; - using Perspex.Controls.Primitives; - using Perspex.Controls.Shapes; - using Perspex.Controls.Templates; - using Perspex.Layout; - using Perspex.Media; - using Perspex.Styling; + using Controls = Perspex.Controls.Controls; /// /// The default style for the control. diff --git a/src/Perspex.Themes.Default/Properties/AssemblyInfo.cs b/src/Perspex.Themes.Default/Properties/AssemblyInfo.cs index edcae44276..846b3e3709 100644 --- a/src/Perspex.Themes.Default/Properties/AssemblyInfo.cs +++ b/src/Perspex.Themes.Default/Properties/AssemblyInfo.cs @@ -1,8 +1,5 @@ - - - - - +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. using System.Reflection; diff --git a/src/Perspex.Themes.Default/RadioButtonStyle.cs b/src/Perspex.Themes.Default/RadioButtonStyle.cs index bc02837aab..a8120a229d 100644 --- a/src/Perspex.Themes.Default/RadioButtonStyle.cs +++ b/src/Perspex.Themes.Default/RadioButtonStyle.cs @@ -1,19 +1,18 @@ - - - - +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. +using System.Linq; +using Perspex.Controls; +using Perspex.Controls.Presenters; +using Perspex.Controls.Shapes; +using Perspex.Controls.Templates; +using Perspex.Layout; +using Perspex.Media; +using Perspex.Styling; namespace Perspex.Themes.Default { - using System.Linq; - using Perspex.Controls; - using Perspex.Controls.Presenters; - using Perspex.Controls.Shapes; - using Perspex.Controls.Templates; - using Perspex.Layout; - using Perspex.Media; - using Perspex.Styling; + using Controls = Perspex.Controls.Controls; /// /// The default style for the control. diff --git a/src/Perspex.Themes.Default/ScrollBarStyle.cs b/src/Perspex.Themes.Default/ScrollBarStyle.cs index 38d3ba97cc..7ba7071f77 100644 --- a/src/Perspex.Themes.Default/ScrollBarStyle.cs +++ b/src/Perspex.Themes.Default/ScrollBarStyle.cs @@ -1,19 +1,16 @@ - - - - +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. +using System.Linq; +using Perspex.Controls; +using Perspex.Controls.Presenters; +using Perspex.Controls.Primitives; +using Perspex.Controls.Templates; +using Perspex.Media; +using Perspex.Styling; namespace Perspex.Themes.Default { - using System.Linq; - using Perspex.Controls; - using Perspex.Controls.Presenters; - using Perspex.Controls.Primitives; - using Perspex.Controls.Templates; - using Perspex.Media; - using Perspex.Styling; - /// /// The default style for the control. /// diff --git a/src/Perspex.Themes.Default/ScrollViewerStyle.cs b/src/Perspex.Themes.Default/ScrollViewerStyle.cs index a54beaabe8..4174dbf1cf 100644 --- a/src/Perspex.Themes.Default/ScrollViewerStyle.cs +++ b/src/Perspex.Themes.Default/ScrollViewerStyle.cs @@ -1,17 +1,16 @@ - - - - +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. +using System.Linq; +using Perspex.Controls; +using Perspex.Controls.Presenters; +using Perspex.Controls.Primitives; +using Perspex.Controls.Templates; +using Perspex.Styling; namespace Perspex.Themes.Default { - using System.Linq; - using Perspex.Controls; - using Perspex.Controls.Presenters; - using Perspex.Controls.Primitives; - using Perspex.Controls.Templates; - using Perspex.Styling; + using Controls = Perspex.Controls.Controls; /// /// The default style for the control. diff --git a/src/Perspex.Themes.Default/TabControlStyle.cs b/src/Perspex.Themes.Default/TabControlStyle.cs index e30579e0cf..5f1d73ef00 100644 --- a/src/Perspex.Themes.Default/TabControlStyle.cs +++ b/src/Perspex.Themes.Default/TabControlStyle.cs @@ -1,17 +1,16 @@ - - - - +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. +using System.Linq; +using System.Reactive.Linq; +using Perspex.Controls; +using Perspex.Controls.Primitives; +using Perspex.Controls.Templates; +using Perspex.Styling; namespace Perspex.Themes.Default { - using System.Linq; - using System.Reactive.Linq; - using Perspex.Controls; - using Perspex.Controls.Primitives; - using Perspex.Controls.Templates; - using Perspex.Styling; + using Controls = Perspex.Controls.Controls; /// /// The default style for the control. diff --git a/src/Perspex.Themes.Default/TabItemStyle.cs b/src/Perspex.Themes.Default/TabItemStyle.cs index 4a8ea03b7d..cfd734ffac 100644 --- a/src/Perspex.Themes.Default/TabItemStyle.cs +++ b/src/Perspex.Themes.Default/TabItemStyle.cs @@ -1,18 +1,15 @@ - - - - +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. +using System.Linq; +using Perspex.Controls; +using Perspex.Controls.Presenters; +using Perspex.Controls.Templates; +using Perspex.Media; +using Perspex.Styling; namespace Perspex.Themes.Default { - using System.Linq; - using Perspex.Controls; - using Perspex.Controls.Presenters; - using Perspex.Controls.Templates; - using Perspex.Media; - using Perspex.Styling; - /// /// The default style for the control. /// diff --git a/src/Perspex.Themes.Default/TabStripStyle.cs b/src/Perspex.Themes.Default/TabStripStyle.cs index 1b381db6a4..e92eb5fe35 100644 --- a/src/Perspex.Themes.Default/TabStripStyle.cs +++ b/src/Perspex.Themes.Default/TabStripStyle.cs @@ -1,18 +1,15 @@ - - - - +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. +using System.Linq; +using Perspex.Controls; +using Perspex.Controls.Presenters; +using Perspex.Controls.Primitives; +using Perspex.Controls.Templates; +using Perspex.Styling; namespace Perspex.Themes.Default { - using System.Linq; - using Perspex.Controls; - using Perspex.Controls.Presenters; - using Perspex.Controls.Primitives; - using Perspex.Controls.Templates; - using Perspex.Styling; - /// /// The default style for the control. /// diff --git a/src/Perspex.Themes.Default/TextBoxStyle.cs b/src/Perspex.Themes.Default/TextBoxStyle.cs index 0f3d858cce..d0864d00c9 100644 --- a/src/Perspex.Themes.Default/TextBoxStyle.cs +++ b/src/Perspex.Themes.Default/TextBoxStyle.cs @@ -1,18 +1,15 @@ - - - - +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. +using System.Linq; +using Perspex.Controls; +using Perspex.Controls.Presenters; +using Perspex.Controls.Templates; +using Perspex.Media; +using Perspex.Styling; namespace Perspex.Themes.Default { - using System.Linq; - using Perspex.Controls; - using Perspex.Controls.Presenters; - using Perspex.Controls.Templates; - using Perspex.Media; - using Perspex.Styling; - /// /// The default style for the control. /// diff --git a/src/Perspex.Themes.Default/ToggleButtonStyle.cs b/src/Perspex.Themes.Default/ToggleButtonStyle.cs index d55a5d1c4d..01ed99a6cc 100644 --- a/src/Perspex.Themes.Default/ToggleButtonStyle.cs +++ b/src/Perspex.Themes.Default/ToggleButtonStyle.cs @@ -1,20 +1,17 @@ - - - - +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. +using System.Linq; +using Perspex.Controls; +using Perspex.Controls.Presenters; +using Perspex.Controls.Primitives; +using Perspex.Controls.Templates; +using Perspex.Layout; +using Perspex.Media; +using Perspex.Styling; namespace Perspex.Themes.Default { - using System.Linq; - using Perspex.Controls; - using Perspex.Controls.Presenters; - using Perspex.Controls.Primitives; - using Perspex.Controls.Templates; - using Perspex.Layout; - using Perspex.Media; - using Perspex.Styling; - /// /// The default style for the control. /// diff --git a/src/Perspex.Themes.Default/ToolTipStyle.cs b/src/Perspex.Themes.Default/ToolTipStyle.cs index bf98457f0d..d5c3790c91 100644 --- a/src/Perspex.Themes.Default/ToolTipStyle.cs +++ b/src/Perspex.Themes.Default/ToolTipStyle.cs @@ -1,18 +1,15 @@ - - - - +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. +using System.Linq; +using Perspex.Controls; +using Perspex.Controls.Presenters; +using Perspex.Controls.Templates; +using Perspex.Media; +using Perspex.Styling; namespace Perspex.Themes.Default { - using System.Linq; - using Perspex.Controls; - using Perspex.Controls.Presenters; - using Perspex.Controls.Templates; - using Perspex.Media; - using Perspex.Styling; - /// /// The default style for the control. /// diff --git a/src/Perspex.Themes.Default/TreeViewItemStyle.cs b/src/Perspex.Themes.Default/TreeViewItemStyle.cs index a976f1df20..733a309fbe 100644 --- a/src/Perspex.Themes.Default/TreeViewItemStyle.cs +++ b/src/Perspex.Themes.Default/TreeViewItemStyle.cs @@ -1,20 +1,19 @@ - - - - +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. +using System.Linq; +using Perspex.Controls; +using Perspex.Controls.Presenters; +using Perspex.Controls.Primitives; +using Perspex.Controls.Shapes; +using Perspex.Controls.Templates; +using Perspex.Layout; +using Perspex.Media; +using Perspex.Styling; namespace Perspex.Themes.Default { - using System.Linq; - using Perspex.Controls; - using Perspex.Controls.Presenters; - using Perspex.Controls.Primitives; - using Perspex.Controls.Shapes; - using Perspex.Controls.Templates; - using Perspex.Layout; - using Perspex.Media; - using Perspex.Styling; + using Controls = Perspex.Controls.Controls; /// /// The default style for the control. diff --git a/src/Perspex.Themes.Default/TreeViewStyle.cs b/src/Perspex.Themes.Default/TreeViewStyle.cs index 61e09b0389..886a41302a 100644 --- a/src/Perspex.Themes.Default/TreeViewStyle.cs +++ b/src/Perspex.Themes.Default/TreeViewStyle.cs @@ -1,18 +1,15 @@ - - - - +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. +using System.Linq; +using Perspex.Controls; +using Perspex.Controls.Presenters; +using Perspex.Controls.Templates; +using Perspex.Media; +using Perspex.Styling; namespace Perspex.Themes.Default { - using System.Linq; - using Perspex.Controls; - using Perspex.Controls.Presenters; - using Perspex.Controls.Templates; - using Perspex.Media; - using Perspex.Styling; - /// /// The default style for the control. /// diff --git a/src/Perspex.Themes.Default/WindowStyle.cs b/src/Perspex.Themes.Default/WindowStyle.cs index 620a5a2f06..f68f0ec9d7 100644 --- a/src/Perspex.Themes.Default/WindowStyle.cs +++ b/src/Perspex.Themes.Default/WindowStyle.cs @@ -1,18 +1,15 @@ - - - - +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. +using System.Linq; +using Perspex.Controls; +using Perspex.Controls.Presenters; +using Perspex.Controls.Primitives; +using Perspex.Controls.Templates; +using Perspex.Styling; namespace Perspex.Themes.Default { - using System.Linq; - using Perspex.Controls; - using Perspex.Controls.Presenters; - using Perspex.Controls.Primitives; - using Perspex.Controls.Templates; - using Perspex.Styling; - /// /// The default style for the control. /// diff --git a/src/Shared/SharedAssemblyInfo.cs b/src/Shared/SharedAssemblyInfo.cs index 9a2e8f3b7033de86fecbd8cff232a96f9df02212..8c2851baff57d125a6fb759c719cb4ec4f9384fb 100644 GIT binary patch literal 1364 zcmb`HOH0F05QS$g_#c8RUD$`4C;l1A*GSHCl9Nh&I_$fdox zH#29>nMXd}t5&tZ&TVFMTUu-*8`_gCxZAg$9k6#fN9=9>V@t4$?9I?bI#$+@w7B-8uj@i+p8GSOj1ftrf9@rMTs9 zgjTT$7=aD2AN%_es5#yoE;)1Yow1~Oz#jXa;wddTvNQxBPFGeF3-KA@FIKYly?6&Qp=>WP6__}#)gX8itoD?k9R$G^tVOvOSw9?B(@0ALDr-bh zbN5|WDQBLbu>P@SGUDv$8qr8sV|c%W-A>%AGxoxH!dlBQ+Jw0IiCvIB_#}rekgUOT z4QfqrKnZmEfX&f60 instance, typeof(IPlatformRenderInterface)); - locator.Register(() => d2d1Factory, typeof(SharpDX.Direct2D1.Factory)); - locator.Register(() => dwfactory, typeof(SharpDX.DirectWrite.Factory)); - locator.Register(() => imagingFactory, typeof(SharpDX.WIC.ImagingFactory)); + locator.Register(() => s_instance, typeof(IPlatformRenderInterface)); + locator.Register(() => s_d2d1Factory, typeof(SharpDX.Direct2D1.Factory)); + locator.Register(() => s_dwfactory, typeof(SharpDX.DirectWrite.Factory)); + locator.Register(() => s_imagingFactory, typeof(SharpDX.WIC.ImagingFactory)); } public IBitmapImpl CreateBitmap(int width, int height) { - return new BitmapImpl(imagingFactory, width, height); + return new BitmapImpl(s_imagingFactory, width, height); } public IFormattedTextImpl CreateFormattedText( @@ -64,7 +60,7 @@ namespace Perspex.Direct2D1 public IRenderTargetBitmapImpl CreateRenderTargetBitmap(int width, int height) { - return new RenderTargetBitmapImpl(imagingFactory, d2d1Factory, width, height); + return new RenderTargetBitmapImpl(s_imagingFactory, s_d2d1Factory, width, height); } public IStreamGeometryImpl CreateStreamGeometry() @@ -74,7 +70,7 @@ namespace Perspex.Direct2D1 public IBitmapImpl LoadBitmap(string fileName) { - return new BitmapImpl(imagingFactory, fileName); + return new BitmapImpl(s_imagingFactory, fileName); } } } diff --git a/src/Windows/Perspex.Direct2D1/Disposable.cs b/src/Windows/Perspex.Direct2D1/Disposable.cs index e47ae23aa4..c389143de1 100644 --- a/src/Windows/Perspex.Direct2D1/Disposable.cs +++ b/src/Windows/Perspex.Direct2D1/Disposable.cs @@ -1,16 +1,13 @@ - - - - +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. +using System; namespace Perspex.Direct2D1 { - using System; - public class Disposable : IDisposable where T : IDisposable { - private IDisposable extra; + private IDisposable _extra; public Disposable(T inner) { @@ -20,7 +17,7 @@ namespace Perspex.Direct2D1 public Disposable(T inner, IDisposable extra) { this.Inner = inner; - this.extra = extra; + _extra = extra; } public T Inner { get; } @@ -33,7 +30,7 @@ namespace Perspex.Direct2D1 public void Dispose() { this.Inner.Dispose(); - this.extra?.Dispose(); + _extra?.Dispose(); } } } diff --git a/src/Windows/Perspex.Direct2D1/Media/BrushImpl.cs b/src/Windows/Perspex.Direct2D1/Media/BrushImpl.cs index 9cf85d1b3b..d14aa9b11b 100644 --- a/src/Windows/Perspex.Direct2D1/Media/BrushImpl.cs +++ b/src/Windows/Perspex.Direct2D1/Media/BrushImpl.cs @@ -1,13 +1,10 @@ - - - - +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. +using System; namespace Perspex.Direct2D1.Media { - using System; - public abstract class BrushImpl : IDisposable { public SharpDX.Direct2D1.Brush PlatformBrush { get; set; } diff --git a/src/Windows/Perspex.Direct2D1/Media/BrushWrapper.cs b/src/Windows/Perspex.Direct2D1/Media/BrushWrapper.cs index 48223b444e..fc853e80f0 100644 --- a/src/Windows/Perspex.Direct2D1/Media/BrushWrapper.cs +++ b/src/Windows/Perspex.Direct2D1/Media/BrushWrapper.cs @@ -1,14 +1,11 @@ - - - - +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. +using Perspex.Media; +using SharpDX; namespace Perspex.Direct2D1.Media { - using Perspex.Media; - using SharpDX; - internal class BrushWrapper : ComObject { public BrushWrapper(Brush brush) diff --git a/src/Windows/Perspex.Direct2D1/Media/DrawingContext.cs b/src/Windows/Perspex.Direct2D1/Media/DrawingContext.cs index 1bab599c93..e2633c9063 100644 --- a/src/Windows/Perspex.Direct2D1/Media/DrawingContext.cs +++ b/src/Windows/Perspex.Direct2D1/Media/DrawingContext.cs @@ -1,19 +1,15 @@ - - - - +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. +using System; +using System.Reactive.Disposables; +using Perspex.Media; +using SharpDX; +using SharpDX.Direct2D1; +using IBitmap = Perspex.Media.Imaging.IBitmap; namespace Perspex.Direct2D1.Media { - using System; - using System.Reactive.Disposables; - using Perspex.Media; - using SharpDX; - using SharpDX.Direct2D1; - using IBitmap = Perspex.Media.Imaging.IBitmap; - using Matrix = Perspex.Matrix; - /// /// Draws using Direct2D1. /// @@ -22,12 +18,12 @@ namespace Perspex.Direct2D1.Media /// /// The Direct2D1 render target. /// - private RenderTarget renderTarget; + private RenderTarget _renderTarget; /// /// The DirectWrite factory. /// - private SharpDX.DirectWrite.Factory directWriteFactory; + private SharpDX.DirectWrite.Factory _directWriteFactory; /// /// Initializes a new instance of the class. @@ -38,9 +34,9 @@ namespace Perspex.Direct2D1.Media RenderTarget renderTarget, SharpDX.DirectWrite.Factory directWriteFactory) { - this.renderTarget = renderTarget; - this.directWriteFactory = directWriteFactory; - this.renderTarget.BeginDraw(); + _renderTarget = renderTarget; + _directWriteFactory = directWriteFactory; + _renderTarget.BeginDraw(); } /// @@ -48,8 +44,8 @@ namespace Perspex.Direct2D1.Media /// public Matrix CurrentTransform { - get { return this.renderTarget.Transform.ToPerspex(); } - private set { this.renderTarget.Transform = value.ToDirect2D(); } + get { return _renderTarget.Transform.ToPerspex(); } + private set { _renderTarget.Transform = value.ToDirect2D(); } } /// @@ -57,7 +53,7 @@ namespace Perspex.Direct2D1.Media /// public void Dispose() { - this.renderTarget.EndDraw(); + _renderTarget.EndDraw(); } /// @@ -70,8 +66,8 @@ namespace Perspex.Direct2D1.Media public void DrawImage(IBitmap source, double opacity, Rect sourceRect, Rect destRect) { BitmapImpl impl = (BitmapImpl)source.PlatformImpl; - Bitmap d2d = impl.GetDirect2DBitmap(this.renderTarget); - this.renderTarget.DrawBitmap( + Bitmap d2d = impl.GetDirect2DBitmap(_renderTarget); + _renderTarget.DrawBitmap( d2d, destRect.ToSharpDX(), (float)opacity, @@ -92,9 +88,9 @@ namespace Perspex.Direct2D1.Media var size = new Rect(p1, p2).Size; using (var d2dBrush = this.CreateBrush(pen.Brush, size)) - using (var d2dStroke = pen.ToDirect2DStrokeStyle(this.renderTarget)) + using (var d2dStroke = pen.ToDirect2DStrokeStyle(_renderTarget)) { - this.renderTarget.DrawLine( + _renderTarget.DrawLine( p1.ToSharpDX(), p2.ToSharpDX(), d2dBrush.PlatformBrush, @@ -117,17 +113,17 @@ namespace Perspex.Direct2D1.Media using (var d2dBrush = this.CreateBrush(brush, geometry.Bounds.Size)) { GeometryImpl impl = (GeometryImpl)geometry.PlatformImpl; - this.renderTarget.FillGeometry(impl.Geometry, d2dBrush.PlatformBrush); + _renderTarget.FillGeometry(impl.Geometry, d2dBrush.PlatformBrush); } } if (pen != null) { using (var d2dBrush = this.CreateBrush(pen.Brush, geometry.GetRenderBounds(pen.Thickness).Size)) - using (var d2dStroke = pen.ToDirect2DStrokeStyle(this.renderTarget)) + using (var d2dStroke = pen.ToDirect2DStrokeStyle(_renderTarget)) { GeometryImpl impl = (GeometryImpl)geometry.PlatformImpl; - this.renderTarget.DrawGeometry(impl.Geometry, d2dBrush.PlatformBrush, (float)pen.Thickness, d2dStroke); + _renderTarget.DrawGeometry(impl.Geometry, d2dBrush.PlatformBrush, (float)pen.Thickness, d2dStroke); } } } @@ -141,11 +137,11 @@ namespace Perspex.Direct2D1.Media public void DrawRectange(Pen pen, Rect rect, float cornerRadius) { using (var brush = this.CreateBrush(pen.Brush, rect.Size)) - using (var d2dStroke = pen.ToDirect2DStrokeStyle(this.renderTarget)) + using (var d2dStroke = pen.ToDirect2DStrokeStyle(_renderTarget)) { if (cornerRadius == 0) { - this.renderTarget.DrawRectangle( + _renderTarget.DrawRectangle( rect.ToDirect2D(), brush.PlatformBrush, (float)pen.Thickness, @@ -153,7 +149,7 @@ namespace Perspex.Direct2D1.Media } else { - this.renderTarget.DrawRoundedRectangle( + _renderTarget.DrawRoundedRectangle( new RoundedRectangle { Rect = rect.ToDirect2D(), RadiusX = cornerRadius, RadiusY = cornerRadius }, brush.PlatformBrush, (float)pen.Thickness, @@ -175,7 +171,7 @@ namespace Perspex.Direct2D1.Media var impl = (FormattedTextImpl)text.PlatformImpl; using (var brush = this.CreateBrush(foreground, impl.Measure())) - using (var renderer = new PerspexTextRenderer(this, this.renderTarget, brush.PlatformBrush)) + using (var renderer = new PerspexTextRenderer(this, _renderTarget, brush.PlatformBrush)) { impl.TextLayout.Draw(renderer, (float)origin.X, (float)origin.Y); } @@ -194,11 +190,11 @@ namespace Perspex.Direct2D1.Media { if (cornerRadius == 0) { - this.renderTarget.FillRectangle(rect.ToDirect2D(), b.PlatformBrush); + _renderTarget.FillRectangle(rect.ToDirect2D(), b.PlatformBrush); } else { - this.renderTarget.FillRoundedRectangle( + _renderTarget.FillRoundedRectangle( new RoundedRectangle { Rect = new RectangleF( @@ -221,11 +217,11 @@ namespace Perspex.Direct2D1.Media /// A disposable used to undo the clip rectangle. public IDisposable PushClip(Rect clip) { - this.renderTarget.PushAxisAlignedClip(clip.ToSharpDX(), AntialiasMode.PerPrimitive); + _renderTarget.PushAxisAlignedClip(clip.ToSharpDX(), AntialiasMode.PerPrimitive); return Disposable.Create(() => { - this.renderTarget.PopAxisAlignedClip(); + _renderTarget.PopAxisAlignedClip(); }); } @@ -245,13 +241,13 @@ namespace Perspex.Direct2D1.Media Opacity = (float)opacity, }; - var layer = new Layer(this.renderTarget); + var layer = new Layer(_renderTarget); - this.renderTarget.PushLayer(ref parameters, layer); + _renderTarget.PushLayer(ref parameters, layer); return Disposable.Create(() => { - this.renderTarget.PopLayer(); + _renderTarget.PopLayer(); layer.Dispose(); }); } @@ -269,13 +265,13 @@ namespace Perspex.Direct2D1.Media public IDisposable PushTransform(Matrix matrix) { Matrix3x2 m3x2 = matrix.ToDirect2D(); - Matrix3x2 transform = this.renderTarget.Transform * m3x2; - this.renderTarget.Transform = transform; + Matrix3x2 transform = _renderTarget.Transform * m3x2; + _renderTarget.Transform = transform; return Disposable.Create(() => { m3x2.Invert(); - this.renderTarget.Transform = transform * m3x2; + _renderTarget.Transform = transform * m3x2; }); } @@ -293,19 +289,19 @@ namespace Perspex.Direct2D1.Media if (solidColorBrush != null) { - return new SolidColorBrushImpl(solidColorBrush, this.renderTarget); + return new SolidColorBrushImpl(solidColorBrush, _renderTarget); } else if (linearGradientBrush != null) { - return new LinearGradientBrushImpl(linearGradientBrush, this.renderTarget, destinationSize); + return new LinearGradientBrushImpl(linearGradientBrush, _renderTarget, destinationSize); } else if (visualBrush != null) { - return new VisualBrushImpl(visualBrush, this.renderTarget, destinationSize); + return new VisualBrushImpl(visualBrush, _renderTarget, destinationSize); } else { - return new SolidColorBrushImpl(null, this.renderTarget); + return new SolidColorBrushImpl(null, _renderTarget); } } } diff --git a/src/Windows/Perspex.Direct2D1/Media/FormattedTextImpl.cs b/src/Windows/Perspex.Direct2D1/Media/FormattedTextImpl.cs index 065a3525b0..4d46a64c90 100644 --- a/src/Windows/Perspex.Direct2D1/Media/FormattedTextImpl.cs +++ b/src/Windows/Perspex.Direct2D1/Media/FormattedTextImpl.cs @@ -1,19 +1,16 @@ - - - - +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. +using System; +using System.Collections.Generic; +using System.Linq; +using Perspex.Media; +using Perspex.Platform; +using Splat; +using DWrite = SharpDX.DirectWrite; namespace Perspex.Direct2D1.Media { - using System; - using System.Collections.Generic; - using System.Linq; - using Perspex.Media; - using Perspex.Platform; - using Splat; - using DWrite = SharpDX.DirectWrite; - public class FormattedTextImpl : IFormattedTextImpl { public FormattedTextImpl( diff --git a/src/Windows/Perspex.Direct2D1/Media/GeometryImpl.cs b/src/Windows/Perspex.Direct2D1/Media/GeometryImpl.cs index 56717623df..96757543f5 100644 --- a/src/Windows/Perspex.Direct2D1/Media/GeometryImpl.cs +++ b/src/Windows/Perspex.Direct2D1/Media/GeometryImpl.cs @@ -1,21 +1,18 @@ - - - - +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. +using Perspex.Platform; +using SharpDX.Direct2D1; +using Splat; namespace Perspex.Direct2D1.Media { - using Perspex.Platform; - using SharpDX.Direct2D1; - using Splat; - /// /// The platform-specific interface for . /// public abstract class GeometryImpl : IGeometryImpl { - private TransformedGeometry transformed; + private TransformedGeometry _transformed; /// /// Gets the geometry's bounding rectangle. @@ -38,7 +35,7 @@ namespace Perspex.Direct2D1.Media /// public Geometry Geometry { - get { return this.transformed ?? this.DefiningGeometry; } + get { return _transformed ?? this.DefiningGeometry; } } /// @@ -48,8 +45,8 @@ namespace Perspex.Direct2D1.Media { get { - return this.transformed != null ? - this.transformed.Transform.ToPerspex() : + return _transformed != null ? + _transformed.Transform.ToPerspex() : Matrix.Identity; } @@ -57,16 +54,16 @@ namespace Perspex.Direct2D1.Media { if (value != this.Transform) { - if (this.transformed != null) + if (_transformed != null) { - this.transformed.Dispose(); - this.transformed = null; + _transformed.Dispose(); + _transformed = null; } if (!value.IsIdentity) { Factory factory = Locator.Current.GetService(); - this.transformed = new TransformedGeometry( + _transformed = new TransformedGeometry( factory, this.DefiningGeometry, value.ToDirect2D()); @@ -82,9 +79,9 @@ namespace Perspex.Direct2D1.Media /// The bounding rectangle. public Rect GetRenderBounds(double strokeThickness) { - if (this.transformed != null) + if (_transformed != null) { - return this.transformed.GetWidenedBounds((float)strokeThickness).ToPerspex(); + return _transformed.GetWidenedBounds((float)strokeThickness).ToPerspex(); } else { diff --git a/src/Windows/Perspex.Direct2D1/Media/Imaging/BitmapImpl.cs b/src/Windows/Perspex.Direct2D1/Media/Imaging/BitmapImpl.cs index 1cf1c40d02..f1f297e370 100644 --- a/src/Windows/Perspex.Direct2D1/Media/Imaging/BitmapImpl.cs +++ b/src/Windows/Perspex.Direct2D1/Media/Imaging/BitmapImpl.cs @@ -1,24 +1,21 @@ - - - - +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. +using System; +using System.IO; +using Perspex.Platform; +using SharpDX.WIC; namespace Perspex.Direct2D1.Media { - using System; - using System.IO; - using Perspex.Platform; - using SharpDX.WIC; - /// /// A Direct2D implementation of a . /// public class BitmapImpl : IBitmapImpl { - private ImagingFactory factory; + private ImagingFactory _factory; - private SharpDX.Direct2D1.Bitmap direct2D; + private SharpDX.Direct2D1.Bitmap _direct2D; /// /// Initializes a new instance of the class. @@ -27,7 +24,7 @@ namespace Perspex.Direct2D1.Media /// The filename of the bitmap to load. public BitmapImpl(ImagingFactory factory, string fileName) { - this.factory = factory; + _factory = factory; using (BitmapDecoder decoder = new BitmapDecoder(factory, fileName, DecodeOptions.CacheOnDemand)) { @@ -43,7 +40,7 @@ namespace Perspex.Direct2D1.Media /// The height of the bitmap. public BitmapImpl(ImagingFactory factory, int width, int height) { - this.factory = factory; + _factory = factory; this.WicImpl = new Bitmap( factory, width, @@ -84,14 +81,14 @@ namespace Perspex.Direct2D1.Media /// The Direct2D bitmap. public SharpDX.Direct2D1.Bitmap GetDirect2DBitmap(SharpDX.Direct2D1.RenderTarget renderTarget) { - if (this.direct2D == null) + if (_direct2D == null) { - FormatConverter converter = new FormatConverter(this.factory); + FormatConverter converter = new FormatConverter(_factory); converter.Initialize(this.WicImpl, PixelFormat.Format32bppPBGRA); - this.direct2D = SharpDX.Direct2D1.Bitmap.FromWicBitmap(renderTarget, converter); + _direct2D = SharpDX.Direct2D1.Bitmap.FromWicBitmap(renderTarget, converter); } - return this.direct2D; + return _direct2D; } /// @@ -108,7 +105,7 @@ namespace Perspex.Direct2D1.Media using (FileStream s = new FileStream(fileName, FileMode.Create)) { - PngBitmapEncoder encoder = new PngBitmapEncoder(this.factory); + PngBitmapEncoder encoder = new PngBitmapEncoder(_factory); encoder.Initialize(s); BitmapFrameEncode frame = new BitmapFrameEncode(encoder); diff --git a/src/Windows/Perspex.Direct2D1/Media/Imaging/RenderTargetBitmapImpl.cs b/src/Windows/Perspex.Direct2D1/Media/Imaging/RenderTargetBitmapImpl.cs index ac034ca61a..c967363bd2 100644 --- a/src/Windows/Perspex.Direct2D1/Media/Imaging/RenderTargetBitmapImpl.cs +++ b/src/Windows/Perspex.Direct2D1/Media/Imaging/RenderTargetBitmapImpl.cs @@ -1,19 +1,16 @@ - - - - +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. +using System; +using Perspex.Platform; +using SharpDX.Direct2D1; +using SharpDX.WIC; namespace Perspex.Direct2D1.Media { - using System; - using Perspex.Platform; - using SharpDX.Direct2D1; - using SharpDX.WIC; - public class RenderTargetBitmapImpl : BitmapImpl, IRenderTargetBitmapImpl, IDisposable { - private WicRenderTarget target; + private WicRenderTarget _target; public RenderTargetBitmapImpl( ImagingFactory imagingFactory, @@ -28,7 +25,7 @@ namespace Perspex.Direct2D1.Media DpiY = 96, }; - this.target = new WicRenderTarget( + _target = new WicRenderTarget( d2dFactory, this.WicImpl, props); @@ -41,7 +38,7 @@ namespace Perspex.Direct2D1.Media public void Render(IVisual visual) { - Renderer renderer = new Renderer(this.target); + Renderer renderer = new Renderer(_target); renderer.Render(visual, null); } } diff --git a/src/Windows/Perspex.Direct2D1/Media/LinearGradientBrushImpl.cs b/src/Windows/Perspex.Direct2D1/Media/LinearGradientBrushImpl.cs index de6521446e..f245c61f66 100644 --- a/src/Windows/Perspex.Direct2D1/Media/LinearGradientBrushImpl.cs +++ b/src/Windows/Perspex.Direct2D1/Media/LinearGradientBrushImpl.cs @@ -1,16 +1,19 @@ -namespace Perspex.Direct2D1.Media -{ - using System; - using System.Collections.Generic; - using System.Linq; - using System.Text; - using System.Threading.Tasks; +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. + +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +namespace Perspex.Direct2D1.Media +{ public class LinearGradientBrushImpl : BrushImpl { public LinearGradientBrushImpl( - Perspex.Media.LinearGradientBrush brush, - SharpDX.Direct2D1.RenderTarget target, + Perspex.Media.LinearGradientBrush brush, + SharpDX.Direct2D1.RenderTarget target, Size destinationSize) { if (brush != null) diff --git a/src/Windows/Perspex.Direct2D1/Media/PerspexTextRenderer.cs b/src/Windows/Perspex.Direct2D1/Media/PerspexTextRenderer.cs index 0325256ec4..314f774dd2 100644 --- a/src/Windows/Perspex.Direct2D1/Media/PerspexTextRenderer.cs +++ b/src/Windows/Perspex.Direct2D1/Media/PerspexTextRenderer.cs @@ -1,32 +1,29 @@ - - - - +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. +using System; +using SharpDX; +using SharpDX.Direct2D1; +using SharpDX.DirectWrite; namespace Perspex.Direct2D1.Media { - using System; - using SharpDX; - using SharpDX.Direct2D1; - using SharpDX.DirectWrite; - internal class PerspexTextRenderer : TextRenderer { - private DrawingContext context; + private DrawingContext _context; - private RenderTarget renderTarget; + private RenderTarget _renderTarget; - private Brush foreground; + private Brush _foreground; public PerspexTextRenderer( DrawingContext context, RenderTarget target, Brush foreground) { - this.context = context; - this.renderTarget = target; - this.foreground = foreground; + _context = context; + _renderTarget = target; + _foreground = foreground; } public IDisposable Shadow @@ -52,10 +49,10 @@ namespace Perspex.Direct2D1.Media // TODO: Work out how to get the size below rather than passing new Size(). var brush = (wrapper == null) ? - this.foreground : - this.context.CreateBrush(wrapper.Brush, new Size()).PlatformBrush; + _foreground : + _context.CreateBrush(wrapper.Brush, new Size()).PlatformBrush; - this.renderTarget.DrawGlyphRun( + _renderTarget.DrawGlyphRun( new Vector2(baselineOriginX, baselineOriginY), glyphRun, brush, @@ -86,12 +83,12 @@ namespace Perspex.Direct2D1.Media public Matrix3x2 GetCurrentTransform(object clientDrawingContext) { - return this.renderTarget.Transform; + return _renderTarget.Transform; } public float GetPixelsPerDip(object clientDrawingContext) { - return this.renderTarget.DotsPerInch.Width / 96; + return _renderTarget.DotsPerInch.Width / 96; } public bool IsPixelSnappingDisabled(object clientDrawingContext) diff --git a/src/Windows/Perspex.Direct2D1/Media/SolidColorBrushImpl.cs b/src/Windows/Perspex.Direct2D1/Media/SolidColorBrushImpl.cs index 66f79421a8..69dce14550 100644 --- a/src/Windows/Perspex.Direct2D1/Media/SolidColorBrushImpl.cs +++ b/src/Windows/Perspex.Direct2D1/Media/SolidColorBrushImpl.cs @@ -1,8 +1,5 @@ - - - - - +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. namespace Perspex.Direct2D1.Media { @@ -11,12 +8,12 @@ namespace Perspex.Direct2D1.Media public SolidColorBrushImpl(Perspex.Media.SolidColorBrush brush, SharpDX.Direct2D1.RenderTarget target) { this.PlatformBrush = new SharpDX.Direct2D1.SolidColorBrush( - target, - brush?.Color.ToDirect2D() ?? new SharpDX.Color4(), - new SharpDX.Direct2D1.BrushProperties - { - Opacity = brush != null ? (float)brush.Opacity : 1.0f, - Transform = target.Transform + target, + brush?.Color.ToDirect2D() ?? new SharpDX.Color4(), + new SharpDX.Direct2D1.BrushProperties + { + Opacity = brush != null ? (float)brush.Opacity : 1.0f, + Transform = target.Transform } ); } diff --git a/src/Windows/Perspex.Direct2D1/Media/StreamGeometryContextImpl.cs b/src/Windows/Perspex.Direct2D1/Media/StreamGeometryContextImpl.cs index ec3a18fd91..ae38a75d84 100644 --- a/src/Windows/Perspex.Direct2D1/Media/StreamGeometryContextImpl.cs +++ b/src/Windows/Perspex.Direct2D1/Media/StreamGeometryContextImpl.cs @@ -1,21 +1,18 @@ - - - - +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. +using Perspex.Platform; +using SharpDX.Direct2D1; namespace Perspex.Direct2D1.Media { - using Perspex.Platform; - using SharpDX.Direct2D1; - public class StreamGeometryContextImpl : IStreamGeometryContextImpl { - private GeometrySink sink; + private GeometrySink _sink; public StreamGeometryContextImpl(GeometrySink sink) { - this.sink = sink; + _sink = sink; } public void ArcTo( @@ -25,7 +22,7 @@ namespace Perspex.Direct2D1.Media bool isLargeArc, Perspex.Media.SweepDirection sweepDirection) { - this.sink.AddArc(new ArcSegment + _sink.AddArc(new ArcSegment { Point = point.ToSharpDX(), Size = size.ToSharpDX(), @@ -37,12 +34,12 @@ namespace Perspex.Direct2D1.Media public void BeginFigure(Point startPoint, bool isFilled) { - this.sink.BeginFigure(startPoint.ToSharpDX(), isFilled ? FigureBegin.Filled : FigureBegin.Hollow); + _sink.BeginFigure(startPoint.ToSharpDX(), isFilled ? FigureBegin.Filled : FigureBegin.Hollow); } public void BezierTo(Point point1, Point point2, Point point3) { - this.sink.AddBezier(new BezierSegment + _sink.AddBezier(new BezierSegment { Point1 = point1.ToSharpDX(), Point2 = point2.ToSharpDX(), @@ -52,18 +49,18 @@ namespace Perspex.Direct2D1.Media public void LineTo(Point point) { - this.sink.AddLine(point.ToSharpDX()); + _sink.AddLine(point.ToSharpDX()); } public void EndFigure(bool isClosed) { - this.sink.EndFigure(isClosed ? FigureEnd.Closed : FigureEnd.Open); + _sink.EndFigure(isClosed ? FigureEnd.Closed : FigureEnd.Open); } public void Dispose() { - this.sink.Close(); - this.sink.Dispose(); + _sink.Close(); + _sink.Dispose(); } } } diff --git a/src/Windows/Perspex.Direct2D1/Media/StreamGeometryImpl.cs b/src/Windows/Perspex.Direct2D1/Media/StreamGeometryImpl.cs index 1446f8b0c3..f25ac25e21 100644 --- a/src/Windows/Perspex.Direct2D1/Media/StreamGeometryImpl.cs +++ b/src/Windows/Perspex.Direct2D1/Media/StreamGeometryImpl.cs @@ -1,23 +1,20 @@ - - - - +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. +using Perspex.Media; +using Perspex.Platform; +using SharpDX.Direct2D1; +using Splat; +using D2DGeometry = SharpDX.Direct2D1.Geometry; namespace Perspex.Direct2D1.Media { - using Perspex.Media; - using Perspex.Platform; - using SharpDX.Direct2D1; - using Splat; - using D2DGeometry = SharpDX.Direct2D1.Geometry; - /// /// A Direct2D implementation of a . /// public class StreamGeometryImpl : GeometryImpl, IStreamGeometryImpl { - private PathGeometry path; + private PathGeometry _path; /// /// Initializes a new instance of the class. @@ -25,7 +22,7 @@ namespace Perspex.Direct2D1.Media public StreamGeometryImpl() { Factory factory = Locator.Current.GetService(); - this.path = new PathGeometry(factory); + _path = new PathGeometry(factory); } /// @@ -34,19 +31,19 @@ namespace Perspex.Direct2D1.Media /// An existing Direct2D . protected StreamGeometryImpl(PathGeometry geometry) { - this.path = geometry; + _path = geometry; } /// public override Rect Bounds { - get { return this.path.GetBounds().ToPerspex(); } + get { return _path.GetBounds().ToPerspex(); } } /// public override D2DGeometry DefiningGeometry { - get { return this.path; } + get { return _path; } } /// @@ -58,7 +55,7 @@ namespace Perspex.Direct2D1.Media Factory factory = Locator.Current.GetService(); var result = new PathGeometry(factory); var sink = result.Open(); - this.path.Stream(sink); + _path.Stream(sink); sink.Close(); return new StreamGeometryImpl(result); } @@ -71,7 +68,7 @@ namespace Perspex.Direct2D1.Media /// public IStreamGeometryContextImpl Open() { - return new StreamGeometryContextImpl(this.path.Open()); + return new StreamGeometryContextImpl(_path.Open()); } } } diff --git a/src/Windows/Perspex.Direct2D1/Media/VisualBrushImpl.cs b/src/Windows/Perspex.Direct2D1/Media/VisualBrushImpl.cs index f02566b584..320ac413e3 100644 --- a/src/Windows/Perspex.Direct2D1/Media/VisualBrushImpl.cs +++ b/src/Windows/Perspex.Direct2D1/Media/VisualBrushImpl.cs @@ -1,16 +1,13 @@ - - - - +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. +using System; +using Perspex.Layout; +using Perspex.Media; +using SharpDX.Direct2D1; namespace Perspex.Direct2D1.Media { - using System; - using Perspex.Layout; - using Perspex.Media; - using SharpDX.Direct2D1; - public class VisualBrushImpl : BrushImpl { public VisualBrushImpl( diff --git a/src/Windows/Perspex.Direct2D1/PrimitiveExtensions.cs b/src/Windows/Perspex.Direct2D1/PrimitiveExtensions.cs index 941b3d5520..732744c16d 100644 --- a/src/Windows/Perspex.Direct2D1/PrimitiveExtensions.cs +++ b/src/Windows/Perspex.Direct2D1/PrimitiveExtensions.cs @@ -1,17 +1,14 @@ - - - - +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. +using System; +using System.Linq; +using SharpDX; +using SharpDX.Direct2D1; +using DWrite = SharpDX.DirectWrite; namespace Perspex.Direct2D1 { - using System; - using System.Linq; - using SharpDX; - using SharpDX.Direct2D1; - using DWrite = SharpDX.DirectWrite; - public static class PrimitiveExtensions { public static Rect ToPerspex(this RectangleF r) diff --git a/src/Windows/Perspex.Direct2D1/Properties/AssemblyInfo.cs b/src/Windows/Perspex.Direct2D1/Properties/AssemblyInfo.cs index 8342e83b68..83ca0abbe7 100644 --- a/src/Windows/Perspex.Direct2D1/Properties/AssemblyInfo.cs +++ b/src/Windows/Perspex.Direct2D1/Properties/AssemblyInfo.cs @@ -1,8 +1,5 @@ - - - - - +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. using System.Reflection; diff --git a/src/Windows/Perspex.Direct2D1/Renderer.cs b/src/Windows/Perspex.Direct2D1/Renderer.cs index aec2fb5a29..e1414b7b4a 100644 --- a/src/Windows/Perspex.Direct2D1/Renderer.cs +++ b/src/Windows/Perspex.Direct2D1/Renderer.cs @@ -1,27 +1,24 @@ - - - - - +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. + +using System; +using Perspex.Direct2D1.Media; +using Perspex.Media; +using Perspex.Platform; +using Perspex.Rendering; +using SharpDX; +using SharpDX.Direct2D1; +using Splat; +using DwFactory = SharpDX.DirectWrite.Factory; namespace Perspex.Direct2D1 { - using System; - using Perspex.Direct2D1.Media; - using Perspex.Media; - using Perspex.Platform; - using Perspex.Rendering; - using SharpDX; - using SharpDX.Direct2D1; - using Splat; - using DwFactory = SharpDX.DirectWrite.Factory; - public class Renderer : RendererBase { /// /// The render target. /// - private RenderTarget renderTarget; + private RenderTarget _renderTarget; /// /// Initializes a new instance of the class. @@ -45,7 +42,7 @@ namespace Perspex.Direct2D1 PresentOptions = PresentOptions.Immediately, }; - this.renderTarget = new WindowRenderTarget( + _renderTarget = new WindowRenderTarget( this.Direct2DFactory, renderTargetProperties, hwndProperties); @@ -59,7 +56,7 @@ namespace Perspex.Direct2D1 { this.Direct2DFactory = Locator.Current.GetService(); this.DirectWriteFactory = Locator.Current.GetService(); - this.renderTarget = renderTarget; + _renderTarget = renderTarget; } /// @@ -87,13 +84,13 @@ namespace Perspex.Direct2D1 /// The new height. public override void Resize(int width, int height) { - WindowRenderTarget window = this.renderTarget as WindowRenderTarget; + WindowRenderTarget window = _renderTarget as WindowRenderTarget; if (window == null) { throw new InvalidOperationException(string.Format( "A renderer with a target of type '{0}' cannot be resized.", - this.renderTarget.GetType().Name)); + _renderTarget.GetType().Name)); } window.Resize(new Size2(width, height)); @@ -106,12 +103,12 @@ namespace Perspex.Direct2D1 /// An . protected override IDrawingContext CreateDrawingContext(IPlatformHandle handle) { - return new DrawingContext(this.renderTarget, this.DirectWriteFactory); + return new DrawingContext(_renderTarget, this.DirectWriteFactory); } public override void Dispose() { - this.renderTarget.Dispose(); + _renderTarget.Dispose(); } } } diff --git a/src/Windows/Perspex.Win32/AssetLoader.cs b/src/Windows/Perspex.Win32/AssetLoader.cs index 53196b283c..843f0b8317 100644 --- a/src/Windows/Perspex.Win32/AssetLoader.cs +++ b/src/Windows/Perspex.Win32/AssetLoader.cs @@ -1,18 +1,15 @@ - - - - +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. +using System; +using System.Globalization; +using System.IO; +using System.Reflection; +using System.Resources; +using Perspex.Platform; namespace Perspex.Win32 { - using System; - using System.Globalization; - using System.IO; - using System.Reflection; - using System.Resources; - using Perspex.Platform; - /// /// Loads assets compiled into the application binary. /// diff --git a/src/Windows/Perspex.Win32/ClipboardImpl.cs b/src/Windows/Perspex.Win32/ClipboardImpl.cs index 6a3dd3a657..a9b16d0431 100644 --- a/src/Windows/Perspex.Win32/ClipboardImpl.cs +++ b/src/Windows/Perspex.Win32/ClipboardImpl.cs @@ -1,17 +1,20 @@ -namespace Perspex.Win32 -{ - using System; - using System.Collections.Generic; - using System.Linq; - using System.Text; - using System.Threading.Tasks; - using Perspex.Input.Platform; - using Perspex.Win32.Interop; - using System.Runtime.InteropServices; +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. + +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Perspex.Input.Platform; +using Perspex.Win32.Interop; +using System.Runtime.InteropServices; - class ClipboardImpl : IClipboard +namespace Perspex.Win32 +{ + internal class ClipboardImpl : IClipboard { - async Task OpenClipboard() + private async Task OpenClipboard() { while (!UnmanagedMethods.OpenClipboard(IntPtr.Zero)) { @@ -56,7 +59,7 @@ await this.OpenClipboard(); try { - var hGlobal = Marshal.StringToHGlobalUni(text); + var hGlobal = Marshal.StringToHGlobalUni(text); UnmanagedMethods.SetClipboardData(UnmanagedMethods.ClipboardFormat.CF_UNICODETEXT, hGlobal); } finally diff --git a/src/Windows/Perspex.Win32/CursorFactory.cs b/src/Windows/Perspex.Win32/CursorFactory.cs index 5307fe135d..ed4212e19e 100644 --- a/src/Windows/Perspex.Win32/CursorFactory.cs +++ b/src/Windows/Perspex.Win32/CursorFactory.cs @@ -1,16 +1,18 @@ -using Perspex.Win32.Interop; +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. + +using Perspex.Win32.Interop; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Perspex.Input; +using Perspex.Platform; namespace Perspex.Win32 { - using System; - using System.Collections.Generic; - using System.Linq; - using System.Text; - using System.Threading.Tasks; - using Perspex.Input; - using Perspex.Platform; - - class CursorFactory : IStandardCursorFactory + internal class CursorFactory : IStandardCursorFactory { public static CursorFactory Instance { get; } = new CursorFactory(); @@ -18,10 +20,9 @@ namespace Perspex.Win32 { } - private static readonly Dictionary CursorTypeMapping = new Dictionary + private static readonly Dictionary s_cursorTypeMapping = new Dictionary { - { StandardCursorType.AppStarting, 32650 }, { StandardCursorType.Arrow, 32512 }, { StandardCursorType.Cross, 32515 }, @@ -40,18 +41,18 @@ namespace Perspex.Win32 { StandardCursorType.Wait, 32514 } }; - private static readonly Dictionary Cache = + private static readonly Dictionary s_cache = new Dictionary(); public IPlatformHandle GetCursor(StandardCursorType cursorType) { IPlatformHandle rv; - if (!Cache.TryGetValue(cursorType, out rv)) + if (!s_cache.TryGetValue(cursorType, out rv)) { - Cache[cursorType] = + s_cache[cursorType] = rv = new PlatformHandle( - UnmanagedMethods.LoadCursor(IntPtr.Zero, new IntPtr(CursorTypeMapping[cursorType])), + UnmanagedMethods.LoadCursor(IntPtr.Zero, new IntPtr(s_cursorTypeMapping[cursorType])), PlatformConstants.CursorHandleType); } diff --git a/src/Windows/Perspex.Win32/Embedding/EmbeddedWindowImpl.cs b/src/Windows/Perspex.Win32/Embedding/EmbeddedWindowImpl.cs index d09b92f78b..36f86fa02f 100644 --- a/src/Windows/Perspex.Win32/Embedding/EmbeddedWindowImpl.cs +++ b/src/Windows/Perspex.Win32/Embedding/EmbeddedWindowImpl.cs @@ -1,11 +1,14 @@ -namespace Perspex.Win32 -{ - using System; - using Perspex.Win32.Interop; +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. + +using System; +using Perspex.Win32.Interop; +namespace Perspex.Win32 +{ public class EmbeddedWindowImpl : WindowImpl { - private static readonly System.Windows.Forms.UserControl WinFormsControl = new System.Windows.Forms.UserControl(); + private static readonly System.Windows.Forms.UserControl s_winFormsControl = new System.Windows.Forms.UserControl(); public IntPtr Handle { get; private set; } @@ -20,7 +23,7 @@ UnmanagedMethods.CW_USEDEFAULT, UnmanagedMethods.CW_USEDEFAULT, UnmanagedMethods.CW_USEDEFAULT, - WinFormsControl.Handle, + s_winFormsControl.Handle, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero); diff --git a/src/Windows/Perspex.Win32/Input/KeyInterop.cs b/src/Windows/Perspex.Win32/Input/KeyInterop.cs index d4dc2d92b6..3f04af3c4b 100644 --- a/src/Windows/Perspex.Win32/Input/KeyInterop.cs +++ b/src/Windows/Perspex.Win32/Input/KeyInterop.cs @@ -1,19 +1,16 @@ - - - - +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. +using System.Collections.Generic; +using System.Text; +using Perspex.Input; +using Perspex.Win32.Interop; namespace Perspex.Win32.Input { - using System.Collections.Generic; - using System.Text; - using Perspex.Input; - using Perspex.Win32.Interop; - public static class KeyInterop { - private static Dictionary virtualKeyFromKey = new Dictionary + private static Dictionary s_virtualKeyFromKey = new Dictionary { { Key.None, 0 }, { Key.Cancel, 3 }, @@ -190,7 +187,7 @@ namespace Perspex.Win32.Input { Key.DeadCharProcessed, 0 }, }; - private static Dictionary keyFromVirtualKey = new Dictionary + private static Dictionary s_keyFromVirtualKey = new Dictionary { { 0, Key.None }, { 3, Key.Cancel }, @@ -368,14 +365,14 @@ namespace Perspex.Win32.Input public static Key KeyFromVirtualKey(int virtualKey) { Key result; - keyFromVirtualKey.TryGetValue(virtualKey, out result); + s_keyFromVirtualKey.TryGetValue(virtualKey, out result); return result; } public static int VirtualKeyFromKey(Key key) { int result; - virtualKeyFromKey.TryGetValue(key, out result); + s_virtualKeyFromKey.TryGetValue(key, out result); return result; } } diff --git a/src/Windows/Perspex.Win32/Input/WindowsKeyboardDevice.cs b/src/Windows/Perspex.Win32/Input/WindowsKeyboardDevice.cs index 7f5b40885b..b2454fb658 100644 --- a/src/Windows/Perspex.Win32/Input/WindowsKeyboardDevice.cs +++ b/src/Windows/Perspex.Win32/Input/WindowsKeyboardDevice.cs @@ -1,25 +1,22 @@ - - - - +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. +using System.Text; +using Perspex.Controls; +using Perspex.Input; +using Perspex.Win32.Interop; namespace Perspex.Win32.Input { - using System.Text; - using Perspex.Controls; - using Perspex.Input; - using Perspex.Win32.Interop; - public class WindowsKeyboardDevice : KeyboardDevice { - private static WindowsKeyboardDevice instance = new WindowsKeyboardDevice(); + private static WindowsKeyboardDevice s_instance = new WindowsKeyboardDevice(); - private byte[] keyStates = new byte[256]; + private byte[] _keyStates = new byte[256]; public static new WindowsKeyboardDevice Instance { - get { return instance; } + get { return s_instance; } } public ModifierKeys Modifiers @@ -64,7 +61,7 @@ namespace Perspex.Win32.Input int length = UnmanagedMethods.ToUnicode( virtualKey, 0, - this.keyStates, + _keyStates, result, 256, 0); @@ -73,7 +70,7 @@ namespace Perspex.Win32.Input private void UpdateKeyStates() { - UnmanagedMethods.GetKeyboardState(this.keyStates); + UnmanagedMethods.GetKeyboardState(_keyStates); } private bool IsDown(Key key) @@ -84,7 +81,7 @@ namespace Perspex.Win32.Input private KeyStates GetKeyStates(Key key) { int vk = KeyInterop.VirtualKeyFromKey(key); - byte state = this.keyStates[vk]; + byte state = _keyStates[vk]; KeyStates result = 0; if ((state & 0x80) != 0) diff --git a/src/Windows/Perspex.Win32/Input/WindowsMouseDevice.cs b/src/Windows/Perspex.Win32/Input/WindowsMouseDevice.cs index 994196d2b0..3bd38c2ace 100644 --- a/src/Windows/Perspex.Win32/Input/WindowsMouseDevice.cs +++ b/src/Windows/Perspex.Win32/Input/WindowsMouseDevice.cs @@ -1,23 +1,20 @@ - - - - +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. +using System; +using Perspex.Input; +using Perspex.Interactivity; +using Perspex.Win32.Interop; namespace Perspex.Win32.Input { - using System; - using Perspex.Input; - using Perspex.Interactivity; - using Perspex.Win32.Interop; - public class WindowsMouseDevice : MouseDevice { - private static WindowsMouseDevice instance = new WindowsMouseDevice(); + private static WindowsMouseDevice s_instance = new WindowsMouseDevice(); public static new WindowsMouseDevice Instance { - get { return instance; } + get { return s_instance; } } public WindowImpl CurrentWindow diff --git a/src/Windows/Perspex.Win32/Interop/UnmanagedMethods.cs b/src/Windows/Perspex.Win32/Interop/UnmanagedMethods.cs index cfc7036d4b..0cbcd707ca 100644 --- a/src/Windows/Perspex.Win32/Interop/UnmanagedMethods.cs +++ b/src/Windows/Perspex.Win32/Interop/UnmanagedMethods.cs @@ -1,16 +1,13 @@ - - - - +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. +using System; +using System.Diagnostics.CodeAnalysis; +using System.Runtime.InteropServices; +using System.Text; namespace Perspex.Win32.Interop { - using System; - using System.Diagnostics.CodeAnalysis; - using System.Runtime.InteropServices; - using System.Text; - [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.")] @@ -656,13 +653,13 @@ namespace Perspex.Win32.Interop [DllImport("user32.dll", SetLastError = true)] public static extern bool CloseClipboard(); - + [DllImport("user32.dll")] public static extern bool EmptyClipboard(); [DllImport("user32.dll")] public static extern IntPtr GetClipboardData(ClipboardFormat uFormat); - + [DllImport("user32.dll")] public static extern IntPtr SetClipboardData(ClipboardFormat uFormat, IntPtr hMem); @@ -677,7 +674,7 @@ namespace Perspex.Win32.Interop public static extern IntPtr GlobalAlloc(int uFlags, int dwBytes); [DllImport("kernel32.dll", CharSet = CharSet.Auto, ExactSpelling = true)] - public static extern IntPtr GlobalFree(IntPtr hMem); + public static extern IntPtr GlobalFree(IntPtr hMem); diff --git a/src/Windows/Perspex.Win32/PlatformConstants.cs b/src/Windows/Perspex.Win32/PlatformConstants.cs index de9439624c..38d2f771f3 100644 --- a/src/Windows/Perspex.Win32/PlatformConstants.cs +++ b/src/Windows/Perspex.Win32/PlatformConstants.cs @@ -1,8 +1,5 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. namespace Perspex.Win32 { diff --git a/src/Windows/Perspex.Win32/PopupImpl.cs b/src/Windows/Perspex.Win32/PopupImpl.cs index d444dfbcc2..27953fe7cc 100644 --- a/src/Windows/Perspex.Win32/PopupImpl.cs +++ b/src/Windows/Perspex.Win32/PopupImpl.cs @@ -1,15 +1,12 @@ - - - - +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. +using System; +using Perspex.Platform; +using Perspex.Win32.Interop; namespace Perspex.Win32 { - using System; - using Perspex.Platform; - using Perspex.Win32.Interop; - public class PopupImpl : WindowImpl, IPopupImpl { public void SetPosition(Point p) diff --git a/src/Windows/Perspex.Win32/Properties/AssemblyInfo.cs b/src/Windows/Perspex.Win32/Properties/AssemblyInfo.cs index 1932e5d412..12c2623551 100644 --- a/src/Windows/Perspex.Win32/Properties/AssemblyInfo.cs +++ b/src/Windows/Perspex.Win32/Properties/AssemblyInfo.cs @@ -1,8 +1,5 @@ - - - - - +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. using System.Reflection; diff --git a/src/Windows/Perspex.Win32/Win32Platform.cs b/src/Windows/Perspex.Win32/Win32Platform.cs index 93f08b8a7e..dfdd7ad6ea 100644 --- a/src/Windows/Perspex.Win32/Win32Platform.cs +++ b/src/Windows/Perspex.Win32/Win32Platform.cs @@ -1,34 +1,30 @@ - - - - - +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. using Perspex.Input.Platform; +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Diagnostics.CodeAnalysis; +using System.Reactive.Disposables; +using System.Runtime.InteropServices; +using Perspex.Input; +using Perspex.Platform; +using Perspex.Win32.Input; +using Perspex.Win32.Interop; +using Splat; namespace Perspex.Win32 { - using System; - using System.Collections.Generic; - using System.ComponentModel; - using System.Diagnostics.CodeAnalysis; - using System.Reactive.Disposables; - using System.Runtime.InteropServices; - using Perspex.Input; - using Perspex.Platform; - using Perspex.Win32.Input; - using Perspex.Win32.Interop; - using Splat; - public class Win32Platform : IPlatformThreadingInterface, IPlatformSettings { - private static Win32Platform instance = new Win32Platform(); + private static Win32Platform s_instance = new Win32Platform(); - private UnmanagedMethods.WndProc wndProcDelegate; + private UnmanagedMethods.WndProc _wndProcDelegate; - private IntPtr hwnd; + private IntPtr _hwnd; - private List delegates = new List(); + private List _delegates = new List(); public Win32Platform() { @@ -58,8 +54,8 @@ namespace Perspex.Win32 locator.Register(() => WindowsKeyboardDevice.Instance, typeof(IKeyboardDevice)); locator.Register(() => WindowsMouseDevice.Instance, typeof(IMouseDevice)); locator.Register(() => CursorFactory.Instance, typeof(IStandardCursorFactory)); - locator.Register(() => instance, typeof(IPlatformSettings)); - locator.Register(() => instance, typeof(IPlatformThreadingInterface)); + locator.Register(() => s_instance, typeof(IPlatformSettings)); + locator.Register(() => s_instance, typeof(IPlatformThreadingInterface)); locator.RegisterConstant(new AssetLoader(), typeof(IAssetLoader)); } @@ -103,11 +99,11 @@ namespace Perspex.Win32 timerDelegate); // Prevent timerDelegate being garbage collected. - this.delegates.Add(timerDelegate); + _delegates.Add(timerDelegate); return Disposable.Create(() => { - this.delegates.Remove(timerDelegate); + _delegates.Remove(timerDelegate); UnmanagedMethods.KillTimer(IntPtr.Zero, handle); }); } @@ -130,12 +126,12 @@ namespace Perspex.Win32 private void CreateMessageWindow() { // Ensure that the delegate doesn't get garbage collected by storing it as a field. - this.wndProcDelegate = new UnmanagedMethods.WndProc(this.WndProc); + _wndProcDelegate = new UnmanagedMethods.WndProc(this.WndProc); UnmanagedMethods.WNDCLASSEX wndClassEx = new UnmanagedMethods.WNDCLASSEX { cbSize = Marshal.SizeOf(typeof(UnmanagedMethods.WNDCLASSEX)), - lpfnWndProc = this.wndProcDelegate, + lpfnWndProc = _wndProcDelegate, hInstance = Marshal.GetHINSTANCE(this.GetType().Module), lpszClassName = "PerspexMessageWindow", }; @@ -147,9 +143,9 @@ namespace Perspex.Win32 throw new Win32Exception(); } - this.hwnd = UnmanagedMethods.CreateWindowEx(0, atom, null, 0, 0, 0, 0, 0, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero); + _hwnd = UnmanagedMethods.CreateWindowEx(0, atom, null, 0, 0, 0, 0, 0, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero); - if (this.hwnd == IntPtr.Zero) + if (_hwnd == IntPtr.Zero) { throw new Win32Exception(); } diff --git a/src/Windows/Perspex.Win32/WindowImpl.cs b/src/Windows/Perspex.Win32/WindowImpl.cs index 9059f10ef9..443b369e63 100644 --- a/src/Windows/Perspex.Win32/WindowImpl.cs +++ b/src/Windows/Perspex.Win32/WindowImpl.cs @@ -1,48 +1,44 @@ - - - - - +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. using Perspex.Input; +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Diagnostics.CodeAnalysis; +using System.Linq; +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; namespace Perspex.Win32 { - using System; - using System.Collections.Generic; - using System.ComponentModel; - using System.Diagnostics.CodeAnalysis; - using System.Linq; - 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 { - private static List instances = new List(); + private static List s_instances = new List(); - private static readonly IntPtr DefaultCursor = UnmanagedMethods.LoadCursor( - IntPtr.Zero, new IntPtr((int) UnmanagedMethods.Cursor.IDC_ARROW)); + private static readonly IntPtr s_defaultCursor = UnmanagedMethods.LoadCursor( + IntPtr.Zero, new IntPtr((int)UnmanagedMethods.Cursor.IDC_ARROW)); - private UnmanagedMethods.WndProc wndProcDelegate; + private UnmanagedMethods.WndProc _wndProcDelegate; - private string className; + private string _className; - private IntPtr hwnd; + private IntPtr _hwnd; - private TopLevel owner; + private TopLevel _owner; - private bool trackingMouse; + private bool _trackingMouse; public WindowImpl() { this.CreateWindow(); - instances.Add(this); + s_instances.Add(this); } public Action Activated { get; set; } @@ -62,7 +58,7 @@ namespace Perspex.Win32 get { UnmanagedMethods.RECT rect; - UnmanagedMethods.GetClientRect(this.hwnd, out rect); + UnmanagedMethods.GetClientRect(_hwnd, out rect); return new Size(rect.right, rect.bottom); } @@ -70,14 +66,14 @@ namespace Perspex.Win32 { if (value != this.ClientSize) { - var style = UnmanagedMethods.GetWindowLong(this.hwnd, -16); - var exStyle = UnmanagedMethods.GetWindowLong(this.hwnd, -20); + var style = UnmanagedMethods.GetWindowLong(_hwnd, -16); + var exStyle = UnmanagedMethods.GetWindowLong(_hwnd, -20); var padding = new UnmanagedMethods.RECT(); if (UnmanagedMethods.AdjustWindowRectEx(ref padding, style, false, exStyle)) { UnmanagedMethods.SetWindowPos( - this.hwnd, + _hwnd, IntPtr.Zero, 0, 0, @@ -97,13 +93,13 @@ namespace Perspex.Win32 public bool IsEnabled { - get { return UnmanagedMethods.IsWindowEnabled(this.hwnd); } - set { UnmanagedMethods.EnableWindow(this.hwnd, value); } + get { return UnmanagedMethods.IsWindowEnabled(_hwnd); } + set { UnmanagedMethods.EnableWindow(_hwnd, value); } } public void Activate() { - UnmanagedMethods.SetActiveWindow(this.hwnd); + UnmanagedMethods.SetActiveWindow(_hwnd); } public IPopupImpl CreatePopup() @@ -113,13 +109,13 @@ namespace Perspex.Win32 public void Dispose() { - instances.Remove(this); - UnmanagedMethods.DestroyWindow(this.hwnd); + s_instances.Remove(this); + UnmanagedMethods.DestroyWindow(_hwnd); } public void Hide() { - UnmanagedMethods.ShowWindow(this.hwnd, UnmanagedMethods.ShowWindowCommand.Hide); + UnmanagedMethods.ShowWindow(_hwnd, UnmanagedMethods.ShowWindowCommand.Hide); } public void Invalidate(Rect rect) @@ -132,41 +128,41 @@ namespace Perspex.Win32 bottom = (int)rect.Bottom, }; - UnmanagedMethods.InvalidateRect(this.hwnd, ref r, false); + UnmanagedMethods.InvalidateRect(_hwnd, ref r, false); } public Point PointToScreen(Point point) { var p = new UnmanagedMethods.POINT { X = (int)point.X, Y = (int)point.Y }; - UnmanagedMethods.ClientToScreen(this.hwnd, ref p); + UnmanagedMethods.ClientToScreen(_hwnd, ref p); return new Point(p.X, p.Y); } public void SetOwner(TopLevel owner) { - this.owner = owner; + _owner = owner; } public void SetTitle(string title) { - UnmanagedMethods.SetWindowText(this.hwnd, title); + UnmanagedMethods.SetWindowText(_hwnd, title); } public virtual void Show() { - UnmanagedMethods.ShowWindow(this.hwnd, UnmanagedMethods.ShowWindowCommand.Normal); + UnmanagedMethods.ShowWindow(_hwnd, UnmanagedMethods.ShowWindowCommand.Normal); } public virtual IDisposable ShowDialog() { - var disabled = instances.Where(x => x != this && x.IsEnabled).ToList(); + var disabled = s_instances.Where(x => x != this && x.IsEnabled).ToList(); TopLevel activated = null; foreach (var window in disabled) { - if (window.owner.IsActive) + if (window._owner.IsActive) { - activated = window.owner; + activated = window._owner; } window.IsEnabled = false; @@ -190,8 +186,8 @@ namespace Perspex.Win32 public void SetCursor(IPlatformHandle cursor) { - UnmanagedMethods.SetClassLong(this.hwnd, UnmanagedMethods.ClassLongIndex.GCL_HCURSOR, - cursor?.Handle ?? DefaultCursor); + UnmanagedMethods.SetClassLong(_hwnd, UnmanagedMethods.ClassLongIndex.GCL_HCURSOR, + cursor?.Handle ?? s_defaultCursor); } protected virtual IntPtr CreateWindowOverride(ushort atom) @@ -253,7 +249,7 @@ namespace Perspex.Win32 case UnmanagedMethods.WindowsMessage.WM_DESTROY: if (this.Closed != null) { - UnmanagedMethods.UnregisterClass(this.className, Marshal.GetHINSTANCE(this.GetType().Module)); + UnmanagedMethods.UnregisterClass(_className, Marshal.GetHINSTANCE(this.GetType().Module)); this.Closed(); } @@ -281,7 +277,7 @@ namespace Perspex.Win32 if (wParam.ToInt32() > 32) { e = new RawTextInputEventArgs(WindowsKeyboardDevice.Instance, timestamp, - new string((char) wParam.ToInt32(), 1)); + new string((char)wParam.ToInt32(), 1)); } break; @@ -289,7 +285,7 @@ namespace Perspex.Win32 e = new RawMouseEventArgs( WindowsMouseDevice.Instance, timestamp, - this.owner, + _owner, RawMouseEventType.LeftButtonDown, new Point((uint)lParam & 0xffff, (uint)lParam >> 16), WindowsKeyboardDevice.Instance.Modifiers); break; @@ -298,19 +294,19 @@ namespace Perspex.Win32 e = new RawMouseEventArgs( WindowsMouseDevice.Instance, timestamp, - this.owner, + _owner, RawMouseEventType.LeftButtonUp, new Point((uint)lParam & 0xffff, (uint)lParam >> 16), WindowsKeyboardDevice.Instance.Modifiers); break; case UnmanagedMethods.WindowsMessage.WM_MOUSEMOVE: - if (!this.trackingMouse) + if (!_trackingMouse) { var tm = new UnmanagedMethods.TRACKMOUSEEVENT { cbSize = Marshal.SizeOf(typeof(UnmanagedMethods.TRACKMOUSEEVENT)), dwFlags = 2, - hwndTrack = this.hwnd, + hwndTrack = _hwnd, dwHoverTime = 0, }; @@ -320,7 +316,7 @@ namespace Perspex.Win32 e = new RawMouseEventArgs( WindowsMouseDevice.Instance, timestamp, - this.owner, + _owner, RawMouseEventType.Move, new Point((uint)lParam & 0xffff, (uint)lParam >> 16), WindowsKeyboardDevice.Instance.Modifiers); break; @@ -329,17 +325,17 @@ namespace Perspex.Win32 e = new RawMouseWheelEventArgs( WindowsMouseDevice.Instance, timestamp, - this.owner, + _owner, this.ScreenToClient((uint)lParam & 0xffff, (uint)lParam >> 16), new Vector(0, ((int)wParam >> 16) / WheelDelta), WindowsKeyboardDevice.Instance.Modifiers); break; case UnmanagedMethods.WindowsMessage.WM_MOUSELEAVE: - this.trackingMouse = false; + _trackingMouse = false; e = new RawMouseEventArgs( WindowsMouseDevice.Instance, timestamp, - this.owner, + _owner, RawMouseEventType.LeaveWindow, new Point(), WindowsKeyboardDevice.Instance.Modifiers); break; @@ -349,12 +345,12 @@ namespace Perspex.Win32 { UnmanagedMethods.PAINTSTRUCT ps; - if (UnmanagedMethods.BeginPaint(this.hwnd, out ps) != IntPtr.Zero) + if (UnmanagedMethods.BeginPaint(_hwnd, out ps) != IntPtr.Zero) { UnmanagedMethods.RECT r; - UnmanagedMethods.GetUpdateRect(this.hwnd, out r, false); + UnmanagedMethods.GetUpdateRect(_hwnd, out r, false); this.Paint(new Rect(r.left, r.top, r.right - r.left, r.bottom - r.top), this.Handle); - UnmanagedMethods.EndPaint(this.hwnd, ref ps); + UnmanagedMethods.EndPaint(_hwnd, ref ps); } } @@ -382,19 +378,19 @@ namespace Perspex.Win32 private void CreateWindow() { // Ensure that the delegate doesn't get garbage collected by storing it as a field. - this.wndProcDelegate = new UnmanagedMethods.WndProc(this.WndProc); + _wndProcDelegate = new UnmanagedMethods.WndProc(this.WndProc); - this.className = Guid.NewGuid().ToString(); + _className = Guid.NewGuid().ToString(); UnmanagedMethods.WNDCLASSEX wndClassEx = new UnmanagedMethods.WNDCLASSEX { cbSize = Marshal.SizeOf(typeof(UnmanagedMethods.WNDCLASSEX)), style = 0, - lpfnWndProc = this.wndProcDelegate, + lpfnWndProc = _wndProcDelegate, hInstance = Marshal.GetHINSTANCE(this.GetType().Module), - hCursor = DefaultCursor, + hCursor = s_defaultCursor, hbrBackground = (IntPtr)5, - lpszClassName = this.className, + lpszClassName = _className, }; ushort atom = UnmanagedMethods.RegisterClassEx(ref wndClassEx); @@ -404,20 +400,20 @@ namespace Perspex.Win32 throw new Win32Exception(); } - this.hwnd = this.CreateWindowOverride(atom); + _hwnd = this.CreateWindowOverride(atom); - if (this.hwnd == IntPtr.Zero) + if (_hwnd == IntPtr.Zero) { throw new Win32Exception(); } - this.Handle = new PlatformHandle(this.hwnd, PlatformConstants.WindowHandleType); + this.Handle = new PlatformHandle(_hwnd, PlatformConstants.WindowHandleType); } private Point ScreenToClient(uint x, uint y) { var p = new UnmanagedMethods.POINT { X = (int)x, Y = (int)y }; - UnmanagedMethods.ScreenToClient(this.hwnd, ref p); + UnmanagedMethods.ScreenToClient(_hwnd, ref p); return new Point(p.X, p.Y); } } diff --git a/tests/Perspex.Base.UnitTests/Collections/CollectionChangedTracker.cs b/tests/Perspex.Base.UnitTests/Collections/CollectionChangedTracker.cs index f0f07d22ae..855775ef26 100644 --- a/tests/Perspex.Base.UnitTests/Collections/CollectionChangedTracker.cs +++ b/tests/Perspex.Base.UnitTests/Collections/CollectionChangedTracker.cs @@ -1,14 +1,11 @@ - - - - +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. +using System; +using System.Collections.Specialized; namespace Perspex.Base.UnitTests.Collections { - using System; - using System.Collections.Specialized; - internal class CollectionChangedTracker { public CollectionChangedTracker(INotifyCollectionChanged collection) diff --git a/tests/Perspex.Base.UnitTests/Collections/PerspexDictionaryTests.cs b/tests/Perspex.Base.UnitTests/Collections/PerspexDictionaryTests.cs index fa32e7b4cc..13c271f0f2 100644 --- a/tests/Perspex.Base.UnitTests/Collections/PerspexDictionaryTests.cs +++ b/tests/Perspex.Base.UnitTests/Collections/PerspexDictionaryTests.cs @@ -1,16 +1,13 @@ - - - - +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. +using System.Collections.Generic; +using System.Collections.Specialized; +using Perspex.Collections; +using Xunit; namespace Perspex.Base.UnitTests.Collections { - using System.Collections.Generic; - using System.Collections.Specialized; - using Perspex.Collections; - using Xunit; - public class PerspexDictionaryTests { [Fact] diff --git a/tests/Perspex.Base.UnitTests/Collections/PerspexListTests.cs b/tests/Perspex.Base.UnitTests/Collections/PerspexListTests.cs index b7d0a22ddd..70509b9f0c 100644 --- a/tests/Perspex.Base.UnitTests/Collections/PerspexListTests.cs +++ b/tests/Perspex.Base.UnitTests/Collections/PerspexListTests.cs @@ -1,18 +1,15 @@ - - - - +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. +using System; +using System.Collections.Generic; +using System.Collections.Specialized; +using System.Linq; +using Perspex.Collections; +using Xunit; namespace Perspex.Base.UnitTests.Collections { - using System; - using System.Collections.Generic; - using System.Collections.Specialized; - using System.Linq; - using Perspex.Collections; - using Xunit; - public class PerspexListTests { [Fact] diff --git a/tests/Perspex.Base.UnitTests/Collections/PropertyChangedTracker.cs b/tests/Perspex.Base.UnitTests/Collections/PropertyChangedTracker.cs index 0a701625fc..f08150f176 100644 --- a/tests/Perspex.Base.UnitTests/Collections/PropertyChangedTracker.cs +++ b/tests/Perspex.Base.UnitTests/Collections/PropertyChangedTracker.cs @@ -1,15 +1,12 @@ - - - - +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. +using System; +using System.Collections.Generic; +using System.ComponentModel; namespace Perspex.Base.UnitTests.Collections { - using System; - using System.Collections.Generic; - using System.ComponentModel; - internal class PropertyChangedTracker { public PropertyChangedTracker(INotifyPropertyChanged obj) diff --git a/tests/Perspex.Base.UnitTests/PerspexObjectTests_Binding.cs b/tests/Perspex.Base.UnitTests/PerspexObjectTests_Binding.cs index 2db8d2820b..d0e496e893 100644 --- a/tests/Perspex.Base.UnitTests/PerspexObjectTests_Binding.cs +++ b/tests/Perspex.Base.UnitTests/PerspexObjectTests_Binding.cs @@ -1,16 +1,13 @@ - - - - +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. +using System; +using System.Reactive.Linq; +using System.Reactive.Subjects; +using Xunit; namespace Perspex.Base.UnitTests { - using System; - using System.Reactive.Linq; - using System.Reactive.Subjects; - using Xunit; - public class PerspexObjectTests_Binding { [Fact] diff --git a/tests/Perspex.Base.UnitTests/PerspexObjectTests_GetObservable.cs b/tests/Perspex.Base.UnitTests/PerspexObjectTests_GetObservable.cs index acb5e61c97..1c341649de 100644 --- a/tests/Perspex.Base.UnitTests/PerspexObjectTests_GetObservable.cs +++ b/tests/Perspex.Base.UnitTests/PerspexObjectTests_GetObservable.cs @@ -1,15 +1,12 @@ - - - - +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. +using System; +using System.Reactive.Linq; +using Xunit; namespace Perspex.Base.UnitTests { - using System; - using System.Reactive.Linq; - using Xunit; - public class PerspexObjectTests_GetObservable { [Fact] diff --git a/tests/Perspex.Base.UnitTests/PerspexObjectTests_GetValue.cs b/tests/Perspex.Base.UnitTests/PerspexObjectTests_GetValue.cs index 22c2a48622..f5942018d3 100644 --- a/tests/Perspex.Base.UnitTests/PerspexObjectTests_GetValue.cs +++ b/tests/Perspex.Base.UnitTests/PerspexObjectTests_GetValue.cs @@ -1,13 +1,10 @@ - - - - +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. +using Xunit; namespace Perspex.Base.UnitTests { - using Xunit; - public class PerspexObjectTests_GetValue { [Fact] diff --git a/tests/Perspex.Base.UnitTests/PerspexObjectTests_Inheritance.cs b/tests/Perspex.Base.UnitTests/PerspexObjectTests_Inheritance.cs index 40db1382fc..1920387ccb 100644 --- a/tests/Perspex.Base.UnitTests/PerspexObjectTests_Inheritance.cs +++ b/tests/Perspex.Base.UnitTests/PerspexObjectTests_Inheritance.cs @@ -1,13 +1,10 @@ - - - - +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. +using Xunit; namespace Perspex.Base.UnitTests { - using Xunit; - public class PerspexObjectTests_Inheritance { [Fact] diff --git a/tests/Perspex.Base.UnitTests/PerspexObjectTests_Metadata.cs b/tests/Perspex.Base.UnitTests/PerspexObjectTests_Metadata.cs index c27469d93e..7b778414c0 100644 --- a/tests/Perspex.Base.UnitTests/PerspexObjectTests_Metadata.cs +++ b/tests/Perspex.Base.UnitTests/PerspexObjectTests_Metadata.cs @@ -1,17 +1,12 @@ - - - - +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. +using System.Linq; +using System.Reactive.Linq; +using Xunit; namespace Perspex.Base.UnitTests { - using System; - using System.Linq; - using System.Reactive.Linq; - using System.Reactive.Subjects; - using Xunit; - public class PerspexObjectTests_Metadata { public PerspexObjectTests_Metadata() diff --git a/tests/Perspex.Base.UnitTests/PerspexObjectTests_SetValue.cs b/tests/Perspex.Base.UnitTests/PerspexObjectTests_SetValue.cs index 9fbc62cb10..549c07b4e3 100644 --- a/tests/Perspex.Base.UnitTests/PerspexObjectTests_SetValue.cs +++ b/tests/Perspex.Base.UnitTests/PerspexObjectTests_SetValue.cs @@ -1,17 +1,11 @@ - - - - +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. +using System; +using Xunit; namespace Perspex.Base.UnitTests { - using System; - using System.Linq; - using System.Reactive.Linq; - using System.Reactive.Subjects; - using Xunit; - public class PerspexObjectTests_SetValue { [Fact] @@ -203,7 +197,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/PerspexObjectTests_Validation.cs b/tests/Perspex.Base.UnitTests/PerspexObjectTests_Validation.cs index 2f0f0e15da..524f09995e 100644 --- a/tests/Perspex.Base.UnitTests/PerspexObjectTests_Validation.cs +++ b/tests/Perspex.Base.UnitTests/PerspexObjectTests_Validation.cs @@ -1,14 +1,11 @@ - - - - +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. +using System; +using Xunit; namespace Perspex.Base.UnitTests { - using System; - using Xunit; - public class PerspexObjectTests_Validation { [Fact] diff --git a/tests/Perspex.Base.UnitTests/PerspexPropertyTests.cs b/tests/Perspex.Base.UnitTests/PerspexPropertyTests.cs index dcdcd66e72..d8f2840597 100644 --- a/tests/Perspex.Base.UnitTests/PerspexPropertyTests.cs +++ b/tests/Perspex.Base.UnitTests/PerspexPropertyTests.cs @@ -1,14 +1,11 @@ - - - - +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. +using System; +using Xunit; namespace Perspex.Base.UnitTests { - using System; - using Xunit; - public class PerspexPropertyTests { [Fact] diff --git a/tests/Perspex.Base.UnitTests/PriorityValueTests.cs b/tests/Perspex.Base.UnitTests/PriorityValueTests.cs index f9dc321cd0..3810e51b65 100644 --- a/tests/Perspex.Base.UnitTests/PriorityValueTests.cs +++ b/tests/Perspex.Base.UnitTests/PriorityValueTests.cs @@ -1,17 +1,14 @@ - - - - +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. +using System; +using System.Linq; +using System.Reactive.Linq; +using System.Reactive.Subjects; +using Xunit; namespace Perspex.Base.UnitTests { - using System; - using System.Linq; - using System.Reactive.Linq; - using System.Reactive.Subjects; - using Xunit; - public class PriorityValueTests { [Fact] diff --git a/tests/Perspex.Base.UnitTests/Properties/AssemblyInfo.cs b/tests/Perspex.Base.UnitTests/Properties/AssemblyInfo.cs index a9cdfbc12a..b011d2a1c4 100644 --- a/tests/Perspex.Base.UnitTests/Properties/AssemblyInfo.cs +++ b/tests/Perspex.Base.UnitTests/Properties/AssemblyInfo.cs @@ -1,8 +1,5 @@ - - - - - +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. using System.Reflection; diff --git a/tests/Perspex.Controls.UnitTests/BorderTests.cs b/tests/Perspex.Controls.UnitTests/BorderTests.cs index feb9e04514..eeb2cd8f90 100644 --- a/tests/Perspex.Controls.UnitTests/BorderTests.cs +++ b/tests/Perspex.Controls.UnitTests/BorderTests.cs @@ -1,13 +1,10 @@ - - - - +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. +using Xunit; namespace Perspex.Controls.UnitTests { - using Xunit; - public class BorderTests { [Fact] diff --git a/tests/Perspex.Controls.UnitTests/ContentControlTests.cs b/tests/Perspex.Controls.UnitTests/ContentControlTests.cs index 805d22ec34..8c16953ec8 100644 --- a/tests/Perspex.Controls.UnitTests/ContentControlTests.cs +++ b/tests/Perspex.Controls.UnitTests/ContentControlTests.cs @@ -1,27 +1,23 @@ - - - - - +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. + +using System; +using System.Collections.Specialized; +using System.Linq; +using Moq; +using Perspex.Controls.Presenters; +using Perspex.Controls.Templates; +using Perspex.LogicalTree; +using Perspex.Platform; +using Perspex.Styling; +using Perspex.VisualTree; +using Ploeh.AutoFixture; +using Ploeh.AutoFixture.AutoMoq; +using Splat; +using Xunit; 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.Platform; - using Perspex.Styling; - using Perspex.VisualTree; - using Ploeh.AutoFixture; - using Ploeh.AutoFixture.AutoMoq; - using Splat; - using Xunit; - public class ContentControlTests { [Fact] diff --git a/tests/Perspex.Controls.UnitTests/ContentPresenterTests.cs b/tests/Perspex.Controls.UnitTests/ContentPresenterTests.cs index 269f17ed79..b2ff5029b2 100644 --- a/tests/Perspex.Controls.UnitTests/ContentPresenterTests.cs +++ b/tests/Perspex.Controls.UnitTests/ContentPresenterTests.cs @@ -1,17 +1,13 @@ - - - - +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. +using System.Collections.Specialized; +using System.Linq; +using Perspex.Controls.Presenters; +using Xunit; namespace Perspex.Controls.UnitTests { - using System.Collections.Specialized; - using System.Linq; - using Perspex.Controls; - using Perspex.Controls.Presenters; - using Xunit; - public class ContentPresenterTests { [Fact] diff --git a/tests/Perspex.Controls.UnitTests/ControlTests.cs b/tests/Perspex.Controls.UnitTests/ControlTests.cs index 293b50a074..e18aa9dac4 100644 --- a/tests/Perspex.Controls.UnitTests/ControlTests.cs +++ b/tests/Perspex.Controls.UnitTests/ControlTests.cs @@ -1,21 +1,17 @@ - - - - - +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. + +using System; +using Moq; +using Perspex.Layout; +using Perspex.Platform; +using Perspex.Rendering; +using Perspex.Styling; +using Splat; +using Xunit; namespace Perspex.Controls.UnitTests { - using System; - using Moq; - using Perspex.Controls; - using Perspex.Layout; - using Perspex.Platform; - using Perspex.Rendering; - using Perspex.Styling; - using Splat; - using Xunit; - public class ControlTests { [Fact] diff --git a/tests/Perspex.Controls.UnitTests/DeckTests.cs b/tests/Perspex.Controls.UnitTests/DeckTests.cs index d35bd83cc2..5cff9ca7b8 100644 --- a/tests/Perspex.Controls.UnitTests/DeckTests.cs +++ b/tests/Perspex.Controls.UnitTests/DeckTests.cs @@ -1,17 +1,14 @@ - - - - +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. +using System.Linq; +using Perspex.Controls.Presenters; +using Perspex.Controls.Templates; +using Perspex.LogicalTree; +using Xunit; namespace Perspex.Controls.UnitTests { - using System.Linq; - using Perspex.Controls.Presenters; - using Perspex.Controls.Templates; - using Perspex.LogicalTree; - using Xunit; - public class DeckTests { [Fact] diff --git a/tests/Perspex.Controls.UnitTests/DecoratorTests.cs b/tests/Perspex.Controls.UnitTests/DecoratorTests.cs index 8ad1fd52a0..84be13c397 100644 --- a/tests/Perspex.Controls.UnitTests/DecoratorTests.cs +++ b/tests/Perspex.Controls.UnitTests/DecoratorTests.cs @@ -1,15 +1,12 @@ - - - - +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. +using System.Collections.Specialized; +using System.Linq; +using Xunit; namespace Perspex.Controls.UnitTests { - using System.Collections.Specialized; - using System.Linq; - using Xunit; - public class DecoratorTests { [Fact] diff --git a/tests/Perspex.Controls.UnitTests/DropDownTests.cs b/tests/Perspex.Controls.UnitTests/DropDownTests.cs index d798dafa96..78918de6a0 100644 --- a/tests/Perspex.Controls.UnitTests/DropDownTests.cs +++ b/tests/Perspex.Controls.UnitTests/DropDownTests.cs @@ -1,27 +1,19 @@ - - - - +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. +using System; +using System.Linq; +using Perspex.Controls.Presenters; +using Perspex.Controls.Primitives; +using Perspex.Controls.Templates; +using Perspex.Platform; +using Ploeh.AutoFixture; +using Ploeh.AutoFixture.AutoMoq; +using Splat; +using Xunit; namespace Perspex.Controls.UnitTests { - using System; - using System.Collections.Specialized; - using System.Linq; - using Moq; - using Perspex.Controls; - using Perspex.Controls.Presenters; - using Perspex.Controls.Primitives; - using Perspex.Controls.Templates; - using Perspex.Platform; - using Perspex.Styling; - using Perspex.VisualTree; - using Ploeh.AutoFixture; - using Ploeh.AutoFixture.AutoMoq; - using Splat; - using Xunit; - public class DropDownTests { [Fact(Skip = "Need to decide if this is right")] diff --git a/tests/Perspex.Controls.UnitTests/ItemsControlTests.cs b/tests/Perspex.Controls.UnitTests/ItemsControlTests.cs index 831493c776..5d0a36974b 100644 --- a/tests/Perspex.Controls.UnitTests/ItemsControlTests.cs +++ b/tests/Perspex.Controls.UnitTests/ItemsControlTests.cs @@ -1,21 +1,17 @@ - - - - - +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. + +using System.Collections.Specialized; +using System.Linq; +using Perspex.Collections; +using Perspex.Controls.Presenters; +using Perspex.Controls.Templates; +using Perspex.Styling; +using Perspex.VisualTree; +using Xunit; namespace Perspex.Controls.UnitTests { - using System.Collections.Specialized; - using System.Linq; - using Perspex.Collections; - using Perspex.Controls; - using Perspex.Controls.Presenters; - using Perspex.Controls.Templates; - using Perspex.Styling; - using Perspex.VisualTree; - using Xunit; - public class ItemsControlTests { [Fact] diff --git a/tests/Perspex.Controls.UnitTests/ListBoxTests.cs b/tests/Perspex.Controls.UnitTests/ListBoxTests.cs index 30ee619e35..f7bc5ea883 100644 --- a/tests/Perspex.Controls.UnitTests/ListBoxTests.cs +++ b/tests/Perspex.Controls.UnitTests/ListBoxTests.cs @@ -1,20 +1,17 @@ - - - - +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. +using System; +using System.Linq; +using Perspex.Controls; +using Perspex.Controls.Presenters; +using Perspex.Controls.Templates; +using Perspex.LogicalTree; +using Perspex.Styling; +using Xunit; namespace Perspex.Controls.UnitTests { - using System; - using System.Linq; - using Perspex.Controls; - using Perspex.Controls.Presenters; - using Perspex.Controls.Templates; - using Perspex.LogicalTree; - using Perspex.Styling; - using Xunit; - public class ListBoxTests { [Fact] diff --git a/tests/Perspex.Controls.UnitTests/Mixins/SelectableMixinTests.cs b/tests/Perspex.Controls.UnitTests/Mixins/SelectableMixinTests.cs index 3869760c69..337301716b 100644 --- a/tests/Perspex.Controls.UnitTests/Mixins/SelectableMixinTests.cs +++ b/tests/Perspex.Controls.UnitTests/Mixins/SelectableMixinTests.cs @@ -1,15 +1,12 @@ - - - - +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. +using Perspex.Controls.Mixins; +using Perspex.Controls.Primitives; +using Xunit; namespace Perspex.Controls.UnitTests.Mixins { - using Perspex.Controls.Mixins; - using Perspex.Controls.Primitives; - using Xunit; - public class SelectableMixinTests { [Fact] diff --git a/tests/Perspex.Controls.UnitTests/PanelTests.cs b/tests/Perspex.Controls.UnitTests/PanelTests.cs index ba341c39ef..cc141626a1 100644 --- a/tests/Perspex.Controls.UnitTests/PanelTests.cs +++ b/tests/Perspex.Controls.UnitTests/PanelTests.cs @@ -1,16 +1,13 @@ - - - - +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. +using System.Linq; +using Perspex.Collections; +using Perspex.LogicalTree; +using Xunit; namespace Perspex.Controls.UnitTests { - using System.Linq; - using Perspex.Collections; - using Perspex.LogicalTree; - using Xunit; - public class PanelTests { [Fact] diff --git a/tests/Perspex.Controls.UnitTests/Presenters/DeckPresenterTests.cs b/tests/Perspex.Controls.UnitTests/Presenters/DeckPresenterTests.cs index 1fae92e146..88f5a179b5 100644 --- a/tests/Perspex.Controls.UnitTests/Presenters/DeckPresenterTests.cs +++ b/tests/Perspex.Controls.UnitTests/Presenters/DeckPresenterTests.cs @@ -1,16 +1,13 @@ - - - - +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. +using Perspex.Controls.Generators; +using Perspex.Controls.Presenters; +using Perspex.Controls.Templates; +using Xunit; namespace Perspex.Controls.UnitTests.Presenters { - using Perspex.Controls.Generators; - using Perspex.Controls.Presenters; - using Perspex.Controls.Templates; - using Xunit; - public class DeckPresenterTests { [Fact] diff --git a/tests/Perspex.Controls.UnitTests/Presenters/ItemsPresenterTests.cs b/tests/Perspex.Controls.UnitTests/Presenters/ItemsPresenterTests.cs index b29712ca47..819842166c 100644 --- a/tests/Perspex.Controls.UnitTests/Presenters/ItemsPresenterTests.cs +++ b/tests/Perspex.Controls.UnitTests/Presenters/ItemsPresenterTests.cs @@ -1,21 +1,17 @@ - - - - - +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. + +using System.Linq; +using Perspex.Collections; +using Perspex.Controls.Generators; +using Perspex.Controls.Presenters; +using Perspex.Controls.Templates; +using Perspex.Input; +using Perspex.VisualTree; +using Xunit; namespace Perspex.Controls.UnitTests.Presenters { - using System.Linq; - using Perspex.Collections; - using Perspex.Controls.Generators; - using Perspex.Controls.Presenters; - using Perspex.Controls.Templates; - using Perspex.Input; - using Perspex.LogicalTree; - using Perspex.VisualTree; - using Xunit; - public class ItemsPresenterTests { [Fact] diff --git a/tests/Perspex.Controls.UnitTests/Presenters/ScrollContentPresenterTests.cs b/tests/Perspex.Controls.UnitTests/Presenters/ScrollContentPresenterTests.cs index 1aa99a3d6d..706790bab0 100644 --- a/tests/Perspex.Controls.UnitTests/Presenters/ScrollContentPresenterTests.cs +++ b/tests/Perspex.Controls.UnitTests/Presenters/ScrollContentPresenterTests.cs @@ -1,18 +1,15 @@ - - - - +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. +using System; +using System.Collections.Generic; +using System.Reactive.Linq; +using Perspex.Controls.Presenters; +using Perspex.Layout; +using Xunit; namespace Perspex.Controls.UnitTests.Presenters { - using System; - using System.Collections.Generic; - using System.Reactive.Linq; - using Perspex.Controls.Presenters; - using Perspex.Layout; - using Xunit; - public class ScrollContentPresenterTests { [Fact] diff --git a/tests/Perspex.Controls.UnitTests/Primitives/PopupTests.cs b/tests/Perspex.Controls.UnitTests/Primitives/PopupTests.cs index d47dd8731c..ef3719abd8 100644 --- a/tests/Perspex.Controls.UnitTests/Primitives/PopupTests.cs +++ b/tests/Perspex.Controls.UnitTests/Primitives/PopupTests.cs @@ -1,26 +1,23 @@ - - - - - +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. + +using System; +using System.Collections.Specialized; +using System.Linq; +using Moq; +using Perspex.Controls.Presenters; +using Perspex.Controls.Primitives; +using Perspex.Controls.Templates; +using Perspex.Layout; +using Perspex.LogicalTree; +using Perspex.Platform; +using Perspex.Styling; +using Perspex.VisualTree; +using Splat; +using Xunit; namespace Perspex.Controls.UnitTests.Primitives { - using System; - using System.Collections.Specialized; - using System.Linq; - using Layout; - using Moq; - using Perspex.Controls.Presenters; - using Perspex.Controls.Primitives; - using Perspex.LogicalTree; - using Perspex.Platform; - using Perspex.Styling; - using Perspex.VisualTree; - using Splat; - using Templates; - using Xunit; - public class PopupTests { [Fact] diff --git a/tests/Perspex.Controls.UnitTests/Primitives/RangeBaseTests.cs b/tests/Perspex.Controls.UnitTests/Primitives/RangeBaseTests.cs index da3fd0dd62..020d10d547 100644 --- a/tests/Perspex.Controls.UnitTests/Primitives/RangeBaseTests.cs +++ b/tests/Perspex.Controls.UnitTests/Primitives/RangeBaseTests.cs @@ -1,15 +1,12 @@ - - - - +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. +using System; +using Perspex.Controls.Primitives; +using Xunit; namespace Perspex.Controls.UnitTests.Primitives { - using System; - using Perspex.Controls.Primitives; - using Xunit; - public class RangeBaseTests { [Fact] diff --git a/tests/Perspex.Controls.UnitTests/Primitives/ScrollBarTests.cs b/tests/Perspex.Controls.UnitTests/Primitives/ScrollBarTests.cs index 8cab51cbd4..6e4cdd33b1 100644 --- a/tests/Perspex.Controls.UnitTests/Primitives/ScrollBarTests.cs +++ b/tests/Perspex.Controls.UnitTests/Primitives/ScrollBarTests.cs @@ -1,17 +1,14 @@ - - - - +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. +using System; +using Perspex.Controls.Primitives; +using Perspex.Controls.Templates; +using Perspex.Media; +using Xunit; namespace Perspex.Controls.UnitTests.Primitives { - using System; - using Perspex.Controls.Primitives; - using Perspex.Controls.Templates; - using Perspex.Media; - using Xunit; - public class ScrollBarTests { [Fact] diff --git a/tests/Perspex.Controls.UnitTests/Primitives/SelectingItemsControlTests.cs b/tests/Perspex.Controls.UnitTests/Primitives/SelectingItemsControlTests.cs index e2f58c2ff7..46cc1a7375 100644 --- a/tests/Perspex.Controls.UnitTests/Primitives/SelectingItemsControlTests.cs +++ b/tests/Perspex.Controls.UnitTests/Primitives/SelectingItemsControlTests.cs @@ -1,20 +1,17 @@ - - - - - +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. + +using System.Collections.ObjectModel; +using Perspex.Collections; +using Perspex.Controls.Presenters; +using Perspex.Controls.Primitives; +using Perspex.Controls.Templates; +using Perspex.Input; +using Perspex.Interactivity; +using Xunit; namespace Perspex.Controls.UnitTests.Primitives { - using System.Collections.ObjectModel; - using Perspex.Collections; - using Perspex.Controls.Presenters; - using Perspex.Controls.Primitives; - using Perspex.Controls.Templates; - using Perspex.Input; - using Perspex.Interactivity; - using Xunit; - public class SelectingItemsControlTests { [Fact] diff --git a/tests/Perspex.Controls.UnitTests/Primitives/SelectingItemsControlTests_AutoSelect.cs b/tests/Perspex.Controls.UnitTests/Primitives/SelectingItemsControlTests_AutoSelect.cs index 7e6ed7de96..1b3bedb734 100644 --- a/tests/Perspex.Controls.UnitTests/Primitives/SelectingItemsControlTests_AutoSelect.cs +++ b/tests/Perspex.Controls.UnitTests/Primitives/SelectingItemsControlTests_AutoSelect.cs @@ -1,18 +1,14 @@ - - - - +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. +using Perspex.Collections; +using Perspex.Controls.Presenters; +using Perspex.Controls.Primitives; +using Perspex.Controls.Templates; +using Xunit; namespace Perspex.Controls.UnitTests.Primitives { - using Perspex.Collections; - using Perspex.Controls.Presenters; - using Perspex.Controls.Primitives; - using Perspex.Controls.Templates; - using Perspex.Interactivity; - using Xunit; - public class SelectingItemsControlTests_AutoSelect { [Fact] diff --git a/tests/Perspex.Controls.UnitTests/Primitives/TabStripTests.cs b/tests/Perspex.Controls.UnitTests/Primitives/TabStripTests.cs index 2ab0e0e97a..28f885ed28 100644 --- a/tests/Perspex.Controls.UnitTests/Primitives/TabStripTests.cs +++ b/tests/Perspex.Controls.UnitTests/Primitives/TabStripTests.cs @@ -1,18 +1,15 @@ - - - - +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. +using System.Collections.ObjectModel; +using System.Linq; +using Perspex.Controls.Presenters; +using Perspex.Controls.Primitives; +using Perspex.Controls.Templates; +using Xunit; namespace Perspex.Controls.UnitTests.Primitives { - using System.Collections.ObjectModel; - using System.Linq; - using Perspex.Controls.Presenters; - using Perspex.Controls.Primitives; - using Perspex.Controls.Templates; - using Xunit; - public class TabStripTests { [Fact] diff --git a/tests/Perspex.Controls.UnitTests/Primitives/TemplatedControlTests.cs b/tests/Perspex.Controls.UnitTests/Primitives/TemplatedControlTests.cs index 73286a5126..618205694a 100644 --- a/tests/Perspex.Controls.UnitTests/Primitives/TemplatedControlTests.cs +++ b/tests/Perspex.Controls.UnitTests/Primitives/TemplatedControlTests.cs @@ -1,22 +1,19 @@ - - - - - +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. + +using System; +using System.Collections.Generic; +using System.Linq; +using Perspex.Collections; +using Perspex.Controls.Presenters; +using Perspex.Controls.Primitives; +using Perspex.Controls.Templates; +using Perspex.LogicalTree; +using Perspex.VisualTree; +using Xunit; namespace Perspex.Controls.UnitTests.Primitives { - using System; - using System.Collections.Generic; - using System.Linq; - using Collections; - using Perspex.Controls.Presenters; - using Perspex.Controls.Primitives; - using Perspex.Controls.Templates; - using Perspex.LogicalTree; - using Perspex.VisualTree; - using Xunit; - public class TemplatedControlTests { [Fact] diff --git a/tests/Perspex.Controls.UnitTests/Primitives/TrackTests.cs b/tests/Perspex.Controls.UnitTests/Primitives/TrackTests.cs index d799dae882..5d065aea32 100644 --- a/tests/Perspex.Controls.UnitTests/Primitives/TrackTests.cs +++ b/tests/Perspex.Controls.UnitTests/Primitives/TrackTests.cs @@ -1,26 +1,11 @@ - - - - +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. +using Perspex.Controls.Primitives; +using Xunit; namespace Perspex.Controls.UnitTests.Primitives { - using System; - using System.Collections.Specialized; - using System.Linq; - using Layout; - using Moq; - using Perspex.Controls.Presenters; - using Perspex.Controls.Primitives; - using Perspex.LogicalTree; - using Perspex.Platform; - using Perspex.Styling; - using Perspex.VisualTree; - using Splat; - using Templates; - using Xunit; - public class TrackTests { [Fact] diff --git a/tests/Perspex.Controls.UnitTests/Properties/AssemblyInfo.cs b/tests/Perspex.Controls.UnitTests/Properties/AssemblyInfo.cs index ddb3c26f70..41f3f65c1a 100644 --- a/tests/Perspex.Controls.UnitTests/Properties/AssemblyInfo.cs +++ b/tests/Perspex.Controls.UnitTests/Properties/AssemblyInfo.cs @@ -1,8 +1,5 @@ - - - - - +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. using System.Reflection; using Xunit; diff --git a/tests/Perspex.Controls.UnitTests/ScrollViewerTests.cs b/tests/Perspex.Controls.UnitTests/ScrollViewerTests.cs index 917f0b2671..a770f88c6d 100644 --- a/tests/Perspex.Controls.UnitTests/ScrollViewerTests.cs +++ b/tests/Perspex.Controls.UnitTests/ScrollViewerTests.cs @@ -1,19 +1,16 @@ - - - - +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. +using System.Linq; +using Perspex.Controls; +using Perspex.Controls.Presenters; +using Perspex.Controls.Primitives; +using Perspex.Controls.Templates; +using Perspex.VisualTree; +using Xunit; namespace Perspex.Controls.UnitTests { - using System.Linq; - using Perspex.Controls; - using Perspex.Controls.Presenters; - using Perspex.Controls.Primitives; - using Perspex.Controls.Templates; - using Perspex.VisualTree; - using Xunit; - public class ScrollViewerTests { [Fact] diff --git a/tests/Perspex.Controls.UnitTests/TabControlTests.cs b/tests/Perspex.Controls.UnitTests/TabControlTests.cs index 323ffb4bec..a2af7537e1 100644 --- a/tests/Perspex.Controls.UnitTests/TabControlTests.cs +++ b/tests/Perspex.Controls.UnitTests/TabControlTests.cs @@ -1,19 +1,16 @@ - - - - +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. +using System.Collections.ObjectModel; +using System.Linq; +using Perspex.Controls.Presenters; +using Perspex.Controls.Primitives; +using Perspex.Controls.Templates; +using Perspex.LogicalTree; +using Xunit; 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; - public class TabControlTests { [Fact] diff --git a/tests/Perspex.Controls.UnitTests/TemplatedControlTests.cs b/tests/Perspex.Controls.UnitTests/TemplatedControlTests.cs index cb47cbcff6..7654531089 100644 --- a/tests/Perspex.Controls.UnitTests/TemplatedControlTests.cs +++ b/tests/Perspex.Controls.UnitTests/TemplatedControlTests.cs @@ -1,22 +1,19 @@ - - - - - +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. + +using System.Linq; +using Moq; +using Perspex.Controls; +using Perspex.Controls.Presenters; +using Perspex.Controls.Primitives; +using Perspex.Controls.Templates; +using Perspex.Styling; +using Perspex.VisualTree; +using Splat; +using Xunit; namespace Perspex.Controls.UnitTests { - using System.Linq; - using Moq; - using Perspex.Controls; - using Perspex.Controls.Presenters; - using Perspex.Controls.Primitives; - using Perspex.Controls.Templates; - using Perspex.Styling; - using Perspex.VisualTree; - using Splat; - using Xunit; - public class TemplatedControlTests { [Fact] diff --git a/tests/Perspex.Controls.UnitTests/Templates/TemplateExtensionsTests.cs b/tests/Perspex.Controls.UnitTests/Templates/TemplateExtensionsTests.cs index dcebc6b2b7..0fea2b1538 100644 --- a/tests/Perspex.Controls.UnitTests/Templates/TemplateExtensionsTests.cs +++ b/tests/Perspex.Controls.UnitTests/Templates/TemplateExtensionsTests.cs @@ -1,17 +1,12 @@ - - - - +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. +using System.Linq; +using Perspex.Controls.UnitTests; +using Xunit; namespace Perspex.Controls.Templates.UnitTests { - using System.Linq; - using Perspex.Controls; - using Perspex.Controls.Templates; - using Perspex.Controls.UnitTests; - using Xunit; - public class TemplateExtensionsTests { /// diff --git a/tests/Perspex.Controls.UnitTests/TestRoot.cs b/tests/Perspex.Controls.UnitTests/TestRoot.cs index 95f08d4a26..d288da2bd1 100644 --- a/tests/Perspex.Controls.UnitTests/TestRoot.cs +++ b/tests/Perspex.Controls.UnitTests/TestRoot.cs @@ -1,17 +1,14 @@ - - - - +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. +using System; +using Moq; +using Perspex.Layout; +using Perspex.Platform; +using Perspex.Rendering; namespace Perspex.Controls.UnitTests { - using System; - using Moq; - using Perspex.Layout; - using Perspex.Platform; - using Perspex.Rendering; - internal class TestRoot : Decorator, ILayoutRoot, IRenderRoot { public Size ClientSize diff --git a/tests/Perspex.Controls.UnitTests/TestTemplatedControl.cs b/tests/Perspex.Controls.UnitTests/TestTemplatedControl.cs index 62b224f62b..dd6741a0ba 100644 --- a/tests/Perspex.Controls.UnitTests/TestTemplatedControl.cs +++ b/tests/Perspex.Controls.UnitTests/TestTemplatedControl.cs @@ -1,13 +1,10 @@ - - - - +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. +using Perspex.Controls.Primitives; namespace Perspex.Controls.UnitTests { - using Perspex.Controls.Primitives; - internal class TestTemplatedControl : TemplatedControl { public bool OnTemplateAppliedCalled { get; private set; } diff --git a/tests/Perspex.Controls.UnitTests/TopLevelTests.cs b/tests/Perspex.Controls.UnitTests/TopLevelTests.cs index d7a039ce14..974e842a0c 100644 --- a/tests/Perspex.Controls.UnitTests/TopLevelTests.cs +++ b/tests/Perspex.Controls.UnitTests/TopLevelTests.cs @@ -1,27 +1,24 @@ - - - - - +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. + +using System.Reactive; +using System.Reactive.Subjects; +using Moq; +using Perspex.Controls.Presenters; +using Perspex.Controls.Templates; +using Perspex.Input; +using Perspex.Input.Raw; +using Perspex.Layout; +using Perspex.Platform; +using Perspex.Rendering; +using Perspex.Styling; +using Ploeh.AutoFixture; +using Ploeh.AutoFixture.AutoMoq; +using Splat; +using Xunit; namespace Perspex.Controls.UnitTests { - using System.Reactive; - using System.Reactive.Subjects; - using Moq; - using Perspex.Controls.Presenters; - using Perspex.Controls.Templates; - using Perspex.Input; - using Perspex.Input.Raw; - using Perspex.Layout; - using Perspex.Platform; - using Perspex.Rendering; - using Perspex.Styling; - using Ploeh.AutoFixture; - using Ploeh.AutoFixture.AutoMoq; - using Splat; - using Xunit; - public class TopLevelTests { [Fact] diff --git a/tests/Perspex.Direct2D1.UnitTests/Controls/Shapes/PathTests.cs b/tests/Perspex.Direct2D1.UnitTests/Controls/Shapes/PathTests.cs index 56a9e85997..7ba098966b 100644 --- a/tests/Perspex.Direct2D1.UnitTests/Controls/Shapes/PathTests.cs +++ b/tests/Perspex.Direct2D1.UnitTests/Controls/Shapes/PathTests.cs @@ -1,20 +1,17 @@ - - - - +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. +using Perspex.Controls.Shapes; +using Perspex.Layout; +using Perspex.Media; +using Splat; +using Xunit; namespace Perspex.Direct2D1.UnitTests.Controls.Shapes { - using Perspex.Controls.Shapes; - using Perspex.Layout; - using Perspex.Media; - using Splat; - using Xunit; - public class PathTests { - private static readonly RectComparer Compare = new RectComparer(); + private static readonly RectComparer s_compare = new RectComparer(); [Fact] public void Should_Measure_Expander_Triangle_Correctly() @@ -35,7 +32,7 @@ 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, s_compare); } } @@ -69,7 +66,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, s_compare); } } } diff --git a/tests/Perspex.Direct2D1.UnitTests/Media/GeometryTests.cs b/tests/Perspex.Direct2D1.UnitTests/Media/GeometryTests.cs index f5972cacd8..c2aa6506c7 100644 --- a/tests/Perspex.Direct2D1.UnitTests/Media/GeometryTests.cs +++ b/tests/Perspex.Direct2D1.UnitTests/Media/GeometryTests.cs @@ -1,18 +1,15 @@ - - - - +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. +using Perspex.Media; +using Splat; +using Xunit; namespace Perspex.Direct2D1.UnitTests.Media { - using Perspex.Media; - using Splat; - using Xunit; - public class GeometryTests { - private static readonly RectComparer Compare = new RectComparer(); + private static readonly RectComparer s_compare = new RectComparer(); [Fact] public void Should_Measure_Expander_Triangle_Correctly() @@ -23,7 +20,7 @@ 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, s_compare); } } @@ -36,7 +33,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), s_compare); } } } diff --git a/tests/Perspex.Direct2D1.UnitTests/Properties/AssemblyInfo.cs b/tests/Perspex.Direct2D1.UnitTests/Properties/AssemblyInfo.cs index c283676fa5..41d73d6667 100644 --- a/tests/Perspex.Direct2D1.UnitTests/Properties/AssemblyInfo.cs +++ b/tests/Perspex.Direct2D1.UnitTests/Properties/AssemblyInfo.cs @@ -1,8 +1,5 @@ - - - - - +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. using System.Reflection; diff --git a/tests/Perspex.Direct2D1.UnitTests/RectComparer.cs b/tests/Perspex.Direct2D1.UnitTests/RectComparer.cs index 6f8b62f4fa..b1e111228e 100644 --- a/tests/Perspex.Direct2D1.UnitTests/RectComparer.cs +++ b/tests/Perspex.Direct2D1.UnitTests/RectComparer.cs @@ -1,8 +1,8 @@ -using System; +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. + +using System; using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; namespace Perspex.Direct2D1.UnitTests { diff --git a/tests/Perspex.Input.UnitTests/KeyboardNavigationTests_Arrows.cs b/tests/Perspex.Input.UnitTests/KeyboardNavigationTests_Arrows.cs index 9b3c6d0b17..3bd3efb707 100644 --- a/tests/Perspex.Input.UnitTests/KeyboardNavigationTests_Arrows.cs +++ b/tests/Perspex.Input.UnitTests/KeyboardNavigationTests_Arrows.cs @@ -1,13 +1,12 @@ - - - - +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. +using Perspex.Controls; +using Xunit; namespace Perspex.Input.UnitTests { - using Perspex.Controls; - using Xunit; + using Controls = Perspex.Controls.Controls; public class KeyboardNavigationTests_Arrows { diff --git a/tests/Perspex.Input.UnitTests/KeyboardNavigationTests_Tab.cs b/tests/Perspex.Input.UnitTests/KeyboardNavigationTests_Tab.cs index 38e3768151..b9725cbd93 100644 --- a/tests/Perspex.Input.UnitTests/KeyboardNavigationTests_Tab.cs +++ b/tests/Perspex.Input.UnitTests/KeyboardNavigationTests_Tab.cs @@ -1,13 +1,12 @@ - - - - +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. +using Perspex.Controls; +using Xunit; namespace Perspex.Input.UnitTests { - using Perspex.Controls; - using Xunit; + using Controls = Perspex.Controls.Controls; public class KeyboardNavigationTests_Tab { diff --git a/tests/Perspex.Input.UnitTests/Properties/AssemblyInfo.cs b/tests/Perspex.Input.UnitTests/Properties/AssemblyInfo.cs index 7c7d0bc2cd..d9d846e53b 100644 --- a/tests/Perspex.Input.UnitTests/Properties/AssemblyInfo.cs +++ b/tests/Perspex.Input.UnitTests/Properties/AssemblyInfo.cs @@ -1,8 +1,5 @@ - - - - - +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. using System.Reflection; diff --git a/tests/Perspex.Interactivity.UnitTests/InteractiveTests.cs b/tests/Perspex.Interactivity.UnitTests/InteractiveTests.cs index 3d580d3c05..4652408503 100644 --- a/tests/Perspex.Interactivity.UnitTests/InteractiveTests.cs +++ b/tests/Perspex.Interactivity.UnitTests/InteractiveTests.cs @@ -1,18 +1,15 @@ - - - - +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. +using System; +using System.Collections.Generic; +using System.Linq; +using Perspex.Interactivity; +using Perspex.VisualTree; +using Xunit; namespace Perspex.Interactivity.UnitTests { - using System; - using System.Collections.Generic; - using System.Linq; - using Perspex.Interactivity; - using Perspex.VisualTree; - using Xunit; - public class InteractiveTests { [Fact] diff --git a/tests/Perspex.Interactivity.UnitTests/Properties/AssemblyInfo.cs b/tests/Perspex.Interactivity.UnitTests/Properties/AssemblyInfo.cs index 8b42de2cf7..a197a392c8 100644 --- a/tests/Perspex.Interactivity.UnitTests/Properties/AssemblyInfo.cs +++ b/tests/Perspex.Interactivity.UnitTests/Properties/AssemblyInfo.cs @@ -1,8 +1,5 @@ - - - - - +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. using System.Reflection; diff --git a/tests/Perspex.Layout.UnitTests/FullLayoutTests.cs b/tests/Perspex.Layout.UnitTests/FullLayoutTests.cs index 3a62ddde1d..1e2b5abd1b 100644 --- a/tests/Perspex.Layout.UnitTests/FullLayoutTests.cs +++ b/tests/Perspex.Layout.UnitTests/FullLayoutTests.cs @@ -1,30 +1,27 @@ - - - - - +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. + +using System.Diagnostics; +using System.IO; +using System.Linq; +using Moq; +using Perspex.Controls; +using Perspex.Controls.Presenters; +using Perspex.Controls.Primitives; +using Perspex.Controls.Templates; +using Perspex.Diagnostics; +using Perspex.Input; +using Perspex.Platform; +using Perspex.Rendering; +using Perspex.Styling; +using Perspex.Themes.Default; +using Ploeh.AutoFixture; +using Ploeh.AutoFixture.AutoMoq; +using Splat; +using Xunit; namespace Perspex.Layout.UnitTests { - using System.Diagnostics; - using System.IO; - using System.Linq; - using Moq; - using Perspex.Controls; - using Perspex.Controls.Presenters; - using Perspex.Controls.Primitives; - using Perspex.Controls.Templates; - using Perspex.Diagnostics; - using Perspex.Input; - using Perspex.Platform; - using Perspex.Rendering; - using Perspex.Styling; - using Perspex.Themes.Default; - using Ploeh.AutoFixture; - using Ploeh.AutoFixture.AutoMoq; - using Splat; - using Xunit; - public class FullLayoutTests { [Fact] diff --git a/tests/Perspex.Layout.UnitTests/Properties/AssemblyInfo.cs b/tests/Perspex.Layout.UnitTests/Properties/AssemblyInfo.cs index bb55fb0d9a..306034540b 100644 --- a/tests/Perspex.Layout.UnitTests/Properties/AssemblyInfo.cs +++ b/tests/Perspex.Layout.UnitTests/Properties/AssemblyInfo.cs @@ -1,8 +1,5 @@ - - - - - +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. using System.Reflection; diff --git a/tests/Perspex.RenderTests/Controls/BorderTests.cs b/tests/Perspex.RenderTests/Controls/BorderTests.cs index 263f4b94923152a6193aa3f6d7eeef261d52868f..ab1eacbcd5be3dc167246ceb39ff3f75ec16638f 100644 GIT binary patch literal 23820 zcmeHPZExE)5Wdd?_8$cAiwhL)5^TV*V!)cDLklEZkfdFKZ7|%}&b--|rI2_>{omo%drN@+wF^gGS*u1)9k2x``v@HNQF||v_l;Wt`5p^d%89}lX7#EElck>7>FhYwQD+%dR(8|r32boqDJP9 zC1(!)mU{v%@HK;$-ezr{K-MuNzQUEz9%M^PQYG{){-;vzNp2^LQuOKTTfd$-?KVaq zbEsv)lxu#Q)!3%*sa5Ji>m)kbW?y-=h5avb}@eM$ntD!7kcu z1}oC_I9w!goI};e0s7dvv<{C)H-6{fFvS=g;7vl`;ctrHe<3aBj>)LBt83O=$Ed9@ zeaemdVts5q*=qeM9B^N1(>G{|$5GuWMNNMe-LV~XQtZ-~xayUC0f}>K&O9|Ky)S%^ zrR9q96#HtG=2U`u8r0lH>U(HGwv8%#{>-+hgPy~qlQmmUAF(>ht>g5(Q2pqxF?}L7J4H`;iQhdL5!?e8QCat> z-?dR+VbQe>ZPagO)bHA;2TByL)nL7|WMi>AFz@zwO@$tjD~$1kKSlZXf@+8*L4>@-Vhi2w(O;`@5lb^9M62WFY=-_#UM}-d!pMa0&6|a^n1zm{czR!A7InQBmBR1m z{#SH4F49KysBY9sYcLzEny9waW`jc;e3bcjJdsIE$}wjM{Tj~JXsxeA=uFhph))dKJqrFnJGOyJz6w_W7riNmMVqu@S>)B8&uAx<3uZ2En^C_bi$ zV!qg-7I*IzVYb~D^R1_OW1C+G?6*i9&%*B%iz~)PyLn{hk;VE&)jP#cjmt4kSX?oY z_$o*GRuxwaE!f9+WWL2T4BI@09l{SAqPKKq->Zuim;ExE2@5TeA(kOl*eC9KHpGf+ zNIkq&Ay&QFt!6V}Y9|e|Hjh~+GN;MsI~Z!&PVBf%ac@7hHFb(07Bj4B_1p*A_LyOA zDGj$ak6UMmPs|LnFz;ulhb*>VhFL}3*qX!pyykF~u|a1Y4W~AbQ*43excKB9^RNu9 ziuO4CZD>{0h@sWCpjFXE8fI-CvwoEIgmc{cz^oHNFg{6fV7s`m=fl6YZ|4XrGK#eUZh1UFpJ+V>)!|0 zbno!jjZdo3o>YI29BYR60rE-C&RRC>_qPpqh54t0@<`(|vxhS3CfVLJJ>#}$!_QR^)|96$+@8szj9RMK#`=qxdP zU}!rdw|uHhE$0wWl5M!0hEz*NMkdoMMt#R;L`tW{MLG><-@)m$h@JutBpwd_OEfaF zwcSVr8?o#=S6Zv~v6_B~@3CxkA-1qKi-&=F-`d1iKjx;AetvQqBm?srlN&F#mFaR} z3ymCs&jnFjIEsiNDCdI{!mma3+&l^|t71)u1Oa~WSgSvx{&fga*52>FS<*z=uQX62 zE!o`L%Qv0?9geVfW2-x&EJ!+uCzP|E9~<@=3%A5nV$abp$a;$r|2jX0g~EIyTB(s2 zoGtY}OQ3=3Sk#Eh6so*U8PwuWyL+&t7KyohJRt&3$7BeymXUbSIydb)M@)RwIyYbc zI%_bot!1*N>`?G&i2FcF~z3c<>H81ZK65ni*hl{h3P{80K&~i}_)HDP^C~uLfBj{|LdagrH8d{(tIGz%y z&kQ`AOuV#7=spjtYem#}{ky8Gowq*ArheQz;ey_2pH3LNwNCxNPgw<9YZkG6xKS;} z{p+P;6oL#(v0q0$4Zv!f^J+d?jI|%?{ZXr}SG`Tfl-;8B9t=4+pHEkGfeJl(2U@&Q zFkiI0K-3|l!*Hwtr!@?<^%#rhIhBt|UqC48TOMut6pNVJMjoYj%Caa|S8@*ZlmO+A z!1^OZd0IAb>sPQpZzGQko~OVcC1@d5$B14 z#S-%uxa_goaBH>lu6MoNebtLg_HM8sNf9Sh{7_Z&R{E|Wj{vP1lUCdj_c_xjG=KA% pxjIS86(p1cF2?$f4>LhyIQP@q+FR3TmLHp*DD?%WJFCnp{{ZiBW>EkD diff --git a/tests/Perspex.RenderTests/Controls/ImageTests.cs b/tests/Perspex.RenderTests/Controls/ImageTests.cs index 8fd0825b2a11c3bf80a204f7af14a459121bed3f..4a6fbcaf003cae56f99a67af7e45d7e22ea7d5c1 100644 GIT binary patch literal 6546 zcmeHLO>fgc5S=p;|G_GkRH|I)34xGkS`bJSs-}oafTA>UQ$xPwBn5=}*MawDJzZ~O z2Zsad!LsVjuIKB`%)Yhz``51QN+bs|m6`mIOi~%jr7W=4lD=$XJjFc0c#L}{bI2v~ zUFR9JzF^jee2kTS8R3cwR^~cOphev)+y{`nFZbY;e&4`fAFC6U7+__I-vgD7VAXj( zlGlhLg6*O-J$4|;*!&Y(i)9QOkz7E2q|Z}W_4a0n#YfI~r?`mu0%NA*5}L%~EfYfo zi<4YxEIsI?(3s?yh-(QXlo>*{gN)80lOUcL7~aWK#a@&Nvl?q9CeUF_BWV9!;|TT# z@Y&l)mhlk5FpqZC&zaUDMJ()muP!H5V>|MDvo=_H?LzT$k?2p*;ErkBpAU8NpAzN5}%N z8M1VqcS!`SBjB3jif;0opm&)IVv6Jm{%qb>S%<{zh1PAA9h+kRu;bW;ZOj&0zZqs- zMBwMXTBdDd7^~I47+(uJo)}Hz_Q>eZ^Qc?$T((yF^-}@&R)w{4jOHsu6Uj69oB;JV zj78inbRY9^nRm)qvp~s~uBOO$jE-DlM&yed`5jo=!rWCQ##8QBM!TK&y2WDSwPvL( zGauz8q96l)F3nt+^DFdws@&wW-^D)Seot`k15H=nDyI-fc{SGO?+}*yu#jnX9G@-l zI|D}g2s64WU53)~u->ytu`UDMF^&g|7366`7XPX>lxEQ^+xS7V z$l5zJv_Ko{VmIAa$bvuR7~3Y=2O9rKYgok9){Hw2s}n`NOj^uj3g&ExDo&M`dA`wq z8!J3dcv7<8$)$sunK0{Bn0$}cL1fl8LuOhX#gzdi`Hjdz9;jDavu0zsvz*;abzB=NeAD+njg`ZnX2O`D!lj`i39*U%ck4xvD$-`sVyt+xKRtV0u^ox-maFLQVKaR@UoJdO3s5DEfkYrx3EzV$ zWl{u7;0eezD6N92;981Yc~_7t=t-F|39+8cUY$zg3EO$k9x+#?7*EOShtg04^TkbT zvFX6^^~K&p!sy9BFfV9o>bC(86=(X!vpi+B%~?$1oGL{S3wAEw82-!d`Qww7{-Ufi?X zn9NGtvQq;yHY}+GJFxOwh`%wM;mR+DI~T*DT4!#!kDTp - - - diff --git a/tests/Perspex.RenderTests/Properties/AssemblyInfo.cs b/tests/Perspex.RenderTests/Properties/AssemblyInfo.cs index 1483b9ca022915e06e37ed2f572f1af7420087d9..f0ef7fb3ada57ddab6dce163ea26e56a0e52c03d 100644 GIT binary patch literal 742 zcmZvaK}*9x5QX1a@INeGY%eK#R6JCB5fqB;K@bnMN!v)$mZUA#AFqBhNk|D2*v-zo zdGqG&{{9R!P|$-m+Ulr6sg_!4N35s0`s`EA3Hz9}Pzf&4m!Au&J~_?7M?{9o_`(TG z>8FG$t39yBAkTG1SL^#kzd6yhBVr*Cm>B*n=!UXIUGR? z@R{dRSX;g=T3Y3%cf)5hFW3v;_f*;}EwjxKU|iRzTr+A?D%SN(HrJj>46_6~!O;>- zf}Th(>Z_sB*^nMyJvp%Jl)mQ8%y;JFzL8JLm7|qH|l3Mq~>V zSnq32SGA(X?I}6aT2kBByX$K2Y2;I0k~g>Pj?B%bqH-nhGG=6FXfW5a+Liy++l#Ak qtsD1Lt*Ae^I|VP$RF_0->V!8?bsTs4r1~b(cp7x)>P%_Kw2|naKQi%F_3{)Ii)q~^q;-8eKa1};7#4hx>%A|wZ;KgOcQ#l M;UlboUBIOJ0t|ym3IG5A diff --git a/tests/Perspex.RenderTests/Shapes/EllipseTests.cs b/tests/Perspex.RenderTests/Shapes/EllipseTests.cs index d181979a9027c29999004b3f7a0db859493b45c0..29ab879a11a73573cbd57577b5c7329fc11153e4 100644 GIT binary patch literal 2094 zcmb7FVQbqk5WUZX{Rh!~abdViKaGvSnxtccm4&v@!Zt=4JE>R42~N_rjQ;hl@0~1c zxk_;`@kP?zz4uNh`TxHIIS?ZQS;$iErIbu&axH7jMKY0n*mI0i*b&~Ptl*c*osLUH z{l;hl{}?kzlH)OrEGr$Qh+^z5-U&Qk$_tMi>^8k&hOQbzL{5NGg4J3rPyHC<8CH10 zKj2s3{~y?=-XV=H_w&fkYXr1JyUN}HO+4PDyuogi0lO)Zx7dl-!P>cu&R%HkcqdvF zhw=tbx7g26T;J^Ev`h3rdFQ%wO+9|EK36-Zp<4}|ce5X?=00|k_a(mzyg~YUE?LoT zbqHmCx+@l|*D`WPczly-;@iSF8c+Gye{6aa=Q4ot@H7_KF8_e W2}p5+^P9z!z|Py2#n)p;_WcN^=^so0 literal 865 zcmaKq!D_-l5Qgvj6idBCC_z0HrO+CcdMFJlRA`H=o6!ueN!VFiq2$SW=p*$NnoUxp zBy=wcJKz8RGsFITeY5Nbm_05|ND@$4K3qiq!wM@Gkr2LIH`>?Y(90u<+kR3lnQ@gx-STw>*N6 z>iT4F;Y+E#@kJ2W-507wh;kPJk#p0&zEE2B83Pk$WUtey7ast(p-peBdLgQy3@Nu$ zv#&R2LyPe<=};di1agN;$Xz|ZVoyV4qHY~bFM`wZU0At2CPeysuJHsFIK^7qg9}-X VdGS6G8m4=(1#-@aA|hoe`vr{u=CA+& diff --git a/tests/Perspex.RenderTests/Shapes/PathTests.cs b/tests/Perspex.RenderTests/Shapes/PathTests.cs index d1a51127779a19bdca12ec6586d1ea239e14ac9c..27b440fb88f46a99a563b9756d6b67c2d50f12e7 100644 GIT binary patch literal 9706 zcmeHMZBNrs6h5C#{0|L&fy7MaHnwR@6!0y9NC1`il4Y<06E>DH6fpdC^?AiBJ@>rd=bqd9``06RB%Z9uiS*<``qGvIIg|nV=4DS7&~D?|N4tUlzMO*2 zmvepYW7Ic1?Sa04o)>bA%ZqS1)h8dLIQBdKTcErz_aK#W*C1~XyT5MARX}VWFPd$`o0aWA-^7U2{os_C%9!Gf2H#+B&$lpnWrec1I)AzUD()AAojW?R+Vl&}>6q%8oQ(=LZ97t9C5N9tJMz^eP&~ znqO_XM9a)=!uMP=8Nse%Bzv6=>1es8gtH)X zz7Dd%ho87|FuoVa59TE+5Fc}WPS!DI5m9w0!CJx#?!&%{QY_-lCyZD~nF9{fEWd`^ zt6+5;H9I()+nUqy)$9bA=xUOAjlZGHLcnuamOY33SgCb@iS&ezRhCrfApfc+{RtKGw*kLm^9e(Fn zpC0RrK=-m#unsH%)vI`_>QzE-33nAlh<8N$6}(MP?P$3hDC4T*s_1yis6{waHYHb4 zWmR#<)ujrGBAzR{`cUR<@hQQY0`x24cbmsbY8UOU!=4JR8h-V_t6Wu!xSusXwIJSQ zXiuF>(7J?+dxqht@SV$!$x~azYa={d8_JI9(AF_CqWM~dXW~(Gx=xa=8u*o2&zZP{ zT&d$%MiiD}^I{s5>Chkx7F_0aV!}6s@%Qq{bt0?AaQD_g_HwtM@8t8H{NLTlb9ETC zpR=mY+IXetbdC4r)nn4Pjeqy0Aj=w%SC3ZB&R*3wsVa1O^Gay4I+ z|81u?#f&vy{zcEQDQqWkf@s{bWsr>;eWJLmC-FSF%U0hT_vr34IXfpQVN#hI*PiER t)A`12a>hNwsW0knT`d#`?56TiL9oUtiwAQBkhz{|ZeGfKIwrpOGE-An_?oaFbI8*%9!sd%X76-Uz_>~CnDiU5I&#+y+JYkHYd+4NpM+IQZ88_LXfFryjOxs z<|$=^P-;|iTOo^r!kmnJNqpIwRC>&!2&9^PoQ5>jPB^(+wk&}?D3Dva0PWJ?Ib=U% z{%uU*WWixI@HFA<9x9JShY=gZLr5-w6;v(HyIRW!$_4YwI+ke9YG@Ndz%WEe$?$|G zLn`>4)*&3Ksd|C%9#jE3NAS#c7T&|?V|91gooOlQ)1u5}_T&;FOCP_>1oBR6d5!EI zl*BSvD;bUmr)NVlplNLZu}1Co;Q+iIWM*5hvb6uaUS)v@Uw)s(PJ17-n}iRSD?y&O zqL5!>dF#4qX$@@awrv}xVOx8qfl*6M2CA-^rt4a|ZtG44wlr+pbsJmQcJ#W1Hit1> zt!~s89WylSx~^?mj^%=@U~6L-2jVt0%Q76pz_U<{wa79#PRU`XNXHsfw~^=7)`}28 z>uNL`LeMqCZ0N3T;zoWJs}mJvpss@Z|El?U`LD}!Mw9J-d#yg`s2kh14{or>tttKcr+OiIX-%qOoU!D;jn+@T`+gDbSIXXRL?ItI2&K! za`iaIJbBm4;fu40uI_QK0h47;99qs`vpUM-U689tUCU~2uMSwR;d=AvwAgV<^ zmJeWI5W8$m#LuuKx8fT{^JRt@My9Zj_4^1>i+Cxx6wJwYj*FV7STkLh@T8U^GBp@P zOmeH4jNuc(Bgr*U*Ahx-a|PRK#(d3k0w3bVuzRhU*v7+$;%nft25tP0VHbeUxB=@- za~*+?{+4KDMa4w_sdob{yi#Q6GOxaY#u!Q$xQwddjvs54 zxxWfcMqa_fJ@?hes&R3vDDG_)jrm%K;GrkU)_K-f;$P;tp1hTv%8og2V862_Vl&eR zMQ>v8Ro(%Yye}FVRyE#XXGGeit7=E6V~QCw0(aXjH^|63<;^@@UIv;=b~U@zb~kI6 zp+iHwG4cj~2|j@Ny?{{w~d6XgH^ literal 1895 zcmeHHO-sW-5WVMDEcKFt6x)+n1nr0DK`d#(f=bzDr^(XoChTriko+evDI7#rBEb|iiGZek;}E4AlJY+ z-A&B5lAFGhR*Sbw!F}Qjsx|SfJt_kM>2b&j!RLV5!=S0m8ouSED%@?SD9mG=kfkNM zXRWL$_XW6B;>wCi<_3v(7t}WoMXg-xG2*QBx9G;ti>YnO8g^vMa#&{sex#_06fsl< zV8|(v@Kk;-6cAjc;+F|!42O`hW+C_260~-Y+lLh7S#mm_E0u!fF%#qR)?TF13~?D-9d>hj$ujNIxwjSC;5sX9m9lNe{ODc!3DTk zW83`-ErkuEO-vPBZD;`6-9dbJ(7pYje>>>jzZi73%nQ3$Vt=K7c%>UAjTaYty7QOt Nfc?=%pqa!;oDVaA*-iie diff --git a/tests/Perspex.RenderTests/TestBase.cs b/tests/Perspex.RenderTests/TestBase.cs index 4a7dd270a2d5649c8d36188a7cd78705bbf679f0..6f8a030367c9bec25667ec5f91f99a8d1b45b755 100644 GIT binary patch literal 4708 zcmd5<+inv<4D~Y-|FBA5wxZgWK7v4`7oZY_D5*pxicp$M8)z=%!d3h_aE>R=?#ymB zX;CW_C6k@CJ;%o$d*;vYZP}Jc_GKs|`7UGW$%S0X6mzk(WE0~Fo;w(8_#Mjxavk}m z&tqtP#8V6M31+Htg-?{RGSR0Fw5a<9zimj~mwQ;1>%PKzEzAy7qK%mu{+f>pQj zu^a(K1lw6@uGoMiv88WlEs;KKMAC))mA>!6YHDu;EGcs09pXcuyBNnh&Y($OQp@xq zg2lmHsxM9G^q?`A`$WHH@PslKkZpj`31m9JlfZ{J@>qReE>lAg6=SMTq3>W|_xwr!AJkn6(7;ChFq^Z8SRh{Q~-Bb0e z2m9_Fnc9GE7cAA}Q0nlE6&^lUF==%#{uHYz1CDef50zdDa)nMexC80tdosGxWX^xridRuLSa;5jS=g) zt3^Y^bBdhgZ%w0dd5gR=;_2F~fSh>_G_1$Wq9^zojznHymhWBFwfR_{Nd?s z8`sTCpWPy?MY&yEM{I3&H|r!e7mn=lJ#5-!FS?2xkh8S-M! zeq7kAm{F_qrY!5|nPpar@&RVKi(Pgls6nhqX~q}D-%$DtryTAf0#iNdj9{I4oj$R$ z48Y)5jO*yfh26&x*cf9Co{u*1O>rdhR&#;eZT*v-mq2W1Z|gy2%rqd)j>XKje_7A% zJ@@)DynbFLQiQ?$4@ciBGnnUt88Vpl#W0yCp|(ByR;th*!w&O$23WjUJ@ z{wc_3xt!7IQkWjXY(oYm1n=Zz`d;cg(&SgdwWZ>AOhPy=Z72dnd-2#+be7aAAS<%JtS3I#V51+2vgo z8{jVbSu=w>u)WyfW!2c-WXW@i@hMi^f%P5PUDBbAxNmWr*d5ReWX@XnW7#LZJ px|+j$Lm#s~8_$ur9{kATz_D1t9N(tMSLKAOY=+84f7U&@-@g@Gu>Jr5 literal 2143 zcmb_d-A>yu6uw@b!YVgLR2JiMh-pw@%yuf zh(WomR1SIq`d+1AV%MvsoWoGgRr)FZ+#)UutINC-5^O`rloXTzfyBYLb)oEWl59)z z%!3XYoF2!G2y0Hk+=@Uhj=AGl)ze(1EX}1cjAT5Ms3CmQ8HKGf$zsagLez@(Flh-xUZ5HN5i5;Xso7smbI;FJCb(s_mG=V zi&9)-oeeu-lt8=&ds*i>z4KQ+A@2MiZRz~(9M|4XV*i}8RmA7*&?gz}LK$)0vJ6be)R?!=-VbDs6E=k96!cph{14cIuAoGSJ|NLvFRp2TLC?mw!b)uk($%Za z+JpzJC$L>aRm@524z~uZLwBa^QdVs0A1ADUFM&*C=bd;0#Z_VVJwfqKWp>g3qstpm z^M&06GQrVdhJO6U^gr(;Z8Q{ZJnbD;<2eLrY7Lwc;SRw{&&K0aYgx>JdvdAut{c8y zg62qVQ0#V@$a~;aj>!CYYtR8JHMq0X@c+{b@U?QyN7MVXo(PelF=DlvMw6+nr8^j& zmO5&;IIF)u9DNpcZ|WVHcrX#ANLR`fxiJrJNBkP~Ms!xiL1E;Yu5ecZ)|b>Tj+ z&o0Pe2soIj7?-8Rwkjr{YjnvlW2dd~Hs?OyOLiy@kJgh*aJwf9eK|D-v=ukH20oK` fsrMTmu6{VGFZ}KZug4BN)D0G^7Jz?SC9C8&K*e{A diff --git a/tests/Perspex.SceneGraph.UnitTests/Properties/AssemblyInfo.cs b/tests/Perspex.SceneGraph.UnitTests/Properties/AssemblyInfo.cs index 8744ea984f..dd0defa358 100644 --- a/tests/Perspex.SceneGraph.UnitTests/Properties/AssemblyInfo.cs +++ b/tests/Perspex.SceneGraph.UnitTests/Properties/AssemblyInfo.cs @@ -1,3 +1,6 @@ -using System.Reflection; +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. + +using System.Reflection; [assembly: AssemblyTitle("Perspex.SceneGraph.UnitTests")] diff --git a/tests/Perspex.SceneGraph.UnitTests/TestRoot.cs b/tests/Perspex.SceneGraph.UnitTests/TestRoot.cs index 69c77c001f..41215cfa08 100644 --- a/tests/Perspex.SceneGraph.UnitTests/TestRoot.cs +++ b/tests/Perspex.SceneGraph.UnitTests/TestRoot.cs @@ -1,14 +1,12 @@ - - - +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. +using System; +using Perspex.Platform; +using Perspex.Rendering; namespace Perspex.SceneGraph.UnitTests { - using System; - using Perspex.Platform; - using Perspex.Rendering; - public class TestRoot : TestVisual, IRenderRoot { public IRenderer Renderer diff --git a/tests/Perspex.SceneGraph.UnitTests/TestVisual.cs b/tests/Perspex.SceneGraph.UnitTests/TestVisual.cs index 551c20d640..f8a6899c2e 100644 --- a/tests/Perspex.SceneGraph.UnitTests/TestVisual.cs +++ b/tests/Perspex.SceneGraph.UnitTests/TestVisual.cs @@ -1,15 +1,13 @@ - - - +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. +using System; +using System.Collections.Generic; +using System.Linq; +using Perspex.Rendering; namespace Perspex.SceneGraph.UnitTests { - using System; - using System.Collections.Generic; - using System.Linq; - using Perspex.Rendering; - public class ParamEventArgs : EventArgs { public ParamEventArgs(T param) diff --git a/tests/Perspex.SceneGraph.UnitTests/VisualTests.cs b/tests/Perspex.SceneGraph.UnitTests/VisualTests.cs index c56136d864..a4b8c40e52 100644 --- a/tests/Perspex.SceneGraph.UnitTests/VisualTests.cs +++ b/tests/Perspex.SceneGraph.UnitTests/VisualTests.cs @@ -1,15 +1,12 @@ - - - - +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. +using System.Linq; +using Perspex.VisualTree; +using Xunit; namespace Perspex.SceneGraph.UnitTests { - using System.Linq; - using Perspex.VisualTree; - using Xunit; - public class VisualTests { [Fact] diff --git a/tests/Perspex.SceneGraph.UnitTests/VisualTree/BoundsTrackerTests.cs b/tests/Perspex.SceneGraph.UnitTests/VisualTree/BoundsTrackerTests.cs index 63cd4a7dc7..efd4118d17 100644 --- a/tests/Perspex.SceneGraph.UnitTests/VisualTree/BoundsTrackerTests.cs +++ b/tests/Perspex.SceneGraph.UnitTests/VisualTree/BoundsTrackerTests.cs @@ -1,20 +1,17 @@ - - - - - +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. + +using System; +using System.Collections.Generic; +using System.Linq; +using System.Reactive.Linq; +using Perspex.Controls; +using Perspex.Controls.Shapes; +using Perspex.VisualTree; +using Xunit; namespace Perspex.SceneGraph.UnitTests.VisualTree { - using System; - using System.Collections.Generic; - using System.Linq; - using System.Reactive.Linq; - using Perspex.Controls; - using Perspex.Controls.Shapes; - using Perspex.VisualTree; - using Xunit; - public class BoundsTrackerTests { [Fact] diff --git a/tests/Perspex.Styling.UnitTests/Properties/AssemblyInfo.cs b/tests/Perspex.Styling.UnitTests/Properties/AssemblyInfo.cs index de65dabcc6..c17aed34e1 100644 --- a/tests/Perspex.Styling.UnitTests/Properties/AssemblyInfo.cs +++ b/tests/Perspex.Styling.UnitTests/Properties/AssemblyInfo.cs @@ -1,8 +1,5 @@ - - - - - +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. using System.Reflection; diff --git a/tests/Perspex.Styling.UnitTests/SelectorTests_Child.cs b/tests/Perspex.Styling.UnitTests/SelectorTests_Child.cs index e190d900e0..9d1e401f4a 100644 --- a/tests/Perspex.Styling.UnitTests/SelectorTests_Child.cs +++ b/tests/Perspex.Styling.UnitTests/SelectorTests_Child.cs @@ -1,19 +1,16 @@ - - - - +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. +using System; +using System.Linq; +using System.Reactive.Linq; +using System.Threading.Tasks; +using Perspex.Collections; +using Perspex.Styling; +using Xunit; namespace Perspex.Styling.UnitTests { - using System; - using System.Linq; - using System.Reactive.Linq; - using System.Threading.Tasks; - using Perspex.Collections; - using Perspex.Styling; - using Xunit; - public class SelectorTests_Child { [Fact] diff --git a/tests/Perspex.Styling.UnitTests/SelectorTests_Class.cs b/tests/Perspex.Styling.UnitTests/SelectorTests_Class.cs index df6abdd5fe..9d98bd9a12 100644 --- a/tests/Perspex.Styling.UnitTests/SelectorTests_Class.cs +++ b/tests/Perspex.Styling.UnitTests/SelectorTests_Class.cs @@ -1,18 +1,15 @@ - - - - +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. +using System.Linq; +using System.Reactive.Linq; +using System.Threading.Tasks; +using Moq; +using Perspex.Styling; +using Xunit; namespace Perspex.Styling.UnitTests { - using System.Linq; - using System.Reactive.Linq; - using System.Threading.Tasks; - using Moq; - using Perspex.Styling; - using Xunit; - public class SelectorTests_Class { [Fact] diff --git a/tests/Perspex.Styling.UnitTests/SelectorTests_Descendent.cs b/tests/Perspex.Styling.UnitTests/SelectorTests_Descendent.cs index d0adcdeee0..e7df8ecdfa 100644 --- a/tests/Perspex.Styling.UnitTests/SelectorTests_Descendent.cs +++ b/tests/Perspex.Styling.UnitTests/SelectorTests_Descendent.cs @@ -1,19 +1,16 @@ - - - - +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. +using System; +using System.Linq; +using System.Reactive.Linq; +using System.Threading.Tasks; +using Perspex.Collections; +using Perspex.Styling; +using Xunit; namespace Perspex.Styling.UnitTests { - using System; - using System.Linq; - using System.Reactive.Linq; - using System.Threading.Tasks; - using Perspex.Collections; - using Perspex.Styling; - using Xunit; - public class SelectorTests_Descendent { [Fact] diff --git a/tests/Perspex.Styling.UnitTests/SelectorTests_Multiple.cs b/tests/Perspex.Styling.UnitTests/SelectorTests_Multiple.cs index c62ec09ff8..aafa3d913e 100644 --- a/tests/Perspex.Styling.UnitTests/SelectorTests_Multiple.cs +++ b/tests/Perspex.Styling.UnitTests/SelectorTests_Multiple.cs @@ -1,19 +1,16 @@ - - - - +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. +using System; +using System.Collections.Generic; +using System.Linq; +using Perspex.Controls; +using Perspex.Controls.Templates; +using Perspex.Styling; +using Xunit; namespace Perspex.Styling.UnitTests { - using System; - using System.Collections.Generic; - using System.Linq; - using Perspex.Controls; - using Perspex.Controls.Templates; - using Perspex.Styling; - using Xunit; - public class SelectorTests_Multiple { [Fact] diff --git a/tests/Perspex.Styling.UnitTests/SelectorTests_Name.cs b/tests/Perspex.Styling.UnitTests/SelectorTests_Name.cs index 2a1c756294..1d01e0f4e7 100644 --- a/tests/Perspex.Styling.UnitTests/SelectorTests_Name.cs +++ b/tests/Perspex.Styling.UnitTests/SelectorTests_Name.cs @@ -1,18 +1,11 @@ - - - - +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. +using Moq; +using Xunit; namespace Perspex.Styling.UnitTests { - using System.Linq; - using System.Reactive.Linq; - using System.Threading.Tasks; - using Moq; - using Perspex.Styling; - using Xunit; - public class SelectorTests_Name { [Fact] diff --git a/tests/Perspex.Styling.UnitTests/SelectorTests_OfType.cs b/tests/Perspex.Styling.UnitTests/SelectorTests_OfType.cs index 5cda67beaa..676d62a644 100644 --- a/tests/Perspex.Styling.UnitTests/SelectorTests_OfType.cs +++ b/tests/Perspex.Styling.UnitTests/SelectorTests_OfType.cs @@ -1,18 +1,11 @@ - - - - +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. +using Moq; +using Xunit; namespace Perspex.Styling.UnitTests { - using System.Linq; - using System.Reactive.Linq; - using System.Threading.Tasks; - using Moq; - using Perspex.Styling; - using Xunit; - public class SelectorTests_OfType { [Fact] diff --git a/tests/Perspex.Styling.UnitTests/SelectorTests_PropertyEquals.cs b/tests/Perspex.Styling.UnitTests/SelectorTests_PropertyEquals.cs index d4aa4844ee..4d5b3c819f 100644 --- a/tests/Perspex.Styling.UnitTests/SelectorTests_PropertyEquals.cs +++ b/tests/Perspex.Styling.UnitTests/SelectorTests_PropertyEquals.cs @@ -1,18 +1,14 @@ - - - - +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. +using System.Linq; +using System.Reactive.Linq; +using System.Threading.Tasks; +using Perspex.Controls; +using Xunit; namespace Perspex.Styling.UnitTests { - using System.Linq; - using System.Reactive.Linq; - using System.Threading.Tasks; - using Perspex.Controls; - using Perspex.Styling; - using Xunit; - public class SelectorTests_PropertyEquals { [Fact] diff --git a/tests/Perspex.Styling.UnitTests/SelectorTests_Template.cs b/tests/Perspex.Styling.UnitTests/SelectorTests_Template.cs index 3df84d3129..77a60df976 100644 --- a/tests/Perspex.Styling.UnitTests/SelectorTests_Template.cs +++ b/tests/Perspex.Styling.UnitTests/SelectorTests_Template.cs @@ -1,19 +1,17 @@ - - - - +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. +using System.Linq; +using System.Reactive.Linq; +using Moq; +using Perspex.Controls; +using Perspex.VisualTree; +using Xunit; +using System.Threading.Tasks; namespace Perspex.Styling.UnitTests { - using System.Linq; - using System.Reactive.Linq; - using Moq; - using Perspex.Controls; - using Perspex.Styling; - using Perspex.VisualTree; - using Xunit; - using System.Threading.Tasks; + using Controls = Perspex.Controls.Controls; public class SelectorTests_Template { diff --git a/tests/Perspex.Styling.UnitTests/StyleActivatorTests.cs b/tests/Perspex.Styling.UnitTests/StyleActivatorTests.cs index 7f96c0d73a..2172bc39f7 100644 --- a/tests/Perspex.Styling.UnitTests/StyleActivatorTests.cs +++ b/tests/Perspex.Styling.UnitTests/StyleActivatorTests.cs @@ -1,10 +1,12 @@ -namespace Perspex.Styling.UnitTests -{ - using System; - using System.Reactive.Linq; - using Perspex.Styling; - using Xunit; +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. + +using System; +using System.Reactive.Linq; +using Xunit; +namespace Perspex.Styling.UnitTests +{ public class StyleActivatorTests { [Fact] diff --git a/tests/Perspex.Styling.UnitTests/StyleTests.cs b/tests/Perspex.Styling.UnitTests/StyleTests.cs index 0969fe72d0..fcc87a99e6 100644 --- a/tests/Perspex.Styling.UnitTests/StyleTests.cs +++ b/tests/Perspex.Styling.UnitTests/StyleTests.cs @@ -1,18 +1,14 @@ - - - - +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. +using System; +using System.Collections.Generic; +using System.Reactive.Subjects; +using Perspex.Controls; +using Xunit; namespace Perspex.Styling.UnitTests { - using System; - using System.Collections.Generic; - using System.Reactive.Subjects; - using Perspex.Controls; - using Perspex.Styling; - using Xunit; - public class StyleTests { [Fact] diff --git a/tests/Perspex.Styling.UnitTests/TestControlBase.cs b/tests/Perspex.Styling.UnitTests/TestControlBase.cs index d455b89779..ca4d465db9 100644 --- a/tests/Perspex.Styling.UnitTests/TestControlBase.cs +++ b/tests/Perspex.Styling.UnitTests/TestControlBase.cs @@ -1,14 +1,10 @@ - - - - +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. +using System; namespace Perspex.Styling.UnitTests { - using System; - using Perspex.Styling; - public class TestControlBase : IStyleable { public TestControlBase() diff --git a/tests/Perspex.Styling.UnitTests/TestObservable.cs b/tests/Perspex.Styling.UnitTests/TestObservable.cs index 4dc394ee91..6ce06f3f97 100644 --- a/tests/Perspex.Styling.UnitTests/TestObservable.cs +++ b/tests/Perspex.Styling.UnitTests/TestObservable.cs @@ -1,14 +1,11 @@ - - - - +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. +using System; +using System.Reactive.Disposables; namespace Perspex.Styling.UnitTests { - using System; - using System.Reactive.Disposables; - public class TestObservable : IObservable { public int SubscribedCount { get; private set; } diff --git a/tests/Perspex.Styling.UnitTests/TestObserver.cs b/tests/Perspex.Styling.UnitTests/TestObserver.cs index 038cc289a2..8e15560e4c 100644 --- a/tests/Perspex.Styling.UnitTests/TestObserver.cs +++ b/tests/Perspex.Styling.UnitTests/TestObserver.cs @@ -1,18 +1,15 @@ - - - - +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. +using System; namespace Perspex.Styling.UnitTests { - using System; - internal class TestObserver : IObserver { - private bool hasValue; + private bool _hasValue; - private T value; + private T _value; public bool Completed { get; private set; } @@ -20,7 +17,7 @@ namespace Perspex.Styling.UnitTests public T GetValue() { - if (!this.hasValue) + if (!_hasValue) { throw new Exception("Observable provided no value."); } @@ -35,8 +32,8 @@ namespace Perspex.Styling.UnitTests throw new Exception("Observable errored unexpectedly."); } - this.hasValue = false; - return this.value; + _hasValue = false; + return _value; } public void OnCompleted() @@ -51,10 +48,10 @@ namespace Perspex.Styling.UnitTests public void OnNext(T value) { - if (!this.hasValue) + if (!_hasValue) { - this.value = value; - this.hasValue = true; + _value = value; + _hasValue = true; } else { diff --git a/tests/Perspex.Styling.UnitTests/TestSelectors.cs b/tests/Perspex.Styling.UnitTests/TestSelectors.cs index 3edd322af3..06e3be6821 100644 --- a/tests/Perspex.Styling.UnitTests/TestSelectors.cs +++ b/tests/Perspex.Styling.UnitTests/TestSelectors.cs @@ -1,13 +1,10 @@ - - - - +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. +using Perspex.Styling; namespace Perspex.Styling.UnitTests { - using Perspex.Styling; - public static class TestSelectors { public static Selector SubscribeCheck(this Selector selector) diff --git a/tests/Perspex.Styling.UnitTests/TestSubject.cs b/tests/Perspex.Styling.UnitTests/TestSubject.cs index dd6ddfa5c8..96e4c68e37 100644 --- a/tests/Perspex.Styling.UnitTests/TestSubject.cs +++ b/tests/Perspex.Styling.UnitTests/TestSubject.cs @@ -1,34 +1,31 @@ - - - - +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. +using System; +using System.Collections.Generic; +using System.Reactive.Disposables; namespace Perspex.Styling.UnitTests { - using System; - using System.Collections.Generic; - using System.Reactive.Disposables; - internal class TestSubject : IObserver, IObservable { - private T initial; + private T _initial; - private List> subscribers = new List>(); + private List> _subscribers = new List>(); public TestSubject(T initial) { - this.initial = initial; + _initial = initial; } public int SubscriberCount { - get { return this.subscribers.Count; } + get { return _subscribers.Count; } } public void OnCompleted() { - foreach (IObserver subscriber in this.subscribers.ToArray()) + foreach (IObserver subscriber in _subscribers.ToArray()) { subscriber.OnCompleted(); } @@ -36,7 +33,7 @@ namespace Perspex.Styling.UnitTests public void OnError(Exception error) { - foreach (IObserver subscriber in this.subscribers.ToArray()) + foreach (IObserver subscriber in _subscribers.ToArray()) { subscriber.OnError(error); } @@ -44,7 +41,7 @@ namespace Perspex.Styling.UnitTests public void OnNext(T value) { - foreach (IObserver subscriber in this.subscribers.ToArray()) + foreach (IObserver subscriber in _subscribers.ToArray()) { subscriber.OnNext(value); } @@ -52,9 +49,9 @@ namespace Perspex.Styling.UnitTests public IDisposable Subscribe(IObserver observer) { - this.subscribers.Add(observer); - observer.OnNext(this.initial); - return Disposable.Create(() => this.subscribers.Remove(observer)); + _subscribers.Add(observer); + observer.OnNext(_initial); + return Disposable.Create(() => _subscribers.Remove(observer)); } } } diff --git a/tests/Perspex.Styling.UnitTests/TestTemplatedControl.cs b/tests/Perspex.Styling.UnitTests/TestTemplatedControl.cs index 3a36dc4eff..8fd47a27fb 100644 --- a/tests/Perspex.Styling.UnitTests/TestTemplatedControl.cs +++ b/tests/Perspex.Styling.UnitTests/TestTemplatedControl.cs @@ -1,15 +1,11 @@ - - - - +// Copyright (c) The Perspex Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. +using System; +using System.Collections.Generic; namespace Perspex.Styling.UnitTests { - using System; - using System.Collections.Generic; - using Perspex.Styling; - public abstract class TestTemplatedControl : ITemplatedControl, IStyleable { public abstract Classes Classes