From 4e03cfd5b75d313630a12f12c90be2915ad50016 Mon Sep 17 00:00:00 2001 From: HeBianGu Date: Fri, 21 Jun 2024 00:22:18 +0800 Subject: [PATCH 1/2] + --- .editorconfig | 4 +- Directory.Build.Props | 2 +- Solution/WPF-Control.sln | 2 +- Source/App/H.App.FileManager/App.xaml.cs | 11 +- .../Converter/GetFileMenuItemConverter.cs | 12 +- .../DataBase/Model/fm_dd_image.cs | 2 +- Source/App/H.App.FileManager/Extention.cs | 4 - .../Presenter/FileView.xaml.cs | 4 +- .../Presenter/ImageView.xaml.cs | 4 +- .../Presenter/MoreFileViewBase.xaml.cs | 2 +- .../Presenter/TorrentView.xaml.cs | 1 - .../Presenter/VideoView.xaml.cs | 9 +- .../Project/FileProjectItem.xaml.cs | 7 +- .../Provider/Filter/FavoriteFileFilter.cs | 3 +- .../Provider/Filter/FileFilter.cs | 2 +- .../Provider/Filter/ScoreFileFilter.cs | 2 +- .../Provider/Filter/SeeLaterFileFilter.cs | 2 +- .../Provider/Filter/WatchedFileFilter.cs | 2 +- .../Provider/Order/FileOrderByAccessTime.cs | 1 - .../Service/FileToMoreViewService.cs | 4 +- .../Service/FileToViewService.cs | 4 +- .../Service/ProjectFavoriteService.cs | 1 - .../ViewModel/FileRepositoryBindable.xaml.cs | 10 +- .../H.Controls.Adorner/Adorner/AdornerBase.cs | 4 +- .../Adorner/BorderAdorner.cs | 2 +- .../Adorner/ControlTemplateAdorner.xaml.cs | 14 +- .../Adorner/DataTemplateAdorner.xaml.cs | 2 +- .../H.Controls.Adorner/Adorner/DragAdorner.cs | 8 +- .../H.Controls.Adorner/Adorner/LineAdorner.cs | 10 +- .../Adorner/ResizeAdorner.xaml.cs | 12 +- .../Adorner/SelectedControlTemplateAdorner.cs | 2 +- .../Service/Bevhavior/DrapAdornerBehavior.cs | 50 +- .../Service/Bevhavior/DropAdornerBehavior.cs | 2 +- .../Bevhavior/ElementAllowDrapBehavior.cs | 20 +- .../H.Controls.Chart2D/Axis/Axis.xaml.cs | 18 +- .../H.Controls.Chart2D/Axis/Grid.xaml.cs | 4 +- .../H.Controls.Chart2D/Axis/Polar.xaml.cs | 2 +- .../Controls/H.Controls.Chart2D/Chart.xaml.cs | 42 +- .../Marker/CirclePointMarker.cs | 4 +- .../H.Controls.Chart2D/Marker/IMark.cs | 4 +- .../H.Controls.Chart2D/Marker/Marker.xaml.cs | 6 +- .../Marker/T5PointMarker.cs | 2 +- .../Marker/TrianglePointMarker.cs | 8 +- Source/Controls/H.Controls.Chart2D/Option.cs | 2 +- .../Presenter/BarPresenter.xaml.cs | 2 +- .../Presenter/Chart2DPresenterBase.cs | 4 +- .../H.Controls.Chart2D/Provider/Layer.xaml.cs | 66 +- .../Provider/LayerGroup.xaml.cs | 24 +- .../Provider/ThumbToolBar.xaml.cs | 14 +- .../H.Controls.Chart2D/Series/Bar.xaml.cs | 16 +- .../H.Controls.Chart2D/Series/FlagTip.xaml.cs | 12 +- .../H.Controls.Chart2D/Series/Line.xaml.cs | 26 +- .../Series/MarkLine.xaml.cs | 14 +- .../Series/MarkPosition.xaml.cs | 16 +- .../H.Controls.Chart2D/Series/MarkTip.xaml.cs | 2 +- .../H.Controls.Chart2D/Series/Pie.xaml.cs | 12 +- .../H.Controls.Chart2D/Series/Scatter.xaml.cs | 14 +- .../H.Controls.Chart2D/Series/Series.xaml.cs | 6 +- .../H.Controls.Chart2D/Series/Title.xaml.cs | 6 +- .../Series/VisualMap.xaml.cs | 2 +- .../H.Controls.ColorBox/ColorBox.xaml.cs | 22 +- .../ColorSourceExtension.cs | 5 - .../Controls/H.Controls.ColorBox/Service.cs | 2 - .../Behaviors/TextBoxFocusBehavior.cs | 44 +- .../Converters/BoolToVisibilityConverter.cs | 2 +- .../Converters/ColorToHexConverter.cs | 4 +- ...RangeConstrainedDoubleToDoubleConverter.cs | 2 +- .../DualPickerControlBase.cs | 36 +- .../EventArgs/ColorRoutedEventArgs.cs | 2 +- .../Model/ColorState.cs | 4 +- .../Model/NotifyableColor.cs | 20 +- .../PickerControlBase.cs | 14 +- .../UIExtensions/HslColorSlider.cs | 36 +- .../UIExtensions/HsvColorSlider.cs | 28 +- .../UIExtensions/PreviewColorSlider.cs | 18 +- .../UIExtensions/RgbColorSlider.cs | 16 +- .../UserControls/HueSlider.xaml.cs | 4 +- .../UserControls/SquareSlider.xaml.cs | 20 +- .../Commands/Command.Node.cs | 2 +- .../DiagramBase.cs | 6 +- .../FlowableDiagramBase.cs | 6 +- .../FlowableDiagramTemplateNodeData.xaml.cs | 2 +- .../Presenter/Node/ImageNodeData.xaml.cs | 2 +- .../Presenter/Node/Provider/NodeData.cs | 16 +- .../Presenter/Node/Provider/SystemNodeData.cs | 8 +- .../DiagramDropDispalyNodeBehavior.cs | 2 +- .../Provider/DiagramTemplate.cs | 3 +- .../WorkflowNodeAdorner.xaml.cs | 2 +- .../H.Controls.Diagram/Diagram.xaml.cs | 38 +- .../H.Controls.Diagram/Layer/Base/Layer.cs | 4 +- .../H.Controls.Diagram/Layer/LinkLayer.cs | 2 +- .../H.Controls.Diagram/Layout/TreeLayout.cs | 6 +- .../LinkDrawer/ArcLinkDrawer.cs | 4 +- .../LinkDrawer/BezierLinkDrawer.cs | 2 +- .../LinkDrawer/BrokenLinkDrawer.cs | 2 +- .../LinkDrawer/LinkDrawer.cs | 10 +- .../NodeResizeAdorner.xaml.cs | 8 +- .../H.Controls.Diagram/Part/Base/Part.cs | 6 +- .../H.Controls.Diagram/Part/Link.xaml.cs | 6 +- .../H.Controls.Diagram/Part/Node.xaml.cs | 2 +- .../H.Controls.Diagram/Part/Port.xaml.cs | 2 +- .../H.Controls.Diagram/Part/TreeNode.xaml.cs | 4 +- .../DynimacLinkBehaviorBase.cs | 4 + .../AnchorableClosedEventArgs.cs | 2 +- .../AnchorableClosingEventArgs.cs | 2 +- .../AnchorableHiddenEventArgs.cs | 2 +- .../AnchorableHidingEventArgs.cs | 2 +- .../H.Controls.Dock/Commands/WeakAction.cs | 46 +- .../Commands/WeakActionGeneric.cs | 28 +- .../H.Controls.Dock/Commands/WeakFunc.cs | 42 +- .../Commands/WeakFuncGeneric.cs | 28 +- .../Controls/AnchorablePaneDropTarget.cs | 16 +- .../Controls/AnchorablePaneTabPanel.cs | 4 +- .../Controls/AnchorablePaneTitle.xaml.cs | 14 +- .../Controls/DockingManagerDropTarget.cs | 6 +- .../DocumentPaneDropAsAnchorableTarget.cs | 4 +- .../Controls/DocumentPaneDropTarget.cs | 18 +- .../Controls/DocumentPaneGroupDropTarget.cs | 8 +- .../Controls/DocumentPaneTabPanel.cs | 4 +- .../H.Controls.Dock/Controls/DropArea.cs | 8 +- .../Controls/DropDownButton.cs | 18 +- .../Controls/DropDownControlArea.cs | 14 +- .../H.Controls.Dock/Controls/DropTarget.cs | 6 +- .../Controls/LayoutAnchorableControl.xaml.cs | 22 +- ...outAnchorableFloatingWindowControl.xaml.cs | 62 +- .../Controls/LayoutAnchorableItem.cs | 28 +- .../LayoutAnchorablePaneControl.xaml.cs | 4 +- .../Controls/LayoutAnchorableTabItem.xaml.cs | 6 +- .../LayoutAutoHideWindowControl.xaml.cs | 38 +- .../Controls/LayoutDocumentControl.xaml.cs | 18 +- ...ayoutDocumentFloatingWindowControl.xaml.cs | 32 +- .../Controls/LayoutDocumentItem.cs | 4 +- .../LayoutDocumentPaneControl.xaml.cs | 4 +- .../Controls/LayoutDocumentTabItem.xaml.cs | 28 +- .../Controls/LayoutFloatingWindowControl.cs | 94 +- .../Controls/LayoutGridControl.cs | 134 +- .../H.Controls.Dock/Controls/LayoutItem.cs | 182 +- .../Controls/LayoutPanelControl.cs | 6 +- .../H.Controls.Dock/Controls/MenuItemEx.cs | 10 +- .../Controls/NavigatorWindow.xaml.cs | 100 +- .../H.Controls.Dock/Controls/OverlayWindow.cs | 16 +- .../Controls/Shell/Standard/ErrorCodes.cs | 8 +- .../Controls/Shell/Standard/MessageWindow.cs | 12 +- .../Controls/Shell/Standard/NativeMethods.cs | 2 +- .../Controls/Shell/SystemParameters2.cs | 66 +- .../Controls/Shell/WindowChromeWorker.cs | 4 +- .../H.Controls.Dock/Controls/TabControlEx.cs | 2 +- .../Controls/WindowActivateEventArgs.cs | 2 +- .../Controls/WindowHookHandler.cs | 4 +- .../H.Controls.Dock/DockingManager.xaml.cs | 220 +- .../DocumentClosedEventArgs.cs | 2 +- .../DocumentClosingEventArgs.cs | 2 +- .../Layout/ChildrenTreeChangedEventArgs.cs | 2 +- .../Layout/LayoutAnchorGroup.cs | 2 +- .../Layout/LayoutAnchorSide.cs | 14 +- .../Layout/LayoutAnchorable.cs | 218 +- .../Layout/LayoutAnchorableFloatingWindow.cs | 46 +- .../Layout/LayoutAnchorablePane.cs | 76 +- .../Layout/LayoutAnchorablePaneGroup.cs | 36 +- .../H.Controls.Dock/Layout/LayoutContent.cs | 268 +- .../H.Controls.Dock/Layout/LayoutDocument.cs | 18 +- .../Layout/LayoutDocumentFloatingWindow.cs | 44 +- .../Layout/LayoutDocumentPane.cs | 70 +- .../Layout/LayoutDocumentPaneGroup.cs | 14 +- .../H.Controls.Dock/Layout/LayoutElement.cs | 12 +- .../Layout/LayoutElementEventArgs.cs | 2 +- .../Layout/LayoutFloatingWindow.cs | 2 +- .../H.Controls.Dock/Layout/LayoutGroup.cs | 14 +- .../H.Controls.Dock/Layout/LayoutGroupBase.cs | 4 +- .../H.Controls.Dock/Layout/LayoutPanel.cs | 26 +- .../Layout/LayoutPositionableGroup.cs | 100 +- .../H.Controls.Dock/Layout/LayoutRoot.cs | 224 +- .../LayoutSerializationCallbackEventArgs.cs | 6 +- .../Layout/Serialization/LayoutSerializer.cs | 14 +- .../Serialization/XmlLayoutSerializer.cs | 8 +- ...outFloatingWindowControlClosedEventArgs.cs | 2 +- ...utFloatingWindowControlCreatedEventArgs.cs | 2 +- .../Controls/H.Controls.Dock/Win32Helper.cs | 4 +- .../FavoriteBox.xaml.cs | 6 +- .../FavoriteFilterBox.xaml.cs | 6 +- .../FavoritesPresenter.xaml.cs | 1 - .../Service/FavoriteOptions.cs | 2 - .../Service/FavoriteService.cs | 4 +- .../Service/IFavoriteService.cs | 3 +- .../H.Controls.FilterBox/FilterBox.xaml.cs | 2 - .../PropertyFilterBox/PropertyConfidtion.cs | 10 +- .../PropertyConfidtionPrensenter.xaml.cs | 38 +- .../PropertyConfidtionsPrensenter.xaml.cs | 34 +- .../PropertyFilterBox.xaml.cs | 14 +- .../TextBlockFilterCountBehavior.cs | 6 +- .../TextBlockFiltersCountBehavior.cs | 6 +- .../FilterColumnDataGrid.xaml.cs | 249 +- .../Provider/FilterCommon.cs | 18 +- .../Provider/FilterItem.cs | 28 +- .../Provider/Loc.cs | 18 +- .../BindingGetSelectSourceMethodAttribute.cs | 2 +- ...BindingGetSelectSourcePropertyAttribute.cs | 2 +- .../Attribute/PropertyItemTypeAttribute.cs | 2 +- Source/Controls/H.Controls.Form/Form.xaml.cs | 61 +- .../PropertyItem/Base/ObjectProperty.cs | 16 +- .../PropertyItem/Base/StringHost.cs | 2 +- .../IEnumerablePropertyItem.xaml.cs | 2 +- .../PrimitiveArrayPropertyItem.cs | 2 +- .../PropertyItem/PrimitiveListPropertyItem.cs | 2 +- .../SelectSourcePropertyItem.xaml.cs | 2 +- .../Provider/PropertyExtention.cs | 6 +- .../GridSplitterBox.xaml.cs | 40 +- .../HorseTextBlock.xaml.cs | 2 +- .../NavigationBox.xaml.cs | 14 +- .../ScrollIntoView.xaml.cs | 10 +- .../H.Controls.OrderBox/OrderBox.xaml.cs | 3 - .../PropertyOrderBox.xaml.cs | 2 +- .../PropertyOrderPrensenter.xaml.cs | 4 +- .../PropertyOrdersPrensenter.xaml.cs | 2 +- .../Common/AnimationDecorator.cs | 48 +- .../H.Controls.OutlookBar/OdcExpander.xaml.cs | 2 +- .../H.Controls.OutlookBar/OutlookBar.xaml.cs | 86 +- .../OutlookSection.xaml.cs | 6 +- .../OverflowMenuCreatedEventArgs.cs | 2 +- .../AllowableCharactersTextBoxBehavior.cs | 14 +- .../H.Controls.PDF/BehaviorForStyle.cs | 4 +- .../BindSelectedItemBehavior.cs | 13 +- Source/Controls/H.Controls.PDF/Extension.cs | 7 +- Source/Controls/H.Controls.PDF/PDFBox.xaml.cs | 30 +- .../Controls/H.Controls.PDF/PDFBoxCommands.cs | 2 +- .../H.Controls.PagerBox/PagerBox.xaml.cs | 52 +- .../Controls/H.Controls.Panel/HexGrid.xaml.cs | 38 +- .../H.Controls.Panel/Panel/ArcPanel.cs | 2 +- .../H.Controls.Panel/Panel/CirclePanel.cs | 2 +- .../H.Controls.Panel/Panel/DockPanel.cs | 4 +- .../H.Controls.Panel/Panel/DragPanel.cs | 110 +- .../DocumentViewPresenter.xaml.cs | 5 - .../Controls/H.Controls.PrintBox/PageSize.cs | 8 +- .../PagerSizeViewPresenter.xaml.cs | 12 +- .../H.Controls.PrintBox/PrintBox.xaml.cs | 7 +- .../H.Controls.PrintBox/PrintBoxSetting.cs | 4 +- .../PrintDocumentViewer.cs | 5 +- .../ProgressButton.xaml.cs | 10 +- .../Implementation/ButtonSpinner.cs | 32 +- .../Implementation/SpinEventArgs.cs | 12 +- .../ButtonSpinner/Implementation/Spinner.cs | 2 +- .../Calculator/Implementation/Calculator.cs | 52 +- .../Implementation/CalculatorUpDown.cs | 16 +- .../Implementation/CheckComboBox.cs | 29 +- .../Chromes/Implementation/ButtonChrome.cs | 2 +- .../Implementation/CollectionControl.cs | 54 +- .../CollectionControlDialog.xaml.cs | 4 +- .../Implementation/ItemAddingEventArgs.cs | 2 +- .../PrimitiveTypeCollectionControl.cs | 30 +- .../ColorCanvas/Implementation/ColorCanvas.cs | 38 +- .../Implementation/ColorSpectrumSlider.cs | 4 +- .../ColorPicker/Implementation/ColorItem.cs | 6 +- .../ColorPicker/Implementation/ColorPicker.cs | 34 +- .../Converters/VisibilityToBoolConverter.cs | 4 +- .../Input/InputValidationErrorEventArgs.cs | 2 +- .../Core/Utilities/Segment.cs | 6 +- .../Implementation/DateTimeUpDown.cs | 72 +- .../Implementation/MultiLineTextEditor.cs | 18 +- .../Implementation/CommonNumericUpDown.cs | 66 +- .../Implementation/DoubleUpDown.cs | 4 +- .../Implementation/NumericUpDown.cs | 2 +- .../Implementation/SingleUpDown.cs | 4 +- .../Primitives/DateTimePickerBase.cs | 15 +- .../Primitives/DateTimeUpDownBase.cs | 6 +- .../Primitives/Selector.cs | 86 +- .../Primitives/UpDownBase.cs | 72 +- .../PropertyGrid.xaml.cs | 30 +- .../Attributes/CategoryOrderAttribute.cs | 6 +- .../Attributes/ItemsSourceAttribute.cs | 2 +- .../Attributes/PropertyOrderAttribute.cs | 4 +- .../Implementation/ContainerHelperBase.cs | 4 +- .../Implementation/CustomPropertyItem.cs | 2 +- .../DescriptorPropertyDefinition.cs | 34 +- .../DescriptorPropertyDefinitionBase.cs | 16 +- .../Implementation/Editors/CheckBoxEditor.cs | 4 +- .../Editors/CollectionEditor.cs | 14 +- .../Implementation/Editors/ColorEditor.cs | 6 +- .../Implementation/Editors/ComboBoxEditor.cs | 4 +- .../Editors/ItemsSourceAttributeEditor.cs | 8 +- .../Editors/MaskedTextBoxEditor.cs | 2 +- .../Editors/PrimitiveTypeCollectionEditor.cs | 12 +- .../Implementation/Editors/TextBlockEditor.cs | 6 +- .../Implementation/Editors/TextBoxEditor.cs | 2 +- .../Implementation/Editors/TypeEditor.cs | 8 +- .../Implementation/Editors/UpDownEditors.cs | 12 +- .../Implementation/ObjectContainerHelper.cs | 18 +- .../ObjectContainerHelperBase.cs | 14 +- .../PropertyDefinitionBaseCollection.cs | 2 +- .../Implementation/PropertyItem.cs | 6 +- .../Implementation/PropertyItemBase.cs | 8 +- .../Implementation/PropertyItemCollection.cs | 4 +- .../H.Controls.QRCoderBox/Extension.cs | 7 +- .../H.Controls.QRCoderBox/QRCoderBox.xaml.cs | 6 +- .../RepositoryBox.xaml.cs | 24 +- .../RepositoryGrid.xaml.cs | 24 +- .../H.Controls.ScheduleBox/Job/HelloJob.cs | 2 +- .../H.Controls.Step/ShowStepCommand.cs | 1 - .../H.Controls.Step/StepPresenter.xaml.cs | 2 +- .../H.Controls.TagBox/Service/ITagService.cs | 1 - .../H.Controls.TagBox/Service/TagService.cs | 3 - .../Controls/H.Controls.TagBox/TagBox.xaml.cs | 5 +- .../H.Controls.TagBox/TagFilterBox.xaml.cs | 2 +- .../H.Controls.TagBox/TagsPresenter.xaml.cs | 1 - .../GetLevelToIndentConverter.cs | 3 +- .../TreeListView.xaml.cs | 4 +- Source/Controls/H.Controls.Vlc/Service.cs | 4 - .../Controls/H.Controls.Vlc/VlcPlayer.xaml.cs | 13 +- Source/Controls/H.Controls.Vlc/VlcSetting.cs | 1 - .../Provider/KeyModifierCollection.cs | 2 +- .../Provider/PropertyChangedEventArgs.cs | 2 +- .../Provider/VisibilityToBoolConverter.cs | 8 +- .../H.Controls.ZoomBox/Zoombox.xaml.cs | 52 +- .../H.Controls.ZoomBox/Zoombox/ZoomboxView.cs | 6 +- .../Zoombox/ZoomboxViewStack.cs | 10 +- .../DataBases/H.DataBases.Share/IDbSetting.cs | 3 - .../H.DataBases.Sqlite/DataContextFactory.cs | 4 - .../H.Data.Test/GetTestViewModelsExtension.cs | 5 - Source/Datas/H.Data.Test/Student.cs | 5 +- .../ApplicationBase.Abstract.cs | 9 +- .../ApplicationBase.cs | 2 +- .../H.Extensions.Attach/Cattach.Animation.cs | 4 +- .../H.Extensions.Attach/Cattach.Attach.cs | 2 +- .../H.Extensions.Attach/Cattach.Caption.cs | 26 +- .../H.Extensions.Attach/Cattach.Check.cs | 30 +- .../H.Extensions.Attach/Cattach.Dock.cs | 10 +- .../H.Extensions.Attach/Cattach.Except.cs | 4 +- .../H.Extensions.Attach/Cattach.Focus.cs | 2 +- .../H.Extensions.Attach/Cattach.Guide.cs | 14 +- .../H.Extensions.Attach/Cattach.Icon.cs | 4 +- .../H.Extensions.Attach/Cattach.Item.cs | 24 +- .../Cattach.ItemsControl.cs | 8 +- .../H.Extensions.Attach/Cattach.NewGuide.cs | 10 +- .../H.Extensions.Attach/Cattach.Search.cs | 18 +- .../H.Extensions.Attach/Cattach.Select.cs | 4 +- .../H.Extensions.Attach/Cattach.Title.cs | 4 +- .../Extensions/H.Extensions.Attach/Cattach.cs | 4 +- .../H.Extensions.BackgroundImage/Class1.cs | 8 +- .../Adorner/Behavior.Adorner.Base.cs | 6 +- .../Behavior.Adorner.HitTest.DragOver.cs | 36 +- .../Behavior.Adorner.HitTest.MouseOver.cs | 16 +- .../Behavior.Adorner.HitTest.Selected.cs | 4 +- .../Adorner/Behavior.Adorner.HitTest.cs | 16 +- .../Adorner/Behavior.Adorner.Loaded.cs | 18 +- .../Adorner/Behavior.Adorner.MouseOver.cs | 24 +- .../Bebavior.ScrollViewer.cs | 2 - .../Bebavior.TextBox.cs | 2 +- .../Behavior.ContextMenu.cs | 2 - .../Behavior.TreeView.cs | 16 +- .../Behavior.TreeViewItem.cs | 8 +- .../DataGrid/DataGridAutoColumnBehavior.cs | 46 +- .../DataGrid/DataGridColumnAttribute.cs | 14 +- .../Behavior.Button.AddItem.Base.cs | 13 +- .../ItemsControl/Behavior.Button.AddItem.cs | 2 +- .../ItemsControl/Behavior.Button.Base.cs | 10 +- .../ItemsControl/Behavior.Button.ClearItem.cs | 4 +- .../Behavior.Button.InsertItem.cs | 2 +- .../Behavior.Button.RemoveCheckedItem.cs | 10 +- .../Behavior.Button.RemoveItem.cs | 6 +- .../Behavior.ItemsControl.Filter.cs | 76 +- .../Behavior.ListBox.BindingSelectedItems.cs | 18 +- .../TextBlockCountBehavior.cs | 10 +- .../Trigger/Action/CallMethodActionEx.cs | 3 - .../Trigger/MousePressClickTrigger.cs | 2 +- .../Trigger/MousePressTrigger.cs | 6 +- .../Trigger/MouseTrigger.cs | 25 +- .../H.Extensions.Color/Extesion.Color.cs | 4 +- .../H.Extensions.Color/HsbaColor.cs | 42 +- .../H.Extensions.Color/RgbaColor.cs | 44 +- .../H.Extensions.Command/Command.Process.cs | 2 +- .../ScrollViewerScrollToBottomCommand.cs | 2 +- .../ScrollViewerScrollToTopCommand.cs | 2 +- .../H.Extensions.Common/Extension.File.cs | 20 +- .../H.Extensions.Common/Extension.Geometry.cs | 8 +- .../H.Extensions.Common/Extension.Object.cs | 1 - .../H.Extensions.Common/Extention.Image.cs | 3 +- .../H.Extensions.Common/TypeJsonConverter.cs | 4 +- .../EncriyptoConverter.cs | 1 - .../H.Extensions.Encryption/Extention.cs | 4 +- .../String/AESExtension.cs | 3 - .../String/Base64Extension.cs | 3 - .../String/DESExtension.cs | 3 - .../String/MD5Extension.cs | 3 - .../String/SHA1Extension.cs | 6 +- .../Extensions/H.Extensions.Excel/Service.cs | 2 - .../H.Extensions.FFMpeg/FFMpegOption.cs | 2 +- .../H.Extensions.FFMpeg/FFMpegService.cs | 1 - .../H.Extensions.Geometry/BeizerExtension.cs | 4 - .../H.Extensions.Geometry/Geometrys.cs | 2 - .../H.Extensions.Mail/MailLogService.cs | 5 +- .../H.Extensions.Mail/MailService.cs | 5 +- .../MarkupExtension.Converter.cs | 4 +- .../MarkupExtension.File.cs | 1 - .../MarkupExtension.GenericType.cs | 2 +- .../MarkupExtension.Object.cs | 2 +- .../MarkupExtension.Random.cs | 4 +- ...ropertyChangedRevertiblePrensenter.xaml.cs | 6 +- .../H.Extensions.Revertible/Revertible.cs | 2 +- .../RevertibleService.cs | 4 +- .../H.Extensions.Setting/Settable.Base.cs | 2 - .../DoubleStoryboard.cs | 20 +- .../EasingFunction/PowerEasingFunction.cs | 2 +- .../StoryboardEngineBase.cs | 10 +- .../H.Extensions.Torrent/Provider/Piece.cs | 8 +- .../H.Extensions.Torrent/Provider/Sha1Hash.cs | 8 +- .../Provider/TorrentFile.cs | 4 +- .../H.Extensions.Torrent/TorrentInfo.xaml.cs | 29 +- .../H.Extensions.Torrent/TorrentService.cs | 3 +- .../ExploreTree.DataProvider.Extension.cs | 4 +- .../H.Extensions.Tree/Demo/ExploreTree.cs | 10 +- .../H.Extensions.Tree/TreeExtension.cs | 3 - .../TreeViewItemLazyLoadBehavior.cs | 2 - .../ObservableCollectionTypeConverter.cs | 4 +- .../PhysicalUnits/LengthUnitable.cs | 2 +- .../PhysicalQuantityUnitableBase.cs | 4 +- .../Provider/AbsoluteTemperature.cs | 31 +- .../PhysicalUnits/Provider/Angle.cs | 8 +- .../PhysicalUnits/Provider/BritishUnits.cs | 814 +- .../PhysicalUnits/Provider/Check.cs | 4 - .../PhysicalUnits/Provider/Dimensionless.cs | 9 +- .../PhysicalUnits/Provider/Dimensions.cs | 17 +- .../Provider/DimensionsStatics.cs | 291 +- .../PhysicalUnits/Provider/Functions.cs | 2 - .../PhysicalUnits/Provider/MetricUnits.cs | 1892 ++- .../Provider/PhysicalQuantity.cs | 15 +- .../PhysicalUnits/Provider/Powers.cs | 9 +- .../PhysicalUnits/Provider/Prefixes.cs | 7 +- .../PhysicalUnits/Provider/Quantities.cs | 12517 ++++++++-------- .../Provider/QuantityWithUnit.cs | 12 +- .../PhysicalUnits/Provider/Shapes.cs | 60 +- .../Provider/TangentialVelocity.cs | 10 +- .../PhysicalUnits/Provider/Time.cs | 5 - .../PhysicalUnits/Provider/TimeUnits.cs | 160 +- .../PhysicalUnits/Provider/USAUnits.cs | 458 +- .../PhysicalUnits/Provider/Unit.cs | 9 +- .../PhysicalUnits/Provider/UnitsSystem.cs | 4 +- .../PhysicalUnits/Provider/VectorOf.cs | 4 +- .../Provider/DoubleUnitableBase.cs | 2 +- .../H.Extensions.Unit/Provider/IUnitable.cs | 4 +- .../Provider/IntUnitableBase.cs | 2 +- .../Provider/LongUnitableBase.cs | 2 +- .../H.Extensions.Unit/TimeUnitable.cs | 5 +- .../ValueConverter/UnitableValueConverter.cs | 4 +- .../UnitableValueConverterBase.cs | 2 +- .../H.Extensions.Unit/WeightUnitable.cs | 3 +- .../ValidationPropertyChangedBase.cs | 4 +- .../RegularExpressionValidationRule.cs | 6 +- .../ValidationRule/RequiredValidationRule.cs | 2 +- .../Bool/Converter.Bool.ToValue.cs | 4 +- .../Brush/Converter.Brush.cs | 2 +- .../H.Extensions.ValueConverter/Converter.cs | 6 +- .../File/Converter.File.cs | 2 +- .../Image/Converter.Image.cs | 1 - .../Image/Converter.cs | 2 +- .../Image/IconHelper.cs | 8 +- .../Int/Converter.String.cs | 20 +- .../Type/Converter.Type.cs | 2 +- .../Visiblility/Converter.Visibility.cs | 8 +- .../Observable/ObservableSource.cs | 2 - .../Repository/IRepositoryBindable.T.cs | 1 - .../Repository/RepositoryBindableBase.cs | 2 +- .../Repository/RepositoryBindableBase1.cs | 5 +- .../SerializeData.cs | 2 +- .../XmlMetaSettingService.cs | 4 +- .../XmlableSerializor.cs | 2 +- .../FeedbackViewPresenter.xaml.cs | 1 - .../Modules/H.Modules.Guide/GuideBox.xaml.cs | 2 +- Source/Modules/H.Modules.Guide/GuideTree.cs | 2 +- .../H.Modules.Identity/AuthoritySetting.cs | 1 - .../Migrations/20240202111856_init1.cs | 4 +- .../Migrations/20240202112908_init2.cs | 4 +- .../Migrations/20240204095504_init3.cs | 4 +- .../Migrations/20240204105610_init4.cs | 4 +- .../Migrations/20240205063120_init5.cs | 4 +- .../H.Modules.Identity/Model/hi_dd_author.cs | 2 +- .../H.Modules.Identity/Model/hi_dd_role.cs | 2 +- .../H.Modules.Identity/Model/hi_dd_user.cs | 6 +- .../H.Modules.Identity/Provider/Role.cs | 6 +- .../H.Modules.Identity/Provider/User.cs | 24 +- .../RoleViewPresenter.xaml.cs | 4 +- .../Service/LoginService.cs | 3 +- .../Service/RegisterService.cs | 1 - .../H.Modules.License/Provider/BigInteger.cs | 58 +- .../Provider/LicenseOption.cs | 2 +- .../H.Modules.License/Provider/RSAHelper.cs | 2 +- .../H.Modules.License/Provider/SystemInfo.cs | 12 +- .../Modules/H.Modules.Login/LoginService.cs | 6 +- .../H.Modules.Login/Provider/MailVerify.cs | 2 +- .../H.Modules.Login/RegisterService.cs | 1 - .../H.Modules.Login/RegistorOptions.cs | 1 - .../RigisterLoginViewPresenter.xaml.cs | 4 +- .../AdonerDialog/AdornerDialog.cs | 4 +- .../Presenters/FatalMessagePresenter.cs | 4 +- .../Presenters/StringMessagePresenter.cs | 2 +- .../Presenters/SuccessMessagePresenter.cs | 4 +- .../Presenters/WarnMessagePresenter.cs | 4 +- .../Presenters/FatalMessagePresenter.cs | 4 +- .../Presenters/StringMessagePresenter.cs | 2 +- .../Presenters/SuccessMessagePresenter.cs | 4 +- .../Presenters/WarnMessagePresenter.cs | 4 +- .../SnackMessageService.cs | 2 +- .../H.Modules.Project/ProjectService.cs | 1 - .../H.Modules.Project/ProjectServiceBase.cs | 2 - .../ProjectViewPresenter.xaml.cs | 2 +- .../H.Modules.Theme/SwitchThemeOptions.cs | 4 +- .../SwitchThemeViewPresenter.xaml.cs | 3 - .../Modules/H.Modules.Theme/ThemeSetting.cs | 2 - .../UpgradePresenter.xaml.cs | 4 +- .../TextBoxPresenter.xaml.cs | 2 +- .../Presenter/CardPresenter.xaml.cs | 39 +- .../Presenter/DataGridDesignPresenter.xaml.cs | 6 +- .../Presenter/DateTimeNowPresenter.xaml.cs | 7 +- .../Presenter/DefinitionGridPresenter.xaml.cs | 1 - .../Presenter/FixedGridPresenter.xaml.cs | 18 +- .../Presenter/GridAreaPresenter.xaml.cs | 4 +- .../Presenter/ImagePresenter.xaml.cs | 12 +- .../Presenter/PropertyGridDesignPresenter.cs | 4 +- .../Presenter/TextBlockPresenter.xaml.cs | 20 +- .../Presenter/TitlePresenter.xaml.cs | 13 +- .../Presenter/UniformGridPresenter.xaml.cs | 4 +- .../Presenter/UserPresenter.xaml.cs | 5 +- .../Provider/ColumnPropertyInfo.cs | 8 +- .../Provider/DataGridPresenterBase.cs | 27 +- .../Provider/DefinitionGrid.xaml.cs | 12 +- .../Provider/DesignPresenter.xaml.cs | 11 +- .../Provider/FixedGrid.xaml.cs | 31 +- .../Provider/GridPresenterBase.cs | 6 +- .../Provider/HexGrid.xaml.cs | 44 +- .../Provider/IDesignPresenter.cs | 4 +- .../Provider/PanelPresenterBase.cs | 11 +- Source/Providers/H.Providers.Ioc/Ioc/DbIoc.cs | 4 +- Source/Providers/H.Providers.Ioc/Ioc/Ioc.cs | 2 +- .../H.Providers.Ioc/Login/IRegisterService.cs | 2 +- .../H.Providers.Ioc/Mail/MailMessageItem.cs | 8 +- .../Message/Dialog/Commands/Command.Base.cs | 4 +- .../Message/Dialog/Commands/Command.Show.cs | 4 +- .../Dialog/Commands/Command.ShowEdit.cs | 2 +- .../Dialog/Commands/Command.ShowIoc.cs | 4 +- .../Dialog/Commands/Command.ShowMessage.cs | 4 +- .../Dialog/Commands/Command.ShowString.cs | 2 +- .../Dialog/Commands/Command.ShowView.cs | 2 +- .../Message/Dialog/IDialogMessageService.cs | 1 - .../Project/ProjectSaveMode.cs | 2 +- .../Serialize/IJsonSerializerService.cs | 6 +- .../Serialize/JsonSerializerService.cs | 6 +- .../Serialize/Web/IocXmlWebSerializer.cs | 1 - .../H.Providers.Ioc/Setting/AppPaths.cs | 60 +- .../Setting/SettingDataManager.cs | 2 +- .../H.Providers.Ioc/Where/IDisplayFilter.cs | 2 +- .../Commands/InvokeCommand.cs | 1 - .../H.Providers.Mvvm/Commands/RelayCommand.cs | 12 +- .../H.Providers.Mvvm/RoutedEventArgs.cs | 4 +- .../H.Providers.Mvvm/ViewModels/Bindable.cs | 4 +- .../ViewModels/DisplayBindable.cs | 2 +- .../ViewModels/DisplayBindableBase.cs | 18 +- .../ViewModels/ModelBindable.cs | 12 +- .../ViewModels/Tree/TreeNodeBase.cs | 58 +- .../Commands/WindowCommand.Close.cs | 1 - .../Commands/WindowCommand.CloseAfterSave.cs | 1 - .../H.Styles.Default/Controls/Border.xaml.cs | 5 - .../Controls/GridView.xaml.cs | 7 +- .../H.Styles.Default/Controls/Window.xaml.cs | 1 - .../H.Styles.Default/LogoMarkupExtension.cs | 2 +- .../Colors/DarkColorResource.cs | 2 +- .../Colors/DefaultColorResource.cs | 2 +- .../Colors/LightColorResource.cs | 2 +- .../H.Windows.Dialog/DialogWindow.xaml.cs | 5 +- .../Windows/H.Windows.Dock/DockWindow.xaml.cs | 7 +- Source/Windows/H.Windows.Dock/Extension.cs | 10 +- .../H.Windows.Dock/ShowDockWindowCommand.cs | 2 +- .../Windows/H.Windows.Main/MainWindow.xaml.cs | 6 +- .../ViewModels/ContextualTabGroupBindable.cs | 2 +- .../ViewModels/ControlBindableBase.cs | 6 +- .../H.Windows.Ribbon/ViewModels/QATItem.cs | 4 +- .../ViewModels/RibbonBindable.cs | 1 - .../ViewModels/TabBindable.cs | 3 +- 575 files changed, 11760 insertions(+), 12173 deletions(-) diff --git a/.editorconfig b/.editorconfig index 3744ec3b..7f2e6d00 100644 --- a/.editorconfig +++ b/.editorconfig @@ -146,7 +146,7 @@ dotnet_naming_style. [*.{cs,vb}] end_of_line = crlf dotnet_style_qualification_for_field = true:silent -dotnet_style_qualification_for_property = true:silent +dotnet_style_qualification_for_property = true:error dotnet_style_qualification_for_method = true:silent dotnet_style_qualification_for_event = true:silent dotnet_style_require_accessibility_modifiers = for_non_interface_members:silent @@ -163,7 +163,7 @@ dotnet_style_null_propagation = true:suggestion dotnet_style_prefer_is_null_check_over_reference_equality_method = true:suggestion dotnet_style_prefer_auto_properties = true:silent dotnet_style_object_initializer = true:suggestion -dotnet_style_prefer_collection_expression = true:suggestion +dotnet_style_prefer_collection_expression = when_types_exactly_match:suggestion dotnet_style_collection_initializer = true:suggestion dotnet_style_prefer_simplified_boolean_expressions = true:suggestion dotnet_style_prefer_conditional_expression_over_assignment = true:silent diff --git a/Directory.Build.Props b/Directory.Build.Props index 438ab0fe..37dccf99 100644 --- a/Directory.Build.Props +++ b/Directory.Build.Props @@ -7,7 +7,7 @@ MIT net7.0-windows False - 9.0 + 10.0 1.0.0 1.0.0 1.0.0 diff --git a/Solution/WPF-Control.sln b/Solution/WPF-Control.sln index 6b4c2a5f..28e22e79 100644 --- a/Solution/WPF-Control.sln +++ b/Solution/WPF-Control.sln @@ -277,7 +277,7 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "H.Modules.Feedback", "..\So EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "H.Controls.FilterColumnDataGrid", "..\Source\Controls\H.Controls.FilterColumnDataGrid\H.Controls.FilterColumnDataGrid.csproj", "{F735E512-F64E-472E-B154-2FBA0931E2AD}" EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = ".sln", ".sln", "{FE1482B2-8EA3-4094-88DE-BF3CCD91F9A8}" +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = ".sln", ".sln", "{45238888-7B45-4268-A751-3D87C759D70F}" ProjectSection(SolutionItems) = preProject ..\.editorconfig = ..\.editorconfig ..\Directory.Build.Props = ..\Directory.Build.Props diff --git a/Source/App/H.App.FileManager/App.xaml.cs b/Source/App/H.App.FileManager/App.xaml.cs index 3ccbef35..b21b1818 100644 --- a/Source/App/H.App.FileManager/App.xaml.cs +++ b/Source/App/H.App.FileManager/App.xaml.cs @@ -1,15 +1,14 @@ using H.Controls.FavoriteBox; using H.Controls.TagBox; +using H.DataBases.Share; using H.Extensions.ApplicationBase; +using H.Modules.Identity; +using H.Modules.Operation; using H.Providers.Ioc; using Microsoft.Extensions.DependencyInjection; using System; using System.Windows; using System.Windows.Media; -using System.Text.Json; -using H.Modules.Identity; -using H.DataBases.Share; -using H.Modules.Operation; namespace H.App.FileManager { @@ -70,12 +69,12 @@ protected override void ConfigureServices(IServiceCollection services) services.AddSetting(); services.AddAppService(); services.AddTorrent(); - services.AddFFMpeg(x=> + services.AddFFMpeg(x => { x.WorkingDirectory = "D:\\ffmpeg"; }); - services.AddSingleton(); + services.AddSingleton(); // Do :身份认证 diff --git a/Source/App/H.App.FileManager/Converter/GetFileMenuItemConverter.cs b/Source/App/H.App.FileManager/Converter/GetFileMenuItemConverter.cs index b0259855..34363be7 100644 --- a/Source/App/H.App.FileManager/Converter/GetFileMenuItemConverter.cs +++ b/Source/App/H.App.FileManager/Converter/GetFileMenuItemConverter.cs @@ -48,7 +48,7 @@ public List> GetFileCommands(fm_dd_file file) }) { Name = "喜欢" }) { IsCheckable = true, IsChecked = file.Favorite }; - if (FileProjectItem.Setting.UseFavorite) + if (this.FileProjectItem.Setting.UseFavorite) result.Add(favorite); } @@ -61,12 +61,12 @@ public List> GetFileCommands(fm_dd_file file) }) { Name = "稍后观看" }) { IsCheckable = true, IsChecked = file.SeeLater }; - if (FileProjectItem.Setting.UseSeeLater) + if (this.FileProjectItem.Setting.UseSeeLater) result.Add(later); } TreeNodeBase scoreNode = new TreeNodeBase(new DisplayCommand(x => file.Score = 9) { Name = $"评分" }); - if (FileProjectItem.Setting.UseScore) + if (this.FileProjectItem.Setting.UseScore) result.Add(scoreNode); foreach (int item in Enumerable.Range(0, 11).Reverse()) @@ -125,7 +125,7 @@ public List> GetImageCommands(fm_dd_image file) { { TreeNodeBase tagNode = new TreeNodeBase(new DisplayCommand(x => { }) { Name = "对象" }); - if (FileProjectItem.Setting.UseObjectTag) + if (this.FileProjectItem.Setting.UseObjectTag) result.Add(tagNode); { IEnumerable tags = tagService.Collection.Where(x => x.GroupName == "Object"); @@ -154,7 +154,7 @@ public List> GetImageCommands(fm_dd_image file) { TreeNodeBase tagNode = new TreeNodeBase(new DisplayCommand(x => { }) { Name = "国家" }); - if (FileProjectItem.Setting.UseAreaTag) + if (this.FileProjectItem.Setting.UseAreaTag) result.Add(tagNode); { IEnumerable tags = tagService.Collection.Where(x => x.GroupName == "Area"); @@ -183,7 +183,7 @@ public List> GetImageCommands(fm_dd_image file) { TreeNodeBase tagNode = new TreeNodeBase(new DisplayCommand(x => { }) { Name = "清晰度" }); - if (FileProjectItem.Setting.UseArticulationTag) + if (this.FileProjectItem.Setting.UseArticulationTag) result.Add(tagNode); { IEnumerable tags = tagService.Collection.Where(x => x.GroupName == "Articulation"); diff --git a/Source/App/H.App.FileManager/DataBase/Model/fm_dd_image.cs b/Source/App/H.App.FileManager/DataBase/Model/fm_dd_image.cs index 7a87fa11..43e8a0aa 100644 --- a/Source/App/H.App.FileManager/DataBase/Model/fm_dd_image.cs +++ b/Source/App/H.App.FileManager/DataBase/Model/fm_dd_image.cs @@ -64,7 +64,7 @@ public string Articulation /// 宽高比 1920x1080 [Display(Name = "宽高比")] [NotMapped] - public string Aspect => $"{PixelWidth}x{PixelHeight}"; + public string Aspect => $"{this.PixelWidth}x{this.PixelHeight}"; } } diff --git a/Source/App/H.App.FileManager/Extention.cs b/Source/App/H.App.FileManager/Extention.cs index 8444f83c..d9696f37 100644 --- a/Source/App/H.App.FileManager/Extention.cs +++ b/Source/App/H.App.FileManager/Extention.cs @@ -3,10 +3,6 @@ using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.DependencyInjection.Extensions; using System.Collections.Generic; -using System.Collections.ObjectModel; -using System; -using System.Linq; -using System.IO; namespace H.App.FileManager { diff --git a/Source/App/H.App.FileManager/Presenter/FileView.xaml.cs b/Source/App/H.App.FileManager/Presenter/FileView.xaml.cs index 01bd4ce1..5d3b19e0 100644 --- a/Source/App/H.App.FileManager/Presenter/FileView.xaml.cs +++ b/Source/App/H.App.FileManager/Presenter/FileView.xaml.cs @@ -1,6 +1,4 @@ -using H.Extensions.Torrent; -using H.Providers.Mvvm; -using System; +using System; using System.ComponentModel.DataAnnotations; using System.IO; diff --git a/Source/App/H.App.FileManager/Presenter/ImageView.xaml.cs b/Source/App/H.App.FileManager/Presenter/ImageView.xaml.cs index 82d999b8..86e00c87 100644 --- a/Source/App/H.App.FileManager/Presenter/ImageView.xaml.cs +++ b/Source/App/H.App.FileManager/Presenter/ImageView.xaml.cs @@ -1,6 +1,4 @@ -using H.Providers.Mvvm; - -namespace H.App.FileManager +namespace H.App.FileManager { diff --git a/Source/App/H.App.FileManager/Presenter/MoreFileViewBase.xaml.cs b/Source/App/H.App.FileManager/Presenter/MoreFileViewBase.xaml.cs index cdc0db2b..8f91243a 100644 --- a/Source/App/H.App.FileManager/Presenter/MoreFileViewBase.xaml.cs +++ b/Source/App/H.App.FileManager/Presenter/MoreFileViewBase.xaml.cs @@ -74,7 +74,7 @@ protected virtual IEnumerable CreateMore() } { - IEnumerable finds = files.Where(x => Path.GetDirectoryName(x.Url) == Path.GetDirectoryName(t.Url) && x.Url != t.Url).OrderBy(x=> + IEnumerable finds = files.Where(x => Path.GetDirectoryName(x.Url) == Path.GetDirectoryName(t.Url) && x.Url != t.Url).OrderBy(x => { if (x.Name == this.Model.Name) return -1; diff --git a/Source/App/H.App.FileManager/Presenter/TorrentView.xaml.cs b/Source/App/H.App.FileManager/Presenter/TorrentView.xaml.cs index 34255788..455fe051 100644 --- a/Source/App/H.App.FileManager/Presenter/TorrentView.xaml.cs +++ b/Source/App/H.App.FileManager/Presenter/TorrentView.xaml.cs @@ -1,5 +1,4 @@ using H.Extensions.Torrent; -using H.Providers.Mvvm; namespace H.App.FileManager { diff --git a/Source/App/H.App.FileManager/Presenter/VideoView.xaml.cs b/Source/App/H.App.FileManager/Presenter/VideoView.xaml.cs index dbe2c270..1192d527 100644 --- a/Source/App/H.App.FileManager/Presenter/VideoView.xaml.cs +++ b/Source/App/H.App.FileManager/Presenter/VideoView.xaml.cs @@ -1,10 +1,5 @@ - -using H.Controls.TagBox; -using H.Providers.Ioc; -using H.Providers.Mvvm; +using H.Providers.Mvvm; using System; -using System.Collections.Generic; -using System.Collections.ObjectModel; using System.IO; using System.Linq; @@ -14,7 +9,7 @@ namespace H.App.FileManager //{ // public MoreVideoView(fm_dd_video t) : base(t) // { - + // //List moreVideos = new List(); // //this.SelectedItem = new VideoView(t); // //moreVideos.Add(this.SelectedItem); diff --git a/Source/App/H.App.FileManager/Project/FileProjectItem.xaml.cs b/Source/App/H.App.FileManager/Project/FileProjectItem.xaml.cs index 7aac2d41..2a4a3ce6 100644 --- a/Source/App/H.App.FileManager/Project/FileProjectItem.xaml.cs +++ b/Source/App/H.App.FileManager/Project/FileProjectItem.xaml.cs @@ -6,7 +6,6 @@ using H.Controls.TagBox; using H.DataBases.Share; using H.Extensions.ViewModel; -using H.Modules.Login; using H.Modules.Project; using H.Providers.Ioc; using Microsoft.EntityFrameworkCore; @@ -87,8 +86,8 @@ public override bool Load(out string message) DataContext find = DbIoc.Services.GetService(); find.Database.Migrate(); // Do :刷新数据 - File = DbIoc.GetService>(); - File.RefreshData(); + this.File = DbIoc.GetService>(); + this.File.RefreshData(); IocTagService.Instance.Load(out message); IocFavoriteService.Instance.Load(out message); SettingDataManager.Instance.Add(this.Setting); @@ -97,7 +96,7 @@ public override bool Load(out string message) public override bool Save(out string message) { - File?.Save(); + this.File?.Save(); DataContext context = DbIoc.Services.GetService(); context?.SaveChanges(); //context?.Dispose(); diff --git a/Source/App/H.App.FileManager/Provider/Filter/FavoriteFileFilter.cs b/Source/App/H.App.FileManager/Provider/Filter/FavoriteFileFilter.cs index 140e924e..f60f8e39 100644 --- a/Source/App/H.App.FileManager/Provider/Filter/FavoriteFileFilter.cs +++ b/Source/App/H.App.FileManager/Provider/Filter/FavoriteFileFilter.cs @@ -1,6 +1,5 @@ using H.Controls.FilterBox; using H.Providers.Mvvm; -using System.ComponentModel.DataAnnotations; namespace H.App.FileManager { @@ -11,7 +10,7 @@ public override bool IsMatch(object obj) { if (obj is ModelBindable file) { - return file.Model.Favorite == Value; + return file.Model.Favorite == this.Value; } return false; } diff --git a/Source/App/H.App.FileManager/Provider/Filter/FileFilter.cs b/Source/App/H.App.FileManager/Provider/Filter/FileFilter.cs index ede3afde..3ef6dc74 100644 --- a/Source/App/H.App.FileManager/Provider/Filter/FileFilter.cs +++ b/Source/App/H.App.FileManager/Provider/Filter/FileFilter.cs @@ -14,7 +14,7 @@ public override bool IsMatch(object obj) { if (obj is ModelBindable file) { - return Extensions.Split(' ').Any(x => x.Equals(file.Model.Extend?.Trim('.'), StringComparison.OrdinalIgnoreCase)); + return this.Extensions.Split(' ').Any(x => x.Equals(file.Model.Extend?.Trim('.'), StringComparison.OrdinalIgnoreCase)); } return false; } diff --git a/Source/App/H.App.FileManager/Provider/Filter/ScoreFileFilter.cs b/Source/App/H.App.FileManager/Provider/Filter/ScoreFileFilter.cs index 7ce8bc45..dc13cff6 100644 --- a/Source/App/H.App.FileManager/Provider/Filter/ScoreFileFilter.cs +++ b/Source/App/H.App.FileManager/Provider/Filter/ScoreFileFilter.cs @@ -12,7 +12,7 @@ public override bool IsMatch(object obj) { if (obj is ModelBindable file) { - return file.Model.Score == Value; + return file.Model.Score == this.Value; } return false; } diff --git a/Source/App/H.App.FileManager/Provider/Filter/SeeLaterFileFilter.cs b/Source/App/H.App.FileManager/Provider/Filter/SeeLaterFileFilter.cs index 7952b711..35f14c85 100644 --- a/Source/App/H.App.FileManager/Provider/Filter/SeeLaterFileFilter.cs +++ b/Source/App/H.App.FileManager/Provider/Filter/SeeLaterFileFilter.cs @@ -10,7 +10,7 @@ public override bool IsMatch(object obj) { if (obj is ModelBindable file) { - return file.Model.SeeLater == Value; + return file.Model.SeeLater == this.Value; } return false; } diff --git a/Source/App/H.App.FileManager/Provider/Filter/WatchedFileFilter.cs b/Source/App/H.App.FileManager/Provider/Filter/WatchedFileFilter.cs index 7153f672..0bc48d38 100644 --- a/Source/App/H.App.FileManager/Provider/Filter/WatchedFileFilter.cs +++ b/Source/App/H.App.FileManager/Provider/Filter/WatchedFileFilter.cs @@ -12,7 +12,7 @@ public override bool IsMatch(object obj) { if (obj is ModelBindable file) { - return file.Model.Watched == Value; + return file.Model.Watched == this.Value; } return false; } diff --git a/Source/App/H.App.FileManager/Provider/Order/FileOrderByAccessTime.cs b/Source/App/H.App.FileManager/Provider/Order/FileOrderByAccessTime.cs index e6eb93b7..d6c45f95 100644 --- a/Source/App/H.App.FileManager/Provider/Order/FileOrderByAccessTime.cs +++ b/Source/App/H.App.FileManager/Provider/Order/FileOrderByAccessTime.cs @@ -4,7 +4,6 @@ using System; using System.Collections; using System.ComponentModel.DataAnnotations; -using System.IO; using System.Linq; namespace H.App.FileManager diff --git a/Source/App/H.App.FileManager/Service/FileToMoreViewService.cs b/Source/App/H.App.FileManager/Service/FileToMoreViewService.cs index cd684039..9df3294f 100644 --- a/Source/App/H.App.FileManager/Service/FileToMoreViewService.cs +++ b/Source/App/H.App.FileManager/Service/FileToMoreViewService.cs @@ -1,6 +1,4 @@ -using H.Extensions.Torrent; - -namespace H.App.FileManager +namespace H.App.FileManager { public class FileToMoreViewService : IFileToMoreViewService { diff --git a/Source/App/H.App.FileManager/Service/FileToViewService.cs b/Source/App/H.App.FileManager/Service/FileToViewService.cs index 30b1a7c0..5780b56e 100644 --- a/Source/App/H.App.FileManager/Service/FileToViewService.cs +++ b/Source/App/H.App.FileManager/Service/FileToViewService.cs @@ -1,6 +1,4 @@ -using H.Extensions.Torrent; - -namespace H.App.FileManager +namespace H.App.FileManager { public class FileToViewService : IFileToViewService { diff --git a/Source/App/H.App.FileManager/Service/ProjectFavoriteService.cs b/Source/App/H.App.FileManager/Service/ProjectFavoriteService.cs index 939b9cd6..0e95dacb 100644 --- a/Source/App/H.App.FileManager/Service/ProjectFavoriteService.cs +++ b/Source/App/H.App.FileManager/Service/ProjectFavoriteService.cs @@ -1,5 +1,4 @@ using H.Controls.FavoriteBox; -using H.Controls.TagBox; using H.Providers.Ioc; using Microsoft.Extensions.Options; using System.Collections.Generic; diff --git a/Source/App/H.App.FileManager/ViewModel/FileRepositoryBindable.xaml.cs b/Source/App/H.App.FileManager/ViewModel/FileRepositoryBindable.xaml.cs index 82b16d80..7a14626d 100644 --- a/Source/App/H.App.FileManager/ViewModel/FileRepositoryBindable.xaml.cs +++ b/Source/App/H.App.FileManager/ViewModel/FileRepositoryBindable.xaml.cs @@ -1,5 +1,4 @@ -using H.Controls.PropertyGrid; -using H.Controls.TagBox; +using H.Controls.TagBox; using H.Extensions.Common; using H.Extensions.FFMpeg; using H.Extensions.ViewModel; @@ -14,7 +13,6 @@ using System.IO; using System.Linq; using System.Text.Json.Serialization; -using System.Threading; using System.Windows; using System.Xml.Serialization; @@ -38,9 +36,9 @@ public FileRepositoryBindable() public override void RefreshData(params string[] includes) { includes = includes ?? GetIncludes()?.ToArray(); - IEnumerable> collection = includes == null ? Repository.GetList().Select(x => new SelectBindable(x)) - : Repository.GetList(includes).Select(x => new SelectBindable(x)); - Collection.Load(collection); + IEnumerable> collection = includes == null ? this.Repository.GetList().Select(x => new SelectBindable(x)) + : this.Repository.GetList(includes).Select(x => new SelectBindable(x)); + this.Collection.Load(collection); } private ObservableCollection _hisotry = new ObservableCollection(); diff --git a/Source/Controls/H.Controls.Adorner/Adorner/AdornerBase.cs b/Source/Controls/H.Controls.Adorner/Adorner/AdornerBase.cs index a7b77f7a..0a3c0f9d 100644 --- a/Source/Controls/H.Controls.Adorner/Adorner/AdornerBase.cs +++ b/Source/Controls/H.Controls.Adorner/Adorner/AdornerBase.cs @@ -22,7 +22,7 @@ public static void SetPen(DependencyObject obj, Pen value) obj.SetValue(PenProperty, value); } - + public static readonly DependencyProperty PenProperty = DependencyProperty.RegisterAttached("Pen", typeof(Pen), typeof(AdornerBase), new PropertyMetadata(new Pen(Brushes.DeepSkyBlue, 1), OnPenChanged)); @@ -46,7 +46,7 @@ public static void SetFill(DependencyObject obj, Brush value) obj.SetValue(FillProperty, value); } - + public static readonly DependencyProperty FillProperty = DependencyProperty.RegisterAttached("Fill", typeof(Brush), typeof(AdornerBase), new PropertyMetadata(default(Brush), OnFillChanged)); diff --git a/Source/Controls/H.Controls.Adorner/Adorner/BorderAdorner.cs b/Source/Controls/H.Controls.Adorner/Adorner/BorderAdorner.cs index ea63b1a7..099fd029 100644 --- a/Source/Controls/H.Controls.Adorner/Adorner/BorderAdorner.cs +++ b/Source/Controls/H.Controls.Adorner/Adorner/BorderAdorner.cs @@ -19,7 +19,7 @@ public BorderAdorner(UIElement adornedElement) : base(adornedElement) protected override void OnRender(DrawingContext dc) { Rect rect = new Rect(this.AdornedElement.RenderSize); - dc.DrawRectangle(this.Fill, this.Pen, new Rect(rect.Left - ScaleLen, rect.Top - ScaleLen, rect.Width + (2 * ScaleLen), rect.Height + (2 * ScaleLen))); + dc.DrawRectangle(this.Fill, this.Pen, new Rect(rect.Left - this.ScaleLen, rect.Top - this.ScaleLen, rect.Width + (2 * this.ScaleLen), rect.Height + (2 * this.ScaleLen))); } } } diff --git a/Source/Controls/H.Controls.Adorner/Adorner/ControlTemplateAdorner.xaml.cs b/Source/Controls/H.Controls.Adorner/Adorner/ControlTemplateAdorner.xaml.cs index b497bff4..0805d080 100644 --- a/Source/Controls/H.Controls.Adorner/Adorner/ControlTemplateAdorner.xaml.cs +++ b/Source/Controls/H.Controls.Adorner/Adorner/ControlTemplateAdorner.xaml.cs @@ -21,13 +21,13 @@ static ControlTemplateAdorner() public ControlTemplateAdorner(UIElement adornedElement) : base(adornedElement) { //visualCollection = new VisualCollection(this); - _contentControl.HorizontalAlignment = HorizontalAlignment.Stretch; - _contentControl.VerticalAlignment = VerticalAlignment.Stretch; - _contentControl.HorizontalContentAlignment = HorizontalAlignment.Stretch; - _contentControl.VerticalContentAlignment = VerticalAlignment.Stretch; - _visualCollection.Add(_contentControl); - _contentControl.Template = this.CreateTemplate(); - _contentControl.Content = adornedElement.GetContent(); + this._contentControl.HorizontalAlignment = HorizontalAlignment.Stretch; + this._contentControl.VerticalAlignment = VerticalAlignment.Stretch; + this._contentControl.HorizontalContentAlignment = HorizontalAlignment.Stretch; + this._contentControl.VerticalContentAlignment = VerticalAlignment.Stretch; + _visualCollection.Add(this._contentControl); + this._contentControl.Template = this.CreateTemplate(); + this._contentControl.Content = adornedElement.GetContent(); } protected virtual ControlTemplate CreateTemplate() diff --git a/Source/Controls/H.Controls.Adorner/Adorner/DataTemplateAdorner.xaml.cs b/Source/Controls/H.Controls.Adorner/Adorner/DataTemplateAdorner.xaml.cs index 35812200..c2e543ee 100644 --- a/Source/Controls/H.Controls.Adorner/Adorner/DataTemplateAdorner.xaml.cs +++ b/Source/Controls/H.Controls.Adorner/Adorner/DataTemplateAdorner.xaml.cs @@ -64,7 +64,7 @@ public static void SetData(DependencyObject obj, object value) obj.SetValue(DataProperty, value); } - + public static readonly DependencyProperty DataProperty = DependencyProperty.RegisterAttached("Data", typeof(object), typeof(DataTemplateAdorner), new PropertyMetadata(default(object), OnDataChanged)); diff --git a/Source/Controls/H.Controls.Adorner/Adorner/DragAdorner.cs b/Source/Controls/H.Controls.Adorner/Adorner/DragAdorner.cs index 24725e8b..671da235 100644 --- a/Source/Controls/H.Controls.Adorner/Adorner/DragAdorner.cs +++ b/Source/Controls/H.Controls.Adorner/Adorner/DragAdorner.cs @@ -20,7 +20,7 @@ public class DragAdorner : AdornerBase, IDragAdorner public DragAdorner(UIElement adornedElement, Point offset) : base(adornedElement) { this.Offset = offset; - vbrush = new VisualBrush(AdornedElement); + vbrush = new VisualBrush(this.AdornedElement); vbrush.Opacity = AdornerSetting.Instance.DragAornerOpacity; } @@ -36,16 +36,16 @@ protected override void OnRender(DrawingContext dc) if (this.DropAdornerMode == DrapAdornerMode.OnlyY) { p = new Point(0, p.Y); - p.Offset(0, -Offset.Y); + p.Offset(0, -this.Offset.Y); } else if (this.DropAdornerMode == DrapAdornerMode.OnlyX) { p = new Point(p.X, 0); - p.Offset(-Offset.X, 0); + p.Offset(-this.Offset.X, 0); } else { - p.Offset(-Offset.X, -Offset.Y); + p.Offset(-this.Offset.X, -this.Offset.Y); } dc.DrawRectangle(vbrush, null, new Rect(p, this.RenderSize)); diff --git a/Source/Controls/H.Controls.Adorner/Adorner/LineAdorner.cs b/Source/Controls/H.Controls.Adorner/Adorner/LineAdorner.cs index 71b95ebc..1ca61d5b 100644 --- a/Source/Controls/H.Controls.Adorner/Adorner/LineAdorner.cs +++ b/Source/Controls/H.Controls.Adorner/Adorner/LineAdorner.cs @@ -20,22 +20,22 @@ public LineAdorner(UIElement adornedElement) : base(adornedElement) protected override void OnRender(DrawingContext dc) { Rect rect = new Rect(this.AdornedElement.RenderSize); - rect = new Rect(rect.Left - ScaleLen, rect.Top - ScaleLen, rect.Width + (2 * ScaleLen), rect.Height + (2 * ScaleLen)); + rect = new Rect(rect.Left - this.ScaleLen, rect.Top - this.ScaleLen, rect.Width + (2 * this.ScaleLen), rect.Height + (2 * this.ScaleLen)); dc.DrawRectangle(this.Fill, null, rect); - if (Dock == Dock.Left) + if (this.Dock == Dock.Left) { dc.DrawLine(this.Pen, rect.TopLeft, rect.BottomLeft); } - if (Dock == Dock.Top) + if (this.Dock == Dock.Top) { dc.DrawLine(this.Pen, rect.TopLeft, rect.TopRight); } - if (Dock == Dock.Right) + if (this.Dock == Dock.Right) { dc.DrawLine(this.Pen, rect.BottomRight, rect.TopRight); } - if (Dock == Dock.Bottom) + if (this.Dock == Dock.Bottom) { dc.DrawLine(this.Pen, rect.BottomLeft, rect.BottomRight); } diff --git a/Source/Controls/H.Controls.Adorner/Adorner/ResizeAdorner.xaml.cs b/Source/Controls/H.Controls.Adorner/Adorner/ResizeAdorner.xaml.cs index 81184a54..e00fff04 100644 --- a/Source/Controls/H.Controls.Adorner/Adorner/ResizeAdorner.xaml.cs +++ b/Source/Controls/H.Controls.Adorner/Adorner/ResizeAdorner.xaml.cs @@ -37,7 +37,7 @@ public ResizeAdorner(UIElement adornedElement) : base(adornedElement) if (thumb != null) thumb.DragDelta += (s, e) => { - FrameworkElement element = AdornedElement as FrameworkElement; + FrameworkElement element = this.AdornedElement as FrameworkElement; if (element == null) return; this.DragMoveHorizontal(e.HorizontalChange); @@ -100,7 +100,7 @@ private void Thumb_DragDelta(object sender, DragDeltaEventArgs e) double ElementMiniSize = thumb.DesiredSize.Width; - FrameworkElement element = AdornedElement as FrameworkElement; + FrameworkElement element = this.AdornedElement as FrameworkElement; if (element == null) return; Resize(element); @@ -189,13 +189,13 @@ protected virtual void DragMoveVertical(double change) public double MinValue { get; set; } = 10; protected virtual void SetHeight(double change) { - FrameworkElement element = AdornedElement as FrameworkElement; - element.Height = Math.Max(MinValue, element.Height + change); + FrameworkElement element = this.AdornedElement as FrameworkElement; + element.Height = Math.Max(this.MinValue, element.Height + change); } protected virtual void SetWidth(double change) { - FrameworkElement element = AdornedElement as FrameworkElement; - element.Width = Math.Max(MinValue, element.Width + change); + FrameworkElement element = this.AdornedElement as FrameworkElement; + element.Width = Math.Max(this.MinValue, element.Width + change); } private void Resize(FrameworkElement fElement) diff --git a/Source/Controls/H.Controls.Adorner/Adorner/SelectedControlTemplateAdorner.cs b/Source/Controls/H.Controls.Adorner/Adorner/SelectedControlTemplateAdorner.cs index f43fe39e..c26e2fb0 100644 --- a/Source/Controls/H.Controls.Adorner/Adorner/SelectedControlTemplateAdorner.cs +++ b/Source/Controls/H.Controls.Adorner/Adorner/SelectedControlTemplateAdorner.cs @@ -22,7 +22,7 @@ protected override void OnRender(DrawingContext drawingContext) base.OnRender(drawingContext); Rect rect = new Rect(this.AdornedElement.RenderSize); - drawingContext.DrawRectangle(this.Fill, this.Pen, new Rect(rect.Left - ScaleLen, rect.Top - ScaleLen, rect.Width + (2 * ScaleLen), rect.Height + (2 * ScaleLen))); + drawingContext.DrawRectangle(this.Fill, this.Pen, new Rect(rect.Left - this.ScaleLen, rect.Top - this.ScaleLen, rect.Width + (2 * this.ScaleLen), rect.Height + (2 * this.ScaleLen))); } } } diff --git a/Source/Controls/H.Controls.Adorner/Service/Bevhavior/DrapAdornerBehavior.cs b/Source/Controls/H.Controls.Adorner/Service/Bevhavior/DrapAdornerBehavior.cs index 87996b3d..2ca7b296 100644 --- a/Source/Controls/H.Controls.Adorner/Service/Bevhavior/DrapAdornerBehavior.cs +++ b/Source/Controls/H.Controls.Adorner/Service/Bevhavior/DrapAdornerBehavior.cs @@ -28,7 +28,7 @@ public double Opacity set { SetValue(OpacityProperty, value); } } - + public static readonly DependencyProperty OpacityProperty = DependencyProperty.Register("Opacity", typeof(double), typeof(DragAdornerBehavior), new PropertyMetadata(0.5, (d, e) => { @@ -47,7 +47,7 @@ public Type AncestorType set { SetValue(AncestorTypeProperty, value); } } - + public static readonly DependencyProperty AncestorTypeProperty = DependencyProperty.Register("AncestorType", typeof(Type), typeof(DragAdornerBehavior), new PropertyMetadata(typeof(ScrollViewer), (d, e) => { @@ -65,7 +65,7 @@ public string DragGroup set { SetValue(DragGroupProperty, value); } } - + public static readonly DependencyProperty DragGroupProperty = DependencyProperty.Register("DragGroup", typeof(string), typeof(DragAdornerBehavior), new PropertyMetadata("DragGroup", (d, e) => { @@ -84,7 +84,7 @@ public DragDropEffects DragDropEffects set { SetValue(DragDropEffectsProperty, value); } } - + public static readonly DependencyProperty DragDropEffectsProperty = DependencyProperty.Register("DragDropEffects", typeof(DragDropEffects), typeof(DragAdornerBehavior), new PropertyMetadata(DragDropEffects.Copy, (d, e) => { @@ -102,39 +102,39 @@ public DragDropEffects DragDropEffects protected override void OnAttached() { - AssociatedObject.AllowDrop = true; - if (RoutingStrategy == RoutingStrategy.Bubble) + this.AssociatedObject.AllowDrop = true; + if (this.RoutingStrategy == RoutingStrategy.Bubble) { - AssociatedObject.PreviewMouseDown += AssociatedObject_MouseDown; - AssociatedObject.PreviewMouseUp += AssociatedObject_MouseUp; - AssociatedObject.PreviewMouseMove += AssociatedObject_MouseMove; + this.AssociatedObject.PreviewMouseDown += AssociatedObject_MouseDown; + this.AssociatedObject.PreviewMouseUp += AssociatedObject_MouseUp; + this.AssociatedObject.PreviewMouseMove += AssociatedObject_MouseMove; } else { - AssociatedObject.MouseDown += AssociatedObject_MouseDown; - AssociatedObject.MouseUp += AssociatedObject_MouseUp; - AssociatedObject.MouseMove += AssociatedObject_MouseMove; + this.AssociatedObject.MouseDown += AssociatedObject_MouseDown; + this.AssociatedObject.MouseUp += AssociatedObject_MouseUp; + this.AssociatedObject.MouseMove += AssociatedObject_MouseMove; } - AssociatedObject.MouseLeave += AssociatedObject_MouseLeave; - AssociatedObject.GiveFeedback += AssociatedObject_GiveFeedback; + this.AssociatedObject.MouseLeave += AssociatedObject_MouseLeave; + this.AssociatedObject.GiveFeedback += AssociatedObject_GiveFeedback; } protected override void OnDetaching() { - AssociatedObject.AllowDrop = false; + this.AssociatedObject.AllowDrop = false; - AssociatedObject.PreviewMouseDown -= AssociatedObject_MouseDown; - AssociatedObject.PreviewMouseUp -= AssociatedObject_MouseUp; - AssociatedObject.PreviewMouseMove -= AssociatedObject_MouseMove; + this.AssociatedObject.PreviewMouseDown -= AssociatedObject_MouseDown; + this.AssociatedObject.PreviewMouseUp -= AssociatedObject_MouseUp; + this.AssociatedObject.PreviewMouseMove -= AssociatedObject_MouseMove; - AssociatedObject.MouseDown -= AssociatedObject_MouseDown; - AssociatedObject.MouseUp -= AssociatedObject_MouseUp; - AssociatedObject.MouseMove -= AssociatedObject_MouseMove; + this.AssociatedObject.MouseDown -= AssociatedObject_MouseDown; + this.AssociatedObject.MouseUp -= AssociatedObject_MouseUp; + this.AssociatedObject.MouseMove -= AssociatedObject_MouseMove; - AssociatedObject.MouseLeave -= AssociatedObject_MouseLeave; + this.AssociatedObject.MouseLeave -= AssociatedObject_MouseLeave; - AssociatedObject.GiveFeedback -= AssociatedObject_GiveFeedback; + this.AssociatedObject.GiveFeedback -= AssociatedObject_GiveFeedback; } private void AssociatedObject_GiveFeedback(object sender, GiveFeedbackEventArgs e) @@ -215,7 +215,7 @@ protected virtual IDragAdorner CreateDragAdorner(UIElement element, Point point) protected virtual void DoDragDrop() { DataObject dragData = new DataObject(this.DragGroup, adorner); - DragDrop.DoDragDrop(this.AssociatedObject, dragData, DragDropEffects); + DragDrop.DoDragDrop(this.AssociatedObject, dragData, this.DragDropEffects); } private bool _isCapture; @@ -324,7 +324,7 @@ public class DragGridAdorner : System.Windows.Documents.Adorner { public DragGridAdorner(UIElement adornedElement) : base(adornedElement) { - vbrush = new VisualBrush(AdornedElement); + vbrush = new VisualBrush(this.AdornedElement); vbrush.Opacity = .5; } diff --git a/Source/Controls/H.Controls.Adorner/Service/Bevhavior/DropAdornerBehavior.cs b/Source/Controls/H.Controls.Adorner/Service/Bevhavior/DropAdornerBehavior.cs index 6b207da3..e606a195 100644 --- a/Source/Controls/H.Controls.Adorner/Service/Bevhavior/DropAdornerBehavior.cs +++ b/Source/Controls/H.Controls.Adorner/Service/Bevhavior/DropAdornerBehavior.cs @@ -20,7 +20,7 @@ public string DragGroup set { SetValue(DragGroupProperty, value); } } - + public static readonly DependencyProperty DragGroupProperty = DependencyProperty.Register("DragGroup", typeof(string), typeof(DropAdornerBehavior), new PropertyMetadata("DragGroup", (d, e) => { diff --git a/Source/Controls/H.Controls.Adorner/Service/Bevhavior/ElementAllowDrapBehavior.cs b/Source/Controls/H.Controls.Adorner/Service/Bevhavior/ElementAllowDrapBehavior.cs index 72566490..929d3f2a 100644 --- a/Source/Controls/H.Controls.Adorner/Service/Bevhavior/ElementAllowDrapBehavior.cs +++ b/Source/Controls/H.Controls.Adorner/Service/Bevhavior/ElementAllowDrapBehavior.cs @@ -16,13 +16,13 @@ public class ElementAllowDragBehavior : DragAdornerBehavior { protected override void OnAttached() { - AssociatedObject.AllowDrop = true; + this.AssociatedObject.AllowDrop = true; - AssociatedObject.Drop += AssociatedObjectOnDrop; + this.AssociatedObject.Drop += AssociatedObjectOnDrop; - AssociatedObject.DragEnter += AssociatedObject_DragEnter; + this.AssociatedObject.DragEnter += AssociatedObject_DragEnter; - AssociatedObject.DragLeave += AssociatedObject_DragLeave; + this.AssociatedObject.DragLeave += AssociatedObject_DragLeave; base.OnAttached(); @@ -30,13 +30,13 @@ protected override void OnAttached() protected override void OnDetaching() { - AssociatedObject.AllowDrop = false; + this.AssociatedObject.AllowDrop = false; - AssociatedObject.Drop -= AssociatedObjectOnDrop; + this.AssociatedObject.Drop -= AssociatedObjectOnDrop; - AssociatedObject.DragEnter -= AssociatedObject_DragEnter; + this.AssociatedObject.DragEnter -= AssociatedObject_DragEnter; - AssociatedObject.DragLeave -= AssociatedObject_DragLeave; + this.AssociatedObject.DragLeave -= AssociatedObject_DragLeave; base.OnDetaching(); } @@ -53,7 +53,7 @@ protected override void DoDragDrop() int index = items.Items.IndexOf(this.AssociatedObject); - DragDropEffects result = DragDrop.DoDragDrop(this.AssociatedObject, dragData, DragDropEffects); + DragDropEffects result = DragDrop.DoDragDrop(this.AssociatedObject, dragData, this.DragDropEffects); // Do :移动成功清理数据 if (result == DragDropEffects.Move) @@ -83,7 +83,7 @@ protected override void DoDragDrop() int index = (items.ItemsSource as IList).IndexOf(data); - DragDropEffects result = DragDrop.DoDragDrop(this.AssociatedObject, dragData, DragDropEffects); + DragDropEffects result = DragDrop.DoDragDrop(this.AssociatedObject, dragData, this.DragDropEffects); // Do :移动成功清理数据 diff --git a/Source/Controls/H.Controls.Chart2D/Axis/Axis.xaml.cs b/Source/Controls/H.Controls.Chart2D/Axis/Axis.xaml.cs index 40fb04ec..fdbd386c 100644 --- a/Source/Controls/H.Controls.Chart2D/Axis/Axis.xaml.cs +++ b/Source/Controls/H.Controls.Chart2D/Axis/Axis.xaml.cs @@ -23,7 +23,7 @@ public int AlignLenght set { SetValue(AlignLenghtProperty, value); } } - + public static readonly DependencyProperty AlignLenghtProperty = DependencyProperty.Register("AlignLenght", typeof(int), typeof(Axis), new PropertyMetadata(5, (d, e) => { @@ -42,7 +42,7 @@ public Style LabelStyle set { SetValue(LabelStyleProperty, value); } } - + public static readonly DependencyProperty LabelStyleProperty = DependencyProperty.Register("LabelStyle", typeof(Style), typeof(Axis), new PropertyMetadata(default(Style), (d, e) => { @@ -60,7 +60,7 @@ public bool TextAlignmentCenter set { SetValue(TextAlignmentCenterProperty, value); } } - + public static readonly DependencyProperty TextAlignmentCenterProperty = DependencyProperty.Register("TextAlignmentCenter", typeof(bool), typeof(Axis), new PropertyMetadata(default(bool), (d, e) => { @@ -81,7 +81,7 @@ public bool AlignAlignmentCenter set { SetValue(AlignAlignmentCenterProperty, value); } } - + public static readonly DependencyProperty AlignAlignmentCenterProperty = DependencyProperty.Register("AlignAlignmentCenter", typeof(bool), typeof(Axis), new PropertyMetadata(default(bool), (d, e) => { @@ -99,7 +99,7 @@ public double Value set { SetValue(ValueProperty, value); } } - + public static readonly DependencyProperty ValueProperty = DependencyProperty.Register("Value", typeof(double), typeof(Axis), new PropertyMetadata(0.0, (d, e) => { @@ -121,7 +121,7 @@ public Dock DockAlignment set { SetValue(DockAlignmentProperty, value); } } - + public static readonly DependencyProperty DockAlignmentProperty = DependencyProperty.Register("DockAlignment", typeof(Dock), typeof(Axis), new PropertyMetadata(Dock.Left, (d, e) => { @@ -375,7 +375,7 @@ public double Len set { SetValue(LenProperty, value); } } - + public static readonly DependencyProperty LenProperty = DependencyProperty.Register("Len", typeof(double), typeof(RadiusAxis), new PropertyMetadata(default(double), (d, e) => { @@ -402,7 +402,7 @@ public override void Draw(Canvas canvas) // Do :底线 System.Windows.Shapes.Line yright = new System.Windows.Shapes.Line(); yright.X1 = this.ActualWidth / 2; - yright.X2 = (this.ActualWidth / 2) + Len; + yright.X2 = (this.ActualWidth / 2) + this.Len; yright.Y1 = 0; yright.Y2 = 0; yright.Style = this.LineStyle; @@ -453,7 +453,7 @@ public double Len set { SetValue(LenProperty, value); } } - + public static readonly DependencyProperty LenProperty = DependencyProperty.Register("Len", typeof(double), typeof(AngleAxis), new PropertyMetadata(default(double), (d, e) => { diff --git a/Source/Controls/H.Controls.Chart2D/Axis/Grid.xaml.cs b/Source/Controls/H.Controls.Chart2D/Axis/Grid.xaml.cs index 56dd6a96..c6143392 100644 --- a/Source/Controls/H.Controls.Chart2D/Axis/Grid.xaml.cs +++ b/Source/Controls/H.Controls.Chart2D/Axis/Grid.xaml.cs @@ -22,7 +22,7 @@ public Style HorizontalLineStyle set { SetValue(HorizontalLineStyleProperty, value); } } - + public static readonly DependencyProperty HorizontalLineStyleProperty = DependencyProperty.Register("HorizontalLineStyle", typeof(Style), typeof(Grid), new PropertyMetadata(default(Style), (d, e) => { @@ -42,7 +42,7 @@ public Style VerticalLineStyle set { SetValue(VerticalLineStyleProperty, value); } } - + public static readonly DependencyProperty VerticalLineStyleProperty = DependencyProperty.Register("VerticalLineStyle", typeof(Style), typeof(Grid), new PropertyMetadata(default(Style), (d, e) => { diff --git a/Source/Controls/H.Controls.Chart2D/Axis/Polar.xaml.cs b/Source/Controls/H.Controls.Chart2D/Axis/Polar.xaml.cs index 6cdd41a7..fe8b58a6 100644 --- a/Source/Controls/H.Controls.Chart2D/Axis/Polar.xaml.cs +++ b/Source/Controls/H.Controls.Chart2D/Axis/Polar.xaml.cs @@ -23,7 +23,7 @@ public double Len set { SetValue(LenProperty, value); } } - + public static readonly DependencyProperty LenProperty = DependencyProperty.Register("Len", typeof(double), typeof(Polar), new PropertyMetadata(200.0, (d, e) => { diff --git a/Source/Controls/H.Controls.Chart2D/Chart.xaml.cs b/Source/Controls/H.Controls.Chart2D/Chart.xaml.cs index bafe248e..1ec238e5 100644 --- a/Source/Controls/H.Controls.Chart2D/Chart.xaml.cs +++ b/Source/Controls/H.Controls.Chart2D/Chart.xaml.cs @@ -69,7 +69,7 @@ public double SplitMilliSecond set { SetValue(SplitMilliSecondProperty, value); } } - + public static readonly DependencyProperty SplitMilliSecondProperty = DependencyProperty.Register("SplitMilliSecond", typeof(double), typeof(Chart), new PropertyMetadata(500.0, (d, e) => { @@ -85,7 +85,7 @@ public ObservableCollection xDisplay set { SetValue(xDisplayProperty, value); } } - + public static readonly DependencyProperty xDisplayProperty = DependencyProperty.Register("xDisplay", typeof(ObservableCollection), typeof(Chart), new PropertyMetadata(new ObservableCollection(), (d, e) => { @@ -104,7 +104,7 @@ public ObservableCollection yDisplay set { SetValue(yDisplayProperty, value); } } - + public static readonly DependencyProperty yDisplayProperty = DependencyProperty.Register("yDisplay", typeof(ObservableCollection), typeof(Chart), new PropertyMetadata(new ObservableCollection(), (d, e) => { @@ -123,7 +123,7 @@ public Style xAxisStyle set { SetValue(xAxisStyleProperty, value); } } - + public static readonly DependencyProperty xAxisStyleProperty = DependencyProperty.Register("xAxisStyle", typeof(Style), typeof(Chart), new PropertyMetadata(default(Style), (d, e) => { @@ -142,7 +142,7 @@ public Style yAxisStyle set { SetValue(yAxisStyleProperty, value); } } - + public static readonly DependencyProperty yAxisStyleProperty = DependencyProperty.Register("yAxisStyle", typeof(Style), typeof(Chart), new PropertyMetadata(default(Style), (d, e) => { @@ -161,7 +161,7 @@ public Style GridStyle set { SetValue(GridStyleProperty, value); } } - + public static readonly DependencyProperty GridStyleProperty = DependencyProperty.Register("GridStyle", typeof(Style), typeof(Chart), new PropertyMetadata(default(Style), (d, e) => { @@ -180,7 +180,7 @@ public Style LegendStyle set { SetValue(LegendStyleProperty, value); } } - + public static readonly DependencyProperty LegendStyleProperty = DependencyProperty.Register("LegendStyle", typeof(Style), typeof(Chart), new PropertyMetadata(default(Style), (d, e) => { @@ -200,7 +200,7 @@ public Style VisualMapStyle set { SetValue(VisualMapStyleProperty, value); } } - + public static readonly DependencyProperty VisualMapStyleProperty = DependencyProperty.Register("VisualMapStyle", typeof(Style), typeof(Chart), new PropertyMetadata(default(Style), (d, e) => { @@ -220,7 +220,7 @@ public Func xConvert set { SetValue(xConvertProperty, value); } } - + public static readonly DependencyProperty xConvertProperty = DependencyProperty.Register("xConvert", typeof(Func), typeof(ViewLayerGroup), new PropertyMetadata(default(Func), (d, e) => { @@ -239,7 +239,7 @@ public Func yConvert set { SetValue(yConvertProperty, value); } } - + public static readonly DependencyProperty yConvertProperty = DependencyProperty.Register("yConvert", typeof(Func), typeof(ViewLayerGroup), new PropertyMetadata(default(Func), (d, e) => { @@ -285,7 +285,7 @@ public bool UseRefreshButton set { SetValue(UseRefreshButtonProperty, value); } } - + public static readonly DependencyProperty UseRefreshButtonProperty = DependencyProperty.Register("UseRefreshButton", typeof(bool), typeof(Chart), new FrameworkPropertyMetadata(true, (d, e) => { @@ -312,7 +312,7 @@ public bool UseLegend set { SetValue(UseLegendProperty, value); } } - + public static readonly DependencyProperty UseLegendProperty = DependencyProperty.Register("UseLegend", typeof(bool), typeof(Chart), new FrameworkPropertyMetadata(true, (d, e) => { @@ -339,7 +339,7 @@ public bool UsexAxis set { SetValue(UsexAxisProperty, value); } } - + public static readonly DependencyProperty UsexAxisProperty = DependencyProperty.Register("UsexAxis", typeof(bool), typeof(Chart), new FrameworkPropertyMetadata(true, (d, e) => { @@ -365,7 +365,7 @@ public bool UseyAxis set { SetValue(UseyAxisProperty, value); } } - + public static readonly DependencyProperty UseyAxisProperty = DependencyProperty.Register("UseyAxis", typeof(bool), typeof(Chart), new FrameworkPropertyMetadata(true, (d, e) => { @@ -392,7 +392,7 @@ public bool UseGrid set { SetValue(UseGridProperty, value); } } - + public static readonly DependencyProperty UseGridProperty = DependencyProperty.Register("UseGrid", typeof(bool), typeof(Chart), new FrameworkPropertyMetadata(true, (d, e) => { @@ -419,7 +419,7 @@ public bool UseMarkLine set { SetValue(UseMarkLineProperty, value); } } - + public static readonly DependencyProperty UseMarkLineProperty = DependencyProperty.Register("UseMarkLine", typeof(bool), typeof(Chart), new FrameworkPropertyMetadata(true, (d, e) => { @@ -446,7 +446,7 @@ public bool UseMarkPosition set { SetValue(UseMarkPositionProperty, value); } } - + public static readonly DependencyProperty UseMarkPositionProperty = DependencyProperty.Register("UseMarkPosition", typeof(bool), typeof(Chart), new FrameworkPropertyMetadata(true, (d, e) => { @@ -485,7 +485,7 @@ public double Len set { SetValue(LenProperty, value); } } - + public static readonly DependencyProperty LenProperty = DependencyProperty.Register("Len", typeof(double), typeof(PolarChart), new PropertyMetadata(default(double), (d, e) => { @@ -512,7 +512,7 @@ public override void OnApplyTemplate() { base.OnApplyTemplate(); - this.toolBar = Template.FindName("PART_TOOLBAR", this) as ThumbToolBar; + this.toolBar = this.Template.FindName("PART_TOOLBAR", this) as ThumbToolBar; this.toolBar.ValueChanged += (l, k) => { @@ -564,7 +564,7 @@ public Chart Chart set { SetValue(ChartProperty, value); } } - + public static readonly DependencyProperty ChartProperty = DependencyProperty.Register("Chart", typeof(Chart), typeof(ChartMap), new PropertyMetadata(default(Chart), (d, e) => { @@ -584,7 +584,7 @@ public int MinCount set { SetValue(MinCountProperty, value); } } - + public static readonly DependencyProperty MinCountProperty = DependencyProperty.Register("MinCount", typeof(int), typeof(ChartMap), new PropertyMetadata(10, (d, e) => { diff --git a/Source/Controls/H.Controls.Chart2D/Marker/CirclePointMarker.cs b/Source/Controls/H.Controls.Chart2D/Marker/CirclePointMarker.cs index 1479c8d5..df90efb0 100644 --- a/Source/Controls/H.Controls.Chart2D/Marker/CirclePointMarker.cs +++ b/Source/Controls/H.Controls.Chart2D/Marker/CirclePointMarker.cs @@ -12,7 +12,7 @@ protected override Geometry DefiningGeometry { get { - EllipseGeometry e = new EllipseGeometry(ScreenPoint, this.Size / 2, this.Size / 2); + EllipseGeometry e = new EllipseGeometry(this.ScreenPoint, this.Size / 2, this.Size / 2); return e; } } @@ -23,7 +23,7 @@ protected override void OnRender(DrawingContext drawingContext) Pen p = new Pen(this.Fill, 1); - drawingContext.DrawGeometry(Brushes.White, p, DefiningGeometry); + drawingContext.DrawGeometry(Brushes.White, p, this.DefiningGeometry); //drawingContext.DrawGeometry(this.Fill, this.Pen, DefiningGeometry); } diff --git a/Source/Controls/H.Controls.Chart2D/Marker/IMark.cs b/Source/Controls/H.Controls.Chart2D/Marker/IMark.cs index 8524b095..ba33d3c1 100644 --- a/Source/Controls/H.Controls.Chart2D/Marker/IMark.cs +++ b/Source/Controls/H.Controls.Chart2D/Marker/IMark.cs @@ -81,7 +81,7 @@ protected override Geometry DefiningGeometry { get { - EllipseGeometry e = new EllipseGeometry(ScreenPoint, this.Size / 2, this.Size / 2); + EllipseGeometry e = new EllipseGeometry(this.ScreenPoint, this.Size / 2, this.Size / 2); return e; } } @@ -98,7 +98,7 @@ protected override void OnRender(DrawingContext drawingContext) Pen p = new Pen(this.Fill, 1); - drawingContext.DrawGeometry(Brushes.White, p, DefiningGeometry); + drawingContext.DrawGeometry(Brushes.White, p, this.DefiningGeometry); } } } diff --git a/Source/Controls/H.Controls.Chart2D/Marker/Marker.xaml.cs b/Source/Controls/H.Controls.Chart2D/Marker/Marker.xaml.cs index b9a1eccb..4e0e834b 100644 --- a/Source/Controls/H.Controls.Chart2D/Marker/Marker.xaml.cs +++ b/Source/Controls/H.Controls.Chart2D/Marker/Marker.xaml.cs @@ -27,7 +27,7 @@ public Rect Rect set { SetValue(RectProperty, value); } } - + public static readonly DependencyProperty RectProperty = DependencyProperty.Register("Rect", typeof(Rect), typeof(EllipseMarker), new PropertyMetadata(default(Rect), (d, e) => { @@ -42,7 +42,7 @@ protected override Geometry DefiningGeometry { get { - EllipseGeometry e = new EllipseGeometry(ScreenPoint, this.Rect.Width / 2, this.Rect.Height / 2); + EllipseGeometry e = new EllipseGeometry(this.ScreenPoint, this.Rect.Width / 2, this.Rect.Height / 2); return e; } } @@ -53,7 +53,7 @@ protected override void OnRender(DrawingContext drawingContext) Pen p = new Pen(this.Stroke, this.StrokeThickness); - drawingContext.DrawGeometry(this.Fill, p, DefiningGeometry); + drawingContext.DrawGeometry(this.Fill, p, this.DefiningGeometry); //drawingContext.DrawGeometry(this.Fill, this.Pen, DefiningGeometry); diff --git a/Source/Controls/H.Controls.Chart2D/Marker/T5PointMarker.cs b/Source/Controls/H.Controls.Chart2D/Marker/T5PointMarker.cs index 16f2cc58..56b7b663 100644 --- a/Source/Controls/H.Controls.Chart2D/Marker/T5PointMarker.cs +++ b/Source/Controls/H.Controls.Chart2D/Marker/T5PointMarker.cs @@ -95,7 +95,7 @@ protected override void OnRender(DrawingContext drawingContext) { base.OnRender(drawingContext); - drawingContext.DrawGeometry(Fill, Pen, DefiningGeometry); + drawingContext.DrawGeometry(this.Fill, this.Pen, this.DefiningGeometry); } } diff --git a/Source/Controls/H.Controls.Chart2D/Marker/TrianglePointMarker.cs b/Source/Controls/H.Controls.Chart2D/Marker/TrianglePointMarker.cs index 2862b1c2..67b08f7f 100644 --- a/Source/Controls/H.Controls.Chart2D/Marker/TrianglePointMarker.cs +++ b/Source/Controls/H.Controls.Chart2D/Marker/TrianglePointMarker.cs @@ -15,9 +15,9 @@ protected override Geometry DefiningGeometry get { double Size = 5; - Point pt0 = Point.Add(ScreenPoint, new Vector(-Size / 2, -Size / 2)); - Point pt1 = Point.Add(ScreenPoint, new Vector(0, Size / 2)); - Point pt2 = Point.Add(ScreenPoint, new Vector(Size / 2, -Size / 2)); + Point pt0 = Point.Add(this.ScreenPoint, new Vector(-Size / 2, -Size / 2)); + Point pt1 = Point.Add(this.ScreenPoint, new Vector(0, Size / 2)); + Point pt2 = Point.Add(this.ScreenPoint, new Vector(Size / 2, -Size / 2)); StreamGeometry streamGeom = new StreamGeometry(); using (StreamGeometryContext context = streamGeom.Open()) @@ -36,7 +36,7 @@ protected override void OnRender(DrawingContext drawingContext) { base.OnRender(drawingContext); - drawingContext.DrawGeometry(Fill, Pen, DefiningGeometry); + drawingContext.DrawGeometry(this.Fill, this.Pen, this.DefiningGeometry); } } } diff --git a/Source/Controls/H.Controls.Chart2D/Option.cs b/Source/Controls/H.Controls.Chart2D/Option.cs index 3969cb5a..20444ccd 100644 --- a/Source/Controls/H.Controls.Chart2D/Option.cs +++ b/Source/Controls/H.Controls.Chart2D/Option.cs @@ -187,7 +187,7 @@ public override object ConvertFrom(ITypeDescriptorContext context, CultureInfo c public override object ConvertTo(ITypeDescriptorContext context, CultureInfo culture, object value, Type destinationType) { if (value is ObservableCollection collection) - return string.Join(",", collection.Select(x => ColorConverter.ConvertToString(null, null, x))); + return string.Join(",", collection.Select(x => this.ColorConverter.ConvertToString(null, null, x))); return base.ConvertTo(context, culture, value, destinationType); } } diff --git a/Source/Controls/H.Controls.Chart2D/Presenter/BarPresenter.xaml.cs b/Source/Controls/H.Controls.Chart2D/Presenter/BarPresenter.xaml.cs index a811e31d..4b70eacd 100644 --- a/Source/Controls/H.Controls.Chart2D/Presenter/BarPresenter.xaml.cs +++ b/Source/Controls/H.Controls.Chart2D/Presenter/BarPresenter.xaml.cs @@ -21,7 +21,7 @@ public BarPresenter(IEnumerable data) : base(data) public BarPresenter(IChartDataProvider dataProvider) : base(dataProvider) { - + } } } diff --git a/Source/Controls/H.Controls.Chart2D/Presenter/Chart2DPresenterBase.cs b/Source/Controls/H.Controls.Chart2D/Presenter/Chart2DPresenterBase.cs index e2694ae9..9ee9329b 100644 --- a/Source/Controls/H.Controls.Chart2D/Presenter/Chart2DPresenterBase.cs +++ b/Source/Controls/H.Controls.Chart2D/Presenter/Chart2DPresenterBase.cs @@ -122,8 +122,8 @@ public bool UseGrid protected IEnumerable Load(IEnumerable data, double max = double.PositiveInfinity, double min = 0.0, int count = 5) { - if(data.Count()==0) - yield break; + if (data.Count() == 0) + yield break; max = max == double.PositiveInfinity ? data.Max() : max; min = min == double.PositiveInfinity ? data.Min() : min; double vSpan = (max - min) / count; diff --git a/Source/Controls/H.Controls.Chart2D/Provider/Layer.xaml.cs b/Source/Controls/H.Controls.Chart2D/Provider/Layer.xaml.cs index f132b2ae..48c5ab13 100644 --- a/Source/Controls/H.Controls.Chart2D/Provider/Layer.xaml.cs +++ b/Source/Controls/H.Controls.Chart2D/Provider/Layer.xaml.cs @@ -32,7 +32,7 @@ public bool UseVisual set { SetValue(UseVisualProperty, value); } } - + public static readonly DependencyProperty UseVisualProperty = DependencyProperty.Register("UseVisual", typeof(bool), typeof(DrawingCanvas), new PropertyMetadata(default(bool), (d, e) => { @@ -52,7 +52,7 @@ protected override int VisualChildrenCount { get { - if (UseVisual) + if (this.UseVisual) { return visuals.Count; } @@ -66,7 +66,7 @@ protected override int VisualChildrenCount //获取Visual protected override Visual GetVisualChild(int index) { - if (UseVisual) + if (this.UseVisual) { return visuals[index]; } @@ -232,7 +232,7 @@ public bool TryFreeze set { SetValue(TryFreezeProperty, value); } } - + public static readonly DependencyProperty TryFreezeProperty = DependencyProperty.Register("TryFreeze", typeof(bool), typeof(LayerBase), new PropertyMetadata(true, (d, e) => { @@ -314,7 +314,7 @@ public class Timelines : List public class AnimationLayer : LayerBase { - public static ComponentResourceKey DefaultKey => new ComponentResourceKey(typeof(AnimationLayer), "S.AnimationLayer.Default"); + public static new ComponentResourceKey DefaultKey => new ComponentResourceKey(typeof(AnimationLayer), "S.AnimationLayer.Default"); static AnimationLayer() { @@ -332,7 +332,7 @@ public Timelines Timelines set { SetValue(TimelinesProperty, value); } } - + public static readonly DependencyProperty TimelinesProperty = DependencyProperty.Register("Timelines", typeof(Timelines), typeof(AnimationLayer), new PropertyMetadata(new Timelines(), (d, e) => { @@ -348,7 +348,7 @@ public Timelines Timelines private void AssociatedObject_Drawed(object sender, RoutedEventArgs e) { - if (Timelines == null) return; + if (this.Timelines == null) return; IEnumerable items = this.GetChildren().Where(l => l.RenderTransform is TransformGroup); items = items.Where(l => (l.RenderTransform as TransformGroup).Children.Count == 4); @@ -361,9 +361,9 @@ private void AssociatedObject_Drawed(object sender, RoutedEventArgs e) for (int i = 0; i < controls.Count; i++) { - foreach (DoubleAnimation item in Timelines.OfType()) + foreach (DoubleAnimation item in this.Timelines.OfType()) { - TimeSpan span = TimeSpan.FromMilliseconds(i * (SplitMilliSecond + item.Duration.TimeSpan.TotalMilliseconds)); + TimeSpan span = TimeSpan.FromMilliseconds(i * (this.SplitMilliSecond + item.Duration.TimeSpan.TotalMilliseconds)); TimeSpan end = item.Duration.TimeSpan + span; @@ -383,9 +383,9 @@ private void AssociatedObject_Drawed(object sender, RoutedEventArgs e) storyboard.Children.Add(animation); } - foreach (ThicknessAnimation item in Timelines.OfType()) + foreach (ThicknessAnimation item in this.Timelines.OfType()) { - TimeSpan span = TimeSpan.FromMilliseconds(i * (SplitMilliSecond + item.Duration.TimeSpan.TotalMilliseconds)); + TimeSpan span = TimeSpan.FromMilliseconds(i * (this.SplitMilliSecond + item.Duration.TimeSpan.TotalMilliseconds)); TimeSpan end = item.Duration.TimeSpan + span; @@ -416,7 +416,7 @@ public double SplitMilliSecond set { SetValue(SplitMilliSecondProperty, value); } } - + public static readonly DependencyProperty SplitMilliSecondProperty = DependencyProperty.Register("SplitMilliSecond", typeof(double), typeof(AnimationLayer), new PropertyMetadata(5.0, (d, e) => { @@ -434,7 +434,7 @@ public bool IsUseAnimation set { SetValue(IsUseAnimationProperty, value); } } - + public static readonly DependencyProperty IsUseAnimationProperty = DependencyProperty.Register("IsUseAnimation", typeof(bool), typeof(AnimationLayer), new PropertyMetadata(true, (d, e) => { @@ -452,11 +452,11 @@ public bool IsUseAnimation /// protected void RunPath(Path path, double MilliSecond = 1000) { - if (!this.IsUseAnimation) + if (!this.IsUseAnimation) return; double _pathLength = path.Data.GetTotalLength(new Size(path.ActualWidth, path.ActualHeight), path.StrokeThickness) * 2; - if (Math.Abs(_pathLength) < 1E-06) + if (Math.Abs(_pathLength) < 1E-06) return; path.StrokeDashOffset = _pathLength; path.StrokeDashArray = new DoubleCollection(new List @@ -510,7 +510,7 @@ public Brush Foreground set { SetValue(ForegroundProperty, value); } } - + public static readonly DependencyProperty ForegroundProperty = DependencyProperty.Register("Foreground", typeof(Brush), typeof(XyLayer), new PropertyMetadata(Brushes.Black, (d, e) => { @@ -604,7 +604,7 @@ public Style LineStyle set { SetValue(LineStyleProperty, value); } } - + public static readonly DependencyProperty LineStyleProperty = DependencyProperty.Register("LineStyle", typeof(Style), typeof(XyLayer), new PropertyMetadata(default(Style), (d, e) => { @@ -625,7 +625,7 @@ public DoubleCollection xAxis set { SetValue(xAxisProperty, value); } } - + public static readonly DependencyProperty xAxisProperty = DependencyProperty.Register("xAxis", typeof(DoubleCollection), typeof(XyLayer), new FrameworkPropertyMetadata(new DoubleCollection(), FrameworkPropertyMetadataOptions.Inherits, (d, e) => { @@ -646,7 +646,7 @@ public DoubleCollection yAxis set { SetValue(yAxisProperty, value); } } - + public static readonly DependencyProperty yAxisProperty = DependencyProperty.Register("yAxis", typeof(DoubleCollection), typeof(XyLayer), new FrameworkPropertyMetadata(new DoubleCollection(), FrameworkPropertyMetadataOptions.Inherits, (d, e) => { @@ -668,7 +668,7 @@ public ObservableCollection xDisplay set { SetValue(xDisplayProperty, value); } } - + public static readonly DependencyProperty xDisplayProperty = DependencyProperty.Register("xDisplay", typeof(ObservableCollection), typeof(XyLayer), new PropertyMetadata(new ObservableCollection(), (d, e) => { @@ -690,7 +690,7 @@ public ObservableCollection yDisplay set { SetValue(yDisplayProperty, value); } } - + public static readonly DependencyProperty yDisplayProperty = DependencyProperty.Register("yDisplay", typeof(ObservableCollection), typeof(XyLayer), new PropertyMetadata(new ObservableCollection(), (d, e) => { @@ -711,7 +711,7 @@ public ObservableCollection xMap set { SetValue(xMapProperty, value); } } - + public static readonly DependencyProperty xMapProperty = DependencyProperty.Register("xMap", typeof(ObservableCollection), typeof(XyLayer), new PropertyMetadata(default(ObservableCollection), (d, e) => { @@ -730,7 +730,7 @@ public ObservableCollection yMap set { SetValue(yMapProperty, value); } } - + public static readonly DependencyProperty yMapProperty = DependencyProperty.Register("yMap", typeof(ObservableCollection), typeof(XyLayer), new PropertyMetadata(default(ObservableCollection), (d, e) => { @@ -750,7 +750,7 @@ public Func xConvert set { SetValue(xConvertProperty, value); } } - + public static readonly DependencyProperty xConvertProperty = DependencyProperty.Register("xConvert", typeof(Func), typeof(XyLayer), new PropertyMetadata(default(Func), (d, e) => { @@ -769,7 +769,7 @@ public Func yConvert set { SetValue(yConvertProperty, value); } } - + public static readonly DependencyProperty yConvertProperty = DependencyProperty.Register("yConvert", typeof(Func), typeof(XyLayer), new PropertyMetadata(default(Func), (d, e) => { @@ -800,7 +800,7 @@ public DoubleCollection Data set { SetValue(DataProperty, value); } } - + public static readonly DependencyProperty DataProperty = DependencyProperty.Register("Data", typeof(DoubleCollection), typeof(DataLayer), new PropertyMetadata(new DoubleCollection(), (d, e) => { @@ -827,7 +827,7 @@ public ObservableCollection DataBoolean set { SetValue(DataBooleanProperty, value); } } - + public static readonly DependencyProperty DataBooleanProperty = DependencyProperty.Register("DataBoolean", typeof(ObservableCollection), typeof(DataLayer), new PropertyMetadata(new ObservableCollection(), (d, e) => { @@ -846,7 +846,7 @@ public ObservableCollection DataMap set { SetValue(DataMapProperty, value); } } - + public static readonly DependencyProperty DataMapProperty = DependencyProperty.Register("DataMap", typeof(ObservableCollection), typeof(DataLayer), new PropertyMetadata(default(ObservableCollection), (d, e) => { @@ -892,7 +892,7 @@ public ObservableCollection yAxises set { SetValue(yAxisesProperty, value); } } - + public static readonly DependencyProperty yAxisesProperty = DependencyProperty.Register("yAxises", typeof(ObservableCollection), typeof(MapLayer), new PropertyMetadata(default(ObservableCollection), (d, e) => { @@ -911,7 +911,7 @@ public ObservableCollection xAxises set { SetValue(xAxisesProperty, value); } } - + public static readonly DependencyProperty xAxisesProperty = DependencyProperty.Register("xAxises", typeof(ObservableCollection), typeof(MapLayer), new PropertyMetadata(default(ObservableCollection), (d, e) => { @@ -971,7 +971,7 @@ public Style MarkStyle set { SetValue(MarkStyleProperty, value); } } - + public static readonly DependencyProperty MarkStyleProperty = DependencyProperty.Register("MarkStyle", typeof(Style), typeof(Layer), new PropertyMetadata(default(Style), (d, e) => { @@ -992,7 +992,7 @@ public Style LabelStyle set { SetValue(LabelStyleProperty, value); } } - + public static readonly DependencyProperty LabelStyleProperty = DependencyProperty.Register("LabelStyle", typeof(Style), typeof(Layer), new PropertyMetadata(default(Style), (d, e) => { @@ -1033,7 +1033,7 @@ public Style PathStyle set { SetValue(PathStyleProperty, value); } } - + public static readonly DependencyProperty PathStyleProperty = DependencyProperty.Register("PathStyle", typeof(Style), typeof(Layer), new PropertyMetadata(default(Style), (d, e) => { diff --git a/Source/Controls/H.Controls.Chart2D/Provider/LayerGroup.xaml.cs b/Source/Controls/H.Controls.Chart2D/Provider/LayerGroup.xaml.cs index bb4b7096..fee565c0 100644 --- a/Source/Controls/H.Controls.Chart2D/Provider/LayerGroup.xaml.cs +++ b/Source/Controls/H.Controls.Chart2D/Provider/LayerGroup.xaml.cs @@ -91,7 +91,7 @@ public string DisplayName set { SetValue(DisplayNameProperty, value); } } - + public static readonly DependencyProperty DisplayNameProperty = DependencyProperty.Register("DisplayName", typeof(string), typeof(LayerGroup), new FrameworkPropertyMetadata(default(string), FrameworkPropertyMetadataOptions.Inherits, (d, e) => { @@ -150,7 +150,7 @@ public bool UseDrawOnce set { SetValue(UseDrawOnceProperty, value); } } - + public static readonly DependencyProperty UseDrawOnceProperty = DependencyProperty.Register("UseDrawOnce", typeof(bool), typeof(ViewLayerGroup), new FrameworkPropertyMetadata(true, FrameworkPropertyMetadataOptions.Inherits, (d, e) => { @@ -177,7 +177,7 @@ public DoubleCollection xAxis set { SetValue(xAxisProperty, value); } } - + public static readonly DependencyProperty xAxisProperty = DependencyProperty.Register("xAxis", typeof(DoubleCollection), typeof(ViewLayerGroup), new FrameworkPropertyMetadata(new DoubleCollection(), FrameworkPropertyMetadataOptions.Inherits, (d, e) => { @@ -199,7 +199,7 @@ public DoubleCollection yAxis set { SetValue(yAxisProperty, value); } } - + public static readonly DependencyProperty yAxisProperty = DependencyProperty.Register("yAxis", typeof(DoubleCollection), typeof(ViewLayerGroup), new FrameworkPropertyMetadata(new DoubleCollection(), FrameworkPropertyMetadataOptions.Inherits, (d, e) => { @@ -222,7 +222,7 @@ public DoubleCollection xDatas set { SetValue(xDatasProperty, value); } } - + public static readonly DependencyProperty xDatasProperty = DependencyProperty.Register("xDatas", typeof(DoubleCollection), typeof(ViewLayerGroup), new FrameworkPropertyMetadata(new DoubleCollection(), FrameworkPropertyMetadataOptions.Inherits, (d, e) => { @@ -246,7 +246,7 @@ public DoubleCollection yDatas set { SetValue(yDatasProperty, value); } } - + public static readonly DependencyProperty yDatasProperty = DependencyProperty.Register("yDatas", typeof(DoubleCollection), typeof(ViewLayerGroup), new FrameworkPropertyMetadata(new DoubleCollection(), FrameworkPropertyMetadataOptions.Inherits, (d, e) => { @@ -269,7 +269,7 @@ public int yAxisCount set { SetValue(yAxisCountProperty, value); } } - + public static readonly DependencyProperty yAxisCountProperty = DependencyProperty.Register("yAxisCount", typeof(int), typeof(ViewLayerGroup), new PropertyMetadata(5, (d, e) => { @@ -289,7 +289,7 @@ public int xAxisCount set { SetValue(xAxisCountProperty, value); } } - + public static readonly DependencyProperty xAxisCountProperty = DependencyProperty.Register("xAxisCount", typeof(int), typeof(ViewLayerGroup), new PropertyMetadata(10, (d, e) => { @@ -309,7 +309,7 @@ public bool yAxisAuto set { SetValue(yAxisAutoProperty, value); } } - + public static readonly DependencyProperty yAxisAutoProperty = DependencyProperty.Register("yAxisAuto", typeof(bool), typeof(ViewLayerGroup), new PropertyMetadata(false, (d, e) => { @@ -328,7 +328,7 @@ public bool xAxisAuto set { SetValue(xAxisAutoProperty, value); } } - + public static readonly DependencyProperty xAxisAutoProperty = DependencyProperty.Register("xAxisAuto", typeof(bool), typeof(ViewLayerGroup), new PropertyMetadata(false, (d, e) => { @@ -431,7 +431,7 @@ public bool DrawOnce set { SetValue(DrawOnceProperty, value); } } - + public static readonly DependencyProperty DrawOnceProperty = DependencyProperty.Register("DrawOnce", typeof(bool), typeof(ViewLayerGroup), new PropertyMetadata(default(bool), (d, e) => { @@ -487,7 +487,7 @@ public ObservableCollection DataMap set { SetValue(DataMapProperty, value); } } - + public static readonly DependencyProperty DataMapProperty = DependencyProperty.Register("DataMap", typeof(ObservableCollection), typeof(DataLayerGroup), new PropertyMetadata(default(ObservableCollection), (d, e) => { diff --git a/Source/Controls/H.Controls.Chart2D/Provider/ThumbToolBar.xaml.cs b/Source/Controls/H.Controls.Chart2D/Provider/ThumbToolBar.xaml.cs index 4bf0bd37..fb5751ff 100644 --- a/Source/Controls/H.Controls.Chart2D/Provider/ThumbToolBar.xaml.cs +++ b/Source/Controls/H.Controls.Chart2D/Provider/ThumbToolBar.xaml.cs @@ -35,9 +35,9 @@ public override void OnApplyTemplate() { base.OnApplyTemplate(); - this._center_thumb = Template.FindName("PART_CENTER_THUMB", this) as ThumbBar; + this._center_thumb = this.Template.FindName("PART_CENTER_THUMB", this) as ThumbBar; - this._center = Template.FindName("PART_CENTER", this) as Canvas; + this._center = this.Template.FindName("PART_CENTER", this) as Canvas; this._center_thumb.DragDeltaChanged += (l, k) => { @@ -99,7 +99,7 @@ public double MaxValue set { SetValue(MaxValueProperty, value); } } - + public static readonly DependencyProperty MaxValueProperty = DependencyProperty.Register("MaxValue", typeof(double), typeof(ThumbToolBar), new PropertyMetadata(100.0, (d, e) => { @@ -127,11 +127,11 @@ private void RefreshData(ThumbType thumb) if (thumb == ThumbType.Left) { - this.LeftPercent = ((left * MaxValue) - (left * MaxValue % minSplite)) / MaxValue; + this.LeftPercent = ((left * this.MaxValue) - (left * this.MaxValue % minSplite)) / this.MaxValue; } else if (thumb == ThumbType.Right) { - this.RightPercent = ((right * MaxValue) - (right * MaxValue % minSplite) + minSplite) / MaxValue; + this.RightPercent = ((right * this.MaxValue) - (right * this.MaxValue % minSplite) + minSplite) / this.MaxValue; } else { @@ -139,8 +139,8 @@ private void RefreshData(ThumbType thumb) //this.RightPercent = Convert.ToDouble((int)(right * MaxValue)) / MaxValue; - this.LeftPercent = ((left * MaxValue) - (left * MaxValue % minSplite)) / MaxValue; - this.RightPercent = ((right * MaxValue) - (right * MaxValue % minSplite)) / MaxValue; + this.LeftPercent = ((left * this.MaxValue) - (left * this.MaxValue % minSplite)) / this.MaxValue; + this.RightPercent = ((right * this.MaxValue) - (right * this.MaxValue % minSplite)) / this.MaxValue; } diff --git a/Source/Controls/H.Controls.Chart2D/Series/Bar.xaml.cs b/Source/Controls/H.Controls.Chart2D/Series/Bar.xaml.cs index b6f82c0a..cc63b8a0 100644 --- a/Source/Controls/H.Controls.Chart2D/Series/Bar.xaml.cs +++ b/Source/Controls/H.Controls.Chart2D/Series/Bar.xaml.cs @@ -28,7 +28,7 @@ public double WidthPercent set { SetValue(WidthPercentProperty, value); } } - + public static readonly DependencyProperty WidthPercentProperty = DependencyProperty.Register("WidthPercent", typeof(double), typeof(BarBase), new PropertyMetadata(0.8, (d, e) => { @@ -49,7 +49,7 @@ public double ItemPercent set { SetValue(ItemPercentProperty, value); } } - + public static readonly DependencyProperty ItemPercentProperty = DependencyProperty.Register("ItemPercent", typeof(double), typeof(BarBase), new PropertyMetadata(1.0, (d, e) => { @@ -69,7 +69,7 @@ public int MulCount set { SetValue(MulCountProperty, value); } } - + public static readonly DependencyProperty MulCountProperty = DependencyProperty.Register("MulCount", typeof(int), typeof(BarBase), new PropertyMetadata(1, (d, e) => { @@ -90,7 +90,7 @@ public int MulIndex set { SetValue(MulIndexProperty, value); } } - + public static readonly DependencyProperty MulIndexProperty = DependencyProperty.Register("MulIndex", typeof(int), typeof(BarBase), new PropertyMetadata(0, (d, e) => { @@ -187,7 +187,7 @@ static StackBarBase() set { SetValue(DataProperty, value); } } - + public static new readonly DependencyProperty DataProperty = DependencyProperty.Register("Data", typeof(ObservableCollection), typeof(StackBarBase), new PropertyMetadata(new ObservableCollection(), (d, e) => { @@ -216,7 +216,7 @@ protected override void InitDataBoolean(int count, bool value = true) set { SetValue(ForegroundProperty, value); } } - + public static new readonly DependencyProperty ForegroundProperty = DependencyProperty.Register("Foreground", typeof(ObservableCollection), typeof(StackBarBase), new PropertyMetadata(new ObservableCollection(), (d, e) => { @@ -479,7 +479,7 @@ public DoubleCollection AnimationData set { SetValue(AnimationDataDataProperty, value); } } - + public static readonly DependencyProperty AnimationDataDataProperty = DependencyProperty.Register("AnimationData", typeof(DoubleCollection), typeof(yAnimationBar), new PropertyMetadata(default(DoubleCollection), (d, e) => { @@ -499,7 +499,7 @@ public double Duration set { SetValue(DurationProperty, value); } } - + public static readonly DependencyProperty DurationProperty = DependencyProperty.Register("Duration", typeof(double), typeof(yAnimationBar), new PropertyMetadata(500.0, (d, e) => { diff --git a/Source/Controls/H.Controls.Chart2D/Series/FlagTip.xaml.cs b/Source/Controls/H.Controls.Chart2D/Series/FlagTip.xaml.cs index aad5a367..8aa0dbcb 100644 --- a/Source/Controls/H.Controls.Chart2D/Series/FlagTip.xaml.cs +++ b/Source/Controls/H.Controls.Chart2D/Series/FlagTip.xaml.cs @@ -134,7 +134,7 @@ public Path X set { SetValue(XProperty, value); } } - + public static readonly DependencyProperty XProperty = DependencyProperty.Register("X", typeof(Path), typeof(FlagTip), new PropertyMetadata(default(Path), (d, e) => { @@ -152,7 +152,7 @@ public Path Y set { SetValue(YProperty, value); } } - + public static readonly DependencyProperty YProperty = DependencyProperty.Register("Y", typeof(Path), typeof(FlagTip), new PropertyMetadata(default(Path), (d, e) => { @@ -171,7 +171,7 @@ public Label LabelX set { SetValue(LabelXProperty, value); } } - + public static readonly DependencyProperty LabelXProperty = DependencyProperty.Register("LabelX", typeof(Label), typeof(FlagTip), new PropertyMetadata(default(Label), (d, e) => { @@ -190,7 +190,7 @@ public Label LabelY set { SetValue(LabelYProperty, value); } } - + public static readonly DependencyProperty LabelYProperty = DependencyProperty.Register("LabelY", typeof(Label), typeof(FlagTip), new PropertyMetadata(default(Label), (d, e) => { @@ -209,7 +209,7 @@ public Shape Marker set { SetValue(MarkerProperty, value); } } - + public static readonly DependencyProperty MarkerProperty = DependencyProperty.Register("Marker", typeof(Shape), typeof(FlagTip), new PropertyMetadata(default(Shape), (d, e) => { @@ -296,7 +296,7 @@ public FlagTipType FlagTipType set { SetValue(FlagTipTypeProperty, value); } } - + public static readonly DependencyProperty FlagTipTypeProperty = DependencyProperty.Register("FlagTipType", typeof(FlagTipType), typeof(FlagTip), new PropertyMetadata(default(FlagTipType), (d, e) => { diff --git a/Source/Controls/H.Controls.Chart2D/Series/Line.xaml.cs b/Source/Controls/H.Controls.Chart2D/Series/Line.xaml.cs index 2dec668d..3e14f175 100644 --- a/Source/Controls/H.Controls.Chart2D/Series/Line.xaml.cs +++ b/Source/Controls/H.Controls.Chart2D/Series/Line.xaml.cs @@ -27,7 +27,7 @@ public ThinningType ThinningType set { SetValue(ThinningTypeProperty, value); } } - + public static readonly DependencyProperty ThinningTypeProperty = DependencyProperty.Register("ThinningType", typeof(ThinningType), typeof(LineBase), new PropertyMetadata(default(ThinningType), (d, e) => { @@ -46,7 +46,7 @@ public int Threshold set { SetValue(ThresholdProperty, value); } } - + public static readonly DependencyProperty ThresholdProperty = DependencyProperty.Register("Threshold", typeof(int), typeof(LineBase), new PropertyMetadata(10, (d, e) => { @@ -65,7 +65,7 @@ public bool AlignmentCenter set { SetValue(AlignmentCenterProperty, value); } } - + public static readonly DependencyProperty AlignmentCenterProperty = DependencyProperty.Register("AlignmentCenter", typeof(bool), typeof(LineBase), new PropertyMetadata(default(bool), (d, e) => { @@ -219,7 +219,7 @@ protected virtual void DrawLine(Canvas canvas) } - IEnumerable setters = PathStyle?.Setters.OfType(); + IEnumerable setters = this.PathStyle?.Setters.OfType(); object st = setters?.FirstOrDefault(l => l.Property.Name == "StrokeThickness")?.Value; @@ -297,7 +297,7 @@ public bool UseSmooth set { SetValue(UseSmoothProperty, value); } } - + public static readonly DependencyProperty UseSmoothProperty = DependencyProperty.Register("UseSmooth", typeof(bool), typeof(Area), new FrameworkPropertyMetadata(default(bool), (d, e) => { @@ -326,7 +326,7 @@ public Style PathAreaStyle set { SetValue(PathAreaStyleProperty, value); } } - + public static readonly DependencyProperty PathAreaStyleProperty = DependencyProperty.Register("PathAreaStyle", typeof(Style), typeof(Area), new FrameworkPropertyMetadata(default(Style), (d, e) => { @@ -353,7 +353,7 @@ public Brush AreaBackground set { SetValue(AreaBackgroundProperty, value); } } - + public static readonly DependencyProperty AreaBackgroundProperty = DependencyProperty.Register("AreaBackground", typeof(Brush), typeof(Area), new FrameworkPropertyMetadata(default(Brush), (d, e) => { @@ -484,7 +484,7 @@ public double Len set { SetValue(LenProperty, value); } } - + public static readonly DependencyProperty LenProperty = DependencyProperty.Register("Len", typeof(double), typeof(PolarLine), new PropertyMetadata(200.0, (d, e) => { @@ -674,7 +674,7 @@ protected virtual void DrawLine(Canvas canvas) public class StepLine : LineBase { - public static ComponentResourceKey DefaultKey => new ComponentResourceKey(typeof(StepLine), "S.StepLine.Default"); + public static new ComponentResourceKey DefaultKey => new ComponentResourceKey(typeof(StepLine), "S.StepLine.Default"); static StepLine() { @@ -687,7 +687,7 @@ public StepType StepType set { SetValue(StepTypeProperty, value); } } - + public static readonly DependencyProperty StepTypeProperty = DependencyProperty.Register("StepType", typeof(StepType), typeof(StepLine), new PropertyMetadata(default(StepType), (d, e) => { @@ -819,7 +819,7 @@ public Brush ForegroundContrarty set { SetValue(ForegroundContrartyProperty, value); } } - + public static readonly DependencyProperty ForegroundContrartyProperty = DependencyProperty.Register("ForegroundContrarty", typeof(Brush), typeof(Candlestick), new PropertyMetadata(default(Brush), (d, e) => { @@ -843,7 +843,7 @@ public Brush ForegroundContrarty set { SetValue(DataProperty, value); } } - + public static new readonly DependencyProperty DataProperty = DependencyProperty.Register("Data", typeof(ObservableCollection), typeof(Candlestick), new PropertyMetadata(default(ObservableCollection), (d, e) => { @@ -861,7 +861,7 @@ public double WidthPercent set { SetValue(WidthPercentProperty, value); } } - + public static readonly DependencyProperty WidthPercentProperty = DependencyProperty.Register("WidthPercent", typeof(double), typeof(Candlestick), new PropertyMetadata(0.5, (d, e) => { diff --git a/Source/Controls/H.Controls.Chart2D/Series/MarkLine.xaml.cs b/Source/Controls/H.Controls.Chart2D/Series/MarkLine.xaml.cs index fac3f87b..f68d9164 100644 --- a/Source/Controls/H.Controls.Chart2D/Series/MarkLine.xaml.cs +++ b/Source/Controls/H.Controls.Chart2D/Series/MarkLine.xaml.cs @@ -32,7 +32,7 @@ public Style TrangleStyle set { SetValue(TrangleStyleProperty, value); } } - + public static readonly DependencyProperty TrangleStyleProperty = DependencyProperty.Register("TrangleStyle", typeof(Style), typeof(MarkLine), new PropertyMetadata(default(Style), (d, e) => { @@ -53,7 +53,7 @@ public Orientation Orientation set { SetValue(OrientationProperty, value); } } - + public static readonly DependencyProperty OrientationProperty = DependencyProperty.Register("Orientation", typeof(Orientation), typeof(MarkLine), new PropertyMetadata(default(Orientation), (d, e) => { @@ -73,7 +73,7 @@ public ObservableCollection MarkBrushes set { SetValue(MarkBrushesProperty, value); } } - + public static readonly DependencyProperty MarkBrushesProperty = DependencyProperty.Register("MarkBrushes", typeof(ObservableCollection), typeof(MarkLine), new PropertyMetadata(new ObservableCollection(), (d, e) => { @@ -94,7 +94,7 @@ public Point Start set { SetValue(StartProperty, value); } } - + public static readonly DependencyProperty StartProperty = DependencyProperty.Register("Start", typeof(Point), typeof(MarkLine), new PropertyMetadata(default(Point), (d, e) => { @@ -114,7 +114,7 @@ public Point End set { SetValue(EndProperty, value); } } - + public static readonly DependencyProperty EndProperty = DependencyProperty.Register("End", typeof(Point), typeof(MarkLine), new PropertyMetadata(default(Point), (d, e) => { @@ -336,7 +336,7 @@ public MarkLineType MarkLineType set { SetValue(MarkLineTypeProperty, value); } } - + public static readonly DependencyProperty MarkLineTypeProperty = DependencyProperty.Register("MarkLineType", typeof(MarkLineType), typeof(MarkLine), new PropertyMetadata(default(MarkLineType), (d, e) => { @@ -389,7 +389,7 @@ public double Value set { SetValue(ValueProperty, value); } } - + public static readonly DependencyProperty ValueProperty = DependencyProperty.Register("Value", typeof(double), typeof(MarkLine), new FrameworkPropertyMetadata(double.NaN, (d, e) => { diff --git a/Source/Controls/H.Controls.Chart2D/Series/MarkPosition.xaml.cs b/Source/Controls/H.Controls.Chart2D/Series/MarkPosition.xaml.cs index 18550111..0b96d462 100644 --- a/Source/Controls/H.Controls.Chart2D/Series/MarkPosition.xaml.cs +++ b/Source/Controls/H.Controls.Chart2D/Series/MarkPosition.xaml.cs @@ -23,7 +23,7 @@ public double WidthPercent set { SetValue(WidthPercentProperty, value); } } - + public static readonly DependencyProperty WidthPercentProperty = DependencyProperty.Register("WidthPercent", typeof(double), typeof(MarkPosition), new PropertyMetadata(0.8, (d, e) => { @@ -43,7 +43,7 @@ public double ItemPercent set { SetValue(ItemPercentProperty, value); } } - + public static readonly DependencyProperty ItemPercentProperty = DependencyProperty.Register("ItemPercent", typeof(double), typeof(MarkPosition), new PropertyMetadata(1.0, (d, e) => { @@ -63,7 +63,7 @@ public int MulCount set { SetValue(MulCountProperty, value); } } - + public static readonly DependencyProperty MulCountProperty = DependencyProperty.Register("MulCount", typeof(int), typeof(MarkPosition), new PropertyMetadata(1, (d, e) => { @@ -84,7 +84,7 @@ public int MulIndex set { SetValue(MulIndexProperty, value); } } - + public static readonly DependencyProperty MulIndexProperty = DependencyProperty.Register("MulIndex", typeof(int), typeof(MarkPosition), new PropertyMetadata(0, (d, e) => { @@ -103,7 +103,7 @@ public bool AlignmentCenter set { SetValue(AlignmentCenterProperty, value); } } - + public static readonly DependencyProperty AlignmentCenterProperty = DependencyProperty.Register("AlignmentCenter", typeof(bool), typeof(MarkPosition), new PropertyMetadata(default(bool), (d, e) => { @@ -124,7 +124,7 @@ public Brush MarkForeground set { SetValue(MarkForegroundProperty, value); } } - + public static readonly DependencyProperty MarkForegroundProperty = DependencyProperty.Register("MarkForeground", typeof(Brush), typeof(MarkPosition), new FrameworkPropertyMetadata(Brushes.White, (d, e) => { @@ -165,7 +165,7 @@ public MarkValueType MarkValueType set { SetValue(MarkValueTypeProperty, value); } } - + public static readonly DependencyProperty MarkValueTypeProperty = DependencyProperty.Register("MarkValueType", typeof(MarkValueType), typeof(MarkPosition), new PropertyMetadata(default(MarkValueType), (d, e) => { @@ -187,7 +187,7 @@ public Point Point set { SetValue(PointProperty, value); } } - + public static readonly DependencyProperty PointProperty = DependencyProperty.Register("Point", typeof(Point), typeof(MarkPosition), new PropertyMetadata(default(Point), (d, e) => { diff --git a/Source/Controls/H.Controls.Chart2D/Series/MarkTip.xaml.cs b/Source/Controls/H.Controls.Chart2D/Series/MarkTip.xaml.cs index 189b0df7..e6a74b2b 100644 --- a/Source/Controls/H.Controls.Chart2D/Series/MarkTip.xaml.cs +++ b/Source/Controls/H.Controls.Chart2D/Series/MarkTip.xaml.cs @@ -139,7 +139,7 @@ public MarkTipType MarkTipType set { SetValue(MarkTipTypeProperty, value); } } - + public static readonly DependencyProperty MarkTipTypeProperty = DependencyProperty.Register("MarkTipType", typeof(MarkTipType), typeof(FlagTip), new PropertyMetadata(default(MarkTipType), (d, e) => { diff --git a/Source/Controls/H.Controls.Chart2D/Series/Pie.xaml.cs b/Source/Controls/H.Controls.Chart2D/Series/Pie.xaml.cs index 0101c15e..0c469de7 100644 --- a/Source/Controls/H.Controls.Chart2D/Series/Pie.xaml.cs +++ b/Source/Controls/H.Controls.Chart2D/Series/Pie.xaml.cs @@ -42,7 +42,7 @@ static Pie() set { SetValue(ForegroundProperty, value); } } - + public static new readonly DependencyProperty ForegroundProperty = DependencyProperty.Register("Foreground", typeof(ObservableCollection), typeof(Pie), new PropertyMetadata(new ObservableCollection(), (d, e) => { @@ -62,7 +62,7 @@ public double Len set { SetValue(LenProperty, value); } } - + public static readonly DependencyProperty LenProperty = DependencyProperty.Register("Len", typeof(double), typeof(Pie), new PropertyMetadata(double.NaN, (d, e) => { @@ -83,7 +83,7 @@ public double CircleLen set { SetValue(CircleLenProperty, value); } } - + public static readonly DependencyProperty CircleLenProperty = DependencyProperty.Register("CircleLen", typeof(double), typeof(Pie), new PropertyMetadata(0.0, (d, e) => { @@ -105,7 +105,7 @@ public bool IsCustomized set { SetValue(IsCustomizedProperty, value); } } - + public static readonly DependencyProperty IsCustomizedProperty = DependencyProperty.Register("IsCustomized", typeof(bool), typeof(Pie), new PropertyMetadata(default(bool), (d, e) => { @@ -127,7 +127,7 @@ public Style EllipseStyle set { SetValue(EllipseStyleProperty, value); } } - + public static readonly DependencyProperty EllipseStyleProperty = DependencyProperty.Register("EllipseStyle", typeof(Style), typeof(Pie), new PropertyMetadata(default(Style), (d, e) => { @@ -172,7 +172,7 @@ public override void Draw(Canvas canvas) bool use = this.DataBoolean.Count > i ? this.DataBoolean[i] : true; // Do :半径 - double len = Len == double.NaN ? min / 2 : Len; + double len = this.Len == double.NaN ? min / 2 : this.Len; double y = use ? this.Data[i] : 0; diff --git a/Source/Controls/H.Controls.Chart2D/Series/Scatter.xaml.cs b/Source/Controls/H.Controls.Chart2D/Series/Scatter.xaml.cs index 2e999951..a977b623 100644 --- a/Source/Controls/H.Controls.Chart2D/Series/Scatter.xaml.cs +++ b/Source/Controls/H.Controls.Chart2D/Series/Scatter.xaml.cs @@ -20,7 +20,7 @@ public bool AlignmentCenter set { SetValue(AlignmentCenterProperty, value); } } - + public static readonly DependencyProperty AlignmentCenterProperty = DependencyProperty.Register("AlignmentCenter", typeof(bool), typeof(ScatterBase), new PropertyMetadata(default(bool), (d, e) => { @@ -56,7 +56,7 @@ public int ShowCount set { SetValue(ShowCountProperty, value); } } - + public static readonly DependencyProperty ShowCountProperty = DependencyProperty.Register("ShowCount", typeof(int), typeof(ScatterBase), new PropertyMetadata(500, (d, e) => { @@ -137,7 +137,7 @@ static AreaScatter() set { SetValue(DataProperty, value); } } - + public static new readonly DependencyProperty DataProperty = DependencyProperty.Register("Data", typeof(ObservableCollection), typeof(AreaScatter), new PropertyMetadata(new ObservableCollection(), (d, e) => { @@ -196,7 +196,7 @@ public DoubleCollection BubbleData set { SetValue(BubbleDataProperty, value); } } - + public static readonly DependencyProperty BubbleDataProperty = DependencyProperty.Register("BubbleData", typeof(DoubleCollection), typeof(Bubble), new PropertyMetadata(default(DoubleCollection), (d, e) => { @@ -262,7 +262,7 @@ public double Len set { SetValue(LenProperty, value); } } - + public static readonly DependencyProperty LenProperty = DependencyProperty.Register("Len", typeof(double), typeof(PolarScatter), new PropertyMetadata(200.0, (d, e) => { @@ -327,7 +327,7 @@ public DoubleCollection BubbleData set { SetValue(BubbleDataProperty, value); } } - + public static readonly DependencyProperty BubbleDataProperty = DependencyProperty.Register("BubbleData", typeof(DoubleCollection), typeof(PolarBubble), new PropertyMetadata(default(DoubleCollection), (d, e) => { @@ -346,7 +346,7 @@ public double Len set { SetValue(LenProperty, value); } } - + public static readonly DependencyProperty LenProperty = DependencyProperty.Register("Len", typeof(double), typeof(PolarBubble), new PropertyMetadata(200.0, (d, e) => { diff --git a/Source/Controls/H.Controls.Chart2D/Series/Series.xaml.cs b/Source/Controls/H.Controls.Chart2D/Series/Series.xaml.cs index d62ee5b1..b61956ec 100644 --- a/Source/Controls/H.Controls.Chart2D/Series/Series.xaml.cs +++ b/Source/Controls/H.Controls.Chart2D/Series/Series.xaml.cs @@ -25,7 +25,7 @@ public Style LineStyle set { SetValue(LineStyleProperty, value); } } - + public static readonly DependencyProperty LineStyleProperty = DependencyProperty.Register("LineStyle", typeof(Style), typeof(Series), new PropertyMetadata(default(Style), (d, e) => { @@ -44,7 +44,7 @@ public Style ScatterStyle set { SetValue(ScatterStyleProperty, value); } } - + public static readonly DependencyProperty ScatterStyleProperty = DependencyProperty.Register("ScatterStyle", typeof(Style), typeof(Series), new PropertyMetadata(default(Style), (d, e) => { @@ -64,7 +64,7 @@ public Style BarStyle set { SetValue(BarStyleProperty, value); } } - + public static readonly DependencyProperty BarStyleProperty = DependencyProperty.Register("BarStyle", typeof(Style), typeof(Series), new PropertyMetadata(default(Style), (d, e) => { diff --git a/Source/Controls/H.Controls.Chart2D/Series/Title.xaml.cs b/Source/Controls/H.Controls.Chart2D/Series/Title.xaml.cs index b495bba7..2fcd6a3d 100644 --- a/Source/Controls/H.Controls.Chart2D/Series/Title.xaml.cs +++ b/Source/Controls/H.Controls.Chart2D/Series/Title.xaml.cs @@ -20,7 +20,7 @@ public string Text set { SetValue(TextProperty, value); } } - + public static readonly DependencyProperty TextProperty = DependencyProperty.Register("Text", typeof(string), typeof(Title), new PropertyMetadata(default(string), (d, e) => { @@ -39,7 +39,7 @@ public string Description set { SetValue(DescriptionProperty, value); } } - + public static readonly DependencyProperty DescriptionProperty = DependencyProperty.Register("Description", typeof(string), typeof(Title), new PropertyMetadata(default(string), (d, e) => { @@ -57,7 +57,7 @@ public override void Draw(Canvas canvas) base.Draw(canvas); // Do :显示文本 - Label label = new Label() { Content = Text }; + Label label = new Label() { Content = this.Text }; label.Style = this.LabelStyle; diff --git a/Source/Controls/H.Controls.Chart2D/Series/VisualMap.xaml.cs b/Source/Controls/H.Controls.Chart2D/Series/VisualMap.xaml.cs index 3dd78d8c..05032bee 100644 --- a/Source/Controls/H.Controls.Chart2D/Series/VisualMap.xaml.cs +++ b/Source/Controls/H.Controls.Chart2D/Series/VisualMap.xaml.cs @@ -28,7 +28,7 @@ public ObservableCollection MarkBrushes set { SetValue(MarkBrushesProperty, value); } } - + public static readonly DependencyProperty MarkBrushesProperty = DependencyProperty.Register("MarkBrushes", typeof(ObservableCollection), typeof(VisualMap), new PropertyMetadata(new ObservableCollection(), (d, e) => { diff --git a/Source/Controls/H.Controls.ColorBox/ColorBox.xaml.cs b/Source/Controls/H.Controls.ColorBox/ColorBox.xaml.cs index 86a86691..e3f45e27 100644 --- a/Source/Controls/H.Controls.ColorBox/ColorBox.xaml.cs +++ b/Source/Controls/H.Controls.ColorBox/ColorBox.xaml.cs @@ -1,25 +1,5 @@ - -using System; -using System.Collections.Generic; -using System.ComponentModel; -using System.Diagnostics; -using System.Linq; -using System.Net.NetworkInformation; -using System.Text; -using System.Threading; -using System.Threading.Tasks; -using System.Windows; -using System.Windows.Controls; +using System.Windows; using System.Windows.Controls.Primitives; -using System.Windows.Data; -using System.Windows.Documents; -using System.Windows.Input; -using System.Windows.Markup; -using System.Windows.Media; -using System.Windows.Media.Imaging; -using System.Windows.Navigation; -using System.Windows.Shapes; -using System.Windows.Threading; namespace H.Controls.ColorBox { diff --git a/Source/Controls/H.Controls.ColorBox/ColorSourceExtension.cs b/Source/Controls/H.Controls.ColorBox/ColorSourceExtension.cs index 33f07683..c0b71af5 100644 --- a/Source/Controls/H.Controls.ColorBox/ColorSourceExtension.cs +++ b/Source/Controls/H.Controls.ColorBox/ColorSourceExtension.cs @@ -1,10 +1,5 @@  using H.Extensions.Color; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Windows.Markup; -using System.Windows.Media; namespace H.Controls.ColorBox { diff --git a/Source/Controls/H.Controls.ColorBox/Service.cs b/Source/Controls/H.Controls.ColorBox/Service.cs index edaa7a82..4c0cb43e 100644 --- a/Source/Controls/H.Controls.ColorBox/Service.cs +++ b/Source/Controls/H.Controls.ColorBox/Service.cs @@ -4,9 +4,7 @@ using H.Providers.Ioc; using System.ComponentModel; using System.ComponentModel.DataAnnotations; -using System.Windows; using System.Windows.Media; -using System.Xml.Serialization; namespace H.Controls.ColorBox { diff --git a/Source/Controls/H.Controls.ColorPicker/Behaviors/TextBoxFocusBehavior.cs b/Source/Controls/H.Controls.ColorPicker/Behaviors/TextBoxFocusBehavior.cs index 20f5cc30..03bb33ea 100644 --- a/Source/Controls/H.Controls.ColorPicker/Behaviors/TextBoxFocusBehavior.cs +++ b/Source/Controls/H.Controls.ColorPicker/Behaviors/TextBoxFocusBehavior.cs @@ -49,27 +49,27 @@ public bool DeselectOnFocusLoss protected override void OnAttached() { base.OnAttached(); - AssociatedObject.GotKeyboardFocus += AssociatedObjectGotKeyboardFocus; - AssociatedObject.GotMouseCapture += AssociatedObjectGotMouseCapture; - AssociatedObject.LostFocus += AssociatedObject_LostFocus; - AssociatedObject.PreviewMouseLeftButtonDown += AssociatedObjectPreviewMouseLeftButtonDown; - AssociatedObject.KeyUp += AssociatedObject_KeyUp; + this.AssociatedObject.GotKeyboardFocus += AssociatedObjectGotKeyboardFocus; + this.AssociatedObject.GotMouseCapture += AssociatedObjectGotMouseCapture; + this.AssociatedObject.LostFocus += AssociatedObject_LostFocus; + this.AssociatedObject.PreviewMouseLeftButtonDown += AssociatedObjectPreviewMouseLeftButtonDown; + this.AssociatedObject.KeyUp += AssociatedObject_KeyUp; } protected override void OnDetaching() { base.OnDetaching(); - AssociatedObject.GotKeyboardFocus -= AssociatedObjectGotKeyboardFocus; - AssociatedObject.GotMouseCapture -= AssociatedObjectGotMouseCapture; - AssociatedObject.LostFocus -= AssociatedObject_LostFocus; - AssociatedObject.PreviewMouseLeftButtonDown -= AssociatedObjectPreviewMouseLeftButtonDown; - AssociatedObject.KeyUp -= AssociatedObject_KeyUp; + this.AssociatedObject.GotKeyboardFocus -= AssociatedObjectGotKeyboardFocus; + this.AssociatedObject.GotMouseCapture -= AssociatedObjectGotMouseCapture; + this.AssociatedObject.LostFocus -= AssociatedObject_LostFocus; + this.AssociatedObject.PreviewMouseLeftButtonDown -= AssociatedObjectPreviewMouseLeftButtonDown; + this.AssociatedObject.KeyUp -= AssociatedObject_KeyUp; } // Converts number to proper format if enter is clicked and moves focus to next object private void AssociatedObject_KeyUp(object sender, KeyEventArgs e) { - if (e.Key != Key.Enter || !ConfirmOnEnter) + if (e.Key != Key.Enter || !this.ConfirmOnEnter) return; RemoveFocus(); @@ -77,8 +77,8 @@ private void AssociatedObject_KeyUp(object sender, KeyEventArgs e) private void RemoveFocus() { - var scope = FocusManager.GetFocusScope(AssociatedObject); - var parent = (FrameworkElement)AssociatedObject.Parent; + var scope = FocusManager.GetFocusScope(this.AssociatedObject); + var parent = (FrameworkElement)this.AssociatedObject.Parent; while (parent != null && parent is IInputElement element && !element.Focusable) parent = (FrameworkElement)parent.Parent; @@ -91,32 +91,32 @@ private void AssociatedObjectGotKeyboardFocus( object sender, KeyboardFocusChangedEventArgs e) { - if (SelectOnMouseClick || e.KeyboardDevice.IsKeyDown(Key.Tab)) - AssociatedObject.SelectAll(); + if (this.SelectOnMouseClick || e.KeyboardDevice.IsKeyDown(Key.Tab)) + this.AssociatedObject.SelectAll(); } private void AssociatedObjectGotMouseCapture( object sender, MouseEventArgs e) { - if (SelectOnMouseClick) - AssociatedObject.SelectAll(); + if (this.SelectOnMouseClick) + this.AssociatedObject.SelectAll(); } private void AssociatedObject_LostFocus(object sender, RoutedEventArgs e) { - if (DeselectOnFocusLoss) - AssociatedObject.Select(0, 0); + if (this.DeselectOnFocusLoss) + this.AssociatedObject.Select(0, 0); } private void AssociatedObjectPreviewMouseLeftButtonDown(object sender, MouseButtonEventArgs e) { - if (!SelectOnMouseClick) + if (!this.SelectOnMouseClick) return; - if (!AssociatedObject.IsKeyboardFocusWithin) + if (!this.AssociatedObject.IsKeyboardFocusWithin) { - AssociatedObject.Focus(); + this.AssociatedObject.Focus(); e.Handled = true; } } diff --git a/Source/Controls/H.Controls.ColorPicker/Converters/BoolToVisibilityConverter.cs b/Source/Controls/H.Controls.ColorPicker/Converters/BoolToVisibilityConverter.cs index 60ffcc3a..45a3be83 100644 --- a/Source/Controls/H.Controls.ColorPicker/Converters/BoolToVisibilityConverter.cs +++ b/Source/Controls/H.Controls.ColorPicker/Converters/BoolToVisibilityConverter.cs @@ -20,7 +20,7 @@ public bool Invert public object Convert(object value, Type targetType, object parameter, CultureInfo culture) { - var actualValue = (bool)value ^ Invert; + var actualValue = (bool)value ^ this.Invert; return actualValue ? Visibility.Visible : Visibility.Hidden; } diff --git a/Source/Controls/H.Controls.ColorPicker/Converters/ColorToHexConverter.cs b/Source/Controls/H.Controls.ColorPicker/Converters/ColorToHexConverter.cs index 4cdaed93..9e6e7673 100644 --- a/Source/Controls/H.Controls.ColorPicker/Converters/ColorToHexConverter.cs +++ b/Source/Controls/H.Controls.ColorPicker/Converters/ColorToHexConverter.cs @@ -33,7 +33,7 @@ public bool ShowAlpha public object Convert(object value, Type targetType, object parameter, CultureInfo culture) { Color c = (Color)value; - return HexHelper.RgbaValuesToString(c.R, c.G, c.B, c.A, ShowAlpha, HexRepresentation) ?? DependencyProperty.UnsetValue; + return HexHelper.RgbaValuesToString(c.R, c.G, c.B, c.A, this.ShowAlpha, this.HexRepresentation) ?? DependencyProperty.UnsetValue; } public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) @@ -41,7 +41,7 @@ public object ConvertBack(object value, Type targetType, object parameter, Cultu if (!(value is string)) return DependencyProperty.UnsetValue; - var values = HexHelper.ParseInputtedHexStringToRgbaValues((string)value, ShowAlpha, HexRepresentation); + var values = HexHelper.ParseInputtedHexStringToRgbaValues((string)value, this.ShowAlpha, this.HexRepresentation); if (values is null) return DependencyProperty.UnsetValue; diff --git a/Source/Controls/H.Controls.ColorPicker/Converters/RangeConstrainedDoubleToDoubleConverter.cs b/Source/Controls/H.Controls.ColorPicker/Converters/RangeConstrainedDoubleToDoubleConverter.cs index d297d88f..eae2629b 100644 --- a/Source/Controls/H.Controls.ColorPicker/Converters/RangeConstrainedDoubleToDoubleConverter.cs +++ b/Source/Controls/H.Controls.ColorPicker/Converters/RangeConstrainedDoubleToDoubleConverter.cs @@ -39,7 +39,7 @@ public object ConvertBack(object value, Type targetType, object parameter, Cultu if (!double.TryParse(((string)value).Replace(',', '.'), NumberStyles.Float, CultureInfo.InvariantCulture, out var result)) return DependencyProperty.UnsetValue; - return MathHelper.Clamp(result, Min, Max); + return MathHelper.Clamp(result, this.Min, this.Max); } } } \ No newline at end of file diff --git a/Source/Controls/H.Controls.ColorPicker/DualPickerControlBase.cs b/Source/Controls/H.Controls.ColorPicker/DualPickerControlBase.cs index e8969559..032517c9 100644 --- a/Source/Controls/H.Controls.ColorPicker/DualPickerControlBase.cs +++ b/Source/Controls/H.Controls.ColorPicker/DualPickerControlBase.cs @@ -44,32 +44,32 @@ public DualPickerControlBase() secondColorDecorator = new SecondColorDecorator(this); hintColorDecorator = new HintColorDecorator(this); - SecondColor = new NotifyableColor(secondColorDecorator); - SecondColor.PropertyChanged += (sender, args) => + this.SecondColor = new NotifyableColor(secondColorDecorator); + this.SecondColor.PropertyChanged += (sender, args) => { if (!ignoreSecondaryColorChange) { ignoreSecondaryColorPropertyChange = true; - SecondaryColor = System.Windows.Media.Color.FromArgb( - (byte)Math.Round(SecondColor.A), - (byte)Math.Round(SecondColor.RGB_R), - (byte)Math.Round(SecondColor.RGB_G), - (byte)Math.Round(SecondColor.RGB_B)); + this.SecondaryColor = System.Windows.Media.Color.FromArgb( + (byte)Math.Round(this.SecondColor.A), + (byte)Math.Round(this.SecondColor.RGB_R), + (byte)Math.Round(this.SecondColor.RGB_G), + (byte)Math.Round(this.SecondColor.RGB_B)); ignoreSecondaryColorPropertyChange = false; } }; - HintNotifyableColor = new NotifyableColor(hintColorDecorator); - HintNotifyableColor.PropertyChanged += (sender, args) => + this.HintNotifyableColor = new NotifyableColor(hintColorDecorator); + this.HintNotifyableColor.PropertyChanged += (sender, args) => { if (!ignoreHintNotifyableColorChange) { ignoreHintColorPropertyChange = true; - HintColor = System.Windows.Media.Color.FromArgb( - (byte)Math.Round(HintNotifyableColor.A), - (byte)Math.Round(HintNotifyableColor.RGB_R), - (byte)Math.Round(HintNotifyableColor.RGB_G), - (byte)Math.Round(HintNotifyableColor.RGB_B)); + this.HintColor = System.Windows.Media.Color.FromArgb( + (byte)Math.Round(this.HintNotifyableColor.A), + (byte)Math.Round(this.HintNotifyableColor.RGB_R), + (byte)Math.Round(this.HintNotifyableColor.RGB_G), + (byte)Math.Round(this.HintNotifyableColor.RGB_B)); ignoreHintColorPropertyChange = false; } }; @@ -111,14 +111,14 @@ public ColorState SecondColorState public void SwapColors() { - var temp = ColorState; - ColorState = SecondColorState; - SecondColorState = temp; + var temp = this.ColorState; + this.ColorState = this.SecondColorState; + this.SecondColorState = temp; } public void SetMainColorFromHintColor() { - ColorState = HintColorState; + this.ColorState = this.HintColorState; } private static void OnSecondColorStatePropertyChange(DependencyObject d, diff --git a/Source/Controls/H.Controls.ColorPicker/EventArgs/ColorRoutedEventArgs.cs b/Source/Controls/H.Controls.ColorPicker/EventArgs/ColorRoutedEventArgs.cs index ef1dc9e2..c21b7409 100644 --- a/Source/Controls/H.Controls.ColorPicker/EventArgs/ColorRoutedEventArgs.cs +++ b/Source/Controls/H.Controls.ColorPicker/EventArgs/ColorRoutedEventArgs.cs @@ -7,7 +7,7 @@ public class ColorRoutedEventArgs : RoutedEventArgs { public ColorRoutedEventArgs(RoutedEvent routedEvent, Color color) : base(routedEvent) { - Color = color; + this.Color = color; } public Color Color { get; private set; } diff --git a/Source/Controls/H.Controls.ColorPicker/Model/ColorState.cs b/Source/Controls/H.Controls.ColorPicker/Model/ColorState.cs index a0484b98..c150ca83 100644 --- a/Source/Controls/H.Controls.ColorPicker/Model/ColorState.cs +++ b/Source/Controls/H.Controls.ColorPicker/Model/ColorState.cs @@ -20,7 +20,7 @@ public ColorState(double rGB_R, double rGB_G, double rGB_B, double a, double hSV _RGB_R = rGB_R; _RGB_G = rGB_G; _RGB_B = rGB_B; - A = a; + this.A = a; _HSV_H = hSV_H; _HSV_S = hSV_S; _HSV_V = hSV_V; @@ -31,7 +31,7 @@ public ColorState(double rGB_R, double rGB_G, double rGB_B, double a, double hSV public void SetARGB(double a, double r, double g, double b) { - A = a; + this.A = a; _RGB_R = r; _RGB_G = g; _RGB_B = b; diff --git a/Source/Controls/H.Controls.ColorPicker/Model/NotifyableColor.cs b/Source/Controls/H.Controls.ColorPicker/Model/NotifyableColor.cs index 822b449b..24f871ca 100644 --- a/Source/Controls/H.Controls.ColorPicker/Model/NotifyableColor.cs +++ b/Source/Controls/H.Controls.ColorPicker/Model/NotifyableColor.cs @@ -144,19 +144,19 @@ public void UpdateEverything(ColorState oldValue) var currentValue = storage.ColorState; if (isUpdating) return; isUpdating = true; - if (currentValue.A != oldValue.A) RaisePropertyChanged(nameof(A)); + if (currentValue.A != oldValue.A) RaisePropertyChanged(nameof(this.A)); - if (currentValue.RGB_R != oldValue.RGB_R) RaisePropertyChanged(nameof(RGB_R)); - if (currentValue.RGB_G != oldValue.RGB_G) RaisePropertyChanged(nameof(RGB_G)); - if (currentValue.RGB_B != oldValue.RGB_B) RaisePropertyChanged(nameof(RGB_B)); + if (currentValue.RGB_R != oldValue.RGB_R) RaisePropertyChanged(nameof(this.RGB_R)); + if (currentValue.RGB_G != oldValue.RGB_G) RaisePropertyChanged(nameof(this.RGB_G)); + if (currentValue.RGB_B != oldValue.RGB_B) RaisePropertyChanged(nameof(this.RGB_B)); - if (currentValue.HSV_H != oldValue.HSV_H) RaisePropertyChanged(nameof(HSV_H)); - if (currentValue.HSV_S != oldValue.HSV_S) RaisePropertyChanged(nameof(HSV_S)); - if (currentValue.HSV_V != oldValue.HSV_V) RaisePropertyChanged(nameof(HSV_V)); + if (currentValue.HSV_H != oldValue.HSV_H) RaisePropertyChanged(nameof(this.HSV_H)); + if (currentValue.HSV_S != oldValue.HSV_S) RaisePropertyChanged(nameof(this.HSV_S)); + if (currentValue.HSV_V != oldValue.HSV_V) RaisePropertyChanged(nameof(this.HSV_V)); - if (currentValue.HSL_H != oldValue.HSL_H) RaisePropertyChanged(nameof(HSL_H)); - if (currentValue.HSL_S != oldValue.HSL_S) RaisePropertyChanged(nameof(HSL_S)); - if (currentValue.HSL_L != oldValue.HSL_L) RaisePropertyChanged(nameof(HSL_L)); + if (currentValue.HSL_H != oldValue.HSL_H) RaisePropertyChanged(nameof(this.HSL_H)); + if (currentValue.HSL_S != oldValue.HSL_S) RaisePropertyChanged(nameof(this.HSL_S)); + if (currentValue.HSL_L != oldValue.HSL_L) RaisePropertyChanged(nameof(this.HSL_L)); isUpdating = false; } } diff --git a/Source/Controls/H.Controls.ColorPicker/PickerControlBase.cs b/Source/Controls/H.Controls.ColorPicker/PickerControlBase.cs index 8a068f33..cf69cf27 100644 --- a/Source/Controls/H.Controls.ColorPicker/PickerControlBase.cs +++ b/Source/Controls/H.Controls.ColorPicker/PickerControlBase.cs @@ -27,14 +27,14 @@ public class PickerControlBase : UserControl, IColorStateStorage public PickerControlBase() { - Color = new NotifyableColor(this); - Color.PropertyChanged += (sender, args) => + this.Color = new NotifyableColor(this); + this.Color.PropertyChanged += (sender, args) => { var newColor = System.Windows.Media.Color.FromArgb( - (byte)Math.Round(Color.A), - (byte)Math.Round(Color.RGB_R), - (byte)Math.Round(Color.RGB_G), - (byte)Math.Round(Color.RGB_B)); + (byte)Math.Round(this.Color.A), + (byte)Math.Round(this.Color.RGB_R), + (byte)Math.Round(this.Color.RGB_G), + (byte)Math.Round(this.Color.RGB_B)); if (newColor != previousColor) { RaiseEvent(new ColorRoutedEventArgs(ColorChangedEvent, newColor)); @@ -46,7 +46,7 @@ public PickerControlBase() if (!ignoreColorChange) { ignoreColorPropertyChange = true; - SelectedColor = ((ColorRoutedEventArgs)newColor).Color; + this.SelectedColor = ((ColorRoutedEventArgs)newColor).Color; ignoreColorPropertyChange = false; } }; diff --git a/Source/Controls/H.Controls.ColorPicker/UIExtensions/HslColorSlider.cs b/Source/Controls/H.Controls.ColorPicker/UIExtensions/HslColorSlider.cs index ab277949..d5ab7670 100644 --- a/Source/Controls/H.Controls.ColorPicker/UIExtensions/HslColorSlider.cs +++ b/Source/Controls/H.Controls.ColorPicker/UIExtensions/HslColorSlider.cs @@ -10,7 +10,7 @@ internal class HslColorSlider : PreviewColorSlider DependencyProperty.Register(nameof(SliderHslType), typeof(string), typeof(HslColorSlider), new PropertyMetadata("")); - protected override bool RefreshGradient => SliderHslType != "H"; + protected override bool RefreshGradient => this.SliderHslType != "H"; public string SliderHslType { @@ -20,13 +20,13 @@ public string SliderHslType protected override void GenerateBackground() { - if (SliderHslType == "H") + if (this.SliderHslType == "H") { var colorStart = GetColorForSelectedArgb(0); var colorEnd = GetColorForSelectedArgb(360); - LeftCapColor.Color = colorStart; - RightCapColor.Color = colorEnd; - BackgroundGradient = new GradientStopCollection + this.LeftCapColor.Color = colorStart; + this.RightCapColor.Color = colorEnd; + this.BackgroundGradient = new GradientStopCollection { new GradientStop(colorStart, 0), new GradientStop(GetColorForSelectedArgb(60), 1 / 6.0), @@ -39,13 +39,13 @@ protected override void GenerateBackground() return; } - if (SliderHslType == "L") + if (this.SliderHslType == "L") { var colorStart = GetColorForSelectedArgb(0); var colorEnd = GetColorForSelectedArgb(255); - LeftCapColor.Color = colorStart; - RightCapColor.Color = colorEnd; - BackgroundGradient = new GradientStopCollection + this.LeftCapColor.Color = colorStart; + this.RightCapColor.Color = colorEnd; + this.BackgroundGradient = new GradientStopCollection { new GradientStop(colorStart, 0), new GradientStop(GetColorForSelectedArgb(128), 0.5), @@ -57,9 +57,9 @@ protected override void GenerateBackground() { var colorStart = GetColorForSelectedArgb(0); var colorEnd = GetColorForSelectedArgb(255); - LeftCapColor.Color = colorStart; - RightCapColor.Color = colorEnd; - BackgroundGradient = new GradientStopCollection + this.LeftCapColor.Color = colorStart; + this.RightCapColor.Color = colorEnd; + this.BackgroundGradient = new GradientStopCollection { new GradientStop(colorStart, 0.0), new GradientStop(colorEnd, 1) @@ -69,7 +69,7 @@ protected override void GenerateBackground() private Color GetColorForSelectedArgb(int value) { - switch (SliderHslType) + switch (this.SliderHslType) { case "H": { @@ -79,21 +79,21 @@ private Color GetColorForSelectedArgb(int value) } case "S": { - var rgbtuple = ColorSpaceHelper.HslToRgb(CurrentColorState.HSL_H, value / 255.0, - CurrentColorState.HSL_L); + var rgbtuple = ColorSpaceHelper.HslToRgb(this.CurrentColorState.HSL_H, value / 255.0, + this.CurrentColorState.HSL_L); double r = rgbtuple.Item1, g = rgbtuple.Item2, b = rgbtuple.Item3; return Color.FromArgb(255, (byte)(r * 255), (byte)(g * 255), (byte)(b * 255)); } case "L": { - var rgbtuple = ColorSpaceHelper.HslToRgb(CurrentColorState.HSL_H, CurrentColorState.HSL_S, + var rgbtuple = ColorSpaceHelper.HslToRgb(this.CurrentColorState.HSL_H, this.CurrentColorState.HSL_S, value / 255.0); double r = rgbtuple.Item1, g = rgbtuple.Item2, b = rgbtuple.Item3; return Color.FromArgb(255, (byte)(r * 255), (byte)(g * 255), (byte)(b * 255)); } default: - return Color.FromArgb(255, (byte)(CurrentColorState.RGB_R * 255), - (byte)(CurrentColorState.RGB_G * 255), (byte)(CurrentColorState.RGB_B * 255)); + return Color.FromArgb(255, (byte)(this.CurrentColorState.RGB_R * 255), + (byte)(this.CurrentColorState.RGB_G * 255), (byte)(this.CurrentColorState.RGB_B * 255)); } } } diff --git a/Source/Controls/H.Controls.ColorPicker/UIExtensions/HsvColorSlider.cs b/Source/Controls/H.Controls.ColorPicker/UIExtensions/HsvColorSlider.cs index 4ae850c5..381221e5 100644 --- a/Source/Controls/H.Controls.ColorPicker/UIExtensions/HsvColorSlider.cs +++ b/Source/Controls/H.Controls.ColorPicker/UIExtensions/HsvColorSlider.cs @@ -10,7 +10,7 @@ internal class HsvColorSlider : PreviewColorSlider DependencyProperty.Register(nameof(SliderHsvType), typeof(string), typeof(HsvColorSlider), new PropertyMetadata("")); - protected override bool RefreshGradient => SliderHsvType != "H"; + protected override bool RefreshGradient => this.SliderHsvType != "H"; public string SliderHsvType { @@ -20,13 +20,13 @@ public string SliderHsvType protected override void GenerateBackground() { - if (SliderHsvType == "H") + if (this.SliderHsvType == "H") { var colorStart = GetColorForSelectedArgb(0); var colorEnd = GetColorForSelectedArgb(360); - LeftCapColor.Color = colorStart; - RightCapColor.Color = colorEnd; - BackgroundGradient = new GradientStopCollection + this.LeftCapColor.Color = colorStart; + this.RightCapColor.Color = colorEnd; + this.BackgroundGradient = new GradientStopCollection { new GradientStop(colorStart, 0), new GradientStop(GetColorForSelectedArgb(60), 1 / 6.0), @@ -42,9 +42,9 @@ protected override void GenerateBackground() { var colorStart = GetColorForSelectedArgb(0); var colorEnd = GetColorForSelectedArgb(255); - LeftCapColor.Color = colorStart; - RightCapColor.Color = colorEnd; - BackgroundGradient = new GradientStopCollection + this.LeftCapColor.Color = colorStart; + this.RightCapColor.Color = colorEnd; + this.BackgroundGradient = new GradientStopCollection { new GradientStop(colorStart, 0.0), new GradientStop(colorEnd, 1) @@ -54,7 +54,7 @@ protected override void GenerateBackground() private Color GetColorForSelectedArgb(int value) { - switch (SliderHsvType) + switch (this.SliderHsvType) { case "H": { @@ -64,21 +64,21 @@ private Color GetColorForSelectedArgb(int value) } case "S": { - var rgbtuple = ColorSpaceHelper.HsvToRgb(CurrentColorState.HSV_H, value / 255.0, - CurrentColorState.HSV_V); + var rgbtuple = ColorSpaceHelper.HsvToRgb(this.CurrentColorState.HSV_H, value / 255.0, + this.CurrentColorState.HSV_V); double r = rgbtuple.Item1, g = rgbtuple.Item2, b = rgbtuple.Item3; return Color.FromArgb(255, (byte)(r * 255), (byte)(g * 255), (byte)(b * 255)); } case "V": { - var rgbtuple = ColorSpaceHelper.HsvToRgb(CurrentColorState.HSV_H, CurrentColorState.HSV_S, + var rgbtuple = ColorSpaceHelper.HsvToRgb(this.CurrentColorState.HSV_H, this.CurrentColorState.HSV_S, value / 255.0); double r = rgbtuple.Item1, g = rgbtuple.Item2, b = rgbtuple.Item3; return Color.FromArgb(255, (byte)(r * 255), (byte)(g * 255), (byte)(b * 255)); } default: - return Color.FromArgb((byte)(CurrentColorState.A * 255), (byte)(CurrentColorState.RGB_R * 255), - (byte)(CurrentColorState.RGB_G * 255), (byte)(CurrentColorState.RGB_B * 255)); + return Color.FromArgb((byte)(this.CurrentColorState.A * 255), (byte)(this.CurrentColorState.RGB_R * 255), + (byte)(this.CurrentColorState.RGB_G * 255), (byte)(this.CurrentColorState.RGB_B * 255)); } } } diff --git a/Source/Controls/H.Controls.ColorPicker/UIExtensions/PreviewColorSlider.cs b/Source/Controls/H.Controls.ColorPicker/UIExtensions/PreviewColorSlider.cs index da4c8c17..60aed5d5 100644 --- a/Source/Controls/H.Controls.ColorPicker/UIExtensions/PreviewColorSlider.cs +++ b/Source/Controls/H.Controls.ColorPicker/UIExtensions/PreviewColorSlider.cs @@ -25,11 +25,11 @@ internal abstract class PreviewColorSlider : Slider, INotifyPropertyChanged public PreviewColorSlider() { - Minimum = 0; - Maximum = 255; - SmallChange = 1; - LargeChange = 10; - MinHeight = 12; + this.Minimum = 0; + this.Maximum = 255; + this.SmallChange = 1; + this.LargeChange = 10; + this.MinHeight = 12; PreviewMouseWheel += OnPreviewMouseWheel; } @@ -59,7 +59,7 @@ public SolidColorBrush LeftCapColor set { _leftCapColor = value; - PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(nameof(LeftCapColor))); + PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(nameof(this.LeftCapColor))); } } @@ -69,7 +69,7 @@ public SolidColorBrush RightCapColor set { _rightCapColor = value; - PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(nameof(RightCapColor))); + PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(nameof(this.RightCapColor))); } } @@ -78,7 +78,7 @@ public SolidColorBrush RightCapColor public override void EndInit() { base.EndInit(); - Background = backgroundBrush; + this.Background = backgroundBrush; GenerateBackground(); } @@ -98,7 +98,7 @@ private static void SmallChangeBindableChangedCallback(DependencyObject d, Depen private void OnPreviewMouseWheel(object sender, MouseWheelEventArgs args) { - Value = MathHelper.Clamp(Value + SmallChange * args.Delta / 120, Minimum, Maximum); + this.Value = MathHelper.Clamp(this.Value + this.SmallChange * args.Delta / 120, this.Minimum, this.Maximum); args.Handled = true; } } diff --git a/Source/Controls/H.Controls.ColorPicker/UIExtensions/RgbColorSlider.cs b/Source/Controls/H.Controls.ColorPicker/UIExtensions/RgbColorSlider.cs index 73fbec45..3c07bf80 100644 --- a/Source/Controls/H.Controls.ColorPicker/UIExtensions/RgbColorSlider.cs +++ b/Source/Controls/H.Controls.ColorPicker/UIExtensions/RgbColorSlider.cs @@ -19,9 +19,9 @@ protected override void GenerateBackground() { var colorStart = GetColorForSelectedArgb(0); var colorEnd = GetColorForSelectedArgb(255); - LeftCapColor.Color = colorStart; - RightCapColor.Color = colorEnd; - BackgroundGradient = new GradientStopCollection + this.LeftCapColor.Color = colorStart; + this.RightCapColor.Color = colorEnd; + this.BackgroundGradient = new GradientStopCollection { new GradientStop(colorStart, 0.0), new GradientStop(colorEnd, 1) @@ -30,11 +30,11 @@ protected override void GenerateBackground() private Color GetColorForSelectedArgb(int value) { - var a = (byte)(CurrentColorState.A * 255); - var r = (byte)(CurrentColorState.RGB_R * 255); - var g = (byte)(CurrentColorState.RGB_G * 255); - var b = (byte)(CurrentColorState.RGB_B * 255); - switch (SliderArgbType) + var a = (byte)(this.CurrentColorState.A * 255); + var r = (byte)(this.CurrentColorState.RGB_R * 255); + var g = (byte)(this.CurrentColorState.RGB_G * 255); + var b = (byte)(this.CurrentColorState.RGB_B * 255); + switch (this.SliderArgbType) { case "A": return Color.FromArgb((byte)value, r, g, b); case "R": return Color.FromArgb(255, (byte)value, g, b); diff --git a/Source/Controls/H.Controls.ColorPicker/UserControls/HueSlider.xaml.cs b/Source/Controls/H.Controls.ColorPicker/UserControls/HueSlider.xaml.cs index 53d64dcd..48164b39 100644 --- a/Source/Controls/H.Controls.ColorPicker/UserControls/HueSlider.xaml.cs +++ b/Source/Controls/H.Controls.ColorPicker/UserControls/HueSlider.xaml.cs @@ -68,12 +68,12 @@ private void UpdateValue(Point mousePos, double width, double height) if (y < 0) angle = -angle; angle = angle * 360 / (Math.PI * 2) + 180; - Value = MathHelper.Clamp(angle, 0, 360); + this.Value = MathHelper.Clamp(angle, 0, 360); } private void OnPreviewMouseWheel(object sender, MouseWheelEventArgs args) { - Value = MathHelper.Mod(Value + SmallChange * args.Delta / 120, 360); + this.Value = MathHelper.Mod(this.Value + this.SmallChange * args.Delta / 120, 360); args.Handled = true; } } diff --git a/Source/Controls/H.Controls.ColorPicker/UserControls/SquareSlider.xaml.cs b/Source/Controls/H.Controls.ColorPicker/UserControls/SquareSlider.xaml.cs index 15025a15..a5ce41ef 100644 --- a/Source/Controls/H.Controls.ColorPicker/UserControls/SquareSlider.xaml.cs +++ b/Source/Controls/H.Controls.ColorPicker/UserControls/SquareSlider.xaml.cs @@ -37,7 +37,7 @@ public static readonly DependencyProperty PickerTypeProperty public SquareSlider() { - GradientBitmap = new WriteableBitmap(32, 32, 96, 96, PixelFormats.Rgb24, null); + this.GradientBitmap = new WriteableBitmap(32, 32, 96, 96, PixelFormats.Rgb24, null); InitializeComponent(); RecalculateGradient(); } @@ -72,7 +72,7 @@ public double RangeX set { _rangeX = value; - RaisePropertyChanged(nameof(RangeX)); + RaisePropertyChanged(nameof(this.RangeX)); } } @@ -82,7 +82,7 @@ public double RangeY set { _rangeY = value; - RaisePropertyChanged(nameof(RangeY)); + RaisePropertyChanged(nameof(this.RangeY)); } } @@ -92,7 +92,7 @@ public WriteableBitmap GradientBitmap set { _gradientBitmap = value; - RaisePropertyChanged(nameof(GradientBitmap)); + RaisePropertyChanged(nameof(this.GradientBitmap)); } } @@ -100,9 +100,9 @@ public WriteableBitmap GradientBitmap private void RecalculateGradient() { - var w = GradientBitmap.PixelWidth; - var h = GradientBitmap.PixelHeight; - var hue = Hue; + var w = this.GradientBitmap.PixelWidth; + var h = this.GradientBitmap.PixelHeight; + var hue = this.Hue; var pixels = new byte[w * h * 3]; for (var j = 0; j < h; j++) for (var i = 0; i < w; i++) @@ -115,7 +115,7 @@ private void RecalculateGradient() pixels[pos + 2] = (byte)(b * 255); } - GradientBitmap.WritePixels(new Int32Rect(0, 0, w, h), pixels, w * 3, 0); + this.GradientBitmap.WritePixels(new Int32Rect(0, 0, w, h), pixels, w * 3, 0); } private static void OnColorSpaceChanged(DependencyObject d, DependencyPropertyChangedEventArgs args) @@ -149,8 +149,8 @@ private void OnMouseMove(object sender, MouseEventArgs e) private void UpdatePos(Point pos) { - HeadX = MathHelper.Clamp(pos.X / ActualWidth, 0, 1) * RangeX; - HeadY = (1 - MathHelper.Clamp(pos.Y / ActualHeight, 0, 1)) * RangeY; + this.HeadX = MathHelper.Clamp(pos.X / this.ActualWidth, 0, 1) * this.RangeX; + this.HeadY = (1 - MathHelper.Clamp(pos.Y / this.ActualHeight, 0, 1)) * this.RangeY; } private void OnMouseUp(object sender, MouseButtonEventArgs e) diff --git a/Source/Controls/H.Controls.Diagram.Extension/Commands/Command.Node.cs b/Source/Controls/H.Controls.Diagram.Extension/Commands/Command.Node.cs index 77b32941..552f7df6 100644 --- a/Source/Controls/H.Controls.Diagram.Extension/Commands/Command.Node.cs +++ b/Source/Controls/H.Controls.Diagram.Extension/Commands/Command.Node.cs @@ -21,7 +21,7 @@ public override void Execute(object parameter) Diagram diagram = node.GetParent(); if (node.Content is NodeData data) { - if (UseApplayToAll) + if (this.UseApplayToAll) { diagram.Nodes.ForEach(x => { diff --git a/Source/Controls/H.Controls.Diagram.Extension/DiagramBase.cs b/Source/Controls/H.Controls.Diagram.Extension/DiagramBase.cs index a0859737..b8ac78a6 100644 --- a/Source/Controls/H.Controls.Diagram.Extension/DiagramBase.cs +++ b/Source/Controls/H.Controls.Diagram.Extension/DiagramBase.cs @@ -1,6 +1,4 @@ - -using H.Extensions.ValueConverter; -using H.Providers.Ioc; +using H.Providers.Ioc; using H.Providers.Mvvm; using System; using System.Collections.Generic; @@ -164,7 +162,7 @@ protected virtual IEnumerable CreateNodeGroups() //data.Order = type?.Order ?? 0; int? od = type.GetOrder(); if (od.HasValue) - Order = od.Value; + this.Order = od.Value; datas.Add(data); } IEnumerable> groups = datas.OrderBy(x => x.Order).GroupBy(x => x.GroupName); diff --git a/Source/Controls/H.Controls.Diagram.Extension/FlowableDiagramBase.cs b/Source/Controls/H.Controls.Diagram.Extension/FlowableDiagramBase.cs index 68a550bd..29cf25d2 100644 --- a/Source/Controls/H.Controls.Diagram.Extension/FlowableDiagramBase.cs +++ b/Source/Controls/H.Controls.Diagram.Extension/FlowableDiagramBase.cs @@ -72,7 +72,7 @@ await Task.Delay(2000).ContinueWith(x => //WindowMessageViewPresenter.Instance.IsVisible = false; }); - }, (s, e) => State != DiagramFlowableState.Running && this.State != DiagramFlowableState.Canceling); + }, (s, e) => this.State != DiagramFlowableState.Running && this.State != DiagramFlowableState.Canceling); [Display(Name = "停止", GroupName = "操作", Order = 0)] @@ -96,7 +96,7 @@ await Task.Delay(2000).ContinueWith(x => part.State = FlowableState.Canceling; } } - }, (s, e) => State == DiagramFlowableState.Running && this.State != DiagramFlowableState.Canceling); + }, (s, e) => this.State == DiagramFlowableState.Running && this.State != DiagramFlowableState.Canceling); [Display(Name = "重置", GroupName = "操作", Order = 0)] public RelayCommand CancelCommand => new RelayCommand((s, e) => @@ -109,7 +109,7 @@ await Task.Delay(2000).ContinueWith(x => flowable.State = FlowableState.Ready; } this.State = DiagramFlowableState.None; - }, (s, e) => State != DiagramFlowableState.None && this.State != DiagramFlowableState.Canceling); + }, (s, e) => this.State != DiagramFlowableState.None && this.State != DiagramFlowableState.Canceling); public RelayCommand StartNodeCommand => new RelayCommand(async (s, e) => diff --git a/Source/Controls/H.Controls.Diagram.Extension/Presenter/Node/Card/FlowableDiagramTemplateNodeData.xaml.cs b/Source/Controls/H.Controls.Diagram.Extension/Presenter/Node/Card/FlowableDiagramTemplateNodeData.xaml.cs index f706c5d2..46abaed6 100644 --- a/Source/Controls/H.Controls.Diagram.Extension/Presenter/Node/Card/FlowableDiagramTemplateNodeData.xaml.cs +++ b/Source/Controls/H.Controls.Diagram.Extension/Presenter/Node/Card/FlowableDiagramTemplateNodeData.xaml.cs @@ -47,7 +47,7 @@ public string FilePath [XmlIgnore] [Display(Name = "查看模板", GroupName = "操作")] - public RelayCommand ShowTemplateCommand => new RelayCommand(async (s, e) => + public RelayCommand ShowTemplateCommand => new RelayCommand((s, e) => { // await IocMessage.Dialog.Show(this.Template, null, this.Name, x => // { diff --git a/Source/Controls/H.Controls.Diagram.Extension/Presenter/Node/ImageNodeData.xaml.cs b/Source/Controls/H.Controls.Diagram.Extension/Presenter/Node/ImageNodeData.xaml.cs index 39fb60a6..7607411c 100644 --- a/Source/Controls/H.Controls.Diagram.Extension/Presenter/Node/ImageNodeData.xaml.cs +++ b/Source/Controls/H.Controls.Diagram.Extension/Presenter/Node/ImageNodeData.xaml.cs @@ -19,7 +19,7 @@ public ImageNodeDataBase() [XmlIgnore] [Display(Name = "浏览文件", GroupName = "操作,工具")] - public RelayCommand OpenCommand => new RelayCommand(async (s, e) => + public RelayCommand OpenCommand => new RelayCommand((s, e) => { OpenFileDialog openFileDialog = new OpenFileDialog(); //openFileDialog.InitialDirectory = AppDomain.CurrentDomain.BaseDirectory; //设置初始路径 diff --git a/Source/Controls/H.Controls.Diagram.Extension/Presenter/Node/Provider/NodeData.cs b/Source/Controls/H.Controls.Diagram.Extension/Presenter/Node/Provider/NodeData.cs index 59792de9..c4ef4398 100644 --- a/Source/Controls/H.Controls.Diagram.Extension/Presenter/Node/Provider/NodeData.cs +++ b/Source/Controls/H.Controls.Diagram.Extension/Presenter/Node/Provider/NodeData.cs @@ -19,7 +19,7 @@ public abstract class NodeDataBase : DisplayBindableBase, ICloneable { public NodeDataBase() { - ID = Guid.NewGuid().ToString(); + this.ID = Guid.NewGuid().ToString(); InitPort(); } @@ -47,7 +47,7 @@ public abstract class NodeData : NodeDataBase, INodeData, ITemplate, ILinkDataCr public NodeData() { NodeTypeAttribute type = GetType().GetCustomAttributes()?.FirstOrDefault(); - Columns = type?.GroupColumns ?? 4; + this.Columns = type?.GroupColumns ?? 4; } [XmlIgnore] @@ -357,10 +357,10 @@ public virtual void ApplayStyleTo(INodeData to) return; //node.Width = this.Width; //node.Height = this.Height; - node.Fill = Fill; - node.Stroke = Stroke; - node.StrokeThickness = StrokeThickness; - node.Stretch = Stretch; + node.Fill = this.Fill; + node.Stroke = this.Stroke; + node.StrokeThickness = this.StrokeThickness; + node.Stretch = this.Stretch; //node.BlurRadius = this.BlurRadius; //node.EffectColor = this.EffectColor; //node.Direction = this.Direction; @@ -380,12 +380,12 @@ public override object Clone() public virtual ILinkData CreateLinkData() { - return new DefaultLinkData() { FromNodeID = ID }; + return new DefaultLinkData() { FromNodeID = this.ID }; } public virtual IPortData CreatePortData() { - return new TextPortData(ID, PortType.Both); + return new TextPortData(this.ID, PortType.Both); } } } diff --git a/Source/Controls/H.Controls.Diagram.Extension/Presenter/Node/Provider/SystemNodeData.cs b/Source/Controls/H.Controls.Diagram.Extension/Presenter/Node/Provider/SystemNodeData.cs index 6d0180dd..35540843 100644 --- a/Source/Controls/H.Controls.Diagram.Extension/Presenter/Node/Provider/SystemNodeData.cs +++ b/Source/Controls/H.Controls.Diagram.Extension/Presenter/Node/Provider/SystemNodeData.cs @@ -23,28 +23,28 @@ protected override void InitPort() IPortData port = CreatePortData(); port.Dock = Dock.Left; port.PortType = PortType.Both; - PortDatas.Add(port); + this.PortDatas.Add(port); } { IPortData port = CreatePortData(); port.Dock = Dock.Right; port.PortType = PortType.Both; - PortDatas.Add(port); + this.PortDatas.Add(port); } { IPortData port = CreatePortData(); port.Dock = Dock.Top; port.PortType = PortType.Both; - PortDatas.Add(port); + this.PortDatas.Add(port); } { IPortData port = CreatePortData(); port.Dock = Dock.Bottom; port.PortType = PortType.Both; - PortDatas.Add(port); + this.PortDatas.Add(port); } } diff --git a/Source/Controls/H.Controls.Diagram.Extension/Provider/DiagramDropDispalyNodeBehavior.cs b/Source/Controls/H.Controls.Diagram.Extension/Provider/DiagramDropDispalyNodeBehavior.cs index 570dcfd1..8d1cc59c 100644 --- a/Source/Controls/H.Controls.Diagram.Extension/Provider/DiagramDropDispalyNodeBehavior.cs +++ b/Source/Controls/H.Controls.Diagram.Extension/Provider/DiagramDropDispalyNodeBehavior.cs @@ -14,7 +14,7 @@ public Type NodeType set { SetValue(NodeTypeProperty, value); } } - + public static readonly DependencyProperty NodeTypeProperty = DependencyProperty.Register("NodeType", typeof(Type), typeof(DiagramDropTextNodeBehavior), new FrameworkPropertyMetadata(typeof(Node), (d, e) => { diff --git a/Source/Controls/H.Controls.Diagram.Extension/Provider/DiagramTemplate.cs b/Source/Controls/H.Controls.Diagram.Extension/Provider/DiagramTemplate.cs index 0e32f712..1b6d589c 100644 --- a/Source/Controls/H.Controls.Diagram.Extension/Provider/DiagramTemplate.cs +++ b/Source/Controls/H.Controls.Diagram.Extension/Provider/DiagramTemplate.cs @@ -1,5 +1,4 @@ -using H.Extensions.ViewModel; -using H.Providers.Mvvm; +using H.Providers.Mvvm; using System; using System.Collections.Generic; using System.Collections.ObjectModel; diff --git a/Source/Controls/H.Controls.Diagram.Extensions.Workflow/WorkflowNodeAdorner.xaml.cs b/Source/Controls/H.Controls.Diagram.Extensions.Workflow/WorkflowNodeAdorner.xaml.cs index 2c23ff96..306c06d4 100644 --- a/Source/Controls/H.Controls.Diagram.Extensions.Workflow/WorkflowNodeAdorner.xaml.cs +++ b/Source/Controls/H.Controls.Diagram.Extensions.Workflow/WorkflowNodeAdorner.xaml.cs @@ -34,7 +34,7 @@ protected override ControlTemplate CreateTemplate() obj.SetValue(TemplateProperty, value); } - + public static new readonly DependencyProperty TemplateProperty = DependencyProperty.RegisterAttached("Template", typeof(ControlTemplate), typeof(WorkflowNodeAdorner), new PropertyMetadata(default(ControlTemplate), OnTemplateChanged)); diff --git a/Source/Controls/H.Controls.Diagram/Diagram.xaml.cs b/Source/Controls/H.Controls.Diagram/Diagram.xaml.cs index 16af55ef..fdae44e5 100644 --- a/Source/Controls/H.Controls.Diagram/Diagram.xaml.cs +++ b/Source/Controls/H.Controls.Diagram/Diagram.xaml.cs @@ -67,7 +67,7 @@ public Diagram() }; binding.CanExecute += (l, k) => { - k.CanExecute = State != DiagramFlowableState.Running && this.State != DiagramFlowableState.Canceling; + k.CanExecute = this.State != DiagramFlowableState.Running && this.State != DiagramFlowableState.Canceling; }; this.CommandBindings.Add(binding); } @@ -95,7 +95,7 @@ public Diagram() }; binding.CanExecute += (l, k) => { - k.CanExecute = State == DiagramFlowableState.Running && this.State != DiagramFlowableState.Canceling; + k.CanExecute = this.State == DiagramFlowableState.Running && this.State != DiagramFlowableState.Canceling; }; this.CommandBindings.Add(binding); } @@ -115,7 +115,7 @@ public Diagram() }; binding.CanExecute += (l, k) => { - k.CanExecute = State != DiagramFlowableState.None && this.State != DiagramFlowableState.Canceling; + k.CanExecute = this.State != DiagramFlowableState.None && this.State != DiagramFlowableState.Canceling; }; this.CommandBindings.Add(binding); } @@ -128,7 +128,7 @@ public Diagram() }; binding.CanExecute += (l, k) => { - k.CanExecute = State != DiagramFlowableState.Running && this.State != DiagramFlowableState.Canceling; + k.CanExecute = this.State != DiagramFlowableState.Running && this.State != DiagramFlowableState.Canceling; }; this.CommandBindings.Add(binding); } @@ -377,9 +377,9 @@ public override void OnApplyTemplate() { base.OnApplyTemplate(); - this.LinkLayer = Template.FindName("LinkLayer", this) as LinkLayer; - this.NodeLayer = Template.FindName("NodeLayer", this) as NodeLayer; - this.DynamicLayer = Template.FindName("DynamicLayer", this) as LinkLayer; + this.LinkLayer = this.Template.FindName("LinkLayer", this) as LinkLayer; + this.NodeLayer = this.Template.FindName("NodeLayer", this) as NodeLayer; + this.DynamicLayer = this.Template.FindName("DynamicLayer", this) as LinkLayer; this.DynamicLayer.Children.Add(_dynamicLink); this._dynamicLink.Style = this.DynamicLinkStyle; _layers.Add(this.LinkLayer); @@ -447,7 +447,7 @@ public bool UseStartNodeOnly set { SetValue(UseStartNodeOnlyProperty, value); } } - + public static readonly DependencyProperty UseStartNodeOnlyProperty = DependencyProperty.Register("UseStartNodeOnly", typeof(bool), typeof(Diagram), new FrameworkPropertyMetadata(default(bool), (d, e) => { @@ -474,7 +474,7 @@ public DiagramFlowableMode FlowableMode set { SetValue(FlowableModeProperty, value); } } - + public static readonly DependencyProperty FlowableModeProperty = DependencyProperty.Register("FlowableMode", typeof(DiagramFlowableMode), typeof(Diagram), new FrameworkPropertyMetadata(DiagramFlowableMode.Link, (d, e) => { @@ -501,7 +501,7 @@ public DiagramFlowableState State private set { SetValue(StateProperty, value); } } - + public static readonly DependencyProperty StateProperty = DependencyProperty.Register("State", typeof(DiagramFlowableState), typeof(Diagram), new FrameworkPropertyMetadata(default(DiagramFlowableState), (d, e) => { @@ -527,7 +527,7 @@ public string Message set { SetValue(MessageProperty, value); } } - + public static readonly DependencyProperty MessageProperty = DependencyProperty.Register("Message", typeof(string), typeof(Diagram), new FrameworkPropertyMetadata(default(string), (d, e) => { @@ -554,7 +554,7 @@ public ILayout Layout set { SetValue(LayoutProperty, value); } } - + public static readonly DependencyProperty LayoutProperty = DependencyProperty.Register("Layout", typeof(ILayout), typeof(Diagram), new FrameworkPropertyMetadata(default(ILayout), FrameworkPropertyMetadataOptions.BindsTwoWayByDefault, (d, e) => { @@ -593,7 +593,7 @@ public Part SelectedPart set { SetValue(SelectedPartProperty, value); } } - + public static readonly DependencyProperty SelectedPartProperty = DependencyProperty.Register("SelectedPart", typeof(Part), typeof(Diagram), new FrameworkPropertyMetadata(default(Part), FrameworkPropertyMetadataOptions.BindsTwoWayByDefault, (d, e) => { @@ -614,7 +614,7 @@ public Node SelectedNode set { SetValue(SelectedNodeProperty, value); } } - + public static readonly DependencyProperty SelectedNodeProperty = DependencyProperty.Register("SelectedNode", typeof(Node), typeof(Diagram), new PropertyMetadata(default(Node), (d, e) => { @@ -637,7 +637,7 @@ public IList NodesSource set { SetValue(NodesSourceProperty, value); } } - + public static readonly DependencyProperty NodesSourceProperty = DependencyProperty.Register("NodesSource", typeof(IList), typeof(Diagram), new PropertyMetadata(new ObservableCollection(), (d, e) => { @@ -668,7 +668,7 @@ public bool UseFlowableSelectToRunning set { SetValue(UseFlowableSelectToRunningProperty, value); } } - + public static readonly DependencyProperty UseFlowableSelectToRunningProperty = DependencyProperty.Register("UseFlowableSelectToRunning", typeof(bool), typeof(Diagram), new FrameworkPropertyMetadata(false, (d, e) => { @@ -695,7 +695,7 @@ public DiagramFlowableZoomMode FlowableZoomMode set { SetValue(FlowableZoomModeProperty, value); } } - + public static readonly DependencyProperty FlowableZoomModeProperty = DependencyProperty.Register("FlowableZoomMode", typeof(DiagramFlowableZoomMode), typeof(Diagram), new FrameworkPropertyMetadata(default(DiagramFlowableZoomMode), (d, e) => { @@ -993,7 +993,7 @@ public TimeSpan Duration set { SetValue(DurationProperty, value); } } - + public static readonly DependencyProperty DurationProperty = DependencyProperty.Register("Duration", typeof(TimeSpan), typeof(Diagram), new PropertyMetadata(TimeSpan.FromMilliseconds(500), (d, e) => { @@ -1034,7 +1034,7 @@ public ILinkDrawer LinkDrawer set { SetValue(LinkDrawerProperty, value); } } - + public static readonly DependencyProperty LinkDrawerProperty = DependencyProperty.Register("LinkDrawer", typeof(ILinkDrawer), typeof(Diagram), new PropertyMetadata(default(ILinkDrawer), (d, e) => { diff --git a/Source/Controls/H.Controls.Diagram/Layer/Base/Layer.cs b/Source/Controls/H.Controls.Diagram/Layer/Base/Layer.cs index d49a7437..7119c13b 100644 --- a/Source/Controls/H.Controls.Diagram/Layer/Base/Layer.cs +++ b/Source/Controls/H.Controls.Diagram/Layer/Base/Layer.cs @@ -16,7 +16,7 @@ public bool UseAnimation set { SetValue(UseAnimationProperty, value); } } - + public static readonly DependencyProperty UseAnimationProperty = DependencyProperty.Register("UseAnimation", typeof(bool), typeof(Layer), new PropertyMetadata(true, (d, e) => { @@ -36,7 +36,7 @@ public TimeSpan Duration set { SetValue(DurationProperty, value); } } - + public static readonly DependencyProperty DurationProperty = DependencyProperty.Register("Duration", typeof(TimeSpan), typeof(Layer), new PropertyMetadata(TimeSpan.FromMilliseconds(200), (d, e) => { diff --git a/Source/Controls/H.Controls.Diagram/Layer/LinkLayer.cs b/Source/Controls/H.Controls.Diagram/Layer/LinkLayer.cs index 9b8d6b3b..40b1c52e 100644 --- a/Source/Controls/H.Controls.Diagram/Layer/LinkLayer.cs +++ b/Source/Controls/H.Controls.Diagram/Layer/LinkLayer.cs @@ -91,7 +91,7 @@ protected override Size ArrangeOverride(Size arrangeSize) //child.Draw(start, end); child.Measure(new Size(double.PositiveInfinity, double.PositiveInfinity)); child.Arrange(new Rect(new Point(0, 0), child.DesiredSize)); - if (UseAnimation) + if (this.UseAnimation) { //child.BeginAnimationOpacity(0, 1, this.Duration.TotalMilliseconds * 3); } diff --git a/Source/Controls/H.Controls.Diagram/Layout/TreeLayout.cs b/Source/Controls/H.Controls.Diagram/Layout/TreeLayout.cs index 11aa69c2..5e810671 100644 --- a/Source/Controls/H.Controls.Diagram/Layout/TreeLayout.cs +++ b/Source/Controls/H.Controls.Diagram/Layout/TreeLayout.cs @@ -21,7 +21,7 @@ public double Span set { SetValue(SpanProperty, value); } } - + public static readonly DependencyProperty SpanProperty = DependencyProperty.Register("Span", typeof(double), typeof(TreeLayout), new PropertyMetadata(200.0, (d, e) => { @@ -42,7 +42,7 @@ public HorizontalAlignment Alignment set { SetValue(AlignmentProperty, value); } } - + public static readonly DependencyProperty AlignmentProperty = DependencyProperty.Register("Alignment", typeof(HorizontalAlignment), typeof(TreeLayout), new PropertyMetadata(HorizontalAlignment.Center, (d, e) => { @@ -63,7 +63,7 @@ public Orientation Orientation set { SetValue(OrientationProperty, value); } } - + public static readonly DependencyProperty OrientationProperty = DependencyProperty.Register("Orientation", typeof(Orientation), typeof(TreeLayout), new PropertyMetadata(default(Orientation), (d, e) => { diff --git a/Source/Controls/H.Controls.Diagram/LinkDrawer/ArcLinkDrawer.cs b/Source/Controls/H.Controls.Diagram/LinkDrawer/ArcLinkDrawer.cs index 3c58d96b..b6306595 100644 --- a/Source/Controls/H.Controls.Diagram/LinkDrawer/ArcLinkDrawer.cs +++ b/Source/Controls/H.Controls.Diagram/LinkDrawer/ArcLinkDrawer.cs @@ -20,7 +20,7 @@ public Orientation Orientation set { SetValue(OrientationProperty, value); } } - + public static readonly DependencyProperty OrientationProperty = DependencyProperty.Register("Orientation", typeof(Orientation), typeof(ArcLinkDrawer), new FrameworkPropertyMetadata(default(Orientation), (d, e) => { @@ -48,7 +48,7 @@ public override Geometry DrawPath(Link link, out Point center) Vector v = end - start; center = new Point((v.X / 2) + start.X, (v.Y / 2) + start.Y); - Point point = Orientation == Orientation.Vertical ? new Point(start.X, end.Y) : new Point(end.X, start.Y); + Point point = this.Orientation == Orientation.Vertical ? new Point(start.X, end.Y) : new Point(end.X, start.Y); if (this.IsLinkCrossBound == true) { diff --git a/Source/Controls/H.Controls.Diagram/LinkDrawer/BezierLinkDrawer.cs b/Source/Controls/H.Controls.Diagram/LinkDrawer/BezierLinkDrawer.cs index 2a7a7062..89c5a4b6 100644 --- a/Source/Controls/H.Controls.Diagram/LinkDrawer/BezierLinkDrawer.cs +++ b/Source/Controls/H.Controls.Diagram/LinkDrawer/BezierLinkDrawer.cs @@ -17,7 +17,7 @@ public double Span set { SetValue(SpanProperty, value); } } - + public static readonly DependencyProperty SpanProperty = DependencyProperty.Register("Span", typeof(double), typeof(BezierLinkDrawer), new FrameworkPropertyMetadata(50.0, (d, e) => { diff --git a/Source/Controls/H.Controls.Diagram/LinkDrawer/BrokenLinkDrawer.cs b/Source/Controls/H.Controls.Diagram/LinkDrawer/BrokenLinkDrawer.cs index 007b5dfd..55bffe4c 100644 --- a/Source/Controls/H.Controls.Diagram/LinkDrawer/BrokenLinkDrawer.cs +++ b/Source/Controls/H.Controls.Diagram/LinkDrawer/BrokenLinkDrawer.cs @@ -32,7 +32,7 @@ public int InnerSpan set { SetValue(InnerSpanProperty, value); } } - + public static readonly DependencyProperty InnerSpanProperty = DependencyProperty.Register("InnerSpan", typeof(int), typeof(BrokenLinkDrawer), new FrameworkPropertyMetadata(30, (d, e) => { diff --git a/Source/Controls/H.Controls.Diagram/LinkDrawer/LinkDrawer.cs b/Source/Controls/H.Controls.Diagram/LinkDrawer/LinkDrawer.cs index d9ac581a..978a3718 100644 --- a/Source/Controls/H.Controls.Diagram/LinkDrawer/LinkDrawer.cs +++ b/Source/Controls/H.Controls.Diagram/LinkDrawer/LinkDrawer.cs @@ -30,7 +30,7 @@ public bool IsLinkCrossBound set { SetValue(IsLinkCrossBoundProperty, value); } } - + public static readonly DependencyProperty IsLinkCrossBoundProperty = DependencyProperty.Register("IsLinkCrossBound", typeof(bool), typeof(LinkDrawer), new PropertyMetadata(true, (d, e) => { @@ -54,7 +54,7 @@ public bool IsUseArrow set { SetValue(IsUseArrowProperty, value); } } - + public static readonly DependencyProperty IsUseArrowProperty = DependencyProperty.Register("IsUseArrow", typeof(bool), typeof(LinkDrawer), new FrameworkPropertyMetadata(true, (d, e) => { @@ -86,7 +86,7 @@ public double ArrowAngle set { SetValue(ArrowAngleProperty, value); } } - + public static readonly DependencyProperty ArrowAngleProperty = DependencyProperty.Register("ArrowAngle", typeof(double), typeof(LinkDrawer), new FrameworkPropertyMetadata(Math.PI / 6, (d, e) => { @@ -115,7 +115,7 @@ public double ArrowLength set { SetValue(ArrowLengthProperty, value); } } - + public static readonly DependencyProperty ArrowLengthProperty = DependencyProperty.Register("ArrowLength", typeof(double), typeof(LinkDrawer), new FrameworkPropertyMetadata(5.0, (d, e) => { @@ -145,7 +145,7 @@ protected Point[] GetArrowLinePoints(double x1, double y1, double x2, double y2) { Point point1 = new Point(x1, y1); // 箭头起点 Point point2 = new Point(x2, y2); // 箭头终点 - if (!IsUseArrow) return new Point[] { point1, point2 }; + if (!this.IsUseArrow) return new Point[] { point1, point2 }; Point[] arrows = this.GetArrowPoints(x1, y1, x2, y2); return new Point[] { point1, point2, arrows[0], arrows[1], arrows[2] }; } diff --git a/Source/Controls/H.Controls.Diagram/NodeResizeAdorner.xaml.cs b/Source/Controls/H.Controls.Diagram/NodeResizeAdorner.xaml.cs index 7bc516bb..ec92e3a1 100644 --- a/Source/Controls/H.Controls.Diagram/NodeResizeAdorner.xaml.cs +++ b/Source/Controls/H.Controls.Diagram/NodeResizeAdorner.xaml.cs @@ -84,8 +84,8 @@ protected override void DragMoveVertical(double change) protected override void SetHeight(double change) { - FrameworkElement element = AdornedElement as FrameworkElement; - element.Height = Math.Max(MinValue, element.Height + change); + FrameworkElement element = this.AdornedElement as FrameworkElement; + element.Height = Math.Max(this.MinValue, element.Height + change); Node node = this.AdornedElement.GetParent(); @@ -95,8 +95,8 @@ protected override void SetHeight(double change) } protected override void SetWidth(double change) { - FrameworkElement element = AdornedElement as FrameworkElement; - element.Width = Math.Max(MinValue, element.Width + change); + FrameworkElement element = this.AdornedElement as FrameworkElement; + element.Width = Math.Max(this.MinValue, element.Width + change); Node node = this.AdornedElement.GetParent(); Point point = NodeLayer.GetPosition(node); diff --git a/Source/Controls/H.Controls.Diagram/Part/Base/Part.cs b/Source/Controls/H.Controls.Diagram/Part/Base/Part.cs index bba1213f..e9dec75b 100644 --- a/Source/Controls/H.Controls.Diagram/Part/Base/Part.cs +++ b/Source/Controls/H.Controls.Diagram/Part/Base/Part.cs @@ -82,7 +82,7 @@ public bool IsSelected set { SetValue(IsSelectedProperty, value); } } - + public static readonly DependencyProperty IsSelectedProperty = DependencyProperty.Register("IsSelected", typeof(bool), typeof(Part), new PropertyMetadata(default(bool), (d, e) => { @@ -131,7 +131,7 @@ public FlowableState State set { SetValue(StateProperty, value); } } - + public static readonly DependencyProperty StateProperty = DependencyProperty.Register("State", typeof(FlowableState), typeof(Part), new FrameworkPropertyMetadata(default(FlowableState), (d, e) => { @@ -227,7 +227,7 @@ public bool HasError set { SetValue(HasErrorProperty, value); } } - + public static readonly DependencyProperty HasErrorProperty = DependencyProperty.Register("HasError", typeof(bool), typeof(Part), new FrameworkPropertyMetadata(default(bool), (d, e) => { diff --git a/Source/Controls/H.Controls.Diagram/Part/Link.xaml.cs b/Source/Controls/H.Controls.Diagram/Part/Link.xaml.cs index 899ed542..c0f74952 100644 --- a/Source/Controls/H.Controls.Diagram/Part/Link.xaml.cs +++ b/Source/Controls/H.Controls.Diagram/Part/Link.xaml.cs @@ -104,7 +104,7 @@ public Style PathStyle set { SetValue(PathStyleProperty, value); } } - + public static readonly DependencyProperty PathStyleProperty = DependencyProperty.Register("PathStyle", typeof(Style), typeof(Link), new PropertyMetadata(default(Style), (d, e) => { @@ -122,7 +122,7 @@ public Brush Foreground set { SetValue(ForegroundProperty, value); } } - + public static readonly DependencyProperty ForegroundProperty = DependencyProperty.Register("Foreground", typeof(Brush), typeof(Link), new FrameworkPropertyMetadata(default(Brush), (d, e) => { @@ -149,7 +149,7 @@ public double FontSize set { SetValue(FontSizeProperty, value); } } - + public static readonly DependencyProperty FontSizeProperty = DependencyProperty.Register("FontSize", typeof(double), typeof(Link), new FrameworkPropertyMetadata(default(double), (d, e) => { diff --git a/Source/Controls/H.Controls.Diagram/Part/Node.xaml.cs b/Source/Controls/H.Controls.Diagram/Part/Node.xaml.cs index 13bf13ab..4541ba18 100644 --- a/Source/Controls/H.Controls.Diagram/Part/Node.xaml.cs +++ b/Source/Controls/H.Controls.Diagram/Part/Node.xaml.cs @@ -59,7 +59,7 @@ public Point Location set { SetValue(LocationProperty, value); } } - + public static readonly DependencyProperty LocationProperty = DependencyProperty.Register("Location", typeof(Point), typeof(Node), new FrameworkPropertyMetadata(default(Point), (d, e) => { diff --git a/Source/Controls/H.Controls.Diagram/Part/Port.xaml.cs b/Source/Controls/H.Controls.Diagram/Part/Port.xaml.cs index 9b32c1d6..0b7c80d9 100644 --- a/Source/Controls/H.Controls.Diagram/Part/Port.xaml.cs +++ b/Source/Controls/H.Controls.Diagram/Part/Port.xaml.cs @@ -33,7 +33,7 @@ public Dock Dock set { SetValue(DockProperty, value); } } - + public static readonly DependencyProperty DockProperty = DependencyProperty.Register("Dock", typeof(Dock), typeof(Port), new PropertyMetadata(default(Dock), (d, e) => { diff --git a/Source/Controls/H.Controls.Diagram/Part/TreeNode.xaml.cs b/Source/Controls/H.Controls.Diagram/Part/TreeNode.xaml.cs index ac022cd3..72800625 100644 --- a/Source/Controls/H.Controls.Diagram/Part/TreeNode.xaml.cs +++ b/Source/Controls/H.Controls.Diagram/Part/TreeNode.xaml.cs @@ -28,7 +28,7 @@ public bool IsExpanded set { SetValue(IsExpandedProperty, value); } } - + public static readonly DependencyProperty IsExpandedProperty = DependencyProperty.Register("IsExpanded", typeof(bool), typeof(TreeNode), new PropertyMetadata(true, (d, e) => { @@ -194,7 +194,7 @@ public double Span set { SetValue(SpanProperty, value); } } - + public static readonly DependencyProperty SpanProperty = DependencyProperty.Register("Span", typeof(double), typeof(TreeNode), new FrameworkPropertyMetadata(110.0, (d, e) => { diff --git a/Source/Controls/H.Controls.Diagram/Service/Bevavior/DynimacLinkBehavior/DynimacLinkBehaviorBase.cs b/Source/Controls/H.Controls.Diagram/Service/Bevavior/DynimacLinkBehavior/DynimacLinkBehaviorBase.cs index e92fef87..eed86149 100644 --- a/Source/Controls/H.Controls.Diagram/Service/Bevavior/DynimacLinkBehavior/DynimacLinkBehaviorBase.cs +++ b/Source/Controls/H.Controls.Diagram/Service/Bevavior/DynimacLinkBehavior/DynimacLinkBehaviorBase.cs @@ -13,6 +13,7 @@ namespace H.Controls.Diagram { public abstract class DynimacLinkBehaviorBase : Behavior where T : FrameworkElement { + [Obsolete] protected override void OnAttached() { this.AssociatedObject.PreviewMouseRightButtonDown += Diagram_PreviewMouseDown; @@ -31,6 +32,7 @@ private void AssociatedObject_MouseLeave(object sender, MouseEventArgs e) } + [Obsolete] protected override void OnDetaching() { this.AssociatedObject.PreviewMouseRightButtonDown -= Diagram_PreviewMouseDown; @@ -81,6 +83,8 @@ private HitTestFilterBehavior HitTestFilter(DependencyObject obj) protected Point point; protected Point previous; private PointHitTestParameters parameters; + + [Obsolete] private void Diagram_PreviewMouseMove(object sender, MouseEventArgs e) { if (this.AssociatedObject._dynamicLink.Visibility != Visibility.Visible) return; diff --git a/Source/Controls/H.Controls.Dock/AnchorableClosedEventArgs.cs b/Source/Controls/H.Controls.Dock/AnchorableClosedEventArgs.cs index 0372145e..5fbae163 100644 --- a/Source/Controls/H.Controls.Dock/AnchorableClosedEventArgs.cs +++ b/Source/Controls/H.Controls.Dock/AnchorableClosedEventArgs.cs @@ -15,7 +15,7 @@ public class AnchorableClosedEventArgs : EventArgs /// public AnchorableClosedEventArgs(LayoutAnchorable anchorable) { - Anchorable = anchorable; + this.Anchorable = anchorable; } /// diff --git a/Source/Controls/H.Controls.Dock/AnchorableClosingEventArgs.cs b/Source/Controls/H.Controls.Dock/AnchorableClosingEventArgs.cs index d194a2e6..00fad322 100644 --- a/Source/Controls/H.Controls.Dock/AnchorableClosingEventArgs.cs +++ b/Source/Controls/H.Controls.Dock/AnchorableClosingEventArgs.cs @@ -24,7 +24,7 @@ public class AnchorableClosingEventArgs : CancelEventArgs /// public AnchorableClosingEventArgs(LayoutAnchorable anchorable) { - Anchorable = anchorable; + this.Anchorable = anchorable; } /// diff --git a/Source/Controls/H.Controls.Dock/AnchorableHiddenEventArgs.cs b/Source/Controls/H.Controls.Dock/AnchorableHiddenEventArgs.cs index 90d79bf2..9eb6ed7d 100644 --- a/Source/Controls/H.Controls.Dock/AnchorableHiddenEventArgs.cs +++ b/Source/Controls/H.Controls.Dock/AnchorableHiddenEventArgs.cs @@ -24,7 +24,7 @@ public class AnchorableHiddenEventArgs : EventArgs /// public AnchorableHiddenEventArgs(LayoutAnchorable anchorable) { - Anchorable = anchorable; + this.Anchorable = anchorable; } /// diff --git a/Source/Controls/H.Controls.Dock/AnchorableHidingEventArgs.cs b/Source/Controls/H.Controls.Dock/AnchorableHidingEventArgs.cs index d668158d..ce498fe3 100644 --- a/Source/Controls/H.Controls.Dock/AnchorableHidingEventArgs.cs +++ b/Source/Controls/H.Controls.Dock/AnchorableHidingEventArgs.cs @@ -24,7 +24,7 @@ public class AnchorableHidingEventArgs : CancelEventArgs /// public AnchorableHidingEventArgs(LayoutAnchorable anchorable) { - Anchorable = anchorable; + this.Anchorable = anchorable; } /// diff --git a/Source/Controls/H.Controls.Dock/Commands/WeakAction.cs b/Source/Controls/H.Controls.Dock/Commands/WeakAction.cs index 4deebd32..fbf79167 100644 --- a/Source/Controls/H.Controls.Dock/Commands/WeakAction.cs +++ b/Source/Controls/H.Controls.Dock/Commands/WeakAction.cs @@ -47,14 +47,14 @@ public WeakAction(object target, Action action) { // Keep a reference to the target to control the // WeakAction's lifetime. - Reference = new WeakReference(target); + this.Reference = new WeakReference(target); } return; } - Method = action.Method; - ActionReference = new WeakReference(action.Target); - Reference = new WeakReference(target); + this.Method = action.Method; + this.ActionReference = new WeakReference(action.Target); + this.Reference = new WeakReference(target); } #endregion Public Constructors @@ -82,22 +82,22 @@ public virtual bool IsAlive get { if (_staticAction == null - && Reference == null) + && this.Reference == null) { return false; } if (_staticAction != null) { - if (Reference != null) + if (this.Reference != null) { - return Reference.IsAlive; + return this.Reference.IsAlive; } return true; } - return Reference.IsAlive; + return this.Reference.IsAlive; } } @@ -130,7 +130,7 @@ public virtual string MethodName { return _staticAction.Method.Name; } - return Method.Name; + return this.Method.Name; } } @@ -143,12 +143,12 @@ public object Target { get { - if (Reference == null) + if (this.Reference == null) { return null; } - return Reference.Target; + return this.Reference.Target; } } @@ -177,12 +177,12 @@ protected object ActionTarget { get { - if (ActionReference == null) + if (this.ActionReference == null) { return null; } - return ActionReference.Target; + return this.ActionReference.Target; } } @@ -226,24 +226,24 @@ public void Execute(object param = null) return; } - object actionTarget = ActionTarget; + object actionTarget = this.ActionTarget; - if (IsAlive) + if (this.IsAlive) { - if (Method != null - && ActionReference != null + if (this.Method != null + && this.ActionReference != null && actionTarget != null) { - int paras = Method.GetParameters().Count(); + int paras = this.Method.GetParameters().Count(); try { if (paras > 0) { - Method.Invoke(actionTarget, new object[] { param }); + this.Method.Invoke(actionTarget, new object[] { param }); } else { - Method.Invoke(actionTarget, null); + this.Method.Invoke(actionTarget, null); } } catch { } @@ -266,9 +266,9 @@ public void Execute(object param = null) /// public void MarkForDeletion() { - Reference = null; - ActionReference = null; - Method = null; + this.Reference = null; + this.ActionReference = null; + this.Method = null; _staticAction = null; #if SILVERLIGHT diff --git a/Source/Controls/H.Controls.Dock/Commands/WeakActionGeneric.cs b/Source/Controls/H.Controls.Dock/Commands/WeakActionGeneric.cs index 78b24908..5f351e4e 100644 --- a/Source/Controls/H.Controls.Dock/Commands/WeakActionGeneric.cs +++ b/Source/Controls/H.Controls.Dock/Commands/WeakActionGeneric.cs @@ -42,14 +42,14 @@ public WeakAction(object target, Action action) { // Keep a reference to the target to control the // WeakAction's lifetime. - Reference = new WeakReference(target); + this.Reference = new WeakReference(target); } return; } - Method = action.Method; - ActionReference = new WeakReference(action.Target); - Reference = new WeakReference(target); + this.Method = action.Method; + this.ActionReference = new WeakReference(action.Target); + this.Reference = new WeakReference(target); } #endregion Public Constructors @@ -65,22 +65,22 @@ public override bool IsAlive get { if (_staticAction == null - && Reference == null) + && this.Reference == null) { return false; } if (_staticAction != null) { - if (Reference != null) + if (this.Reference != null) { - return Reference.IsAlive; + return this.Reference.IsAlive; } return true; } - return Reference.IsAlive; + return this.Reference.IsAlive; } } @@ -95,7 +95,7 @@ public override string MethodName { return _staticAction.Method.Name; } - return Method.Name; + return this.Method.Name; } } @@ -125,17 +125,17 @@ public void Execute(T parameter) return; } - object actionTarget = ActionTarget; + object actionTarget = this.ActionTarget; - if (IsAlive) + if (this.IsAlive) { - if (Method != null - && ActionReference != null + if (this.Method != null + && this.ActionReference != null && actionTarget != null) { try { - Method.Invoke( + this.Method.Invoke( actionTarget, new object[] { diff --git a/Source/Controls/H.Controls.Dock/Commands/WeakFunc.cs b/Source/Controls/H.Controls.Dock/Commands/WeakFunc.cs index 50f7a9a1..3b7c273f 100644 --- a/Source/Controls/H.Controls.Dock/Commands/WeakFunc.cs +++ b/Source/Controls/H.Controls.Dock/Commands/WeakFunc.cs @@ -50,14 +50,14 @@ public WeakFunc(object target, Func func) { // Keep a reference to the target to control the // WeakAction's lifetime. - Reference = new WeakReference(target); + this.Reference = new WeakReference(target); } return; } - Method = func.Method; - FuncReference = new WeakReference(func.Target); - Reference = new WeakReference(target); + this.Method = func.Method; + this.FuncReference = new WeakReference(func.Target); + this.Reference = new WeakReference(target); } #endregion Public Constructors @@ -85,22 +85,22 @@ public virtual bool IsAlive get { if (_staticFunc == null - && Reference == null) + && this.Reference == null) { return false; } if (_staticFunc != null) { - if (Reference != null) + if (this.Reference != null) { - return Reference.IsAlive; + return this.Reference.IsAlive; } return true; } - return Reference.IsAlive; + return this.Reference.IsAlive; } } @@ -128,7 +128,7 @@ public virtual string MethodName { return _staticFunc.Method.Name; } - return Method.Name; + return this.Method.Name; } } @@ -141,12 +141,12 @@ public object Target { get { - if (Reference == null) + if (this.Reference == null) { return null; } - return Reference.Target; + return this.Reference.Target; } } @@ -178,12 +178,12 @@ protected object FuncTarget { get { - if (FuncReference == null) + if (this.FuncReference == null) { return null; } - return FuncReference.Target; + return this.FuncReference.Target; } } @@ -227,15 +227,15 @@ public TResult Execute() return _staticFunc(); } - object funcTarget = FuncTarget; + object funcTarget = this.FuncTarget; - if (IsAlive) + if (this.IsAlive) { - if (Method != null - && FuncReference != null + if (this.Method != null + && this.FuncReference != null && funcTarget != null) { - return (TResult)Method.Invoke(funcTarget, null); + return (TResult)this.Method.Invoke(funcTarget, null); } } @@ -247,9 +247,9 @@ public TResult Execute() /// public void MarkForDeletion() { - Reference = null; - FuncReference = null; - Method = null; + this.Reference = null; + this.FuncReference = null; + this.Method = null; _staticFunc = null; } diff --git a/Source/Controls/H.Controls.Dock/Commands/WeakFuncGeneric.cs b/Source/Controls/H.Controls.Dock/Commands/WeakFuncGeneric.cs index fd96dc46..4b70999d 100644 --- a/Source/Controls/H.Controls.Dock/Commands/WeakFuncGeneric.cs +++ b/Source/Controls/H.Controls.Dock/Commands/WeakFuncGeneric.cs @@ -52,14 +52,14 @@ public WeakFunc(object target, Func func) { // Keep a reference to the target to control the // WeakAction's lifetime. - Reference = new WeakReference(target); + this.Reference = new WeakReference(target); } return; } - Method = func.Method; - FuncReference = new WeakReference(func.Target); - Reference = new WeakReference(target); + this.Method = func.Method; + this.FuncReference = new WeakReference(func.Target); + this.Reference = new WeakReference(target); } #endregion Public Constructors @@ -76,22 +76,22 @@ public override bool IsAlive get { if (_staticFunc == null - && Reference == null) + && this.Reference == null) { return false; } if (_staticFunc != null) { - if (Reference != null) + if (this.Reference != null) { - return Reference.IsAlive; + return this.Reference.IsAlive; } return true; } - return Reference.IsAlive; + return this.Reference.IsAlive; } } @@ -107,7 +107,7 @@ public override string MethodName { return _staticFunc.Method.Name; } - return Method.Name; + return this.Method.Name; } } @@ -138,15 +138,15 @@ public TResult Execute(T parameter) return _staticFunc(parameter); } - object funcTarget = FuncTarget; + object funcTarget = this.FuncTarget; - if (IsAlive) + if (this.IsAlive) { - if (Method != null - && FuncReference != null + if (this.Method != null + && this.FuncReference != null && funcTarget != null) { - return (TResult)Method.Invoke( + return (TResult)this.Method.Invoke( funcTarget, new object[] { diff --git a/Source/Controls/H.Controls.Dock/Controls/AnchorablePaneDropTarget.cs b/Source/Controls/H.Controls.Dock/Controls/AnchorablePaneDropTarget.cs index 8d7f1b41..9eba86d5 100644 --- a/Source/Controls/H.Controls.Dock/Controls/AnchorablePaneDropTarget.cs +++ b/Source/Controls/H.Controls.Dock/Controls/AnchorablePaneDropTarget.cs @@ -67,7 +67,7 @@ protected override void Drop(LayoutAnchorableFloatingWindow floatingWindow) ILayoutAnchorablePane targetModel = _targetPane.Model as ILayoutAnchorablePane; LayoutAnchorable anchorableActive = floatingWindow.Descendents().OfType().FirstOrDefault(); - switch (Type) + switch (this.Type) { case DropTargetType.AnchorablePaneDockBottom: @@ -292,11 +292,11 @@ protected override void Drop(LayoutAnchorableFloatingWindow floatingWindow) public override Geometry GetPreviewPath(OverlayWindow overlayWindow, LayoutFloatingWindow floatingWindowModel) { - switch (Type) + switch (this.Type) { case DropTargetType.AnchorablePaneDockBottom: { - Rect targetScreenRect = TargetElement.GetScreenArea(); + Rect targetScreenRect = this.TargetElement.GetScreenArea(); targetScreenRect.Offset(-overlayWindow.Left, -overlayWindow.Top); targetScreenRect.Offset(0.0, targetScreenRect.Height / 2.0); @@ -307,7 +307,7 @@ public override Geometry GetPreviewPath(OverlayWindow overlayWindow, case DropTargetType.AnchorablePaneDockTop: { - Rect targetScreenRect = TargetElement.GetScreenArea(); + Rect targetScreenRect = this.TargetElement.GetScreenArea(); targetScreenRect.Offset(-overlayWindow.Left, -overlayWindow.Top); targetScreenRect.Height /= 2.0; @@ -317,7 +317,7 @@ public override Geometry GetPreviewPath(OverlayWindow overlayWindow, case DropTargetType.AnchorablePaneDockLeft: { - Rect targetScreenRect = TargetElement.GetScreenArea(); + Rect targetScreenRect = this.TargetElement.GetScreenArea(); targetScreenRect.Offset(-overlayWindow.Left, -overlayWindow.Top); targetScreenRect.Width /= 2.0; @@ -327,7 +327,7 @@ public override Geometry GetPreviewPath(OverlayWindow overlayWindow, case DropTargetType.AnchorablePaneDockRight: { - Rect targetScreenRect = TargetElement.GetScreenArea(); + Rect targetScreenRect = this.TargetElement.GetScreenArea(); targetScreenRect.Offset(-overlayWindow.Left, -overlayWindow.Top); targetScreenRect.Offset(targetScreenRect.Width / 2.0, 0.0); @@ -338,14 +338,14 @@ public override Geometry GetPreviewPath(OverlayWindow overlayWindow, case DropTargetType.AnchorablePaneDockInside: { - Rect targetScreenRect = TargetElement.GetScreenArea(); + Rect targetScreenRect = this.TargetElement.GetScreenArea(); targetScreenRect.Offset(-overlayWindow.Left, -overlayWindow.Top); if (_tabIndex == -1) return new RectangleGeometry(targetScreenRect); else { - Rect translatedDetectionRect = new Rect(DetectionRects[0].TopLeft, DetectionRects[0].BottomRight); + Rect translatedDetectionRect = new Rect(this.DetectionRects[0].TopLeft, this.DetectionRects[0].BottomRight); translatedDetectionRect.Offset(-overlayWindow.Left, -overlayWindow.Top); PathFigure pathFigure = new PathFigure(); diff --git a/Source/Controls/H.Controls.Dock/Controls/AnchorablePaneTabPanel.cs b/Source/Controls/H.Controls.Dock/Controls/AnchorablePaneTabPanel.cs index 0dcd179b..05005a8f 100644 --- a/Source/Controls/H.Controls.Dock/Controls/AnchorablePaneTabPanel.cs +++ b/Source/Controls/H.Controls.Dock/Controls/AnchorablePaneTabPanel.cs @@ -27,7 +27,7 @@ protected override Size MeasureOverride(Size availableSize) { double totWidth = 0; double maxHeight = 0; - System.Collections.Generic.IEnumerable visibleChildren = Children.Cast().Where(ch => ch.Visibility != System.Windows.Visibility.Collapsed); + System.Collections.Generic.IEnumerable visibleChildren = this.Children.Cast().Where(ch => ch.Visibility != System.Windows.Visibility.Collapsed); foreach (FrameworkElement child in visibleChildren) { child.Measure(new Size(double.PositiveInfinity, availableSize.Height)); @@ -49,7 +49,7 @@ protected override Size MeasureOverride(Size availableSize) protected override Size ArrangeOverride(Size finalSize) { - System.Collections.Generic.IEnumerable visibleChildren = Children.Cast().Where(ch => ch.Visibility != System.Windows.Visibility.Collapsed); + System.Collections.Generic.IEnumerable visibleChildren = this.Children.Cast().Where(ch => ch.Visibility != System.Windows.Visibility.Collapsed); double finalWidth = finalSize.Width; double desideredWidth = visibleChildren.Sum(ch => ch.DesiredSize.Width); diff --git a/Source/Controls/H.Controls.Dock/Controls/AnchorablePaneTitle.xaml.cs b/Source/Controls/H.Controls.Dock/Controls/AnchorablePaneTitle.xaml.cs index 624f16be..41956f02 100644 --- a/Source/Controls/H.Controls.Dock/Controls/AnchorablePaneTitle.xaml.cs +++ b/Source/Controls/H.Controls.Dock/Controls/AnchorablePaneTitle.xaml.cs @@ -53,8 +53,8 @@ public LayoutAnchorable Model /// Provides derived classes an opportunity to handle changes to the property. protected virtual void OnModelChanged(DependencyPropertyChangedEventArgs e) { - if (Model != null) - SetLayoutItem(Model?.Root?.Manager?.GetLayoutItemFromModel(Model)); + if (this.Model != null) + SetLayoutItem(this.Model?.Root?.Manager?.GetLayoutItemFromModel(this.Model)); else SetLayoutItem(null); } @@ -109,7 +109,7 @@ protected override void OnMouseLeave(MouseEventArgs e) // Start dragging a LayoutAnchorable control that docked/reduced into a SidePanel and // 1) made visible by clicking on to its name in AutoHide mode // 2) user drags the top title bar of the LayoutAnchorable control to drag it out of its current docking position - Model?.Root?.Manager?.StartDraggingFloatingWindowForContent(Model); + this.Model?.Root?.Manager?.StartDraggingFloatingWindowForContent(this.Model); } } _isMouseDown = false; @@ -121,15 +121,15 @@ protected override void OnMouseLeftButtonDown(MouseButtonEventArgs e) base.OnMouseLeftButtonDown(e); // Start a drag & drop action for a LayoutAnchorable - if (e.Handled || Model.CanMove == false) return; + if (e.Handled || this.Model.CanMove == false) return; bool attachFloatingWindow = false; - LayoutAnchorableFloatingWindow parentFloatingWindow = Model.FindParent(); + LayoutAnchorableFloatingWindow parentFloatingWindow = this.Model.FindParent(); if (parentFloatingWindow != null) attachFloatingWindow = parentFloatingWindow.Descendents().OfType().Count() == 1; if (attachFloatingWindow) { //the pane is hosted inside a floating window that contains only an anchorable pane so drag the floating window itself - LayoutFloatingWindowControl floatingWndControl = Model.Root.Manager.FloatingWindows.Single(fwc => fwc.Model == parentFloatingWindow); + LayoutFloatingWindowControl floatingWndControl = this.Model.Root.Manager.FloatingWindows.Single(fwc => fwc.Model == parentFloatingWindow); floatingWndControl.AttachDrag(false); } else @@ -141,7 +141,7 @@ protected override void OnMouseLeftButtonUp(MouseButtonEventArgs e) { _isMouseDown = false; base.OnMouseLeftButtonUp(e); - if (Model != null) Model.IsActive = true;//FocusElementManager.SetFocusOnLastElement(Model); + if (this.Model != null) this.Model.IsActive = true;//FocusElementManager.SetFocusOnLastElement(Model); } #endregion Overrides diff --git a/Source/Controls/H.Controls.Dock/Controls/DockingManagerDropTarget.cs b/Source/Controls/H.Controls.Dock/Controls/DockingManagerDropTarget.cs index f0b540df..84c2012e 100644 --- a/Source/Controls/H.Controls.Dock/Controls/DockingManagerDropTarget.cs +++ b/Source/Controls/H.Controls.Dock/Controls/DockingManagerDropTarget.cs @@ -50,7 +50,7 @@ internal DockingManagerDropTarget(DockingManager manager, /// protected override void Drop(LayoutAnchorableFloatingWindow floatingWindow) { - switch (Type) + switch (this.Type) { case DropTargetType.DockingManagerDockLeft: @@ -227,9 +227,9 @@ public override Geometry GetPreviewPath(OverlayWindow overlayWindow, ILayoutPositionableElement layoutAnchorablePane = anchorableFloatingWindowModel.RootPanel; ILayoutPositionableElementWithActualSize layoutAnchorablePaneWithActualSize = anchorableFloatingWindowModel.RootPanel; - Rect targetScreenRect = TargetElement.GetScreenArea(); + Rect targetScreenRect = this.TargetElement.GetScreenArea(); - switch (Type) + switch (this.Type) { case DropTargetType.DockingManagerDockLeft: { diff --git a/Source/Controls/H.Controls.Dock/Controls/DocumentPaneDropAsAnchorableTarget.cs b/Source/Controls/H.Controls.Dock/Controls/DocumentPaneDropAsAnchorableTarget.cs index 6913e0a5..a3fe9334 100644 --- a/Source/Controls/H.Controls.Dock/Controls/DocumentPaneDropAsAnchorableTarget.cs +++ b/Source/Controls/H.Controls.Dock/Controls/DocumentPaneDropAsAnchorableTarget.cs @@ -70,7 +70,7 @@ protected override void Drop(LayoutAnchorableFloatingWindow floatingWindow) LayoutPanel parentGroupPanel; FindParentLayoutDocumentPane(targetModel, out parentGroup, out parentGroupPanel); - switch (Type) + switch (this.Type) { case DropTargetType.DocumentPaneDockAsAnchorableBottom: @@ -240,7 +240,7 @@ public override Geometry GetPreviewPath(OverlayWindow overlayWindow, LayoutFloat FrameworkElement documentPaneControl = manager.FindLogicalChildren().OfType().First(d => parentGroup != null ? d.Model == parentGroup : d.Model == parentGroupPanel) as FrameworkElement; targetScreenRect = documentPaneControl.GetScreenArea(); - switch (Type) + switch (this.Type) { case DropTargetType.DocumentPaneDockAsAnchorableBottom: { diff --git a/Source/Controls/H.Controls.Dock/Controls/DocumentPaneDropTarget.cs b/Source/Controls/H.Controls.Dock/Controls/DocumentPaneDropTarget.cs index d6fb0365..ad13a5c4 100644 --- a/Source/Controls/H.Controls.Dock/Controls/DocumentPaneDropTarget.cs +++ b/Source/Controls/H.Controls.Dock/Controls/DocumentPaneDropTarget.cs @@ -89,7 +89,7 @@ protected override void Drop(LayoutDocumentFloatingWindow floatingWindow) ILayoutOrientableGroup paneGroupOrientaion = paneGroup; - switch (Type) + switch (this.Type) { case DropTargetType.DocumentPaneDockBottom: @@ -244,7 +244,7 @@ protected override void Drop(LayoutAnchorableFloatingWindow floatingWindow) { ILayoutDocumentPane targetModel = _targetPane.Model as ILayoutDocumentPane; - switch (Type) + switch (this.Type) { case DropTargetType.DocumentPaneDockBottom: @@ -472,11 +472,11 @@ protected override void Drop(LayoutAnchorableFloatingWindow floatingWindow) public override Geometry GetPreviewPath(OverlayWindow overlayWindow, LayoutFloatingWindow floatingWindowModel) { - switch (Type) + switch (this.Type) { case DropTargetType.DocumentPaneDockInside: { - Rect targetScreenRect = TargetElement.GetScreenArea(); + Rect targetScreenRect = this.TargetElement.GetScreenArea(); targetScreenRect.Offset(-overlayWindow.Left, -overlayWindow.Top); if (_tabIndex == -1) @@ -485,7 +485,7 @@ public override Geometry GetPreviewPath(OverlayWindow overlayWindow, } else { - Rect translatedDetectionRect = new Rect(DetectionRects[0].TopLeft, DetectionRects[0].BottomRight); + Rect translatedDetectionRect = new Rect(this.DetectionRects[0].TopLeft, this.DetectionRects[0].BottomRight); translatedDetectionRect.Offset(-overlayWindow.Left, -overlayWindow.Top); PathFigure pathFigure = new PathFigure(); @@ -506,7 +506,7 @@ public override Geometry GetPreviewPath(OverlayWindow overlayWindow, case DropTargetType.DocumentPaneDockBottom: { - Rect targetScreenRect = TargetElement.GetScreenArea(); + Rect targetScreenRect = this.TargetElement.GetScreenArea(); targetScreenRect.Offset(-overlayWindow.Left, -overlayWindow.Top); targetScreenRect.Offset(0.0, targetScreenRect.Height / 2.0); targetScreenRect.Height /= 2.0; @@ -515,7 +515,7 @@ public override Geometry GetPreviewPath(OverlayWindow overlayWindow, case DropTargetType.DocumentPaneDockTop: { - Rect targetScreenRect = TargetElement.GetScreenArea(); + Rect targetScreenRect = this.TargetElement.GetScreenArea(); targetScreenRect.Offset(-overlayWindow.Left, -overlayWindow.Top); targetScreenRect.Height /= 2.0; return new RectangleGeometry(targetScreenRect); @@ -523,7 +523,7 @@ public override Geometry GetPreviewPath(OverlayWindow overlayWindow, case DropTargetType.DocumentPaneDockLeft: { - Rect targetScreenRect = TargetElement.GetScreenArea(); + Rect targetScreenRect = this.TargetElement.GetScreenArea(); targetScreenRect.Offset(-overlayWindow.Left, -overlayWindow.Top); targetScreenRect.Width /= 2.0; return new RectangleGeometry(targetScreenRect); @@ -531,7 +531,7 @@ public override Geometry GetPreviewPath(OverlayWindow overlayWindow, case DropTargetType.DocumentPaneDockRight: { - Rect targetScreenRect = TargetElement.GetScreenArea(); + Rect targetScreenRect = this.TargetElement.GetScreenArea(); targetScreenRect.Offset(-overlayWindow.Left, -overlayWindow.Top); targetScreenRect.Offset(targetScreenRect.Width / 2.0, 0.0); targetScreenRect.Width /= 2.0; diff --git a/Source/Controls/H.Controls.Dock/Controls/DocumentPaneGroupDropTarget.cs b/Source/Controls/H.Controls.Dock/Controls/DocumentPaneGroupDropTarget.cs index eeccc5d8..a8585549 100644 --- a/Source/Controls/H.Controls.Dock/Controls/DocumentPaneGroupDropTarget.cs +++ b/Source/Controls/H.Controls.Dock/Controls/DocumentPaneGroupDropTarget.cs @@ -47,7 +47,7 @@ protected override void Drop(LayoutDocumentFloatingWindow floatingWindow) { ILayoutPane targetModel = _targetPane.Model as ILayoutPane; - switch (Type) + switch (this.Type) { case DropTargetType.DocumentPaneGroupDockInside: @@ -77,7 +77,7 @@ protected override void Drop(LayoutAnchorableFloatingWindow floatingWindow) { ILayoutPane targetModel = _targetPane.Model as ILayoutPane; - switch (Type) + switch (this.Type) { case DropTargetType.DocumentPaneGroupDockInside: @@ -117,14 +117,14 @@ protected override void Drop(LayoutAnchorableFloatingWindow floatingWindow) public override Geometry GetPreviewPath(OverlayWindow overlayWindow, LayoutFloatingWindow floatingWindowModel) { - switch (Type) + switch (this.Type) { case DropTargetType.DocumentPaneGroupDockInside: #region DropTargetType.DocumentPaneGroupDockInside { - Rect targetScreenRect = TargetElement.GetScreenArea(); + Rect targetScreenRect = this.TargetElement.GetScreenArea(); targetScreenRect.Offset(-overlayWindow.Left, -overlayWindow.Top); return new RectangleGeometry(targetScreenRect); diff --git a/Source/Controls/H.Controls.Dock/Controls/DocumentPaneTabPanel.cs b/Source/Controls/H.Controls.Dock/Controls/DocumentPaneTabPanel.cs index d4cbf8c2..a1bb589b 100644 --- a/Source/Controls/H.Controls.Dock/Controls/DocumentPaneTabPanel.cs +++ b/Source/Controls/H.Controls.Dock/Controls/DocumentPaneTabPanel.cs @@ -29,7 +29,7 @@ public DocumentPaneTabPanel() protected override Size MeasureOverride(Size availableSize) { Size desideredSize = new Size(); - foreach (FrameworkElement child in Children) + foreach (FrameworkElement child in this.Children) { child.Measure(new Size(double.PositiveInfinity, double.PositiveInfinity)); desideredSize.Width += child.DesiredSize.Width; @@ -42,7 +42,7 @@ protected override Size MeasureOverride(Size availableSize) protected override Size ArrangeOverride(Size finalSize) { - System.Collections.Generic.IEnumerable visibleChildren = Children.Cast().Where(ch => ch.Visibility != System.Windows.Visibility.Collapsed); + System.Collections.Generic.IEnumerable visibleChildren = this.Children.Cast().Where(ch => ch.Visibility != System.Windows.Visibility.Collapsed); double offset = 0.0; bool skipAllOthers = false; foreach (TabItem doc in visibleChildren) diff --git a/Source/Controls/H.Controls.Dock/Controls/DropArea.cs b/Source/Controls/H.Controls.Dock/Controls/DropArea.cs index 0ef534cb..ac67a0d8 100644 --- a/Source/Controls/H.Controls.Dock/Controls/DropArea.cs +++ b/Source/Controls/H.Controls.Dock/Controls/DropArea.cs @@ -49,9 +49,9 @@ public class DropArea : IDropArea where T : FrameworkElement /// the type of drop area for this drop target. internal DropArea(T areaElement, DropAreaType type) { - AreaElement = areaElement; - DetectionRect = areaElement.GetScreenArea(); - Type = type; + this.AreaElement = areaElement; + this.DetectionRect = areaElement.GetScreenArea(); + this.Type = type; } #endregion Constructors @@ -66,7 +66,7 @@ internal DropArea(T areaElement, DropAreaType type) public Point TransformToDeviceDPI(Point dragPosition) { - return AreaElement.TransformToDeviceDPI(dragPosition); + return this.AreaElement.TransformToDeviceDPI(dragPosition); } #endregion IDropArea diff --git a/Source/Controls/H.Controls.Dock/Controls/DropDownButton.cs b/Source/Controls/H.Controls.Dock/Controls/DropDownButton.cs index 6d37c1c5..07ae9466 100644 --- a/Source/Controls/H.Controls.Dock/Controls/DropDownButton.cs +++ b/Source/Controls/H.Controls.Dock/Controls/DropDownButton.cs @@ -47,7 +47,7 @@ public ContextMenu DropDownContextMenu /// Provides derived classes an opportunity to handle changes to the property. protected virtual void OnDropDownContextMenuChanged(DependencyPropertyChangedEventArgs e) { - if (e.OldValue is ContextMenu oldContextMenu && IsChecked.GetValueOrDefault()) + if (e.OldValue is ContextMenu oldContextMenu && this.IsChecked.GetValueOrDefault()) oldContextMenu.Closed -= OnContextMenuClosed; } @@ -76,14 +76,14 @@ public object DropDownContextMenuDataContext /// protected override void OnClick() { - if (DropDownContextMenu != null) + if (this.DropDownContextMenu != null) { //IsChecked = true; - DropDownContextMenu.PlacementTarget = this; - DropDownContextMenu.Placement = PlacementMode.Bottom; - DropDownContextMenu.DataContext = DropDownContextMenuDataContext; - DropDownContextMenu.Closed += OnContextMenuClosed; - DropDownContextMenu.IsOpen = true; + this.DropDownContextMenu.PlacementTarget = this; + this.DropDownContextMenu.Placement = PlacementMode.Bottom; + this.DropDownContextMenu.DataContext = this.DropDownContextMenuDataContext; + this.DropDownContextMenu.Closed += OnContextMenuClosed; + this.DropDownContextMenu.IsOpen = true; } base.OnClick(); } @@ -97,14 +97,14 @@ private void OnContextMenuClosed(object sender, RoutedEventArgs e) //Debug.Assert(IsChecked.GetValueOrDefault()); ContextMenu ctxMenu = sender as ContextMenu; ctxMenu.Closed -= OnContextMenuClosed; - IsChecked = false; + this.IsChecked = false; } private void DropDownButton_Unloaded(object sender, RoutedEventArgs e) { // When changing theme, Unloaded event is called, erasing the DropDownContextMenu. // Prevent this on theme changes. - if (IsLoaded) DropDownContextMenu = null; + if (this.IsLoaded) this.DropDownContextMenu = null; } #endregion Private Methods diff --git a/Source/Controls/H.Controls.Dock/Controls/DropDownControlArea.cs b/Source/Controls/H.Controls.Dock/Controls/DropDownControlArea.cs index 5b1b58e9..299d49fc 100644 --- a/Source/Controls/H.Controls.Dock/Controls/DropDownControlArea.cs +++ b/Source/Controls/H.Controls.Dock/Controls/DropDownControlArea.cs @@ -83,16 +83,16 @@ public object DropDownContextMenuDataContext // so no further processing occurs. private void PreviewMouseRightButtonUpCallback(MouseButtonEventArgs e) { - if (!e.Handled && DropDownContextMenu != null) + if (!e.Handled && this.DropDownContextMenu != null) { // Fix for multi-dpi aware aplications - DropDownContextMenu.PlacementTarget = e.Source as UIElement; + this.DropDownContextMenu.PlacementTarget = e.Source as UIElement; //DropDownContextMenu.PlacementTarget = null; - DropDownContextMenu.Placement = PlacementMode.MousePoint; - DropDownContextMenu.HorizontalOffset = 0d; - DropDownContextMenu.VerticalOffset = 0d; - DropDownContextMenu.DataContext = DropDownContextMenuDataContext; - DropDownContextMenu.IsOpen = true; + this.DropDownContextMenu.Placement = PlacementMode.MousePoint; + this.DropDownContextMenu.HorizontalOffset = 0d; + this.DropDownContextMenu.VerticalOffset = 0d; + this.DropDownContextMenu.DataContext = this.DropDownContextMenuDataContext; + this.DropDownContextMenu.IsOpen = true; e.Handled = true; } diff --git a/Source/Controls/H.Controls.Dock/Controls/DropTarget.cs b/Source/Controls/H.Controls.Dock/Controls/DropTarget.cs index ad98099a..61f609b4 100644 --- a/Source/Controls/H.Controls.Dock/Controls/DropTarget.cs +++ b/Source/Controls/H.Controls.Dock/Controls/DropTarget.cs @@ -120,7 +120,7 @@ public void Drop(LayoutFloatingWindow floatingWindow) } if (currentActiveContent == null) return; - Dispatcher.BeginInvoke(new Action(() => + this.Dispatcher.BeginInvoke(new Action(() => { currentActiveContent.IsSelected = false; currentActiveContent.IsActive = false; @@ -137,12 +137,12 @@ public virtual bool HitTest(Point dragPoint) public void DragEnter() { - SetIsDraggingOver(TargetElement, true); + SetIsDraggingOver(this.TargetElement, true); } public void DragLeave() { - SetIsDraggingOver(TargetElement, false); + SetIsDraggingOver(this.TargetElement, false); } #endregion Public Methods diff --git a/Source/Controls/H.Controls.Dock/Controls/LayoutAnchorableControl.xaml.cs b/Source/Controls/H.Controls.Dock/Controls/LayoutAnchorableControl.xaml.cs index bd463dc8..cf4c8f16 100644 --- a/Source/Controls/H.Controls.Dock/Controls/LayoutAnchorableControl.xaml.cs +++ b/Source/Controls/H.Controls.Dock/Controls/LayoutAnchorableControl.xaml.cs @@ -56,10 +56,10 @@ public LayoutAnchorable Model protected virtual void OnModelChanged(DependencyPropertyChangedEventArgs e) { if (e.OldValue != null) ((LayoutContent)e.OldValue).PropertyChanged -= Model_PropertyChanged; - if (Model != null) + if (this.Model != null) { - Model.PropertyChanged += Model_PropertyChanged; - SetLayoutItem(Model?.Root?.Manager?.GetLayoutItemFromModel(Model)); + this.Model.PropertyChanged += Model_PropertyChanged; + SetLayoutItem(this.Model?.Root?.Manager?.GetLayoutItemFromModel(this.Model)); } else SetLayoutItem(null); @@ -68,10 +68,10 @@ protected virtual void OnModelChanged(DependencyPropertyChangedEventArgs e) private void Model_PropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e) { if (e.PropertyName != nameof(LayoutAnchorable.IsEnabled)) return; - if (Model == null) return; - IsEnabled = Model.IsEnabled; - if (IsEnabled || !Model.IsActive) return; - if (Model.Parent != null && Model.Parent is LayoutAnchorablePane layoutAnchorablePane) + if (this.Model == null) return; + this.IsEnabled = this.Model.IsEnabled; + if (this.IsEnabled || !this.Model.IsActive) return; + if (this.Model.Parent != null && this.Model.Parent is LayoutAnchorablePane layoutAnchorablePane) layoutAnchorablePane.SetNextSelectedIndex(); } @@ -105,8 +105,8 @@ private void Model_PropertyChanged(object sender, System.ComponentModel.Property /// protected override void OnGotKeyboardFocus(System.Windows.Input.KeyboardFocusChangedEventArgs e) { - if (Model != null) - Model.IsActive = true; + if (this.Model != null) + this.Model.IsActive = true; base.OnGotKeyboardFocus(e); } @@ -118,8 +118,8 @@ protected override void OnGotKeyboardFocus(System.Windows.Input.KeyboardFocusCha private void LayoutAnchorableControl_Unloaded(object sender, RoutedEventArgs e) { // prevent memory leak via event handler - if (Model != null) - Model.PropertyChanged -= Model_PropertyChanged; + if (this.Model != null) + this.Model.PropertyChanged -= Model_PropertyChanged; Unloaded -= LayoutAnchorableControl_Unloaded; } diff --git a/Source/Controls/H.Controls.Dock/Controls/LayoutAnchorableFloatingWindowControl.xaml.cs b/Source/Controls/H.Controls.Dock/Controls/LayoutAnchorableFloatingWindowControl.xaml.cs index 103b6f46..cccb7ca0 100644 --- a/Source/Controls/H.Controls.Dock/Controls/LayoutAnchorableFloatingWindowControl.xaml.cs +++ b/Source/Controls/H.Controls.Dock/Controls/LayoutAnchorableFloatingWindowControl.xaml.cs @@ -42,12 +42,12 @@ internal LayoutAnchorableFloatingWindowControl(LayoutAnchorableFloatingWindow mo : base(model, isContentImmutable) { _model = model; - HideWindowCommand = new RelayCommand((p) => OnExecuteHideWindowCommand(p), (p) => CanExecuteHideWindowCommand(p)); - CloseWindowCommand = new RelayCommand((p) => OnExecuteCloseWindowCommand(p), (p) => CanExecuteCloseWindowCommand(p)); + this.HideWindowCommand = new RelayCommand((p) => OnExecuteHideWindowCommand(p), (p) => CanExecuteHideWindowCommand(p)); + this.CloseWindowCommand = new RelayCommand((p) => OnExecuteCloseWindowCommand(p), (p) => CanExecuteCloseWindowCommand(p)); Activated += LayoutAnchorableFloatingWindowControl_Activated; UpdateThemeResources(); - MinWidth = _model.RootPanel.CalculatedDockMinWidth(); - MinHeight = _model.RootPanel.CalculatedDockMinHeight(); + this.MinWidth = _model.RootPanel.CalculatedDockMinWidth(); + this.MinHeight = _model.RootPanel.CalculatedDockMinHeight(); if (_model.Root is LayoutRoot root) root.Updated += OnRootUpdated; _model.IsVisibleChanged += _model_IsVisibleChanged; } @@ -55,15 +55,15 @@ internal LayoutAnchorableFloatingWindowControl(LayoutAnchorableFloatingWindow mo private void OnRootUpdated(object sender, EventArgs e) { if (_model?.RootPanel == null) return; - MinWidth = _model.RootPanel.CalculatedDockMinWidth(); - MinHeight = _model.RootPanel.CalculatedDockMinHeight(); + this.MinWidth = _model.RootPanel.CalculatedDockMinWidth(); + this.MinHeight = _model.RootPanel.CalculatedDockMinHeight(); } private void LayoutAnchorableFloatingWindowControl_Activated(object sender, EventArgs e) { // Issue similar to: http://avalondock.codeplex.com/workitem/15036 BindingExpression visibilityBinding = GetBindingExpression(VisibilityProperty); - if (visibilityBinding == null && Visibility == Visibility.Visible) SetVisibilityBinding(); + if (visibilityBinding == null && this.Visibility == Visibility.Visible) SetVisibilityBinding(); } internal LayoutAnchorableFloatingWindowControl(LayoutAnchorableFloatingWindow model) @@ -117,14 +117,14 @@ public override void EnableBindings() { _model.PropertyChanged += _model_PropertyChanged; SetVisibilityBinding(); - if (Model.Root is LayoutRoot layoutRoot) layoutRoot.Updated += OnRootUpdated; + if (this.Model.Root is LayoutRoot layoutRoot) layoutRoot.Updated += OnRootUpdated; base.EnableBindings(); } /// public override void DisableBindings() { - if (Model.Root is LayoutRoot layoutRoot) layoutRoot.Updated -= OnRootUpdated; + if (this.Model.Root is LayoutRoot layoutRoot) layoutRoot.Updated -= OnRootUpdated; BindingOperations.ClearBinding(_model, VisibilityProperty); _model.PropertyChanged -= _model_PropertyChanged; base.DisableBindings(); @@ -165,7 +165,7 @@ IEnumerable IOverlayWindowHost.GetDropAreas(LayoutFloatingWindowContr if (_dropAreas != null) return _dropAreas; _dropAreas = new List(); if (draggingWindow.Model is LayoutDocumentFloatingWindow) return _dropAreas; - System.Windows.Media.Visual rootVisual = (Content as FloatingWindowContentHost).RootVisual; + System.Windows.Media.Visual rootVisual = (this.Content as FloatingWindowContentHost).RootVisual; foreach (LayoutAnchorablePaneControl areaHost in rootVisual.FindVisualChildren()) _dropAreas.Add(new DropArea(areaHost, DropAreaType.AnchorablePane)); foreach (LayoutDocumentPaneControl areaHost in rootVisual.FindVisualChildren()) @@ -184,7 +184,7 @@ protected override void OnInitialized(EventArgs e) { base.OnInitialized(e); DockingManager manager = _model.Root.Manager; - Content = manager.CreateUIElementForModel(_model.RootPanel); + this.Content = manager.CreateUIElementForModel(_model.RootPanel); //SetBinding(VisibilityProperty, new Binding("IsVisible") { Source = _model, Converter = new BoolToVisibilityConverter(), Mode = BindingMode.OneWay, ConverterParameter = Visibility.Hidden }); //Issue: http://avalondock.codeplex.com/workitem/15036 @@ -196,7 +196,7 @@ protected override void OnInitialized(EventArgs e) /// protected override void OnClosed(EventArgs e) { - ILayoutRoot root = Model.Root; + ILayoutRoot root = this.Model.Root; if (root != null) { if (root is LayoutRoot layoutRoot) layoutRoot.Updated -= OnRootUpdated; @@ -209,7 +209,7 @@ protected override void OnClosed(EventArgs e) _overlayWindow = null; } base.OnClosed(e); - if (!CloseInitiatedByUser) root?.FloatingWindows.Remove(_model); + if (!this.CloseInitiatedByUser) root?.FloatingWindows.Remove(_model); // We have to clear binding instead of creating a new empty binding. BindingOperations.ClearBinding(_model, VisibilityProperty); @@ -225,8 +225,8 @@ protected override void OnClosed(EventArgs e) /// protected override void OnClosing(System.ComponentModel.CancelEventArgs e) { - bool canHide = HideWindowCommand.CanExecute(null); - if (CloseInitiatedByUser && !KeepContentVisibleOnClose && !canHide) e.Cancel = true; + bool canHide = this.HideWindowCommand.CanExecute(null); + if (this.CloseInitiatedByUser && !this.KeepContentVisibleOnClose && !canHide) e.Cancel = true; base.OnClosing(e); } @@ -284,15 +284,15 @@ private void _model_PropertyChanged(object sender, System.ComponentModel.Propert break; case nameof(LayoutAnchorableFloatingWindow.IsVisible): - if (_model.IsVisible != IsVisible) - Visibility = _model.IsVisible ? Visibility.Visible : Visibility.Hidden; + if (_model.IsVisible != this.IsVisible) + this.Visibility = _model.IsVisible ? Visibility.Visible : Visibility.Hidden; break; } } private void _model_IsVisibleChanged(object sender, EventArgs e) { - if (!IsVisible && _model.IsVisible) Show(); + if (!this.IsVisible && _model.IsVisible) Show(); } private void CreateOverlayWindow(LayoutFloatingWindowControl draggingWindow) @@ -317,10 +317,10 @@ private void CreateOverlayWindow(LayoutFloatingWindowControl draggingWindow) private bool OpenContextMenu() { System.Windows.Controls.ContextMenu ctxMenu = _model.Root.Manager.AnchorableContextMenu; - if (ctxMenu == null || SingleContentLayoutItem == null) return false; + if (ctxMenu == null || this.SingleContentLayoutItem == null) return false; ctxMenu.PlacementTarget = null; ctxMenu.Placement = PlacementMode.MousePoint; - ctxMenu.DataContext = SingleContentLayoutItem; + ctxMenu.DataContext = this.SingleContentLayoutItem; ctxMenu.IsOpen = true; return true; } @@ -329,7 +329,7 @@ private void SetVisibilityBinding() { SetBinding( VisibilityProperty, - new Binding(nameof(IsVisible)) + new Binding(nameof(this.IsVisible)) { Source = _model, Converter = new BoolToVisibilityConverter(), @@ -343,8 +343,8 @@ private void SetVisibilityBinding() private void LayoutAnchorableFloatingWindowControl_IsVisibleChanged(object sender, DependencyPropertyChangedEventArgs e) { BindingExpression visibilityBinding = GetBindingExpression(VisibilityProperty); - if (IsVisible && visibilityBinding == null) - SetBinding(VisibilityProperty, new Binding(nameof(IsVisible)) + if (this.IsVisible && visibilityBinding == null) + SetBinding(VisibilityProperty, new Binding(nameof(this.IsVisible)) { Source = _model, Converter = new BoolToVisibilityConverter(), Mode = BindingMode.OneWay, ConverterParameter = Visibility.Hidden }); } @@ -352,10 +352,10 @@ private void LayoutAnchorableFloatingWindowControl_IsVisibleChanged(object sende private bool CanExecuteHideWindowCommand(object parameter) { - DockingManager manager = Model?.Root?.Manager; + DockingManager manager = this.Model?.Root?.Manager; if (manager == null) return false; bool canExecute = false; - foreach (LayoutAnchorable anchorable in Model.Descendents().OfType().ToArray()) + foreach (LayoutAnchorable anchorable in this.Model.Descendents().OfType().ToArray()) { if (!anchorable.CanHide) { @@ -375,8 +375,8 @@ private bool CanExecuteHideWindowCommand(object parameter) private void OnExecuteHideWindowCommand(object parameter) { - DockingManager manager = Model.Root.Manager; - foreach (LayoutAnchorable anchorable in Model.Descendents().OfType().ToArray()) + DockingManager manager = this.Model.Root.Manager; + foreach (LayoutAnchorable anchorable in this.Model.Descendents().OfType().ToArray()) { LayoutAnchorableItem anchorableLayoutItem = manager.GetLayoutItemFromModel(anchorable) as LayoutAnchorableItem; anchorableLayoutItem.HideCommand.Execute(parameter); @@ -390,10 +390,10 @@ private void OnExecuteHideWindowCommand(object parameter) private bool CanExecuteCloseWindowCommand(object parameter) { - DockingManager manager = Model?.Root?.Manager; + DockingManager manager = this.Model?.Root?.Manager; if (manager == null) return false; bool canExecute = false; - foreach (LayoutAnchorable anchorable in Model.Descendents().OfType().ToArray()) + foreach (LayoutAnchorable anchorable in this.Model.Descendents().OfType().ToArray()) { if (!anchorable.CanClose) { @@ -413,8 +413,8 @@ private bool CanExecuteCloseWindowCommand(object parameter) private void OnExecuteCloseWindowCommand(object parameter) { - DockingManager manager = Model.Root.Manager; - foreach (LayoutAnchorable anchorable in Model.Descendents().OfType().ToArray()) + DockingManager manager = this.Model.Root.Manager; + foreach (LayoutAnchorable anchorable in this.Model.Descendents().OfType().ToArray()) { LayoutAnchorableItem anchorableLayoutItem = manager.GetLayoutItemFromModel(anchorable) as LayoutAnchorableItem; anchorableLayoutItem.CloseCommand.Execute(parameter); diff --git a/Source/Controls/H.Controls.Dock/Controls/LayoutAnchorableItem.cs b/Source/Controls/H.Controls.Dock/Controls/LayoutAnchorableItem.cs index 6aad66d4..a2d574cb 100644 --- a/Source/Controls/H.Controls.Dock/Controls/LayoutAnchorableItem.cs +++ b/Source/Controls/H.Controls.Dock/Controls/LayoutAnchorableItem.cs @@ -71,7 +71,7 @@ protected virtual void OnHideCommandChanged(DependencyPropertyChangedEventArgs e /// Coerces the value. private static object CoerceHideCommandValue(DependencyObject d, object value) => value; - private bool CanExecuteHideCommand(object parameter) => LayoutElement != null && _anchorable.CanHide; + private bool CanExecuteHideCommand(object parameter) => this.LayoutElement != null && _anchorable.CanHide; private void ExecuteHideCommand(object parameter) => _anchorable?.Root?.Manager?.ExecuteHideCommand(_anchorable); @@ -105,8 +105,8 @@ protected virtual void OnAutoHideCommandChanged(DependencyPropertyChangedEventAr private bool CanExecuteAutoHideCommand(object parameter) { - if (LayoutElement == null) return false; - if (LayoutElement.FindParent() != null) return false;//is floating + if (this.LayoutElement == null) return false; + if (this.LayoutElement.FindParent() != null) return false;//is floating return _anchorable.CanAutoHide; } @@ -140,9 +140,9 @@ protected virtual void OnDockCommandChanged(DependencyPropertyChangedEventArgs e /// Coerces the value. private static object CoerceDockCommandValue(DependencyObject d, object value) => value; - private bool CanExecuteDockCommand(object parameter) => LayoutElement?.FindParent() != null; + private bool CanExecuteDockCommand(object parameter) => this.LayoutElement?.FindParent() != null; - private void ExecuteDockCommand(object parameter) => LayoutElement.Root.Manager.ExecuteDockCommand(_anchorable); + private void ExecuteDockCommand(object parameter) => this.LayoutElement.Root.Manager.ExecuteDockCommand(_anchorable); #endregion DockCommand @@ -242,19 +242,19 @@ protected override void InitDefaultCommands() /// protected override void ClearDefaultBindings() { - if (HideCommand == _defaultHideCommand) BindingOperations.ClearBinding(this, HideCommandProperty); - if (AutoHideCommand == _defaultAutoHideCommand) BindingOperations.ClearBinding(this, AutoHideCommandProperty); - if (DockCommand == _defaultDockCommand) BindingOperations.ClearBinding(this, DockCommandProperty); + if (this.HideCommand == _defaultHideCommand) BindingOperations.ClearBinding(this, HideCommandProperty); + if (this.AutoHideCommand == _defaultAutoHideCommand) BindingOperations.ClearBinding(this, AutoHideCommandProperty); + if (this.DockCommand == _defaultDockCommand) BindingOperations.ClearBinding(this, DockCommandProperty); base.ClearDefaultBindings(); } /// protected override void SetDefaultBindings() { - if (HideCommand == null) HideCommand = _defaultHideCommand; - if (AutoHideCommand == null) AutoHideCommand = _defaultAutoHideCommand; - if (DockCommand == null) DockCommand = _defaultDockCommand; - Visibility = _anchorable.IsVisible ? Visibility.Visible : Visibility.Hidden; + if (this.HideCommand == null) this.HideCommand = _defaultHideCommand; + if (this.AutoHideCommand == null) this.AutoHideCommand = _defaultAutoHideCommand; + if (this.DockCommand == null) this.DockCommand = _defaultDockCommand; + this.Visibility = _anchorable.IsVisible ? Visibility.Visible : Visibility.Hidden; base.SetDefaultBindings(); } @@ -265,7 +265,7 @@ protected override void OnVisibilityChanged() { using (_visibilityReentrantFlag.Enter()) { - switch (Visibility) + switch (this.Visibility) { case Visibility.Hidden: case Visibility.Collapsed: _anchorable.HideAnchorable(false); break; case Visibility.Visible: _anchorable.Show(); break; @@ -284,7 +284,7 @@ private void _anchorable_IsVisibleChanged(object sender, EventArgs e) if (_anchorable?.Root == null || !_anchorableVisibilityReentrantFlag.CanEnter) return; using (_anchorableVisibilityReentrantFlag.Enter()) { - Visibility = _anchorable.IsVisible ? Visibility.Visible : Visibility.Hidden; + this.Visibility = _anchorable.IsVisible ? Visibility.Visible : Visibility.Hidden; } } diff --git a/Source/Controls/H.Controls.Dock/Controls/LayoutAnchorablePaneControl.xaml.cs b/Source/Controls/H.Controls.Dock/Controls/LayoutAnchorablePaneControl.xaml.cs index 8715770d..1f54f3c6 100644 --- a/Source/Controls/H.Controls.Dock/Controls/LayoutAnchorablePaneControl.xaml.cs +++ b/Source/Controls/H.Controls.Dock/Controls/LayoutAnchorablePaneControl.xaml.cs @@ -103,8 +103,8 @@ protected override void OnMouseRightButtonDown(System.Windows.Input.MouseButtonE private void OnSizeChanged(object sender, SizeChangedEventArgs e) { ILayoutPositionableElementWithActualSize modelWithActualSize = _model; - modelWithActualSize.ActualWidth = ActualWidth; - modelWithActualSize.ActualHeight = ActualHeight; + modelWithActualSize.ActualWidth = this.ActualWidth; + modelWithActualSize.ActualHeight = this.ActualHeight; } #endregion Private Methods diff --git a/Source/Controls/H.Controls.Dock/Controls/LayoutAnchorableTabItem.xaml.cs b/Source/Controls/H.Controls.Dock/Controls/LayoutAnchorableTabItem.xaml.cs index 822baa09..b5c7d833 100644 --- a/Source/Controls/H.Controls.Dock/Controls/LayoutAnchorableTabItem.xaml.cs +++ b/Source/Controls/H.Controls.Dock/Controls/LayoutAnchorableTabItem.xaml.cs @@ -56,7 +56,7 @@ public LayoutContent Model /// Provides derived classes an opportunity to handle changes to the property. protected virtual void OnModelChanged(DependencyPropertyChangedEventArgs e) { - SetLayoutItem(Model?.Root.Manager.GetLayoutItemFromModel(Model)); + SetLayoutItem(this.Model?.Root.Manager.GetLayoutItemFromModel(this.Model)); //UpdateLogicalParent(); } @@ -133,7 +133,7 @@ protected override void OnMouseLeftButtonUp(System.Windows.Input.MouseButtonEven { _isMouseDown = false; base.OnMouseLeftButtonUp(e); - Model.IsActive = true; + this.Model.IsActive = true; } /// @@ -155,7 +155,7 @@ protected override void OnMouseEnter(MouseEventArgs e) { base.OnMouseEnter(e); if (_draggingItem == null || _draggingItem == this || e.LeftButton != MouseButtonState.Pressed) return; - LayoutContent model = Model; + LayoutContent model = this.Model; ILayoutContainer container = model.Parent; ILayoutPane containerPane = model.Parent as ILayoutPane; if (containerPane is LayoutAnchorablePane layoutAnchorablePane && !layoutAnchorablePane.CanRepositionItems) return; diff --git a/Source/Controls/H.Controls.Dock/Controls/LayoutAutoHideWindowControl.xaml.cs b/Source/Controls/H.Controls.Dock/Controls/LayoutAutoHideWindowControl.xaml.cs index aa2e0e40..7adf27e8 100644 --- a/Source/Controls/H.Controls.Dock/Controls/LayoutAutoHideWindowControl.xaml.cs +++ b/Source/Controls/H.Controls.Dock/Controls/LayoutAutoHideWindowControl.xaml.cs @@ -115,7 +115,7 @@ internal void Show(LayoutAnchorControl anchor) _model.PropertyChanged += _model_PropertyChanged; SetLayoutTransform(); StartListeningToViewboxZoomChange(); - Visibility = Visibility.Visible; + this.Visibility = Visibility.Visible; InvalidateMeasure(); UpdateWindowPos(); Win32Helper.BringWindowToTop(_internalHwndSource.Handle); @@ -131,7 +131,7 @@ internal void Hide() _anchor = null; _model = null; _manager = null; - Visibility = Visibility.Hidden; + this.Visibility = Visibility.Hidden; } internal bool IsWin32MouseOver @@ -144,8 +144,8 @@ internal bool IsWin32MouseOver Rect rectWindow = this.GetScreenArea(); if (rectWindow.Contains(new Point(ptMouse.X, ptMouse.Y))) return true; - DockingManager manager = Model?.Root.Manager; - LayoutAnchorControl anchor = manager?.FindVisualChildren().Where(c => c.Model == Model).FirstOrDefault(); + DockingManager manager = this.Model?.Root.Manager; + LayoutAnchorControl anchor = manager?.FindVisualChildren().Where(c => c.Model == this.Model).FirstOrDefault(); return anchor != null && anchor.IsMouseOver; //location = anchor.PointToScreenDPI(new Point()); @@ -248,9 +248,9 @@ private void SetLayoutTransform() // 2) An ancestor Viewbox changes its zoom (the Viewbox or its child changes size) // We would also want to refresh when the visual tree changes such that an ancestor Viewbox is added, removed, or changed. However, this is completely unnecessary // because the LayoutAutoHideWindowControl closes if a visual ancestor is changed: DockingManager.Unloaded handler calls _autoHideWindowManager?.HideAutoWindow() - if (ChildLayoutTransform is Transform transform && _internalHostPresenter.LayoutTransform.Value != transform.Value) + if (this.ChildLayoutTransform is Transform transform && _internalHostPresenter.LayoutTransform.Value != transform.Value) { - LayoutTransform = (Transform)transform.Inverse; + this.LayoutTransform = (Transform)transform.Inverse; _internalHostPresenter.LayoutTransform = transform; } } @@ -275,7 +275,7 @@ private void CreateInternalGrid() _internalGrid = new Grid { FlowDirection = FlowDirection.LeftToRight }; _internalGrid.SetBinding(Panel.BackgroundProperty, new Binding(nameof(Grid.Background)) { Source = this }); - _internalHost = new LayoutAnchorableControl { Model = _model, Style = AnchorableStyle }; + _internalHost = new LayoutAnchorableControl { Model = _model, Style = this.AnchorableStyle }; _internalHost.SetBinding(FlowDirectionProperty, new Binding("Model.Root.Manager.FlowDirection") { Source = this }); KeyboardNavigation.SetTabNavigation(_internalGrid, KeyboardNavigationMode.Cycle); @@ -293,8 +293,8 @@ private void CreateInternalGrid() Grid.SetColumn(_resizer, 0); Grid.SetColumn(_internalHost, 1); _resizer.Cursor = Cursors.SizeWE; - HorizontalAlignment = HorizontalAlignment.Right; - VerticalAlignment = VerticalAlignment.Stretch; + this.HorizontalAlignment = HorizontalAlignment.Right; + this.VerticalAlignment = VerticalAlignment.Stretch; break; case AnchorSide.Left: @@ -303,8 +303,8 @@ private void CreateInternalGrid() Grid.SetColumn(_internalHost, 0); Grid.SetColumn(_resizer, 1); _resizer.Cursor = Cursors.SizeWE; - HorizontalAlignment = HorizontalAlignment.Left; - VerticalAlignment = VerticalAlignment.Stretch; + this.HorizontalAlignment = HorizontalAlignment.Left; + this.VerticalAlignment = VerticalAlignment.Stretch; break; case AnchorSide.Top: @@ -313,8 +313,8 @@ private void CreateInternalGrid() Grid.SetRow(_internalHost, 0); Grid.SetRow(_resizer, 1); _resizer.Cursor = Cursors.SizeNS; - VerticalAlignment = VerticalAlignment.Top; - HorizontalAlignment = HorizontalAlignment.Stretch; + this.VerticalAlignment = VerticalAlignment.Top; + this.HorizontalAlignment = HorizontalAlignment.Stretch; break; case AnchorSide.Bottom: @@ -323,8 +323,8 @@ private void CreateInternalGrid() Grid.SetRow(_resizer, 0); Grid.SetRow(_internalHost, 1); _resizer.Cursor = Cursors.SizeNS; - VerticalAlignment = VerticalAlignment.Bottom; - HorizontalAlignment = HorizontalAlignment.Stretch; + this.VerticalAlignment = VerticalAlignment.Bottom; + this.HorizontalAlignment = HorizontalAlignment.Stretch; break; } _internalGrid.Children.Add(_resizer); @@ -407,7 +407,7 @@ private void OnResizerDragCompleted(object sender, System.Windows.Controls.Primi GeneralTransform trToWnd = TransformToAncestor(rootVisual); //var transformedDelta = trToWnd.Transform(new Point(e.HorizontalChange, e.VerticalChange)) - trToWnd.Transform(new Point()); - Point deltaPoint = ChildLayoutTransform.Inverse.Transform(new Point(Canvas.GetLeft(_resizerGhost) - _initialStartPoint.X, Canvas.GetTop(_resizerGhost) - _initialStartPoint.Y)); + Point deltaPoint = this.ChildLayoutTransform.Inverse.Transform(new Point(Canvas.GetLeft(_resizerGhost) - _initialStartPoint.X, Canvas.GetTop(_resizerGhost) - _initialStartPoint.Y)); double delta; if (_side == AnchorSide.Right || _side == AnchorSide.Left) @@ -447,7 +447,7 @@ private void OnResizerDragCompleted(object sender, System.Windows.Controls.Primi } } HideResizerOverlayWindow(); - IsResizing = false; + this.IsResizing = false; InvalidateMeasure(); } @@ -458,7 +458,7 @@ private void OnResizerDragDelta(object sender, System.Windows.Controls.Primitive GeneralTransform trToWnd = TransformToAncestor(rootVisual); Vector transformedDelta = trToWnd.Transform(new Point(e.HorizontalChange, e.VerticalChange)) - trToWnd.Transform(new Point()); - if (ChildLayoutTransform is Transform transform && !transform.Value.IsIdentity) + if (this.ChildLayoutTransform is Transform transform && !transform.Value.IsIdentity) { transformedDelta = transform.Transform(new Point() + transformedDelta) - new Point(); } @@ -475,7 +475,7 @@ private void OnResizerDragDelta(object sender, System.Windows.Controls.Primitive private void OnResizerDragStarted(object sender, System.Windows.Controls.Primitives.DragStartedEventArgs e) { ShowResizerOverlayWindow(sender as LayoutGridResizerControl); - IsResizing = true; + this.IsResizing = true; } #endregion Private Methods diff --git a/Source/Controls/H.Controls.Dock/Controls/LayoutDocumentControl.xaml.cs b/Source/Controls/H.Controls.Dock/Controls/LayoutDocumentControl.xaml.cs index ec95900e..c9c1e5c4 100644 --- a/Source/Controls/H.Controls.Dock/Controls/LayoutDocumentControl.xaml.cs +++ b/Source/Controls/H.Controls.Dock/Controls/LayoutDocumentControl.xaml.cs @@ -51,10 +51,10 @@ public LayoutContent Model protected virtual void OnModelChanged(DependencyPropertyChangedEventArgs e) { if (e.OldValue != null) ((LayoutContent)e.OldValue).PropertyChanged -= Model_PropertyChanged; - if (Model != null) + if (this.Model != null) { - Model.PropertyChanged += Model_PropertyChanged; - SetLayoutItem(Model?.Root?.Manager?.GetLayoutItemFromModel(Model)); + this.Model.PropertyChanged += Model_PropertyChanged; + SetLayoutItem(this.Model?.Root?.Manager?.GetLayoutItemFromModel(this.Model)); } else SetLayoutItem(null); @@ -63,10 +63,10 @@ protected virtual void OnModelChanged(DependencyPropertyChangedEventArgs e) private void Model_PropertyChanged(object sender, PropertyChangedEventArgs e) { if (e.PropertyName != nameof(LayoutContent.IsEnabled)) return; - if (Model == null) return; - IsEnabled = Model.IsEnabled; - if (IsEnabled || !Model.IsActive) return; - if (Model.Parent is LayoutDocumentPane layoutDocumentPane) layoutDocumentPane.SetNextSelectedIndex(); + if (this.Model == null) return; + this.IsEnabled = this.Model.IsEnabled; + if (this.IsEnabled || !this.Model.IsActive) return; + if (this.Model.Parent is LayoutDocumentPane layoutDocumentPane) layoutDocumentPane.SetNextSelectedIndex(); } #endregion Model @@ -101,7 +101,7 @@ private void Model_PropertyChanged(object sender, PropertyChangedEventArgs e) /// protected override void OnPreviewMouseLeftButtonUp(MouseButtonEventArgs e) { - Debug.WriteLine($"{nameof(OnPreviewMouseLeftButtonUp)}: {LayoutItem.ContentId}"); + Debug.WriteLine($"{nameof(OnPreviewMouseLeftButtonUp)}: {this.LayoutItem.ContentId}"); SetIsActive(); base.OnPreviewMouseLeftButtonUp(e); } @@ -126,7 +126,7 @@ protected override void OnMouseRightButtonDown(MouseButtonEventArgs e) private void SetIsActive() { - if (Model != null && !Model.IsActive) Model.IsActive = true; + if (this.Model != null && !this.Model.IsActive) this.Model.IsActive = true; } #endregion Private Methods diff --git a/Source/Controls/H.Controls.Dock/Controls/LayoutDocumentFloatingWindowControl.xaml.cs b/Source/Controls/H.Controls.Dock/Controls/LayoutDocumentFloatingWindowControl.xaml.cs index 63b96987..6f78a321 100644 --- a/Source/Controls/H.Controls.Dock/Controls/LayoutDocumentFloatingWindowControl.xaml.cs +++ b/Source/Controls/H.Controls.Dock/Controls/LayoutDocumentFloatingWindowControl.xaml.cs @@ -42,9 +42,9 @@ internal LayoutDocumentFloatingWindowControl(LayoutDocumentFloatingWindow model, : base(model, isContentImmutable) { _model = model; - HideWindowCommand = new RelayCommand(OnExecuteHideWindowCommand, CanExecuteHideWindowCommand); - CloseWindowCommand = new RelayCommand(OnExecuteCloseWindowCommand, CanExecuteCloseWindowCommand); - Closed += (sender, args) => { Owner?.Focus(); }; + this.HideWindowCommand = new RelayCommand(OnExecuteHideWindowCommand, CanExecuteHideWindowCommand); + this.CloseWindowCommand = new RelayCommand(OnExecuteCloseWindowCommand, CanExecuteCloseWindowCommand); + Closed += (sender, args) => { this.Owner?.Focus(); }; UpdateThemeResources(); } @@ -94,7 +94,7 @@ protected override void OnInitialized(EventArgs e) { base.OnInitialized(e); DockingManager manager = _model.Root.Manager; - Content = manager.CreateUIElementForModel(_model.RootPanel); + this.Content = manager.CreateUIElementForModel(_model.RootPanel); // TODO IsVisibleChanged //SetBinding(SingleContentLayoutItemProperty, new Binding("Model.SinglePane.SelectedContent") { Source = this, Converter = new LayoutItemFromLayoutModelConverter() }); _model.RootPanel.ChildrenCollectionChanged += RootPanelOnChildrenCollectionChanged; @@ -130,7 +130,7 @@ private void ActiveOfSinglePane(bool isActive) private LayoutDocumentPaneControl FindDocumentPaneControlByMousePoint() { Point mousePosition = Win32Helper.GetMousePosition(); - System.Windows.Media.Visual rootVisual = ((FloatingWindowContentHost)Content).RootVisual; + System.Windows.Media.Visual rootVisual = ((FloatingWindowContentHost)this.Content).RootVisual; IEnumerable areaHosts = rootVisual.FindVisualChildren(); foreach (LayoutDocumentPaneControl areaHost in areaHosts) @@ -255,7 +255,7 @@ protected override IntPtr FilterMessage(IntPtr hwnd, int msg, IntPtr wParam, Int break; case Win32Helper.WM_CLOSE: - if (CloseInitiatedByUser) + if (this.CloseInitiatedByUser) { // We want to force the window to go through our standard logic for closing. // So, if the window close is initiated outside of our code (such as from the taskbar), @@ -271,7 +271,7 @@ protected override IntPtr FilterMessage(IntPtr hwnd, int msg, IntPtr wParam, Int /// protected override void OnClosed(EventArgs e) { - ILayoutRoot root = Model.Root; + ILayoutRoot root = this.Model.Root; // MK sometimes root is null, prevent crash, or should it always be set?? if (root != null) { @@ -284,7 +284,7 @@ protected override void OnClosed(EventArgs e) _overlayWindow = null; } base.OnClosed(e); - if (!CloseInitiatedByUser) root?.FloatingWindows.Remove(_model); + if (!this.CloseInitiatedByUser) root?.FloatingWindows.Remove(_model); _model.PropertyChanged -= Model_PropertyChanged; } @@ -300,10 +300,10 @@ private void RootPanelOnChildrenCollectionChanged(object sender, EventArgs e) private bool OpenContextMenu() { System.Windows.Controls.ContextMenu ctxMenu = _model.Root.Manager.DocumentContextMenu; - if (ctxMenu == null || SingleContentLayoutItem == null) return false; + if (ctxMenu == null || this.SingleContentLayoutItem == null) return false; ctxMenu.PlacementTarget = null; ctxMenu.Placement = PlacementMode.MousePoint; - ctxMenu.DataContext = SingleContentLayoutItem; + ctxMenu.DataContext = this.SingleContentLayoutItem; ctxMenu.IsOpen = true; return true; } @@ -312,7 +312,7 @@ private bool OpenContextMenu() protected override void OnClosing(System.ComponentModel.CancelEventArgs e) { // TODO - if (CloseInitiatedByUser && !KeepContentVisibleOnClose) + if (this.CloseInitiatedByUser && !this.KeepContentVisibleOnClose) { e.Cancel = true; //_model.Descendents().OfType().ToArray().ForEach((a) => a.Hide()); @@ -392,7 +392,7 @@ public IEnumerable GetDropAreas(LayoutFloatingWindowControl draggingW } } - System.Windows.Media.Visual rootVisual = ((FloatingWindowContentHost)Content).RootVisual; + System.Windows.Media.Visual rootVisual = ((FloatingWindowContentHost)this.Content).RootVisual; foreach (LayoutAnchorablePaneControl areaHost in rootVisual.FindVisualChildren()) _dropAreas.Add(new DropArea(areaHost, DropAreaType.AnchorablePane)); @@ -451,7 +451,7 @@ internal IEnumerable GetLayoutAnchorable(LayoutAnchorablePaneG private bool CanExecuteHideWindowCommand(object parameter) { - ILayoutRoot root = Model?.Root; + ILayoutRoot root = this.Model?.Root; DockingManager manager = root?.Manager; if (manager == null) return false; @@ -484,7 +484,7 @@ private bool CanExecuteHideWindowCommand(object parameter) private void OnExecuteHideWindowCommand(object parameter) { - DockingManager manager = Model.Root.Manager; + DockingManager manager = this.Model.Root.Manager; foreach (LayoutContent anchorable in this.Model.Descendents().OfType().ToArray()) { //if (manager.GetLayoutItemFromModel(anchorable) is LayoutAnchorableItem layoutAnchorableItem) layoutAnchorableItem.HideCommand.Execute(parameter); @@ -501,7 +501,7 @@ private void OnExecuteHideWindowCommand(object parameter) private bool CanExecuteCloseWindowCommand(object parameter) { - DockingManager manager = Model?.Root?.Manager; + DockingManager manager = this.Model?.Root?.Manager; if (manager == null) return false; bool canExecute = false; @@ -525,7 +525,7 @@ private bool CanExecuteCloseWindowCommand(object parameter) private void OnExecuteCloseWindowCommand(object parameter) { - DockingManager manager = Model.Root.Manager; + DockingManager manager = this.Model.Root.Manager; foreach (LayoutDocument document in this.Model.Descendents().OfType().ToArray()) { LayoutDocumentItem documentLayoutItem = manager.GetLayoutItemFromModel(document) as LayoutDocumentItem; diff --git a/Source/Controls/H.Controls.Dock/Controls/LayoutDocumentItem.cs b/Source/Controls/H.Controls.Dock/Controls/LayoutDocumentItem.cs index 46ede4c2..ccfe0a2c 100644 --- a/Source/Controls/H.Controls.Dock/Controls/LayoutDocumentItem.cs +++ b/Source/Controls/H.Controls.Dock/Controls/LayoutDocumentItem.cs @@ -80,7 +80,7 @@ protected override void OnVisibilityChanged() { if (_document?.Root != null) { - _document.IsVisible = Visibility == Visibility.Visible; + _document.IsVisible = this.Visibility == Visibility.Visible; if (_document.Parent is LayoutDocumentPane layoutDocumentPane) layoutDocumentPane.ComputeVisibility(); } base.OnVisibilityChanged(); @@ -102,7 +102,7 @@ internal override void Detach() protected override bool CanExecuteDockAsDocumentCommand() { - return LayoutElement != null && LayoutElement.FindParent() != null && LayoutElement.IsFloating; + return this.LayoutElement != null && this.LayoutElement.FindParent() != null && this.LayoutElement.IsFloating; } #endregion Overrides diff --git a/Source/Controls/H.Controls.Dock/Controls/LayoutDocumentPaneControl.xaml.cs b/Source/Controls/H.Controls.Dock/Controls/LayoutDocumentPaneControl.xaml.cs index 7b051e69..bf3e9784 100644 --- a/Source/Controls/H.Controls.Dock/Controls/LayoutDocumentPaneControl.xaml.cs +++ b/Source/Controls/H.Controls.Dock/Controls/LayoutDocumentPaneControl.xaml.cs @@ -128,8 +128,8 @@ protected override void OnItemsChanged(NotifyCollectionChangedEventArgs e) private void OnSizeChanged(object sender, SizeChangedEventArgs e) { ILayoutPositionableElementWithActualSize modelWithAtcualSize = _model; - modelWithAtcualSize.ActualWidth = ActualWidth; - modelWithAtcualSize.ActualHeight = ActualHeight; + modelWithAtcualSize.ActualWidth = this.ActualWidth; + modelWithAtcualSize.ActualHeight = this.ActualHeight; } #endregion Private Methods diff --git a/Source/Controls/H.Controls.Dock/Controls/LayoutDocumentTabItem.xaml.cs b/Source/Controls/H.Controls.Dock/Controls/LayoutDocumentTabItem.xaml.cs index 05819820..ea8f7080 100644 --- a/Source/Controls/H.Controls.Dock/Controls/LayoutDocumentTabItem.xaml.cs +++ b/Source/Controls/H.Controls.Dock/Controls/LayoutDocumentTabItem.xaml.cs @@ -63,10 +63,10 @@ public LayoutContent Model /// Provides derived classes an opportunity to handle changes to the property. protected virtual void OnModelChanged(DependencyPropertyChangedEventArgs e) { - LayoutItem layoutItem = (Model?.Root?.Manager)?.GetLayoutItemFromModel(Model); + LayoutItem layoutItem = (this.Model?.Root?.Manager)?.GetLayoutItemFromModel(this.Model); SetLayoutItem(layoutItem); if (layoutItem != null) - Model.TabItem = this; + this.Model.TabItem = this; //UpdateLogicalParent(); } @@ -103,8 +103,8 @@ protected override void OnMouseLeftButtonDown(MouseButtonEventArgs e) base.OnMouseLeftButtonDown(e); CaptureMouse(); _allowDrag = false; - Model.IsActive = true; - if (Model is LayoutDocument layoutDocument && !layoutDocument.CanMove) return; + this.Model.IsActive = true; + if (this.Model is LayoutDocument layoutDocument && !layoutDocument.CanMove) return; if (e.ClickCount != 1) return; _mouseDownPoint = e.GetPosition(this); _isMouseDown = true; @@ -126,7 +126,7 @@ protected override void OnMouseMove(MouseEventArgs e) _allowDrag = true; } } - if (!IsMouseCaptured || !_allowDrag) return; + if (!this.IsMouseCaptured || !_allowDrag) return; Point mousePosInScreenCoord = this.PointToScreenDPI(e.GetPosition(this)); if (!_parentDocumentTabPanelScreenArea.Contains(mousePosInScreenCoord)) StartDraggingFloatingWindowForContent(); @@ -135,15 +135,15 @@ protected override void OnMouseMove(MouseEventArgs e) int indexOfTabItemWithMouseOver = _otherTabsScreenArea.FindIndex(r => r.Contains(mousePosInScreenCoord)); if (indexOfTabItemWithMouseOver < 0) return; LayoutContent targetModel = _otherTabs[indexOfTabItemWithMouseOver].Content as LayoutContent; - ILayoutContainer container = Model.Parent; - ILayoutPane containerPane = Model.Parent as ILayoutPane; + ILayoutContainer container = this.Model.Parent; + ILayoutPane containerPane = this.Model.Parent as ILayoutPane; if (containerPane is LayoutDocumentPane layoutDocumentPane && !layoutDocumentPane.CanRepositionItems) return; if (containerPane.Parent is LayoutDocumentPaneGroup layoutDocumentPaneGroup && !layoutDocumentPaneGroup.CanRepositionItems) return; List childrenList = container.Children.ToList(); - containerPane.MoveChild(childrenList.IndexOf(Model), childrenList.IndexOf(targetModel)); - Model.IsActive = true; + containerPane.MoveChild(childrenList.IndexOf(this.Model), childrenList.IndexOf(targetModel)); + this.Model.IsActive = true; _parentDocumentTabPanel.UpdateLayout(); UpdateDragDetails(); } @@ -154,7 +154,7 @@ protected override void OnMouseLeftButtonUp(MouseButtonEventArgs e) { _isMouseDown = false; _allowDrag = false; - if (IsMouseCaptured) ReleaseMouseCapture(); + if (this.IsMouseCaptured) ReleaseMouseCapture(); base.OnMouseLeftButtonUp(e); } @@ -175,9 +175,9 @@ protected override void OnMouseEnter(MouseEventArgs e) /// protected override void OnMouseDown(MouseButtonEventArgs e) { - if (LayoutItem != null && e.ChangedButton == MouseButton.Middle && LayoutItem.CloseCommand.CanExecute(null)) + if (this.LayoutItem != null && e.ChangedButton == MouseButton.Middle && this.LayoutItem.CloseCommand.CanExecute(null)) { - LayoutItem.CloseCommand.Execute(null); + this.LayoutItem.CloseCommand.Execute(null); } base.OnMouseDown(e); @@ -210,8 +210,8 @@ private void StartDraggingFloatingWindowForContent() ReleaseMouseCapture(); // BD: 17.08.2020 Remove that bodge and handle CanClose=false && CanHide=true in XAML //if (Model is LayoutAnchorable layoutAnchorable) layoutAnchorable.ResetCanCloseInternal(); - DockingManager manager = Model.Root.Manager; - manager.StartDraggingFloatingWindowForContent(Model); + DockingManager manager = this.Model.Root.Manager; + manager.StartDraggingFloatingWindowForContent(this.Model); } #endregion Private Methods diff --git a/Source/Controls/H.Controls.Dock/Controls/LayoutFloatingWindowControl.cs b/Source/Controls/H.Controls.Dock/Controls/LayoutFloatingWindowControl.cs index f948d3c0..c6dce092 100644 --- a/Source/Controls/H.Controls.Dock/Controls/LayoutFloatingWindowControl.cs +++ b/Source/Controls/H.Controls.Dock/Controls/LayoutFloatingWindowControl.cs @@ -76,7 +76,7 @@ protected LayoutFloatingWindowControl(ILayoutElement model) protected LayoutFloatingWindowControl(ILayoutElement model, bool isContentImmutable) : this(model) { - IsContentImmutable = isContentImmutable; + this.IsContentImmutable = isContentImmutable; } #endregion Constructors @@ -218,7 +218,7 @@ private set protected override void OnStateChanged(EventArgs e) { if (!_isInternalChange) - UpdateMaximizedState(WindowState == WindowState.Maximized); + UpdateMaximizedState(this.WindowState == WindowState.Maximized); base.OnStateChanged(e); } @@ -299,16 +299,16 @@ internal virtual void UpdateThemeResources(Theme oldTheme = null) { if (currentThemeResourceDictionary != null) { - Resources.MergedDictionaries.Remove(currentThemeResourceDictionary); + this.Resources.MergedDictionaries.Remove(currentThemeResourceDictionary); currentThemeResourceDictionary = null; } } else { ResourceDictionary resourceDictionaryToRemove = - Resources.MergedDictionaries.FirstOrDefault(r => r.Source == oldTheme.GetResourceUri()); + this.Resources.MergedDictionaries.FirstOrDefault(r => r.Source == oldTheme.GetResourceUri()); if (resourceDictionaryToRemove != null) - Resources.MergedDictionaries.Remove( + this.Resources.MergedDictionaries.Remove( resourceDictionaryToRemove); } } @@ -319,10 +319,10 @@ internal virtual void UpdateThemeResources(Theme oldTheme = null) if (manager.Theme is DictionaryTheme dictionaryTheme) { currentThemeResourceDictionary = dictionaryTheme.ThemeResourceDictionary; - Resources.MergedDictionaries.Add(currentThemeResourceDictionary); + this.Resources.MergedDictionaries.Add(currentThemeResourceDictionary); } else - Resources.MergedDictionaries.Add(new ResourceDictionary { Source = manager.Theme.GetResourceUri() }); + this.Resources.MergedDictionaries.Add(new ResourceDictionary { Source = manager.Theme.GetResourceUri() }); } internal void AttachDrag(bool onActivated = true) @@ -336,7 +336,7 @@ internal void AttachDrag(bool onActivated = true) { CaptureMouse(); IntPtr windowHandle = new WindowInteropHelper(this).Handle; - IntPtr lParam = new IntPtr(((int)Left & 0xFFFF) | ((int)Top << 16)); + IntPtr lParam = new IntPtr(((int)this.Left & 0xFFFF) | ((int)this.Top << 16)); Win32Helper.SendMessage(windowHandle, Win32Helper.WM_NCLBUTTONDOWN, new IntPtr(Win32Helper.HT_CAPTION), lParam); } } @@ -367,7 +367,7 @@ protected virtual IntPtr FilterMessage(IntPtr hwnd, int msg, IntPtr wParam, IntP case Win32Helper.WM_MOVING: { UpdateDragPosition(); - if (IsMaximized) UpdateMaximizedState(false); + if (this.IsMaximized) UpdateMaximizedState(false); } break; @@ -432,7 +432,7 @@ private void UpdateMargins() Thickness margin = frameworkElements.Sum(f => f.Margin); margin = margin.Add(padding).Add(border).Add(grid.Margin); margin.Top = grid.RowDefinitions[0].MinHeight; - TotalMargin = margin; + this.TotalMargin = margin; _isTotalMarginSet = true; } } @@ -458,8 +458,8 @@ private void UpdateWindowsSizeBasedOnMinSize() System.Collections.Generic.IEnumerable contents = layoutContents.OfType(); foreach (FrameworkElement content in contents) { - ContentMinHeight = Math.Max(content.MinHeight, ContentMinHeight); - ContentMinWidth = Math.Max(content.MinWidth, ContentMinWidth); + this.ContentMinHeight = Math.Max(content.MinHeight, this.ContentMinHeight); + this.ContentMinWidth = Math.Max(content.MinWidth, this.ContentMinWidth); if ((this.Model?.Root?.Manager?.AutoWindowSizeWhenOpened).GetValueOrDefault()) { FrameworkElement parent = content.GetParents() @@ -469,13 +469,13 @@ private void UpdateWindowsSizeBasedOnMinSize() if (content.ActualHeight < content.MinHeight || (parent != null && parent.ActualHeight < content.MinHeight)) { - Height = content.MinHeight + TotalMargin.Top + TotalMargin.Bottom; + this.Height = content.MinHeight + this.TotalMargin.Top + this.TotalMargin.Bottom; } if (content.ActualWidth < content.MinWidth || (parent != null && parent.ActualWidth < content.MinWidth)) { - Width = content.MinWidth + TotalMargin.Left + TotalMargin.Right; + this.Width = content.MinWidth + this.TotalMargin.Left + this.TotalMargin.Right; } } } @@ -499,9 +499,9 @@ internal void InternalClose(bool closeInitiatedByUser = false) protected override void OnClosed(EventArgs e) { SizeChanged -= OnSizeChanged; - if (Content != null) + if (this.Content != null) { - (Content as FloatingWindowContentHost)?.Dispose(); + (this.Content as FloatingWindowContentHost)?.Dispose(); if (_hwndSrc != null) { _hwndSrc.RemoveHook(_hwndSrcHook); @@ -515,13 +515,13 @@ protected override void OnClosed(EventArgs e) /// protected override void OnInitialized(EventArgs e) { - CommandBindings.Add(new CommandBinding(Microsoft.Windows.Shell.SystemCommands.CloseWindowCommand, + this.CommandBindings.Add(new CommandBinding(Microsoft.Windows.Shell.SystemCommands.CloseWindowCommand, (s, args) => Microsoft.Windows.Shell.SystemCommands.CloseWindow((Window)args.Parameter))); - CommandBindings.Add(new CommandBinding(Microsoft.Windows.Shell.SystemCommands.MaximizeWindowCommand, + this.CommandBindings.Add(new CommandBinding(Microsoft.Windows.Shell.SystemCommands.MaximizeWindowCommand, (s, args) => Microsoft.Windows.Shell.SystemCommands.MaximizeWindow((Window)args.Parameter))); - CommandBindings.Add(new CommandBinding(Microsoft.Windows.Shell.SystemCommands.MinimizeWindowCommand, + this.CommandBindings.Add(new CommandBinding(Microsoft.Windows.Shell.SystemCommands.MinimizeWindowCommand, (s, args) => Microsoft.Windows.Shell.SystemCommands.MinimizeWindow((Window)args.Parameter))); - CommandBindings.Add(new CommandBinding(Microsoft.Windows.Shell.SystemCommands.RestoreWindowCommand, + this.CommandBindings.Add(new CommandBinding(Microsoft.Windows.Shell.SystemCommands.RestoreWindowCommand, (s, args) => Microsoft.Windows.Shell.SystemCommands.RestoreWindow((Window)args.Parameter))); //Debug.Assert(this.Owner != null); base.OnInitialized(e); @@ -540,7 +540,7 @@ private void AssureOwnerIsNotMinimized() { try { - Owner?.Activate(); + this.Owner?.Activate(); } catch (Exception) { @@ -568,7 +568,7 @@ private void OnLoaded(object sender, RoutedEventArgs e) _hwndSrcHook = FilterMessage; _hwndSrc.AddHook(_hwndSrcHook); // Restore maximize state - bool maximized = Model.Descendents().OfType().Any(l => l.IsMaximized); + bool maximized = this.Model.Descendents().OfType().Any(l => l.IsMaximized); UpdateMaximizedState(maximized); } @@ -576,8 +576,8 @@ internal void UpdateOwnership() { // Determine whether the child window should be owned by the parent or act independently // according to OwnedByDockingManagerWindow property. - DockingManager manager = Model?.Root?.Manager; - if (OwnedByDockingManagerWindow && manager != null) + DockingManager manager = this.Model?.Root?.Manager; + if (this.OwnedByDockingManagerWindow && manager != null) this.SetParentToMainWindowOf(manager); else this.SetParentWindowToNull(); @@ -602,10 +602,10 @@ private void OnClosing(object sender, CancelEventArgs e) private void OnSizeChanged(object sender, SizeChangedEventArgs e) { - foreach (ILayoutElementForFloatingWindow posElement in Model.Descendents().OfType()) + foreach (ILayoutElementForFloatingWindow posElement in this.Model.Descendents().OfType()) { - posElement.FloatingWidth = ActualWidth; - posElement.FloatingHeight = ActualHeight; + posElement.FloatingWidth = this.ActualWidth; + posElement.FloatingHeight = this.ActualHeight; posElement.RaiseFloatingPropertiesUpdated(); } } @@ -623,15 +623,15 @@ private void OnActivated(object sender, EventArgs e) // BugFix Issue #6 // This code is initializes the drag when content (document or toolwindow) is dragged // A second chance back up plan if DragDelta is not set - if (DragDelta == default) DragDelta = new Point(3, 3); - Left = mousePosition.X - DragDelta.X; // BugFix Issue #6 - Top = mousePosition.Y - DragDelta.Y; + if (this.DragDelta == default) this.DragDelta = new Point(3, 3); + this.Left = mousePosition.X - this.DragDelta.X; // BugFix Issue #6 + this.Top = mousePosition.Y - this.DragDelta.Y; if (this.GetScreenArea().Size != area.Size) // setting the top/left co-ordinates has changed the size - this means moving to a screen with a different DPI. Recalculate mouse position based on new DPI to avoid wrong drag location { mousePosition = this.PointToScreenDPI(Mouse.GetPosition(this)); - Left = mousePosition.X - DragDelta.X; - Top = mousePosition.Y - DragDelta.Y; + this.Left = mousePosition.X - this.DragDelta.X; + this.Top = mousePosition.Y - this.DragDelta.Y; } _attachDrag = false; @@ -642,32 +642,32 @@ private void OnActivated(object sender, EventArgs e) private void UpdatePositionAndSizeOfPanes() { - foreach (ILayoutElementForFloatingWindow posElement in Model.Descendents().OfType()) + foreach (ILayoutElementForFloatingWindow posElement in this.Model.Descendents().OfType()) { - posElement.FloatingLeft = Left; - posElement.FloatingTop = Top; - posElement.FloatingWidth = Width; - posElement.FloatingHeight = Height; + posElement.FloatingLeft = this.Left; + posElement.FloatingTop = this.Top; + posElement.FloatingWidth = this.Width; + posElement.FloatingHeight = this.Height; posElement.RaiseFloatingPropertiesUpdated(); } } private void UpdateMaximizedState(bool isMaximized) { - foreach (ILayoutElementForFloatingWindow posElement in Model.Descendents().OfType()) + foreach (ILayoutElementForFloatingWindow posElement in this.Model.Descendents().OfType()) posElement.IsMaximized = isMaximized; - IsMaximized = isMaximized; + this.IsMaximized = isMaximized; _isInternalChange = true; if (isMaximized) { - WindowState = WindowState.Maximized; + this.WindowState = WindowState.Maximized; } else if (!this.AllowMinimize || this.WindowState != WindowState.Minimized) { // If minimize is not supported, this prevents the window from being minimized. // by resetting it to the normal state. - WindowState = WindowState.Normal; + this.WindowState = WindowState.Normal; } _isInternalChange = false; @@ -712,7 +712,7 @@ protected internal class FloatingWindowContentHost : HwndHost public FloatingWindowContentHost(LayoutFloatingWindowControl owner) { _owner = owner; - Binding binding = new Binding(nameof(SizeToContent)) { Source = _owner }; + Binding binding = new Binding(nameof(this.SizeToContent)) { Source = _owner }; BindingOperations.SetBinding(this, SizeToContentProperty, binding); } @@ -744,7 +744,7 @@ public UIElement Content /// Provides derived classes an opportunity to handle changes to the property. protected virtual void OnContentChanged(UIElement oldValue, UIElement newValue) { - if (_rootPresenter != null) _rootPresenter.Child = Content; + if (_rootPresenter != null) _rootPresenter.Child = this.Content; if (oldValue is FrameworkElement oldContent) oldContent.SizeChanged -= Content_SizeChanged; if (newValue is FrameworkElement newContent) newContent.SizeChanged += Content_SizeChanged; } @@ -791,7 +791,7 @@ protected override HandleRef BuildWindowCore(HandleRef hwndParent) UsesPerPixelOpacity = true, }); - _rootPresenter = new Border { Child = new AdornerDecorator { Child = Content }, Focusable = true }; + _rootPresenter = new Border { Child = new AdornerDecorator { Child = this.Content }, Focusable = true }; AutomationProperties.SetName(_rootPresenter, "FloatingWindowHost"); _rootPresenter.SetBinding(Border.BackgroundProperty, new Binding(nameof(Background)) { Source = _owner }); _wpfContentHost.RootVisual = _rootPresenter; @@ -812,9 +812,9 @@ protected override void DestroyWindowCore(HandleRef hwnd) /// protected override Size MeasureOverride(Size constraint) { - if (Content == null) return base.MeasureOverride(constraint); - Content.Measure(constraint); - return Content.DesiredSize; + if (this.Content == null) return base.MeasureOverride(constraint); + this.Content.Measure(constraint); + return this.Content.DesiredSize; } #endregion Overrides diff --git a/Source/Controls/H.Controls.Dock/Controls/LayoutGridControl.cs b/Source/Controls/H.Controls.Dock/Controls/LayoutGridControl.cs index b0f8a864..7790a60d 100644 --- a/Source/Controls/H.Controls.Dock/Controls/LayoutGridControl.cs +++ b/Source/Controls/H.Controls.Dock/Controls/LayoutGridControl.cs @@ -49,7 +49,7 @@ internal LayoutGridControl(LayoutPositionableGroup model, Orientation orienta { _model = model ?? throw new ArgumentNullException(nameof(model)); _orientation = orientation; - FlowDirection = System.Windows.FlowDirection.LeftToRight; + this.FlowDirection = System.Windows.FlowDirection.LeftToRight; Unloaded += OnUnloaded; } @@ -76,7 +76,7 @@ protected override void OnInitialized(EventArgs e) if (args.Change != ChildrenTreeChange.DirectChildrenChanged) return; if (_asyncRefreshCalled.HasValue && _asyncRefreshCalled.Value == args.Change) return; _asyncRefreshCalled = args.Change; - Dispatcher.BeginInvoke(new Action(() => + this.Dispatcher.BeginInvoke(new Action(() => { _asyncRefreshCalled = null; UpdateChildren(); @@ -104,8 +104,8 @@ protected void FixChildrenDockLengths() private void OnSizeChanged(object sender, SizeChangedEventArgs e) { ILayoutPositionableElementWithActualSize modelWithAtcualSize = _model; - modelWithAtcualSize.ActualWidth = ActualWidth; - modelWithAtcualSize.ActualHeight = ActualHeight; + modelWithAtcualSize.ActualWidth = this.ActualWidth; + modelWithAtcualSize.ActualHeight = this.ActualHeight; if (!_initialized) { _initialized = true; @@ -128,21 +128,21 @@ private void OnUnloaded(object sender, RoutedEventArgs e) private void UpdateChildren() { - ILayoutControl[] alreadyContainedChildren = Children.OfType().ToArray(); + ILayoutControl[] alreadyContainedChildren = this.Children.OfType().ToArray(); DetachOldSplitters(); DetachPropertyChangeHandler(); - Children.Clear(); - ColumnDefinitions.Clear(); - RowDefinitions.Clear(); + this.Children.Clear(); + this.ColumnDefinitions.Clear(); + this.RowDefinitions.Clear(); DockingManager manager = _model?.Root?.Manager; if (manager == null) return; foreach (T child in _model.Children) { ILayoutControl foundContainedChild = alreadyContainedChildren.FirstOrDefault(chVM => chVM.Model == child); if (foundContainedChild != null) - Children.Add(foundContainedChild as UIElement); + this.Children.Add(foundContainedChild as UIElement); else - Children.Add(manager.CreateUIElementForModel(child)); + this.Children.Add(manager.CreateUIElementForModel(child)); } CreateSplitters(); UpdateRowColDefinitions(); @@ -152,34 +152,34 @@ private void UpdateChildren() private void AttachPropertyChangeHandler() { - foreach (ILayoutControl child in InternalChildren.OfType()) + foreach (ILayoutControl child in this.InternalChildren.OfType()) child.Model.PropertyChanged += this.OnChildModelPropertyChanged; } private void DetachPropertyChangeHandler() { - foreach (ILayoutControl child in InternalChildren.OfType()) + foreach (ILayoutControl child in this.InternalChildren.OfType()) child.Model.PropertyChanged -= this.OnChildModelPropertyChanged; } private void OnChildModelPropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e) { - if (AsyncRefreshCalled) return; - if (_fixingChildrenDockLengths.CanEnter && e.PropertyName == nameof(ILayoutPositionableElement.DockWidth) && Orientation == System.Windows.Controls.Orientation.Horizontal) + if (this.AsyncRefreshCalled) return; + if (_fixingChildrenDockLengths.CanEnter && e.PropertyName == nameof(ILayoutPositionableElement.DockWidth) && this.Orientation == System.Windows.Controls.Orientation.Horizontal) { - if (ColumnDefinitions.Count != InternalChildren.Count) return; + if (this.ColumnDefinitions.Count != this.InternalChildren.Count) return; ILayoutPositionableElement changedElement = sender as ILayoutPositionableElement; - UIElement childFromModel = InternalChildren.OfType().First(ch => ch.Model == changedElement) as UIElement; - int indexOfChild = InternalChildren.IndexOf(childFromModel); - ColumnDefinitions[indexOfChild].Width = changedElement.DockWidth; + UIElement childFromModel = this.InternalChildren.OfType().First(ch => ch.Model == changedElement) as UIElement; + int indexOfChild = this.InternalChildren.IndexOf(childFromModel); + this.ColumnDefinitions[indexOfChild].Width = changedElement.DockWidth; } - else if (_fixingChildrenDockLengths.CanEnter && e.PropertyName == nameof(ILayoutPositionableElement.DockHeight) && Orientation == System.Windows.Controls.Orientation.Vertical) + else if (_fixingChildrenDockLengths.CanEnter && e.PropertyName == nameof(ILayoutPositionableElement.DockHeight) && this.Orientation == System.Windows.Controls.Orientation.Vertical) { - if (RowDefinitions.Count != InternalChildren.Count) return; + if (this.RowDefinitions.Count != this.InternalChildren.Count) return; ILayoutPositionableElement changedElement = sender as ILayoutPositionableElement; - UIElement childFromModel = InternalChildren.OfType().First(ch => ch.Model == changedElement) as UIElement; - int indexOfChild = InternalChildren.IndexOf(childFromModel); - RowDefinitions[indexOfChild].Height = changedElement.DockHeight; + UIElement childFromModel = this.InternalChildren.OfType().First(ch => ch.Model == changedElement) as UIElement; + int indexOfChild = this.InternalChildren.IndexOf(childFromModel); + this.RowDefinitions[indexOfChild].Height = changedElement.DockHeight; } else if (e.PropertyName == nameof(ILayoutPositionableElement.IsVisible)) UpdateRowColDefinitions(); @@ -195,25 +195,25 @@ private void UpdateRowColDefinitions() #region Setup GridRows/Cols - RowDefinitions.Clear(); - ColumnDefinitions.Clear(); - if (Orientation == Orientation.Horizontal) + this.RowDefinitions.Clear(); + this.ColumnDefinitions.Clear(); + if (this.Orientation == Orientation.Horizontal) { int iColumn = 0; int iChild = 0; // BD: 24.08.2020 added check for iChild against InternalChildren.Count - for (int iChildModel = 0; iChildModel < _model.Children.Count && iChild < InternalChildren.Count; iChildModel++, iColumn++, iChild++) + for (int iChildModel = 0; iChildModel < _model.Children.Count && iChild < this.InternalChildren.Count; iChildModel++, iColumn++, iChild++) { ILayoutPositionableElement childModel = _model.Children[iChildModel] as ILayoutPositionableElement; - ColumnDefinitions.Add(new ColumnDefinition + this.ColumnDefinitions.Add(new ColumnDefinition { Width = childModel.IsVisible ? childModel.DockWidth : new GridLength(0.0, GridUnitType.Pixel), MinWidth = childModel.IsVisible ? childModel.CalculatedDockMinWidth() : 0.0 }); - Grid.SetColumn(InternalChildren[iChild], iColumn); + Grid.SetColumn(this.InternalChildren[iChild], iColumn); //append column for splitter - if (iChild >= InternalChildren.Count - 1) continue; + if (iChild >= this.InternalChildren.Count - 1) continue; iChild++; iColumn++; @@ -226,11 +226,11 @@ private void UpdateRowColDefinitions() break; } - ColumnDefinitions.Add(new ColumnDefinition + this.ColumnDefinitions.Add(new ColumnDefinition { Width = childModel.IsVisible && nextChildModelVisibleExist ? new GridLength(manager.GridSplitterWidth) : new GridLength(0.0, GridUnitType.Pixel) }); - Grid.SetColumn(InternalChildren[iChild], iColumn); + Grid.SetColumn(this.InternalChildren[iChild], iColumn); } } else //if (_model.Orientation == Orientation.Vertical) @@ -238,21 +238,21 @@ private void UpdateRowColDefinitions() int iRow = 0; int iChild = 0; // BD: 24.08.2020 added check for iChild against InternalChildren.Count - for (int iChildModel = 0; iChildModel < _model.Children.Count && iChild < InternalChildren.Count; iChildModel++, iRow++, iChild++) + for (int iChildModel = 0; iChildModel < _model.Children.Count && iChild < this.InternalChildren.Count; iChildModel++, iRow++, iChild++) { ILayoutPositionableElement childModel = _model.Children[iChildModel] as ILayoutPositionableElement; - RowDefinitions.Add(new RowDefinition + this.RowDefinitions.Add(new RowDefinition { Height = childModel.IsVisible ? childModel.DockHeight : new GridLength(0.0, GridUnitType.Pixel), MinHeight = childModel.IsVisible ? childModel.CalculatedDockMinHeight() : 0.0 }); - Grid.SetRow(InternalChildren[iChild], iRow); + Grid.SetRow(this.InternalChildren[iChild], iRow); //if (RowDefinitions.Last().Height.Value == 0.0) // System.Diagnostics.Debugger.Break(); //append row for splitter (if necessary) - if (iChild >= InternalChildren.Count - 1) continue; + if (iChild >= this.InternalChildren.Count - 1) continue; iChild++; iRow++; @@ -265,13 +265,13 @@ private void UpdateRowColDefinitions() break; } - RowDefinitions.Add(new RowDefinition + this.RowDefinitions.Add(new RowDefinition { Height = childModel.IsVisible && nextChildModelVisibleExist ? new GridLength(manager.GridSplitterHeight) : new GridLength(0.0, GridUnitType.Pixel) }); //if (RowDefinitions.Last().Height.Value == 0.0) // System.Diagnostics.Debugger.Break(); - Grid.SetRow(InternalChildren[iChild], iRow); + Grid.SetRow(this.InternalChildren[iChild], iRow); } } @@ -282,11 +282,11 @@ private void UpdateRowColDefinitions() /// (and splitter style if optional splitter style is set) to Grid Resizer Control. private void CreateSplitters() { - for (int iChild = 1; iChild < Children.Count; iChild++) + for (int iChild = 1; iChild < this.Children.Count; iChild++) { LayoutGridResizerControl splitter = new LayoutGridResizerControl(); - if (Orientation == Orientation.Horizontal) + if (this.Orientation == Orientation.Horizontal) { splitter.Cursor = Cursors.SizeWE; splitter.Style = _model.Root?.Manager?.GridSplitterVerticalStyle; @@ -298,7 +298,7 @@ private void CreateSplitters() } - Children.Insert(iChild, splitter); + this.Children.Insert(iChild, splitter); // TODO: MK Is this a bug???? iChild++; } @@ -306,7 +306,7 @@ private void CreateSplitters() private void DetachOldSplitters() { - foreach (LayoutGridResizerControl splitter in Children.OfType()) + foreach (LayoutGridResizerControl splitter in this.Children.OfType()) { splitter.DragStarted -= OnSplitterDragStarted; splitter.DragDelta -= OnSplitterDragDelta; @@ -316,7 +316,7 @@ private void DetachOldSplitters() private void AttachNewSplitters() { - foreach (LayoutGridResizerControl splitter in Children.OfType()) + foreach (LayoutGridResizerControl splitter in this.Children.OfType()) { splitter.DragStarted += OnSplitterDragStarted; splitter.DragDelta += OnSplitterDragDelta; @@ -331,7 +331,7 @@ private void OnSplitterDragDelta(object sender, System.Windows.Controls.Primitiv Visual rootVisual = this.FindVisualTreeRoot() as Visual; GeneralTransform trToWnd = TransformToAncestor(rootVisual); Vector transformedDelta = trToWnd.Transform(new Point(e.HorizontalChange, e.VerticalChange)) - trToWnd.Transform(new Point()); - if (Orientation == System.Windows.Controls.Orientation.Horizontal) + if (this.Orientation == System.Windows.Controls.Orientation.Horizontal) Canvas.SetLeft(_resizerGhost, MathHelper.MinMax(_initialStartPoint.X + transformedDelta.X, 0.0, _resizerWindowHost.Width - _resizerGhost.Width)); else Canvas.SetTop(_resizerGhost, MathHelper.MinMax(_initialStartPoint.Y + transformedDelta.Y, 0.0, _resizerWindowHost.Height - _resizerGhost.Height)); @@ -346,14 +346,14 @@ private void OnSplitterDragCompleted(object sender, System.Windows.Controls.Prim Vector transformedDelta = trToWnd.Transform(new Point(e.HorizontalChange, e.VerticalChange)) - trToWnd.Transform(new Point()); double delta; - if (Orientation == System.Windows.Controls.Orientation.Horizontal) + if (this.Orientation == System.Windows.Controls.Orientation.Horizontal) delta = Canvas.GetLeft(_resizerGhost) - _initialStartPoint.X; else delta = Canvas.GetTop(_resizerGhost) - _initialStartPoint.Y; - int indexOfResizer = InternalChildren.IndexOf(splitter); + int indexOfResizer = this.InternalChildren.IndexOf(splitter); - FrameworkElement prevChild = InternalChildren[indexOfResizer - 1] as FrameworkElement; + FrameworkElement prevChild = this.InternalChildren[indexOfResizer - 1] as FrameworkElement; FrameworkElement nextChild = GetNextVisibleChild(indexOfResizer); Size prevChildActualSize = prevChild.TransformActualSizeToAncestor(); @@ -362,7 +362,7 @@ private void OnSplitterDragCompleted(object sender, System.Windows.Controls.Prim ILayoutPositionableElement prevChildModel = (ILayoutPositionableElement)(prevChild as ILayoutControl).Model; ILayoutPositionableElement nextChildModel = (ILayoutPositionableElement)(nextChild as ILayoutControl).Model; - if (Orientation == System.Windows.Controls.Orientation.Horizontal) + if (this.Orientation == System.Windows.Controls.Orientation.Horizontal) { if (prevChildModel.DockWidth.IsStar) prevChildModel.DockWidth = new GridLength(prevChildModel.DockWidth.Value * (prevChildActualSize.Width + delta) / prevChildActualSize.Width, GridUnitType.Star); @@ -421,13 +421,13 @@ public virtual void AdjustFixedChildrenPanelSizes(Size? parentSize = null) List relativePanels; // Get current available size of panel. - Size availableSize = parentSize ?? new Size(ActualWidth, ActualHeight); + Size availableSize = parentSize ?? new Size(this.ActualWidth, this.ActualHeight); // Calculate minimum required size and current size of children. Size minimumSize = new Size(0, 0); Size currentSize = new Size(0, 0); Size preferredMinimumSize = new Size(0, 0); - if (Orientation == Orientation.Vertical) + if (this.Orientation == Orientation.Vertical) { fixedPanels = layoutChildrenModels.Where(child => child.DockHeight.IsAbsolute).ToList(); relativePanels = layoutChildrenModels.Where(child => !child.DockHeight.IsAbsolute).ToList(); @@ -455,7 +455,7 @@ public virtual void AdjustFixedChildrenPanelSizes(Size? parentSize = null) } // Apply corrected sizes for fixed panels. - if (Orientation == Orientation.Vertical) + if (this.Orientation == Orientation.Vertical) { double delta = availableSize.Height - currentSize.Height; double relativeDelta = relativePanels.Sum(child => child.ActualHeight - child.CalculatedDockMinHeight()); @@ -526,16 +526,16 @@ public virtual void AdjustFixedChildrenPanelSizes(Size? parentSize = null) } } - foreach (IAdjustableSizeLayout child in InternalChildren.OfType()) + foreach (IAdjustableSizeLayout child in this.InternalChildren.OfType()) child.AdjustFixedChildrenPanelSizes(availableSize); } private FrameworkElement GetNextVisibleChild(int index) { - for (int i = index + 1; i < InternalChildren.Count; i++) + for (int i = index + 1; i < this.InternalChildren.Count; i++) { - if (InternalChildren[i] is LayoutGridResizerControl) continue; - if (IsChildVisible(i)) return InternalChildren[i] as FrameworkElement; + if (this.InternalChildren[i] is LayoutGridResizerControl) continue; + if (IsChildVisible(i)) return this.InternalChildren[i] as FrameworkElement; } return null; } @@ -543,23 +543,23 @@ private FrameworkElement GetNextVisibleChild(int index) private List GetVisibleChildren() { List visibleChildren = new List(); - for (int i = 0; i < InternalChildren.Count; i++) + for (int i = 0; i < this.InternalChildren.Count; i++) { - if (IsChildVisible(i) && InternalChildren[i] is FrameworkElement) - visibleChildren.Add(InternalChildren[i] as FrameworkElement); + if (IsChildVisible(i) && this.InternalChildren[i] is FrameworkElement) + visibleChildren.Add(this.InternalChildren[i] as FrameworkElement); } return visibleChildren; } private bool IsChildVisible(int index) { - if (Orientation == Orientation.Horizontal) + if (this.Orientation == Orientation.Horizontal) { - if (index < ColumnDefinitions.Count) - return ColumnDefinitions[index].Width.IsStar || ColumnDefinitions[index].Width.Value > 0; + if (index < this.ColumnDefinitions.Count) + return this.ColumnDefinitions[index].Width.IsStar || this.ColumnDefinitions[index].Width.Value > 0; } - else if (index < RowDefinitions.Count) - return RowDefinitions[index].Height.IsStar || RowDefinitions[index].Height.Value > 0; + else if (index < this.RowDefinitions.Count) + return this.RowDefinitions[index].Height.IsStar || this.RowDefinitions[index].Height.Value > 0; return false; } @@ -568,9 +568,9 @@ private void ShowResizerOverlayWindow(LayoutGridResizerControl splitter) { _resizerGhost = new Border { Background = splitter.BackgroundWhileDragging, Opacity = splitter.OpacityWhileDragging }; - int indexOfResizer = InternalChildren.IndexOf(splitter); + int indexOfResizer = this.InternalChildren.IndexOf(splitter); - FrameworkElement prevChild = InternalChildren[indexOfResizer - 1] as FrameworkElement; + FrameworkElement prevChild = this.InternalChildren[indexOfResizer - 1] as FrameworkElement; FrameworkElement nextChild = GetNextVisibleChild(indexOfResizer); Size prevChildActualSize = prevChild.TransformActualSizeToAncestor(); @@ -583,7 +583,7 @@ private void ShowResizerOverlayWindow(LayoutGridResizerControl splitter) Size actualSize; - if (Orientation == System.Windows.Controls.Orientation.Horizontal) + if (this.Orientation == System.Windows.Controls.Orientation.Horizontal) { actualSize = new Size( prevChildActualSize.Width - prevChildModel.CalculatedDockMinWidth() + splitter.ActualWidth + nextChildActualSize.Width - nextChildModel.CalculatedDockMinWidth(), @@ -607,7 +607,7 @@ private void ShowResizerOverlayWindow(LayoutGridResizerControl splitter) _initialStartPoint = splitter.PointToScreenDPIWithoutFlowDirection(new Point()) - ptTopLeftScreen; - if (Orientation == System.Windows.Controls.Orientation.Horizontal) + if (this.Orientation == System.Windows.Controls.Orientation.Horizontal) Canvas.SetLeft(_resizerGhost, _initialStartPoint.X); else Canvas.SetTop(_resizerGhost, _initialStartPoint.Y); diff --git a/Source/Controls/H.Controls.Dock/Controls/LayoutItem.cs b/Source/Controls/H.Controls.Dock/Controls/LayoutItem.cs index f9831b19..4c0da93d 100644 --- a/Source/Controls/H.Controls.Dock/Controls/LayoutItem.cs +++ b/Source/Controls/H.Controls.Dock/Controls/LayoutItem.cs @@ -74,11 +74,11 @@ public ContentPresenter View { if (_view != null) return _view; _view = new ContentPresenter(); - _view.SetBinding(ContentPresenter.ContentProperty, new Binding(nameof(ContentPresenter.Content)) { Source = LayoutElement }); - if (LayoutElement?.Root == null) return _view; - _view.SetBinding(ContentPresenter.ContentTemplateProperty, new Binding(nameof(DockingManager.LayoutItemTemplate)) { Source = LayoutElement.Root.Manager }); - _view.SetBinding(ContentPresenter.ContentTemplateSelectorProperty, new Binding(nameof(DockingManager.LayoutItemTemplateSelector)) { Source = LayoutElement.Root.Manager }); - LayoutElement.Root.Manager?.InternalAddLogicalChild(_view); + _view.SetBinding(ContentPresenter.ContentProperty, new Binding(nameof(ContentPresenter.Content)) { Source = this.LayoutElement }); + if (this.LayoutElement?.Root == null) return _view; + _view.SetBinding(ContentPresenter.ContentTemplateProperty, new Binding(nameof(DockingManager.LayoutItemTemplate)) { Source = this.LayoutElement.Root.Manager }); + _view.SetBinding(ContentPresenter.ContentTemplateSelectorProperty, new Binding(nameof(DockingManager.LayoutItemTemplateSelector)) { Source = this.LayoutElement.Root.Manager }); + this.LayoutElement.Root.Manager?.InternalAddLogicalChild(_view); return _view; } } @@ -105,7 +105,7 @@ public string Title /// Provides derived classes an opportunity to handle changes to the property. protected virtual void OnTitleChanged(DependencyPropertyChangedEventArgs e) { - if (LayoutElement != null) LayoutElement.Title = (string)e.NewValue; + if (this.LayoutElement != null) this.LayoutElement.Title = (string)e.NewValue; } #endregion Title @@ -130,7 +130,7 @@ public ImageSource IconSource /// Provides derived classes an opportunity to handle changes to the property. protected virtual void OnIconSourceChanged(DependencyPropertyChangedEventArgs e) { - if (LayoutElement != null) LayoutElement.IconSource = IconSource; + if (this.LayoutElement != null) this.LayoutElement.IconSource = this.IconSource; } #endregion IconSource @@ -155,7 +155,7 @@ public string ContentId /// Provides derived classes an opportunity to handle changes to the property. protected virtual void OnContentIdChanged(DependencyPropertyChangedEventArgs e) { - if (LayoutElement != null) LayoutElement.ContentId = (string)e.NewValue; + if (this.LayoutElement != null) this.LayoutElement.ContentId = (string)e.NewValue; } #endregion ContentId @@ -183,7 +183,7 @@ protected virtual void OnIsSelectedChanged(DependencyPropertyChangedEventArgs e) if (!_isSelectedReentrantFlag.CanEnter) return; using (_isSelectedReentrantFlag.Enter()) { - if (LayoutElement != null) LayoutElement.IsSelected = (bool)e.NewValue; + if (this.LayoutElement != null) this.LayoutElement.IsSelected = (bool)e.NewValue; } } @@ -212,7 +212,7 @@ protected virtual void OnIsActiveChanged(DependencyPropertyChangedEventArgs e) if (!_isActiveReentrantFlag.CanEnter) return; using (_isActiveReentrantFlag.Enter()) { - if (LayoutElement != null) LayoutElement.IsActive = (bool)e.NewValue; + if (this.LayoutElement != null) this.LayoutElement.IsActive = (bool)e.NewValue; } } @@ -238,7 +238,7 @@ public bool CanClose /// Provides derived classes an opportunity to handle changes to the property. protected virtual void OnCanCloseChanged(DependencyPropertyChangedEventArgs e) { - if (LayoutElement != null) LayoutElement.CanClose = (bool)e.NewValue; + if (this.LayoutElement != null) this.LayoutElement.CanClose = (bool)e.NewValue; } #endregion CanClose @@ -263,7 +263,7 @@ public bool CanFloat /// Provides derived classes an opportunity to handle changes to the property. protected virtual void OnCanFloatChanged(DependencyPropertyChangedEventArgs e) { - if (LayoutElement != null) LayoutElement.CanFloat = (bool)e.NewValue; + if (this.LayoutElement != null) this.LayoutElement.CanFloat = (bool)e.NewValue; } #endregion CanFloat @@ -293,7 +293,7 @@ protected virtual void OnCloseCommandChanged(DependencyPropertyChangedEventArgs /// Coerces the value. private static object CoerceCloseCommandValue(DependencyObject d, object value) => value; - private bool CanExecuteCloseCommand(object parameter) => LayoutElement != null && LayoutElement.CanClose; + private bool CanExecuteCloseCommand(object parameter) => this.LayoutElement != null && this.LayoutElement.CanClose; private void ExecuteCloseCommand(object parameter) => Close(); @@ -328,11 +328,11 @@ protected virtual void OnFloatCommandChanged(DependencyPropertyChangedEventArgs /// Coerces the value. private static object CoerceFloatCommandValue(DependencyObject d, object value) => value; - private bool CanExecuteFloatCommand(object anchorable) => LayoutElement != null && LayoutElement.CanFloat && LayoutElement.FindParent() == null; + private bool CanExecuteFloatCommand(object anchorable) => this.LayoutElement != null && this.LayoutElement.CanFloat && this.LayoutElement.FindParent() == null; /// Executes to float the content of this LayoutItem in a separate . /// - private void ExecuteFloatCommand(object parameter) => LayoutElement.Root.Manager.ExecuteFloatCommand(LayoutElement); + private void ExecuteFloatCommand(object parameter) => this.LayoutElement.Root.Manager.ExecuteFloatCommand(this.LayoutElement); #endregion FloatCommand @@ -362,11 +362,11 @@ protected virtual void OnDockAsDocumentCommandChanged(DependencyPropertyChangedE /// Coerces the value. private static object CoerceDockAsDocumentCommandValue(DependencyObject d, object value) => value; - protected virtual bool CanExecuteDockAsDocumentCommand() => LayoutElement != null && LayoutElement.FindParent() == null; + protected virtual bool CanExecuteDockAsDocumentCommand() => this.LayoutElement != null && this.LayoutElement.FindParent() == null; private bool CanExecuteDockAsDocumentCommand(object parameter) => CanExecuteDockAsDocumentCommand(); - private void ExecuteDockAsDocumentCommand(object parameter) => LayoutElement.Root.Manager.ExecuteDockAsDocumentCommand(LayoutElement); + private void ExecuteDockAsDocumentCommand(object parameter) => this.LayoutElement.Root.Manager.ExecuteDockAsDocumentCommand(this.LayoutElement); #endregion DockAsDocumentCommand @@ -397,12 +397,12 @@ protected virtual void OnCloseAllButThisCommandChanged(DependencyPropertyChanged private bool CanExecuteCloseAllButThisCommand(object parameter) { - ILayoutRoot root = LayoutElement?.Root; + ILayoutRoot root = this.LayoutElement?.Root; if (root == null) return false; - return LayoutElement.Root.Manager.Layout.Descendents().OfType().Any(d => d != LayoutElement && (d.Parent is LayoutDocumentPane || d.Parent is LayoutDocumentFloatingWindow)); + return this.LayoutElement.Root.Manager.Layout.Descendents().OfType().Any(d => d != this.LayoutElement && (d.Parent is LayoutDocumentPane || d.Parent is LayoutDocumentFloatingWindow)); } - private void ExecuteCloseAllButThisCommand(object parameter) => LayoutElement.Root.Manager.ExecuteCloseAllButThisCommand(LayoutElement); + private void ExecuteCloseAllButThisCommand(object parameter) => this.LayoutElement.Root.Manager.ExecuteCloseAllButThisCommand(this.LayoutElement); #endregion CloseAllButThisCommand @@ -433,12 +433,12 @@ protected virtual void OnCloseAllCommandChanged(DependencyPropertyChangedEventAr private bool CanExecuteCloseAllCommand(object parameter) { - ILayoutRoot root = LayoutElement?.Root; + ILayoutRoot root = this.LayoutElement?.Root; if (root == null) return false; - return LayoutElement.Root.Manager.Layout.Descendents().OfType().Any(d => d.Parent is LayoutDocumentPane || d.Parent is LayoutDocumentFloatingWindow); + return this.LayoutElement.Root.Manager.Layout.Descendents().OfType().Any(d => d.Parent is LayoutDocumentPane || d.Parent is LayoutDocumentFloatingWindow); } - private void ExecuteCloseAllCommand(object parameter) => LayoutElement.Root.Manager.ExecuteCloseAllCommand(LayoutElement); + private void ExecuteCloseAllCommand(object parameter) => this.LayoutElement.Root.Manager.ExecuteCloseAllCommand(this.LayoutElement); #endregion CloseAllCommand @@ -467,9 +467,9 @@ protected virtual void OnActivateCommandChanged(DependencyPropertyChangedEventAr /// Coerces the value. private static object CoerceActivateCommandValue(DependencyObject d, object value) => value; - private bool CanExecuteActivateCommand(object parameter) => LayoutElement != null; + private bool CanExecuteActivateCommand(object parameter) => this.LayoutElement != null; - private void ExecuteActivateCommand(object parameter) => LayoutElement.Root.Manager.ExecuteContentActivateCommand(LayoutElement); + private void ExecuteActivateCommand(object parameter) => this.LayoutElement.Root.Manager.ExecuteContentActivateCommand(this.LayoutElement); #endregion ActivateCommand @@ -497,20 +497,20 @@ protected virtual void OnNewVerticalTabGroupCommandChanged(DependencyPropertyCha private bool CanExecuteNewVerticalTabGroupCommand(object parameter) { - if (LayoutElement == null) return false; - if (LayoutElement is LayoutDocument layoutDocument && !layoutDocument.CanMove) return false; - LayoutDocumentPaneGroup parentDocumentGroup = LayoutElement.FindParent(); + if (this.LayoutElement == null) return false; + if (this.LayoutElement is LayoutDocument layoutDocument && !layoutDocument.CanMove) return false; + LayoutDocumentPaneGroup parentDocumentGroup = this.LayoutElement.FindParent(); return (parentDocumentGroup == null || parentDocumentGroup.ChildrenCount == 1 || parentDocumentGroup.Root.Manager.AllowMixedOrientation || parentDocumentGroup.Orientation == Orientation.Horizontal) && - LayoutElement.Parent is LayoutDocumentPane parentDocumentPane && + this.LayoutElement.Parent is LayoutDocumentPane parentDocumentPane && parentDocumentPane.ChildrenCount > 1; } private void ExecuteNewVerticalTabGroupCommand(object parameter) { - LayoutContent layoutElement = LayoutElement; + LayoutContent layoutElement = this.LayoutElement; LayoutDocumentPaneGroup parentDocumentGroup = layoutElement.FindParent(); LayoutDocumentPane parentDocumentPane = layoutElement.Parent as LayoutDocumentPane; @@ -554,20 +554,20 @@ protected virtual void OnNewHorizontalTabGroupCommandChanged(DependencyPropertyC private bool CanExecuteNewHorizontalTabGroupCommand(object parameter) { - if (LayoutElement == null) return false; - if (LayoutElement is LayoutDocument layoutDocument && !layoutDocument.CanMove) return false; - LayoutDocumentPaneGroup parentDocumentGroup = LayoutElement.FindParent(); + if (this.LayoutElement == null) return false; + if (this.LayoutElement is LayoutDocument layoutDocument && !layoutDocument.CanMove) return false; + LayoutDocumentPaneGroup parentDocumentGroup = this.LayoutElement.FindParent(); return (parentDocumentGroup == null || parentDocumentGroup.ChildrenCount == 1 || parentDocumentGroup.Root.Manager.AllowMixedOrientation || parentDocumentGroup.Orientation == Orientation.Vertical) && - LayoutElement.Parent is LayoutDocumentPane parentDocumentPane && + this.LayoutElement.Parent is LayoutDocumentPane parentDocumentPane && parentDocumentPane.ChildrenCount > 1; } private void ExecuteNewHorizontalTabGroupCommand(object parameter) { - LayoutContent layoutElement = LayoutElement; + LayoutContent layoutElement = this.LayoutElement; LayoutDocumentPaneGroup parentDocumentGroup = layoutElement.FindParent(); LayoutDocumentPane parentDocumentPane = layoutElement.Parent as LayoutDocumentPane; @@ -611,10 +611,10 @@ protected virtual void OnMoveToNextTabGroupCommandChanged(DependencyPropertyChan private bool CanExecuteMoveToNextTabGroupCommand(object parameter) { - if (LayoutElement == null) return false; - LayoutDocumentPaneGroup parentDocumentGroup = LayoutElement.FindParent(); + if (this.LayoutElement == null) return false; + LayoutDocumentPaneGroup parentDocumentGroup = this.LayoutElement.FindParent(); return parentDocumentGroup != null && - LayoutElement.Parent is LayoutDocumentPane parentDocumentPane && + this.LayoutElement.Parent is LayoutDocumentPane parentDocumentPane && parentDocumentGroup.ChildrenCount > 1 && parentDocumentGroup.IndexOfChild(parentDocumentPane) < parentDocumentGroup.ChildrenCount - 1 && parentDocumentGroup.Children[parentDocumentGroup.IndexOfChild(parentDocumentPane) + 1] is LayoutDocumentPane; @@ -622,7 +622,7 @@ LayoutElement.Parent is LayoutDocumentPane parentDocumentPane && private void ExecuteMoveToNextTabGroupCommand(object parameter) { - LayoutContent layoutElement = LayoutElement; + LayoutContent layoutElement = this.LayoutElement; LayoutDocumentPaneGroup parentDocumentGroup = layoutElement.FindParent(); LayoutDocumentPane parentDocumentPane = layoutElement.Parent as LayoutDocumentPane; int indexOfParentPane = parentDocumentGroup.IndexOfChild(parentDocumentPane); @@ -658,10 +658,10 @@ protected virtual void OnMoveToPreviousTabGroupCommandChanged(DependencyProperty private bool CanExecuteMoveToPreviousTabGroupCommand(object parameter) { - if (LayoutElement == null) return false; - LayoutDocumentPaneGroup parentDocumentGroup = LayoutElement.FindParent(); + if (this.LayoutElement == null) return false; + LayoutDocumentPaneGroup parentDocumentGroup = this.LayoutElement.FindParent(); return parentDocumentGroup != null && - LayoutElement.Parent is LayoutDocumentPane parentDocumentPane && + this.LayoutElement.Parent is LayoutDocumentPane parentDocumentPane && parentDocumentGroup.ChildrenCount > 1 && parentDocumentGroup.IndexOfChild(parentDocumentPane) > 0 && parentDocumentGroup.Children[parentDocumentGroup.IndexOfChild(parentDocumentPane) - 1] is LayoutDocumentPane; @@ -669,7 +669,7 @@ LayoutElement.Parent is LayoutDocumentPane parentDocumentPane && private void ExecuteMoveToPreviousTabGroupCommand(object parameter) { - LayoutContent layoutElement = LayoutElement; + LayoutContent layoutElement = this.LayoutElement; LayoutDocumentPaneGroup parentDocumentGroup = layoutElement.FindParent(); LayoutDocumentPane parentDocumentPane = layoutElement.Parent as LayoutDocumentPane; int indexOfParentPane = parentDocumentGroup.IndexOfChild(parentDocumentPane); @@ -701,78 +701,78 @@ protected virtual void InitDefaultCommands() protected virtual void ClearDefaultBindings() { - if (CloseCommand == _defaultCloseCommand) + if (this.CloseCommand == _defaultCloseCommand) BindingOperations.ClearBinding(this, CloseCommandProperty); - if (FloatCommand == _defaultFloatCommand) + if (this.FloatCommand == _defaultFloatCommand) BindingOperations.ClearBinding(this, FloatCommandProperty); - if (DockAsDocumentCommand == _defaultDockAsDocumentCommand) + if (this.DockAsDocumentCommand == _defaultDockAsDocumentCommand) BindingOperations.ClearBinding(this, DockAsDocumentCommandProperty); - if (CloseAllButThisCommand == _defaultCloseAllButThisCommand) + if (this.CloseAllButThisCommand == _defaultCloseAllButThisCommand) BindingOperations.ClearBinding(this, CloseAllButThisCommandProperty); - if (CloseAllCommand == _defaultCloseAllCommand) + if (this.CloseAllCommand == _defaultCloseAllCommand) BindingOperations.ClearBinding(this, CloseAllCommandProperty); - if (ActivateCommand == _defaultActivateCommand) + if (this.ActivateCommand == _defaultActivateCommand) BindingOperations.ClearBinding(this, ActivateCommandProperty); - if (NewVerticalTabGroupCommand == _defaultNewVerticalTabGroupCommand) + if (this.NewVerticalTabGroupCommand == _defaultNewVerticalTabGroupCommand) BindingOperations.ClearBinding(this, NewVerticalTabGroupCommandProperty); - if (NewHorizontalTabGroupCommand == _defaultNewHorizontalTabGroupCommand) + if (this.NewHorizontalTabGroupCommand == _defaultNewHorizontalTabGroupCommand) BindingOperations.ClearBinding(this, NewHorizontalTabGroupCommandProperty); - if (MoveToNextTabGroupCommand == _defaultMoveToNextTabGroupCommand) + if (this.MoveToNextTabGroupCommand == _defaultMoveToNextTabGroupCommand) BindingOperations.ClearBinding(this, MoveToNextTabGroupCommandProperty); - if (MoveToPreviousTabGroupCommand == _defaultMoveToPreviousTabGroupCommand) + if (this.MoveToPreviousTabGroupCommand == _defaultMoveToPreviousTabGroupCommand) BindingOperations.ClearBinding(this, MoveToPreviousTabGroupCommandProperty); } protected virtual void SetDefaultBindings() { - if (CloseCommand == null) - CloseCommand = _defaultCloseCommand; - if (FloatCommand == null) - FloatCommand = _defaultFloatCommand; - if (DockAsDocumentCommand == null) - DockAsDocumentCommand = _defaultDockAsDocumentCommand; - if (CloseAllButThisCommand == null) - CloseAllButThisCommand = _defaultCloseAllButThisCommand; - if (CloseAllCommand == null) - CloseAllCommand = _defaultCloseAllCommand; - if (ActivateCommand == null) - ActivateCommand = _defaultActivateCommand; - if (NewVerticalTabGroupCommand == null) - NewVerticalTabGroupCommand = _defaultNewVerticalTabGroupCommand; - if (NewHorizontalTabGroupCommand == null) - NewHorizontalTabGroupCommand = _defaultNewHorizontalTabGroupCommand; - if (MoveToNextTabGroupCommand == null) - MoveToNextTabGroupCommand = _defaultMoveToNextTabGroupCommand; - if (MoveToPreviousTabGroupCommand == null) - MoveToPreviousTabGroupCommand = _defaultMoveToPreviousTabGroupCommand; - - IsSelected = LayoutElement.IsSelected; - IsActive = LayoutElement.IsActive; - CanClose = LayoutElement.CanClose; + if (this.CloseCommand == null) + this.CloseCommand = _defaultCloseCommand; + if (this.FloatCommand == null) + this.FloatCommand = _defaultFloatCommand; + if (this.DockAsDocumentCommand == null) + this.DockAsDocumentCommand = _defaultDockAsDocumentCommand; + if (this.CloseAllButThisCommand == null) + this.CloseAllButThisCommand = _defaultCloseAllButThisCommand; + if (this.CloseAllCommand == null) + this.CloseAllCommand = _defaultCloseAllCommand; + if (this.ActivateCommand == null) + this.ActivateCommand = _defaultActivateCommand; + if (this.NewVerticalTabGroupCommand == null) + this.NewVerticalTabGroupCommand = _defaultNewVerticalTabGroupCommand; + if (this.NewHorizontalTabGroupCommand == null) + this.NewHorizontalTabGroupCommand = _defaultNewHorizontalTabGroupCommand; + if (this.MoveToNextTabGroupCommand == null) + this.MoveToNextTabGroupCommand = _defaultMoveToNextTabGroupCommand; + if (this.MoveToPreviousTabGroupCommand == null) + this.MoveToPreviousTabGroupCommand = _defaultMoveToPreviousTabGroupCommand; + + this.IsSelected = this.LayoutElement.IsSelected; + this.IsActive = this.LayoutElement.IsActive; + this.CanClose = this.LayoutElement.CanClose; } protected virtual void OnVisibilityChanged() { - if (LayoutElement != null && Visibility == Visibility.Collapsed) - LayoutElement.Close(); + if (this.LayoutElement != null && this.Visibility == Visibility.Collapsed) + this.LayoutElement.Close(); } internal virtual void Attach(LayoutContent model) { - LayoutElement = model; - Model = model.Content; + this.LayoutElement = model; + this.Model = model.Content; InitDefaultCommands(); - LayoutElement.IsSelectedChanged += LayoutElement_IsSelectedChanged; - LayoutElement.IsActiveChanged += LayoutElement_IsActiveChanged; - DataContext = this; + this.LayoutElement.IsSelectedChanged += LayoutElement_IsSelectedChanged; + this.LayoutElement.IsActiveChanged += LayoutElement_IsActiveChanged; + this.DataContext = this; } internal virtual void Detach() { - LayoutElement.IsSelectedChanged -= LayoutElement_IsSelectedChanged; - LayoutElement.IsActiveChanged -= LayoutElement_IsActiveChanged; - LayoutElement = null; - Model = null; + this.LayoutElement.IsSelectedChanged -= LayoutElement_IsSelectedChanged; + this.LayoutElement.IsActiveChanged -= LayoutElement_IsActiveChanged; + this.LayoutElement = null; + this.Model = null; } internal void _ClearDefaultBindings() => ClearDefaultBindings(); @@ -791,7 +791,7 @@ private void LayoutElement_IsActiveChanged(object sender, EventArgs e) using (_isActiveReentrantFlag.Enter()) { Binding bnd = BindingOperations.GetBinding(this, IsActiveProperty); - IsActive = LayoutElement.IsActive; + this.IsActive = this.LayoutElement.IsActive; Binding bnd2 = BindingOperations.GetBinding(this, IsActiveProperty); } } @@ -801,7 +801,7 @@ private void LayoutElement_IsSelectedChanged(object sender, EventArgs e) if (!_isSelectedReentrantFlag.CanEnter) return; using (_isSelectedReentrantFlag.Enter()) { - IsSelected = LayoutElement.IsSelected; + this.IsSelected = this.LayoutElement.IsSelected; } } @@ -809,7 +809,7 @@ private void LayoutElement_IsSelectedChanged(object sender, EventArgs e) private void OnToolTipChanged() { - if (LayoutElement != null) LayoutElement.ToolTip = ToolTip; + if (this.LayoutElement != null) this.LayoutElement.ToolTip = this.ToolTip; } private static void OnVisibilityChanged(DependencyObject s, DependencyPropertyChangedEventArgs e) => ((LayoutItem)s).OnVisibilityChanged(); diff --git a/Source/Controls/H.Controls.Dock/Controls/LayoutPanelControl.cs b/Source/Controls/H.Controls.Dock/Controls/LayoutPanelControl.cs index f159c737..d118d087 100644 --- a/Source/Controls/H.Controls.Dock/Controls/LayoutPanelControl.cs +++ b/Source/Controls/H.Controls.Dock/Controls/LayoutPanelControl.cs @@ -32,7 +32,7 @@ internal LayoutPanelControl(LayoutPanel model) protected override void OnFixChildrenDockLengths() { - if (ActualWidth == 0.0 || ActualHeight == 0.0) return; + if (this.ActualWidth == 0.0 || this.ActualHeight == 0.0) return; #region Setup DockWidth/Height for children @@ -55,7 +55,7 @@ protected override void OnFixChildrenDockLengths() double childDockMinWidth = (_model.Children[i] as ILayoutPositionableElement).CalculatedDockMinWidth(); double widthToSet = Math.Max(childPositionableModelWidthActualSize.ActualWidth, childDockMinWidth); - widthToSet = Math.Min(widthToSet, ActualWidth / 2.0); + widthToSet = Math.Min(widthToSet, this.ActualWidth / 2.0); widthToSet = Math.Max(widthToSet, childDockMinWidth); (_model.Children[i] as ILayoutPositionableElement).DockWidth = new GridLength(widthToSet, GridUnitType.Pixel); } @@ -92,7 +92,7 @@ protected override void OnFixChildrenDockLengths() ILayoutPositionableElementWithActualSize childPositionableModelWidthActualSize = _model.Children[i] as ILayoutPositionableElement as ILayoutPositionableElementWithActualSize; double childDockMinHeight = (_model.Children[i] as ILayoutPositionableElement).CalculatedDockMinHeight(); double heightToSet = Math.Max(childPositionableModelWidthActualSize.ActualHeight, childDockMinHeight); - heightToSet = Math.Min(heightToSet, ActualHeight / 2.0); + heightToSet = Math.Min(heightToSet, this.ActualHeight / 2.0); heightToSet = Math.Max(heightToSet, childDockMinHeight); (_model.Children[i] as ILayoutPositionableElement).DockHeight = new GridLength(heightToSet, GridUnitType.Pixel); } diff --git a/Source/Controls/H.Controls.Dock/Controls/MenuItemEx.cs b/Source/Controls/H.Controls.Dock/Controls/MenuItemEx.cs index 86afcd64..c65731a7 100644 --- a/Source/Controls/H.Controls.Dock/Controls/MenuItemEx.cs +++ b/Source/Controls/H.Controls.Dock/Controls/MenuItemEx.cs @@ -87,13 +87,13 @@ private void UpdateIcon() { if (_reentrantFlag) return; _reentrantFlag = true; - if (IconTemplateSelector != null) + if (this.IconTemplateSelector != null) { - DataTemplate dataTemplateToUse = IconTemplateSelector.SelectTemplate(Icon, this); - if (dataTemplateToUse != null) Icon = dataTemplateToUse.LoadContent(); + DataTemplate dataTemplateToUse = this.IconTemplateSelector.SelectTemplate(this.Icon, this); + if (dataTemplateToUse != null) this.Icon = dataTemplateToUse.LoadContent(); } - else if (IconTemplate != null) - Icon = IconTemplate.LoadContent(); + else if (this.IconTemplate != null) + this.Icon = this.IconTemplate.LoadContent(); _reentrantFlag = false; } diff --git a/Source/Controls/H.Controls.Dock/Controls/NavigatorWindow.xaml.cs b/Source/Controls/H.Controls.Dock/Controls/NavigatorWindow.xaml.cs index 73f15907..17a27690 100644 --- a/Source/Controls/H.Controls.Dock/Controls/NavigatorWindow.xaml.cs +++ b/Source/Controls/H.Controls.Dock/Controls/NavigatorWindow.xaml.cs @@ -67,19 +67,19 @@ internal NavigatorWindow(DockingManager manager) // if there are multiple documents, select the next document. // if there is only one document, select that document. // if there are no documents, select the first anchorable. - if (Documents.Length > 1) + if (this.Documents.Length > 1) { - InternalSetSelectedDocument(Documents[1]); + InternalSetSelectedDocument(this.Documents[1]); _isSelectingDocument = true; } - else if (Documents.Length == 1) + else if (this.Documents.Length == 1) { - InternalSetSelectedDocument(Documents[0]); + InternalSetSelectedDocument(this.Documents[0]); _isSelectingDocument = true; } else { - LayoutAnchorableItem anchorable = Anchorables.FirstOrDefault(); + LayoutAnchorableItem anchorable = this.Anchorables.FirstOrDefault(); if (anchorable != null) { InternalSetSelectedAnchorable(anchorable); @@ -87,7 +87,7 @@ internal NavigatorWindow(DockingManager manager) } } - DataContext = this; + this.DataContext = this; Loaded += OnLoaded; Unloaded += OnUnloaded; UpdateThemeResources(); @@ -145,18 +145,18 @@ public LayoutDocumentItem SelectedDocument /// Provides derived classes an opportunity to handle changes to the property. protected virtual void OnSelectedDocumentChanged(DependencyPropertyChangedEventArgs e) { - if (_internalSetSelectedDocument || SelectedDocument == null) + if (_internalSetSelectedDocument || this.SelectedDocument == null) { return; } - if (!SelectedDocument.ActivateCommand.CanExecute(null)) + if (!this.SelectedDocument.ActivateCommand.CanExecute(null)) { return; } Close(); - SelectedDocument.ActivateCommand.Execute(null); + this.SelectedDocument.ActivateCommand.Execute(null); } #endregion SelectedDocument @@ -184,10 +184,10 @@ protected virtual void OnSelectedAnchorableChanged(DependencyPropertyChangedEven if (_internalSetSelectedAnchorable) return; // TODO: What goes on here?? LayoutAnchorableItem selectedAnchorable = e.NewValue as LayoutAnchorableItem; - if (SelectedAnchorable != null && SelectedAnchorable.ActivateCommand.CanExecute(null)) + if (this.SelectedAnchorable != null && this.SelectedAnchorable.ActivateCommand.CanExecute(null)) { Close(); - SelectedAnchorable.ActivateCommand.Execute(null); + this.SelectedAnchorable.ActivateCommand.Execute(null); } } @@ -218,7 +218,7 @@ public override void OnApplyTemplate() private void ItemContainerGenerator_StatusChanged(object sender, EventArgs e) { bool isListOfDocuments = sender == _documentListBox.ItemContainerGenerator; - IEnumerable itemsCollection = isListOfDocuments ? Documents : Anchorables.ToArray(); + IEnumerable itemsCollection = isListOfDocuments ? this.Documents : this.Anchorables.ToArray(); ItemContainerGenerator generator = (ItemContainerGenerator)sender; switch (generator.Status) { @@ -278,8 +278,8 @@ protected override void OnKeyDown(KeyEventArgs e) case Key.Right: if (_isSelectingDocument) { - LayoutAnchorableItem anchorable = Anchorables.ElementAtOrDefault(Documents.IndexOf(SelectedDocument)) - ?? Anchorables.LastOrDefault(); + LayoutAnchorableItem anchorable = this.Anchorables.ElementAtOrDefault(this.Documents.IndexOf(this.SelectedDocument)) + ?? this.Anchorables.LastOrDefault(); if (anchorable != null) { _isSelectingDocument = false; @@ -290,9 +290,9 @@ protected override void OnKeyDown(KeyEventArgs e) else { int index = _anchorableListBox?.SelectedIndex - ?? Anchorables.ToArray().IndexOf(SelectedAnchorable); - LayoutDocumentItem document = Documents.ElementAtOrDefault(index) - ?? Documents.LastOrDefault(); + ?? this.Anchorables.ToArray().IndexOf(this.SelectedAnchorable); + LayoutDocumentItem document = this.Documents.ElementAtOrDefault(index) + ?? this.Documents.LastOrDefault(); if (document != null) { _isSelectingDocument = true; @@ -321,7 +321,7 @@ void SetNextLayoutContent(bool next) // Selecting LayoutDocuments if (_isSelectingDocument) { - if (SelectedDocument != null) + if (this.SelectedDocument != null) { // Jump to previous/next LayoutDocument if (next) @@ -334,15 +334,15 @@ void SetNextLayoutContent(bool next) } } // There is no SelectedDocument, select the first one. - else if (Documents.Length > 0) + else if (this.Documents.Length > 0) { - InternalSetSelectedDocument(Documents[0]); + InternalSetSelectedDocument(this.Documents[0]); } } // Selecting LayoutAnchorables else { - if (SelectedAnchorable != null) + if (this.SelectedAnchorable != null) { // Jump to previous/next LayoutAnchorable if (next) @@ -357,7 +357,7 @@ void SetNextLayoutContent(bool next) // There is no SelectedAnchorable, select the first one. else { - LayoutAnchorableItem anchorable = Anchorables.FirstOrDefault(); + LayoutAnchorableItem anchorable = this.Anchorables.FirstOrDefault(); if (anchorable != null) { InternalSetSelectedAnchorable(anchorable); @@ -373,10 +373,10 @@ protected override void OnKeyUp(KeyEventArgs e) if (!(e.Key == Key.Tab || e.Key == Key.Left || e.Key == Key.Right || e.Key == Key.Up || e.Key == Key.Down)) { Close(); - if (SelectedDocument != null && SelectedDocument.ActivateCommand.CanExecute(null)) - SelectedDocument.ActivateCommand.Execute(null); - if (SelectedDocument == null && SelectedAnchorable != null && SelectedAnchorable.ActivateCommand.CanExecute(null)) - SelectedAnchorable.ActivateCommand.Execute(null); + if (this.SelectedDocument != null && this.SelectedDocument.ActivateCommand.CanExecute(null)) + this.SelectedDocument.ActivateCommand.Execute(null); + if (this.SelectedDocument == null && this.SelectedAnchorable != null && this.SelectedAnchorable.ActivateCommand.CanExecute(null)) + this.SelectedAnchorable.ActivateCommand.Execute(null); e.Handled = true; } base.OnKeyUp(e); @@ -410,14 +410,14 @@ internal void UpdateThemeResources(Theme oldTheme = null) { if (currentThemeResourceDictionary != null) { - Resources.MergedDictionaries.Remove(currentThemeResourceDictionary); + this.Resources.MergedDictionaries.Remove(currentThemeResourceDictionary); currentThemeResourceDictionary = null; } } else { - ResourceDictionary resourceDictionaryToRemove = Resources.MergedDictionaries.FirstOrDefault(r => r.Source == oldTheme.GetResourceUri()); - if (resourceDictionaryToRemove != null) Resources.MergedDictionaries.Remove(resourceDictionaryToRemove); + ResourceDictionary resourceDictionaryToRemove = this.Resources.MergedDictionaries.FirstOrDefault(r => r.Source == oldTheme.GetResourceUri()); + if (resourceDictionaryToRemove != null) this.Resources.MergedDictionaries.Remove(resourceDictionaryToRemove); } } @@ -426,26 +426,26 @@ internal void UpdateThemeResources(Theme oldTheme = null) if (_manager.Theme is DictionaryTheme dictionaryTheme) { currentThemeResourceDictionary = dictionaryTheme.ThemeResourceDictionary; - Resources.MergedDictionaries.Add(currentThemeResourceDictionary); + this.Resources.MergedDictionaries.Add(currentThemeResourceDictionary); } else - Resources.MergedDictionaries.Add(new ResourceDictionary() { Source = _manager.Theme.GetResourceUri() }); + this.Resources.MergedDictionaries.Add(new ResourceDictionary() { Source = _manager.Theme.GetResourceUri() }); } internal void SelectNextDocument() { - if (SelectedDocument == null) return; - int docIndex = Documents.IndexOf(SelectedDocument); + if (this.SelectedDocument == null) return; + int docIndex = this.Documents.IndexOf(this.SelectedDocument); docIndex++; - if (docIndex == Documents.Length) docIndex = 0; - InternalSetSelectedDocument(Documents[docIndex]); + if (docIndex == this.Documents.Length) docIndex = 0; + InternalSetSelectedDocument(this.Documents[docIndex]); } internal void SelectNextAnchorable() { - if (SelectedAnchorable == null) return; - LayoutAnchorableItem[] anchorablesArray = Anchorables.ToArray(); - int anchorableIndex = anchorablesArray.IndexOf(SelectedAnchorable); + if (this.SelectedAnchorable == null) return; + LayoutAnchorableItem[] anchorablesArray = this.Anchorables.ToArray(); + int anchorableIndex = anchorablesArray.IndexOf(this.SelectedAnchorable); anchorableIndex++; if (anchorableIndex == anchorablesArray.Length) anchorableIndex = 0; InternalSetSelectedAnchorable(anchorablesArray[anchorableIndex]); @@ -453,18 +453,18 @@ internal void SelectNextAnchorable() internal void SelectPreviousDocument() { - if (SelectedDocument == null) return; - int docIndex = Documents.IndexOf(SelectedDocument); + if (this.SelectedDocument == null) return; + int docIndex = this.Documents.IndexOf(this.SelectedDocument); docIndex--; - if (docIndex < 0) docIndex = Documents.Length - 1; - InternalSetSelectedDocument(Documents[docIndex]); + if (docIndex < 0) docIndex = this.Documents.Length - 1; + InternalSetSelectedDocument(this.Documents[docIndex]); } internal void SelectPreviousAnchorable() { - if (SelectedAnchorable == null) return; - LayoutAnchorableItem[] anchorablesArray = Anchorables.ToArray(); - int anchorableIndex = anchorablesArray.IndexOf(SelectedAnchorable); + if (this.SelectedAnchorable == null) return; + LayoutAnchorableItem[] anchorablesArray = this.Anchorables.ToArray(); + int anchorableIndex = anchorablesArray.IndexOf(this.SelectedAnchorable); anchorableIndex--; if (anchorableIndex < 0) anchorableIndex = anchorablesArray.Length - 1; InternalSetSelectedAnchorable(anchorablesArray[anchorableIndex]); @@ -477,7 +477,7 @@ internal void SelectPreviousAnchorable() private void InternalSetSelectedAnchorable(LayoutAnchorableItem anchorableToSelect) { _internalSetSelectedAnchorable = true; - SelectedAnchorable = anchorableToSelect; + this.SelectedAnchorable = anchorableToSelect; _internalSetSelectedAnchorable = false; if (_anchorableListBox != null) { @@ -488,7 +488,7 @@ private void InternalSetSelectedAnchorable(LayoutAnchorableItem anchorableToSele private void InternalSetSelectedDocument(LayoutDocumentItem documentToSelect) { _internalSetSelectedDocument = true; - SelectedDocument = documentToSelect; + this.SelectedDocument = documentToSelect; _internalSetSelectedDocument = false; if (_documentListBox != null) { @@ -499,15 +499,15 @@ private void InternalSetSelectedDocument(LayoutDocumentItem documentToSelect) private void OnLoaded(object sender, RoutedEventArgs e) { Loaded -= OnLoaded; - if (_documentListBox != null && SelectedDocument != null) + if (_documentListBox != null && this.SelectedDocument != null) { FocusSelectedItem(_documentListBox); } - else if (_anchorableListBox != null && SelectedAnchorable != null) + else if (_anchorableListBox != null && this.SelectedAnchorable != null) { FocusSelectedItem(_anchorableListBox); } - WindowStartupLocation = WindowStartupLocation.CenterOwner; + this.WindowStartupLocation = WindowStartupLocation.CenterOwner; } private void OnUnloaded(object sender, RoutedEventArgs e) => Unloaded -= OnUnloaded; diff --git a/Source/Controls/H.Controls.Dock/Controls/OverlayWindow.cs b/Source/Controls/H.Controls.Dock/Controls/OverlayWindow.cs index 3b15d296..262b3997 100644 --- a/Source/Controls/H.Controls.Dock/Controls/OverlayWindow.cs +++ b/Source/Controls/H.Controls.Dock/Controls/OverlayWindow.cs @@ -172,16 +172,16 @@ internal void UpdateThemeResources(Theme oldTheme = null) { if (currentThemeResourceDictionary != null) { - Resources.MergedDictionaries.Remove(currentThemeResourceDictionary); + this.Resources.MergedDictionaries.Remove(currentThemeResourceDictionary); currentThemeResourceDictionary = null; } } else { ResourceDictionary resourceDictionaryToRemove = - Resources.MergedDictionaries.FirstOrDefault(r => r.Source == oldTheme.GetResourceUri()); + this.Resources.MergedDictionaries.FirstOrDefault(r => r.Source == oldTheme.GetResourceUri()); if (resourceDictionaryToRemove != null) - Resources.MergedDictionaries.Remove( + this.Resources.MergedDictionaries.Remove( resourceDictionaryToRemove); } } @@ -191,11 +191,11 @@ internal void UpdateThemeResources(Theme oldTheme = null) if (_host.Manager.Theme is DictionaryTheme theme) { currentThemeResourceDictionary = theme.ThemeResourceDictionary; - Resources.MergedDictionaries.Add(currentThemeResourceDictionary); + this.Resources.MergedDictionaries.Add(currentThemeResourceDictionary); } else { - Resources.MergedDictionaries.Add(new ResourceDictionary() { Source = _host.Manager.Theme.GetResourceUri() }); + this.Resources.MergedDictionaries.Add(new ResourceDictionary() { Source = _host.Manager.Theme.GetResourceUri() }); } } } @@ -505,7 +505,7 @@ void IOverlayWindow.DragEnter(LayoutFloatingWindowControl floatingWindow) /// void IOverlayWindow.DragLeave(LayoutFloatingWindowControl floatingWindow) { - Visibility = System.Windows.Visibility.Hidden; + this.Visibility = System.Windows.Visibility.Hidden; _floatingWindow = null; } @@ -723,8 +723,8 @@ void IOverlayWindow.DragEnter(IDropArea area) break; } - Canvas.SetLeft(areaElement, area.DetectionRect.Left - Left); - Canvas.SetTop(areaElement, area.DetectionRect.Top - Top); + Canvas.SetLeft(areaElement, area.DetectionRect.Left - this.Left); + Canvas.SetTop(areaElement, area.DetectionRect.Top - this.Top); areaElement.Width = area.DetectionRect.Width; areaElement.Height = area.DetectionRect.Height; areaElement.Visibility = System.Windows.Visibility.Visible; diff --git a/Source/Controls/H.Controls.Dock/Controls/Shell/Standard/ErrorCodes.cs b/Source/Controls/H.Controls.Dock/Controls/Shell/Standard/ErrorCodes.cs index 4c7ae2f4..a5055331 100644 --- a/Source/Controls/H.Controls.Dock/Controls/Shell/Standard/ErrorCodes.cs +++ b/Source/Controls/H.Controls.Dock/Controls/Shell/Standard/ErrorCodes.cs @@ -369,7 +369,7 @@ public override string ToString() } // Try Win32 error codes also - if (Facility == Facility.Win32) + if (this.Facility == Facility.Win32) { foreach (FieldInfo publicStaticField in typeof(Win32Error).GetFields(BindingFlags.Static | BindingFlags.Public)) { @@ -419,7 +419,7 @@ public override bool Equals(object obj) SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands")] public void ThrowIfFailed(string message) { - if (!Failed) return; + if (!this.Failed) return; if (string.IsNullOrEmpty(message)) message = ToString(); #if DEBUG @@ -449,9 +449,9 @@ public void ThrowIfFailed(string message) // then at least check the facility and attempt to do better ourselves. if (e.GetType() == typeof(COMException)) { - switch (Facility) + switch (this.Facility) { - case Facility.Win32: e = new Win32Exception(Code, message); break; + case Facility.Win32: e = new Win32Exception(this.Code, message); break; default: e = new COMException(message, (int)_value); break; } } diff --git a/Source/Controls/H.Controls.Dock/Controls/Shell/Standard/MessageWindow.cs b/Source/Controls/H.Controls.Dock/Controls/Shell/Standard/MessageWindow.cs index d2f5c606..54480203 100644 --- a/Source/Controls/H.Controls.Dock/Controls/Shell/Standard/MessageWindow.cs +++ b/Source/Controls/H.Controls.Dock/Controls/Shell/Standard/MessageWindow.cs @@ -49,7 +49,7 @@ public MessageWindow(CS classStyle, WS style, WS_EX exStyle, Rect location, stri gcHandle = GCHandle.Alloc(this); IntPtr pinnedThisPtr = (IntPtr)gcHandle; - Handle = NativeMethods.CreateWindowEx( + this.Handle = NativeMethods.CreateWindowEx( exStyle, _className, name, @@ -88,21 +88,21 @@ private void _Dispose(bool disposing, bool isHwndBeingDestroyed) // Block against reentrancy. if (_isDisposed) return; _isDisposed = true; - IntPtr hwnd = Handle; + IntPtr hwnd = this.Handle; string className = _className; if (isHwndBeingDestroyed) - Dispatcher.BeginInvoke(DispatcherPriority.Normal, (DispatcherOperationCallback)(arg => _DestroyWindow(IntPtr.Zero, className))); - else if (Handle != IntPtr.Zero) + this.Dispatcher.BeginInvoke(DispatcherPriority.Normal, (DispatcherOperationCallback)(arg => _DestroyWindow(IntPtr.Zero, className))); + else if (this.Handle != IntPtr.Zero) { if (CheckAccess()) _DestroyWindow(hwnd, className); else - Dispatcher.BeginInvoke(DispatcherPriority.Normal, (DispatcherOperationCallback)(arg => _DestroyWindow(hwnd, className))); + this.Dispatcher.BeginInvoke(DispatcherPriority.Normal, (DispatcherOperationCallback)(arg => _DestroyWindow(hwnd, className))); } s_windowLookup.Remove(hwnd); _className = null; - Handle = IntPtr.Zero; + this.Handle = IntPtr.Zero; } [SuppressMessage("Microsoft.Usage", "CA1816:CallGCSuppressFinalizeCorrectly")] diff --git a/Source/Controls/H.Controls.Dock/Controls/Shell/Standard/NativeMethods.cs b/Source/Controls/H.Controls.Dock/Controls/Shell/Standard/NativeMethods.cs index 8f3d9c7e..d1657d2e 100644 --- a/Source/Controls/H.Controls.Dock/Controls/Shell/Standard/NativeMethods.cs +++ b/Source/Controls/H.Controls.Dock/Controls/Shell/Standard/NativeMethods.cs @@ -2071,7 +2071,7 @@ public void Offset(int dx, int dy) public POINT Position => new POINT { x = _left, y = _top }; [SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] - public SIZE Size => new SIZE { cx = Width, cy = Height }; + public SIZE Size => new SIZE { cx = this.Width, cy = this.Height }; public static RECT Union(RECT rect1, RECT rect2) { diff --git a/Source/Controls/H.Controls.Dock/Controls/Shell/SystemParameters2.cs b/Source/Controls/H.Controls.Dock/Controls/Shell/SystemParameters2.cs index d53ae3bb..3103bcc4 100644 --- a/Source/Controls/H.Controls.Dock/Controls/Shell/SystemParameters2.cs +++ b/Source/Controls/H.Controls.Dock/Controls/Shell/SystemParameters2.cs @@ -47,7 +47,7 @@ public class SystemParameters2 : INotifyPropertyChanged private void _InitializeIsGlassEnabled() { - IsGlassEnabled = NativeMethods.DwmIsCompositionEnabled(); + this.IsGlassEnabled = NativeMethods.DwmIsCompositionEnabled(); } private void _UpdateIsGlassEnabled(IntPtr wParam, IntPtr lParam) @@ -60,10 +60,10 @@ private void _InitializeGlassColor() { NativeMethods.DwmGetColorizationColor(out uint color, out bool isOpaque); color |= isOpaque ? 0xFF000000 : 0; - WindowGlassColor = Utility.ColorFromArgbDword(color); - SolidColorBrush glassBrush = new SolidColorBrush(WindowGlassColor); + this.WindowGlassColor = Utility.ColorFromArgbDword(color); + SolidColorBrush glassBrush = new SolidColorBrush(this.WindowGlassColor); glassBrush.Freeze(); - WindowGlassBrush = glassBrush; + this.WindowGlassBrush = glassBrush; } private void _UpdateGlassColor(IntPtr wParam, IntPtr lParam) @@ -71,16 +71,16 @@ private void _UpdateGlassColor(IntPtr wParam, IntPtr lParam) bool isOpaque = lParam != IntPtr.Zero; uint color = unchecked((uint)(int)wParam.ToInt64()); color |= isOpaque ? 0xFF000000 : 0; - WindowGlassColor = Utility.ColorFromArgbDword(color); - SolidColorBrush glassBrush = new SolidColorBrush(WindowGlassColor); + this.WindowGlassColor = Utility.ColorFromArgbDword(color); + SolidColorBrush glassBrush = new SolidColorBrush(this.WindowGlassColor); glassBrush.Freeze(); - WindowGlassBrush = glassBrush; + this.WindowGlassBrush = glassBrush; } private void _InitializeCaptionHeight() { Point ptCaption = new Point(0, NativeMethods.GetSystemMetrics(SM.CYCAPTION)); - WindowCaptionHeight = DpiHelper.DevicePixelsToLogical(ptCaption).Y; + this.WindowCaptionHeight = DpiHelper.DevicePixelsToLogical(ptCaption).Y; } private void _UpdateCaptionHeight(IntPtr wParam, IntPtr lParam) @@ -92,7 +92,7 @@ private void _InitializeWindowResizeBorderThickness() { Size frameSize = new Size(NativeMethods.GetSystemMetrics(SM.CXSIZEFRAME), NativeMethods.GetSystemMetrics(SM.CYSIZEFRAME)); Size frameSizeInDips = DpiHelper.DeviceSizeToLogical(frameSize); - WindowResizeBorderThickness = new Thickness(frameSizeInDips.Width, frameSizeInDips.Height, frameSizeInDips.Width, frameSizeInDips.Height); + this.WindowResizeBorderThickness = new Thickness(frameSizeInDips.Width, frameSizeInDips.Height, frameSizeInDips.Width, frameSizeInDips.Height); } private void _UpdateWindowResizeBorderThickness(IntPtr wParam, IntPtr lParam) @@ -106,7 +106,7 @@ private void _InitializeWindowNonClientFrameThickness() Size frameSizeInDips = DpiHelper.DeviceSizeToLogical(frameSize); int captionHeight = NativeMethods.GetSystemMetrics(SM.CYCAPTION); double captionHeightInDips = DpiHelper.DevicePixelsToLogical(new Point(0, captionHeight)).Y; - WindowNonClientFrameThickness = new Thickness(frameSizeInDips.Width, frameSizeInDips.Height + captionHeightInDips, frameSizeInDips.Width, frameSizeInDips.Height); + this.WindowNonClientFrameThickness = new Thickness(frameSizeInDips.Width, frameSizeInDips.Height + captionHeightInDips, frameSizeInDips.Width, frameSizeInDips.Height); } private void _UpdateWindowNonClientFrameThickness(IntPtr wParam, IntPtr lParam) @@ -116,7 +116,7 @@ private void _UpdateWindowNonClientFrameThickness(IntPtr wParam, IntPtr lParam) private void _InitializeSmallIconSize() { - SmallIconSize = new Size(NativeMethods.GetSystemMetrics(SM.CXSMICON), NativeMethods.GetSystemMetrics(SM.CYSMICON)); + this.SmallIconSize = new Size(NativeMethods.GetSystemMetrics(SM.CXSMICON), NativeMethods.GetSystemMetrics(SM.CYSMICON)); } private void _UpdateSmallIconSize(IntPtr wParam, IntPtr lParam) @@ -137,7 +137,7 @@ private void _LegacyInitializeCaptionButtonLocation() Rect captionRect = new Rect(0, 0, captionX * 3, captionY); captionRect.Offset(-frameX - captionRect.Width, frameY); - WindowCaptionButtonsLocation = captionRect; + this.WindowCaptionButtonsLocation = captionRect; } [SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands")] @@ -182,7 +182,7 @@ private void _InitializeCaptionButtonLocation() rcAllCaptionButtons.Width, rcAllCaptionButtons.Height); Rect logicalCaptionLocation = DpiHelper.DeviceRectToLogical(deviceCaptionLocation); - WindowCaptionButtonsLocation = logicalCaptionLocation; + this.WindowCaptionButtonsLocation = logicalCaptionLocation; } private void _UpdateCaptionButtonLocation(IntPtr wParam, IntPtr lParam) @@ -193,7 +193,7 @@ private void _UpdateCaptionButtonLocation(IntPtr wParam, IntPtr lParam) private void _InitializeHighContrast() { HIGHCONTRAST hc = NativeMethods.SystemParameterInfo_GetHIGHCONTRAST(); - HighContrast = (hc.dwFlags & HCF.HIGHCONTRASTON) != 0; + this.HighContrast = (hc.dwFlags & HCF.HIGHCONTRASTON) != 0; } private void _UpdateHighContrast(IntPtr wParam, IntPtr lParam) @@ -205,16 +205,16 @@ private void _InitializeThemeInfo() { if (!NativeMethods.IsThemeActive()) { - UxThemeName = "Classic"; - UxThemeColor = ""; + this.UxThemeName = "Classic"; + this.UxThemeColor = ""; return; } NativeMethods.GetCurrentThemeName(out string name, out string color, out _); // Consider whether this is the most useful way to expose this... - UxThemeName = System.IO.Path.GetFileNameWithoutExtension(name); - UxThemeColor = color; + this.UxThemeName = System.IO.Path.GetFileNameWithoutExtension(name); + this.UxThemeColor = color; } private void _UpdateThemeInfo(IntPtr wParam, IntPtr lParam) @@ -227,7 +227,7 @@ private void _InitializeWindowCornerRadius() // The radius of window corners isn't exposed as a true system parameter. // It instead is a logical size that we're approximating based on the current theme. // There aren't any known variations based on theme color. - Assert.IsNeitherNullNorEmpty(UxThemeName); + Assert.IsNeitherNullNorEmpty(this.UxThemeName); // These radii are approximate. The way WPF does rounding is different than how // rounded-rectangle HRGNs are created, which is also different than the actual @@ -240,7 +240,7 @@ private void _InitializeWindowCornerRadius() // "Zune" and "Royale", but WPF doesn't know about these either. // If a new theme was to replace Aero, then this will fall back on "classic" behaviors. // This isn't ideal, but it's not the end of the world. WPF will generally have problems anyways. - switch (UxThemeName.ToUpperInvariant()) + switch (this.UxThemeName.ToUpperInvariant()) { case "LUNA": cornerRadius = new CornerRadius(6, 6, 0, 0); @@ -266,7 +266,7 @@ private void _InitializeWindowCornerRadius() break; } - WindowCornerRadius = cornerRadius; + this.WindowCornerRadius = cornerRadius; } private void _UpdateWindowCornerRadius(IntPtr wParam, IntPtr lParam) @@ -347,7 +347,7 @@ private set { if (value == _isGlassEnabled) return; _isGlassEnabled = value; - _NotifyPropertyChanged(nameof(IsGlassEnabled)); + _NotifyPropertyChanged(nameof(this.IsGlassEnabled)); } } @@ -358,7 +358,7 @@ private set { if (value == _glassColor) return; _glassColor = value; - _NotifyPropertyChanged(nameof(WindowGlassColor)); + _NotifyPropertyChanged(nameof(this.WindowGlassColor)); } } @@ -371,7 +371,7 @@ private set Assert.IsTrue(value.IsFrozen); if (_glassColorBrush != null && value.Color == _glassColorBrush.Color) return; _glassColorBrush = value; - _NotifyPropertyChanged(nameof(WindowGlassBrush)); + _NotifyPropertyChanged(nameof(this.WindowGlassBrush)); } } @@ -382,7 +382,7 @@ private set { if (value == _windowResizeBorderThickness) return; _windowResizeBorderThickness = value; - _NotifyPropertyChanged(nameof(WindowResizeBorderThickness)); + _NotifyPropertyChanged(nameof(this.WindowResizeBorderThickness)); } } @@ -393,7 +393,7 @@ private set { if (value == _windowNonClientFrameThickness) return; _windowNonClientFrameThickness = value; - _NotifyPropertyChanged(nameof(WindowNonClientFrameThickness)); + _NotifyPropertyChanged(nameof(this.WindowNonClientFrameThickness)); } } @@ -404,7 +404,7 @@ private set { if (value == _captionHeight) return; _captionHeight = value; - _NotifyPropertyChanged(nameof(WindowCaptionHeight)); + _NotifyPropertyChanged(nameof(this.WindowCaptionHeight)); } } @@ -415,7 +415,7 @@ private set { if (value == _smallIconSize) return; _smallIconSize = value; - _NotifyPropertyChanged(nameof(SmallIconSize)); + _NotifyPropertyChanged(nameof(this.SmallIconSize)); } } @@ -428,7 +428,7 @@ private set { if (value == _uxThemeName) return; _uxThemeName = value; - _NotifyPropertyChanged(nameof(UxThemeName)); + _NotifyPropertyChanged(nameof(this.UxThemeName)); } } @@ -441,7 +441,7 @@ private set { if (value == _uxThemeColor) return; _uxThemeColor = value; - _NotifyPropertyChanged(nameof(UxThemeColor)); + _NotifyPropertyChanged(nameof(this.UxThemeColor)); } } @@ -452,7 +452,7 @@ private set { if (value == _isHighContrast) return; _isHighContrast = value; - _NotifyPropertyChanged(nameof(HighContrast)); + _NotifyPropertyChanged(nameof(this.HighContrast)); } } @@ -463,7 +463,7 @@ private set { if (value == _windowCornerRadius) return; _windowCornerRadius = value; - _NotifyPropertyChanged(nameof(WindowCornerRadius)); + _NotifyPropertyChanged(nameof(this.WindowCornerRadius)); } } @@ -474,7 +474,7 @@ private set { if (value == _captionButtonLocation) return; _captionButtonLocation = value; - _NotifyPropertyChanged(nameof(WindowCaptionButtonsLocation)); + _NotifyPropertyChanged(nameof(this.WindowCaptionButtonsLocation)); } } diff --git a/Source/Controls/H.Controls.Dock/Controls/Shell/WindowChromeWorker.cs b/Source/Controls/H.Controls.Dock/Controls/Shell/WindowChromeWorker.cs index 4597cafe..c9d106c6 100644 --- a/Source/Controls/H.Controls.Dock/Controls/Shell/WindowChromeWorker.cs +++ b/Source/Controls/H.Controls.Dock/Controls/Shell/WindowChromeWorker.cs @@ -309,7 +309,7 @@ private void _FixupWindows7Issues() // NativeMethods.DwmGetCompositionTimingInfo swallows E_PENDING. // If the call wasn't successful, try again later. if (!success) - Dispatcher.BeginInvoke(DispatcherPriority.Loaded, (_Action)_FixupWindows7Issues); + this.Dispatcher.BeginInvoke(DispatcherPriority.Loaded, (_Action)_FixupWindows7Issues); else // Reset this. We will want to force this again if DWM composition changes. _blackGlassFixupAttemptCount = 0; @@ -535,7 +535,7 @@ private IntPtr _HandleEnterSizeMove(WM uMsg, IntPtr wParam, IntPtr lParam, out b { // Check for the docked window case. The window can still be restored when it's in this position so // try to account for that and not update the start position. - if (!_IsWindowDocked) + if (!this._IsWindowDocked) { _windowPosAtStartOfUserMove = new Point(_window.Left, _window.Top); } diff --git a/Source/Controls/H.Controls.Dock/Controls/TabControlEx.cs b/Source/Controls/H.Controls.Dock/Controls/TabControlEx.cs index 674019b3..dfb0c223 100644 --- a/Source/Controls/H.Controls.Dock/Controls/TabControlEx.cs +++ b/Source/Controls/H.Controls.Dock/Controls/TabControlEx.cs @@ -39,7 +39,7 @@ protected TabControlEx() _IsVirtualizing = true; // This is necessary so that we get the initial databound selected item - ItemContainerGenerator.StatusChanged += ItemContainerGenerator_StatusChanged; + this.ItemContainerGenerator.StatusChanged += ItemContainerGenerator_StatusChanged; } #endregion constructors diff --git a/Source/Controls/H.Controls.Dock/Controls/WindowActivateEventArgs.cs b/Source/Controls/H.Controls.Dock/Controls/WindowActivateEventArgs.cs index 9d537217..2430e991 100644 --- a/Source/Controls/H.Controls.Dock/Controls/WindowActivateEventArgs.cs +++ b/Source/Controls/H.Controls.Dock/Controls/WindowActivateEventArgs.cs @@ -7,7 +7,7 @@ internal class WindowActivateEventArgs : EventArgs { public WindowActivateEventArgs(IntPtr hwndActivating) { - HwndActivating = hwndActivating; + this.HwndActivating = hwndActivating; } public IntPtr HwndActivating { get; private set; } diff --git a/Source/Controls/H.Controls.Dock/Controls/WindowHookHandler.cs b/Source/Controls/H.Controls.Dock/Controls/WindowHookHandler.cs index bff7cdd2..ca3a8e38 100644 --- a/Source/Controls/H.Controls.Dock/Controls/WindowHookHandler.cs +++ b/Source/Controls/H.Controls.Dock/Controls/WindowHookHandler.cs @@ -9,8 +9,8 @@ internal class FocusChangeEventArgs : EventArgs public FocusChangeEventArgs(IntPtr gotFocusWinHandle, IntPtr lostFocusWinHandle) { - GotFocusWinHandle = gotFocusWinHandle; - LostFocusWinHandle = lostFocusWinHandle; + this.GotFocusWinHandle = gotFocusWinHandle; + this.LostFocusWinHandle = lostFocusWinHandle; } #endregion Constructors diff --git a/Source/Controls/H.Controls.Dock/DockingManager.xaml.cs b/Source/Controls/H.Controls.Dock/DockingManager.xaml.cs index edb45ee7..073787b4 100644 --- a/Source/Controls/H.Controls.Dock/DockingManager.xaml.cs +++ b/Source/Controls/H.Controls.Dock/DockingManager.xaml.cs @@ -84,11 +84,11 @@ static DockingManager() /// public DockingManager() { - IsVirtualizingDocument = true; - IsVirtualizingAnchorable = true; + this.IsVirtualizingDocument = true; + this.IsVirtualizingAnchorable = true; #if !VS2008 - Layout = new LayoutRoot { RootPanel = new LayoutPanel(new LayoutDocumentPaneGroup(new LayoutDocumentPane())) }; + this.Layout = new LayoutRoot { RootPanel = new LayoutPanel(new LayoutDocumentPaneGroup(new LayoutDocumentPane())) }; #else this.SetCurrentValue( DockingManager.LayoutProperty, new LayoutRoot() { RootPanel = new LayoutPanel(new LayoutDocumentPaneGroup(new LayoutDocumentPane())) } ); #endif @@ -196,8 +196,8 @@ protected virtual void OnLayoutChanged(LayoutRoot oldLayout, LayoutRoot newLayou } _fwHiddenList.Clear(); - DetachDocumentsSource(oldLayout, DocumentsSource); - DetachAnchorablesSource(oldLayout, AnchorablesSource); + DetachDocumentsSource(oldLayout, this.DocumentsSource); + DetachAnchorablesSource(oldLayout, this.AnchorablesSource); if (oldLayout != null && oldLayout.Manager == this) oldLayout.Manager = null; @@ -205,21 +205,21 @@ protected virtual void OnLayoutChanged(LayoutRoot oldLayout, LayoutRoot newLayou ClearLogicalChildrenList(); DetachLayoutItems(); - Layout.Manager = this; + this.Layout.Manager = this; AttachLayoutItems(); - AttachDocumentsSource(newLayout, DocumentsSource); - AttachAnchorablesSource(newLayout, AnchorablesSource); + AttachDocumentsSource(newLayout, this.DocumentsSource); + AttachAnchorablesSource(newLayout, this.AnchorablesSource); - if (IsLoaded) + if (this.IsLoaded) { - LayoutRootPanel = CreateUIElementForModel(Layout.RootPanel) as LayoutPanelControl; - LeftSidePanel = CreateUIElementForModel(Layout.LeftSide) as LayoutAnchorSideControl; - TopSidePanel = CreateUIElementForModel(Layout.TopSide) as LayoutAnchorSideControl; - RightSidePanel = CreateUIElementForModel(Layout.RightSide) as LayoutAnchorSideControl; - BottomSidePanel = CreateUIElementForModel(Layout.BottomSide) as LayoutAnchorSideControl; + this.LayoutRootPanel = CreateUIElementForModel(this.Layout.RootPanel) as LayoutPanelControl; + this.LeftSidePanel = CreateUIElementForModel(this.Layout.LeftSide) as LayoutAnchorSideControl; + this.TopSidePanel = CreateUIElementForModel(this.Layout.TopSide) as LayoutAnchorSideControl; + this.RightSidePanel = CreateUIElementForModel(this.Layout.RightSide) as LayoutAnchorSideControl; + this.BottomSidePanel = CreateUIElementForModel(this.Layout.BottomSide) as LayoutAnchorSideControl; - foreach (LayoutFloatingWindow fw in Layout.FloatingWindows.ToArray()) + foreach (LayoutFloatingWindow fw in this.Layout.FloatingWindows.ToArray()) if (fw.IsValid) _fwList.Add(CreateUIElementForModel(fw) as LayoutFloatingWindowControl); @@ -482,10 +482,10 @@ public DataTemplateSelector DocumentHeaderTemplateSelector /// Provides derived classes an opportunity to handle changes to the property. protected virtual void OnDocumentHeaderTemplateSelectorChanged(DependencyPropertyChangedEventArgs e) { - if (e.NewValue != null && DocumentHeaderTemplate != null) - DocumentHeaderTemplate = null; - if (DocumentPaneMenuItemHeaderTemplateSelector == null) - DocumentPaneMenuItemHeaderTemplateSelector = DocumentHeaderTemplateSelector; + if (e.NewValue != null && this.DocumentHeaderTemplate != null) + this.DocumentHeaderTemplate = null; + if (this.DocumentPaneMenuItemHeaderTemplateSelector == null) + this.DocumentPaneMenuItemHeaderTemplateSelector = this.DocumentHeaderTemplateSelector; } /// Coerces the value. @@ -546,7 +546,7 @@ public DataTemplateSelector DocumentTitleTemplateSelector protected virtual void OnDocumentTitleTemplateSelectorChanged(DependencyPropertyChangedEventArgs e) { if (e.NewValue != null) - DocumentTitleTemplate = null; + this.DocumentTitleTemplate = null; } /// Coerces the value. @@ -606,8 +606,8 @@ public DataTemplateSelector AnchorableTitleTemplateSelector /// Provides derived classes an opportunity to handle changes to the property. protected virtual void OnAnchorableTitleTemplateSelectorChanged(DependencyPropertyChangedEventArgs e) { - if (e.NewValue != null && AnchorableTitleTemplate != null) - AnchorableTitleTemplate = null; + if (e.NewValue != null && this.AnchorableTitleTemplate != null) + this.AnchorableTitleTemplate = null; } #endregion AnchorableTitleTemplateSelector @@ -665,7 +665,7 @@ public DataTemplateSelector AnchorableHeaderTemplateSelector protected virtual void OnAnchorableHeaderTemplateSelectorChanged(DependencyPropertyChangedEventArgs e) { if (e.NewValue != null) - AnchorableHeaderTemplate = null; + this.AnchorableHeaderTemplate = null; } #endregion AnchorableHeaderTemplateSelector @@ -945,8 +945,8 @@ public IEnumerable DocumentsSource /// Provides derived classes an opportunity to handle changes to the property. protected virtual void OnDocumentsSourceChanged(DependencyPropertyChangedEventArgs e) { - DetachDocumentsSource(Layout, e.OldValue as IEnumerable); - AttachDocumentsSource(Layout, e.NewValue as IEnumerable); + DetachDocumentsSource(this.Layout, e.OldValue as IEnumerable); + AttachDocumentsSource(this.Layout, e.NewValue as IEnumerable); } #endregion DocumentsSource @@ -987,8 +987,8 @@ public IEnumerable AnchorablesSource /// Provides derived classes an opportunity to handle changes to the property. protected virtual void OnAnchorablesSourceChanged(DependencyPropertyChangedEventArgs e) { - DetachAnchorablesSource(Layout, e.OldValue as IEnumerable); - AttachAnchorablesSource(Layout, e.NewValue as IEnumerable); + DetachAnchorablesSource(this.Layout, e.OldValue as IEnumerable); + AttachAnchorablesSource(this.Layout, e.NewValue as IEnumerable); } #endregion AnchorablesSource @@ -1056,7 +1056,7 @@ public Theme Theme protected virtual void OnThemeChanged(DependencyPropertyChangedEventArgs e) { Theme oldTheme = e.OldValue as Theme; - ResourceDictionary resources = Resources; + ResourceDictionary resources = this.Resources; if (oldTheme != null) // remove old theme from resource dictionary if present { if (oldTheme is DictionaryTheme) // We are using H.Controls.Dock's own DictionaryTheme class @@ -1234,8 +1234,8 @@ public DataTemplateSelector DocumentPaneMenuItemHeaderTemplateSelector /// Provides derived classes an opportunity to handle changes to the property. protected virtual void OnDocumentPaneMenuItemHeaderTemplateSelectorChanged(DependencyPropertyChangedEventArgs e) { - if (e.NewValue != null && DocumentPaneMenuItemHeaderTemplate != null) - DocumentPaneMenuItemHeaderTemplate = null; + if (e.NewValue != null && this.DocumentPaneMenuItemHeaderTemplate != null) + this.DocumentPaneMenuItemHeaderTemplate = null; } /// Coerces the value. @@ -1392,7 +1392,7 @@ public bool AutoWindowSizeWhenOpened /// protected override IEnumerator LogicalChildren => _logicalChildren.Select(ch => ch.GetValueOrDefault()).GetEnumerator(); - public IEnumerator LogicalChildrenPublic => LogicalChildren; + public IEnumerator LogicalChildrenPublic => this.LogicalChildren; internal void InternalAddLogicalChild(object element) { @@ -1627,13 +1627,13 @@ internal UIElement CreateUIElementForModel(ILayoutElement model) if (model is LayoutDocumentPane) { - LayoutDocumentPaneControl templateModelView = new LayoutDocumentPaneControl(model as LayoutDocumentPane, IsVirtualizingDocument); + LayoutDocumentPaneControl templateModelView = new LayoutDocumentPaneControl(model as LayoutDocumentPane, this.IsVirtualizingDocument); templateModelView.SetBinding(StyleProperty, new Binding(DocumentPaneControlStyleProperty.Name) { Source = this }); return templateModelView; } if (model is LayoutAnchorablePane) { - LayoutAnchorablePaneControl templateModelView = new LayoutAnchorablePaneControl(model as LayoutAnchorablePane, IsVirtualizingAnchorable); + LayoutAnchorablePaneControl templateModelView = new LayoutAnchorablePaneControl(model as LayoutAnchorablePane, this.IsVirtualizingAnchorable); templateModelView.SetBinding(StyleProperty, new Binding(AnchorablePaneControlStyleProperty.Name) { Source = this }); return templateModelView; } @@ -1668,7 +1668,7 @@ internal UIElement CreateUIElementForModel(ILayoutElement model) newFW.ShowInTaskbar = false; - Dispatcher.BeginInvoke(new Action(() => + this.Dispatcher.BeginInvoke(new Action(() => { if (newFW.Content != null || (newFW.Model as LayoutAnchorableFloatingWindow)?.IsVisible == true) newFW.Show(); @@ -1769,7 +1769,7 @@ internal void StartDraggingFloatingWindowForContent(LayoutContent contentModel, if (fwc != null) { - Dispatcher.BeginInvoke(new Action(() => + this.Dispatcher.BeginInvoke(new Action(() => { // Activate only inactive document if (startDrag) fwc.AttachDrag(); @@ -1946,13 +1946,13 @@ private int GetIndexOfDocument(LayoutDocument documentToFind) internal void ExecuteCloseAllButThisCommand(LayoutContent contentSelected) { - foreach (LayoutContent contentToClose in Layout.Descendents().OfType().Where(d => d != contentSelected && (d.Parent is LayoutDocumentPane || d.Parent is LayoutDocumentFloatingWindow)).ToArray()) + foreach (LayoutContent contentToClose in this.Layout.Descendents().OfType().Where(d => d != contentSelected && (d.Parent is LayoutDocumentPane || d.Parent is LayoutDocumentFloatingWindow)).ToArray()) Close(contentToClose); } internal void ExecuteCloseAllCommand(LayoutContent contentSelected) { - foreach (LayoutContent contentToClose in Layout.Descendents().OfType().Where(d => d.Parent is LayoutDocumentPane || d.Parent is LayoutDocumentFloatingWindow).ToArray()) + foreach (LayoutContent contentToClose in this.Layout.Descendents().OfType().Where(d => d.Parent is LayoutDocumentPane || d.Parent is LayoutDocumentFloatingWindow).ToArray()) Close(contentToClose); } @@ -2028,7 +2028,7 @@ protected override void OnPreviewKeyDown(KeyEventArgs e) { if (e.IsDown && e.Key == Key.Tab) { - if (CanShowNavigatorWindow && !IsNavigatorWindowActive) + if (this.CanShowNavigatorWindow && !this.IsNavigatorWindowActive) { ShowNavigatorWindow(); e.Handled = true; @@ -2062,10 +2062,10 @@ private void OnLayoutRootPropertyChanged(object sender, PropertyChangedEventArgs { case nameof(LayoutRoot.RootPanel): { - if (IsInitialized) + if (this.IsInitialized) { - LayoutPanelControl layoutRootPanel = CreateUIElementForModel(Layout.RootPanel) as LayoutPanelControl; - LayoutRootPanel = layoutRootPanel; + LayoutPanelControl layoutRootPanel = CreateUIElementForModel(this.Layout.RootPanel) as LayoutPanelControl; + this.LayoutRootPanel = layoutRootPanel; } break; } @@ -2077,14 +2077,14 @@ private void OnLayoutRootPropertyChanged(object sender, PropertyChangedEventArgs //{ // _setFocusAsyncOperation = Dispatcher.BeginInvoke(new Action(() => // { - if (Layout.ActiveContent != null) - FocusElementManager.SetFocusOnLastElement(Layout.ActiveContent); + if (this.Layout.ActiveContent != null) + FocusElementManager.SetFocusOnLastElement(this.Layout.ActiveContent); //_setFocusAsyncOperation = null; // } ), DispatcherPriority.Input ); //} if (!_insideInternalSetActiveContent) - ActiveContent = Layout.ActiveContent?.Content; + this.ActiveContent = this.Layout.ActiveContent?.Content; break; } } @@ -2097,13 +2097,13 @@ private void OnLayoutRootPropertyChanged(object sender, PropertyChangedEventArgs private void DockingManager_Loaded(object sender, RoutedEventArgs e) { if (DesignerProperties.GetIsInDesignMode(this)) return; - if (Layout.Manager == this) + if (this.Layout.Manager == this) { - LayoutRootPanel = CreateUIElementForModel(Layout.RootPanel) as LayoutPanelControl; - LeftSidePanel = CreateUIElementForModel(Layout.LeftSide) as LayoutAnchorSideControl; - TopSidePanel = CreateUIElementForModel(Layout.TopSide) as LayoutAnchorSideControl; - RightSidePanel = CreateUIElementForModel(Layout.RightSide) as LayoutAnchorSideControl; - BottomSidePanel = CreateUIElementForModel(Layout.BottomSide) as LayoutAnchorSideControl; + this.LayoutRootPanel = CreateUIElementForModel(this.Layout.RootPanel) as LayoutPanelControl; + this.LeftSidePanel = CreateUIElementForModel(this.Layout.LeftSide) as LayoutAnchorSideControl; + this.TopSidePanel = CreateUIElementForModel(this.Layout.TopSide) as LayoutAnchorSideControl; + this.RightSidePanel = CreateUIElementForModel(this.Layout.RightSide) as LayoutAnchorSideControl; + this.BottomSidePanel = CreateUIElementForModel(this.Layout.BottomSide) as LayoutAnchorSideControl; // In order to prevent resource leaks, unsubscribe from SizeChanged event for case when we have no stored Layout settings. SizeChanged -= OnSizeChanged; @@ -2126,12 +2126,12 @@ private void DockingManager_Loaded(object sender, RoutedEventArgs e) _fwHiddenList.Clear(); // load floating windows not already loaded! (issue #59 & #254) - List items = new List(Layout.FloatingWindows.Where(fw => !_fwList.Any(fwc => fwc.Model == fw))); + List items = new List(this.Layout.FloatingWindows.Where(fw => !_fwList.Any(fwc => fwc.Model == fw))); foreach (LayoutFloatingWindow fw in items) CreateUIElementForModel(fw); //create the overlaywindow if it's possible - if (IsVisible) + if (this.IsVisible) CreateOverlayWindow(); FocusElementManager.SetupFocusManagement(this); } @@ -2142,10 +2142,10 @@ private void DockingManager_Loaded(object sender, RoutedEventArgs e) private void OnSizeChanged(object sender, SizeChangedEventArgs e) { // Lets make sure this always remains non-negative to avoid crach in layout system - double width = Math.Max(ActualWidth - GridSplitterWidth - RightSidePanel.ActualWidth - LeftSidePanel.ActualWidth, 0); - double height = Math.Max(ActualHeight - GridSplitterHeight - TopSidePanel.ActualHeight - BottomSidePanel.ActualHeight, 0); + double width = Math.Max(this.ActualWidth - this.GridSplitterWidth - this.RightSidePanel.ActualWidth - this.LeftSidePanel.ActualWidth, 0); + double height = Math.Max(this.ActualHeight - this.GridSplitterHeight - this.TopSidePanel.ActualHeight - this.BottomSidePanel.ActualHeight, 0); - LayoutRootPanel.AdjustFixedChildrenPanelSizes(new Size(width, height)); + this.LayoutRootPanel.AdjustFixedChildrenPanelSizes(new Size(width, height)); } private void DockingManager_Unloaded(object sender, RoutedEventArgs e) @@ -2155,7 +2155,7 @@ private void DockingManager_Unloaded(object sender, RoutedEventArgs e) if (DesignerProperties.GetIsInDesignMode(this)) return; _autoHideWindowManager?.HideAutoWindow(); - AutoHideWindow?.Dispose(); + this.AutoHideWindow?.Dispose(); foreach (LayoutFloatingWindowControl fw in _fwList.ToArray()) { @@ -2190,7 +2190,7 @@ private void SetupAutoHideWindow() else _autoHideWindowManager = new AutoHideWindowManager(this); - AutoHideWindow?.Dispose(); + this.AutoHideWindow?.Dispose(); SetAutoHideWindow(new LayoutAutoHideWindowControl()); } @@ -2257,8 +2257,8 @@ private void AttachDocumentsSource(LayoutRoot layout, IEnumerable documentsSourc LayoutDocument documentToImport = new LayoutDocument { Content = documentContentToImport }; bool added = false; - if (LayoutUpdateStrategy != null) - added = LayoutUpdateStrategy.BeforeInsertDocument(layout, documentToImport, documentPane); + if (this.LayoutUpdateStrategy != null) + added = this.LayoutUpdateStrategy.BeforeInsertDocument(layout, documentToImport, documentPane); if (!added) { @@ -2268,7 +2268,7 @@ private void AttachDocumentsSource(LayoutRoot layout, IEnumerable documentsSourc documentPane.Children.Add(documentToImport); } - LayoutUpdateStrategy?.AfterInsertDocument(layout, documentToImport); + this.LayoutUpdateStrategy?.AfterInsertDocument(layout, documentToImport); CreateDocumentLayoutItem(documentToImport); } _suspendLayoutItemCreation = false; @@ -2278,7 +2278,7 @@ private void AttachDocumentsSource(LayoutRoot layout, IEnumerable documentsSourc private void DocumentsSourceElementsChanged(object sender, NotifyCollectionChangedEventArgs e) { - if (Layout == null) return; + if (this.Layout == null) return; //When deserializing documents are created automatically by the deserializer if (SuspendDocumentsSourceBinding) return; @@ -2288,7 +2288,7 @@ private void DocumentsSourceElementsChanged(object sender, NotifyCollectionChang { if (e.OldItems != null) { - LayoutDocument[] documentsToRemove = Layout.Descendents().OfType().Where(d => e.OldItems.Contains(d.Content)).ToArray(); + LayoutDocument[] documentsToRemove = this.Layout.Descendents().OfType().Where(d => e.OldItems.Contains(d.Content)).ToArray(); foreach (LayoutDocument documentToRemove in documentsToRemove) { documentToRemove.Content = null; @@ -2304,13 +2304,13 @@ private void DocumentsSourceElementsChanged(object sender, NotifyCollectionChang if (e.NewItems != null) { LayoutDocumentPane documentPane = null; - if (Layout.LastFocusedDocument != null) + if (this.Layout.LastFocusedDocument != null) { - documentPane = Layout.LastFocusedDocument.Parent as LayoutDocumentPane; + documentPane = this.Layout.LastFocusedDocument.Parent as LayoutDocumentPane; } if (documentPane == null) { - documentPane = Layout.Descendents().OfType().FirstOrDefault(); + documentPane = this.Layout.Descendents().OfType().FirstOrDefault(); } //if (documentPane == null) // throw new InvalidOperationException("Layout must contains at least one LayoutDocumentPane in order to host documents"); @@ -2323,9 +2323,9 @@ private void DocumentsSourceElementsChanged(object sender, NotifyCollectionChang }; bool added = false; - if (LayoutUpdateStrategy != null) + if (this.LayoutUpdateStrategy != null) { - added = LayoutUpdateStrategy.BeforeInsertDocument(Layout, documentToImport, documentPane); + added = this.LayoutUpdateStrategy.BeforeInsertDocument(this.Layout, documentToImport, documentPane); } if (!added) @@ -2337,7 +2337,7 @@ private void DocumentsSourceElementsChanged(object sender, NotifyCollectionChang added = true; } - LayoutUpdateStrategy?.AfterInsertDocument(Layout, documentToImport); + this.LayoutUpdateStrategy?.AfterInsertDocument(this.Layout, documentToImport); ILayoutRoot root = documentToImport.Root; if (root != null && root.Manager == this) { @@ -2351,7 +2351,7 @@ private void DocumentsSourceElementsChanged(object sender, NotifyCollectionChang if (e.Action == NotifyCollectionChangedAction.Reset) { //Remove documents that are no longer in the DocumentSource. - LayoutDocument[] documentsToRemove = GetItemsToRemoveAfterReset(DocumentsSource); + LayoutDocument[] documentsToRemove = GetItemsToRemoveAfterReset(this.DocumentsSource); foreach (LayoutDocument documentToRemove in documentsToRemove) { documentToRemove.Parent.RemoveChild( @@ -2360,7 +2360,7 @@ private void DocumentsSourceElementsChanged(object sender, NotifyCollectionChang } } - Layout?.CollectGarbage(); + this.Layout?.CollectGarbage(); } /// @@ -2380,7 +2380,7 @@ private TLayoutType[] GetItemsToRemoveAfterReset(IEnumerable source //Find remaining items in source HashSet itemsThatRemain = new HashSet(source.Cast(), ReferenceEqualityComparer.Default); //Find the removed items that are not in the remaining collection - return Layout.Descendents() + return this.Layout.Descendents() .OfType() .Where(x => !itemsThatRemain.Contains(x.Content)) .ToArray(); @@ -2461,8 +2461,8 @@ private void AttachAnchorablesSource(LayoutRoot layout, IEnumerable anchorablesS { LayoutAnchorable anchorableToImport = new LayoutAnchorable { Content = anchorableContentToImport }; bool added = false; - if (LayoutUpdateStrategy != null) - added = LayoutUpdateStrategy.BeforeInsertAnchorable(layout, anchorableToImport, anchorablePane); + if (this.LayoutUpdateStrategy != null) + added = this.LayoutUpdateStrategy.BeforeInsertAnchorable(layout, anchorableToImport, anchorablePane); if (!added) { @@ -2483,7 +2483,7 @@ private void AttachAnchorablesSource(LayoutRoot layout, IEnumerable anchorablesS added = true; } - LayoutUpdateStrategy?.AfterInsertAnchorable(layout, anchorableToImport); + this.LayoutUpdateStrategy?.AfterInsertAnchorable(layout, anchorableToImport); CreateAnchorableLayoutItem(anchorableToImport); } _suspendLayoutItemCreation = false; @@ -2493,7 +2493,7 @@ private void AttachAnchorablesSource(LayoutRoot layout, IEnumerable anchorablesS private void AnchorablesSourceElementsChanged(object sender, NotifyCollectionChangedEventArgs e) { - if (Layout == null) return; + if (this.Layout == null) return; //When deserializing documents are created automatically by the deserializer if (SuspendAnchorablesSourceBinding) return; @@ -2503,7 +2503,7 @@ private void AnchorablesSourceElementsChanged(object sender, NotifyCollectionCha { if (e.OldItems != null) { - LayoutAnchorable[] anchorablesToRemove = Layout.Descendents().OfType().Where(d => e.OldItems.Contains(d.Content)).ToArray(); + LayoutAnchorable[] anchorablesToRemove = this.Layout.Descendents().OfType().Where(d => e.OldItems.Contains(d.Content)).ToArray(); foreach (LayoutAnchorable anchorableToRemove in anchorablesToRemove) { anchorableToRemove.Content = null; @@ -2519,45 +2519,45 @@ private void AnchorablesSourceElementsChanged(object sender, NotifyCollectionCha if (e.NewItems != null) { LayoutAnchorablePane anchorablePane = null; - if (Layout.ActiveContent != null) + if (this.Layout.ActiveContent != null) { //look for active content parent pane - anchorablePane = Layout.ActiveContent.Parent as LayoutAnchorablePane; + anchorablePane = this.Layout.ActiveContent.Parent as LayoutAnchorablePane; } if (anchorablePane == null) { //look for a pane on the right side - anchorablePane = Layout.Descendents().OfType().FirstOrDefault(pane => !pane.IsHostedInFloatingWindow && pane.GetSide() == AnchorSide.Right); + anchorablePane = this.Layout.Descendents().OfType().FirstOrDefault(pane => !pane.IsHostedInFloatingWindow && pane.GetSide() == AnchorSide.Right); } if (anchorablePane == null) { //look for an available pane - anchorablePane = Layout.Descendents().OfType().FirstOrDefault(); + anchorablePane = this.Layout.Descendents().OfType().FirstOrDefault(); } _suspendLayoutItemCreation = true; foreach (object anchorableContentToImport in e.NewItems) { LayoutAnchorable anchorableToImport = new LayoutAnchorable { Content = anchorableContentToImport }; bool added = false; - if (LayoutUpdateStrategy != null) - added = LayoutUpdateStrategy.BeforeInsertAnchorable(Layout, anchorableToImport, anchorablePane); + if (this.LayoutUpdateStrategy != null) + added = this.LayoutUpdateStrategy.BeforeInsertAnchorable(this.Layout, anchorableToImport, anchorablePane); if (!added) { if (anchorablePane == null) { LayoutPanel mainLayoutPanel = new LayoutPanel { Orientation = Orientation.Horizontal }; - if (Layout.RootPanel != null) + if (this.Layout.RootPanel != null) { - mainLayoutPanel.Children.Add(Layout.RootPanel); + mainLayoutPanel.Children.Add(this.Layout.RootPanel); } - Layout.RootPanel = mainLayoutPanel; + this.Layout.RootPanel = mainLayoutPanel; anchorablePane = new LayoutAnchorablePane { DockWidth = new GridLength(200.0, GridUnitType.Pixel) }; mainLayoutPanel.Children.Add(anchorablePane); } anchorablePane.Children.Add(anchorableToImport); added = true; } - LayoutUpdateStrategy?.AfterInsertAnchorable(Layout, anchorableToImport); + this.LayoutUpdateStrategy?.AfterInsertAnchorable(this.Layout, anchorableToImport); ILayoutRoot root = anchorableToImport.Root; if (root != null && root.Manager == this) CreateAnchorableLayoutItem(anchorableToImport); @@ -2569,7 +2569,7 @@ private void AnchorablesSourceElementsChanged(object sender, NotifyCollectionCha if (e.Action == NotifyCollectionChangedAction.Reset) { //Remove anchorables that are no longer in the AnchorablesSource. - LayoutAnchorable[] anchorablesToRemove = GetItemsToRemoveAfterReset(AnchorablesSource); + LayoutAnchorable[] anchorablesToRemove = GetItemsToRemoveAfterReset(this.AnchorablesSource); foreach (LayoutAnchorable anchorableToRemove in anchorablesToRemove) { anchorableToRemove.Parent.RemoveChild( @@ -2578,7 +2578,7 @@ private void AnchorablesSourceElementsChanged(object sender, NotifyCollectionCha } } - Layout?.CollectGarbage(); + this.Layout?.CollectGarbage(); } private void DetachAnchorablesSource(LayoutRoot layout, IEnumerable anchorablesSource) @@ -2610,10 +2610,10 @@ private void RemoveViewFromLogicalChild(LayoutContent layoutContent) private void InternalSetActiveContent(object contentObject) { // BugFix for first issue in #59 - List list = Layout.Descendents().OfType().ToList(); + List list = this.Layout.Descendents().OfType().ToList(); LayoutContent layoutContent = list.FirstOrDefault(lc => lc == contentObject || lc.Content == contentObject); _insideInternalSetActiveContent = true; - Layout.ActiveContent = layoutContent; + this.Layout.ActiveContent = layoutContent; _insideInternalSetActiveContent = false; } @@ -2638,7 +2638,7 @@ private void Layout_ElementRemoved(object sender, LayoutElementEventArgs e) private void Layout_ElementAdded(object sender, LayoutElementEventArgs e) { if (_suspendLayoutItemCreation) return; - foreach (LayoutContent content in Layout.Descendents().OfType().ToList()) + foreach (LayoutContent content in this.Layout.Descendents().OfType().ToList()) { if (content is LayoutDocument) CreateDocumentLayoutItem(content as LayoutDocument); @@ -2654,10 +2654,10 @@ private void Layout_ElementAdded(object sender, LayoutElementEventArgs e) private void CollectLayoutItemsDeleted() { if (_collectLayoutItemsOperations != null) return; - _collectLayoutItemsOperations = Dispatcher.BeginInvoke(new Action(() => + _collectLayoutItemsOperations = this.Dispatcher.BeginInvoke(new Action(() => { _collectLayoutItemsOperations = null; - foreach (LayoutItem itemToRemove in _layoutItems.Where(item => item.LayoutElement.Root != Layout).ToArray()) + foreach (LayoutItem itemToRemove in _layoutItems.Where(item => item.LayoutElement.Root != this.Layout).ToArray()) { itemToRemove.Detach(); _layoutItems.Remove(itemToRemove); @@ -2670,11 +2670,11 @@ private void CollectLayoutItemsDeleted() /// private void DetachLayoutItems() { - if (Layout == null) return; + if (this.Layout == null) return; _layoutItems.ForEach(i => i.Detach()); _layoutItems.Clear(); - Layout.ElementAdded -= Layout_ElementAdded; - Layout.ElementRemoved -= Layout_ElementRemoved; + this.Layout.ElementAdded -= Layout_ElementAdded; + this.Layout.ElementRemoved -= Layout_ElementRemoved; } /// @@ -2686,15 +2686,15 @@ private void DetachLayoutItems() /// private void AttachLayoutItems() { - if (Layout == null) return; - foreach (LayoutDocument document in Layout.Descendents().OfType().ToArray()) + if (this.Layout == null) return; + foreach (LayoutDocument document in this.Layout.Descendents().OfType().ToArray()) CreateDocumentLayoutItem(document); - foreach (LayoutAnchorable anchorable in Layout.Descendents().OfType().ToArray()) + foreach (LayoutAnchorable anchorable in this.Layout.Descendents().OfType().ToArray()) CreateAnchorableLayoutItem(anchorable); - Layout.ElementAdded += Layout_ElementAdded; - Layout.ElementRemoved += Layout_ElementRemoved; + this.Layout.ElementAdded += Layout_ElementAdded; + this.Layout.ElementRemoved += Layout_ElementRemoved; } /// @@ -2706,10 +2706,10 @@ private void AttachLayoutItems() private void ApplyStyleToLayoutItem(LayoutItem layoutItem) { layoutItem._ClearDefaultBindings(); - if (LayoutItemContainerStyle != null) - layoutItem.Style = LayoutItemContainerStyle; - else if (LayoutItemContainerStyleSelector != null) - layoutItem.Style = LayoutItemContainerStyleSelector.SelectStyle(layoutItem.Model, layoutItem); + if (this.LayoutItemContainerStyle != null) + layoutItem.Style = this.LayoutItemContainerStyle; + else if (this.LayoutItemContainerStyleSelector != null) + layoutItem.Style = this.LayoutItemContainerStyleSelector.SelectStyle(layoutItem.Model, layoutItem); layoutItem._SetDefaultBindings(); } @@ -2822,7 +2822,7 @@ private LayoutFloatingWindowControl CreateFloatingWindowForLayoutAnchorableWitho } }; - Layout.FloatingWindows.Add(fw); + this.Layout.FloatingWindows.Add(fw); fwc = new LayoutAnchorableFloatingWindowControl((LayoutAnchorableFloatingWindow)fw, isContentImmutable) { @@ -2834,7 +2834,7 @@ private LayoutFloatingWindowControl CreateFloatingWindowForLayoutAnchorableWitho //fwc.Owner = Window.GetWindow(this); //fwc.SetParentToMainWindowOf(this); _fwList.Add(fwc); - Layout.CollectGarbage(); + this.Layout.CollectGarbage(); InvalidateArrange(); return fwc; } @@ -2891,7 +2891,7 @@ private LayoutFloatingWindowControl CreateFloatingWindowCore(LayoutContent conte }) }; - Layout.FloatingWindows.Add(fw); + this.Layout.FloatingWindows.Add(fw); fwc = new LayoutAnchorableFloatingWindowControl((LayoutAnchorableFloatingWindow)fw, isContentImmutable) { Width = fwWidth, @@ -2918,7 +2918,7 @@ private LayoutFloatingWindowControl CreateFloatingWindowCore(LayoutContent conte }) }; - Layout.FloatingWindows.Add(fw); + this.Layout.FloatingWindows.Add(fw); fwc = new LayoutDocumentFloatingWindowControl((LayoutDocumentFloatingWindow)fw, isContentImmutable) { Width = fwWidth, @@ -2930,7 +2930,7 @@ private LayoutFloatingWindowControl CreateFloatingWindowCore(LayoutContent conte //fwc.Owner = Window.GetWindow(this); //fwc.SetParentToMainWindowOf(this); _fwList.Add(fwc); - Layout.CollectGarbage(); + this.Layout.CollectGarbage(); UpdateLayout(); return fwc; } diff --git a/Source/Controls/H.Controls.Dock/DocumentClosedEventArgs.cs b/Source/Controls/H.Controls.Dock/DocumentClosedEventArgs.cs index 0cc048b0..5b32321a 100644 --- a/Source/Controls/H.Controls.Dock/DocumentClosedEventArgs.cs +++ b/Source/Controls/H.Controls.Dock/DocumentClosedEventArgs.cs @@ -24,7 +24,7 @@ public class DocumentClosedEventArgs : EventArgs /// public DocumentClosedEventArgs(LayoutDocument document) { - Document = document; + this.Document = document; } /// diff --git a/Source/Controls/H.Controls.Dock/DocumentClosingEventArgs.cs b/Source/Controls/H.Controls.Dock/DocumentClosingEventArgs.cs index ec755d8e..9ac7546d 100644 --- a/Source/Controls/H.Controls.Dock/DocumentClosingEventArgs.cs +++ b/Source/Controls/H.Controls.Dock/DocumentClosingEventArgs.cs @@ -24,7 +24,7 @@ public class DocumentClosingEventArgs : CancelEventArgs /// public DocumentClosingEventArgs(LayoutDocument document) { - Document = document; + this.Document = document; } /// diff --git a/Source/Controls/H.Controls.Dock/Layout/ChildrenTreeChangedEventArgs.cs b/Source/Controls/H.Controls.Dock/Layout/ChildrenTreeChangedEventArgs.cs index d6a52ec1..cf750f5f 100644 --- a/Source/Controls/H.Controls.Dock/Layout/ChildrenTreeChangedEventArgs.cs +++ b/Source/Controls/H.Controls.Dock/Layout/ChildrenTreeChangedEventArgs.cs @@ -33,7 +33,7 @@ public class ChildrenTreeChangedEventArgs : EventArgs /// Class constructor public ChildrenTreeChangedEventArgs(ChildrenTreeChange change) { - Change = change; + this.Change = change; } /// Gets the type of for this event. diff --git a/Source/Controls/H.Controls.Dock/Layout/LayoutAnchorGroup.cs b/Source/Controls/H.Controls.Dock/Layout/LayoutAnchorGroup.cs index 677ce625..cd16213d 100644 --- a/Source/Controls/H.Controls.Dock/Layout/LayoutAnchorGroup.cs +++ b/Source/Controls/H.Controls.Dock/Layout/LayoutAnchorGroup.cs @@ -23,7 +23,7 @@ public class LayoutAnchorGroup : LayoutGroup, ILayoutPreviousC #region Overrides /// - protected override bool GetVisibility() => Children.Count > 0; + protected override bool GetVisibility() => this.Children.Count > 0; /// public override void WriteXml(System.Xml.XmlWriter writer) diff --git a/Source/Controls/H.Controls.Dock/Layout/LayoutAnchorSide.cs b/Source/Controls/H.Controls.Dock/Layout/LayoutAnchorSide.cs index 9b25c8af..cd6eeb4f 100644 --- a/Source/Controls/H.Controls.Dock/Layout/LayoutAnchorSide.cs +++ b/Source/Controls/H.Controls.Dock/Layout/LayoutAnchorSide.cs @@ -35,9 +35,9 @@ public AnchorSide Side private set { if (value == _side) return; - RaisePropertyChanging(nameof(Side)); + RaisePropertyChanging(nameof(this.Side)); _side = value; - RaisePropertyChanged(nameof(Side)); + RaisePropertyChanged(nameof(this.Side)); } } @@ -46,7 +46,7 @@ private set #region Overrides /// - protected override bool GetVisibility() => Children.Count > 0; + protected override bool GetVisibility() => this.Children.Count > 0; /// protected override void OnParentChanged(ILayoutContainer oldValue, ILayoutContainer newValue) @@ -61,10 +61,10 @@ protected override void OnParentChanged(ILayoutContainer oldValue, ILayoutContai private void UpdateSide() { - if (this == Root.LeftSide) Side = AnchorSide.Left; - else if (this == Root.TopSide) Side = AnchorSide.Top; - else if (this == Root.RightSide) Side = AnchorSide.Right; - else if (this == Root.BottomSide) Side = AnchorSide.Bottom; + if (this == this.Root.LeftSide) this.Side = AnchorSide.Left; + else if (this == this.Root.TopSide) this.Side = AnchorSide.Top; + else if (this == this.Root.RightSide) this.Side = AnchorSide.Right; + else if (this == this.Root.BottomSide) this.Side = AnchorSide.Bottom; } #endregion Private Methods diff --git a/Source/Controls/H.Controls.Dock/Layout/LayoutAnchorable.cs b/Source/Controls/H.Controls.Dock/Layout/LayoutAnchorable.cs index 87c961db..e065f3ca 100644 --- a/Source/Controls/H.Controls.Dock/Layout/LayoutAnchorable.cs +++ b/Source/Controls/H.Controls.Dock/Layout/LayoutAnchorable.cs @@ -71,10 +71,10 @@ public double AutoHideWidth set { if (value == _autohideWidth) return; - RaisePropertyChanging(nameof(AutoHideWidth)); + RaisePropertyChanging(nameof(this.AutoHideWidth)); value = Math.Max(value, _autohideMinWidth); _autohideWidth = value; - RaisePropertyChanged(nameof(AutoHideWidth)); + RaisePropertyChanged(nameof(this.AutoHideWidth)); } } @@ -85,10 +85,10 @@ public double AutoHideMinWidth set { if (value == _autohideMinWidth) return; - RaisePropertyChanging(nameof(AutoHideMinWidth)); + RaisePropertyChanging(nameof(this.AutoHideMinWidth)); if (value < 0) throw new ArgumentOutOfRangeException("Negative value is not allowed.", nameof(value)); _autohideMinWidth = value; - RaisePropertyChanged(nameof(AutoHideMinWidth)); + RaisePropertyChanged(nameof(this.AutoHideMinWidth)); } } @@ -99,10 +99,10 @@ public double AutoHideHeight set { if (value == _autohideHeight) return; - RaisePropertyChanging(nameof(AutoHideHeight)); + RaisePropertyChanging(nameof(this.AutoHideHeight)); value = Math.Max(value, _autohideMinHeight); _autohideHeight = value; - RaisePropertyChanged(nameof(AutoHideHeight)); + RaisePropertyChanged(nameof(this.AutoHideHeight)); } } @@ -113,11 +113,11 @@ public double AutoHideMinHeight set { if (value == _autohideMinHeight) return; - RaisePropertyChanging(nameof(AutoHideMinHeight)); + RaisePropertyChanging(nameof(this.AutoHideMinHeight)); if (value < 0) throw new ArgumentOutOfRangeException("Negative value is not allowed.", nameof(value)); _autohideMinHeight = value; - RaisePropertyChanged(nameof(AutoHideMinHeight)); + RaisePropertyChanged(nameof(this.AutoHideMinHeight)); } } @@ -129,7 +129,7 @@ public bool CanHide { if (value == _canHide) return; _canHide = value; - RaisePropertyChanged(nameof(CanHide)); + RaisePropertyChanged(nameof(this.CanHide)); } } @@ -141,7 +141,7 @@ public bool CanAutoHide { if (value == _canAutoHide) return; _canAutoHide = value; - RaisePropertyChanged(nameof(CanAutoHide)); + RaisePropertyChanged(nameof(this.CanAutoHide)); } } @@ -153,7 +153,7 @@ public bool CanDockAsTabbedDocument { if (_canDockAsTabbedDocument == value) return; _canDockAsTabbedDocument = value; - RaisePropertyChanged(nameof(CanDockAsTabbedDocument)); + RaisePropertyChanged(nameof(this.CanDockAsTabbedDocument)); } } @@ -167,22 +167,22 @@ public bool CanMove { if (value == _canMove) return; _canMove = value; - RaisePropertyChanged(nameof(CanMove)); + RaisePropertyChanged(nameof(this.CanMove)); } } /// Get a value indicating if the anchorable is anchored to an achor side in an AutoHide status or not. - public bool IsAutoHidden => Parent is LayoutAnchorGroup; + public bool IsAutoHidden => this.Parent is LayoutAnchorGroup; /// Gets whether this object is in a state where it is not visible in the UI or not. [XmlIgnore] - public bool IsHidden => Parent is LayoutRoot; + public bool IsHidden => this.Parent is LayoutRoot; /// Gets/sets whether this object is in a state where it is visible in the UI or not. [XmlIgnore] public bool IsVisible { - get => Parent != null && !(Parent is LayoutRoot); + get => this.Parent != null && !(this.Parent is LayoutRoot); set { if (value) Show(); else Hide(); } } @@ -194,17 +194,17 @@ public bool IsVisible protected override void OnParentChanged(ILayoutContainer oldValue, ILayoutContainer newValue) { UpdateParentVisibility(); - RaisePropertyChanged(nameof(IsVisible)); + RaisePropertyChanged(nameof(this.IsVisible)); NotifyIsVisibleChanged(); - RaisePropertyChanged(nameof(IsHidden)); - RaisePropertyChanged(nameof(IsAutoHidden)); + RaisePropertyChanged(nameof(this.IsHidden)); + RaisePropertyChanged(nameof(this.IsAutoHidden)); base.OnParentChanged(oldValue, newValue); } /// protected override void InternalDock() { - LayoutRoot root = Root as LayoutRoot; + LayoutRoot root = this.Root as LayoutRoot; LayoutAnchorablePane anchorablePane = null; //look for active content parent pane @@ -238,53 +238,53 @@ protected override void InternalDock() /// public override void ReadXml(System.Xml.XmlReader reader) { - if (reader.MoveToAttribute(nameof(CanHide))) - CanHide = bool.Parse(reader.Value); - if (reader.MoveToAttribute(nameof(CanAutoHide))) - CanAutoHide = bool.Parse(reader.Value); - if (reader.MoveToAttribute(nameof(AutoHideWidth))) - AutoHideWidth = double.Parse(reader.Value, CultureInfo.InvariantCulture); - if (reader.MoveToAttribute(nameof(AutoHideHeight))) - AutoHideHeight = double.Parse(reader.Value, CultureInfo.InvariantCulture); - if (reader.MoveToAttribute(nameof(AutoHideMinWidth))) - AutoHideMinWidth = double.Parse(reader.Value, CultureInfo.InvariantCulture); - if (reader.MoveToAttribute(nameof(AutoHideMinHeight))) - AutoHideMinHeight = double.Parse(reader.Value, CultureInfo.InvariantCulture); - if (reader.MoveToAttribute(nameof(CanDockAsTabbedDocument))) - CanDockAsTabbedDocument = bool.Parse(reader.Value); - if (reader.MoveToAttribute(nameof(CanMove))) - CanMove = bool.Parse(reader.Value); + if (reader.MoveToAttribute(nameof(this.CanHide))) + this.CanHide = bool.Parse(reader.Value); + if (reader.MoveToAttribute(nameof(this.CanAutoHide))) + this.CanAutoHide = bool.Parse(reader.Value); + if (reader.MoveToAttribute(nameof(this.AutoHideWidth))) + this.AutoHideWidth = double.Parse(reader.Value, CultureInfo.InvariantCulture); + if (reader.MoveToAttribute(nameof(this.AutoHideHeight))) + this.AutoHideHeight = double.Parse(reader.Value, CultureInfo.InvariantCulture); + if (reader.MoveToAttribute(nameof(this.AutoHideMinWidth))) + this.AutoHideMinWidth = double.Parse(reader.Value, CultureInfo.InvariantCulture); + if (reader.MoveToAttribute(nameof(this.AutoHideMinHeight))) + this.AutoHideMinHeight = double.Parse(reader.Value, CultureInfo.InvariantCulture); + if (reader.MoveToAttribute(nameof(this.CanDockAsTabbedDocument))) + this.CanDockAsTabbedDocument = bool.Parse(reader.Value); + if (reader.MoveToAttribute(nameof(this.CanMove))) + this.CanMove = bool.Parse(reader.Value); base.ReadXml(reader); } /// public override void WriteXml(System.Xml.XmlWriter writer) { - if (!CanHide) - writer.WriteAttributeString(nameof(CanHide), CanHide.ToString()); - if (!CanAutoHide) - writer.WriteAttributeString(nameof(CanAutoHide), CanAutoHide.ToString(CultureInfo.InvariantCulture)); - if (AutoHideWidth > 0) - writer.WriteAttributeString(nameof(AutoHideWidth), AutoHideWidth.ToString(CultureInfo.InvariantCulture)); - if (AutoHideHeight > 0) - writer.WriteAttributeString(nameof(AutoHideHeight), AutoHideHeight.ToString(CultureInfo.InvariantCulture)); - if (AutoHideMinWidth != 25.0) - writer.WriteAttributeString(nameof(AutoHideMinWidth), AutoHideMinWidth.ToString(CultureInfo.InvariantCulture)); - if (AutoHideMinHeight != 25.0) - writer.WriteAttributeString(nameof(AutoHideMinHeight), AutoHideMinHeight.ToString(CultureInfo.InvariantCulture)); - if (!CanDockAsTabbedDocument) - writer.WriteAttributeString(nameof(CanDockAsTabbedDocument), CanDockAsTabbedDocument.ToString(CultureInfo.InvariantCulture)); - if (!CanMove) - writer.WriteAttributeString(nameof(CanMove), CanMove.ToString()); + if (!this.CanHide) + writer.WriteAttributeString(nameof(this.CanHide), this.CanHide.ToString()); + if (!this.CanAutoHide) + writer.WriteAttributeString(nameof(this.CanAutoHide), this.CanAutoHide.ToString(CultureInfo.InvariantCulture)); + if (this.AutoHideWidth > 0) + writer.WriteAttributeString(nameof(this.AutoHideWidth), this.AutoHideWidth.ToString(CultureInfo.InvariantCulture)); + if (this.AutoHideHeight > 0) + writer.WriteAttributeString(nameof(this.AutoHideHeight), this.AutoHideHeight.ToString(CultureInfo.InvariantCulture)); + if (this.AutoHideMinWidth != 25.0) + writer.WriteAttributeString(nameof(this.AutoHideMinWidth), this.AutoHideMinWidth.ToString(CultureInfo.InvariantCulture)); + if (this.AutoHideMinHeight != 25.0) + writer.WriteAttributeString(nameof(this.AutoHideMinHeight), this.AutoHideMinHeight.ToString(CultureInfo.InvariantCulture)); + if (!this.CanDockAsTabbedDocument) + writer.WriteAttributeString(nameof(this.CanDockAsTabbedDocument), this.CanDockAsTabbedDocument.ToString(CultureInfo.InvariantCulture)); + if (!this.CanMove) + writer.WriteAttributeString(nameof(this.CanMove), this.CanMove.ToString()); base.WriteXml(writer); } /// public override void Close() { - if (Root?.Manager != null) + if (this.Root?.Manager != null) { - DockingManager dockingManager = Root.Manager; + DockingManager dockingManager = this.Root.Manager; dockingManager.ExecuteCloseCommand(this); } else @@ -309,7 +309,7 @@ public override void ConsoleDump(int tab) #region Public Methods public void Hide() { - if (Root?.Manager is DockingManager dockingManager) + if (this.Root?.Manager is DockingManager dockingManager) dockingManager.ExecuteHideCommand(this); else HideAnchorable(true); @@ -320,10 +320,10 @@ public void Hide() /// internal bool HideAnchorable(bool cancelable) { - if (!IsVisible) + if (!this.IsVisible) { - IsSelected = true; - IsActive = true; + this.IsSelected = true; + this.IsActive = true; return false; } @@ -334,17 +334,17 @@ internal bool HideAnchorable(bool cancelable) if (args.Cancel) return false; } - RaisePropertyChanging(nameof(IsHidden)); - RaisePropertyChanging(nameof(IsVisible)); - if (Parent is ILayoutGroup) + RaisePropertyChanging(nameof(this.IsHidden)); + RaisePropertyChanging(nameof(this.IsVisible)); + if (this.Parent is ILayoutGroup) { - ILayoutGroup parentAsGroup = Parent as ILayoutGroup; - PreviousContainer = parentAsGroup; - PreviousContainerIndex = parentAsGroup.IndexOfChild(this); + ILayoutGroup parentAsGroup = this.Parent as ILayoutGroup; + this.PreviousContainer = parentAsGroup; + this.PreviousContainerIndex = parentAsGroup.IndexOfChild(this); } - Root?.Hidden?.Add(this); - RaisePropertyChanged(nameof(IsVisible)); - RaisePropertyChanged(nameof(IsHidden)); + this.Root?.Hidden?.Add(this); + RaisePropertyChanged(nameof(this.IsVisible)); + RaisePropertyChanged(nameof(this.IsHidden)); NotifyIsVisibleChanged(); return true; @@ -354,33 +354,33 @@ internal bool HideAnchorable(bool cancelable) /// Try to show the content where it was previously hidden. public void Show() { - if (IsVisible) return; - if (!IsHidden) throw new InvalidOperationException(); - RaisePropertyChanging(nameof(IsHidden)); - RaisePropertyChanging(nameof(IsVisible)); + if (this.IsVisible) return; + if (!this.IsHidden) throw new InvalidOperationException(); + RaisePropertyChanging(nameof(this.IsHidden)); + RaisePropertyChanging(nameof(this.IsVisible)); bool added = false; - ILayoutRoot root = Root; + ILayoutRoot root = this.Root; if (root?.Manager?.LayoutUpdateStrategy != null) - added = root.Manager.LayoutUpdateStrategy.BeforeInsertAnchorable(root as LayoutRoot, this, PreviousContainer); + added = root.Manager.LayoutUpdateStrategy.BeforeInsertAnchorable(root as LayoutRoot, this, this.PreviousContainer); - if (!added && PreviousContainer != null) + if (!added && this.PreviousContainer != null) { - ILayoutGroup previousContainerAsLayoutGroup = PreviousContainer as ILayoutGroup; - if (PreviousContainerIndex < previousContainerAsLayoutGroup.ChildrenCount) - previousContainerAsLayoutGroup.InsertChildAt(PreviousContainerIndex, this); + ILayoutGroup previousContainerAsLayoutGroup = this.PreviousContainer as ILayoutGroup; + if (this.PreviousContainerIndex < previousContainerAsLayoutGroup.ChildrenCount) + previousContainerAsLayoutGroup.InsertChildAt(this.PreviousContainerIndex, this); else previousContainerAsLayoutGroup.InsertChildAt(previousContainerAsLayoutGroup.ChildrenCount, this); - Parent = previousContainerAsLayoutGroup; - IsSelected = true; - IsActive = true; + this.Parent = previousContainerAsLayoutGroup; + this.IsSelected = true; + this.IsActive = true; } root?.Manager?.LayoutUpdateStrategy?.AfterInsertAnchorable(root as LayoutRoot, this); - PreviousContainer = null; - PreviousContainerIndex = -1; - RaisePropertyChanged(nameof(IsVisible)); - RaisePropertyChanged(nameof(IsHidden)); + this.PreviousContainer = null; + this.PreviousContainerIndex = -1; + RaisePropertyChanged(nameof(this.IsVisible)); + RaisePropertyChanged(nameof(this.IsHidden)); NotifyIsVisibleChanged(); } @@ -389,7 +389,7 @@ public void Show() /// public void AddToLayout(DockingManager manager, AnchorableShowStrategy strategy) { - if (IsVisible || IsHidden) throw new InvalidOperationException(); + if (this.IsVisible || this.IsHidden) throw new InvalidOperationException(); bool most = (strategy & AnchorableShowStrategy.Most) == AnchorableShowStrategy.Most; bool left = (strategy & AnchorableShowStrategy.Left) == AnchorableShowStrategy.Left; @@ -446,9 +446,9 @@ public void ToggleAutoHide() { #region Anchorable is already auto hidden - if (IsAutoHidden) + if (this.IsAutoHidden) { - LayoutAnchorGroup parentGroup = Parent as LayoutAnchorGroup; + LayoutAnchorGroup parentGroup = this.Parent as LayoutAnchorGroup; LayoutAnchorSide parentSide = parentGroup.Parent as LayoutAnchorSide; LayoutAnchorablePane previousContainer = ((ILayoutPreviousContainer)parentGroup).PreviousContainer as LayoutAnchorablePane; @@ -462,8 +462,8 @@ public void ToggleAutoHide() { previousContainer = new LayoutAnchorablePane { - DockMinWidth = AutoHideMinWidth, - DockMinHeight = AutoHideMinHeight + DockMinWidth = this.AutoHideMinWidth, + DockMinHeight = this.AutoHideMinHeight }; parentGroup.Root.RootPanel.Children.Add(previousContainer); } @@ -471,8 +471,8 @@ public void ToggleAutoHide() { previousContainer = new LayoutAnchorablePane { - DockMinHeight = AutoHideMinHeight, - DockMinWidth = AutoHideMinWidth + DockMinHeight = this.AutoHideMinHeight, + DockMinWidth = this.AutoHideMinWidth }; LayoutPanel panel = new LayoutPanel { Orientation = Orientation.Horizontal }; LayoutRoot root = parentGroup.Root as LayoutRoot; @@ -488,8 +488,8 @@ public void ToggleAutoHide() { previousContainer = new LayoutAnchorablePane { - DockMinWidth = AutoHideMinWidth, - DockMinHeight = AutoHideMinHeight + DockMinWidth = this.AutoHideMinWidth, + DockMinHeight = this.AutoHideMinHeight }; parentGroup.Root.RootPanel.Children.Insert(0, previousContainer); } @@ -497,8 +497,8 @@ public void ToggleAutoHide() { previousContainer = new LayoutAnchorablePane { - DockMinHeight = AutoHideMinHeight, - DockMinWidth = AutoHideMinWidth + DockMinHeight = this.AutoHideMinHeight, + DockMinWidth = this.AutoHideMinWidth }; LayoutPanel panel = new LayoutPanel { Orientation = Orientation.Horizontal }; LayoutRoot root = parentGroup.Root as LayoutRoot; @@ -514,8 +514,8 @@ public void ToggleAutoHide() { previousContainer = new LayoutAnchorablePane { - DockMinHeight = AutoHideMinHeight, - DockMinWidth = AutoHideMinWidth + DockMinHeight = this.AutoHideMinHeight, + DockMinWidth = this.AutoHideMinWidth }; parentGroup.Root.RootPanel.Children.Insert(0, previousContainer); } @@ -523,8 +523,8 @@ public void ToggleAutoHide() { previousContainer = new LayoutAnchorablePane { - DockMinWidth = AutoHideMinWidth, - DockMinHeight = AutoHideMinHeight + DockMinWidth = this.AutoHideMinWidth, + DockMinHeight = this.AutoHideMinHeight }; LayoutPanel panel = new LayoutPanel { Orientation = Orientation.Vertical }; LayoutRoot root = parentGroup.Root as LayoutRoot; @@ -540,8 +540,8 @@ public void ToggleAutoHide() { previousContainer = new LayoutAnchorablePane { - DockMinHeight = AutoHideMinHeight, - DockMinWidth = AutoHideMinWidth + DockMinHeight = this.AutoHideMinHeight, + DockMinWidth = this.AutoHideMinWidth }; parentGroup.Root.RootPanel.Children.Add(previousContainer); } @@ -549,8 +549,8 @@ public void ToggleAutoHide() { previousContainer = new LayoutAnchorablePane { - DockMinWidth = AutoHideMinWidth, - DockMinHeight = AutoHideMinHeight + DockMinWidth = this.AutoHideMinWidth, + DockMinHeight = this.AutoHideMinHeight }; LayoutPanel panel = new LayoutPanel { Orientation = Orientation.Vertical }; LayoutRoot root = parentGroup.Root as LayoutRoot; @@ -597,10 +597,10 @@ public void ToggleAutoHide() #region Anchorable is docked - else if (Parent is LayoutAnchorablePane) + else if (this.Parent is LayoutAnchorablePane) { - ILayoutRoot root = Root; - LayoutAnchorablePane parentPane = Parent as LayoutAnchorablePane; + ILayoutRoot root = this.Root; + LayoutAnchorablePane parentPane = this.Parent as LayoutAnchorablePane; LayoutAnchorGroup newAnchorGroup = new LayoutAnchorGroup(); ((ILayoutPreviousContainer)newAnchorGroup).PreviousContainer = parentPane; @@ -629,7 +629,7 @@ public void ToggleAutoHide() internal bool CloseAnchorable() { if (!TestCanClose()) return false; - if (IsAutoHidden) ToggleAutoHide(); + if (this.IsAutoHidden) ToggleAutoHide(); CloseInternal(); return true; } @@ -655,14 +655,14 @@ internal bool CloseAnchorable() private void UpdateParentVisibility() { // Element is Hidden since it has no parent but a previous parent - if (PreviousContainer != null && Parent == null) + if (this.PreviousContainer != null && this.Parent == null) { // Go back to using previous parent - Parent = PreviousContainer; + this.Parent = this.PreviousContainer; //// PreviousContainer = null; } - if (Parent is ILayoutElementWithVisibility parentPane) + if (this.Parent is ILayoutElementWithVisibility parentPane) parentPane.ComputeVisibility(); } diff --git a/Source/Controls/H.Controls.Dock/Layout/LayoutAnchorableFloatingWindow.cs b/Source/Controls/H.Controls.Dock/Layout/LayoutAnchorableFloatingWindow.cs index 95b05520..07e7e174 100644 --- a/Source/Controls/H.Controls.Dock/Layout/LayoutAnchorableFloatingWindow.cs +++ b/Source/Controls/H.Controls.Dock/Layout/LayoutAnchorableFloatingWindow.cs @@ -40,7 +40,7 @@ public class LayoutAnchorableFloatingWindow : LayoutFloatingWindow, ILayoutEleme #region Properties - public bool IsSinglePane => RootPanel != null && RootPanel.Descendents().OfType().Count(p => p.IsVisible) == 1; + public bool IsSinglePane => this.RootPanel != null && this.RootPanel.Descendents().OfType().Count(p => p.IsVisible) == 1; /// Gets/sets whether this object is in a state where it is visible in the UI or not. [XmlIgnore] @@ -50,9 +50,9 @@ public bool IsVisible private set { if (value == _isVisible) return; - RaisePropertyChanging(nameof(IsVisible)); + RaisePropertyChanging(nameof(this.IsVisible)); _isVisible = value; - RaisePropertyChanged(nameof(IsVisible)); + RaisePropertyChanged(nameof(this.IsVisible)); IsVisibleChanged?.Invoke(this, EventArgs.Empty); } } @@ -63,7 +63,7 @@ public LayoutAnchorablePaneGroup RootPanel set { if (value == _rootPanel) return; - RaisePropertyChanging(nameof(RootPanel)); + RaisePropertyChanging(nameof(this.RootPanel)); if (_rootPanel != null) _rootPanel.ChildrenTreeChanged -= _rootPanel_ChildrenTreeChanged; _rootPanel = value; if (_rootPanel != null) @@ -72,11 +72,11 @@ public LayoutAnchorablePaneGroup RootPanel _rootPanel.ChildrenTreeChanged += _rootPanel_ChildrenTreeChanged; } - RaisePropertyChanged(nameof(RootPanel)); - RaisePropertyChanged(nameof(IsSinglePane)); - RaisePropertyChanged(nameof(SinglePane)); - RaisePropertyChanged(nameof(Children)); - RaisePropertyChanged(nameof(ChildrenCount)); + RaisePropertyChanged(nameof(this.RootPanel)); + RaisePropertyChanged(nameof(this.IsSinglePane)); + RaisePropertyChanged(nameof(this.SinglePane)); + RaisePropertyChanged(nameof(this.Children)); + RaisePropertyChanged(nameof(this.ChildrenCount)); ((ILayoutElementWithVisibility)this).ComputeVisibility(); } } @@ -85,8 +85,8 @@ public ILayoutAnchorablePane SinglePane { get { - if (!IsSinglePane) return null; - LayoutAnchorablePane singlePane = RootPanel.Descendents().OfType().Single(p => p.IsVisible); + if (!this.IsSinglePane) return null; + LayoutAnchorablePane singlePane = this.RootPanel.Descendents().OfType().Single(p => p.IsVisible); singlePane.UpdateIsDirectlyHostedInFloatingWindow(); return singlePane; } @@ -106,28 +106,28 @@ public ILayoutAnchorablePane SinglePane /// public override IEnumerable Children { - get { if (ChildrenCount == 1) yield return RootPanel; } + get { if (this.ChildrenCount == 1) yield return this.RootPanel; } } /// public override void RemoveChild(ILayoutElement element) { - Debug.Assert(element == RootPanel && element != null); - RootPanel = null; + Debug.Assert(element == this.RootPanel && element != null); + this.RootPanel = null; } /// public override void ReplaceChild(ILayoutElement oldElement, ILayoutElement newElement) { - Debug.Assert(oldElement == RootPanel && oldElement != null); - RootPanel = newElement as LayoutAnchorablePaneGroup; + Debug.Assert(oldElement == this.RootPanel && oldElement != null); + this.RootPanel = newElement as LayoutAnchorablePaneGroup; } /// - public override int ChildrenCount => RootPanel == null ? 0 : 1; + public override int ChildrenCount => this.RootPanel == null ? 0 : 1; /// - public override bool IsValid => RootPanel != null; + public override bool IsValid => this.RootPanel != null; /// public override void ReadXml(XmlReader reader) @@ -163,7 +163,7 @@ public override void ReadXml(XmlReader reader) throw new ArgumentException("H.Controls.Dock.LayoutAnchorableFloatingWindow doesn't know how to deserialize " + reader.LocalName); serializer = XmlSerializersCache.GetSerializer(type); } - RootPanel = (LayoutAnchorablePaneGroup)serializer.Deserialize(reader); + this.RootPanel = (LayoutAnchorablePaneGroup)serializer.Deserialize(reader); } reader.ReadEndElement(); } @@ -175,7 +175,7 @@ public override void ConsoleDump(int tab) System.Diagnostics.Trace.Write(new string(' ', tab * 4)); System.Diagnostics.Trace.WriteLine("FloatingAnchorableWindow()"); - RootPanel.ConsoleDump(tab + 1); + this.RootPanel.ConsoleDump(tab + 1); } #endif @@ -185,11 +185,11 @@ public override void ConsoleDump(int tab) private void _rootPanel_ChildrenTreeChanged(object sender, ChildrenTreeChangedEventArgs e) { - RaisePropertyChanged(nameof(IsSinglePane)); - RaisePropertyChanged(nameof(SinglePane)); + RaisePropertyChanged(nameof(this.IsSinglePane)); + RaisePropertyChanged(nameof(this.SinglePane)); } - private void ComputeVisibility() => IsVisible = RootPanel != null && RootPanel.IsVisible; + private void ComputeVisibility() => this.IsVisible = this.RootPanel != null && this.RootPanel.IsVisible; #endregion Private Methods } diff --git a/Source/Controls/H.Controls.Dock/Layout/LayoutAnchorablePane.cs b/Source/Controls/H.Controls.Dock/Layout/LayoutAnchorablePane.cs index 0d59b9d8..4301fd18 100644 --- a/Source/Controls/H.Controls.Dock/Layout/LayoutAnchorablePane.cs +++ b/Source/Controls/H.Controls.Dock/Layout/LayoutAnchorablePane.cs @@ -43,7 +43,7 @@ public LayoutAnchorablePane() /// Class constructor from which will be added into its children collection. public LayoutAnchorablePane(LayoutAnchorable anchorable) { - Children.Add(anchorable); + this.Children.Add(anchorable); } #endregion Constructors @@ -51,10 +51,10 @@ public LayoutAnchorablePane(LayoutAnchorable anchorable) #region Properties /// Gets whether the pane can be hidden. - public bool CanHide => Children.All(a => a.CanHide); + public bool CanHide => this.Children.All(a => a.CanHide); /// Gets whether the pane can be closed. - public bool CanClose => Children.All(a => a.CanClose); + public bool CanClose => this.Children.All(a => a.CanClose); /// Gets whether the pane is hosted in a floating window. public bool IsHostedInFloatingWindow => this.FindParent() != null; @@ -67,7 +67,7 @@ public string Name { if (value == _name) return; _name = value; - RaisePropertyChanged(nameof(Name)); + RaisePropertyChanged(nameof(this.Name)); } } @@ -77,22 +77,22 @@ public int SelectedContentIndex get => _selectedIndex; set { - if (value < 0 || value >= Children.Count) value = -1; + if (value < 0 || value >= this.Children.Count) value = -1; if (value == _selectedIndex) return; - RaisePropertyChanging(nameof(SelectedContentIndex)); - RaisePropertyChanging(nameof(SelectedContent)); - if (_selectedIndex >= 0 && _selectedIndex < Children.Count) - Children[_selectedIndex].IsSelected = false; + RaisePropertyChanging(nameof(this.SelectedContentIndex)); + RaisePropertyChanging(nameof(this.SelectedContent)); + if (_selectedIndex >= 0 && _selectedIndex < this.Children.Count) + this.Children[_selectedIndex].IsSelected = false; _selectedIndex = value; - if (_selectedIndex >= 0 && _selectedIndex < Children.Count) - Children[_selectedIndex].IsSelected = true; - RaisePropertyChanged(nameof(SelectedContentIndex)); - RaisePropertyChanged(nameof(SelectedContent)); + if (_selectedIndex >= 0 && _selectedIndex < this.Children.Count) + this.Children[_selectedIndex].IsSelected = true; + RaisePropertyChanged(nameof(this.SelectedContentIndex)); + RaisePropertyChanged(nameof(this.SelectedContent)); } } /// Gets the selected content in the pane or null. - public LayoutContent SelectedContent => _selectedIndex == -1 ? null : Children[_selectedIndex]; + public LayoutContent SelectedContent => _selectedIndex == -1 ? null : this.Children[_selectedIndex]; /// Gets/sets the unique id that is used for the serialization of this panel. string ILayoutPaneSerializable.Id @@ -106,16 +106,16 @@ string ILayoutPaneSerializable.Id #region Overrides /// - protected override bool GetVisibility() => Children.Count > 0 && Children.Any(c => c.IsVisible); + protected override bool GetVisibility() => this.Children.Count > 0 && this.Children.Any(c => c.IsVisible); /// protected override void ChildMoved(int oldIndex, int newIndex) { if (_selectedIndex == oldIndex) { - RaisePropertyChanging(nameof(SelectedContentIndex)); + RaisePropertyChanging(nameof(this.SelectedContentIndex)); _selectedIndex = newIndex; - RaisePropertyChanged(nameof(SelectedContentIndex)); + RaisePropertyChanged(nameof(this.SelectedContentIndex)); } base.ChildMoved(oldIndex, newIndex); } @@ -124,15 +124,15 @@ protected override void ChildMoved(int oldIndex, int newIndex) protected override void OnChildrenCollectionChanged() { AutoFixSelectedContent(); - for (int i = 0; i < Children.Count; i++) + for (int i = 0; i < this.Children.Count; i++) { - if (!Children[i].IsSelected) continue; - SelectedContentIndex = i; + if (!this.Children[i].IsSelected) continue; + this.SelectedContentIndex = i; break; } - RaisePropertyChanged(nameof(CanClose)); - RaisePropertyChanged(nameof(CanHide)); - RaisePropertyChanged(nameof(IsDirectlyHostedInFloatingWindow)); + RaisePropertyChanged(nameof(this.CanClose)); + RaisePropertyChanged(nameof(this.CanHide)); + RaisePropertyChanged(nameof(this.IsDirectlyHostedInFloatingWindow)); base.OnChildrenCollectionChanged(); } @@ -140,7 +140,7 @@ protected override void OnChildrenCollectionChanged() protected override void OnParentChanged(ILayoutContainer oldValue, ILayoutContainer newValue) { if (oldValue is ILayoutGroup oldGroup) oldGroup.ChildrenCollectionChanged -= OnParentChildrenCollectionChanged; - RaisePropertyChanged(nameof(IsDirectlyHostedInFloatingWindow)); + RaisePropertyChanged(nameof(this.IsDirectlyHostedInFloatingWindow)); if (newValue is ILayoutGroup newGroup) newGroup.ChildrenCollectionChanged += OnParentChildrenCollectionChanged; base.OnParentChanged(oldValue, newValue); } @@ -149,7 +149,7 @@ protected override void OnParentChanged(ILayoutContainer oldValue, ILayoutContai public override void WriteXml(System.Xml.XmlWriter writer) { if (_id != null) writer.WriteAttributeString(nameof(ILayoutPaneSerializable.Id), _id); - if (_name != null) writer.WriteAttributeString(nameof(Name), _name); + if (_name != null) writer.WriteAttributeString(nameof(this.Name), _name); base.WriteXml(writer); } @@ -157,7 +157,7 @@ public override void WriteXml(System.Xml.XmlWriter writer) public override void ReadXml(System.Xml.XmlReader reader) { if (reader.MoveToAttribute(nameof(ILayoutPaneSerializable.Id))) _id = reader.Value; - if (reader.MoveToAttribute(nameof(Name))) _name = reader.Value; + if (reader.MoveToAttribute(nameof(this.Name))) _name = reader.Value; _autoFixSelectedContent = false; base.ReadXml(reader); _autoFixSelectedContent = true; @@ -171,7 +171,7 @@ public override void ConsoleDump(int tab) System.Diagnostics.Trace.Write(new string(' ', tab * 4)); System.Diagnostics.Trace.WriteLine("AnchorablePane()"); - foreach (LayoutElement child in Children) + foreach (LayoutElement child in this.Children) child.ConsoleDump(tab + 1); } #endif @@ -188,7 +188,7 @@ public override void ConsoleDump(int tab) public int IndexOf(LayoutContent content) { if (!(content is LayoutAnchorable anchorableChild)) return -1; - return Children.IndexOf(anchorableChild); + return this.Children.IndexOf(anchorableChild); } /// @@ -213,11 +213,11 @@ public bool IsDirectlyHostedInFloatingWindow /// Invalidates the current and sets the index for the next avialable child with IsEnabled == true. internal void SetNextSelectedIndex() { - SelectedContentIndex = -1; - for (int i = 0; i < Children.Count; ++i) + this.SelectedContentIndex = -1; + for (int i = 0; i < this.Children.Count; ++i) { - if (!Children[i].IsEnabled) continue; - SelectedContentIndex = i; + if (!this.Children[i].IsEnabled) continue; + this.SelectedContentIndex = i; return; } } @@ -225,7 +225,7 @@ internal void SetNextSelectedIndex() /// /// Updates whether this object is hosted at the root level of a floating window control or not. /// - internal void UpdateIsDirectlyHostedInFloatingWindow() => RaisePropertyChanged(nameof(IsDirectlyHostedInFloatingWindow)); + internal void UpdateIsDirectlyHostedInFloatingWindow() => RaisePropertyChanged(nameof(this.IsDirectlyHostedInFloatingWindow)); #endregion Internal Methods @@ -234,18 +234,18 @@ internal void SetNextSelectedIndex() private void AutoFixSelectedContent() { if (!_autoFixSelectedContent) return; - if (SelectedContentIndex >= ChildrenCount) SelectedContentIndex = Children.Count - 1; - if (SelectedContentIndex == -1 && ChildrenCount > 0) SetLastActivatedIndex(); + if (this.SelectedContentIndex >= this.ChildrenCount) this.SelectedContentIndex = this.Children.Count - 1; + if (this.SelectedContentIndex == -1 && this.ChildrenCount > 0) SetLastActivatedIndex(); } /// Sets the current to the last activated child with IsEnabled == true private void SetLastActivatedIndex() { - LayoutAnchorable lastActivatedDocument = Children.Where(c => c.IsEnabled).OrderByDescending(c => c.LastActivationTimeStamp.GetValueOrDefault()).FirstOrDefault(); - SelectedContentIndex = Children.IndexOf(lastActivatedDocument); + LayoutAnchorable lastActivatedDocument = this.Children.Where(c => c.IsEnabled).OrderByDescending(c => c.LastActivationTimeStamp.GetValueOrDefault()).FirstOrDefault(); + this.SelectedContentIndex = this.Children.IndexOf(lastActivatedDocument); } - private void OnParentChildrenCollectionChanged(object sender, EventArgs e) => RaisePropertyChanged(nameof(IsDirectlyHostedInFloatingWindow)); + private void OnParentChildrenCollectionChanged(object sender, EventArgs e) => RaisePropertyChanged(nameof(this.IsDirectlyHostedInFloatingWindow)); #endregion Private Methods } diff --git a/Source/Controls/H.Controls.Dock/Layout/LayoutAnchorablePaneGroup.cs b/Source/Controls/H.Controls.Dock/Layout/LayoutAnchorablePaneGroup.cs index 5042545b..0303da57 100644 --- a/Source/Controls/H.Controls.Dock/Layout/LayoutAnchorablePaneGroup.cs +++ b/Source/Controls/H.Controls.Dock/Layout/LayoutAnchorablePaneGroup.cs @@ -39,7 +39,7 @@ public LayoutAnchorablePaneGroup() /// Class constructor to be inserted into collection of children models. public LayoutAnchorablePaneGroup(LayoutAnchorablePane firstChild) { - Children.Add(firstChild); + this.Children.Add(firstChild); } #endregion Constructors @@ -55,9 +55,9 @@ public Orientation Orientation set { if (value == _orientation) return; - RaisePropertyChanging(nameof(Orientation)); + RaisePropertyChanging(nameof(this.Orientation)); _orientation = value; - RaisePropertyChanged(nameof(Orientation)); + RaisePropertyChanged(nameof(this.Orientation)); } } @@ -66,7 +66,7 @@ public Orientation Orientation #region Overrides /// - protected override bool GetVisibility() => Children.Count > 0 && Children.Any(c => c.IsVisible); + protected override bool GetVisibility() => this.Children.Count > 0 && this.Children.Any(c => c.IsVisible); /// protected override void OnIsVisibleChanged() @@ -78,41 +78,41 @@ protected override void OnIsVisibleChanged() /// protected override void OnDockWidthChanged() { - if (DockWidth.IsAbsolute && ChildrenCount == 1) - ((ILayoutPositionableElement)Children[0]).DockWidth = DockWidth; + if (this.DockWidth.IsAbsolute && this.ChildrenCount == 1) + ((ILayoutPositionableElement)this.Children[0]).DockWidth = this.DockWidth; base.OnDockWidthChanged(); } /// protected override void OnDockHeightChanged() { - if (DockHeight.IsAbsolute && ChildrenCount == 1) - ((ILayoutPositionableElement)Children[0]).DockHeight = DockHeight; + if (this.DockHeight.IsAbsolute && this.ChildrenCount == 1) + ((ILayoutPositionableElement)this.Children[0]).DockHeight = this.DockHeight; base.OnDockHeightChanged(); } /// protected override void OnChildrenCollectionChanged() { - if (DockWidth.IsAbsolute && ChildrenCount == 1) - ((ILayoutPositionableElement)Children[0]).DockWidth = DockWidth; - if (DockHeight.IsAbsolute && ChildrenCount == 1) - ((ILayoutPositionableElement)Children[0]).DockHeight = DockHeight; + if (this.DockWidth.IsAbsolute && this.ChildrenCount == 1) + ((ILayoutPositionableElement)this.Children[0]).DockWidth = this.DockWidth; + if (this.DockHeight.IsAbsolute && this.ChildrenCount == 1) + ((ILayoutPositionableElement)this.Children[0]).DockHeight = this.DockHeight; base.OnChildrenCollectionChanged(); } /// public override void WriteXml(System.Xml.XmlWriter writer) { - writer.WriteAttributeString(nameof(Orientation), Orientation.ToString()); + writer.WriteAttributeString(nameof(this.Orientation), this.Orientation.ToString()); base.WriteXml(writer); } /// public override void ReadXml(System.Xml.XmlReader reader) { - if (reader.MoveToAttribute(nameof(Orientation))) - Orientation = (Orientation)Enum.Parse(typeof(Orientation), reader.Value, true); + if (reader.MoveToAttribute(nameof(this.Orientation))) + this.Orientation = (Orientation)Enum.Parse(typeof(Orientation), reader.Value, true); base.ReadXml(reader); } @@ -121,9 +121,9 @@ public override void ReadXml(System.Xml.XmlReader reader) public override void ConsoleDump(int tab) { System.Diagnostics.Trace.Write(new string(' ', tab * 4)); - System.Diagnostics.Trace.WriteLine(string.Format("AnchorablePaneGroup({0})", Orientation)); + System.Diagnostics.Trace.WriteLine(string.Format("AnchorablePaneGroup({0})", this.Orientation)); - foreach (LayoutElement child in Children) + foreach (LayoutElement child in this.Children) child.ConsoleDump(tab + 1); } #endif @@ -134,7 +134,7 @@ public override void ConsoleDump(int tab) private void UpdateParentVisibility() { - if (Parent is ILayoutElementWithVisibility parentPane) parentPane.ComputeVisibility(); + if (this.Parent is ILayoutElementWithVisibility parentPane) parentPane.ComputeVisibility(); } #endregion Private Methods diff --git a/Source/Controls/H.Controls.Dock/Layout/LayoutContent.cs b/Source/Controls/H.Controls.Dock/Layout/LayoutContent.cs index 22922c09..90d750dd 100644 --- a/Source/Controls/H.Controls.Dock/Layout/LayoutContent.cs +++ b/Source/Controls/H.Controls.Dock/Layout/LayoutContent.cs @@ -94,10 +94,10 @@ public object Content set { if (value == _content) return; - RaisePropertyChanging(nameof(Content)); + RaisePropertyChanging(nameof(this.Content)); _content = value; - RaisePropertyChanged(nameof(Content)); - if (ContentId == null) SetContentIdFromContent(); + RaisePropertyChanged(nameof(this.Content)); + if (this.ContentId == null) SetContentIdFromContent(); } } @@ -127,7 +127,7 @@ private static void OnContentIdPropertyChanged(DependencyObject obj, DependencyP private void OnContentIdPropertyChanged(string oldValue, string newValue) { - if (oldValue != newValue) RaisePropertyChanged(nameof(ContentId)); + if (oldValue != newValue) RaisePropertyChanged(nameof(this.ContentId)); } private void SetContentIdFromContent() @@ -149,11 +149,11 @@ public bool IsSelected { if (value == _isSelected) return; bool oldValue = _isSelected; - RaisePropertyChanging(nameof(IsSelected)); + RaisePropertyChanging(nameof(this.IsSelected)); _isSelected = value; - if (Parent is ILayoutContentSelector parentSelector) parentSelector.SelectedContentIndex = _isSelected ? parentSelector.IndexOf(this) : -1; + if (this.Parent is ILayoutContentSelector parentSelector) parentSelector.SelectedContentIndex = _isSelected ? parentSelector.IndexOf(this) : -1; OnIsSelectedChanged(oldValue, value); - RaisePropertyChanged(nameof(IsSelected)); + RaisePropertyChanged(nameof(this.IsSelected)); LayoutAnchorableTabItem.CancelMouseLeave(); } } @@ -179,18 +179,18 @@ public bool IsActive set { if (value == _isActive) return; - RaisePropertyChanging(nameof(IsActive)); + RaisePropertyChanging(nameof(this.IsActive)); bool oldValue = _isActive; _isActive = value; - ILayoutRoot root = Root; + ILayoutRoot root = this.Root; if (root != null) { - if (root.ActiveContent != this && value) Root.ActiveContent = this; + if (root.ActiveContent != this && value) this.Root.ActiveContent = this; if (_isActive && root.ActiveContent != this) root.ActiveContent = this; } - if (_isActive) IsSelected = true; + if (_isActive) this.IsSelected = true; OnIsActiveChanged(oldValue, value); - RaisePropertyChanged(nameof(IsActive)); + RaisePropertyChanged(nameof(this.IsActive)); } } @@ -199,7 +199,7 @@ public bool IsActive /// protected virtual void OnIsActiveChanged(bool oldValue, bool newValue) { - if (newValue) LastActivationTimeStamp = DateTime.Now; + if (newValue) this.LastActivationTimeStamp = DateTime.Now; IsActiveChanged?.Invoke(this, EventArgs.Empty); } @@ -217,9 +217,9 @@ public bool IsLastFocusedDocument internal set { if (value == _isLastFocusedDocument) return; - RaisePropertyChanging(nameof(IsLastFocusedDocument)); + RaisePropertyChanging(nameof(this.IsLastFocusedDocument)); _isLastFocusedDocument = value; - RaisePropertyChanged(nameof(IsLastFocusedDocument)); + RaisePropertyChanged(nameof(this.IsLastFocusedDocument)); } } @@ -238,7 +238,7 @@ ILayoutContainer ILayoutPreviousContainer.PreviousContainer { if (value == _previousContainer) return; _previousContainer = value; - RaisePropertyChanged(nameof(PreviousContainer)); + RaisePropertyChanged(nameof(this.PreviousContainer)); if (_previousContainer is ILayoutPaneSerializable paneSerializable && paneSerializable.Id == null) paneSerializable.Id = Guid.NewGuid().ToString(); } @@ -274,7 +274,7 @@ public int PreviousContainerIndex { if (value == _previousContainerIndex) return; _previousContainerIndex = value; - RaisePropertyChanged(nameof(PreviousContainerIndex)); + RaisePropertyChanged(nameof(this.PreviousContainerIndex)); } } @@ -291,7 +291,7 @@ public DateTime? LastActivationTimeStamp { if (value == _lastActivationTimeStamp) return; _lastActivationTimeStamp = value; - RaisePropertyChanged(nameof(LastActivationTimeStamp)); + RaisePropertyChanged(nameof(this.LastActivationTimeStamp)); } } @@ -307,9 +307,9 @@ public double FloatingWidth set { if (value == _floatingWidth) return; - RaisePropertyChanging(nameof(FloatingWidth)); + RaisePropertyChanging(nameof(this.FloatingWidth)); _floatingWidth = value; - RaisePropertyChanged(nameof(FloatingWidth)); + RaisePropertyChanged(nameof(this.FloatingWidth)); } } @@ -325,9 +325,9 @@ public double FloatingHeight set { if (value == _floatingHeight) return; - RaisePropertyChanging(nameof(FloatingHeight)); + RaisePropertyChanging(nameof(this.FloatingHeight)); _floatingHeight = value; - RaisePropertyChanged(nameof(FloatingHeight)); + RaisePropertyChanged(nameof(this.FloatingHeight)); } } @@ -343,9 +343,9 @@ public double FloatingLeft set { if (value == _floatingLeft) return; - RaisePropertyChanging(nameof(FloatingLeft)); + RaisePropertyChanging(nameof(this.FloatingLeft)); _floatingLeft = value; - RaisePropertyChanged(nameof(FloatingLeft)); + RaisePropertyChanged(nameof(this.FloatingLeft)); } } @@ -361,9 +361,9 @@ public double FloatingTop set { if (value == _floatingTop) return; - RaisePropertyChanging(nameof(FloatingTop)); + RaisePropertyChanging(nameof(this.FloatingTop)); _floatingTop = value; - RaisePropertyChanged(nameof(FloatingTop)); + RaisePropertyChanged(nameof(this.FloatingTop)); } } @@ -379,9 +379,9 @@ public bool IsMaximized set { if (value == _isMaximized) return; - RaisePropertyChanging(nameof(IsMaximized)); + RaisePropertyChanging(nameof(this.IsMaximized)); _isMaximized = value; - RaisePropertyChanged(nameof(IsMaximized)); + RaisePropertyChanged(nameof(this.IsMaximized)); } } @@ -398,7 +398,7 @@ public object ToolTip { if (value == _toolTip) return; _toolTip = value; - RaisePropertyChanged(nameof(ToolTip)); + RaisePropertyChanged(nameof(this.ToolTip)); } } @@ -419,7 +419,7 @@ public ImageSource IconSource { if (value == _iconSource) return; _iconSource = value; - RaisePropertyChanged(nameof(IconSource)); + RaisePropertyChanged(nameof(this.IconSource)); } } @@ -439,7 +439,7 @@ public bool CanClose { if (_canClose == value) return; _canClose = value; - RaisePropertyChanged(nameof(CanClose)); + RaisePropertyChanged(nameof(this.CanClose)); } } @@ -456,7 +456,7 @@ public bool CanFloat { if (value == _canFloat) return; _canFloat = value; - RaisePropertyChanged(nameof(CanFloat)); + RaisePropertyChanged(nameof(this.CanFloat)); } } @@ -480,7 +480,7 @@ public bool CanShowOnHover { if (value == _canShowOnHover) return; _canShowOnHover = value; - RaisePropertyChanged(nameof(CanShowOnHover)); + RaisePropertyChanged(nameof(this.CanShowOnHover)); } } @@ -497,7 +497,7 @@ public bool IsEnabled { if (value == _isEnabled) return; _isEnabled = value; - RaisePropertyChanged(nameof(IsEnabled)); + RaisePropertyChanged(nameof(this.IsEnabled)); } } @@ -523,40 +523,40 @@ public bool IsEnabled /// public virtual void ReadXml(System.Xml.XmlReader reader) { - if (reader.MoveToAttribute(nameof(Title))) - Title = reader.Value; + if (reader.MoveToAttribute(nameof(this.Title))) + this.Title = reader.Value; //if (reader.MoveToAttribute("IconSource")) // IconSource = new Uri(reader.Value, UriKind.RelativeOrAbsolute); - if (reader.MoveToAttribute(nameof(IsSelected))) - IsSelected = bool.Parse(reader.Value); - if (reader.MoveToAttribute(nameof(ContentId))) - ContentId = reader.Value; - if (reader.MoveToAttribute(nameof(IsLastFocusedDocument))) - IsLastFocusedDocument = bool.Parse(reader.Value); - if (reader.MoveToAttribute(nameof(PreviousContainerId))) - PreviousContainerId = reader.Value; - if (reader.MoveToAttribute(nameof(PreviousContainerIndex))) - PreviousContainerIndex = int.Parse(reader.Value); - - if (reader.MoveToAttribute(nameof(FloatingLeft))) - FloatingLeft = double.Parse(reader.Value, CultureInfo.InvariantCulture); - if (reader.MoveToAttribute(nameof(FloatingTop))) - FloatingTop = double.Parse(reader.Value, CultureInfo.InvariantCulture); - if (reader.MoveToAttribute(nameof(FloatingWidth))) - FloatingWidth = double.Parse(reader.Value, CultureInfo.InvariantCulture); - if (reader.MoveToAttribute(nameof(FloatingHeight))) - FloatingHeight = double.Parse(reader.Value, CultureInfo.InvariantCulture); - if (reader.MoveToAttribute(nameof(IsMaximized))) - IsMaximized = bool.Parse(reader.Value); - if (reader.MoveToAttribute(nameof(CanClose))) - CanClose = bool.Parse(reader.Value); - if (reader.MoveToAttribute(nameof(CanFloat))) - CanFloat = bool.Parse(reader.Value); - if (reader.MoveToAttribute(nameof(LastActivationTimeStamp))) - LastActivationTimeStamp = DateTime.Parse(reader.Value, CultureInfo.InvariantCulture); - if (reader.MoveToAttribute(nameof(CanShowOnHover))) - CanShowOnHover = bool.Parse(reader.Value); + if (reader.MoveToAttribute(nameof(this.IsSelected))) + this.IsSelected = bool.Parse(reader.Value); + if (reader.MoveToAttribute(nameof(this.ContentId))) + this.ContentId = reader.Value; + if (reader.MoveToAttribute(nameof(this.IsLastFocusedDocument))) + this.IsLastFocusedDocument = bool.Parse(reader.Value); + if (reader.MoveToAttribute(nameof(this.PreviousContainerId))) + this.PreviousContainerId = reader.Value; + if (reader.MoveToAttribute(nameof(this.PreviousContainerIndex))) + this.PreviousContainerIndex = int.Parse(reader.Value); + + if (reader.MoveToAttribute(nameof(this.FloatingLeft))) + this.FloatingLeft = double.Parse(reader.Value, CultureInfo.InvariantCulture); + if (reader.MoveToAttribute(nameof(this.FloatingTop))) + this.FloatingTop = double.Parse(reader.Value, CultureInfo.InvariantCulture); + if (reader.MoveToAttribute(nameof(this.FloatingWidth))) + this.FloatingWidth = double.Parse(reader.Value, CultureInfo.InvariantCulture); + if (reader.MoveToAttribute(nameof(this.FloatingHeight))) + this.FloatingHeight = double.Parse(reader.Value, CultureInfo.InvariantCulture); + if (reader.MoveToAttribute(nameof(this.IsMaximized))) + this.IsMaximized = bool.Parse(reader.Value); + if (reader.MoveToAttribute(nameof(this.CanClose))) + this.CanClose = bool.Parse(reader.Value); + if (reader.MoveToAttribute(nameof(this.CanFloat))) + this.CanFloat = bool.Parse(reader.Value); + if (reader.MoveToAttribute(nameof(this.LastActivationTimeStamp))) + this.LastActivationTimeStamp = DateTime.Parse(reader.Value, CultureInfo.InvariantCulture); + if (reader.MoveToAttribute(nameof(this.CanShowOnHover))) + this.CanShowOnHover = bool.Parse(reader.Value); reader.Read(); } @@ -564,39 +564,39 @@ public virtual void ReadXml(System.Xml.XmlReader reader) /// public virtual void WriteXml(System.Xml.XmlWriter writer) { - if (!string.IsNullOrWhiteSpace(Title)) - writer.WriteAttributeString(nameof(Title), Title); + if (!string.IsNullOrWhiteSpace(this.Title)) + writer.WriteAttributeString(nameof(this.Title), this.Title); //if (IconSource != null) // writer.WriteAttributeString("IconSource", IconSource.ToString()); - if (IsSelected) - writer.WriteAttributeString(nameof(IsSelected), IsSelected.ToString()); + if (this.IsSelected) + writer.WriteAttributeString(nameof(this.IsSelected), this.IsSelected.ToString()); - if (IsLastFocusedDocument) - writer.WriteAttributeString(nameof(IsLastFocusedDocument), IsLastFocusedDocument.ToString()); + if (this.IsLastFocusedDocument) + writer.WriteAttributeString(nameof(this.IsLastFocusedDocument), this.IsLastFocusedDocument.ToString()); - if (!string.IsNullOrWhiteSpace(ContentId)) - writer.WriteAttributeString(nameof(ContentId), ContentId); + if (!string.IsNullOrWhiteSpace(this.ContentId)) + writer.WriteAttributeString(nameof(this.ContentId), this.ContentId); - if (ToolTip is string toolTip && !string.IsNullOrWhiteSpace(toolTip)) - writer.WriteAttributeString(nameof(ToolTip), toolTip); + if (this.ToolTip is string toolTip && !string.IsNullOrWhiteSpace(toolTip)) + writer.WriteAttributeString(nameof(this.ToolTip), toolTip); - if (FloatingLeft != 0.0) writer.WriteAttributeString(nameof(FloatingLeft), FloatingLeft.ToString(CultureInfo.InvariantCulture)); - if (FloatingTop != 0.0) writer.WriteAttributeString(nameof(FloatingTop), FloatingTop.ToString(CultureInfo.InvariantCulture)); - if (FloatingWidth != 0.0) writer.WriteAttributeString(nameof(FloatingWidth), FloatingWidth.ToString(CultureInfo.InvariantCulture)); - if (FloatingHeight != 0.0) writer.WriteAttributeString(nameof(FloatingHeight), FloatingHeight.ToString(CultureInfo.InvariantCulture)); + if (this.FloatingLeft != 0.0) writer.WriteAttributeString(nameof(this.FloatingLeft), this.FloatingLeft.ToString(CultureInfo.InvariantCulture)); + if (this.FloatingTop != 0.0) writer.WriteAttributeString(nameof(this.FloatingTop), this.FloatingTop.ToString(CultureInfo.InvariantCulture)); + if (this.FloatingWidth != 0.0) writer.WriteAttributeString(nameof(this.FloatingWidth), this.FloatingWidth.ToString(CultureInfo.InvariantCulture)); + if (this.FloatingHeight != 0.0) writer.WriteAttributeString(nameof(this.FloatingHeight), this.FloatingHeight.ToString(CultureInfo.InvariantCulture)); - if (IsMaximized) writer.WriteAttributeString(nameof(IsMaximized), IsMaximized.ToString()); + if (this.IsMaximized) writer.WriteAttributeString(nameof(this.IsMaximized), this.IsMaximized.ToString()); // BD: 14.08.2020 changed to check CanClose value against the default in _canCloseDefault // thus CanClose property will be serialized only when not equal to its default for given class // With previous code it was not possible to serialize CanClose if set to true for LayoutAnchorable instance - if (CanClose != _canCloseDefault) writer.WriteAttributeString(nameof(CanClose), CanClose.ToString()); - if (!CanFloat) writer.WriteAttributeString(nameof(CanFloat), CanFloat.ToString()); + if (this.CanClose != _canCloseDefault) writer.WriteAttributeString(nameof(this.CanClose), this.CanClose.ToString()); + if (!this.CanFloat) writer.WriteAttributeString(nameof(this.CanFloat), this.CanFloat.ToString()); - if (LastActivationTimeStamp != null) writer.WriteAttributeString(nameof(LastActivationTimeStamp), LastActivationTimeStamp.Value.ToString(CultureInfo.InvariantCulture)); + if (this.LastActivationTimeStamp != null) writer.WriteAttributeString(nameof(this.LastActivationTimeStamp), this.LastActivationTimeStamp.Value.ToString(CultureInfo.InvariantCulture)); - if (!CanShowOnHover) writer.WriteAttributeString(nameof(CanShowOnHover), CanShowOnHover.ToString()); + if (!this.CanShowOnHover) writer.WriteAttributeString(nameof(this.CanShowOnHover), this.CanShowOnHover.ToString()); if (_previousContainer is ILayoutPaneSerializable paneSerializable) { @@ -607,48 +607,48 @@ public virtual void WriteXml(System.Xml.XmlWriter writer) public int CompareTo(LayoutContent other) { - if (Content is IComparable contentAsComparable) + if (this.Content is IComparable contentAsComparable) return contentAsComparable.CompareTo(other.Content); - return string.Compare(Title, other.Title); + return string.Compare(this.Title, other.Title); } /// Float the content in a popup window public void Float() { - if (PreviousContainer != null && PreviousContainer.FindParent() != null) + if (this.PreviousContainer != null && this.PreviousContainer.FindParent() != null) { - ILayoutPane currentContainer = Parent as ILayoutPane; + ILayoutPane currentContainer = this.Parent as ILayoutPane; int currentContainerIndex = (currentContainer as ILayoutGroup).IndexOfChild(this); - ILayoutGroup previousContainerAsLayoutGroup = PreviousContainer as ILayoutGroup; + ILayoutGroup previousContainerAsLayoutGroup = this.PreviousContainer as ILayoutGroup; - if (PreviousContainerIndex < previousContainerAsLayoutGroup.ChildrenCount) - previousContainerAsLayoutGroup.InsertChildAt(PreviousContainerIndex, this); + if (this.PreviousContainerIndex < previousContainerAsLayoutGroup.ChildrenCount) + previousContainerAsLayoutGroup.InsertChildAt(this.PreviousContainerIndex, this); else previousContainerAsLayoutGroup.InsertChildAt(previousContainerAsLayoutGroup.ChildrenCount, this); - PreviousContainer = currentContainer; - PreviousContainerIndex = currentContainerIndex; - IsSelected = true; - IsActive = true; - Root.CollectGarbage(); + this.PreviousContainer = currentContainer; + this.PreviousContainerIndex = currentContainerIndex; + this.IsSelected = true; + this.IsActive = true; + this.Root.CollectGarbage(); } else { - Root.Manager.StartDraggingFloatingWindowForContent(this, false); - IsSelected = true; - IsActive = true; + this.Root.Manager.StartDraggingFloatingWindowForContent(this, false); + this.IsSelected = true; + this.IsActive = true; } // BD: 14.08.2020 raise IsFloating property changed - RaisePropertyChanged(nameof(IsFloating)); + RaisePropertyChanged(nameof(this.IsFloating)); } /// Dock the content as document. public void DockAsDocument() { - if (!(Root is LayoutRoot root)) throw new InvalidOperationException(); + if (!(this.Root is LayoutRoot root)) throw new InvalidOperationException(); - if (PreviousContainer is LayoutDocumentPane) + if (this.PreviousContainer is LayoutDocumentPane) { Dock(); return; @@ -665,48 +665,48 @@ public void DockAsDocument() newParentPane.Children.Add(this); root.CollectGarbage(); } - IsSelected = true; - IsActive = true; + this.IsSelected = true; + this.IsActive = true; // BD: 14.08.2020 raise IsFloating property changed - RaisePropertyChanged(nameof(IsFloating)); + RaisePropertyChanged(nameof(this.IsFloating)); } /// Re-dock the content to its previous container public void Dock() { - if (PreviousContainer != null) + if (this.PreviousContainer != null) { - ILayoutContainer currentContainer = Parent; + ILayoutContainer currentContainer = this.Parent; int currentContainerIndex = currentContainer is ILayoutGroup ? (currentContainer as ILayoutGroup).IndexOfChild(this) : -1; - ILayoutGroup previousContainerAsLayoutGroup = PreviousContainer as ILayoutGroup; + ILayoutGroup previousContainerAsLayoutGroup = this.PreviousContainer as ILayoutGroup; - if (PreviousContainerIndex < previousContainerAsLayoutGroup.ChildrenCount) - previousContainerAsLayoutGroup.InsertChildAt(PreviousContainerIndex, this); + if (this.PreviousContainerIndex < previousContainerAsLayoutGroup.ChildrenCount) + previousContainerAsLayoutGroup.InsertChildAt(this.PreviousContainerIndex, this); else previousContainerAsLayoutGroup.InsertChildAt(previousContainerAsLayoutGroup.ChildrenCount, this); if (currentContainerIndex > -1) { - PreviousContainer = currentContainer; - PreviousContainerIndex = currentContainerIndex; + this.PreviousContainer = currentContainer; + this.PreviousContainerIndex = currentContainerIndex; } else { - PreviousContainer = null; - PreviousContainerIndex = 0; + this.PreviousContainer = null; + this.PreviousContainerIndex = 0; } - IsSelected = true; - IsActive = true; + this.IsSelected = true; + this.IsActive = true; } else InternalDock(); - Root.CollectGarbage(); + this.Root.CollectGarbage(); // BD: 14.08.2020 raise IsFloating property changed - RaisePropertyChanged(nameof(IsFloating)); + RaisePropertyChanged(nameof(this.IsFloating)); } #endregion Public Methods @@ -716,7 +716,7 @@ public void Dock() /// protected override void OnParentChanging(ILayoutContainer oldValue, ILayoutContainer newValue) { - if (oldValue != null) IsSelected = false; + if (oldValue != null) this.IsSelected = false; base.OnParentChanging(oldValue, newValue); } @@ -724,9 +724,9 @@ protected override void OnParentChanging(ILayoutContainer oldValue, ILayoutConta /// protected override void OnParentChanged(ILayoutContainer oldValue, ILayoutContainer newValue) { - if (IsSelected && Parent is ILayoutContentSelector) + if (this.IsSelected && this.Parent is ILayoutContentSelector) { - ILayoutContentSelector parentSelector = Parent as ILayoutContentSelector; + ILayoutContentSelector parentSelector = this.Parent as ILayoutContentSelector; parentSelector.SelectedContentIndex = parentSelector.IndexOf(this); } @@ -748,29 +748,29 @@ internal bool TestCanClose() internal void CloseInternal() { - ILayoutRoot root = Root; - ILayoutContainer parentAsContainer = Parent; + ILayoutRoot root = this.Root; + ILayoutContainer parentAsContainer = this.Parent; - if (PreviousContainer == null) + if (this.PreviousContainer == null) { - ILayoutGroup parentAsGroup = Parent as ILayoutGroup; - PreviousContainer = parentAsContainer; - PreviousContainerIndex = parentAsGroup.IndexOfChild(this); + ILayoutGroup parentAsGroup = this.Parent as ILayoutGroup; + this.PreviousContainer = parentAsContainer; + this.PreviousContainerIndex = parentAsGroup.IndexOfChild(this); if (parentAsGroup is ILayoutPaneSerializable layoutPaneSerializable) { - PreviousContainerId = layoutPaneSerializable.Id; + this.PreviousContainerId = layoutPaneSerializable.Id; // This parentAsGroup will be removed in the GarbageCollection below - if (parentAsGroup.Children.Count() == 1 && parentAsGroup.Parent != null && Root.Manager != null) + if (parentAsGroup.Children.Count() == 1 && parentAsGroup.Parent != null && this.Root.Manager != null) { - Parent = Root.Manager.Layout; - PreviousContainer = parentAsGroup.Parent; - PreviousContainerIndex = -1; + this.Parent = this.Root.Manager.Layout; + this.PreviousContainer = parentAsGroup.Parent; + this.PreviousContainerIndex = -1; if (parentAsGroup.Parent is ILayoutPaneSerializable paneSerializable) - PreviousContainerId = paneSerializable.Id; + this.PreviousContainerId = paneSerializable.Id; else - PreviousContainerId = null; + this.PreviousContainerId = null; } } } diff --git a/Source/Controls/H.Controls.Dock/Layout/LayoutDocument.cs b/Source/Controls/H.Controls.Dock/Layout/LayoutDocument.cs index 5ba07c30..ed31c337 100644 --- a/Source/Controls/H.Controls.Dock/Layout/LayoutDocument.cs +++ b/Source/Controls/H.Controls.Dock/Layout/LayoutDocument.cs @@ -38,7 +38,7 @@ public bool CanMove { if (value == _canMove) return; _canMove = value; - RaisePropertyChanged(nameof(CanMove)); + RaisePropertyChanged(nameof(this.CanMove)); } } @@ -62,7 +62,7 @@ public string Description { if (_description == value) return; _description = value; - RaisePropertyChanged(nameof(Description)); + RaisePropertyChanged(nameof(this.Description)); } } @@ -85,24 +85,24 @@ internal bool CloseDocument() public override void WriteXml(System.Xml.XmlWriter writer) { base.WriteXml(writer); - if (!string.IsNullOrWhiteSpace(Description)) writer.WriteAttributeString(nameof(Description), Description); - if (!CanMove) writer.WriteAttributeString(nameof(CanMove), CanMove.ToString()); + if (!string.IsNullOrWhiteSpace(this.Description)) writer.WriteAttributeString(nameof(this.Description), this.Description); + if (!this.CanMove) writer.WriteAttributeString(nameof(this.CanMove), this.CanMove.ToString()); } /// public override void ReadXml(System.Xml.XmlReader reader) { - if (reader.MoveToAttribute(nameof(Description))) Description = reader.Value; - if (reader.MoveToAttribute(nameof(CanMove))) CanMove = bool.Parse(reader.Value); + if (reader.MoveToAttribute(nameof(this.Description))) this.Description = reader.Value; + if (reader.MoveToAttribute(nameof(this.CanMove))) this.CanMove = bool.Parse(reader.Value); base.ReadXml(reader); } /// public override void Close() { - if (Root?.Manager != null) + if (this.Root?.Manager != null) { - DockingManager dockingManager = Root.Manager; + DockingManager dockingManager = this.Root.Manager; dockingManager.ExecuteCloseCommand(this); } else @@ -119,7 +119,7 @@ public override void ConsoleDump(int tab) protected override void InternalDock() { - LayoutRoot root = Root as LayoutRoot; + LayoutRoot root = this.Root as LayoutRoot; LayoutDocumentPane documentPane = null; if (root?.LastFocusedDocument != null && root.LastFocusedDocument != this) documentPane = root.LastFocusedDocument.Parent as LayoutDocumentPane; if (documentPane == null) documentPane = root.Descendents().OfType().FirstOrDefault(); diff --git a/Source/Controls/H.Controls.Dock/Layout/LayoutDocumentFloatingWindow.cs b/Source/Controls/H.Controls.Dock/Layout/LayoutDocumentFloatingWindow.cs index c3b4bed2..eb654a56 100644 --- a/Source/Controls/H.Controls.Dock/Layout/LayoutDocumentFloatingWindow.cs +++ b/Source/Controls/H.Controls.Dock/Layout/LayoutDocumentFloatingWindow.cs @@ -49,33 +49,33 @@ public LayoutDocumentPaneGroup RootPanel if (_rootPanel != null) _rootPanel.Parent = this; if (_rootPanel != null) _rootPanel.ChildrenTreeChanged += _rootPanel_ChildrenTreeChanged; - RaisePropertyChanged(nameof(RootPanel)); - RaisePropertyChanged(nameof(IsSinglePane)); - RaisePropertyChanged(nameof(SinglePane)); - RaisePropertyChanged(nameof(Children)); - RaisePropertyChanged(nameof(ChildrenCount)); + RaisePropertyChanged(nameof(this.RootPanel)); + RaisePropertyChanged(nameof(this.IsSinglePane)); + RaisePropertyChanged(nameof(this.SinglePane)); + RaisePropertyChanged(nameof(this.Children)); + RaisePropertyChanged(nameof(this.ChildrenCount)); ((ILayoutElementWithVisibility)this).ComputeVisibility(); } } private void _rootPanel_ChildrenTreeChanged(object sender, ChildrenTreeChangedEventArgs e) { - RaisePropertyChanged(nameof(IsSinglePane)); - RaisePropertyChanged(nameof(SinglePane)); + RaisePropertyChanged(nameof(this.IsSinglePane)); + RaisePropertyChanged(nameof(this.SinglePane)); } #endregion RootPanel #region IsSinglePane - public bool IsSinglePane => RootPanel?.Descendents().OfType().Count(p => p.IsVisible) == 1; + public bool IsSinglePane => this.RootPanel?.Descendents().OfType().Count(p => p.IsVisible) == 1; public LayoutDocumentPane SinglePane { get { - if (!IsSinglePane) return null; - LayoutDocumentPane singlePane = RootPanel.Descendents().OfType().Single(p => p.IsVisible); + if (!this.IsSinglePane) return null; + LayoutDocumentPane singlePane = this.RootPanel.Descendents().OfType().Single(p => p.IsVisible); //singlePane.UpdateIsDirectlyHostedInFloatingWindow(); return singlePane; } @@ -90,9 +90,9 @@ public bool IsVisible private set { if (_isVisible == value) return; - RaisePropertyChanging(nameof(IsVisible)); + RaisePropertyChanging(nameof(this.IsVisible)); _isVisible = value; - RaisePropertyChanged(nameof(IsVisible)); + RaisePropertyChanged(nameof(this.IsVisible)); IsVisibleChanged?.Invoke(this, EventArgs.Empty); } } @@ -104,30 +104,30 @@ private set /// public override IEnumerable Children { - get { if (ChildrenCount == 1) yield return RootPanel; } + get { if (this.ChildrenCount == 1) yield return this.RootPanel; } } /// public override void RemoveChild(ILayoutElement element) { - Debug.Assert(element == RootPanel && element != null); - RootPanel = null; + Debug.Assert(element == this.RootPanel && element != null); + this.RootPanel = null; } /// public override void ReplaceChild(ILayoutElement oldElement, ILayoutElement newElement) { - Debug.Assert(oldElement == RootPanel && oldElement != null); - RootPanel = newElement as LayoutDocumentPaneGroup; + Debug.Assert(oldElement == this.RootPanel && oldElement != null); + this.RootPanel = newElement as LayoutDocumentPaneGroup; } /// - public override int ChildrenCount => RootPanel == null ? 0 : 1; + public override int ChildrenCount => this.RootPanel == null ? 0 : 1; - void ILayoutElementWithVisibility.ComputeVisibility() => IsVisible = RootPanel != null && RootPanel.IsVisible; + void ILayoutElementWithVisibility.ComputeVisibility() => this.IsVisible = this.RootPanel != null && this.RootPanel.IsVisible; /// - public override bool IsValid => RootPanel != null; + public override bool IsValid => this.RootPanel != null; /// public override void ReadXml(XmlReader reader) @@ -160,7 +160,7 @@ public override void ReadXml(XmlReader reader) if (type == null) throw new ArgumentException("H.Controls.Dock.LayoutDocumentFloatingWindow doesn't know how to deserialize " + reader.LocalName); serializer = XmlSerializersCache.GetSerializer(type); } - RootPanel = (LayoutDocumentPaneGroup)serializer.Deserialize(reader); + this.RootPanel = (LayoutDocumentPaneGroup)serializer.Deserialize(reader); } reader.ReadEndElement(); @@ -172,7 +172,7 @@ public override void ConsoleDump(int tab) System.Diagnostics.Trace.Write(new string(' ', tab * 4)); System.Diagnostics.Trace.WriteLine("FloatingDocumentWindow()"); - RootPanel.ConsoleDump(tab + 1); + this.RootPanel.ConsoleDump(tab + 1); } #endif diff --git a/Source/Controls/H.Controls.Dock/Layout/LayoutDocumentPane.cs b/Source/Controls/H.Controls.Dock/Layout/LayoutDocumentPane.cs index 9d0a4044..3103ea99 100644 --- a/Source/Controls/H.Controls.Dock/Layout/LayoutDocumentPane.cs +++ b/Source/Controls/H.Controls.Dock/Layout/LayoutDocumentPane.cs @@ -48,7 +48,7 @@ public LayoutDocumentPane() /// public LayoutDocumentPane(LayoutContent firstChild) { - Children.Add(firstChild); + this.Children.Add(firstChild); } #endregion Constructors @@ -63,7 +63,7 @@ public bool ShowHeader { if (value == _showHeader) return; _showHeader = value; - RaisePropertyChanged(nameof(ShowHeader)); + RaisePropertyChanged(nameof(this.ShowHeader)); } } @@ -73,20 +73,20 @@ public int SelectedContentIndex get => _selectedIndex; set { - if (value < 0 || value >= Children.Count) value = -1; + if (value < 0 || value >= this.Children.Count) value = -1; if (value == _selectedIndex) return; - RaisePropertyChanging(nameof(SelectedContentIndex)); - RaisePropertyChanging(nameof(SelectedContent)); - if (_selectedIndex >= 0 && _selectedIndex < Children.Count) Children[_selectedIndex].IsSelected = false; + RaisePropertyChanging(nameof(this.SelectedContentIndex)); + RaisePropertyChanging(nameof(this.SelectedContent)); + if (_selectedIndex >= 0 && _selectedIndex < this.Children.Count) this.Children[_selectedIndex].IsSelected = false; _selectedIndex = value; - if (_selectedIndex >= 0 && _selectedIndex < Children.Count) Children[_selectedIndex].IsSelected = true; - RaisePropertyChanged(nameof(SelectedContentIndex)); - RaisePropertyChanged(nameof(SelectedContent)); + if (_selectedIndex >= 0 && _selectedIndex < this.Children.Count) this.Children[_selectedIndex].IsSelected = true; + RaisePropertyChanged(nameof(this.SelectedContentIndex)); + RaisePropertyChanged(nameof(this.SelectedContent)); } } /// - public LayoutContent SelectedContent => _selectedIndex == -1 ? null : Children[_selectedIndex]; + public LayoutContent SelectedContent => _selectedIndex == -1 ? null : this.Children[_selectedIndex]; /// string ILayoutPaneSerializable.Id @@ -103,7 +103,7 @@ public IEnumerable ChildrenSorted { get { - List listSorted = Children.ToList(); + List listSorted = this.Children.ToList(); listSorted.Sort(); return listSorted; } @@ -116,8 +116,8 @@ public IEnumerable ChildrenSorted /// protected override bool GetVisibility() { - if (Parent is LayoutDocumentPaneGroup) - return ChildrenCount > 0 && Children.Any(c => (c is LayoutDocument document && document.IsVisible) || c is LayoutAnchorable); + if (this.Parent is LayoutDocumentPaneGroup) + return this.ChildrenCount > 0 && this.Children.Any(c => (c is LayoutDocument document && document.IsVisible) || c is LayoutAnchorable); return true; } @@ -126,9 +126,9 @@ protected override void ChildMoved(int oldIndex, int newIndex) { if (_selectedIndex == oldIndex) { - RaisePropertyChanging(nameof(SelectedContentIndex)); + RaisePropertyChanging(nameof(this.SelectedContentIndex)); _selectedIndex = newIndex; - RaisePropertyChanged(nameof(SelectedContentIndex)); + RaisePropertyChanged(nameof(this.SelectedContentIndex)); } base.ChildMoved(oldIndex, newIndex); } @@ -137,25 +137,25 @@ protected override void ChildMoved(int oldIndex, int newIndex) protected override void OnChildrenCollectionChanged() { AutoFixSelectedContent(); - for (int i = 0; i < Children.Count; i++) + for (int i = 0; i < this.Children.Count; i++) { - if (!Children[i].IsSelected) continue; - SelectedContentIndex = i; + if (!this.Children[i].IsSelected) continue; + this.SelectedContentIndex = i; break; } // TODO: MK who's properties are these?? //RaisePropertyChanged(nameof(CanClose)); //RaisePropertyChanged(nameof(CanHide)); - RaisePropertyChanged(nameof(IsDirectlyHostedInFloatingWindow)); + RaisePropertyChanged(nameof(this.IsDirectlyHostedInFloatingWindow)); base.OnChildrenCollectionChanged(); - RaisePropertyChanged(nameof(ChildrenSorted)); + RaisePropertyChanged(nameof(this.ChildrenSorted)); } private void AutoFixSelectedContent() { if (!_autoFixSelectedContent) return; - if (SelectedContentIndex >= ChildrenCount) SelectedContentIndex = Children.Count - 1; - if (SelectedContentIndex == -1 && ChildrenCount > 0) SetLastActivatedIndex(); + if (this.SelectedContentIndex >= this.ChildrenCount) this.SelectedContentIndex = this.Children.Count - 1; + if (this.SelectedContentIndex == -1 && this.ChildrenCount > 0) SetLastActivatedIndex(); } /// @@ -175,7 +175,7 @@ public bool IsDirectlyHostedInFloatingWindow public override void WriteXml(System.Xml.XmlWriter writer) { if (_id != null) writer.WriteAttributeString(nameof(ILayoutPaneSerializable.Id), _id); - if (!_showHeader) writer.WriteAttributeString(nameof(ShowHeader), _showHeader.ToString()); + if (!_showHeader) writer.WriteAttributeString(nameof(this.ShowHeader), _showHeader.ToString()); base.WriteXml(writer); } @@ -183,7 +183,7 @@ public override void WriteXml(System.Xml.XmlWriter writer) public override void ReadXml(System.Xml.XmlReader reader) { if (reader.MoveToAttribute(nameof(ILayoutPaneSerializable.Id))) _id = reader.Value; - if (reader.MoveToAttribute(nameof(ShowHeader))) _showHeader = bool.Parse(reader.Value); + if (reader.MoveToAttribute(nameof(this.ShowHeader))) _showHeader = bool.Parse(reader.Value); base.ReadXml(reader); } @@ -194,7 +194,7 @@ public override void ConsoleDump(int tab) System.Diagnostics.Trace.Write(new string(' ', tab * 4)); System.Diagnostics.Trace.WriteLine("DocumentPane()"); - foreach (LayoutElement child in Children) + foreach (LayoutElement child in this.Children) child.ConsoleDump(tab + 1); } #endif @@ -208,17 +208,17 @@ public override void ConsoleDump(int tab) /// public int IndexOf(LayoutContent content) { - return !(content is LayoutDocument documentChild) ? -1 : Children.IndexOf(documentChild); + return !(content is LayoutDocument documentChild) ? -1 : this.Children.IndexOf(documentChild); } /// Invalidates the current and sets the index for the next avialable child with IsEnabled == true. internal void SetNextSelectedIndex() { - SelectedContentIndex = -1; - for (int i = 0; i < Children.Count; ++i) + this.SelectedContentIndex = -1; + for (int i = 0; i < this.Children.Count; ++i) { - if (!Children[i].IsEnabled) continue; - SelectedContentIndex = i; + if (!this.Children[i].IsEnabled) continue; + this.SelectedContentIndex = i; return; } } @@ -226,24 +226,24 @@ internal void SetNextSelectedIndex() /// Sets the current to the last activated child with IsEnabled == true private void SetLastActivatedIndex() { - LayoutContent lastActivatedDocument = Children.Where(c => c.IsEnabled).OrderByDescending(c => c.LastActivationTimeStamp.GetValueOrDefault()).FirstOrDefault(); - SelectedContentIndex = Children.IndexOf(lastActivatedDocument); + LayoutContent lastActivatedDocument = this.Children.Where(c => c.IsEnabled).OrderByDescending(c => c.LastActivationTimeStamp.GetValueOrDefault()).FirstOrDefault(); + this.SelectedContentIndex = this.Children.IndexOf(lastActivatedDocument); } /// Updates the property of this object. - internal void UpdateIsDirectlyHostedInFloatingWindow() => RaisePropertyChanged(nameof(IsDirectlyHostedInFloatingWindow)); + internal void UpdateIsDirectlyHostedInFloatingWindow() => RaisePropertyChanged(nameof(this.IsDirectlyHostedInFloatingWindow)); /// protected override void OnParentChanged(ILayoutContainer oldValue, ILayoutContainer newValue) { if (oldValue is ILayoutGroup oldGroup) oldGroup.ChildrenCollectionChanged -= OnParentChildrenCollectionChanged; - RaisePropertyChanged(nameof(IsDirectlyHostedInFloatingWindow)); + RaisePropertyChanged(nameof(this.IsDirectlyHostedInFloatingWindow)); if (newValue is ILayoutGroup newGroup) newGroup.ChildrenCollectionChanged += OnParentChildrenCollectionChanged; base.OnParentChanged(oldValue, newValue); } /// - private void OnParentChildrenCollectionChanged(object sender, EventArgs e) => RaisePropertyChanged(nameof(IsDirectlyHostedInFloatingWindow)); + private void OnParentChildrenCollectionChanged(object sender, EventArgs e) => RaisePropertyChanged(nameof(this.IsDirectlyHostedInFloatingWindow)); #endregion methods } diff --git a/Source/Controls/H.Controls.Dock/Layout/LayoutDocumentPaneGroup.cs b/Source/Controls/H.Controls.Dock/Layout/LayoutDocumentPaneGroup.cs index 0d270fed..a9d31d2b 100644 --- a/Source/Controls/H.Controls.Dock/Layout/LayoutDocumentPaneGroup.cs +++ b/Source/Controls/H.Controls.Dock/Layout/LayoutDocumentPaneGroup.cs @@ -37,7 +37,7 @@ public LayoutDocumentPaneGroup() /// Class constructor from that is added into the children collection of this object. public LayoutDocumentPaneGroup(LayoutDocumentPane documentPane) { - Children.Add(documentPane); + this.Children.Add(documentPane); } #endregion Constructors @@ -51,9 +51,9 @@ public Orientation Orientation set { if (value == _orientation) return; - RaisePropertyChanging(nameof(Orientation)); + RaisePropertyChanging(nameof(this.Orientation)); _orientation = value; - RaisePropertyChanged(nameof(Orientation)); + RaisePropertyChanged(nameof(this.Orientation)); } } @@ -67,14 +67,14 @@ public Orientation Orientation /// public override void WriteXml(System.Xml.XmlWriter writer) { - writer.WriteAttributeString(nameof(Orientation), Orientation.ToString()); + writer.WriteAttributeString(nameof(this.Orientation), this.Orientation.ToString()); base.WriteXml(writer); } /// public override void ReadXml(System.Xml.XmlReader reader) { - if (reader.MoveToAttribute(nameof(Orientation))) Orientation = (Orientation)Enum.Parse(typeof(Orientation), reader.Value, true); + if (reader.MoveToAttribute(nameof(this.Orientation))) this.Orientation = (Orientation)Enum.Parse(typeof(Orientation), reader.Value, true); base.ReadXml(reader); } @@ -83,9 +83,9 @@ public override void ReadXml(System.Xml.XmlReader reader) public override void ConsoleDump(int tab) { System.Diagnostics.Trace.Write(new string(' ', tab * 4)); - System.Diagnostics.Trace.WriteLine(string.Format("DocumentPaneGroup({0})", Orientation)); + System.Diagnostics.Trace.WriteLine(string.Format("DocumentPaneGroup({0})", this.Orientation)); - foreach (LayoutElement child in Children) + foreach (LayoutElement child in this.Children) child.ConsoleDump(tab + 1); } #endif diff --git a/Source/Controls/H.Controls.Dock/Layout/LayoutElement.cs b/Source/Controls/H.Controls.Dock/Layout/LayoutElement.cs index 8774c54e..0386abbe 100644 --- a/Source/Controls/H.Controls.Dock/Layout/LayoutElement.cs +++ b/Source/Controls/H.Controls.Dock/Layout/LayoutElement.cs @@ -72,15 +72,15 @@ public ILayoutContainer Parent if (_parent == value) return; ILayoutContainer oldValue = _parent; ILayoutRoot oldRoot = _root; - RaisePropertyChanging(nameof(Parent)); + RaisePropertyChanging(nameof(this.Parent)); OnParentChanging(oldValue, value); _parent = value; OnParentChanged(oldValue, value); - _root = Root; + _root = this.Root; if (oldRoot != _root) OnRootChanged(oldRoot, _root); - RaisePropertyChanged(nameof(Parent)); - if (Root is LayoutRoot root) root.FireLayoutUpdated(); + RaisePropertyChanged(nameof(this.Parent)); + if (this.Root is LayoutRoot root) root.FireLayoutUpdated(); } } @@ -89,7 +89,7 @@ public ILayoutRoot Root { get { - ILayoutContainer parent = Parent; + ILayoutContainer parent = this.Parent; while (parent != null && (!(parent is ILayoutRoot))) parent = parent.Parent; return parent as ILayoutRoot; } @@ -118,7 +118,7 @@ public virtual void ConsoleDump(int tab) internal void FixCachedRootOnDeserialize() { if (_root == null) - _root = Root; + _root = this.Root; } #endregion Internal Methods diff --git a/Source/Controls/H.Controls.Dock/Layout/LayoutElementEventArgs.cs b/Source/Controls/H.Controls.Dock/Layout/LayoutElementEventArgs.cs index 2d0326f1..201c4d4e 100644 --- a/Source/Controls/H.Controls.Dock/Layout/LayoutElementEventArgs.cs +++ b/Source/Controls/H.Controls.Dock/Layout/LayoutElementEventArgs.cs @@ -22,7 +22,7 @@ public class LayoutElementEventArgs : EventArgs /// public LayoutElementEventArgs(LayoutElement element) { - Element = element; + this.Element = element; } /// Gets the particular for which this event has been raised. diff --git a/Source/Controls/H.Controls.Dock/Layout/LayoutFloatingWindow.cs b/Source/Controls/H.Controls.Dock/Layout/LayoutFloatingWindow.cs index 07f87889..67fd9578 100644 --- a/Source/Controls/H.Controls.Dock/Layout/LayoutFloatingWindow.cs +++ b/Source/Controls/H.Controls.Dock/Layout/LayoutFloatingWindow.cs @@ -58,7 +58,7 @@ public XmlSchema GetSchema() /// public virtual void WriteXml(XmlWriter writer) { - foreach (ILayoutElement child in Children) + foreach (ILayoutElement child in this.Children) { Type type = child.GetType(); XmlSerializer serializer = XmlSerializersCache.GetSerializer(type); diff --git a/Source/Controls/H.Controls.Dock/Layout/LayoutGroup.cs b/Source/Controls/H.Controls.Dock/Layout/LayoutGroup.cs index 1ef68536..061826de 100644 --- a/Source/Controls/H.Controls.Dock/Layout/LayoutGroup.cs +++ b/Source/Controls/H.Controls.Dock/Layout/LayoutGroup.cs @@ -59,10 +59,10 @@ public bool IsVisible protected set { if (value == _isVisible) return; - RaisePropertyChanging(nameof(IsVisible)); + RaisePropertyChanging(nameof(this.IsVisible)); _isVisible = value; OnIsVisibleChanged(); - RaisePropertyChanged(nameof(IsVisible)); + RaisePropertyChanged(nameof(this.IsVisible)); } } @@ -71,7 +71,7 @@ protected set #region Public Methods /// - public void ComputeVisibility() => IsVisible = GetVisibility(); + public void ComputeVisibility() => this.IsVisible = GetVisibility(); /// public void MoveChild(int oldIndex, int newIndex) @@ -160,7 +160,7 @@ public virtual void ReadXml(System.Xml.XmlReader reader) throw new ArgumentException("H.Controls.Dock.LayoutGroup doesn't know how to deserialize " + reader.LocalName); XmlSerializer serializer = XmlSerializersCache.GetSerializer(typeForSerializer); - Children.Add((T)serializer.Deserialize(reader)); + this.Children.Add((T)serializer.Deserialize(reader)); } reader.ReadEndElement(); @@ -170,7 +170,7 @@ public virtual void ReadXml(System.Xml.XmlReader reader) /// provides a standard overridable implementation for deriving classes. public virtual void WriteXml(System.Xml.XmlWriter writer) { - foreach (T child in Children) + foreach (T child in this.Children) { Type type = child.GetType(); XmlSerializer serializer = XmlSerializersCache.GetSerializer(type); @@ -239,12 +239,12 @@ private void Children_CollectionChanged(object sender, NotifyCollectionChangedEv RaiseChildrenTreeChanged(); else NotifyChildrenTreeChanged(ChildrenTreeChange.DirectChildrenChanged); - RaisePropertyChanged(nameof(ChildrenCount)); + RaisePropertyChanged(nameof(this.ChildrenCount)); } private void UpdateParentVisibility() { - if (Parent is ILayoutElementWithVisibility parentPane) + if (this.Parent is ILayoutElementWithVisibility parentPane) parentPane.ComputeVisibility(); } diff --git a/Source/Controls/H.Controls.Dock/Layout/LayoutGroupBase.cs b/Source/Controls/H.Controls.Dock/Layout/LayoutGroupBase.cs index a663e807..f7ae52c1 100644 --- a/Source/Controls/H.Controls.Dock/Layout/LayoutGroupBase.cs +++ b/Source/Controls/H.Controls.Dock/Layout/LayoutGroupBase.cs @@ -45,7 +45,7 @@ public abstract class LayoutGroupBase : LayoutElement internal void RaiseChildrenTreeChanged() { OnChildrenTreeChanged(ChildrenTreeChange.DirectChildrenChanged); - LayoutGroupBase parentGroup = Parent as LayoutGroupBase; + LayoutGroupBase parentGroup = this.Parent as LayoutGroupBase; if (parentGroup != null) parentGroup.RaiseChildrenTreeChanged(); } @@ -68,7 +68,7 @@ protected virtual void OnChildrenTreeChanged(ChildrenTreeChange change) protected void NotifyChildrenTreeChanged(ChildrenTreeChange change) { OnChildrenTreeChanged(change); - LayoutGroupBase parentGroup = Parent as LayoutGroupBase; + LayoutGroupBase parentGroup = this.Parent as LayoutGroupBase; if (parentGroup != null) parentGroup.NotifyChildrenTreeChanged(ChildrenTreeChange.TreeChanged); } diff --git a/Source/Controls/H.Controls.Dock/Layout/LayoutPanel.cs b/Source/Controls/H.Controls.Dock/Layout/LayoutPanel.cs index 3476f450..d6b995c3 100644 --- a/Source/Controls/H.Controls.Dock/Layout/LayoutPanel.cs +++ b/Source/Controls/H.Controls.Dock/Layout/LayoutPanel.cs @@ -37,7 +37,7 @@ public LayoutPanel() /// public LayoutPanel(ILayoutPanelElement firstChild) { - Children.Add(firstChild); + this.Children.Add(firstChild); } #endregion Constructors @@ -51,9 +51,9 @@ public Orientation Orientation set { if (value == _orientation) return; - RaisePropertyChanging(nameof(Orientation)); + RaisePropertyChanging(nameof(this.Orientation)); _orientation = value; - RaisePropertyChanged(nameof(Orientation)); + RaisePropertyChanged(nameof(this.Orientation)); } } @@ -90,15 +90,15 @@ public bool CanDock #region Overrides /// - protected override bool GetVisibility() => Children.Any(c => c.IsVisible); + protected override bool GetVisibility() => this.Children.Any(c => c.IsVisible); /// public override void WriteXml(System.Xml.XmlWriter writer) { - writer.WriteAttributeString(nameof(Orientation), Orientation.ToString()); + writer.WriteAttributeString(nameof(this.Orientation), this.Orientation.ToString()); - if (CanDock == false) - writer.WriteAttributeString(nameof(CanDock), CanDock.ToString()); + if (this.CanDock == false) + writer.WriteAttributeString(nameof(this.CanDock), this.CanDock.ToString()); base.WriteXml(writer); } @@ -110,13 +110,13 @@ public override void WriteXml(System.Xml.XmlWriter writer) /// public override void ReadXml(System.Xml.XmlReader reader) { - if (reader.MoveToAttribute(nameof(Orientation))) - Orientation = (Orientation)Enum.Parse(typeof(Orientation), reader.Value, true); - if (reader.MoveToAttribute(nameof(CanDock))) + if (reader.MoveToAttribute(nameof(this.Orientation))) + this.Orientation = (Orientation)Enum.Parse(typeof(Orientation), reader.Value, true); + if (reader.MoveToAttribute(nameof(this.CanDock))) { string canDockStr = reader.GetAttribute("CanDock"); if (canDockStr != null) - CanDock = bool.Parse(canDockStr); + this.CanDock = bool.Parse(canDockStr); } base.ReadXml(reader); } @@ -126,9 +126,9 @@ public override void ReadXml(System.Xml.XmlReader reader) public override void ConsoleDump(int tab) { System.Diagnostics.Trace.Write(new string(' ', tab * 4)); - System.Diagnostics.Trace.WriteLine(string.Format("Panel({0})", Orientation)); + System.Diagnostics.Trace.WriteLine(string.Format("Panel({0})", this.Orientation)); - foreach (LayoutElement child in Children) + foreach (LayoutElement child in this.Children) child.ConsoleDump(tab + 1); } #endif diff --git a/Source/Controls/H.Controls.Dock/Layout/LayoutPositionableGroup.cs b/Source/Controls/H.Controls.Dock/Layout/LayoutPositionableGroup.cs index 5ee34dd8..0d09bc88 100644 --- a/Source/Controls/H.Controls.Dock/Layout/LayoutPositionableGroup.cs +++ b/Source/Controls/H.Controls.Dock/Layout/LayoutPositionableGroup.cs @@ -75,9 +75,9 @@ public GridLength DockWidth { if (value == _dockWidth || !(value.Value > 0)) return; if (value.IsAbsolute) _resizableAbsoluteDockWidth = value.Value; - RaisePropertyChanging(nameof(DockWidth)); + RaisePropertyChanging(nameof(this.DockWidth)); _dockWidth = value; - RaisePropertyChanged(nameof(DockWidth)); + RaisePropertyChanged(nameof(this.DockWidth)); OnDockWidthChanged(); } } @@ -92,9 +92,9 @@ public double ResizableAbsoluteDockWidth if (!_dockWidth.IsAbsolute) return; if (value <= _dockWidth.Value && value > 0) { - RaisePropertyChanging(nameof(DockWidth)); + RaisePropertyChanging(nameof(this.DockWidth)); _resizableAbsoluteDockWidth = value; - RaisePropertyChanged(nameof(DockWidth)); + RaisePropertyChanged(nameof(this.DockWidth)); OnDockWidthChanged(); } else if (value > _dockWidth.Value && _resizableAbsoluteDockWidth < _dockWidth.Value) @@ -114,9 +114,9 @@ public GridLength DockHeight { if (_dockHeight == value || !(value.Value > 0)) return; if (value.IsAbsolute) _resizableAbsoluteDockHeight = value.Value; - RaisePropertyChanging(nameof(DockHeight)); + RaisePropertyChanging(nameof(this.DockHeight)); _dockHeight = value; - RaisePropertyChanged(nameof(DockHeight)); + RaisePropertyChanged(nameof(this.DockHeight)); OnDockHeightChanged(); } } @@ -131,14 +131,14 @@ public double ResizableAbsoluteDockHeight if (!_dockHeight.IsAbsolute) return; if (value < _dockHeight.Value && value > 0) { - RaisePropertyChanging(nameof(DockHeight)); + RaisePropertyChanging(nameof(this.DockHeight)); _resizableAbsoluteDockHeight = value; - RaisePropertyChanged(nameof(DockHeight)); + RaisePropertyChanged(nameof(this.DockHeight)); OnDockHeightChanged(); } else if (value > _dockHeight.Value && _resizableAbsoluteDockHeight < _dockHeight.Value) _resizableAbsoluteDockHeight = _dockHeight.Value; - else if (value == 0) _resizableAbsoluteDockHeight = DockMinHeight; + else if (value == 0) _resizableAbsoluteDockHeight = this.DockMinHeight; } } @@ -156,9 +156,9 @@ public bool AllowDuplicateContent set { if (value == _allowDuplicateContent) return; - RaisePropertyChanging(nameof(AllowDuplicateContent)); + RaisePropertyChanging(nameof(this.AllowDuplicateContent)); _allowDuplicateContent = value; - RaisePropertyChanged(nameof(AllowDuplicateContent)); + RaisePropertyChanged(nameof(this.AllowDuplicateContent)); } } @@ -168,21 +168,21 @@ public bool CanRepositionItems set { if (value == _canRepositionItems) return; - RaisePropertyChanging(nameof(CanRepositionItems)); + RaisePropertyChanging(nameof(this.CanRepositionItems)); _canRepositionItems = value; - RaisePropertyChanged(nameof(CanRepositionItems)); + RaisePropertyChanged(nameof(this.CanRepositionItems)); } } public double CalculatedDockMinWidth() { double childrenDockMinWidth = 0.0; - System.Collections.Generic.List visibleChildren = Children.OfType().Where(child => child.IsVisible).ToList(); + System.Collections.Generic.List visibleChildren = this.Children.OfType().Where(child => child.IsVisible).ToList(); if (this is ILayoutOrientableGroup orientableGroup && visibleChildren.Any()) { childrenDockMinWidth = orientableGroup.Orientation == Orientation.Vertical ? visibleChildren.Max(child => child.CalculatedDockMinWidth()) - : visibleChildren.Sum(child => child.CalculatedDockMinWidth() + ((Root?.Manager?.GridSplitterWidth ?? 0) * (visibleChildren.Count - 1))); + : visibleChildren.Sum(child => child.CalculatedDockMinWidth() + ((this.Root?.Manager?.GridSplitterWidth ?? 0) * (visibleChildren.Count - 1))); } return Math.Max(this._dockMinWidth, childrenDockMinWidth); } @@ -200,20 +200,20 @@ public double DockMinWidth { if (value == _dockMinWidth) return; MathHelper.AssertIsPositiveOrZero(value); - RaisePropertyChanging(nameof(DockMinWidth)); + RaisePropertyChanging(nameof(this.DockMinWidth)); _dockMinWidth = value; - RaisePropertyChanged(nameof(DockMinWidth)); + RaisePropertyChanged(nameof(this.DockMinWidth)); } } public double CalculatedDockMinHeight() { double childrenDockMinHeight = 0.0; - System.Collections.Generic.List visibleChildren = Children.OfType().Where(child => child.IsVisible).ToList(); + System.Collections.Generic.List visibleChildren = this.Children.OfType().Where(child => child.IsVisible).ToList(); if (this is ILayoutOrientableGroup orientableGroup && visibleChildren.Any()) { childrenDockMinHeight = orientableGroup.Orientation == Orientation.Vertical ? - visibleChildren.Sum(child => child.CalculatedDockMinHeight() + ((Root?.Manager?.GridSplitterHeight ?? 0) * (visibleChildren.Count - 1))) + visibleChildren.Sum(child => child.CalculatedDockMinHeight() + ((this.Root?.Manager?.GridSplitterHeight ?? 0) * (visibleChildren.Count - 1))) : visibleChildren.Max(child => child.CalculatedDockMinHeight()); } @@ -233,9 +233,9 @@ public double DockMinHeight { if (value == _dockMinHeight) return; MathHelper.AssertIsPositiveOrZero(value); - RaisePropertyChanging(nameof(DockMinHeight)); + RaisePropertyChanging(nameof(this.DockMinHeight)); _dockMinHeight = value; - RaisePropertyChanged(nameof(DockMinHeight)); + RaisePropertyChanged(nameof(this.DockMinHeight)); } } @@ -245,9 +245,9 @@ public double FloatingWidth set { if (value == _floatingWidth) return; - RaisePropertyChanging(nameof(FloatingWidth)); + RaisePropertyChanging(nameof(this.FloatingWidth)); _floatingWidth = value; - RaisePropertyChanged(nameof(FloatingWidth)); + RaisePropertyChanged(nameof(this.FloatingWidth)); } } @@ -257,9 +257,9 @@ public double FloatingHeight set { if (_floatingHeight == value) return; - RaisePropertyChanging(nameof(FloatingHeight)); + RaisePropertyChanging(nameof(this.FloatingHeight)); _floatingHeight = value; - RaisePropertyChanged(nameof(FloatingHeight)); + RaisePropertyChanged(nameof(this.FloatingHeight)); } } @@ -269,9 +269,9 @@ public double FloatingLeft set { if (value == _floatingLeft) return; - RaisePropertyChanging(nameof(FloatingLeft)); + RaisePropertyChanging(nameof(this.FloatingLeft)); _floatingLeft = value; - RaisePropertyChanged(nameof(FloatingLeft)); + RaisePropertyChanged(nameof(this.FloatingLeft)); } } @@ -281,9 +281,9 @@ public double FloatingTop set { if (value == _floatingTop) return; - RaisePropertyChanging(nameof(FloatingTop)); + RaisePropertyChanging(nameof(this.FloatingTop)); _floatingTop = value; - RaisePropertyChanged(nameof(FloatingTop)); + RaisePropertyChanged(nameof(this.FloatingTop)); } } @@ -294,7 +294,7 @@ public bool IsMaximized { if (value == _isMaximized) return; _isMaximized = value; - RaisePropertyChanged(nameof(IsMaximized)); + RaisePropertyChanged(nameof(this.IsMaximized)); } } @@ -322,31 +322,31 @@ double ILayoutPositionableElementWithActualSize.ActualHeight public override void WriteXml(System.Xml.XmlWriter writer) { - if (DockWidth.Value != 1.0 || !DockWidth.IsStar) - writer.WriteAttributeString(nameof(DockWidth), _gridLengthConverter.ConvertToInvariantString(DockWidth.IsAbsolute ? new GridLength(FixedDockWidth) : DockWidth)); - if (DockHeight.Value != 1.0 || !DockHeight.IsStar) - writer.WriteAttributeString(nameof(DockHeight), _gridLengthConverter.ConvertToInvariantString(DockHeight.IsAbsolute ? new GridLength(FixedDockHeight) : DockHeight)); - if (DockMinWidth != 25.0) writer.WriteAttributeString(nameof(DockMinWidth), DockMinWidth.ToString(CultureInfo.InvariantCulture)); - if (DockMinHeight != 25.0) writer.WriteAttributeString(nameof(DockMinHeight), DockMinHeight.ToString(CultureInfo.InvariantCulture)); - if (FloatingWidth != 0.0) writer.WriteAttributeString(nameof(FloatingWidth), FloatingWidth.ToString(CultureInfo.InvariantCulture)); - if (FloatingHeight != 0.0) writer.WriteAttributeString(nameof(FloatingHeight), FloatingHeight.ToString(CultureInfo.InvariantCulture)); - if (FloatingLeft != 0.0) writer.WriteAttributeString(nameof(FloatingLeft), FloatingLeft.ToString(CultureInfo.InvariantCulture)); - if (FloatingTop != 0.0) writer.WriteAttributeString(nameof(FloatingTop), FloatingTop.ToString(CultureInfo.InvariantCulture)); - if (IsMaximized) writer.WriteAttributeString(nameof(IsMaximized), IsMaximized.ToString()); + if (this.DockWidth.Value != 1.0 || !this.DockWidth.IsStar) + writer.WriteAttributeString(nameof(this.DockWidth), _gridLengthConverter.ConvertToInvariantString(this.DockWidth.IsAbsolute ? new GridLength(this.FixedDockWidth) : this.DockWidth)); + if (this.DockHeight.Value != 1.0 || !this.DockHeight.IsStar) + writer.WriteAttributeString(nameof(this.DockHeight), _gridLengthConverter.ConvertToInvariantString(this.DockHeight.IsAbsolute ? new GridLength(this.FixedDockHeight) : this.DockHeight)); + if (this.DockMinWidth != 25.0) writer.WriteAttributeString(nameof(this.DockMinWidth), this.DockMinWidth.ToString(CultureInfo.InvariantCulture)); + if (this.DockMinHeight != 25.0) writer.WriteAttributeString(nameof(this.DockMinHeight), this.DockMinHeight.ToString(CultureInfo.InvariantCulture)); + if (this.FloatingWidth != 0.0) writer.WriteAttributeString(nameof(this.FloatingWidth), this.FloatingWidth.ToString(CultureInfo.InvariantCulture)); + if (this.FloatingHeight != 0.0) writer.WriteAttributeString(nameof(this.FloatingHeight), this.FloatingHeight.ToString(CultureInfo.InvariantCulture)); + if (this.FloatingLeft != 0.0) writer.WriteAttributeString(nameof(this.FloatingLeft), this.FloatingLeft.ToString(CultureInfo.InvariantCulture)); + if (this.FloatingTop != 0.0) writer.WriteAttributeString(nameof(this.FloatingTop), this.FloatingTop.ToString(CultureInfo.InvariantCulture)); + if (this.IsMaximized) writer.WriteAttributeString(nameof(this.IsMaximized), this.IsMaximized.ToString()); base.WriteXml(writer); } public override void ReadXml(System.Xml.XmlReader reader) { - if (reader.MoveToAttribute(nameof(DockWidth))) _dockWidth = (GridLength)_gridLengthConverter.ConvertFromInvariantString(reader.Value); - if (reader.MoveToAttribute(nameof(DockHeight))) _dockHeight = (GridLength)_gridLengthConverter.ConvertFromInvariantString(reader.Value); - if (reader.MoveToAttribute(nameof(DockMinWidth))) _dockMinWidth = double.Parse(reader.Value, CultureInfo.InvariantCulture); - if (reader.MoveToAttribute(nameof(DockMinHeight))) _dockMinHeight = double.Parse(reader.Value, CultureInfo.InvariantCulture); - if (reader.MoveToAttribute(nameof(FloatingWidth))) _floatingWidth = double.Parse(reader.Value, CultureInfo.InvariantCulture); - if (reader.MoveToAttribute(nameof(FloatingHeight))) _floatingHeight = double.Parse(reader.Value, CultureInfo.InvariantCulture); - if (reader.MoveToAttribute(nameof(FloatingLeft))) _floatingLeft = double.Parse(reader.Value, CultureInfo.InvariantCulture); - if (reader.MoveToAttribute(nameof(FloatingTop))) _floatingTop = double.Parse(reader.Value, CultureInfo.InvariantCulture); - if (reader.MoveToAttribute(nameof(IsMaximized))) _isMaximized = bool.Parse(reader.Value); + if (reader.MoveToAttribute(nameof(this.DockWidth))) _dockWidth = (GridLength)_gridLengthConverter.ConvertFromInvariantString(reader.Value); + if (reader.MoveToAttribute(nameof(this.DockHeight))) _dockHeight = (GridLength)_gridLengthConverter.ConvertFromInvariantString(reader.Value); + if (reader.MoveToAttribute(nameof(this.DockMinWidth))) _dockMinWidth = double.Parse(reader.Value, CultureInfo.InvariantCulture); + if (reader.MoveToAttribute(nameof(this.DockMinHeight))) _dockMinHeight = double.Parse(reader.Value, CultureInfo.InvariantCulture); + if (reader.MoveToAttribute(nameof(this.FloatingWidth))) _floatingWidth = double.Parse(reader.Value, CultureInfo.InvariantCulture); + if (reader.MoveToAttribute(nameof(this.FloatingHeight))) _floatingHeight = double.Parse(reader.Value, CultureInfo.InvariantCulture); + if (reader.MoveToAttribute(nameof(this.FloatingLeft))) _floatingLeft = double.Parse(reader.Value, CultureInfo.InvariantCulture); + if (reader.MoveToAttribute(nameof(this.FloatingTop))) _floatingTop = double.Parse(reader.Value, CultureInfo.InvariantCulture); + if (reader.MoveToAttribute(nameof(this.IsMaximized))) _isMaximized = bool.Parse(reader.Value); base.ReadXml(reader); } diff --git a/Source/Controls/H.Controls.Dock/Layout/LayoutRoot.cs b/Source/Controls/H.Controls.Dock/Layout/LayoutRoot.cs index 133a7dd4..6ae61975 100644 --- a/Source/Controls/H.Controls.Dock/Layout/LayoutRoot.cs +++ b/Source/Controls/H.Controls.Dock/Layout/LayoutRoot.cs @@ -64,11 +64,11 @@ public class LayoutRoot : LayoutElement, ILayoutContainer, ILayoutRoot, IXmlSeri /// Standard class constructor public LayoutRoot() { - RightSide = new LayoutAnchorSide(); - LeftSide = new LayoutAnchorSide(); - TopSide = new LayoutAnchorSide(); - BottomSide = new LayoutAnchorSide(); - RootPanel = new LayoutPanel(new LayoutDocumentPane()); + this.RightSide = new LayoutAnchorSide(); + this.LeftSide = new LayoutAnchorSide(); + this.TopSide = new LayoutAnchorSide(); + this.BottomSide = new LayoutAnchorSide(); + this.RootPanel = new LayoutPanel(new LayoutDocumentPane()); } #endregion Constructors @@ -98,21 +98,21 @@ public LayoutPanel RootPanel set { if (_rootPanel == value) return; - RaisePropertyChanging(nameof(RootPanel)); - LayoutContent activeContent = ActiveContent; + RaisePropertyChanging(nameof(this.RootPanel)); + LayoutContent activeContent = this.ActiveContent; ILayoutRoot activeRoot = activeContent?.Root; if (_rootPanel != null && _rootPanel.Parent == this) _rootPanel.Parent = null; _rootPanel = value ?? new LayoutPanel(new LayoutDocumentPane()); _rootPanel.Parent = this; - if (ActiveContent == null && activeRoot == this && activeContent != null) + if (this.ActiveContent == null && activeRoot == this && activeContent != null) { - ActiveContent = activeContent; - if (ActiveContent != activeContent) + this.ActiveContent = activeContent; + if (this.ActiveContent != activeContent) { - ActiveContent = activeContent; + this.ActiveContent = activeContent; } } - RaisePropertyChanged(nameof(RootPanel)); + RaisePropertyChanged(nameof(this.RootPanel)); } } @@ -123,10 +123,10 @@ public LayoutAnchorSide TopSide set { if (_topSide == value) return; - RaisePropertyChanging(nameof(TopSide)); + RaisePropertyChanging(nameof(this.TopSide)); _topSide = value; if (_topSide != null) _topSide.Parent = this; - RaisePropertyChanged(nameof(TopSide)); + RaisePropertyChanged(nameof(this.TopSide)); } } @@ -137,10 +137,10 @@ public LayoutAnchorSide RightSide set { if (_rightSide == value) return; - RaisePropertyChanging(nameof(RightSide)); + RaisePropertyChanging(nameof(this.RightSide)); _rightSide = value; if (_rightSide != null) _rightSide.Parent = this; - RaisePropertyChanged(nameof(RightSide)); + RaisePropertyChanged(nameof(this.RightSide)); } } @@ -151,10 +151,10 @@ public LayoutAnchorSide LeftSide set { if (value == _leftSide) return; - RaisePropertyChanging(nameof(LeftSide)); + RaisePropertyChanging(nameof(this.LeftSide)); _leftSide = value; if (_leftSide != null) _leftSide.Parent = this; - RaisePropertyChanged(nameof(LeftSide)); + RaisePropertyChanged(nameof(this.LeftSide)); } } @@ -165,10 +165,10 @@ public LayoutAnchorSide BottomSide set { if (value == _bottomSide) return; - RaisePropertyChanging(nameof(BottomSide)); + RaisePropertyChanging(nameof(this.BottomSide)); _bottomSide = value; if (_bottomSide != null) _bottomSide.Parent = this; - RaisePropertyChanged(nameof(BottomSide)); + RaisePropertyChanged(nameof(this.BottomSide)); } } @@ -209,21 +209,21 @@ public IEnumerable Children { get { - if (RootPanel != null) - yield return RootPanel; + if (this.RootPanel != null) + yield return this.RootPanel; if (_floatingWindows != null) { foreach (LayoutFloatingWindow floatingWindow in _floatingWindows) yield return floatingWindow; } - if (TopSide != null) - yield return TopSide; - if (RightSide != null) - yield return RightSide; - if (BottomSide != null) - yield return BottomSide; - if (LeftSide != null) - yield return LeftSide; + if (this.TopSide != null) + yield return this.TopSide; + if (this.RightSide != null) + yield return this.RightSide; + if (this.BottomSide != null) + yield return this.BottomSide; + if (this.LeftSide != null) + yield return this.LeftSide; if (_hiddenAnchorables != null) { foreach (LayoutAnchorable hiddenAnchorable in _hiddenAnchorables) @@ -247,7 +247,7 @@ public LayoutContent ActiveContent } set { - LayoutContent currentValue = ActiveContent; + LayoutContent currentValue = this.ActiveContent; if (currentValue != value) { InternalSetActiveContent(currentValue, value); @@ -261,15 +261,15 @@ public LayoutContent LastFocusedDocument get => _lastFocusedDocument.GetValueOrDefault(); private set { - LayoutContent currentValue = LastFocusedDocument; + LayoutContent currentValue = this.LastFocusedDocument; if (currentValue != value) { - RaisePropertyChanging(nameof(LastFocusedDocument)); + RaisePropertyChanging(nameof(this.LastFocusedDocument)); if (currentValue != null) currentValue.IsLastFocusedDocument = false; _lastFocusedDocument = new WeakReference(value); - currentValue = LastFocusedDocument; + currentValue = this.LastFocusedDocument; if (currentValue != null) currentValue.IsLastFocusedDocument = true; - RaisePropertyChanged(nameof(LastFocusedDocument)); + RaisePropertyChanged(nameof(this.LastFocusedDocument)); } } } @@ -282,9 +282,9 @@ public DockingManager Manager internal set { if (value == _manager) return; - RaisePropertyChanging(nameof(Manager)); + RaisePropertyChanging(nameof(this.Manager)); _manager = value; - RaisePropertyChanged(nameof(Manager)); + RaisePropertyChanged(nameof(this.Manager)); } } @@ -298,18 +298,18 @@ public override void ConsoleDump(int tab) System.Diagnostics.Trace.Write(new string(' ', tab * 4)); System.Diagnostics.Trace.WriteLine("RootPanel()"); - RootPanel.ConsoleDump(tab + 1); + this.RootPanel.ConsoleDump(tab + 1); System.Diagnostics.Trace.Write(new string(' ', tab * 4)); System.Diagnostics.Trace.WriteLine("FloatingWindows()"); - foreach (LayoutFloatingWindow fw in FloatingWindows) + foreach (LayoutFloatingWindow fw in this.FloatingWindows) fw.ConsoleDump(tab + 1); System.Diagnostics.Trace.Write(new string(' ', tab * 4)); System.Diagnostics.Trace.WriteLine("Hidden()"); - foreach (LayoutAnchorable hidden in Hidden) + foreach (LayoutAnchorable hidden in this.Hidden) hidden.ConsoleDump(tab + 1); } #endif @@ -320,26 +320,26 @@ public override void ConsoleDump(int tab) public void RemoveChild(ILayoutElement element) { - if (element == RootPanel) - RootPanel = null; + if (element == this.RootPanel) + this.RootPanel = null; else if (_floatingWindows != null && _floatingWindows.Contains(element)) _floatingWindows.Remove(element as LayoutFloatingWindow); else if (_hiddenAnchorables != null && _hiddenAnchorables.Contains(element)) _hiddenAnchorables.Remove(element as LayoutAnchorable); - else if (element == TopSide) - TopSide = null; - else if (element == RightSide) - RightSide = null; - else if (element == BottomSide) - BottomSide = null; - else if (element == LeftSide) - LeftSide = null; + else if (element == this.TopSide) + this.TopSide = null; + else if (element == this.RightSide) + this.RightSide = null; + else if (element == this.BottomSide) + this.BottomSide = null; + else if (element == this.LeftSide) + this.LeftSide = null; } public void ReplaceChild(ILayoutElement oldElement, ILayoutElement newElement) { - if (oldElement == RootPanel) - RootPanel = (LayoutPanel)newElement; + if (oldElement == this.RootPanel) + this.RootPanel = (LayoutPanel)newElement; else if (_floatingWindows != null && _floatingWindows.Contains(oldElement)) { int index = _floatingWindows.IndexOf(oldElement as LayoutFloatingWindow); @@ -352,14 +352,14 @@ public void ReplaceChild(ILayoutElement oldElement, ILayoutElement newElement) _hiddenAnchorables.Remove(oldElement as LayoutAnchorable); _hiddenAnchorables.Insert(index, newElement as LayoutAnchorable); } - else if (oldElement == TopSide) - TopSide = (LayoutAnchorSide)newElement; - else if (oldElement == RightSide) - RightSide = (LayoutAnchorSide)newElement; - else if (oldElement == BottomSide) - BottomSide = (LayoutAnchorSide)newElement; - else if (oldElement == LeftSide) - LeftSide = (LayoutAnchorSide)newElement; + else if (oldElement == this.TopSide) + this.TopSide = (LayoutAnchorSide)newElement; + else if (oldElement == this.RightSide) + this.RightSide = (LayoutAnchorSide)newElement; + else if (oldElement == this.BottomSide) + this.BottomSide = (LayoutAnchorSide)newElement; + else if (oldElement == this.LeftSide) + this.LeftSide = (LayoutAnchorSide)newElement; } /// Removes any empty container not directly referenced by other layout items. @@ -437,13 +437,13 @@ public void CollectGarbage() { ILayoutContainer parentGroup = emptyLayoutDocumentPane.Parent; if (!(parentGroup.Parent is LayoutDocumentFloatingWindow)) continue; - int index = RootPanel.IndexOfChild(this.Descendents().OfType().First()); + int index = this.RootPanel.IndexOfChild(this.Descendents().OfType().First()); parentGroup.RemoveChild(emptyLayoutDocumentPane); if (!this.Descendents().OfType().Any()) { // Now the last Pane container is deleted, at least one is required for documents to be added. // We did not want to keep an empty window floating, but add a new one to the main window - RootPanel.Children.Insert(index < 0 ? 0 : index, emptyLayoutDocumentPane); + this.RootPanel.Children.Insert(index < 0 ? 0 : index, emptyLayoutDocumentPane); } exitFlag = false; break; @@ -553,7 +553,7 @@ public void CollectGarbage() Debug.Assert(!this.Descendents().OfType().Any(a => a.ChildrenCount == 0 && a.IsVisible)); //DumpTree(true); #if TRACE - RootPanel.ConsoleDump(4); + this.RootPanel.ConsoleDump(4); #endif #endif } @@ -576,27 +576,27 @@ void IXmlSerializable.ReadXml(XmlReader reader) List layoutPanelElements = ReadRootPanel(reader, out Orientation orientation, out bool canDock); if (layoutPanelElements != null) { - RootPanel = new LayoutPanel { Orientation = orientation, CanDock = canDock }; + this.RootPanel = new LayoutPanel { Orientation = orientation, CanDock = canDock }; //Add all children to RootPanel - foreach (ILayoutPanelElement panel in layoutPanelElements) RootPanel.Children.Add(panel); + foreach (ILayoutPanelElement panel in layoutPanelElements) this.RootPanel.Children.Add(panel); } - TopSide = new LayoutAnchorSide(); - if (ReadElement(reader) != null) FillLayoutAnchorSide(reader, TopSide); - RightSide = new LayoutAnchorSide(); - if (ReadElement(reader) != null) FillLayoutAnchorSide(reader, RightSide); - LeftSide = new LayoutAnchorSide(); - if (ReadElement(reader) != null) FillLayoutAnchorSide(reader, LeftSide); - BottomSide = new LayoutAnchorSide(); - if (ReadElement(reader) != null) FillLayoutAnchorSide(reader, BottomSide); + this.TopSide = new LayoutAnchorSide(); + if (ReadElement(reader) != null) FillLayoutAnchorSide(reader, this.TopSide); + this.RightSide = new LayoutAnchorSide(); + if (ReadElement(reader) != null) FillLayoutAnchorSide(reader, this.RightSide); + this.LeftSide = new LayoutAnchorSide(); + if (ReadElement(reader) != null) FillLayoutAnchorSide(reader, this.LeftSide); + this.BottomSide = new LayoutAnchorSide(); + if (ReadElement(reader) != null) FillLayoutAnchorSide(reader, this.BottomSide); - FloatingWindows.Clear(); + this.FloatingWindows.Clear(); List floatingWindows = ReadElementList(reader, true); - foreach (object floatingWindow in floatingWindows) FloatingWindows.Add((LayoutFloatingWindow)floatingWindow); + foreach (object floatingWindow in floatingWindows) this.FloatingWindows.Add((LayoutFloatingWindow)floatingWindow); - Hidden.Clear(); + this.Hidden.Clear(); List hidden = ReadElementList(reader, false); - foreach (object hiddenObject in hidden) Hidden.Add((LayoutAnchorable)hiddenObject); + foreach (object hiddenObject in hidden) this.Hidden.Add((LayoutAnchorable)hiddenObject); //Read the closing end element of LayoutRoot reader.ReadEndElement(); @@ -605,30 +605,30 @@ void IXmlSerializable.ReadXml(XmlReader reader) /// void IXmlSerializable.WriteXml(XmlWriter writer) { - writer.WriteStartElement(nameof(RootPanel)); - RootPanel?.WriteXml(writer); + writer.WriteStartElement(nameof(this.RootPanel)); + this.RootPanel?.WriteXml(writer); writer.WriteEndElement(); - writer.WriteStartElement(nameof(TopSide)); - TopSide?.WriteXml(writer); + writer.WriteStartElement(nameof(this.TopSide)); + this.TopSide?.WriteXml(writer); writer.WriteEndElement(); - writer.WriteStartElement(nameof(RightSide)); - RightSide?.WriteXml(writer); + writer.WriteStartElement(nameof(this.RightSide)); + this.RightSide?.WriteXml(writer); writer.WriteEndElement(); - writer.WriteStartElement(nameof(LeftSide)); - LeftSide?.WriteXml(writer); + writer.WriteStartElement(nameof(this.LeftSide)); + this.LeftSide?.WriteXml(writer); writer.WriteEndElement(); - writer.WriteStartElement(nameof(BottomSide)); - BottomSide?.WriteXml(writer); + writer.WriteStartElement(nameof(this.BottomSide)); + this.BottomSide?.WriteXml(writer); writer.WriteEndElement(); // Write all floating windows (can be LayoutDocumentFloatingWindow or LayoutAnchorableFloatingWindow). // To prevent "can not create instance of abstract type", the type is retrieved with GetType().Name - writer.WriteStartElement(nameof(FloatingWindows)); - foreach (LayoutFloatingWindow layoutFloatingWindow in FloatingWindows) + writer.WriteStartElement(nameof(this.FloatingWindows)); + foreach (LayoutFloatingWindow layoutFloatingWindow in this.FloatingWindows) { writer.WriteStartElement(layoutFloatingWindow.GetType().Name); layoutFloatingWindow.WriteXml(writer); @@ -636,8 +636,8 @@ void IXmlSerializable.WriteXml(XmlWriter writer) } writer.WriteEndElement(); - writer.WriteStartElement(nameof(Hidden)); - foreach (LayoutAnchorable layoutAnchorable in Hidden) + writer.WriteStartElement(nameof(this.Hidden)); + foreach (LayoutAnchorable layoutAnchorable in this.Hidden) { writer.WriteStartElement(layoutAnchorable.GetType().Name); layoutAnchorable.WriteXml(writer); @@ -676,10 +676,10 @@ internal static Type FindType(string name) internal void OnLayoutElementRemoved(LayoutElement element) { - if (element.Descendents().OfType().Any(c => c == LastFocusedDocument)) - LastFocusedDocument = null; - if (element.Descendents().OfType().Any(c => c == ActiveContent)) - ActiveContent = null; + if (element.Descendents().OfType().Any(c => c == this.LastFocusedDocument)) + this.LastFocusedDocument = null; + if (element.Descendents().OfType().Any(c => c == this.ActiveContent)) + this.ActiveContent = null; ElementRemoved?.Invoke(this, new LayoutElementEventArgs(element)); } @@ -718,12 +718,12 @@ private void _floatingWindows_CollectionChanged(object sender, System.Collection { case System.Collections.Specialized.NotifyCollectionChangedAction.Remove: case System.Collections.Specialized.NotifyCollectionChangedAction.Add: - RaisePropertyChanged(nameof(Children)); - RaisePropertyChanged(nameof(ChildrenCount)); + RaisePropertyChanged(nameof(this.Children)); + RaisePropertyChanged(nameof(this.ChildrenCount)); break; case System.Collections.Specialized.NotifyCollectionChangedAction.Replace: - RaisePropertyChanged(nameof(Children)); + RaisePropertyChanged(nameof(this.Children)); break; } } @@ -767,37 +767,37 @@ private void _hiddenAnchorables_CollectionChanged(object sender, System.Collecti { case System.Collections.Specialized.NotifyCollectionChangedAction.Remove: case System.Collections.Specialized.NotifyCollectionChangedAction.Add: - RaisePropertyChanged(nameof(Children)); - RaisePropertyChanged(nameof(ChildrenCount)); + RaisePropertyChanged(nameof(this.Children)); + RaisePropertyChanged(nameof(this.ChildrenCount)); break; case System.Collections.Specialized.NotifyCollectionChangedAction.Replace: - RaisePropertyChanged(nameof(Children)); + RaisePropertyChanged(nameof(this.Children)); break; } } private void InternalSetActiveContent(LayoutContent currentValue, LayoutContent newActiveContent) { - RaisePropertyChanging(nameof(ActiveContent)); + RaisePropertyChanging(nameof(this.ActiveContent)); if (currentValue != null && currentValue.IsActive) currentValue.IsActive = false; _activeContent = new WeakReference(newActiveContent); - currentValue = ActiveContent; + currentValue = this.ActiveContent; if (currentValue != null && !currentValue.IsActive) currentValue.IsActive = true; - RaisePropertyChanged(nameof(ActiveContent)); + RaisePropertyChanged(nameof(this.ActiveContent)); _activeContentSet = currentValue != null; if (currentValue != null) { if (currentValue.Parent is LayoutDocumentPane || currentValue is LayoutDocument) - LastFocusedDocument = currentValue; + this.LastFocusedDocument = currentValue; } else - LastFocusedDocument = null; + this.LastFocusedDocument = null; } private void UpdateActiveContentProperty() { - LayoutContent activeContent = ActiveContent; + LayoutContent activeContent = this.ActiveContent; if (_activeContentSet && (activeContent == null || activeContent.Root != this)) { _activeContentSet = false; @@ -844,7 +844,7 @@ private List ReadRootPanel(XmlReader reader while (reader.NodeType == XmlNodeType.Whitespace) reader.Read(); - if (reader.LocalName.Equals(nameof(RootPanel))) + if (reader.LocalName.Equals(nameof(this.RootPanel))) { orientation = (Orientation)Enum.Parse(typeof(Orientation), reader.GetAttribute(nameof(Orientation)), true); @@ -949,10 +949,10 @@ private object ReadElement(XmlReader reader) typeToSerialize = typeof(LayoutAnchorableFloatingWindow); break; - case nameof(LeftSide): - case nameof(RightSide): - case nameof(TopSide): - case nameof(BottomSide): + case nameof(this.LeftSide): + case nameof(this.RightSide): + case nameof(this.TopSide): + case nameof(this.BottomSide): if (reader.IsEmptyElement) { reader.Read(); diff --git a/Source/Controls/H.Controls.Dock/Layout/Serialization/LayoutSerializationCallbackEventArgs.cs b/Source/Controls/H.Controls.Dock/Layout/Serialization/LayoutSerializationCallbackEventArgs.cs index 2e8017f6..557d0c6c 100644 --- a/Source/Controls/H.Controls.Dock/Layout/Serialization/LayoutSerializationCallbackEventArgs.cs +++ b/Source/Controls/H.Controls.Dock/Layout/Serialization/LayoutSerializationCallbackEventArgs.cs @@ -24,9 +24,9 @@ public class LayoutSerializationCallbackEventArgs : CancelEventArgs /// The content if it was available in previous layout. public LayoutSerializationCallbackEventArgs(LayoutContent model, object previousContent) { - Cancel = false; // reloading an item is not by cancelled by default - Model = model; - Content = previousContent; + this.Cancel = false; // reloading an item is not by cancelled by default + this.Model = model; + this.Content = previousContent; } #endregion constructors diff --git a/Source/Controls/H.Controls.Dock/Layout/Serialization/LayoutSerializer.cs b/Source/Controls/H.Controls.Dock/Layout/Serialization/LayoutSerializer.cs index 05aeba39..623d2f02 100644 --- a/Source/Controls/H.Controls.Dock/Layout/Serialization/LayoutSerializer.cs +++ b/Source/Controls/H.Controls.Dock/Layout/Serialization/LayoutSerializer.cs @@ -22,9 +22,9 @@ public abstract class LayoutSerializer /// public LayoutSerializer(DockingManager manager) { - Manager = manager ?? throw new ArgumentNullException(nameof(manager)); - _previousAnchorables = Manager.Layout.Descendents().OfType().ToArray(); - _previousDocuments = Manager.Layout.Descendents().OfType().ToArray(); + this.Manager = manager ?? throw new ArgumentNullException(nameof(manager)); + _previousAnchorables = this.Manager.Layout.Descendents().OfType().ToArray(); + _previousDocuments = this.Manager.Layout.Descendents().OfType().ToArray(); } #endregion Constructors @@ -128,14 +128,14 @@ protected virtual void FixupLayout(LayoutRoot layout) protected void StartDeserialization() { - Manager.SuspendDocumentsSourceBinding = true; - Manager.SuspendAnchorablesSourceBinding = true; + this.Manager.SuspendDocumentsSourceBinding = true; + this.Manager.SuspendAnchorablesSourceBinding = true; } protected void EndDeserialization() { - Manager.SuspendDocumentsSourceBinding = false; - Manager.SuspendAnchorablesSourceBinding = false; + this.Manager.SuspendDocumentsSourceBinding = false; + this.Manager.SuspendAnchorablesSourceBinding = false; } #endregion Methods diff --git a/Source/Controls/H.Controls.Dock/Layout/Serialization/XmlLayoutSerializer.cs b/Source/Controls/H.Controls.Dock/Layout/Serialization/XmlLayoutSerializer.cs index e90cf522..b5266685 100644 --- a/Source/Controls/H.Controls.Dock/Layout/Serialization/XmlLayoutSerializer.cs +++ b/Source/Controls/H.Controls.Dock/Layout/Serialization/XmlLayoutSerializer.cs @@ -44,7 +44,7 @@ private void DeserializeCommon(DeserializeFunction function) StartDeserialization(); LayoutRoot layout = function(); FixupLayout(layout); - Manager.Layout = layout; + this.Manager.Layout = layout; } finally { @@ -61,21 +61,21 @@ private void DeserializeCommon(DeserializeFunction function) /// public void Serialize(XmlWriter writer) { - _serializer.Serialize(writer, Manager.Layout); + _serializer.Serialize(writer, this.Manager.Layout); } /// Serialize the layout into a . /// public void Serialize(TextWriter writer) { - _serializer.Serialize(writer, Manager.Layout); + _serializer.Serialize(writer, this.Manager.Layout); } /// Serialize the layout into a . /// public void Serialize(Stream stream) { - _serializer.Serialize(stream, Manager.Layout); + _serializer.Serialize(stream, this.Manager.Layout); } /// Serialize the layout into a file using a . diff --git a/Source/Controls/H.Controls.Dock/LayoutFloatingWindowControlClosedEventArgs.cs b/Source/Controls/H.Controls.Dock/LayoutFloatingWindowControlClosedEventArgs.cs index 6bd343e5..a0900e4d 100644 --- a/Source/Controls/H.Controls.Dock/LayoutFloatingWindowControlClosedEventArgs.cs +++ b/Source/Controls/H.Controls.Dock/LayoutFloatingWindowControlClosedEventArgs.cs @@ -7,7 +7,7 @@ public sealed class LayoutFloatingWindowControlClosedEventArgs : EventArgs { public LayoutFloatingWindowControlClosedEventArgs(LayoutFloatingWindowControl layoutFloatingWindowControl) { - LayoutFloatingWindowControl = layoutFloatingWindowControl; + this.LayoutFloatingWindowControl = layoutFloatingWindowControl; } public LayoutFloatingWindowControl LayoutFloatingWindowControl { get; } diff --git a/Source/Controls/H.Controls.Dock/LayoutFloatingWindowControlCreatedEventArgs.cs b/Source/Controls/H.Controls.Dock/LayoutFloatingWindowControlCreatedEventArgs.cs index 3bd35c2e..5f1dee8a 100644 --- a/Source/Controls/H.Controls.Dock/LayoutFloatingWindowControlCreatedEventArgs.cs +++ b/Source/Controls/H.Controls.Dock/LayoutFloatingWindowControlCreatedEventArgs.cs @@ -7,7 +7,7 @@ public sealed class LayoutFloatingWindowControlCreatedEventArgs : EventArgs { public LayoutFloatingWindowControlCreatedEventArgs(LayoutFloatingWindowControl layoutFloatingWindowControl) { - LayoutFloatingWindowControl = layoutFloatingWindowControl; + this.LayoutFloatingWindowControl = layoutFloatingWindowControl; } public LayoutFloatingWindowControl LayoutFloatingWindowControl { get; } diff --git a/Source/Controls/H.Controls.Dock/Win32Helper.cs b/Source/Controls/H.Controls.Dock/Win32Helper.cs index fcf42d60..81074f92 100644 --- a/Source/Controls/H.Controls.Dock/Win32Helper.cs +++ b/Source/Controls/H.Controls.Dock/Win32Helper.cs @@ -265,7 +265,7 @@ public Size Size { get { - return new Size(Width, Height); + return new Size(this.Width, this.Height); } } @@ -290,7 +290,7 @@ public static RECT FromRectangle(Rect rectangle) public override int GetHashCode() { - return Left ^ ((Top << 13) | (Top >> 0x13)) ^ ((Width << 0x1a) | (Width >> 6)) ^ ((Height << 7) | (Height >> 0x19)); + return Left ^ ((Top << 13) | (Top >> 0x13)) ^ ((this.Width << 0x1a) | (this.Width >> 6)) ^ ((this.Height << 7) | (this.Height >> 0x19)); } #region Operator overloads diff --git a/Source/Controls/H.Controls.FavoriteBox/FavoriteBox.xaml.cs b/Source/Controls/H.Controls.FavoriteBox/FavoriteBox.xaml.cs index 6568f6e8..b77f4650 100644 --- a/Source/Controls/H.Controls.FavoriteBox/FavoriteBox.xaml.cs +++ b/Source/Controls/H.Controls.FavoriteBox/FavoriteBox.xaml.cs @@ -1,7 +1,5 @@ using H.Extensions.Tree; using H.Providers.Mvvm; -using System; -using System.Collections; using System.Collections.Generic; using System.Linq; using System.Windows; @@ -24,7 +22,7 @@ public FavoriteBox() bingding.Executed += (s, e) => { this.SelectNone(); - }; + }; bingding.CanExecute += (l, k) => { k.CanExecute = this.SelectedItem != null; @@ -127,7 +125,7 @@ protected override void OnSelectedItemChanged(RoutedPropertyChangedEventArgs + bingding.CanExecute += (l, k) => { k.CanExecute = this.SelectedItem != null; }; @@ -174,7 +172,7 @@ public bool IsMatch(object obj) var value = property.GetValue(model); if (value == null) return false; - if (this._favoriteBox.SelectedItem is TreeNodeBase node &&node.Model is IFavoriteItem favorite) + if (this._favoriteBox.SelectedItem is TreeNodeBase node && node.Model is IFavoriteItem favorite) { return value.Equals(favorite.Path); } diff --git a/Source/Controls/H.Controls.FavoriteBox/FavoritesPresenter.xaml.cs b/Source/Controls/H.Controls.FavoriteBox/FavoritesPresenter.xaml.cs index 4845d7ac..9fc7d42c 100644 --- a/Source/Controls/H.Controls.FavoriteBox/FavoritesPresenter.xaml.cs +++ b/Source/Controls/H.Controls.FavoriteBox/FavoritesPresenter.xaml.cs @@ -1,5 +1,4 @@ using H.Providers.Mvvm; -using System; using System.Collections.ObjectModel; namespace H.Controls.FavoriteBox diff --git a/Source/Controls/H.Controls.FavoriteBox/Service/FavoriteOptions.cs b/Source/Controls/H.Controls.FavoriteBox/Service/FavoriteOptions.cs index cb59ed83..7278b014 100644 --- a/Source/Controls/H.Controls.FavoriteBox/Service/FavoriteOptions.cs +++ b/Source/Controls/H.Controls.FavoriteBox/Service/FavoriteOptions.cs @@ -3,8 +3,6 @@ using System.Collections.ObjectModel; using System.ComponentModel; using System.ComponentModel.DataAnnotations; -using System.Text.Json.Serialization; -using System.Xml.Serialization; namespace H.Controls.FavoriteBox { diff --git a/Source/Controls/H.Controls.FavoriteBox/Service/FavoriteService.cs b/Source/Controls/H.Controls.FavoriteBox/Service/FavoriteService.cs index fc1dadb4..e40aa936 100644 --- a/Source/Controls/H.Controls.FavoriteBox/Service/FavoriteService.cs +++ b/Source/Controls/H.Controls.FavoriteBox/Service/FavoriteService.cs @@ -24,7 +24,7 @@ public FavoriteService(IOptions options) public virtual void Add(params IFavoriteItem[] ts) { - if(this.Collection is IList list) + if (this.Collection is IList list) { foreach (var item in ts.OfType()) { @@ -44,7 +44,7 @@ public virtual void Delete(params IFavoriteItem[] ts) var favorites = ts.OfType(); foreach (var t in favorites) { - if(this.Collection is IList list) + if (this.Collection is IList list) list.Remove(t); } this.CollectionChanged?.Invoke(this, EventArgs.Empty); diff --git a/Source/Controls/H.Controls.FavoriteBox/Service/IFavoriteService.cs b/Source/Controls/H.Controls.FavoriteBox/Service/IFavoriteService.cs index 24ee2265..90f0064a 100644 --- a/Source/Controls/H.Controls.FavoriteBox/Service/IFavoriteService.cs +++ b/Source/Controls/H.Controls.FavoriteBox/Service/IFavoriteService.cs @@ -1,5 +1,4 @@ -using H.Extensions.Tree; -using H.Providers.Ioc; +using H.Providers.Ioc; namespace H.Controls.FavoriteBox { diff --git a/Source/Controls/H.Controls.FilterBox/FilterBox.xaml.cs b/Source/Controls/H.Controls.FilterBox/FilterBox.xaml.cs index 75008ef2..2961ad28 100644 --- a/Source/Controls/H.Controls.FilterBox/FilterBox.xaml.cs +++ b/Source/Controls/H.Controls.FilterBox/FilterBox.xaml.cs @@ -1,10 +1,8 @@ using H.Providers.Ioc; using System; using System.Collections; -using System.Collections.Generic; using System.Collections.ObjectModel; using System.Linq; -using System.Reflection; using System.Windows; using System.Windows.Controls; diff --git a/Source/Controls/H.Controls.FilterBox/PropertyFilterBox/PropertyConfidtion.cs b/Source/Controls/H.Controls.FilterBox/PropertyFilterBox/PropertyConfidtion.cs index 7893ca44..95b11260 100644 --- a/Source/Controls/H.Controls.FilterBox/PropertyFilterBox/PropertyConfidtion.cs +++ b/Source/Controls/H.Controls.FilterBox/PropertyFilterBox/PropertyConfidtion.cs @@ -18,7 +18,7 @@ public PropertyConfidtion() public PropertyConfidtion(PropertyInfo propertyInfo) { - Filter = FilterFactory.Create(propertyInfo, null) as IPropertyFilter; + this.Filter = FilterFactory.Create(propertyInfo, null) as IPropertyFilter; } private IPropertyFilter _filter; @@ -39,7 +39,7 @@ public IPropertyFilter Filter if (l is SelectionChangedEventArgs arg) { if (arg.AddedItems[0] is PropertyInfo info) - Filter = FilterFactory.Create(info, null) as IPropertyFilter; + this.Filter = FilterFactory.Create(info, null) as IPropertyFilter; } }); @@ -48,9 +48,9 @@ public bool IsMatch(object obj) { if (obj == null) return false; - if(obj is IModelBindable mv) - return Filter.IsMatch(mv.GetModel()); - return Filter.IsMatch(obj); + if (obj is IModelBindable mv) + return this.Filter.IsMatch(mv.GetModel()); + return this.Filter.IsMatch(obj); } } } diff --git a/Source/Controls/H.Controls.FilterBox/PropertyFilterBox/PropertyConfidtionPrensenter.xaml.cs b/Source/Controls/H.Controls.FilterBox/PropertyFilterBox/PropertyConfidtionPrensenter.xaml.cs index fa2eb093..e1eaa04d 100644 --- a/Source/Controls/H.Controls.FilterBox/PropertyFilterBox/PropertyConfidtionPrensenter.xaml.cs +++ b/Source/Controls/H.Controls.FilterBox/PropertyFilterBox/PropertyConfidtionPrensenter.xaml.cs @@ -27,9 +27,9 @@ public PropertyConfidtionPrensenter(Type modelTyle, Func pre { ObservableCollection ps = modelTyle.GetProperties().Where(x => x.PropertyType.IsPrimitive || x.PropertyType == typeof(DateTime) || x.PropertyType == typeof(string)).ToObservable(); if (predicate != null) - Properties = ps.Where(predicate).ToObservable(); + this.Properties = ps.Where(predicate).ToObservable(); else - Properties = ps.ToObservable(); + this.Properties = ps.ToObservable(); } private ObservableCollection _conditions = new ObservableCollection(); @@ -60,18 +60,18 @@ public ConditionOperate ConditionOperate [XmlIgnore] public RelayCommand AddConditionCommand => new RelayCommand(l => { - PropertyInfo first = Properties.FirstOrDefault(); + PropertyInfo first = this.Properties.FirstOrDefault(); PropertyConfidtion confidtion = new PropertyConfidtion(first); confidtion.Filter.IsSelected = true; - Conditions.Add(confidtion); + this.Conditions.Add(confidtion); }); [JsonIgnore] [XmlIgnore] public RelayCommand ClearConditionCommand => new RelayCommand(l => { - Conditions.Clear(); - }, l => Conditions.Count > 0); + this.Conditions.Clear(); + }, l => this.Conditions.Count > 0); [JsonIgnore] [XmlIgnore] @@ -95,13 +95,13 @@ public ObservableCollection Properties public bool IsMatch(object obj) { - if (ConditionOperate == ConditionOperate.All) - return Conditions.All(x => x.IsMatch(obj)); - if (ConditionOperate == ConditionOperate.Any) - return Conditions.Any(x => x.IsMatch(obj)); - if (ConditionOperate == ConditionOperate.AnyNot) - return Conditions.Any(x => !x.IsMatch(obj)); - return !Conditions.All(x => x.IsMatch(obj)); + if (this.ConditionOperate == ConditionOperate.All) + return this.Conditions.All(x => x.IsMatch(obj)); + if (this.ConditionOperate == ConditionOperate.Any) + return this.Conditions.Any(x => x.IsMatch(obj)); + if (this.ConditionOperate == ConditionOperate.AnyNot) + return this.Conditions.Any(x => !x.IsMatch(obj)); + return !this.Conditions.All(x => x.IsMatch(obj)); } [JsonIgnore] @@ -111,12 +111,12 @@ public bool IsMatch(object obj) public bool Save(out string message) { message = null; - if (string.IsNullOrEmpty(ID)) + if (string.IsNullOrEmpty(this.ID)) { message = "ID为空"; return false; } - MetaSettingService?.Serilize(this, ID); + this.MetaSettingService?.Serilize(this, this.ID); return true; } @@ -125,9 +125,9 @@ public void Load() { if (_isLoaded) return; - if (string.IsNullOrEmpty(ID)) + if (string.IsNullOrEmpty(this.ID)) return; - PropertyConfidtionPrensenter find = MetaSettingService?.Deserilize(ID); + PropertyConfidtionPrensenter find = this.MetaSettingService?.Deserilize(this.ID); if (find == null) return; @@ -137,9 +137,9 @@ public void Load() PropertyConfidtion pc = new PropertyConfidtion(); //item.Filter.PropertyInfo = propertyInfo; pc.Filter = item.Filter; - Conditions.Add(pc); + this.Conditions.Add(pc); } - ConditionOperate = find.ConditionOperate; + this.ConditionOperate = find.ConditionOperate; _isLoaded = true; } } diff --git a/Source/Controls/H.Controls.FilterBox/PropertyFilterBox/PropertyConfidtionsPrensenter.xaml.cs b/Source/Controls/H.Controls.FilterBox/PropertyFilterBox/PropertyConfidtionsPrensenter.xaml.cs index ec4cc56d..67d814b7 100644 --- a/Source/Controls/H.Controls.FilterBox/PropertyFilterBox/PropertyConfidtionsPrensenter.xaml.cs +++ b/Source/Controls/H.Controls.FilterBox/PropertyFilterBox/PropertyConfidtionsPrensenter.xaml.cs @@ -24,9 +24,9 @@ public PropertyConfidtionsPrensenter(Type modelTyle, Func pr { ObservableCollection ps = modelTyle.GetProperties().Where(x => x.PropertyType.IsPrimitive || x.PropertyType == typeof(DateTime) || x.PropertyType == typeof(string)).ToObservable(); if (predicate != null) - Properties = ps.Where(predicate).ToObservable(); + this.Properties = ps.Where(predicate).ToObservable(); else - Properties = ps.ToObservable(); + this.Properties = ps.ToObservable(); } private ObservableCollection _properties = new ObservableCollection(); @@ -83,38 +83,38 @@ public int SelectedIndex public RelayCommand AddCommand => new RelayCommand(l => { PropertyConfidtionPrensenter item = new PropertyConfidtionPrensenter() { ID = DateTime.Now.ToString("yyyyMMddHHmmssfff") }; - item.Properties = Properties; + item.Properties = this.Properties; item.Load(); - PropertyConfidtions.Add(item); - if (SelectedItem == null) - SelectedItem = item; + this.PropertyConfidtions.Add(item); + if (this.SelectedItem == null) + this.SelectedItem = item; }); [JsonIgnore] [XmlIgnore] public RelayCommand ClearSelectionCommand => new RelayCommand(l => { - SelectedItem = null; + this.SelectedItem = null; this.Save(out string message); - }, x => SelectedItem != null); + }, x => this.SelectedItem != null); public bool IsMatch(object obj) { - if (SelectedItem == null) + if (this.SelectedItem == null) return true; - return SelectedItem.IsMatch(obj); + return this.SelectedItem.IsMatch(obj); } public bool Save(out string message) { message = null; - if (string.IsNullOrEmpty(ID)) + if (string.IsNullOrEmpty(this.ID)) { message = "ID为空"; return false; } - SelectedIndex = PropertyConfidtions.IndexOf(SelectedItem); - MetaSettingService?.Serilize(this, ID); + this.SelectedIndex = this.PropertyConfidtions.IndexOf(this.SelectedItem); + this.MetaSettingService?.Serilize(this, this.ID); return true; } @@ -127,16 +127,16 @@ public void Load() { if (_loaded == true) return; - PropertyConfidtionsPrensenter find = MetaSettingService?.Deserilize(ID); + PropertyConfidtionsPrensenter find = this.MetaSettingService?.Deserilize(this.ID); if (find == null) return; - PropertyConfidtions = find.PropertyConfidtions; + this.PropertyConfidtions = find.PropertyConfidtions; if (find.SelectedIndex >= 0) - SelectedItem = find.PropertyConfidtions[find.SelectedIndex]; + this.SelectedItem = find.PropertyConfidtions[find.SelectedIndex]; foreach (PropertyConfidtionPrensenter item in find.PropertyConfidtions) { - item.Properties = Properties; + item.Properties = this.Properties; foreach (IPropertyConfidtion confidtion in item.Conditions) { PropertyInfo propertyInfo = item.Properties.FirstOrDefault(x => x.Name == confidtion.Filter.Name); diff --git a/Source/Controls/H.Controls.FilterBox/PropertyFilterBox/PropertyFilterBox.xaml.cs b/Source/Controls/H.Controls.FilterBox/PropertyFilterBox/PropertyFilterBox.xaml.cs index e7c95006..d91f5d73 100644 --- a/Source/Controls/H.Controls.FilterBox/PropertyFilterBox/PropertyFilterBox.xaml.cs +++ b/Source/Controls/H.Controls.FilterBox/PropertyFilterBox/PropertyFilterBox.xaml.cs @@ -34,8 +34,8 @@ static PropertyFilterBox() public PropertyFilterBox() { - Filter = new PropertyFilterBoxFilter(this); - ID = GetType().Name; + this.Filter = new PropertyFilterBoxFilter(this); + this.ID = GetType().Name; } public string ID { get; set; } @@ -44,13 +44,13 @@ public override void OnApplyTemplate() { base.OnApplyTemplate(); - _button = Template.FindName("PART_Button", this) as Button; + _button = this.Template.FindName("PART_Button", this) as Button; _button.Click += (l, k) => { ShowConfig(); }; - _selector = Template.FindName("PART_Selector", this) as Selector; + _selector = this.Template.FindName("PART_Selector", this) as Selector; _selector.SelectionChanged += (l, k) => { if (l is Popup popup && popup.IsOpen == false) @@ -184,11 +184,11 @@ private void RefreshType(Type type) return; Func predicate = x => { - return PropertyNames?.Split(',').Contains(x.Name) != false; + return this.PropertyNames?.Split(',').Contains(x.Name) != false; }; _propertyConfidtions = new PropertyConfidtionsPrensenter(type, predicate) { - ID = ID + ID = this.ID }; _propertyConfidtions.Load(); this.OnFilterChanged(); @@ -213,7 +213,7 @@ public async void ShowConfig() private void Save() { _propertyConfidtions.Save(out string message); - Filter = new PropertyFilterBoxFilter(this); + this.Filter = new PropertyFilterBoxFilter(this); this.OnFilterChanged(); } diff --git a/Source/Controls/H.Controls.FilterBox/TextBlockFilterCountBehavior.cs b/Source/Controls/H.Controls.FilterBox/TextBlockFilterCountBehavior.cs index 977e0de1..b87e94d5 100644 --- a/Source/Controls/H.Controls.FilterBox/TextBlockFilterCountBehavior.cs +++ b/Source/Controls/H.Controls.FilterBox/TextBlockFilterCountBehavior.cs @@ -19,7 +19,7 @@ public IDisplayFilter DisplayFilter set { SetValue(DisplayFilterProperty, value); } } - + public static readonly DependencyProperty DisplayFilterProperty = DependencyProperty.Register("DisplayFilter", typeof(IDisplayFilter), typeof(TextBlockFilterCountBehavior), new FrameworkPropertyMetadata(default(IDisplayFilter), (d, e) => { @@ -66,7 +66,7 @@ public string Header set { SetValue(HeaderProperty, value); } } - + public static readonly DependencyProperty HeaderProperty = DependencyProperty.Register("Header", typeof(string), typeof(TextBlockFilterCountBehavior), new FrameworkPropertyMetadata("合计:", (d, e) => { @@ -92,7 +92,7 @@ public string Format set { SetValue(FormatProperty, value); } } - + public static readonly DependencyProperty FormatProperty = DependencyProperty.Register("Format", typeof(string), typeof(TextBlockFilterCountBehavior), new FrameworkPropertyMetadata("[{0}] {1}", (d, e) => { diff --git a/Source/Controls/H.Controls.FilterBox/TextBlockFiltersCountBehavior.cs b/Source/Controls/H.Controls.FilterBox/TextBlockFiltersCountBehavior.cs index 5d5e5d42..c407dc20 100644 --- a/Source/Controls/H.Controls.FilterBox/TextBlockFiltersCountBehavior.cs +++ b/Source/Controls/H.Controls.FilterBox/TextBlockFiltersCountBehavior.cs @@ -50,7 +50,7 @@ public string Header set { SetValue(HeaderProperty, value); } } - + public static readonly DependencyProperty HeaderProperty = DependencyProperty.Register("Header", typeof(string), typeof(TextBlockFiltersCountBehavior), new FrameworkPropertyMetadata("合计:", (d, e) => { @@ -77,7 +77,7 @@ public string Format set { SetValue(FormatProperty, value); } } - + public static readonly DependencyProperty FormatProperty = DependencyProperty.Register("Format", typeof(string), typeof(TextBlockFiltersCountBehavior), new FrameworkPropertyMetadata("[{0}] {1}", (d, e) => { @@ -104,7 +104,7 @@ public ConditionOperate ConditionOperate set { SetValue(ConditionOperateProperty, value); } } - + public static readonly DependencyProperty ConditionOperateProperty = DependencyProperty.Register("ConditionOperate", typeof(ConditionOperate), typeof(TextBlockFiltersCountBehavior), new FrameworkPropertyMetadata(ConditionOperate.All, (d, e) => { diff --git a/Source/Controls/H.Controls.FilterColumnDataGrid/FilterColumnDataGrid.xaml.cs b/Source/Controls/H.Controls.FilterColumnDataGrid/FilterColumnDataGrid.xaml.cs index 4bef82db..7f947f6a 100644 --- a/Source/Controls/H.Controls.FilterColumnDataGrid/FilterColumnDataGrid.xaml.cs +++ b/Source/Controls/H.Controls.FilterColumnDataGrid/FilterColumnDataGrid.xaml.cs @@ -15,7 +15,6 @@ using System.Windows.Data; using System.Windows.Input; using System.Windows.Threading; -using H.Controls.FilterColumnDataGrid; namespace H.Controls.FilterColumnDataGrid { public class FilterColumnDataGrid : DataGrid, INotifyPropertyChanged @@ -24,13 +23,13 @@ public class FilterColumnDataGrid : DataGrid, INotifyPropertyChanged public FilterColumnDataGrid() { - CommandBindings.Add(new CommandBinding(ShowFilter, ShowFilterCommand, CanShowFilter)); - CommandBindings.Add(new CommandBinding(ApplyFilter, ApplyFilterCommand, CanApplyFilter)); // Ok - CommandBindings.Add(new CommandBinding(CancelFilter, CancelFilterCommand)); - CommandBindings.Add(new CommandBinding(RemoveFilter, RemoveFilterCommand, CanRemoveFilter)); - CommandBindings.Add(new CommandBinding(IsChecked, CheckedAllCommand)); - CommandBindings.Add(new CommandBinding(ClearSearchBox, ClearSearchBoxClick)); - CommandBindings.Add(new CommandBinding(RemoveAllFilter, RemoveAllFilterCommand, CanRemoveAllFilter)); + this.CommandBindings.Add(new CommandBinding(ShowFilter, ShowFilterCommand, CanShowFilter)); + this.CommandBindings.Add(new CommandBinding(ApplyFilter, ApplyFilterCommand, CanApplyFilter)); // Ok + this.CommandBindings.Add(new CommandBinding(CancelFilter, CancelFilterCommand)); + this.CommandBindings.Add(new CommandBinding(RemoveFilter, RemoveFilterCommand, CanRemoveFilter)); + this.CommandBindings.Add(new CommandBinding(IsChecked, CheckedAllCommand)); + this.CommandBindings.Add(new CommandBinding(ClearSearchBox, ClearSearchBoxClick)); + this.CommandBindings.Add(new CommandBinding(RemoveAllFilter, RemoveAllFilterCommand, CanRemoveAllFilter)); this.Loaded += (l, k) => { @@ -149,7 +148,7 @@ public bool StartsWith OnPropertyChanged(); // refresh filter - if (!string.IsNullOrEmpty(searchText)) ItemCollectionView.Refresh(); + if (!string.IsNullOrEmpty(searchText)) this.ItemCollectionView.Refresh(); } } @@ -216,10 +215,10 @@ public bool PersistentFilter private IEnumerable PopupViewItems => - ItemCollectionView?.OfType().Where(c => c.Level != 0) ?? new List(); + this.ItemCollectionView?.OfType().Where(c => c.Level != 0) ?? new List(); private IEnumerable SourcePopupViewItems => - ItemCollectionView?.SourceCollection.OfType().Where(c => c.Level != 0) ?? + this.ItemCollectionView?.SourceCollection.OfType().Where(c => c.Level != 0) ?? new List(); #endregion Private Properties @@ -231,8 +230,8 @@ protected override void OnInitialized(EventArgs e) try { - if (AutoGenerateColumns) - excludedFields = ExcludeFields.Split(',').Select(p => p.Trim()).ToList(); + if (this.AutoGenerateColumns) + excludedFields = this.ExcludeFields.Split(',').Select(p => p.Trim()).ToList(); Sorted += OnSorted; Loaded += OnLoaded; } @@ -257,14 +256,14 @@ protected override void OnAutoGeneratingColumn(DataGridAutoGeneratingColumnEvent var column = new DataGridTextColumn { - Binding = new Binding(e.PropertyName) { ConverterCulture = Translate.Culture /* StringFormat */ }, + Binding = new Binding(e.PropertyName) { ConverterCulture = this.Translate.Culture /* StringFormat */ }, FieldName = e.PropertyName, Header = e.Column.Header.ToString(), IsColumnFiltered = false }; fieldType = Nullable.GetUnderlyingType(e.PropertyType) ?? e.PropertyType; - if (fieldType == typeof(DateTime) && !string.IsNullOrEmpty(DateFormatString)) - column.Binding.StringFormat = DateFormatString; + if (fieldType == typeof(DateTime) && !string.IsNullOrEmpty(this.DateFormatString)) + column.Binding.StringFormat = this.DateFormatString; if (!fieldType.IsSystemType()) { column.CanUserSort = false; @@ -321,13 +320,13 @@ protected override void OnItemsSourceChanged(IEnumerable oldValue, IEnumerable n if (oldValue != null) { - CurrentFilter = null; - GlobalFilterList.Clear(); + this.CurrentFilter = null; + this.GlobalFilterList.Clear(); criteria.Clear(); if (oldValue is INotifyCollectionChanged) ((INotifyCollectionChanged)oldValue).CollectionChanged -= ItemSource_CollectionChanged; - CollectionViewSource = System.Windows.Data.CollectionViewSource.GetDefaultView(new object()); + this.CollectionViewSource = System.Windows.Data.CollectionViewSource.GetDefaultView(new object()); var scrollViewer = GetTemplateChild("DG_ScrollViewer") as ScrollViewer; scrollViewer?.ScrollToTop(); } @@ -335,12 +334,12 @@ protected override void OnItemsSourceChanged(IEnumerable oldValue, IEnumerable n if (newValue is INotifyCollectionChanged) ((INotifyCollectionChanged)newValue).CollectionChanged += ItemSource_CollectionChanged; - CollectionViewSource = System.Windows.Data.CollectionViewSource.GetDefaultView(ItemsSource); - if (CollectionViewSource.CanFilter) CollectionViewSource.Filter = Filter; + this.CollectionViewSource = System.Windows.Data.CollectionViewSource.GetDefaultView(this.ItemsSource); + if (this.CollectionViewSource.CanFilter) this.CollectionViewSource.Filter = Filter; - ItemsSourceCount = Items.Count; + this.ItemsSourceCount = this.Items.Count; //ElapsedTime = new TimeSpan(0, 0, 0); - OnPropertyChanged(nameof(ItemsSourceCount)); + OnPropertyChanged(nameof(this.ItemsSourceCount)); // Calculate row header width //if (ShowRowsCount) @@ -374,13 +373,13 @@ protected override void OnItemsSourceChanged(IEnumerable oldValue, IEnumerable n // set name of persistent filter json file // The name of the file is defined by the "Name" property of the FilterDatGrid, otherwise // the name of the source collection type is used - if (PersistentFilter && this.CollectionType != null) + if (this.PersistentFilter && this.CollectionType != null) { - fileName = !string.IsNullOrEmpty(Name) ? $"{Name}.json" : $"{this.CollectionType?.Name}.json"; + fileName = !string.IsNullOrEmpty(this.Name) ? $"{this.Name}.json" : $"{this.CollectionType?.Name}.json"; } // generating custom columns - if (!AutoGenerateColumns && this.CollectionType != null) GeneratingCustomsColumn(); + if (!this.AutoGenerateColumns && this.CollectionType != null) GeneratingCustomsColumn(); } catch (Exception ex) { @@ -482,7 +481,7 @@ private void OnFilterPresetChanged(List filterPreset) // set cursor Mouse.OverrideCursor = Cursors.Wait; - if (GlobalFilterList.Count > 0) + if (this.GlobalFilterList.Count > 0) RemoveAllFilterCommand(null, null); // reset previous elapsed time @@ -491,7 +490,7 @@ private void OnFilterPresetChanged(List filterPreset) foreach (var preset in filterPreset) { - var columns = Columns + var columns = this.Columns .Where(c => (c is DataGridTextColumn dtx && dtx.IsColumnFiltered & dtx.FieldName == preset.FieldName) || c is DataGridTemplateColumn dtp && dtp.IsColumnFiltered & dtp.FieldName == preset.FieldName @@ -526,20 +525,20 @@ object ConvertDateTime(object o) } preset.FieldType = fieldType; - preset.Translate = Translate; + preset.Translate = this.Translate; preset.FilterButton = filterButton; if (filterButton != null) FilterState.SetIsFiltered(filterButton, true); preset.AddFilter(criteria); - if (GlobalFilterList.All(f => f.FieldName != preset.FieldName)) - GlobalFilterList.Add(preset); + if (this.GlobalFilterList.All(f => f.FieldName != preset.FieldName)) + this.GlobalFilterList.Add(preset); lastFilter = preset.FieldName; - CollectionViewSource.Refresh(); + this.CollectionViewSource.Refresh(); } } - if (Items.Count == 0) + if (this.Items.Count == 0) { RemoveAllFilterCommand(null, null); SavePreset(); @@ -554,7 +553,7 @@ private async void Serialize() { await Task.Run(() => { - var result = JsonConvert.Serialize(fileName, GlobalFilterList); + var result = JsonConvert.Serialize(fileName, this.GlobalFilterList); }); } private async void DeSerialize() @@ -564,7 +563,7 @@ await Task.Run(() => var result = JsonConvert.Deserialize>(fileName); if (result == null) return; - Dispatcher.BeginInvoke((Action)(() => { OnFilterPresetChanged(result); }), + this.Dispatcher.BeginInvoke((Action)(() => { OnFilterPresetChanged(result); }), DispatcherPriority.Normal); }); } @@ -577,7 +576,7 @@ private List BuildTree(IEnumerable dates) { new FilterItemDate { - Label = Translate.All, Level = 0, Initialize = true, FieldType = fieldType + Label = this.Translate.All, Level = 0, Initialize = true, FieldType = fieldType } }; @@ -596,7 +595,7 @@ private List BuildTree(IEnumerable dates) { Level = 1, Content = year.Key, - Label = year.FirstOrDefault()?.Date.ToString("yyyy", Translate.Culture), + Label = year.FirstOrDefault()?.Date.ToString("yyyy", this.Translate.Culture), Initialize = true, FieldType = fieldType, @@ -605,7 +604,7 @@ private List BuildTree(IEnumerable dates) { Level = 2, Content = month.Key, - Label = month.FirstOrDefault()?.Date.ToString("MMMM", Translate.Culture), + Label = month.FirstOrDefault()?.Date.ToString("MMMM", this.Translate.Culture), Initialize = true, FieldType = fieldType, @@ -614,7 +613,7 @@ private List BuildTree(IEnumerable dates) { Level = 3, Content = day.Key, - Label = day.FirstOrDefault()?.Date.ToString("dd", Translate.Culture), + Label = day.FirstOrDefault()?.Date.ToString("dd", this.Translate.Culture), Initialize = true, FieldType = fieldType, Item = day.FirstOrDefault()?.Item, @@ -648,7 +647,7 @@ private List BuildTree(IEnumerable dates) tree.Add( new FilterItemDate { - Label = Translate.Empty, + Label = this.Translate.Empty, Content = null, Level = -1, FieldType = fieldType, @@ -673,7 +672,7 @@ private void GeneratingCustomsColumn() { try { - var columns = Columns + var columns = this.Columns .Where(c => (c is DataGridTextColumn dtx && dtx.IsColumnFiltered) || (c is DataGridTemplateColumn dtp && dtp.IsColumnFiltered) || (c is DataGridCheckBoxColumn dcb && dcb.IsColumnFiltered) @@ -701,11 +700,11 @@ private void GeneratingCustomsColumn() if (fieldProperty != null) fieldType = Nullable.GetUnderlyingType(fieldProperty.PropertyType) ?? fieldProperty.PropertyType; - if (fieldType == typeof(DateTime) && !string.IsNullOrEmpty(DateFormatString)) + if (fieldType == typeof(DateTime) && !string.IsNullOrEmpty(this.DateFormatString)) if (string.IsNullOrEmpty(column.Binding.StringFormat)) - column.Binding.StringFormat = DateFormatString; + column.Binding.StringFormat = this.DateFormatString; if (((Binding)column.Binding).ConverterCulture == null) - ((Binding)column.Binding).ConverterCulture = Translate.Culture; + ((Binding)column.Binding).ConverterCulture = this.Translate.Culture; column.FieldName = ((Binding)column.Binding).Path.Path; } @@ -719,7 +718,7 @@ private void GeneratingCustomsColumn() var column = (DataGridCheckBoxColumn)col; column.FieldName = ((Binding)column.Binding).Path.Path; if (((Binding)column.Binding).ConverterCulture == null) - ((Binding)column.Binding).ConverterCulture = Translate.Culture; + ((Binding)column.Binding).ConverterCulture = this.Translate.Culture; column.HeaderTemplate = this.DataGridHeaderTemplate; } } @@ -739,7 +738,7 @@ private void OnSorted(object sender, EventArgs e) private async void ResetCursor() { - await Dispatcher.BeginInvoke((Action)(() => { Mouse.OverrideCursor = null; }), + await this.Dispatcher.BeginInvoke((Action)(() => { Mouse.OverrideCursor = null; }), DispatcherPriority.ContextIdle); } @@ -752,10 +751,10 @@ private void CanApplyFilter(object sender, CanExecuteRoutedEventArgs e) else { if (search) - e.CanExecute = PopupViewItems.Any(f => f?.IsChecked == true); + e.CanExecute = this.PopupViewItems.Any(f => f?.IsChecked == true); else - e.CanExecute = PopupViewItems.Any(f => f.IsChanged) && - PopupViewItems.Any(f => f?.IsChecked == true); + e.CanExecute = this.PopupViewItems.Any(f => f.IsChanged) && + this.PopupViewItems.Any(f => f?.IsChecked == true); } } @@ -767,25 +766,25 @@ private void CancelFilterCommand(object sender, ExecutedRoutedEventArgs e) private void CanRemoveAllFilter(object sender, CanExecuteRoutedEventArgs e) { - e.CanExecute = GlobalFilterList.Count > 0; + e.CanExecute = this.GlobalFilterList.Count > 0; } private void CanRemoveFilter(object sender, CanExecuteRoutedEventArgs e) { - e.CanExecute = CurrentFilter?.IsFiltered ?? false; + e.CanExecute = this.CurrentFilter?.IsFiltered ?? false; } private void CanShowFilter(object sender, CanExecuteRoutedEventArgs e) { - e.CanExecute = CollectionViewSource?.CanFilter == true && (!popup?.IsOpen ?? true) && !pending; + e.CanExecute = this.CollectionViewSource?.CanFilter == true && (!popup?.IsOpen ?? true) && !pending; } private void CheckedAllCommand(object sender, ExecutedRoutedEventArgs e) { var item = (FilterItem)e.Parameter; - if (item?.Level != 0 || ItemCollectionView == null) return; + if (item?.Level != 0 || this.ItemCollectionView == null) return; - foreach (var obj in PopupViewItems.ToList() + foreach (var obj in this.PopupViewItems.ToList() .Where(f => f.IsChecked != item.IsChecked)) obj.IsChecked = item.IsChecked; } @@ -809,7 +808,7 @@ private void OnPropertyChanged([CallerMemberName] string propertyName = null) private void OnResizeThumbDragCompleted(object sender, DragCompletedEventArgs e) { - Cursor = cursor; + this.Cursor = cursor; } private void OnResizeThumbDragDelta(object sender, DragDeltaEventArgs e) @@ -831,16 +830,16 @@ private void OnResizeThumbDragDelta(object sender, DragDeltaEventArgs e) } private void OnResizeThumbDragStarted(object sender, DragStartedEventArgs e) { - cursor = Cursor; - Cursor = Cursors.SizeNWSE; + cursor = this.Cursor; + this.Cursor = Cursors.SizeNWSE; } private void PopupClosed(object sender, EventArgs e) { var pop = (Popup)sender; if (!pending) { - ItemCollectionView = System.Windows.Data.CollectionViewSource.GetDefaultView(new object()); - CurrentFilter = null; + this.ItemCollectionView = System.Windows.Data.CollectionViewSource.GetDefaultView(new object()); + this.CurrentFilter = null; ResetCursor(); } pop.Closed -= PopupClosed; @@ -852,10 +851,10 @@ private void PopupClosed(object sender, EventArgs e) sizableContentGrid.Width = sizableContentWidth; sizableContentGrid.Height = sizableContentHeight; - Cursor = cursor; + this.Cursor = cursor; - ListBoxItems = new List(); - TreeViewItems = new List(); + this.ListBoxItems = new List(); + this.TreeViewItems = new List(); searchText = string.Empty; search = false; @@ -865,10 +864,10 @@ private void PopupClosed(object sender, EventArgs e) private void RemoveAllFilterCommand(object sender, ExecutedRoutedEventArgs e) { //ElapsedTime = new TimeSpan(0, 0, 0); - if (GlobalFilterList.Count == 0) + if (this.GlobalFilterList.Count == 0) return; - var columns = Columns + var columns = this.Columns .Where(c => (c is DataGridTextColumn dtx && dtx.IsColumnFiltered) || c is DataGridTemplateColumn dtp && dtp.IsColumnFiltered @@ -884,10 +883,10 @@ private void RemoveAllFilterCommand(object sender, ExecutedRoutedEventArgs e) } criteria.Clear(); - GlobalFilterList.Clear(); - ItemCollectionView = System.Windows.Data.CollectionViewSource.GetDefaultView(new object()); - CollectionViewSource.Refresh(); - if (PersistentFilter) + this.GlobalFilterList.Clear(); + this.ItemCollectionView = System.Windows.Data.CollectionViewSource.GetDefaultView(new object()); + this.CollectionViewSource.Refresh(); + if (this.PersistentFilter) SavePreset(); } @@ -896,29 +895,29 @@ private void RemoveAllFilterCommand(object sender, ExecutedRoutedEventArgs e) /// private void RemoveCurrentFilter() { - if (CurrentFilter == null) + if (this.CurrentFilter == null) return; popup.IsOpen = false; - FilterState.SetIsFiltered(CurrentFilter.FilterButton, false); + FilterState.SetIsFiltered(this.CurrentFilter.FilterButton, false); //ElapsedTime = new TimeSpan(0, 0, 0); stopWatchFilter = Stopwatch.StartNew(); Mouse.OverrideCursor = Cursors.Wait; - if (CurrentFilter.IsFiltered && criteria.Remove(CurrentFilter.FieldName)) - CollectionViewSource.Refresh(); + if (this.CurrentFilter.IsFiltered && criteria.Remove(this.CurrentFilter.FieldName)) + this.CollectionViewSource.Refresh(); - if (GlobalFilterList.Contains(CurrentFilter)) - _ = GlobalFilterList.Remove(CurrentFilter); - lastFilter = GlobalFilterList.LastOrDefault()?.FieldName; + if (this.GlobalFilterList.Contains(this.CurrentFilter)) + _ = this.GlobalFilterList.Remove(this.CurrentFilter); + lastFilter = this.GlobalFilterList.LastOrDefault()?.FieldName; - CurrentFilter.IsFiltered = false; - CurrentFilter = null; + this.CurrentFilter.IsFiltered = false; + this.CurrentFilter = null; ResetCursor(); - if (PersistentFilter) + if (this.PersistentFilter) SavePreset(); stopWatchFilter.Stop(); @@ -935,36 +934,36 @@ private bool SearchFilter(object obj) var item = (FilterItem)obj; if (string.IsNullOrEmpty(searchText) || item == null || item.Level == 0) return true; - var content = Convert.ToString(item.Content, Translate.Culture); - if (!StartsWith) - return Translate.Culture.CompareInfo.IndexOf(content ?? string.Empty, searchText, + var content = Convert.ToString(item.Content, this.Translate.Culture); + if (!this.StartsWith) + return this.Translate.Culture.CompareInfo.IndexOf(content ?? string.Empty, searchText, CompareOptions.OrdinalIgnoreCase) >= 0; if (searchLength > item.ContentLength) return false; - return Translate.Culture.CompareInfo.IndexOf(content ?? string.Empty, searchText, 0, searchLength, + return this.Translate.Culture.CompareInfo.IndexOf(content ?? string.Empty, searchText, 0, searchLength, CompareOptions.OrdinalIgnoreCase) >= 0; } private void SearchTextBoxOnTextChanged(object sender, TextChangedEventArgs e) { var textBox = (TextBox)sender; - if (textBox == null || textBox.Text == searchText || ItemCollectionView == null) + if (textBox == null || textBox.Text == searchText || this.ItemCollectionView == null) return; e.Handled = true; searchText = textBox.Text; searchLength = searchText.Length; search = !string.IsNullOrEmpty(searchText); - ItemCollectionView.Refresh(); - if (CurrentFilter.FieldType != typeof(DateTime) || treeView == null) + this.ItemCollectionView.Refresh(); + if (this.CurrentFilter.FieldType != typeof(DateTime) || treeView == null) return; if (string.IsNullOrEmpty(searchText)) { - TreeViewItems = BuildTree(SourcePopupViewItems); + this.TreeViewItems = BuildTree(this.SourcePopupViewItems); } else { - var items = PopupViewItems.Where(i => i.IsChecked).ToList(); - TreeViewItems = BuildTree(items.Any() ? items : null); + var items = this.PopupViewItems.Where(i => i.IsChecked).ToList(); + this.TreeViewItems = BuildTree(items.Any() ? items : null); } } @@ -978,7 +977,7 @@ private async void ShowFilterCommand(object sender, ExecutedRoutedEventArgs e) try { button = (Button)e.OriginalSource; - if (Items.Count == 0 || button == null) + if (this.Items.Count == 0 || button == null) return; _ = CommitEdit(DataGridEditingUnit.Row, true); var header = VisualTreeHelpers.FindAncestor(button); @@ -1023,13 +1022,13 @@ private async void ShowFilterCommand(object sender, ExecutedRoutedEventArgs e) fieldType = null; var fieldProperty = this.CollectionType.GetPropertyInfo(fieldName); if (fieldProperty != null) - FieldType = Nullable.GetUnderlyingType(fieldProperty.PropertyType) ?? fieldProperty.PropertyType; - CurrentFilter = GlobalFilterList.FirstOrDefault(f => f.FieldName == fieldName) ?? + this.FieldType = Nullable.GetUnderlyingType(fieldProperty.PropertyType) ?? fieldProperty.PropertyType; + this.CurrentFilter = this.GlobalFilterList.FirstOrDefault(f => f.FieldName == fieldName) ?? new FilterCommon { FieldName = fieldName, FieldType = fieldType, - Translate = Translate, + Translate = this.Translate, FilterButton = button }; var sourceObjectList = new List(); @@ -1037,22 +1036,22 @@ private async void ShowFilterCommand(object sender, ExecutedRoutedEventArgs e) List filterItemList = null; await Task.Run(() => { - Dispatcher.Invoke(() => + this.Dispatcher.Invoke(() => { if (fieldType == typeof(DateTime)) - sourceObjectList = Items.Cast() + sourceObjectList = this.Items.Cast() .Select(x => (object)((DateTime?)x.GetPropertyValue(fieldName))?.Date) .Distinct() .ToList(); else - sourceObjectList = Items.Cast() + sourceObjectList = this.Items.Cast() .Select(x => x.GetPropertyValue(fieldName)) .Distinct() .ToList(); }); - if (lastFilter == CurrentFilter.FieldName) - sourceObjectList.AddRange(CurrentFilter?.PreviouslyFilteredItems ?? new HashSet()); + if (lastFilter == this.CurrentFilter.FieldName) + sourceObjectList.AddRange(this.CurrentFilter?.PreviouslyFilteredItems ?? new HashSet()); var emptyItem = sourceObjectList.RemoveAll(v => v == null || v.Equals(string.Empty)) > 0; sourceObjectList = sourceObjectList.AsParallel().OrderBy(x => x).ToList(); @@ -1064,7 +1063,7 @@ await Task.Run(() => { filterItemList = new List(sourceObjectList.Count + 2) { - new FilterItem { Label = Translate.All, IsChecked = true, Level = 0 } + new FilterItem { Label = this.Translate.All, IsChecked = true, Level = 0 } }; } filterItemList.AddRange(sourceObjectList.Select(item => new FilterItem @@ -1074,13 +1073,13 @@ await Task.Run(() => FieldType = fieldType, Label = item, Level = 1, - Initialize = CurrentFilter.PreviouslyFilteredItems?.Contains(item) == false + Initialize = this.CurrentFilter.PreviouslyFilteredItems?.Contains(item) == false })); if (fieldType == typeof(bool)) filterItemList.ToList().ForEach(c => { - c.Label = (bool)c.Content ? Translate.IsTrue : Translate.IsFalse; + c.Label = (bool)c.Content ? this.Translate.IsTrue : this.Translate.IsFalse; }); if (!emptyItem) return; @@ -1090,18 +1089,18 @@ await Task.Run(() => { FieldType = fieldType, Content = null, - Label = fieldType == typeof(bool) ? Translate.Indeterminate : Translate.Empty, + Label = fieldType == typeof(bool) ? this.Translate.Indeterminate : this.Translate.Empty, Level = -1, - Initialize = CurrentFilter?.PreviouslyFilteredItems?.Contains(null) == false + Initialize = this.CurrentFilter?.PreviouslyFilteredItems?.Contains(null) == false }); }); if (fieldType == typeof(DateTime)) - TreeViewItems = BuildTree(filterItemList); + this.TreeViewItems = BuildTree(filterItemList); else - ListBoxItems = filterItemList; - ItemCollectionView = System.Windows.Data.CollectionViewSource.GetDefaultView(filterItemList); - if (ItemCollectionView.CanFilter) ItemCollectionView.Filter = SearchFilter; + this.ListBoxItems = filterItemList; + this.ItemCollectionView = System.Windows.Data.CollectionViewSource.GetDefaultView(filterItemList); + if (this.ItemCollectionView.CanFilter) this.ItemCollectionView.Filter = SearchFilter; PopupPlacement(sizableContentGrid, header); popup.UpdateLayout(); popup.IsOpen = true; @@ -1132,21 +1131,21 @@ private async void ApplyFilterCommand(object sender, ExecutedRoutedEventArgs e) { await Task.Run(() => { - var previousFiltered = CurrentFilter.PreviouslyFilteredItems; + var previousFiltered = this.CurrentFilter.PreviouslyFilteredItems; var blankIsChanged = new FilterItem(); if (search) { blankIsChanged.IsChecked = false; blankIsChanged.IsChanged = !previousFiltered.Any(c => c != null && c.Equals(string.Empty)); - var searchResult = PopupViewItems.Where(c => c.IsChecked).ToList(); - var uncheckedItems = SourcePopupViewItems.Except(searchResult).ToList(); + var searchResult = this.PopupViewItems.Where(c => c.IsChecked).ToList(); + var uncheckedItems = this.SourcePopupViewItems.Except(searchResult).ToList(); uncheckedItems.AddRange(searchResult.Where(c => c.IsChecked == false)); previousFiltered.ExceptWith(searchResult.Select(c => c.Content)); previousFiltered.UnionWith(uncheckedItems.Select(c => c.Content)); } else { - var changedItems = PopupViewItems.Where(c => c.IsChanged).ToList(); + var changedItems = this.PopupViewItems.Where(c => c.IsChanged).ToList(); var checkedItems = changedItems.Where(c => c.IsChecked); var uncheckedItems = changedItems.Where(c => !c.IsChecked).ToList(); previousFiltered.ExceptWith(checkedItems.Select(c => c.Content)); @@ -1155,23 +1154,23 @@ await Task.Run(() => blankIsChanged.IsChanged = changedItems.Any(c => c.Level == -1); } - if (blankIsChanged.IsChanged && CurrentFilter.FieldType == typeof(string)) + if (blankIsChanged.IsChanged && this.CurrentFilter.FieldType == typeof(string)) { if (blankIsChanged.IsChecked == false) previousFiltered.Add(string.Empty); else if (blankIsChanged.IsChecked && previousFiltered.Any(c => c?.ToString() == string.Empty)) previousFiltered.RemoveWhere(item => item?.ToString() == string.Empty); } - if (!CurrentFilter.IsFiltered) CurrentFilter.AddFilter(criteria); - if (GlobalFilterList.All(f => f.FieldName != CurrentFilter.FieldName)) - GlobalFilterList.Add(CurrentFilter); - lastFilter = CurrentFilter.FieldName; + if (!this.CurrentFilter.IsFiltered) this.CurrentFilter.AddFilter(criteria); + if (this.GlobalFilterList.All(f => f.FieldName != this.CurrentFilter.FieldName)) + this.GlobalFilterList.Add(this.CurrentFilter); + lastFilter = this.CurrentFilter.FieldName; }); - CollectionViewSource.Refresh(); - FilterState.SetIsFiltered(CurrentFilter.FilterButton, CurrentFilter?.IsFiltered ?? false); - if (CurrentFilter != null && !CurrentFilter.PreviouslyFilteredItems.Any()) + this.CollectionViewSource.Refresh(); + FilterState.SetIsFiltered(this.CurrentFilter.FilterButton, this.CurrentFilter?.IsFiltered ?? false); + if (this.CurrentFilter != null && !this.CurrentFilter.PreviouslyFilteredItems.Any()) RemoveCurrentFilter(); - else if (PersistentFilter) + else if (this.PersistentFilter) Serialize(); } catch (Exception ex) @@ -1182,9 +1181,9 @@ await Task.Run(() => finally { ResetCursor(); - ItemCollectionView = System.Windows.Data.CollectionViewSource.GetDefaultView(new object()); + this.ItemCollectionView = System.Windows.Data.CollectionViewSource.GetDefaultView(new object()); pending = false; - CurrentFilter = null; + this.CurrentFilter = null; stopWatchFilter.Stop(); //ElapsedTime = stopWatchFilter.Elapsed; @@ -1233,11 +1232,11 @@ private void PopupPlacement(FrameworkElement grid, FrameworkElement header) private void ItemSource_CollectionChanged(object sender, NotifyCollectionChangedEventArgs e) { - ItemsSourceCount = Items.Count; - OnPropertyChanged(nameof(ItemsSourceCount)); - for (int i = 0; i < Items.Count; i++) + this.ItemsSourceCount = this.Items.Count; + OnPropertyChanged(nameof(this.ItemsSourceCount)); + for (int i = 0; i < this.Items.Count; i++) { - if (ItemContainerGenerator.ContainerFromIndex(i) is DataGridRow row) + if (this.ItemContainerGenerator.ContainerFromIndex(i) is DataGridRow row) { row.Header = $"{i + 1}"; } diff --git a/Source/Controls/H.Controls.FilterColumnDataGrid/Provider/FilterCommon.cs b/Source/Controls/H.Controls.FilterColumnDataGrid/Provider/FilterCommon.cs index 3c8e4b4c..d79f6387 100644 --- a/Source/Controls/H.Controls.FilterColumnDataGrid/Provider/FilterCommon.cs +++ b/Source/Controls/H.Controls.FilterColumnDataGrid/Provider/FilterCommon.cs @@ -19,7 +19,7 @@ public sealed class FilterCommon : NotifyProperty public FilterCommon() { - PreviouslyFilteredItems = new HashSet(EqualityComparer.Default); + this.PreviouslyFilteredItems = new HashSet(EqualityComparer.Default); } #endregion Public Constructors @@ -41,7 +41,7 @@ public bool IsFiltered set { isFiltered = value; - OnPropertyChanged(nameof(IsFiltered)); + OnPropertyChanged(nameof(this.IsFiltered)); } } @@ -50,19 +50,19 @@ public bool IsFiltered #region Public Methods public void AddFilter(Dictionary> criteria) { - if (IsFiltered) + if (this.IsFiltered) return; bool Predicate(object o) { - var value = FieldType == typeof(DateTime) - ? ((DateTime?)o.GetPropertyValue(FieldName))?.Date - : o.GetPropertyValue(FieldName); + var value = this.FieldType == typeof(DateTime) + ? ((DateTime?)o.GetPropertyValue(this.FieldName))?.Date + : o.GetPropertyValue(this.FieldName); - return !PreviouslyFilteredItems.Contains(value); + return !this.PreviouslyFilteredItems.Contains(value); } - criteria.Add(FieldName, Predicate); + criteria.Add(this.FieldName, Predicate); - IsFiltered = true; + this.IsFiltered = true; } #endregion Public Methods diff --git a/Source/Controls/H.Controls.FilterColumnDataGrid/Provider/FilterItem.cs b/Source/Controls/H.Controls.FilterColumnDataGrid/Provider/FilterItem.cs index 327d3b32..b65120ce 100644 --- a/Source/Controls/H.Controls.FilterColumnDataGrid/Provider/FilterItem.cs +++ b/Source/Controls/H.Controls.FilterColumnDataGrid/Provider/FilterItem.cs @@ -48,8 +48,8 @@ public bool IsChecked set { isChecked = value; - IsChanged = value != initialState; - OnPropertyChanged(nameof(IsChecked)); + this.IsChanged = value != initialState; + OnPropertyChanged(nameof(this.IsChecked)); } } public object Label { get; set; } @@ -113,29 +113,29 @@ private void SetIsChecked(bool? value, bool updateChildren, bool updateParent) if (value == isChecked) return; isChecked = value; - IsChanged = initialState != isChecked; - if (Item != null) + this.IsChanged = initialState != isChecked; + if (this.Item != null) { - Item.IsChanged = IsChanged; - Item.Initialize = IsChecked == true; + this.Item.IsChanged = this.IsChanged; + this.Item.Initialize = this.IsChecked == true; } - if (Level == 0) - Tree?.Skip(1).ToList().ForEach(c => { c.SetIsChecked(value, true, true); }); - if (updateChildren && isChecked.HasValue && Level > 0) - Children?.ForEach(c => { c.SetIsChecked(value, true, false); }); + if (this.Level == 0) + this.Tree?.Skip(1).ToList().ForEach(c => { c.SetIsChecked(value, true, true); }); + if (updateChildren && isChecked.HasValue && this.Level > 0) + this.Children?.ForEach(c => { c.SetIsChecked(value, true, false); }); - if (updateParent) Parent?.VerifyCheckedState(); + if (updateParent) this.Parent?.VerifyCheckedState(); - OnPropertyChanged(nameof(IsChecked)); + OnPropertyChanged(nameof(this.IsChecked)); } private void VerifyCheckedState() { bool? b = null; - for (var i = 0; i < Children.Count; ++i) + for (var i = 0; i < this.Children.Count; ++i) { - var item = Children[i]; + var item = this.Children[i]; var current = item.IsChecked; if (i == 0) diff --git a/Source/Controls/H.Controls.FilterColumnDataGrid/Provider/Loc.cs b/Source/Controls/H.Controls.FilterColumnDataGrid/Provider/Loc.cs index b09fa3dd..c408cfa2 100644 --- a/Source/Controls/H.Controls.FilterColumnDataGrid/Provider/Loc.cs +++ b/Source/Controls/H.Controls.FilterColumnDataGrid/Provider/Loc.cs @@ -124,16 +124,16 @@ public class Loc public Loc() { language = Local.English; - SelectedLanguage = English; + this.SelectedLanguage = English; } #endregion Public Constructors #region Public Properties - public CultureInfo Culture => SelectedLanguage.Culture; - public string DisplayName => SelectedLanguage.Culture.DisplayName; - public string EnglishName => SelectedLanguage.Language; + public CultureInfo Culture => this.SelectedLanguage.Culture; + public string DisplayName => this.SelectedLanguage.Culture.DisplayName; + public string EnglishName => this.SelectedLanguage.Language; public Local Language { @@ -148,7 +148,7 @@ public Local Language BindingFlags.Static | BindingFlags.NonPublic); if (propertyInfo == null) return; - SelectedLanguage = (ILanguageDictionary)propertyInfo.GetValue(null); + this.SelectedLanguage = (ILanguageDictionary)propertyInfo.GetValue(null); } } @@ -161,7 +161,7 @@ public Local Language /// /// /// - private string Translate(TranslatableElements key) => SelectedLanguage == null ? "unknow" : SelectedLanguage.Dictionary[key]; + private string Translate(TranslatableElements key) => this.SelectedLanguage == null ? "unknow" : this.SelectedLanguage.Dictionary[key]; #endregion Private Methods @@ -471,9 +471,9 @@ internal class LanguageDictionary : ILanguageDictionary public LanguageDictionary(string language, CultureInfo culture, Dictionary dictionary) { - Language = language; - Culture = culture; - Dictionary = dictionary; + this.Language = language; + this.Culture = culture; + this.Dictionary = dictionary; } #endregion Public Constructors diff --git a/Source/Controls/H.Controls.Form/Attribute/BindingGetSelectSourceMethodAttribute.cs b/Source/Controls/H.Controls.Form/Attribute/BindingGetSelectSourceMethodAttribute.cs index 7d0da65a..a0637004 100644 --- a/Source/Controls/H.Controls.Form/Attribute/BindingGetSelectSourceMethodAttribute.cs +++ b/Source/Controls/H.Controls.Form/Attribute/BindingGetSelectSourceMethodAttribute.cs @@ -7,7 +7,7 @@ public sealed class BindingGetSelectSourceMethodAttribute : System.Attribute { public BindingGetSelectSourceMethodAttribute(string methodName) { - MethodName = methodName; + this.MethodName = methodName; } public string MethodName { get; } diff --git a/Source/Controls/H.Controls.Form/Attribute/BindingGetSelectSourcePropertyAttribute.cs b/Source/Controls/H.Controls.Form/Attribute/BindingGetSelectSourcePropertyAttribute.cs index 693b98e7..4883a391 100644 --- a/Source/Controls/H.Controls.Form/Attribute/BindingGetSelectSourcePropertyAttribute.cs +++ b/Source/Controls/H.Controls.Form/Attribute/BindingGetSelectSourcePropertyAttribute.cs @@ -7,7 +7,7 @@ public sealed class BindingGetSelectSourcePropertyAttribute : System.Attribute { public BindingGetSelectSourcePropertyAttribute(string propertyName) { - PropertyName = propertyName; + this.PropertyName = propertyName; } public string PropertyName { get; } diff --git a/Source/Controls/H.Controls.Form/Attribute/PropertyItemTypeAttribute.cs b/Source/Controls/H.Controls.Form/Attribute/PropertyItemTypeAttribute.cs index 58507edc..8004c997 100644 --- a/Source/Controls/H.Controls.Form/Attribute/PropertyItemTypeAttribute.cs +++ b/Source/Controls/H.Controls.Form/Attribute/PropertyItemTypeAttribute.cs @@ -13,7 +13,7 @@ public PropertyItemTypeAttribute() } public PropertyItemTypeAttribute(Type type) { - Type = type; + this.Type = type; } public Type Type { get; set; } } diff --git a/Source/Controls/H.Controls.Form/Form.xaml.cs b/Source/Controls/H.Controls.Form/Form.xaml.cs index c31f9dea..e2edb9f8 100644 --- a/Source/Controls/H.Controls.Form/Form.xaml.cs +++ b/Source/Controls/H.Controls.Form/Form.xaml.cs @@ -4,7 +4,6 @@ using H.Providers.Ioc; -using H.Providers.Mvvm; using System; using System.Collections; using System.Collections.Generic; @@ -124,7 +123,7 @@ public DataTemplate ItemHeaderTemplate set { SetValue(ItemHeaderTemplateProperty, value); } } - + public static readonly DependencyProperty ItemHeaderTemplateProperty = DependencyProperty.Register("ItemHeaderTemplate", typeof(DataTemplate), typeof(Form), new FrameworkPropertyMetadata(default(DataTemplate), (d, e) => { @@ -217,7 +216,7 @@ public bool UseDisplayOnly set { SetValue(UseDisplayOnlyProperty, value); } } - + public static readonly DependencyProperty UseDisplayOnlyProperty = DependencyProperty.Register("UseDisplayOnly", typeof(bool), typeof(Form), new FrameworkPropertyMetadata(true, (d, e) => { @@ -245,7 +244,7 @@ public bool UseDeclaredOnly set { SetValue(UseDeclaredOnlyProperty, value); } } - + public static readonly DependencyProperty UseDeclaredOnlyProperty = DependencyProperty.Register("UseDeclaredOnly", typeof(bool), typeof(Form), new FrameworkPropertyMetadata(default(bool), (d, e) => { @@ -272,7 +271,7 @@ public string ExceptPropertyNames set { SetValue(ExceptPropertyNamesProperty, value); } } - + public static readonly DependencyProperty ExceptPropertyNamesProperty = DependencyProperty.Register("ExceptPropertyNames", typeof(string), typeof(Form), new FrameworkPropertyMetadata(default(string), (d, e) => { @@ -300,7 +299,7 @@ public string UsePropertyNames set { SetValue(UsePropertyNamesProperty, value); } } - + public static readonly DependencyProperty UsePropertyNamesProperty = DependencyProperty.Register("UsePropertyNames", typeof(string), typeof(Form), new FrameworkPropertyMetadata(default(string), (d, e) => { @@ -328,7 +327,7 @@ public bool UsePropertyView set { SetValue(UsePropertyViewProperty, value); } } - + public static readonly DependencyProperty UsePropertyViewProperty = DependencyProperty.Register("UsePropertyView", typeof(bool), typeof(Form), new FrameworkPropertyMetadata(default(bool), FrameworkPropertyMetadataOptions.Inherits, (d, e) => { @@ -358,7 +357,7 @@ public bool UsePresenter set { SetValue(UsePresenterProperty, value); } } - + public static readonly DependencyProperty UsePresenterProperty = DependencyProperty.Register("UsePresenter", typeof(bool), typeof(Form), new FrameworkPropertyMetadata(default(bool), (d, e) => { @@ -412,7 +411,7 @@ public bool UseTypeConverterOnly set { SetValue(UseTypeConverterOnlyProperty, value); } } - + public static readonly DependencyProperty UseTypeConverterOnlyProperty = DependencyProperty.Register("UseTypeConverterOnly", typeof(bool), typeof(Form), new FrameworkPropertyMetadata(default(bool), (d, e) => { @@ -490,7 +489,7 @@ public bool UseBoolen set { SetValue(UseBoolenProperty, value); } } - + public static readonly DependencyProperty UseBoolenProperty = DependencyProperty.Register("UseBoolen", typeof(bool), typeof(Form), new FrameworkPropertyMetadata(true, (d, e) => { @@ -518,7 +517,7 @@ public bool UseOrderByType set { SetValue(UseOrderByTypeProperty, value); } } - + public static readonly DependencyProperty UseOrderByTypeProperty = DependencyProperty.Register("UseOrderByType", typeof(bool), typeof(Form), new FrameworkPropertyMetadata(default(bool), (d, e) => { @@ -545,7 +544,7 @@ public bool UseOrderByName set { SetValue(UseOrderByNameProperty, value); } } - + public static readonly DependencyProperty UseOrderByNameProperty = DependencyProperty.Register("UseOrderByName", typeof(bool), typeof(Form), new FrameworkPropertyMetadata(default(bool), (d, e) => { @@ -573,7 +572,7 @@ public bool UseOrder set { SetValue(UseOrderProperty, value); } } - + public static readonly DependencyProperty UseOrderProperty = DependencyProperty.Register("UseOrder", typeof(bool), typeof(Form), new FrameworkPropertyMetadata(true, (d, e) => { @@ -599,7 +598,7 @@ public bool UseEnum set { SetValue(UseEnumProperty, value); } } - + public static readonly DependencyProperty UseEnumProperty = DependencyProperty.Register("UseEnum", typeof(bool), typeof(Form), new FrameworkPropertyMetadata(true, (d, e) => { @@ -625,7 +624,7 @@ public bool UseString set { SetValue(UseStringProperty, value); } } - + public static readonly DependencyProperty UseStringProperty = DependencyProperty.Register("UseString", typeof(bool), typeof(Form), new FrameworkPropertyMetadata(true, (d, e) => { @@ -651,7 +650,7 @@ public bool UseDateTime set { SetValue(UseDateTimeProperty, value); } } - + public static readonly DependencyProperty UseDateTimeProperty = DependencyProperty.Register("UseDateTime", typeof(bool), typeof(Form), new FrameworkPropertyMetadata(true, (d, e) => { @@ -680,7 +679,7 @@ public bool UseCommandOnly set { SetValue(UseCommandOnlyProperty, value); } } - + public static readonly DependencyProperty UseCommandOnlyProperty = DependencyProperty.Register("UseCommandOnly", typeof(bool), typeof(Form), new FrameworkPropertyMetadata(default(bool), (d, e) => { @@ -707,7 +706,7 @@ public bool UseCommand set { SetValue(UseCommandProperty, value); } } - + public static readonly DependencyProperty UseCommandProperty = DependencyProperty.Register("UseCommand", typeof(bool), typeof(Form), new FrameworkPropertyMetadata(true, (d, e) => { @@ -734,7 +733,7 @@ public bool UseClass set { SetValue(UseClassProperty, value); } } - + public static readonly DependencyProperty UseClassProperty = DependencyProperty.Register("UseClass", typeof(bool), typeof(Form), new FrameworkPropertyMetadata(true, (d, e) => { @@ -761,7 +760,7 @@ public bool UseArray set { SetValue(UseArrayProperty, value); } } - + public static readonly DependencyProperty UseArrayProperty = DependencyProperty.Register("UseArray", typeof(bool), typeof(Form), new FrameworkPropertyMetadata(true, (d, e) => { @@ -788,7 +787,7 @@ public bool UseInterface set { SetValue(UseInterfaceProperty, value); } } - + public static readonly DependencyProperty UseInterfaceProperty = DependencyProperty.Register("UseInterface", typeof(bool), typeof(Form), new FrameworkPropertyMetadata(true, (d, e) => { @@ -816,7 +815,7 @@ public bool UsePrimitive set { SetValue(UsePrimitiveProperty, value); } } - + public static readonly DependencyProperty UsePrimitiveProperty = DependencyProperty.Register("UsePrimitive", typeof(bool), typeof(Form), new FrameworkPropertyMetadata(true, (d, e) => { @@ -842,7 +841,7 @@ public Func Mapper set { SetValue(MapperProperty, value); } } - + public static readonly DependencyProperty MapperProperty = DependencyProperty.Register("Mapper", typeof(Func), typeof(Form), new FrameworkPropertyMetadata(default(Func), FrameworkPropertyMetadataOptions.BindsTwoWayByDefault, (d, e) => { @@ -894,7 +893,7 @@ public bool UseGroup set { SetValue(UseGroupProperty, value); } } - + public static readonly DependencyProperty UseGroupProperty = DependencyProperty.Register("UseGroup", typeof(bool), typeof(Form), new FrameworkPropertyMetadata(default(bool), (d, e) => { @@ -923,7 +922,7 @@ public string UseGroupNames set { SetValue(UseGroupNamesProperty, value); } } - + public static readonly DependencyProperty UseGroupNamesProperty = DependencyProperty.Register("UseGroupNames", typeof(string), typeof(Form), new FrameworkPropertyMetadata(default(string), (d, e) => { @@ -1020,13 +1019,13 @@ protected void OnValueChanged(Tuple tuple) // } //} - if(this.CheckAccess()) + if (this.CheckAccess()) { this.RaiseEvent(args); } else { - this.Dispatcher.Invoke(()=> this.RaiseEvent(args)); + this.Dispatcher.Invoke(() => this.RaiseEvent(args)); } } @@ -1037,7 +1036,7 @@ public double MessageWidth set { SetValue(MessageWidthProperty, value); } } - + public static readonly DependencyProperty MessageWidthProperty = DependencyProperty.Register("MessageWidth", typeof(double), typeof(Form), new PropertyMetadata(default(double), (d, e) => { @@ -1074,7 +1073,7 @@ public bool UseAsync set { SetValue(UseAsyncProperty, value); } } - + public static readonly DependencyProperty UseAsyncProperty = DependencyProperty.Register("UseAsync", typeof(bool), typeof(Form), new FrameworkPropertyMetadata(default(bool), (d, e) => { @@ -1173,8 +1172,8 @@ protected void RefreshObjectinternal() if (!this.UseNull) { - if(item.Name!="Item") - if (item.GetValue(o) == null) continue; + if (item.Name != "Item") + if (item.GetValue(o) == null) continue; } // Do :筛选条件 diff --git a/Source/Controls/H.Controls.Form/PropertyItem/Base/ObjectProperty.cs b/Source/Controls/H.Controls.Form/PropertyItem/Base/ObjectProperty.cs index 54e51ff0..8b579ada 100644 --- a/Source/Controls/H.Controls.Form/PropertyItem/Base/ObjectProperty.cs +++ b/Source/Controls/H.Controls.Form/PropertyItem/Base/ObjectProperty.cs @@ -17,7 +17,7 @@ public class ObjectPropertyItem : ObjectPropertyItem, IDataErrorInfo public ObjectPropertyItem(PropertyInfo property, object obj) : base(property, obj) { List required = property.GetCustomAttributes()?.ToList(); - Validations = property.GetCustomAttributes()?.ToList(); + this.Validations = property.GetCustomAttributes()?.ToList(); //// Do :这两个特性用在通知,本控件默认不可用于验证属性定义 //Validations.RemoveAll(l => l is CustomValidationAttribute); //Validations.RemoveAll(l => l is CompareAttribute); @@ -75,9 +75,9 @@ public virtual T Value this.Error = null; // Do:检验数据有效性 - if (Validations != null) + if (this.Validations != null) { - foreach (ValidationAttribute item in Validations) + foreach (ValidationAttribute item in this.Validations) { if (!item.IsValid(value)) { @@ -204,17 +204,17 @@ private object ConverToObject(T value) protected virtual void SetValue(T value) { object to = this.ConverToObject(value); - object from = this.PropertyInfo.GetValue(Obj); + object from = this.PropertyInfo.GetValue(this.Obj); if (to == from) return; if (to?.Equals(from) == true) return; - this.PropertyInfo.SetValue(Obj, to); + this.PropertyInfo.SetValue(this.Obj, to); } protected virtual T GetValue() { - return (T)this.PropertyInfo.GetValue(Obj); + return (T)this.PropertyInfo.GetValue(this.Obj); } protected R GetValue() @@ -282,8 +282,8 @@ public abstract class ObjectPropertyItem : DisplayBindableBase, IPropertyItem public ObjectPropertyItem(PropertyInfo property, object obj) { - PropertyInfo = property; - Obj = obj; + this.PropertyInfo = property; + this.Obj = obj; DisplayAttribute display = property.GetCustomAttribute(); this.Name = property.Name; if (display != null) diff --git a/Source/Controls/H.Controls.Form/PropertyItem/Base/StringHost.cs b/Source/Controls/H.Controls.Form/PropertyItem/Base/StringHost.cs index c35ee70f..25324962 100644 --- a/Source/Controls/H.Controls.Form/PropertyItem/Base/StringHost.cs +++ b/Source/Controls/H.Controls.Form/PropertyItem/Base/StringHost.cs @@ -71,7 +71,7 @@ public string this[string columnName] this.Message = ex.Message; } - return this.Error = Message; + return this.Error = this.Message; } } } diff --git a/Source/Controls/H.Controls.Form/PropertyItem/IEnumerablePropertyItem.xaml.cs b/Source/Controls/H.Controls.Form/PropertyItem/IEnumerablePropertyItem.xaml.cs index 28c94f3f..7b1eaeb7 100644 --- a/Source/Controls/H.Controls.Form/PropertyItem/IEnumerablePropertyItem.xaml.cs +++ b/Source/Controls/H.Controls.Form/PropertyItem/IEnumerablePropertyItem.xaml.cs @@ -82,7 +82,7 @@ protected override ObservableCollection GetValue() protected override void SetValue(ObservableCollection value) { object to = this.ChangeType(value); - this.PropertyInfo.SetValue(Obj, to); + this.PropertyInfo.SetValue(this.Obj, to); } protected abstract object ChangeType(ObservableCollection value); diff --git a/Source/Controls/H.Controls.Form/PropertyItem/PrimitiveArrayPropertyItem.cs b/Source/Controls/H.Controls.Form/PropertyItem/PrimitiveArrayPropertyItem.cs index 54448ddc..0d69019e 100644 --- a/Source/Controls/H.Controls.Form/PropertyItem/PrimitiveArrayPropertyItem.cs +++ b/Source/Controls/H.Controls.Form/PropertyItem/PrimitiveArrayPropertyItem.cs @@ -24,7 +24,7 @@ protected override void SetValue(ObservableCollection value) { object to = this.ChangeType(value); - this.PropertyInfo.SetValue(Obj, to); + this.PropertyInfo.SetValue(this.Obj, to); } private object ChangeType(ObservableCollection value) diff --git a/Source/Controls/H.Controls.Form/PropertyItem/PrimitiveListPropertyItem.cs b/Source/Controls/H.Controls.Form/PropertyItem/PrimitiveListPropertyItem.cs index ea43ac5a..4a3356a4 100644 --- a/Source/Controls/H.Controls.Form/PropertyItem/PrimitiveListPropertyItem.cs +++ b/Source/Controls/H.Controls.Form/PropertyItem/PrimitiveListPropertyItem.cs @@ -25,7 +25,7 @@ protected override void SetValue(ObservableCollection value) { object to = this.ChangeType(value); - this.PropertyInfo.SetValue(Obj, to); + this.PropertyInfo.SetValue(this.Obj, to); } private object ChangeType(ObservableCollection value) diff --git a/Source/Controls/H.Controls.Form/PropertyItem/SelectSourcePropertyItem.xaml.cs b/Source/Controls/H.Controls.Form/PropertyItem/SelectSourcePropertyItem.xaml.cs index 2e3fa110..fd7818c2 100644 --- a/Source/Controls/H.Controls.Form/PropertyItem/SelectSourcePropertyItem.xaml.cs +++ b/Source/Controls/H.Controls.Form/PropertyItem/SelectSourcePropertyItem.xaml.cs @@ -110,7 +110,7 @@ protected override bool CheckType(object value, out string error) protected override void SetValue(object value) { - this.PropertyInfo.SetValue(Obj, value); + this.PropertyInfo.SetValue(this.Obj, value); } } diff --git a/Source/Controls/H.Controls.Form/Provider/PropertyExtention.cs b/Source/Controls/H.Controls.Form/Provider/PropertyExtention.cs index 0f0f9c58..fbf412a2 100644 --- a/Source/Controls/H.Controls.Form/Provider/PropertyExtention.cs +++ b/Source/Controls/H.Controls.Form/Provider/PropertyExtention.cs @@ -2,8 +2,6 @@ using System; using System.Collections; -using System.Collections.Generic; -using System.ComponentModel.DataAnnotations; using System.Linq; using System.Reflection; using System.Windows.Input; @@ -80,7 +78,7 @@ public static IPropertyItem Create(this PropertyInfo info, object obj) //CustomValidationAttribute attr = info.GetCustomAttribute(); //if (attr == null || string.IsNullOrEmpty(attr.Method)) //{ - return new ObjectPropertyItem(info, obj); + return new ObjectPropertyItem(info, obj); //} //else //{ @@ -147,7 +145,7 @@ public static ObjectPropertyItem CreateByType(this PropertyInfo info, object obj //if (attr == null || string.IsNullOrEmpty(attr.Method)) //{ - return new ObjectPropertyItem(info, obj); + return new ObjectPropertyItem(info, obj); //} //else //{ diff --git a/Source/Controls/H.Controls.GridSplitterBox/GridSplitterBox.xaml.cs b/Source/Controls/H.Controls.GridSplitterBox/GridSplitterBox.xaml.cs index ec4727fd..4202acf2 100644 --- a/Source/Controls/H.Controls.GridSplitterBox/GridSplitterBox.xaml.cs +++ b/Source/Controls/H.Controls.GridSplitterBox/GridSplitterBox.xaml.cs @@ -41,14 +41,14 @@ static GridSplitterBox() public override void OnApplyTemplate() { base.OnApplyTemplate(); - _gridSplitter = Template.FindName(GridSplitterName, this) as System.Windows.Controls.GridSplitter; + _gridSplitter = this.Template.FindName(GridSplitterName, this) as System.Windows.Controls.GridSplitter; if (_gridSplitter == null) return; - _menuGrid = Template.FindName("PART_Menu", this) as Grid; + _menuGrid = this.Template.FindName("PART_Menu", this) as Grid; if (_menuGrid == null) return; - _menuColumnDefinition = Template.FindName("PART_Column_Menu", this) as ColumnDefinition; - _menuRowDefinition = Template.FindName("PART_Row_Menu", this) as RowDefinition; + _menuColumnDefinition = this.Template.FindName("PART_Column_Menu", this) as ColumnDefinition; + _menuRowDefinition = this.Template.FindName("PART_Row_Menu", this) as RowDefinition; _menuWidthTemp = this.MenuWidth.Value; this.Load(); if (this.MenuDock == Dock.Right) @@ -159,7 +159,7 @@ public GridSplitteMode Mode set { SetValue(ModeProperty, value); } } - + public static readonly DependencyProperty ModeProperty = DependencyProperty.Register("Mode", typeof(GridSplitteMode), typeof(GridSplitterBox), new FrameworkPropertyMetadata(GridSplitteMode.Hidden, (d, e) => { @@ -186,7 +186,7 @@ public object MenuContent set { SetValue(MenuContentProperty, value); } } - + public static readonly DependencyProperty MenuContentProperty = DependencyProperty.Register("MenuContent", typeof(object), typeof(GridSplitterBox), new FrameworkPropertyMetadata(default(object), (d, e) => { @@ -213,7 +213,7 @@ public DataTemplate MenuTempate set { SetValue(MenuTempateProperty, value); } } - + public static readonly DependencyProperty MenuTempateProperty = DependencyProperty.Register("MenuTempate", typeof(DataTemplate), typeof(GridSplitterBox), new FrameworkPropertyMetadata(default(DataTemplate), (d, e) => { @@ -240,7 +240,7 @@ public double GridSpliteWidth set { SetValue(GridSpliteWidthProperty, value); } } - + public static readonly DependencyProperty GridSpliteWidthProperty = DependencyProperty.Register("GridSpliteWidth", typeof(double), typeof(GridSplitterBox), new FrameworkPropertyMetadata(5.0, (d, e) => { @@ -266,7 +266,7 @@ public double MenuMinWidth set { SetValue(MenuMinWidthProperty, value); } } - + public static readonly DependencyProperty MenuMinWidthProperty = DependencyProperty.Register("MenuMinWidth", typeof(double), typeof(GridSplitterBox), new FrameworkPropertyMetadata(10.0, (d, e) => { @@ -291,7 +291,7 @@ public double MenuMaxWidth set { SetValue(MenuMaxWidthProperty, value); } } - + public static readonly DependencyProperty MenuMaxWidthProperty = DependencyProperty.Register("MenuMaxWidth", typeof(double), typeof(GridSplitterBox), new FrameworkPropertyMetadata(300.0, (d, e) => { @@ -318,7 +318,7 @@ public GridLength MenuWidth set { SetValue(MenuWidthProperty, value); } } - + public static readonly DependencyProperty MenuWidthProperty = DependencyProperty.Register("MenuWidth", typeof(GridLength), typeof(GridSplitterBox), new FrameworkPropertyMetadata(new GridLength(200.0), (d, e) => { @@ -344,7 +344,7 @@ public Brush GridSpliterBackground set { SetValue(GridSpliterBackgroundProperty, value); } } - + public static readonly DependencyProperty GridSpliterBackgroundProperty = DependencyProperty.Register("GridSpliterBackground", typeof(Brush), typeof(GridSplitterBox), new FrameworkPropertyMetadata(default(Brush), (d, e) => { @@ -370,7 +370,7 @@ public HorizontalAlignment ToggleHorizontalAlignment set { SetValue(ToggleHorizontalAlignmentProperty, value); } } - + public static readonly DependencyProperty ToggleHorizontalAlignmentProperty = DependencyProperty.Register("ToggleHorizontalAlignment", typeof(HorizontalAlignment), typeof(GridSplitterBox), new FrameworkPropertyMetadata(default(HorizontalAlignment), (d, e) => { @@ -397,7 +397,7 @@ public VerticalAlignment ToggleVerticalAlignment set { SetValue(ToggleVerticalAlignmentProperty, value); } } - + public static readonly DependencyProperty ToggleVerticalAlignmentProperty = DependencyProperty.Register("ToggleVerticalAlignment", typeof(VerticalAlignment), typeof(GridSplitterBox), new FrameworkPropertyMetadata(default(VerticalAlignment), (d, e) => { @@ -424,7 +424,7 @@ public Dock MenuDock set { SetValue(MenuDockProperty, value); } } - + public static readonly DependencyProperty MenuDockProperty = DependencyProperty.Register("MenuDock", typeof(Dock), typeof(GridSplitterBox), new FrameworkPropertyMetadata(default(Dock), (d, e) => { @@ -450,7 +450,7 @@ public Style ToggleStyle set { SetValue(ToggleStyleProperty, value); } } - + public static readonly DependencyProperty ToggleStyleProperty = DependencyProperty.Register("ToggleStyle", typeof(Style), typeof(GridSplitterBox), new FrameworkPropertyMetadata(default(Style), (d, e) => { @@ -477,7 +477,7 @@ public string OpenGeometry set { SetValue(OpenGeometryProperty, value); } } - + public static readonly DependencyProperty OpenGeometryProperty = DependencyProperty.Register("OpenGeometry", typeof(string), typeof(GridSplitterBox), new FrameworkPropertyMetadata(default(string), (d, e) => { @@ -504,7 +504,7 @@ public string CloseGeometry set { SetValue(CloseGeometryProperty, value); } } - + public static readonly DependencyProperty CloseGeometryProperty = DependencyProperty.Register("CloseGeometry", typeof(string), typeof(GridSplitterBox), new FrameworkPropertyMetadata(default(string), (d, e) => { @@ -531,7 +531,7 @@ public bool IsExpanded set { SetValue(IsExpandedProperty, value); } } - + public static readonly DependencyProperty IsExpandedProperty = DependencyProperty.Register("IsExpanded", typeof(bool), typeof(GridSplitterBox), new FrameworkPropertyMetadata(true, (d, e) => { @@ -558,7 +558,7 @@ public bool UseToggle set { SetValue(UseToggleProperty, value); } } - + public static readonly DependencyProperty UseToggleProperty = DependencyProperty.Register("UseToggle", typeof(bool), typeof(GridSplitterBox), new FrameworkPropertyMetadata(true, (d, e) => { diff --git a/Source/Controls/H.Controls.HorseTextBlock/HorseTextBlock.xaml.cs b/Source/Controls/H.Controls.HorseTextBlock/HorseTextBlock.xaml.cs index 89f026bd..46f09195 100644 --- a/Source/Controls/H.Controls.HorseTextBlock/HorseTextBlock.xaml.cs +++ b/Source/Controls/H.Controls.HorseTextBlock/HorseTextBlock.xaml.cs @@ -99,7 +99,7 @@ public RepeatBehavior RepeatBehavior set { SetValue(RepeatBehaviorProperty, value); } } - + public static readonly DependencyProperty RepeatBehaviorProperty = DependencyProperty.Register("RepeatBehavior", typeof(RepeatBehavior), typeof(HorseTextBlock), new FrameworkPropertyMetadata(new RepeatBehavior(3), (d, e) => { diff --git a/Source/Controls/H.Controls.NavigationBox/NavigationBox.xaml.cs b/Source/Controls/H.Controls.NavigationBox/NavigationBox.xaml.cs index 6604d9de..56d0dbe0 100644 --- a/Source/Controls/H.Controls.NavigationBox/NavigationBox.xaml.cs +++ b/Source/Controls/H.Controls.NavigationBox/NavigationBox.xaml.cs @@ -24,9 +24,9 @@ public override void OnApplyTemplate() { base.OnApplyTemplate(); - this._navigation = Template.FindName("PART_NAVIGATION", this) as ListBox; + this._navigation = this.Template.FindName("PART_NAVIGATION", this) as ListBox; - this._scrollviewer = Template.FindName("PART_SCROLLVIEWER", this) as ScrollViewer; + this._scrollviewer = this.Template.FindName("PART_SCROLLVIEWER", this) as ScrollViewer; this._navigation.SelectionChanged += (l, k) => { @@ -90,7 +90,7 @@ public Point HitTestPoint set { SetValue(HitTestPointProperty, value); } } - + public static readonly DependencyProperty HitTestPointProperty = DependencyProperty.Register("HitTestPoint", typeof(Point), typeof(NavigationBox), new FrameworkPropertyMetadata(new Point(10, 10), FrameworkPropertyMetadataOptions.BindsTwoWayByDefault, (d, e) => { @@ -148,7 +148,7 @@ public DataTemplate NavigationDataTemplate set { SetValue(NavigationDataTemplateProperty, value); } } - + public static readonly DependencyProperty NavigationDataTemplateProperty = DependencyProperty.Register("NavigationDataTemplate", typeof(DataTemplate), typeof(NavigationBox), new PropertyMetadata(default(DataTemplate), (d, e) => { @@ -167,7 +167,7 @@ public DataTemplate ContainDataTemplate set { SetValue(ContainDataTemplateProperty, value); } } - + public static readonly DependencyProperty ContainDataTemplateProperty = DependencyProperty.Register("ContainDataTemplate", typeof(DataTemplate), typeof(NavigationBox), new PropertyMetadata(default(DataTemplate), (d, e) => { @@ -186,7 +186,7 @@ public IEnumerable NavigationSource set { SetValue(NavigationSourceProperty, value); } } - + public static readonly DependencyProperty NavigationSourceProperty = DependencyProperty.Register("NavigationSource", typeof(IEnumerable), typeof(NavigationBox), new PropertyMetadata(default(IEnumerable), (d, e) => { @@ -206,7 +206,7 @@ public Style NavigationStyle set { SetValue(NavigationStyleProperty, value); } } - + public static readonly DependencyProperty NavigationStyleProperty = DependencyProperty.Register("NavigationStyle", typeof(Style), typeof(NavigationBox), new FrameworkPropertyMetadata(default(Style), FrameworkPropertyMetadataOptions.BindsTwoWayByDefault, (d, e) => { diff --git a/Source/Controls/H.Controls.NavigationBox/ScrollIntoView.xaml.cs b/Source/Controls/H.Controls.NavigationBox/ScrollIntoView.xaml.cs index 0245103c..8a8cd2fa 100644 --- a/Source/Controls/H.Controls.NavigationBox/ScrollIntoView.xaml.cs +++ b/Source/Controls/H.Controls.NavigationBox/ScrollIntoView.xaml.cs @@ -25,10 +25,10 @@ public override void OnApplyTemplate() { base.OnApplyTemplate(); - this._navigation = Template.FindName("PART_NAVIGATION", this) as ListBox; + this._navigation = this.Template.FindName("PART_NAVIGATION", this) as ListBox; - this._contain = Template.FindName("PART_CONTAINT", this) as ListBox; + this._contain = this.Template.FindName("PART_CONTAINT", this) as ListBox; this._navigation.SelectionChanged += (l, k) => { @@ -42,7 +42,7 @@ public DataTemplate NavigationDataTemplate set { SetValue(NavigationDataTemplateProperty, value); } } - + public static readonly DependencyProperty NavigationDataTemplateProperty = DependencyProperty.Register("NavigationDataTemplate", typeof(DataTemplate), typeof(ScrollIntoView), new PropertyMetadata(default(DataTemplate), (d, e) => { @@ -61,7 +61,7 @@ public DataTemplate ContainDataTemplate set { SetValue(ContainDataTemplateProperty, value); } } - + public static readonly DependencyProperty ContainDataTemplateProperty = DependencyProperty.Register("ContainDataTemplate", typeof(DataTemplate), typeof(ScrollIntoView), new PropertyMetadata(default(DataTemplate), (d, e) => { @@ -80,7 +80,7 @@ public IEnumerable Source set { SetValue(SourceProperty, value); } } - + public static readonly DependencyProperty SourceProperty = DependencyProperty.Register("Source", typeof(IEnumerable), typeof(ScrollIntoView), new PropertyMetadata(default(IEnumerable), (d, e) => { diff --git a/Source/Controls/H.Controls.OrderBox/OrderBox.xaml.cs b/Source/Controls/H.Controls.OrderBox/OrderBox.xaml.cs index e48a25a8..fdab37ad 100644 --- a/Source/Controls/H.Controls.OrderBox/OrderBox.xaml.cs +++ b/Source/Controls/H.Controls.OrderBox/OrderBox.xaml.cs @@ -1,11 +1,8 @@ using H.Providers.Ioc; using System; using System.Collections; -using System.Collections.Generic; using System.Collections.ObjectModel; using System.Linq; -using System.Text; -using System.Threading.Tasks; using System.Windows; using System.Windows.Controls; diff --git a/Source/Controls/H.Controls.OrderBox/PropertyOrderBox.xaml.cs b/Source/Controls/H.Controls.OrderBox/PropertyOrderBox.xaml.cs index fd87ad69..1f4dc74e 100644 --- a/Source/Controls/H.Controls.OrderBox/PropertyOrderBox.xaml.cs +++ b/Source/Controls/H.Controls.OrderBox/PropertyOrderBox.xaml.cs @@ -127,7 +127,7 @@ public IOrderable Order public static readonly RoutedEvent OrderChangedRoutedEvent = EventManager.RegisterRoutedEvent("OrderChanged", RoutingStrategy.Bubble, typeof(EventHandler), typeof(PropertyOrderBox)); - + public event RoutedEventHandler OrderChanged { add { this.AddHandler(OrderChangedRoutedEvent, value); } diff --git a/Source/Controls/H.Controls.OrderBox/PropertyOrderPrensenter.xaml.cs b/Source/Controls/H.Controls.OrderBox/PropertyOrderPrensenter.xaml.cs index 17154a3d..440afe14 100644 --- a/Source/Controls/H.Controls.OrderBox/PropertyOrderPrensenter.xaml.cs +++ b/Source/Controls/H.Controls.OrderBox/PropertyOrderPrensenter.xaml.cs @@ -95,12 +95,12 @@ public ObservableCollection Properties public bool Save(out string message) { message = null; - if (string.IsNullOrEmpty(ID)) + if (string.IsNullOrEmpty(this.ID)) { message = "ID为空"; return false; } - MetaSettingService?.Serilize(this, ID); + this.MetaSettingService?.Serilize(this, this.ID); return true; } private bool _isLoaded = false; diff --git a/Source/Controls/H.Controls.OrderBox/PropertyOrdersPrensenter.xaml.cs b/Source/Controls/H.Controls.OrderBox/PropertyOrdersPrensenter.xaml.cs index e672df28..d26165c0 100644 --- a/Source/Controls/H.Controls.OrderBox/PropertyOrdersPrensenter.xaml.cs +++ b/Source/Controls/H.Controls.OrderBox/PropertyOrdersPrensenter.xaml.cs @@ -100,7 +100,7 @@ public int SelectedIndex public bool Save(out string message) { message = null; - if (string.IsNullOrEmpty(ID)) + if (string.IsNullOrEmpty(this.ID)) { message = "ID为空"; return false; diff --git a/Source/Controls/H.Controls.OutlookBar/Common/AnimationDecorator.cs b/Source/Controls/H.Controls.OutlookBar/Common/AnimationDecorator.cs index 8287e1fb..c247380f 100644 --- a/Source/Controls/H.Controls.OutlookBar/Common/AnimationDecorator.cs +++ b/Source/Controls/H.Controls.OutlookBar/Common/AnimationDecorator.cs @@ -16,7 +16,7 @@ static AnimationDecorator() public AnimationDecorator() : base() { - ClipToBounds = true; + this.ClipToBounds = true; } @@ -103,9 +103,9 @@ public Duration Duration private void UnanimatedExpandedChanged(bool expanded) { - if (Child != null) + if (this.Child != null) { - YOffset = expanded ? 0 : -Child.DesiredSize.Height; + this.YOffset = expanded ? 0 : -this.Child.DesiredSize.Height; } } @@ -115,19 +115,19 @@ private void UnanimatedExpandedChanged(bool expanded) /// private void AnimateExpandedChanged(bool expanded) { - if (Child != null) + if (this.Child != null) { - if (YOffset > 0) YOffset = 0; - if (-YOffset > Child.DesiredSize.Height) YOffset = -Child.DesiredSize.Height; - DoubleAnimation animation = HeightAnimation; + if (this.YOffset > 0) this.YOffset = 0; + if (-this.YOffset > this.Child.DesiredSize.Height) this.YOffset = -this.Child.DesiredSize.Height; + DoubleAnimation animation = this.HeightAnimation; if (animation == null) animation = CreateDoubleAnimation(); animation.From = null; - animation.To = expanded ? 0 : -Child.DesiredSize.Height; + animation.To = expanded ? 0 : -this.Child.DesiredSize.Height; animation.Completed += new EventHandler(animation_Completed); animating = true; this.BeginAnimation(AnimationDecorator.YOffsetProperty, animation); - if (OpacityAnimation) + if (this.OpacityAnimation) { animation.From = null; animation.To = expanded ? 1 : 0; @@ -136,7 +136,7 @@ private void AnimateExpandedChanged(bool expanded) } else { - YOffset = int.MinValue; + this.YOffset = int.MinValue; } } @@ -144,7 +144,7 @@ private DoubleAnimation CreateDoubleAnimation() { DoubleAnimation animation = new DoubleAnimation(); animation.DecelerationRatio = 0.8; - animation.Duration = Duration; + animation.Duration = this.Duration; return animation; } @@ -162,7 +162,7 @@ private void animation_Completed(object sender, EventArgs e) private Double AnimatedResize(Double h) { Double delta = targetHeight - h; - DoubleAnimation animation = HeightAnimation; + DoubleAnimation animation = this.HeightAnimation; if (animation == null) animation = CreateDoubleAnimation(); targetHeight = h; animation.From = delta; @@ -225,38 +225,38 @@ internal Double YOffset /// protected override Size MeasureOverride(Size constraint) { - if (Child == null) return new Size(0, 0); + if (this.Child == null) return new Size(0, 0); Size size; if (double.IsInfinity(constraint.Height)) { - Child.Measure(new Size(constraint.Width, Double.PositiveInfinity)); - Double childHeight = Child.DesiredSize.Height; + this.Child.Measure(new Size(constraint.Width, Double.PositiveInfinity)); + Double childHeight = this.Child.DesiredSize.Height; Double deltaHeight = 0; - if (this.AnimateOnContentHeightChanged && this.IsLoaded && IsVisible && CanAnimate) + if (this.AnimateOnContentHeightChanged && this.IsLoaded && this.IsVisible && this.CanAnimate) { if (targetHeight != childHeight) { deltaHeight = AnimatedResize(childHeight); if (animating) { - AnimateExpandedChanged(IsExpanded); + AnimateExpandedChanged(this.IsExpanded); } } } else targetHeight = childHeight; - double w = IsExpanded ? Child.DesiredSize.Width : 0; - size = new Size(w, Math.Max(0d, childHeight + YOffset + HeightOffset + deltaHeight)); + double w = this.IsExpanded ? this.Child.DesiredSize.Width : 0; + size = new Size(w, Math.Max(0d, childHeight + this.YOffset + this.HeightOffset + deltaHeight)); } else { size = base.MeasureOverride(constraint); } - if (Child != null) + if (this.Child != null) { - Child.IsEnabled = size.Height > 0; + this.Child.IsEnabled = size.Height > 0; } if (size.Height == 0) this.AnimationOpacity = 0; return size; @@ -272,10 +272,10 @@ protected override Size MeasureOverride(Size constraint) /// protected override Size ArrangeOverride(Size arrangeSize) { - if (Child == null) return arrangeSize; + if (this.Child == null) return arrangeSize; - Child.Arrange(new Rect(0d, YOffset, arrangeSize.Width, Child.DesiredSize.Height)); - Double h = Math.Max(0, Child.DesiredSize.Height + YOffset); + this.Child.Arrange(new Rect(0d, this.YOffset, arrangeSize.Width, this.Child.DesiredSize.Height)); + Double h = Math.Max(0, this.Child.DesiredSize.Height + this.YOffset); return new Size(arrangeSize.Width, h); } diff --git a/Source/Controls/H.Controls.OutlookBar/OdcExpander.xaml.cs b/Source/Controls/H.Controls.OutlookBar/OdcExpander.xaml.cs index 94892baa..de831594 100644 --- a/Source/Controls/H.Controls.OutlookBar/OdcExpander.xaml.cs +++ b/Source/Controls/H.Controls.OutlookBar/OdcExpander.xaml.cs @@ -302,7 +302,7 @@ void IKeyTipControl.ExecuteKeyTip() this.IsExpanded ^= true; if (this.IsExpanded) { - FrameworkElement e = Content as FrameworkElement; + FrameworkElement e = this.Content as FrameworkElement; if (e != null && e.Focusable) e.Focus(); } } diff --git a/Source/Controls/H.Controls.OutlookBar/OutlookBar.xaml.cs b/Source/Controls/H.Controls.OutlookBar/OutlookBar.xaml.cs index 50ec728e..0e3b93a8 100644 --- a/Source/Controls/H.Controls.OutlookBar/OutlookBar.xaml.cs +++ b/Source/Controls/H.Controls.OutlookBar/OutlookBar.xaml.cs @@ -42,11 +42,11 @@ public OutlookBar() SetValue(OutlookBar.OverflowMenuItemsPropertyKey, overflowMenu); SetValue(OutlookBar.OptionButtonsPropertyKey, new Collection()); - CommandBindings.Add(new CommandBinding(CollapseCommand, CollapseCommandExecuted)); - CommandBindings.Add(new CommandBinding(StartDraggingCommand, StartDraggingCommandExecuted)); - CommandBindings.Add(new CommandBinding(ShowPopupCommand, ShowPopupCommandExecuted)); - CommandBindings.Add(new CommandBinding(ResizeCommand, ResizeCommandExecuted)); - CommandBindings.Add(new CommandBinding(CloseCommand, CloseCommandExecuted)); + this.CommandBindings.Add(new CommandBinding(CollapseCommand, CollapseCommandExecuted)); + this.CommandBindings.Add(new CommandBinding(StartDraggingCommand, StartDraggingCommandExecuted)); + this.CommandBindings.Add(new CommandBinding(ShowPopupCommand, ShowPopupCommandExecuted)); + this.CommandBindings.Add(new CommandBinding(ResizeCommand, ResizeCommandExecuted)); + this.CommandBindings.Add(new CommandBinding(CloseCommand, CloseCommandExecuted)); maximizedSections = new Collection(); minimizedSections = new Collection(); @@ -71,14 +71,14 @@ private void OutlookBar_SizeChanged(object sender, SizeChangedEventArgs e) private void CollapseCommandExecuted(object sender, ExecutedRoutedEventArgs e) { - IsMaximized ^= true; + this.IsMaximized ^= true; } private void ShowPopupCommandExecuted(object sender, ExecutedRoutedEventArgs e) { - if (!IsMaximized) + if (!this.IsMaximized) { - IsPopupVisible = true; + this.IsPopupVisible = true; } } @@ -102,7 +102,7 @@ private void PreviewMouseMoveResize(object sender, MouseEventArgs e) System.Windows.Controls.Control c = e.OriginalSource as System.Windows.Controls.Control; if (e.LeftButton == MouseButtonState.Pressed) { - if (DockPosition == HorizontalAlignment.Left) + if (this.DockPosition == HorizontalAlignment.Left) { ResizeFromRight(e); } @@ -122,14 +122,14 @@ private void ResizeFromLeft(MouseEventArgs e) if (w < 80) { w = double.NaN; - IsMaximized = false; + this.IsMaximized = false; } else { - IsMaximized = true; + this.IsMaximized = true; } - if (MaxWidth != double.NaN && w > MaxWidth) w = MaxWidth; - Width = w; + if (this.MaxWidth != double.NaN && w > this.MaxWidth) w = this.MaxWidth; + this.Width = w; } private void ResizeFromRight(MouseEventArgs e) { @@ -139,14 +139,14 @@ private void ResizeFromRight(MouseEventArgs e) if (w < 80) { w = double.NaN; - IsMaximized = false; + this.IsMaximized = false; } else { - IsMaximized = true; + this.IsMaximized = true; } - if (MaxWidth != double.NaN && w > MaxWidth) w = MaxWidth; - Width = w; + if (this.MaxWidth != double.NaN && w > this.MaxWidth) w = this.MaxWidth; + this.Width = w; } private void StartDraggingCommandExecuted(object sender, ExecutedRoutedEventArgs e) @@ -178,8 +178,8 @@ private void PreviewMouseMoveButtons(object sender, MouseEventArgs e) if (e.LeftButton == MouseButtonState.Pressed) { Point pos = e.GetPosition(this); - double h = this.ActualHeight - 1 - ButtonHeight - pos.Y; - MaxNumberOfButtons = (int)(h / ButtonHeight); + double h = this.ActualHeight - 1 - this.ButtonHeight - pos.Y; + this.MaxNumberOfButtons = (int)(h / this.ButtonHeight); } else this.PreviewMouseMove -= PreviewMouseMoveButtons; } @@ -201,9 +201,9 @@ protected virtual void ApplySections() { maximizedSections = new Collection(); minimizedSections = new Collection(); - int max = MaxNumberOfButtons; + int max = this.MaxNumberOfButtons; int index = 0; - int selectedIndex = SelectedSectionIndex; + int selectedIndex = this.SelectedSectionIndex; OutlookSection selectedContent = null; int n = GetNumberOfMinimizedButtons(); @@ -211,7 +211,7 @@ protected virtual void ApplySections() foreach (OutlookSection e in sections) { e.OutlookBar = this; - e.Height = ButtonHeight; + e.Height = this.ButtonHeight; if (max-- > 0) { e.IsMaximized = true; @@ -231,7 +231,7 @@ protected virtual void ApplySections() } SetValue(OutlookBar.MaximizedSectionsPropertyKey, maximizedSections); SetValue(OutlookBar.MinimizedSectionsPropertyKey, minimizedSections); - SelectedSection = selectedContent; + this.SelectedSection = selectedContent; } } @@ -259,16 +259,14 @@ public Collection OverflowMenuItems private void ApplyOverflowMenu() { Collection overflowItems = new Collection(); - if (OverflowMenuItems.Count > 0) + if (this.OverflowMenuItems.Count > 0) { - foreach (object item in OverflowMenuItems) + foreach (object item in this.OverflowMenuItems) { overflowItems.Add(item); } } - - bool separatorAdded = false; - int visibleButtons = maximizedSections.Count + (IsMaximized ? minimizedSections.Count : 0); + int visibleButtons = maximizedSections.Count + (this.IsMaximized ? minimizedSections.Count : 0); for (int i = visibleButtons; i < sections.Count; i++) { @@ -304,7 +302,7 @@ private int GetNumberOfMinimizedButtons() const double overflowWidth = 18; double fraction = (minimizedButtonContainer.ActualWidth - overflowWidth) / width; int minimizedButtons = (int)Math.Truncate(fraction); - int visibleButtons = MaxNumberOfButtons + minimizedButtons; + int visibleButtons = this.MaxNumberOfButtons + minimizedButtons; return visibleButtons; } return 0; @@ -369,13 +367,13 @@ private void btn_PreviewMouseLeftButtonUp(object sender, MouseButtonEventArgs e) protected virtual void OnPopupOpened(object sender, EventArgs e) { - IsPopupVisible = true; + this.IsPopupVisible = true; Mouse.Capture(this, CaptureMode.SubTree); } protected virtual void OnPopupClosed(object sender, EventArgs e) { - IsPopupVisible = false; + this.IsPopupVisible = false; Mouse.Capture(null); } @@ -446,18 +444,18 @@ private static void MaximizedPropertyChanged(DependencyObject d, DependencyPrope /// protected virtual void OnMaximizedChanged(bool isExpanded) { - if (isExpanded) IsPopupVisible = false; + if (isExpanded) this.IsPopupVisible = false; EnsureSectionContentIsVisible(); if (isExpanded) { - MaxWidth = previousMaxWidth; + this.MaxWidth = previousMaxWidth; RaiseEvent(new RoutedEventArgs(ExpandedEvent)); } else { - previousMaxWidth = MaxWidth; - MaxWidth = MinimizedWidth + (CanResize ? 4 : 0); + previousMaxWidth = this.MaxWidth; + this.MaxWidth = this.MinimizedWidth + (this.CanResize ? 4 : 0); RaiseEvent(new RoutedEventArgs(CollapsedEvent)); } } @@ -494,10 +492,10 @@ public event RoutedEventHandler Expanded /// private void EnsureSectionContentIsVisible() { - object content = SelectedSection != null ? SelectedSection.Content : null; - SectionContent = null; // set temporarily to null, so resetting to the current content will have an effect. - CollapsedSectionContent = IsMaximized ? null : content; - SectionContent = IsMaximized ? content : null; + object content = this.SelectedSection != null ? this.SelectedSection.Content : null; + this.SectionContent = null; // set temporarily to null, so resetting to the current content will have an effect. + this.CollapsedSectionContent = this.IsMaximized ? null : content; + this.SectionContent = this.IsMaximized ? content : null; } @@ -688,9 +686,9 @@ protected virtual void OnSelectedSectionChanged(OutlookSection oldSection, Outlo section.IsSelected = newSection == section; if (selected) { - SelectedSectionIndex = index; - SectionContent = IsMaximized ? section.Content : null; - CollapsedSectionContent = IsMaximized ? null : section.Content; + this.SelectedSectionIndex = index; + this.SectionContent = this.IsMaximized ? section.Content : null; + this.CollapsedSectionContent = this.IsMaximized ? null : section.Content; } } RaiseEvent(new RoutedPropertyChangedEventArgs(oldSection, newSection, SelectedSectionChangedEvent)); @@ -946,8 +944,8 @@ protected override IEnumerator LogicalChildren protected virtual IEnumerable GetLogicalChildren() { - foreach (OutlookSection section in Sections) yield return section; - if (SelectedSection != null) yield return SelectedSection.Content; + foreach (OutlookSection section in this.Sections) yield return section; + if (this.SelectedSection != null) yield return this.SelectedSection.Content; } diff --git a/Source/Controls/H.Controls.OutlookBar/OutlookSection.xaml.cs b/Source/Controls/H.Controls.OutlookBar/OutlookSection.xaml.cs index fee1a4cc..bba708ea 100644 --- a/Source/Controls/H.Controls.OutlookBar/OutlookSection.xaml.cs +++ b/Source/Controls/H.Controls.OutlookBar/OutlookSection.xaml.cs @@ -19,7 +19,7 @@ public OutlookSection() : base() private void buttonClickedEvent(object sender, RoutedEventArgs e) { - OutlookBar bar = OutlookBar; + OutlookBar bar = this.OutlookBar; ToggleButton b = e.OriginalSource as ToggleButton; if (b != null) b.IsChecked = true; if (bar != null) @@ -60,7 +60,7 @@ private static void IsSelectedPropertyChanged(DependencyObject o, DependencyProp protected virtual void OnSelectedPropertyChanged(bool oldValue, bool newValue) { - if (newValue) OutlookBar.SelectedSection = this; + if (newValue) this.OutlookBar.SelectedSection = this; } /// @@ -107,7 +107,7 @@ public bool IsMaximized void IKeyTipControl.ExecuteKeyTip() { - IsSelected = true; + this.IsSelected = true; } #endregion diff --git a/Source/Controls/H.Controls.OutlookBar/OverflowMenuCreatedEventArgs.cs b/Source/Controls/H.Controls.OutlookBar/OverflowMenuCreatedEventArgs.cs index 1798a536..575e83ec 100644 --- a/Source/Controls/H.Controls.OutlookBar/OverflowMenuCreatedEventArgs.cs +++ b/Source/Controls/H.Controls.OutlookBar/OverflowMenuCreatedEventArgs.cs @@ -8,7 +8,7 @@ public class OverflowMenuCreatedEventArgs : EventArgs public OverflowMenuCreatedEventArgs(Collection menuItems) : base() { - MenuItems = menuItems; + this.MenuItems = menuItems; } public Collection MenuItems { get; private set; } diff --git a/Source/Controls/H.Controls.PDF/AllowableCharactersTextBoxBehavior.cs b/Source/Controls/H.Controls.PDF/AllowableCharactersTextBoxBehavior.cs index d22a8b76..085cc646 100644 --- a/Source/Controls/H.Controls.PDF/AllowableCharactersTextBoxBehavior.cs +++ b/Source/Controls/H.Controls.PDF/AllowableCharactersTextBoxBehavior.cs @@ -30,8 +30,8 @@ public int MaxLength protected override void OnAttached() { base.OnAttached(); - AssociatedObject.PreviewTextInput += OnPreviewTextInput; - DataObject.AddPastingHandler(AssociatedObject, OnPaste); + this.AssociatedObject.PreviewTextInput += OnPreviewTextInput; + DataObject.AddPastingHandler(this.AssociatedObject, OnPaste); } private void OnPaste(object sender, DataObjectPastingEventArgs e) @@ -59,20 +59,20 @@ void OnPreviewTextInput(object sender, System.Windows.Input.TextCompositionEvent protected override void OnDetaching() { base.OnDetaching(); - AssociatedObject.PreviewTextInput -= OnPreviewTextInput; - DataObject.RemovePastingHandler(AssociatedObject, OnPaste); + this.AssociatedObject.PreviewTextInput -= OnPreviewTextInput; + DataObject.RemovePastingHandler(this.AssociatedObject, OnPaste); } private bool IsValid(string newText, bool paste) { - return !ExceedsMaxLength(newText, paste) && Regex.IsMatch(newText, RegularExpression); + return !ExceedsMaxLength(newText, paste) && Regex.IsMatch(newText, this.RegularExpression); } private bool ExceedsMaxLength(string newText, bool paste) { - if (MaxLength == 0) return false; + if (this.MaxLength == 0) return false; - return LengthOfModifiedText(newText, paste) > MaxLength; + return LengthOfModifiedText(newText, paste) > this.MaxLength; } private int LengthOfModifiedText(string newText, bool paste) diff --git a/Source/Controls/H.Controls.PDF/BehaviorForStyle.cs b/Source/Controls/H.Controls.PDF/BehaviorForStyle.cs index 30048160..3daaebe4 100644 --- a/Source/Controls/H.Controls.PDF/BehaviorForStyle.cs +++ b/Source/Controls/H.Controls.PDF/BehaviorForStyle.cs @@ -1,6 +1,6 @@ -using System.Linq; +using Microsoft.Xaml.Behaviors; +using System.Linq; using System.Windows; -using Microsoft.Xaml.Behaviors; namespace H.Controls.PDF { diff --git a/Source/Controls/H.Controls.PDF/BindSelectedItemBehavior.cs b/Source/Controls/H.Controls.PDF/BindSelectedItemBehavior.cs index a2e3461d..d0f92fba 100644 --- a/Source/Controls/H.Controls.PDF/BindSelectedItemBehavior.cs +++ b/Source/Controls/H.Controls.PDF/BindSelectedItemBehavior.cs @@ -1,5 +1,4 @@ -using System.Runtime.CompilerServices; -using System.Windows; +using System.Windows; using System.Windows.Controls; namespace H.Controls.PDF @@ -28,7 +27,7 @@ private static void OnSelectedItemChanged(DependencyObject sender, DependencyPro { if (sender is BindSelectedItemBehavior behavior) { - var treeitem = behavior.AssociatedObject.GetChild(x => x.DataContext == e.NewValue); + var treeitem = behavior.AssociatedObject.GetChild(x => x.DataContext == e.NewValue); if (treeitem != null) { treeitem.IsSelected = true; @@ -42,22 +41,22 @@ private static void OnSelectedItemChanged(DependencyObject sender, DependencyPro protected override void OnAttached() { base.OnAttached(); - AssociatedObject.SelectedItemChanged += OnTreeViewSelectedItemChanged; + this.AssociatedObject.SelectedItemChanged += OnTreeViewSelectedItemChanged; } protected override void OnDetaching() { base.OnDetaching(); - if (AssociatedObject != null) + if (this.AssociatedObject != null) { - AssociatedObject.SelectedItemChanged -= OnTreeViewSelectedItemChanged; + this.AssociatedObject.SelectedItemChanged -= OnTreeViewSelectedItemChanged; } } private void OnTreeViewSelectedItemChanged(object sender, RoutedPropertyChangedEventArgs e) { - SelectedItem = e.NewValue; + this.SelectedItem = e.NewValue; } } } \ No newline at end of file diff --git a/Source/Controls/H.Controls.PDF/Extension.cs b/Source/Controls/H.Controls.PDF/Extension.cs index 162cc9ab..21734f9c 100644 --- a/Source/Controls/H.Controls.PDF/Extension.cs +++ b/Source/Controls/H.Controls.PDF/Extension.cs @@ -1,9 +1,4 @@ -using H.Controls.PDF; -using Microsoft.Extensions.DependencyInjection; -using Microsoft.Extensions.DependencyInjection.Extensions; -using System.Collections.Generic; - -namespace System +namespace System { public static class Extension { diff --git a/Source/Controls/H.Controls.PDF/PDFBox.xaml.cs b/Source/Controls/H.Controls.PDF/PDFBox.xaml.cs index 47bf21bd..0b1133a3 100644 --- a/Source/Controls/H.Controls.PDF/PDFBox.xaml.cs +++ b/Source/Controls/H.Controls.PDF/PDFBox.xaml.cs @@ -1,5 +1,4 @@ using H.Providers.Ioc; -using H.Providers.Mvvm; using Microsoft.Win32; using PdfiumViewer; using PdfiumViewer.Core; @@ -8,7 +7,6 @@ using System.Diagnostics; using System.IO; using System.Linq; -using System.Reflection; using System.Text; using System.Threading; using System.Threading.Tasks; @@ -168,10 +166,10 @@ public PDFBox() try { var pageStep = this._renderer.PagesDisplayMode == PdfViewerPagesDisplayMode.BookMode ? 2 : 1; - Dispatcher.Invoke(() => this._renderer.GotoPage(0)); + this.Dispatcher.Invoke(() => this._renderer.GotoPage(0)); while (this._renderer.PageNo < this._renderer.PageCount - pageStep) { - Dispatcher.Invoke(() => this._renderer.NextPage()); + this.Dispatcher.Invoke(() => this._renderer.NextPage()); await Task.Delay(1); } } @@ -290,9 +288,9 @@ public PDFBox() CommandBinding binding = new CommandBinding(PDFBoxCommands.ShowBookmarks); binding.Executed += (l, k) => { - Bookmarks = Renderer.Bookmarks; - if (Bookmarks?.Count > 0) - ShowBookmarks = !ShowBookmarks; + this.Bookmarks = Renderer.Bookmarks; + if (this.Bookmarks?.Count > 0) + this.ShowBookmarks = !this.ShowBookmarks; }; binding.CanExecute += (l, k) => { @@ -365,7 +363,7 @@ public PDFBox() CommandBinding binding = new CommandBinding(PDFBoxCommands.Searchterm); binding.Executed += (l, k) => { - IsSearchOpen = !IsSearchOpen; + this.IsSearchOpen = !this.IsSearchOpen; }; binding.CanExecute += (l, k) => { @@ -441,9 +439,9 @@ public PDFBox() CommandBinding binding = new CommandBinding(PDFBoxCommands.FindNext); binding.Executed += (l, k) => { - if (SearchMatchItemNo > 1) + if (this.SearchMatchItemNo > 1) { - SearchMatchItemNo--; + this.SearchMatchItemNo--; // DisplayTextSpan(SearchMatches.Items[SearchMatchItemNo - 1].TextSpan); _searchManager.FindNext(false); } @@ -459,9 +457,9 @@ public PDFBox() CommandBinding binding = new CommandBinding(PDFBoxCommands.FindPrevious); binding.Executed += (l, k) => { - if (SearchMatchesCount > SearchMatchItemNo) + if (this.SearchMatchesCount > this.SearchMatchItemNo) { - SearchMatchItemNo++; + this.SearchMatchItemNo++; //DisplayTextSpan(SearchMatches.Items[SearchMatchItemNo - 1].TextSpan); _searchManager.FindNext(true); } @@ -855,18 +853,18 @@ public string SearchTerm public async void Search() { - SearchMatchItemNo = 0; + this.SearchMatchItemNo = 0; _searchManager.MatchCase = this.UseMatchCase; _searchManager.MatchWholeWord = this.UseWholeWordOnly; _searchManager.HighlightAllMatches = this.UseHighlightAllMatches; //SearchMatchesTextBlock.Visibility = Visibility.Visible; - if (!_searchManager.Search(SearchTerm)) - { + if (!_searchManager.Search(this.SearchTerm)) + { await IocMessage.ShowDialogMessage("未搜索到数据"); } else - SearchMatchesCount = _searchManager.MatchesCount; + this.SearchMatchesCount = _searchManager.MatchesCount; if (!_searchManager.FindNext(true)) await IocMessage.ShowDialogMessage("到达了搜索的起点"); diff --git a/Source/Controls/H.Controls.PDF/PDFBoxCommands.cs b/Source/Controls/H.Controls.PDF/PDFBoxCommands.cs index 76fcfec2..3ecc82ef 100644 --- a/Source/Controls/H.Controls.PDF/PDFBoxCommands.cs +++ b/Source/Controls/H.Controls.PDF/PDFBoxCommands.cs @@ -5,7 +5,7 @@ namespace H.Controls.PDF { public class PDFBoxCommands { - public static RoutedUICommand Open { get; } = new RoutedUICommand("打开",nameof(Open), typeof(Commands)) ; + public static RoutedUICommand Open { get; } = new RoutedUICommand("打开", nameof(Open), typeof(Commands)); public static RoutedUICommand SaveAsImages { get; } = new RoutedUICommand("另存为图片", nameof(SaveAsImages), typeof(Commands)); public static RoutedUICommand RenderToMemory { get; } = new RoutedUICommand("加载数据", nameof(RenderToMemory), typeof(Commands)); public static RoutedUICommand ShowBookmarks { get; } = new RoutedUICommand("显示标签", nameof(ShowBookmarks), typeof(Commands)); diff --git a/Source/Controls/H.Controls.PagerBox/PagerBox.xaml.cs b/Source/Controls/H.Controls.PagerBox/PagerBox.xaml.cs index 4429192b..cbb82be9 100644 --- a/Source/Controls/H.Controls.PagerBox/PagerBox.xaml.cs +++ b/Source/Controls/H.Controls.PagerBox/PagerBox.xaml.cs @@ -4,11 +4,9 @@ using System; -using System.Collections; using System.Windows; using System.Windows.Controls; using System.Windows.Input; -using System.Windows.Threading; namespace H.Controls.PagerBox { @@ -75,11 +73,11 @@ public event EventHandler> PageUpdated public PagerBox() { - CommandBindings.Add(new CommandBinding(Commands.Prev, ButtonPrev_OnClick)); - CommandBindings.Add(new CommandBinding(Commands.Next, ButtonNext_OnClick)); - CommandBindings.Add(new CommandBinding(Commands.Selected, ToggleButton_OnChecked)); + this.CommandBindings.Add(new CommandBinding(Commands.Prev, ButtonPrev_OnClick)); + this.CommandBindings.Add(new CommandBinding(Commands.Next, ButtonNext_OnClick)); + this.CommandBindings.Add(new CommandBinding(Commands.Selected, ToggleButton_OnChecked)); //this.VisibilityWith(MaxPageCount > 1); - this.Visibility = MaxPageCount > 1 ? Visibility.Visible : Visibility.Collapsed; + this.Visibility = this.MaxPageCount > 1 ? Visibility.Visible : Visibility.Collapsed; } #region Public Properties @@ -279,16 +277,16 @@ private void CheckNull() private void Update() { if (!_appliedTemplate) return; - _buttonLeft.IsEnabled = PageIndex > 1; - _buttonRight.IsEnabled = PageIndex < MaxPageCount; - if (MaxPageInterval == 0) + _buttonLeft.IsEnabled = this.PageIndex > 1; + _buttonRight.IsEnabled = this.PageIndex < this.MaxPageCount; + if (this.MaxPageInterval == 0) { _buttonFirst.Visibility = Visibility.Collapsed; _buttonLast.Visibility = Visibility.Collapsed; _textBlockLeft.Visibility = Visibility.Collapsed; _textBlockRight.Visibility = Visibility.Collapsed; _panelMain.Children.Clear(); - RadioButton selectButton = CreateButton(PageIndex); + RadioButton selectButton = CreateButton(this.PageIndex); _panelMain.Children.Add(selectButton); selectButton.IsChecked = true; return; @@ -299,31 +297,31 @@ private void Update() _textBlockRight.Visibility = Visibility.Visible; //更新最后一页 - if (MaxPageCount == 1) + if (this.MaxPageCount == 1) { _buttonLast.Visibility = Visibility.Collapsed; } else { _buttonLast.Visibility = Visibility.Visible; - _buttonLast.Tag = MaxPageCount.ToString(); + _buttonLast.Tag = this.MaxPageCount.ToString(); } //更新省略号 - int right = MaxPageCount - PageIndex; - int left = PageIndex - 1; - _textBlockRight.Visibility = right > MaxPageInterval ? Visibility.Visible : Visibility.Collapsed; - _textBlockLeft.Visibility = left > MaxPageInterval ? Visibility.Visible : Visibility.Collapsed; + int right = this.MaxPageCount - this.PageIndex; + int left = this.PageIndex - 1; + _textBlockRight.Visibility = right > this.MaxPageInterval ? Visibility.Visible : Visibility.Collapsed; + _textBlockLeft.Visibility = left > this.MaxPageInterval ? Visibility.Visible : Visibility.Collapsed; //更新中间部分 _panelMain.Children.Clear(); - if (PageIndex > 1 && PageIndex < MaxPageCount) + if (this.PageIndex > 1 && this.PageIndex < this.MaxPageCount) { - RadioButton selectButton = CreateButton(PageIndex); + RadioButton selectButton = CreateButton(this.PageIndex); _panelMain.Children.Add(selectButton); selectButton.IsChecked = true; } - else if (PageIndex == 1) + else if (this.PageIndex == 1) { _buttonFirst.IsChecked = true; } @@ -332,8 +330,8 @@ private void Update() _buttonLast.IsChecked = true; } - int sub = PageIndex; - for (int i = 0; i < MaxPageInterval - 1; i++) + int sub = this.PageIndex; + for (int i = 0; i < this.MaxPageInterval - 1; i++) { if (--sub > 1) { @@ -344,10 +342,10 @@ private void Update() break; } } - int add = PageIndex; - for (int i = 0; i < MaxPageInterval - 1; i++) + int add = this.PageIndex; + for (int i = 0; i < this.MaxPageInterval - 1; i++) { - if (++add < MaxPageCount) + if (++add < this.MaxPageCount) { _panelMain.Children.Add(CreateButton(add)); } @@ -358,9 +356,9 @@ private void Update() } } - private void ButtonPrev_OnClick(object sender, RoutedEventArgs e) => PageIndex--; + private void ButtonPrev_OnClick(object sender, RoutedEventArgs e) => this.PageIndex--; - private void ButtonNext_OnClick(object sender, RoutedEventArgs e) => PageIndex++; + private void ButtonNext_OnClick(object sender, RoutedEventArgs e) => this.PageIndex++; private RadioButton CreateButton(int page) { @@ -375,7 +373,7 @@ private void ToggleButton_OnChecked(object sender, RoutedEventArgs e) { if (!(e.OriginalSource is RadioButton button)) return; if (button.IsChecked == false) return; - PageIndex = int.Parse(button.Tag.ToString()); + this.PageIndex = int.Parse(button.Tag.ToString()); } #endregion Private Methods diff --git a/Source/Controls/H.Controls.Panel/HexGrid.xaml.cs b/Source/Controls/H.Controls.Panel/HexGrid.xaml.cs index 5c5cb058..bc9c3126 100644 --- a/Source/Controls/H.Controls.Panel/HexGrid.xaml.cs +++ b/Source/Controls/H.Controls.Panel/HexGrid.xaml.cs @@ -78,16 +78,16 @@ private static bool ValidateCountCallback(object value) private int GetRow(UIElement e) { int row = (int)e.GetValue(Grid.RowProperty); - if (row >= RowCount) - row = RowCount - 1; + if (row >= this.RowCount) + row = this.RowCount - 1; return row; } private int GetColumn(UIElement e) { int column = (int)e.GetValue(Grid.ColumnProperty); - if (column >= ColumnCount) - column = ColumnCount - 1; + if (column >= this.ColumnCount) + column = this.ColumnCount - 1; return column; } @@ -102,7 +102,7 @@ protected override Size MeasureOverride(Size availableSize) // determine maximum desired size h = 0; w = 0; - foreach (UIElement e in InternalChildren) + foreach (UIElement e in this.InternalChildren) { e.Measure(availableSize); Size s = e.DesiredSize; @@ -113,10 +113,10 @@ protected override Size MeasureOverride(Size availableSize) } // multiply maximum size to RowCount and ColumnCount to get total size - if (Orientation == Orientation.Horizontal) - return new Size(w * (ColumnCount * 3 + 1) / 4, h * (RowCount * 2 + 1) / 2); + if (this.Orientation == Orientation.Horizontal) + return new Size(w * (this.ColumnCount * 3 + 1) / 4, h * (this.RowCount * 2 + 1) / 2); - return new Size(w * (ColumnCount * 2 + 1) / 2, h * (RowCount * 3 + 1) / 4); + return new Size(w * (this.ColumnCount * 2 + 1) / 2, h * (this.RowCount * 3 + 1) / 4); } return availableSize; @@ -125,7 +125,7 @@ protected override Size MeasureOverride(Size availableSize) #region HasShift private void HasShift(out bool first, out bool last) { - if (Orientation == Orientation.Horizontal) + if (this.Orientation == Orientation.Horizontal) HasRowShift(out first, out last); else HasColumnShift(out first, out last); @@ -150,7 +150,7 @@ private void HasRowShift(out bool firstRow, out bool lastRow) if (row == 0 && mod == 0) firstRow = false; - if (row == RowCount - 1 && mod == 1) + if (row == this.RowCount - 1 && mod == 1) lastRow = false; } } @@ -174,7 +174,7 @@ private void HasColumnShift(out bool firstColumn, out bool lastColumn) if (column == 0 && mod == 0) firstColumn = false; - if (column == ColumnCount - 1 && mod == 1) + if (column == this.ColumnCount - 1 && mod == 1) lastColumn = false; } } @@ -186,7 +186,7 @@ private Size GetHexSize(Size gridSize) double minH = 0; double minW = 0; - foreach (UIElement e in InternalChildren) + foreach (UIElement e in this.InternalChildren) { FrameworkElement f = e as FrameworkElement; if (f != null) @@ -216,7 +216,7 @@ private Size GetPossibleSize(Size gridSize) bool first, last; HasShift(out first, out last); - if (Orientation == Orientation.Horizontal) + if (this.Orientation == Orientation.Horizontal) return GetPossibleSizeHorizontal(gridSize, first, last); return GetPossibleSizeVertical(gridSize, first, last); @@ -224,10 +224,10 @@ private Size GetPossibleSize(Size gridSize) private Size GetPossibleSizeVertical(Size gridSize, bool first, bool last) { - int columns = ((first ? 0 : 1) + 2 * ColumnCount - (last ? 1 : 0)); + int columns = ((first ? 0 : 1) + 2 * this.ColumnCount - (last ? 1 : 0)); double w = 2 * (gridSize.Width / columns); - int rows = 1 + 3 * RowCount; + int rows = 1 + 3 * this.RowCount; double h = 4 * (gridSize.Height / rows); return new Size(w, h); @@ -235,10 +235,10 @@ private Size GetPossibleSizeVertical(Size gridSize, bool first, bool last) private Size GetPossibleSizeHorizontal(Size gridSize, bool first, bool last) { - int columns = 1 + 3 * ColumnCount; + int columns = 1 + 3 * this.ColumnCount; double w = 4 * (gridSize.Width / columns); - int rows = (first ? 0 : 1) + 2 * RowCount - (last ? 1 : 0); + int rows = (first ? 0 : 1) + 2 * this.RowCount - (last ? 1 : 0); double h = 2 * (gridSize.Height / rows); return new Size(w, h); @@ -251,7 +251,7 @@ protected override Size ArrangeOverride(Size finalSize) HasShift(out first, out last); Size hexSize = GetHexSize(finalSize); double columnWidth, rowHeight; - if (Orientation == Orientation.Horizontal) + if (this.Orientation == Orientation.Horizontal) { rowHeight = 0.50 * hexSize.Height; columnWidth = 0.25 * hexSize.Width; @@ -280,7 +280,7 @@ private void ArrangeElement(UIElement e, Size hexSize, double columnWidth, doubl double x; double y; - if (Orientation == Orientation.Horizontal) + if (this.Orientation == Orientation.Horizontal) { x = 3 * columnWidth * column; y = rowHeight * (2 * row + (column % 2 == 1 ? 1 : 0) + (shift ? -1 : 0)); diff --git a/Source/Controls/H.Controls.Panel/Panel/ArcPanel.cs b/Source/Controls/H.Controls.Panel/Panel/ArcPanel.cs index e0fbee66..045d93cf 100644 --- a/Source/Controls/H.Controls.Panel/Panel/ArcPanel.cs +++ b/Source/Controls/H.Controls.Panel/Panel/ArcPanel.cs @@ -94,7 +94,7 @@ protected override Size ArrangeOverride(Size finalSize) { System.Collections.Generic.List children = this.GetChildren(); Point center = new Point(finalSize.Width / 2, finalSize.Height / 2); - Point start = new Point(finalSize.Width / 2 + Len, finalSize.Height / 2); + Point start = new Point(finalSize.Width / 2 + this.Len, finalSize.Height / 2); double totalAngle = this.EndAngle - this.StartAngle; for (int i = 0; i < children.Count; i++) { diff --git a/Source/Controls/H.Controls.Panel/Panel/CirclePanel.cs b/Source/Controls/H.Controls.Panel/Panel/CirclePanel.cs index 03940891..7e1b7679 100644 --- a/Source/Controls/H.Controls.Panel/Panel/CirclePanel.cs +++ b/Source/Controls/H.Controls.Panel/Panel/CirclePanel.cs @@ -53,7 +53,7 @@ protected override Size ArrangeOverride(Size finalSize) { System.Collections.Generic.List children = this.GetChildren(); Point center = new Point(finalSize.Width / 2, finalSize.Height / 2); - Point start = new Point(finalSize.Width / 2 + Len, finalSize.Height / 2); + Point start = new Point(finalSize.Width / 2 + this.Len, finalSize.Height / 2); for (int i = 0; i < children.Count; i++) { UIElement elment = children[i]; diff --git a/Source/Controls/H.Controls.Panel/Panel/DockPanel.cs b/Source/Controls/H.Controls.Panel/Panel/DockPanel.cs index 7850bc40..91198de0 100644 --- a/Source/Controls/H.Controls.Panel/Panel/DockPanel.cs +++ b/Source/Controls/H.Controls.Panel/Panel/DockPanel.cs @@ -241,7 +241,7 @@ protected override Size ArrangeOverride(Size finalSize) Func GetLen = index => { - if (IsFull && (children.Count - 1) % 2 == 1 && index >= count) + if (this.IsFull && (children.Count - 1) % 2 == 1 && index >= count) { return finalSize.Width / (count - 1); } @@ -404,7 +404,7 @@ protected override Size ArrangeOverride(Size finalSize) Func GetLen = index => { - if (IsFull && (children.Count - 1) % 2 == 1 && index >= count) + if (this.IsFull && (children.Count - 1) % 2 == 1 && index >= count) { return finalSize.Height / (count - 1); } diff --git a/Source/Controls/H.Controls.Panel/Panel/DragPanel.cs b/Source/Controls/H.Controls.Panel/Panel/DragPanel.cs index 625e936d..8fa8bbfb 100644 --- a/Source/Controls/H.Controls.Panel/Panel/DragPanel.cs +++ b/Source/Controls/H.Controls.Panel/Panel/DragPanel.cs @@ -32,7 +32,7 @@ public DragPanel() : base() private UIElement GetChildThatHasMouseOver() { - return GetParent(Mouse.DirectlyOver as DependencyObject, (ve) => Children.Contains(ve as UIElement)) as UIElement; + return GetParent(Mouse.DirectlyOver as DependencyObject, (ve) => this.Children.Contains(ve as UIElement)) as UIElement; } private Point GetItemVisualPoint(UIElement element) @@ -45,8 +45,8 @@ private Point GetItemVisualPoint(UIElement element) private int GetIndexFromPoint(double x, double y) { - int columnIndex = (int)Math.Truncate(x / itemContainterWidth); - int rowIndex = (int)Math.Truncate(y / itemContainterHeight); + int columnIndex = (int)Math.Truncate(x / this.itemContainterWidth); + int rowIndex = (int)Math.Truncate(y / this.itemContainterHeight); return columns * rowIndex + columnIndex; } @@ -108,11 +108,11 @@ public int AnimationMilliseconds } private double itemContainterHeight { - get { return ItemSeparation.Top + ItemsHeight + ItemSeparation.Bottom; } + get { return this.ItemSeparation.Top + this.ItemsHeight + this.ItemSeparation.Bottom; } } private double itemContainterWidth { - get { return ItemSeparation.Left + ItemsWidth + ItemSeparation.Right; } + get { return this.ItemSeparation.Left + this.ItemsWidth + this.ItemSeparation.Right; } } public ICommand SwapCommand { @@ -127,16 +127,16 @@ private void AnimateAll() //Apply exactly the same algorithm, but instide of Arrange a call AnimateTo method double colPosition = 0; double rowPosition = 0; - foreach (UIElement child in Children) + foreach (UIElement child in this.Children) { - if (child != _draggedElement) - AnimateTo(child, colPosition + ItemSeparation.Left, rowPosition + ItemSeparation.Top, _isNotFirstArrange ? AnimationMilliseconds : 0); + if (child != this._draggedElement) + AnimateTo(child, colPosition + this.ItemSeparation.Left, rowPosition + this.ItemSeparation.Top, _isNotFirstArrange ? this.AnimationMilliseconds : 0); //drag will locate dragged element - colPosition += itemContainterWidth; + colPosition += this.itemContainterWidth; if (colPosition + 1 > _calculatedSize.Width) { colPosition = 0; - rowPosition += itemContainterHeight; + rowPosition += this.itemContainterHeight; } } } @@ -161,22 +161,22 @@ private DoubleAnimation MakeAnimation(double to, int duration) #region measure protected override Size MeasureOverride(Size availableSize) { - Size itemContainerSize = new Size(itemContainterWidth, itemContainterHeight); + Size itemContainerSize = new Size(this.itemContainterWidth, this.itemContainterHeight); int count = 0; //for not call it again - foreach (UIElement child in Children) + foreach (UIElement child in this.Children) { child.Measure(itemContainerSize); count++; } - if (availableSize.Width < itemContainterWidth) - _calculatedSize = new Size(itemContainterWidth, count * itemContainterHeight); //the size of nX1 + if (availableSize.Width < this.itemContainterWidth) + _calculatedSize = new Size(this.itemContainterWidth, count * this.itemContainterHeight); //the size of nX1 else { - columns = (int)Math.Truncate(availableSize.Width / itemContainterWidth); + columns = (int)Math.Truncate(availableSize.Width / this.itemContainterWidth); rows = count / columns; if (count % columns != 0) rows++; - _calculatedSize = new Size(columns * itemContainterWidth, rows * itemContainterHeight); + _calculatedSize = new Size(columns * this.itemContainterWidth, rows * this.itemContainterHeight); } return _calculatedSize; } @@ -185,9 +185,9 @@ protected override Size MeasureOverride(Size availableSize) #region arrange protected override Size ArrangeOverride(Size finalSize) { - Size _finalItemSize = new Size(ItemsWidth, ItemsHeight); + Size _finalItemSize = new Size(this.ItemsWidth, this.ItemsHeight); //if is animated then arrange elements to 0,0, and then put them on its location using the transform - foreach (UIElement child in InternalChildren) + foreach (UIElement child in this.InternalChildren) { // If this is the first time we've seen this child, add our transforms if (child.RenderTransform as TransformGroup == null) @@ -275,9 +275,9 @@ private ScrollViewer scrollViewer private void OnMouseMove(object sender, MouseEventArgs e) { - if (e.LeftButton == MouseButtonState.Pressed && _draggedElement == null && !this.IsMouseCaptured) + if (e.LeftButton == MouseButtonState.Pressed && this._draggedElement == null && !this.IsMouseCaptured) StartDrag(e); - else if (_draggedElement != null) + else if (this._draggedElement != null) OnDragOver(e); } @@ -295,38 +295,38 @@ private void OnDragOver(MouseEventArgs e) if (_x + difX < _rectOnDrag.Location.X) _x = 0; - else if (ItemsWidth + _x + difX > _rectOnDrag.Location.X + _rectOnDrag.Width) - _x = _rectOnDrag.Location.X + _rectOnDrag.Width - ItemsWidth; + else if (this.ItemsWidth + _x + difX > _rectOnDrag.Location.X + _rectOnDrag.Width) + _x = _rectOnDrag.Location.X + _rectOnDrag.Width - this.ItemsWidth; else if (mousePos.X > _rectOnDrag.Location.X && mousePos.X < _rectOnDrag.Location.X + _rectOnDrag.Width) _x += difX; if (_y + difY < _rectOnDrag.Location.Y) _y = 0; - else if (ItemsHeight + _y + difY > _rectOnDrag.Location.Y + _rectOnDrag.Height) - _y = _rectOnDrag.Location.Y + _rectOnDrag.Height - ItemsHeight; + else if (this.ItemsHeight + _y + difY > _rectOnDrag.Location.Y + _rectOnDrag.Height) + _y = _rectOnDrag.Location.Y + _rectOnDrag.Height - this.ItemsHeight; else if (mousePos.Y > _rectOnDrag.Location.Y && mousePos.Y < _rectOnDrag.Location.Y + _rectOnDrag.Height) _y += difY; //lines ends - AnimateTo(_draggedElement, _x, _y, 0); + AnimateTo(this._draggedElement, _x, _y, 0); _lastMousePosX = mousePos.X; _lastMousePosY = mousePos.Y; _lastMouseMoveTime = e.Timestamp; - SwapElement(_x + ItemsWidth / 2, _y + ItemsHeight / 2); + SwapElement(_x + this.ItemsWidth / 2, _y + this.ItemsHeight / 2); } } private void StartDrag(MouseEventArgs e) { Point mousePos = Mouse.GetPosition(this); - _draggedElement = GetChildThatHasMouseOver(); - if (_draggedElement == null) + this._draggedElement = GetChildThatHasMouseOver(); + if (this._draggedElement == null) return; - _draggedIndex = Children.IndexOf(_draggedElement); + _draggedIndex = this.Children.IndexOf(this._draggedElement); _rectOnDrag = VisualTreeHelper.GetDescendantBounds(this); - Point p = GetItemVisualPoint(_draggedElement); + Point p = GetItemVisualPoint(this._draggedElement); _x = p.X; _y = p.Y; - SetZIndex(_draggedElement, 1000); + SetZIndex(this._draggedElement, 1000); _lastMousePosX = mousePos.X; _lastMousePosY = mousePos.Y; _lastMouseMoveTime = e.Timestamp; @@ -347,19 +347,19 @@ private void SwapElement(double x, double y) if (index == _draggedIndex || index < 0) return; - if (index >= Children.Count) - index = Children.Count - 1; + if (index >= this.Children.Count) + index = this.Children.Count - 1; int[] parameter = new int[] { _draggedIndex, index }; - if (SwapCommand != null && SwapCommand.CanExecute(parameter)) + if (this.SwapCommand != null && this.SwapCommand.CanExecute(parameter)) { - SwapCommand.Execute(parameter); + this.SwapCommand.Execute(parameter); - _draggedElement = Children[index]; + this._draggedElement = this.Children[index]; //this is bcause after changing the collection the element is other - FillNewDraggedChild(_draggedElement); + FillNewDraggedChild(this._draggedElement); _draggedIndex = index; } @@ -368,10 +368,10 @@ private void SwapElement(double x, double y) // Do :设置更新ListBox数据 if (this.AutoSwapItems(_draggedIndex, index)) { - _draggedElement = Children[index]; + this._draggedElement = this.Children[index]; //this is bcause after changing the collection the element is other - FillNewDraggedChild(_draggedElement); + FillNewDraggedChild(this._draggedElement); _draggedIndex = index; } @@ -437,38 +437,38 @@ private void OnLostMouseCapture(object sender, MouseEventArgs e) private void FinishDrag() { - if (_draggedElement != null) + if (this._draggedElement != null) { - SetZIndex(_draggedElement, 0); - _draggedElement = null; + SetZIndex(this._draggedElement, 0); + this._draggedElement = null; this.InvalidateArrange(); } } private void DoScroll() { - if (scrollViewer != null) + if (this.scrollViewer != null) { - Point position = Mouse.GetPosition(scrollViewer); - double scrollMargin = Math.Min(scrollViewer.FontSize * 2, scrollViewer.ActualHeight / 2); + Point position = Mouse.GetPosition(this.scrollViewer); + double scrollMargin = Math.Min(this.scrollViewer.FontSize * 2, this.scrollViewer.ActualHeight / 2); - if (position.X >= scrollViewer.ActualWidth - scrollMargin && - scrollViewer.HorizontalOffset < scrollViewer.ExtentWidth - scrollViewer.ViewportWidth) + if (position.X >= this.scrollViewer.ActualWidth - scrollMargin && + this.scrollViewer.HorizontalOffset < this.scrollViewer.ExtentWidth - this.scrollViewer.ViewportWidth) { - scrollViewer.LineRight(); + this.scrollViewer.LineRight(); } - else if (position.X < scrollMargin && scrollViewer.HorizontalOffset > 0) + else if (position.X < scrollMargin && this.scrollViewer.HorizontalOffset > 0) { - scrollViewer.LineLeft(); + this.scrollViewer.LineLeft(); } - else if (position.Y >= scrollViewer.ActualHeight - scrollMargin && - scrollViewer.VerticalOffset < scrollViewer.ExtentHeight - scrollViewer.ViewportHeight) + else if (position.Y >= this.scrollViewer.ActualHeight - scrollMargin && + this.scrollViewer.VerticalOffset < this.scrollViewer.ExtentHeight - this.scrollViewer.ViewportHeight) { - scrollViewer.LineDown(); + this.scrollViewer.LineDown(); } - else if (position.Y < scrollMargin && scrollViewer.VerticalOffset > 0) + else if (position.Y < scrollMargin && this.scrollViewer.VerticalOffset > 0) { - scrollViewer.LineUp(); + this.scrollViewer.LineUp(); } } } diff --git a/Source/Controls/H.Controls.PrintBox/DocumentViewPresenter.xaml.cs b/Source/Controls/H.Controls.PrintBox/DocumentViewPresenter.xaml.cs index 4c392260..f49953a5 100644 --- a/Source/Controls/H.Controls.PrintBox/DocumentViewPresenter.xaml.cs +++ b/Source/Controls/H.Controls.PrintBox/DocumentViewPresenter.xaml.cs @@ -2,11 +2,6 @@ using H.Providers.Mvvm; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; using System.Windows.Documents; namespace H.Controls.PrintBox diff --git a/Source/Controls/H.Controls.PrintBox/PageSize.cs b/Source/Controls/H.Controls.PrintBox/PageSize.cs index e2274fbc..c7f824b2 100644 --- a/Source/Controls/H.Controls.PrintBox/PageSize.cs +++ b/Source/Controls/H.Controls.PrintBox/PageSize.cs @@ -11,10 +11,10 @@ public class PageSize { public PageSize(PageMediaSizeName sizeName, Size size, string name) { - Name = name; - SizeName = sizeName; - SizeInInch = new Size(size.Width / 25.4, size.Height / 25.4); - SizeDesc = size.Width.ToString() + " x " + size.Height.ToString() + " mm"; + this.Name = name; + this.SizeName = sizeName; + this.SizeInInch = new Size(size.Width / 25.4, size.Height / 25.4); + this.SizeDesc = size.Width.ToString() + " x " + size.Height.ToString() + " mm"; } public string Name { get; set; } diff --git a/Source/Controls/H.Controls.PrintBox/PagerSizeViewPresenter.xaml.cs b/Source/Controls/H.Controls.PrintBox/PagerSizeViewPresenter.xaml.cs index a9307f78..7dbf568c 100644 --- a/Source/Controls/H.Controls.PrintBox/PagerSizeViewPresenter.xaml.cs +++ b/Source/Controls/H.Controls.PrintBox/PagerSizeViewPresenter.xaml.cs @@ -1,10 +1,10 @@ -using System.Collections.ObjectModel; -using System.Windows; -using System.Linq; -using System.ComponentModel.DataAnnotations; -using H.Providers.Ioc; -using System; +using H.Providers.Ioc; using H.Providers.Mvvm; +using System; +using System.Collections.ObjectModel; +using System.ComponentModel.DataAnnotations; +using System.Linq; +using System.Windows; namespace H.Controls.PrintBox { diff --git a/Source/Controls/H.Controls.PrintBox/PrintBox.xaml.cs b/Source/Controls/H.Controls.PrintBox/PrintBox.xaml.cs index a9d15202..9400a610 100644 --- a/Source/Controls/H.Controls.PrintBox/PrintBox.xaml.cs +++ b/Source/Controls/H.Controls.PrintBox/PrintBox.xaml.cs @@ -2,7 +2,6 @@ using H.Providers.Ioc; using System; using System.Collections.Generic; -using System.Linq; using System.Printing; using System.Windows; using System.Windows.Controls; @@ -29,10 +28,10 @@ public PrintBox() { capabilities = _printDialog.PrintQueue.GetPrintCapabilities(_printDialog.PrintTicket); } - catch (Exception ex) + catch (Exception) { IocMessage.Dialog.Show("请先设置系统默认打印机"); - throw ex; + throw; } this.PrintableAreaWidth = _printDialog.PrintableAreaWidth; this.PrintableAreaHeight = _printDialog.PrintableAreaHeight; @@ -69,7 +68,7 @@ public PrintBox() } { CommandBinding binding = new CommandBinding(PrintCommands.Print); - binding.Executed += async (l, k) => + binding.Executed += (l, k) => { FixedDocument fixedDoc = this.GetFixedDocument(); IocMessage.Snack?.ShowInfo("正在打印.."); diff --git a/Source/Controls/H.Controls.PrintBox/PrintBoxSetting.cs b/Source/Controls/H.Controls.PrintBox/PrintBoxSetting.cs index 2340233e..110deef7 100644 --- a/Source/Controls/H.Controls.PrintBox/PrintBoxSetting.cs +++ b/Source/Controls/H.Controls.PrintBox/PrintBoxSetting.cs @@ -1,6 +1,6 @@ -using System.ComponentModel.DataAnnotations; +using H.Extensions.Setting; using H.Providers.Ioc; -using H.Extensions.Setting; +using System.ComponentModel.DataAnnotations; namespace H.Controls.PrintBox { diff --git a/Source/Controls/H.Controls.PrintBox/PrintDocumentViewer.cs b/Source/Controls/H.Controls.PrintBox/PrintDocumentViewer.cs index b7449cc6..0267491e 100644 --- a/Source/Controls/H.Controls.PrintBox/PrintDocumentViewer.cs +++ b/Source/Controls/H.Controls.PrintBox/PrintDocumentViewer.cs @@ -1,10 +1,7 @@  -using System.Windows.Controls; -using System.Windows.Documents.Serialization; -using System.Windows.Documents; -using System.Windows.Input; using System.Printing; +using System.Windows.Controls; namespace H.Controls.PrintBox { diff --git a/Source/Controls/H.Controls.ProgressButton/ProgressButton.xaml.cs b/Source/Controls/H.Controls.ProgressButton/ProgressButton.xaml.cs index f19e4f73..0d082355 100644 --- a/Source/Controls/H.Controls.ProgressButton/ProgressButton.xaml.cs +++ b/Source/Controls/H.Controls.ProgressButton/ProgressButton.xaml.cs @@ -26,7 +26,7 @@ public bool IsIndeterminate set { SetValue(IsIndeterminateProperty, value); } } - + public static readonly DependencyProperty IsIndeterminateProperty = DependencyProperty.Register("IsIndeterminate", typeof(bool), typeof(ProgressButton), new FrameworkPropertyMetadata(default(bool), (d, e) => { @@ -53,7 +53,7 @@ public bool IsBusy set { SetValue(IsBusyProperty, value); } } - + public static readonly DependencyProperty IsBusyProperty = DependencyProperty.Register("IsBusy", typeof(bool), typeof(ProgressButton), new FrameworkPropertyMetadata(default(bool), (d, e) => { @@ -80,7 +80,7 @@ public double Percent set { SetValue(PercentProperty, value); } } - + public static readonly DependencyProperty PercentProperty = DependencyProperty.Register("Percent", typeof(double), typeof(ProgressButton), new FrameworkPropertyMetadata(default(double), (d, e) => { @@ -107,7 +107,7 @@ public string Message set { SetValue(MessageProperty, value); } } - + public static readonly DependencyProperty MessageProperty = DependencyProperty.Register("Message", typeof(string), typeof(ProgressButton), new FrameworkPropertyMetadata(default(string), (d, e) => { @@ -134,7 +134,7 @@ public double ProgressOpacity set { SetValue(ProgressOpacityProperty, value); } } - + public static readonly DependencyProperty ProgressOpacityProperty = DependencyProperty.Register("ProgressOpacity", typeof(double), typeof(ProgressButton), new FrameworkPropertyMetadata(0.5, (d, e) => { diff --git a/Source/Controls/H.Controls.PropertyGrid/ButtonSpinner/Implementation/ButtonSpinner.cs b/Source/Controls/H.Controls.PropertyGrid/ButtonSpinner/Implementation/ButtonSpinner.cs index 8b0bfc23..3f6bae9f 100644 --- a/Source/Controls/H.Controls.PropertyGrid/ButtonSpinner/Implementation/ButtonSpinner.cs +++ b/Source/Controls/H.Controls.PropertyGrid/ButtonSpinner/Implementation/ButtonSpinner.cs @@ -185,8 +185,8 @@ public override void OnApplyTemplate() { base.OnApplyTemplate(); - IncreaseButton = GetTemplateChild(PART_IncreaseButton) as ButtonBase; - DecreaseButton = GetTemplateChild(PART_DecreaseButton) as ButtonBase; + this.IncreaseButton = GetTemplateChild(PART_IncreaseButton) as ButtonBase; + this.DecreaseButton = GetTemplateChild(PART_DecreaseButton) as ButtonBase; SetButtonUsage(); } @@ -201,21 +201,21 @@ protected override void OnMouseLeftButtonUp(MouseButtonEventArgs e) base.OnMouseLeftButtonUp(e); Point mousePosition; - if (IncreaseButton != null && IncreaseButton.IsEnabled == false) + if (this.IncreaseButton != null && this.IncreaseButton.IsEnabled == false) { - mousePosition = e.GetPosition(IncreaseButton); - if (mousePosition.X > 0 && mousePosition.X < IncreaseButton.ActualWidth && - mousePosition.Y > 0 && mousePosition.Y < IncreaseButton.ActualHeight) + mousePosition = e.GetPosition(this.IncreaseButton); + if (mousePosition.X > 0 && mousePosition.X < this.IncreaseButton.ActualWidth && + mousePosition.Y > 0 && mousePosition.Y < this.IncreaseButton.ActualHeight) { e.Handled = true; } } - if (DecreaseButton != null && DecreaseButton.IsEnabled == false) + if (this.DecreaseButton != null && this.DecreaseButton.IsEnabled == false) { - mousePosition = e.GetPosition(DecreaseButton); - if (mousePosition.X > 0 && mousePosition.X < DecreaseButton.ActualWidth && - mousePosition.Y > 0 && mousePosition.Y < DecreaseButton.ActualHeight) + mousePosition = e.GetPosition(this.DecreaseButton); + if (mousePosition.X > 0 && mousePosition.X < this.DecreaseButton.ActualWidth && + mousePosition.Y > 0 && mousePosition.Y < this.DecreaseButton.ActualHeight) { e.Handled = true; } @@ -297,9 +297,9 @@ protected override void OnValidSpinDirectionChanged(ValidSpinDirections oldValue /// Event args. private void OnButtonClick(object sender, RoutedEventArgs e) { - if (AllowSpin) + if (this.AllowSpin) { - SpinDirection direction = sender == IncreaseButton ? SpinDirection.Increase : SpinDirection.Decrease; + SpinDirection direction = sender == this.IncreaseButton ? SpinDirection.Increase : SpinDirection.Decrease; OnSpin(new SpinEventArgs(Spinner.SpinnerSpinEvent, direction)); } } @@ -328,14 +328,14 @@ protected virtual void OnAllowSpinChanged(bool oldValue, bool newValue) private void SetButtonUsage() { // buttonspinner adds buttons that spin, so disable accordingly. - if (IncreaseButton != null) + if (this.IncreaseButton != null) { - IncreaseButton.IsEnabled = AllowSpin && ((ValidSpinDirection & ValidSpinDirections.Increase) == ValidSpinDirections.Increase); + this.IncreaseButton.IsEnabled = this.AllowSpin && ((this.ValidSpinDirection & ValidSpinDirections.Increase) == ValidSpinDirections.Increase); } - if (DecreaseButton != null) + if (this.DecreaseButton != null) { - DecreaseButton.IsEnabled = AllowSpin && ((ValidSpinDirection & ValidSpinDirections.Decrease) == ValidSpinDirections.Decrease); + this.DecreaseButton.IsEnabled = this.AllowSpin && ((this.ValidSpinDirection & ValidSpinDirections.Decrease) == ValidSpinDirections.Decrease); } } diff --git a/Source/Controls/H.Controls.PropertyGrid/ButtonSpinner/Implementation/SpinEventArgs.cs b/Source/Controls/H.Controls.PropertyGrid/ButtonSpinner/Implementation/SpinEventArgs.cs index 6f46f09f..9d558656 100644 --- a/Source/Controls/H.Controls.PropertyGrid/ButtonSpinner/Implementation/SpinEventArgs.cs +++ b/Source/Controls/H.Controls.PropertyGrid/ButtonSpinner/Implementation/SpinEventArgs.cs @@ -36,27 +36,27 @@ public bool UsingMouseWheel public SpinEventArgs(SpinDirection direction) : base() { - Direction = direction; + this.Direction = direction; } public SpinEventArgs(RoutedEvent routedEvent, SpinDirection direction) : base(routedEvent) { - Direction = direction; + this.Direction = direction; } public SpinEventArgs(SpinDirection direction, bool usingMouseWheel) : base() { - Direction = direction; - UsingMouseWheel = usingMouseWheel; + this.Direction = direction; + this.UsingMouseWheel = usingMouseWheel; } public SpinEventArgs(RoutedEvent routedEvent, SpinDirection direction, bool usingMouseWheel) : base(routedEvent) { - Direction = direction; - UsingMouseWheel = usingMouseWheel; + this.Direction = direction; + this.UsingMouseWheel = usingMouseWheel; } } } diff --git a/Source/Controls/H.Controls.PropertyGrid/ButtonSpinner/Implementation/Spinner.cs b/Source/Controls/H.Controls.PropertyGrid/ButtonSpinner/Implementation/Spinner.cs index 92263dc6..3d1eb92c 100644 --- a/Source/Controls/H.Controls.PropertyGrid/ButtonSpinner/Implementation/Spinner.cs +++ b/Source/Controls/H.Controls.PropertyGrid/ButtonSpinner/Implementation/Spinner.cs @@ -82,7 +82,7 @@ protected virtual void OnSpin(SpinEventArgs e) ValidSpinDirections valid = e.Direction == SpinDirection.Increase ? ValidSpinDirections.Increase : ValidSpinDirections.Decrease; //Only raise the event if spin is allowed. - if ((ValidSpinDirection & valid) == valid) + if ((this.ValidSpinDirection & valid) == valid) { EventHandler handler = Spin; if (handler != null) diff --git a/Source/Controls/H.Controls.PropertyGrid/Calculator/Implementation/Calculator.cs b/Source/Controls/H.Controls.PropertyGrid/Calculator/Implementation/Calculator.cs index 438d3a07..fce0be1f 100644 --- a/Source/Controls/H.Controls.PropertyGrid/Calculator/Implementation/Calculator.cs +++ b/Source/Controls/H.Controls.PropertyGrid/Calculator/Implementation/Calculator.cs @@ -231,7 +231,7 @@ static Calculator() public Calculator() { - CommandBindings.Add(new CommandBinding(CalculatorCommands.CalculatorButtonClick, ExecuteCalculatorButtonClick)); + this.CommandBindings.Add(new CommandBinding(CalculatorCommands.CalculatorButtonClick, ExecuteCalculatorButtonClick)); AddHandler(MouseDownEvent, new MouseButtonEventHandler(Calculator_OnMouseDown), true); } @@ -265,7 +265,7 @@ protected override void OnTextInput(TextCompositionEventArgs e) private void Calculator_OnMouseDown(object sender, MouseButtonEventArgs e) { - if (!IsFocused) + if (!this.IsFocused) { Focus(); e.Handled = true; @@ -298,7 +298,7 @@ internal void InitializeToValue(decimal? value) _previousValue = 0; _lastOperation = Operation.None; _showNewNumber = true; - Value = value; + this.Value = value; // Since the display text may be out of sync // with "Value", this call will force the // text update if Value was already equal to @@ -313,22 +313,22 @@ private void Calculate() try { - Value = Decimal.Round(CalculateValue(_lastOperation), Precision); - SetDisplayText(Value); //Set DisplayText even when Value doesn't change + this.Value = Decimal.Round(CalculateValue(_lastOperation), this.Precision); + SetDisplayText(this.Value); //Set DisplayText even when Value doesn't change } catch { - Value = null; - DisplayText = "ERROR"; + this.Value = null; + this.DisplayText = "ERROR"; } } private void SetDisplayText(decimal? newValue) { if (newValue.HasValue && (newValue.Value != 0)) - DisplayText = newValue.ToString(); + this.DisplayText = newValue.ToString(); else - DisplayText = "0"; + this.DisplayText = "0"; } private void Calculate(Operation newOperation) @@ -349,7 +349,7 @@ private void Calculate(Operation currentOperation, Operation newOperation) private decimal CalculateValue(Operation operation) { decimal newValue = decimal.Zero; - decimal currentValue = CalculatorUtilities.ParseDecimal(DisplayText); + decimal currentValue = CalculatorUtilities.ParseDecimal(this.DisplayText); switch (operation) { @@ -388,9 +388,9 @@ private decimal CalculateValue(Operation operation) private void ProcessBackKey() { string displayText; - if (DisplayText.Length > 1 && !(DisplayText.Length == 2 && DisplayText[0] == '-')) + if (this.DisplayText.Length > 1 && !(this.DisplayText.Length == 2 && this.DisplayText[0] == '-')) { - displayText = DisplayText.Remove(DisplayText.Length - 1, 1); + displayText = this.DisplayText.Remove(this.DisplayText.Length - 1, 1); } else { @@ -398,7 +398,7 @@ private void ProcessBackKey() _showNewNumber = true; } - DisplayText = displayText; + this.DisplayText = displayText; } private void ProcessCalculatorButton(CalculatorButtonType buttonType) @@ -414,36 +414,36 @@ private void ProcessCalculatorButton(CalculatorButtonType buttonType) private void ProcessDigitKey(CalculatorButtonType buttonType) { if (_showNewNumber) - DisplayText = CalculatorUtilities.GetCalculatorButtonContent(buttonType); + this.DisplayText = CalculatorUtilities.GetCalculatorButtonContent(buttonType); else - DisplayText += CalculatorUtilities.GetCalculatorButtonContent(buttonType); + this.DisplayText += CalculatorUtilities.GetCalculatorButtonContent(buttonType); _showNewNumber = false; } private void ProcessMemoryKey(Calculator.CalculatorButtonType buttonType) { - decimal currentValue = CalculatorUtilities.ParseDecimal(DisplayText); + decimal currentValue = CalculatorUtilities.ParseDecimal(this.DisplayText); _showNewNumber = true; switch (buttonType) { case Calculator.CalculatorButtonType.MAdd: - Memory += currentValue; + this.Memory += currentValue; break; case Calculator.CalculatorButtonType.MC: - Memory = decimal.Zero; + this.Memory = decimal.Zero; break; case Calculator.CalculatorButtonType.MR: - DisplayText = Memory.ToString(); + this.DisplayText = this.Memory.ToString(); _showNewNumber = false; break; case Calculator.CalculatorButtonType.MS: - Memory = currentValue; + this.Memory = currentValue; break; case Calculator.CalculatorButtonType.MSub: - Memory -= currentValue; + this.Memory -= currentValue; break; default: break; @@ -469,13 +469,13 @@ private void ProcessOperationKey(CalculatorButtonType buttonType) case CalculatorButtonType.Percent: if (_lastOperation != Operation.None) { - decimal currentValue = CalculatorUtilities.ParseDecimal(DisplayText); + decimal currentValue = CalculatorUtilities.ParseDecimal(this.DisplayText); decimal newValue = CalculatorUtilities.Percent(_previousValue, currentValue); - DisplayText = newValue.ToString(); + this.DisplayText = newValue.ToString(); } else { - DisplayText = "0"; + this.DisplayText = "0"; _showNewNumber = true; } return; @@ -495,7 +495,7 @@ private void ProcessOperationKey(CalculatorButtonType buttonType) Calculate(Operation.Clear, Operation.None); break; case CalculatorButtonType.Cancel: - DisplayText = _previousValue.ToString(); + this.DisplayText = _previousValue.ToString(); _lastOperation = Operation.None; _showNewNumber = true; return; @@ -506,7 +506,7 @@ private void ProcessOperationKey(CalculatorButtonType buttonType) break; } - Decimal.TryParse(DisplayText, out _previousValue); + Decimal.TryParse(this.DisplayText, out _previousValue); _showNewNumber = true; } diff --git a/Source/Controls/H.Controls.PropertyGrid/CalculatorUpDown/Implementation/CalculatorUpDown.cs b/Source/Controls/H.Controls.PropertyGrid/CalculatorUpDown/Implementation/CalculatorUpDown.cs index 81b1f428..436702d9 100644 --- a/Source/Controls/H.Controls.PropertyGrid/CalculatorUpDown/Implementation/CalculatorUpDown.cs +++ b/Source/Controls/H.Controls.PropertyGrid/CalculatorUpDown/Implementation/CalculatorUpDown.cs @@ -196,7 +196,7 @@ private void CalculatorPopup_Opened(object sender, EventArgs e) protected override void OnTextInput(TextCompositionEventArgs e) { - if (IsOpen && EnterClosesCalculator) + if (this.IsOpen && this.EnterClosesCalculator) { Calculator.CalculatorButtonType buttonType = CalculatorUtilities.GetCalculatorButtonTypeFromText(e.Text); if (buttonType == Calculator.CalculatorButtonType.Equal) @@ -208,11 +208,11 @@ protected override void OnTextInput(TextCompositionEventArgs e) private void OnKeyDown(object sender, KeyEventArgs e) { - if (!IsOpen) + if (!this.IsOpen) { if (KeyboardUtilities.IsKeyModifyingPopupState(e)) { - IsOpen = true; + this.IsOpen = true; // Calculator will get focus in CalculatorPopup_Opened(). e.Handled = true; } @@ -226,7 +226,7 @@ private void OnKeyDown(object sender, KeyEventArgs e) } else if (e.Key == Key.Escape) { - if (EnterClosesCalculator) + if (this.EnterClosesCalculator) { if (this.UpdateValueOnEnterKey) { @@ -254,12 +254,12 @@ private void OnMouseDownOutsideCapturedElement(object sender, MouseButtonEventAr private void CloseCalculatorUpDown(bool isFocusOnTextBox) { - if (IsOpen) - IsOpen = false; + if (this.IsOpen) + this.IsOpen = false; ReleaseMouseCapture(); - if (isFocusOnTextBox && (TextBox != null)) - TextBox.Focus(); + if (isFocusOnTextBox && (this.TextBox != null)) + this.TextBox.Focus(); } #endregion //Methods diff --git a/Source/Controls/H.Controls.PropertyGrid/CheckComboBox/Implementation/CheckComboBox.cs b/Source/Controls/H.Controls.PropertyGrid/CheckComboBox/Implementation/CheckComboBox.cs index ebaaee47..12d29602 100644 --- a/Source/Controls/H.Controls.PropertyGrid/CheckComboBox/Implementation/CheckComboBox.cs +++ b/Source/Controls/H.Controls.PropertyGrid/CheckComboBox/Implementation/CheckComboBox.cs @@ -4,7 +4,6 @@ using System.Collections.Generic; using System.Linq; using System.Windows; -using System.Windows.Controls; using System.Windows.Controls.Primitives; using System.Windows.Input; @@ -120,7 +119,7 @@ protected virtual void OnIsDropDownOpenChanged(bool oldValue, bool newValue) if (newValue) { _initialValue.Clear(); - foreach (object o in SelectedItems) + foreach (object o in this.SelectedItems) _initialValue.Add(o); } else @@ -209,11 +208,11 @@ private void OnMouseDownOutsideCapturedElement(object sender, MouseButtonEventAr private void OnKeyDown(object sender, KeyEventArgs e) { - if (!IsDropDownOpen) + if (!this.IsDropDownOpen) { if (KeyboardUtilities.IsKeyModifyingPopupState(e)) { - IsDropDownOpen = true; + this.IsDropDownOpen = true; // Popup_Opened() will Focus on ComboBoxItem. e.Handled = true; } @@ -232,9 +231,9 @@ private void OnKeyDown(object sender, KeyEventArgs e) } else if (e.Key == Key.Escape) { - SelectedItems.Clear(); + this.SelectedItems.Clear(); foreach (object o in _initialValue) - SelectedItems.Add(o); + this.SelectedItems.Add(o); CloseDropDown(true); e.Handled = true; } @@ -243,9 +242,9 @@ private void OnKeyDown(object sender, KeyEventArgs e) private void Popup_Opened(object sender, EventArgs e) { - UIElement item = ItemContainerGenerator.ContainerFromItem(SelectedItem) as UIElement; - if ((item == null) && (Items.Count > 0)) - item = ItemContainerGenerator.ContainerFromItem(Items[0]) as UIElement; + UIElement item = this.ItemContainerGenerator.ContainerFromItem(this.SelectedItem) as UIElement; + if ((item == null) && (this.Items.Count > 0)) + item = this.ItemContainerGenerator.ContainerFromItem(this.Items[0]) as UIElement; if (item != null) item.Focus(); } @@ -259,10 +258,10 @@ protected virtual void UpdateText() #if VS2008 string newValue = String.Join( Delimiter, SelectedItems.Cast().Select( x => GetItemDisplayValue( x ).ToString() ).ToArray() ); #else - string newValue = String.Join(Delimiter, SelectedItems.Cast().Select(x => GetItemDisplayValue(x))); + string newValue = String.Join(this.Delimiter, this.SelectedItems.Cast().Select(x => GetItemDisplayValue(x))); #endif - if (String.IsNullOrEmpty(Text) || !Text.Equals(newValue)) + if (String.IsNullOrEmpty(this.Text) || !this.Text.Equals(newValue)) { _ignoreTextValueChanged = true; #if VS2008 @@ -276,7 +275,7 @@ protected virtual void UpdateText() private void UpdateDisplayMemberPathValuesBindings() { - _displayMemberPathValuesChangeHelper.UpdateValueSource(ItemsCollection, this.DisplayMemberPath); + _displayMemberPathValuesChangeHelper.UpdateValueSource(this.ItemsCollection, this.DisplayMemberPath); } private void OnDisplayMemberPathValuesChanged() @@ -293,7 +292,7 @@ private void UpdateFromText() List selectedValues = null; if (!String.IsNullOrEmpty(this.Text)) { - selectedValues = this.Text.Replace(" ", string.Empty).Split(new string[] { Delimiter }, StringSplitOptions.RemoveEmptyEntries).ToList(); + selectedValues = this.Text.Replace(" ", string.Empty).Split(new string[] { this.Delimiter }, StringSplitOptions.RemoveEmptyEntries).ToList(); } this.UpdateFromList(selectedValues, this.GetItemDisplayValue); @@ -336,8 +335,8 @@ protected object GetItemDisplayValue(object item) private void CloseDropDown(bool isFocusOnComboBox) { - if (IsDropDownOpen) - IsDropDownOpen = false; + if (this.IsDropDownOpen) + this.IsDropDownOpen = false; ReleaseMouseCapture(); if (isFocusOnComboBox) diff --git a/Source/Controls/H.Controls.PropertyGrid/Chromes/Implementation/ButtonChrome.cs b/Source/Controls/H.Controls.PropertyGrid/Chromes/Implementation/ButtonChrome.cs index cf32f334..a349f38e 100644 --- a/Source/Controls/H.Controls.PropertyGrid/Chromes/Implementation/ButtonChrome.cs +++ b/Source/Controls/H.Controls.PropertyGrid/Chromes/Implementation/ButtonChrome.cs @@ -38,7 +38,7 @@ protected virtual void OnCornerRadiusChanged(CornerRadius oldValue, CornerRadius Math.Max(0, newValue.BottomRight - 1), Math.Max(0, newValue.BottomLeft - 1)); - InnerCornerRadius = newInnerCornerRadius; + this.InnerCornerRadius = newInnerCornerRadius; } #endregion //CornerRadius diff --git a/Source/Controls/H.Controls.PropertyGrid/CollectionControl/Implementation/CollectionControl.cs b/Source/Controls/H.Controls.PropertyGrid/CollectionControl/Implementation/CollectionControl.cs index 35aea153..2690cc94 100644 --- a/Source/Controls/H.Controls.PropertyGrid/CollectionControl/Implementation/CollectionControl.cs +++ b/Source/Controls/H.Controls.PropertyGrid/CollectionControl/Implementation/CollectionControl.cs @@ -117,7 +117,7 @@ public void OnItemSourceChanged(IEnumerable oldValue, IEnumerable newValue) { if (item != null) { - Items.Add(item); + this.Items.Add(item); } } } @@ -234,11 +234,11 @@ static CollectionControl() public CollectionControl() { - Items = new ObservableCollection(); - CommandBindings.Add(new CommandBinding(ApplicationCommands.New, AddNew, CanAddNew)); - CommandBindings.Add(new CommandBinding(ApplicationCommands.Delete, Delete, CanDelete)); - CommandBindings.Add(new CommandBinding(ComponentCommands.MoveDown, MoveDown, CanMoveDown)); - CommandBindings.Add(new CommandBinding(ComponentCommands.MoveUp, MoveUp, CanMoveUp)); + this.Items = new ObservableCollection(); + this.CommandBindings.Add(new CommandBinding(ApplicationCommands.New, AddNew, CanAddNew)); + this.CommandBindings.Add(new CommandBinding(ApplicationCommands.Delete, Delete, CanDelete)); + this.CommandBindings.Add(new CommandBinding(ComponentCommands.MoveDown, MoveDown, CanMoveDown)); + this.CommandBindings.Add(new CommandBinding(ComponentCommands.MoveUp, MoveUp, CanMoveUp)); } #endregion //Constructors @@ -401,11 +401,11 @@ private void AddNew(object sender, ExecutedRoutedEventArgs e) return; newItem = eventArgs.Item; - Items.Add(newItem); + this.Items.Add(newItem); this.RaiseEvent(new ItemEventArgs(ItemAddedEvent, newItem)); - SelectedItem = newItem; + this.SelectedItem = newItem; } private void CanAddNew(object sender, CanExecuteRoutedEventArgs e) @@ -429,49 +429,49 @@ private void Delete(object sender, ExecutedRoutedEventArgs e) if (eventArgs.Cancel) return; - Items.Remove(e.Parameter); + this.Items.Remove(e.Parameter); this.RaiseEvent(new ItemEventArgs(ItemDeletedEvent, e.Parameter)); } private void CanDelete(object sender, CanExecuteRoutedEventArgs e) { - e.CanExecute = e.Parameter != null && !IsReadOnly; + e.CanExecute = e.Parameter != null && !this.IsReadOnly; } private void MoveDown(object sender, ExecutedRoutedEventArgs e) { object selectedItem = e.Parameter; - int index = Items.IndexOf(selectedItem); - Items.RemoveAt(index); - Items.Insert(++index, selectedItem); + int index = this.Items.IndexOf(selectedItem); + this.Items.RemoveAt(index); + this.Items.Insert(++index, selectedItem); this.RaiseEvent(new ItemEventArgs(ItemMovedDownEvent, selectedItem)); - SelectedItem = selectedItem; + this.SelectedItem = selectedItem; } private void CanMoveDown(object sender, CanExecuteRoutedEventArgs e) { - if (e.Parameter != null && Items.IndexOf(e.Parameter) < (Items.Count - 1) && !IsReadOnly) + if (e.Parameter != null && this.Items.IndexOf(e.Parameter) < (this.Items.Count - 1) && !this.IsReadOnly) e.CanExecute = true; } private void MoveUp(object sender, ExecutedRoutedEventArgs e) { object selectedItem = e.Parameter; - int index = Items.IndexOf(selectedItem); - Items.RemoveAt(index); - Items.Insert(--index, selectedItem); + int index = this.Items.IndexOf(selectedItem); + this.Items.RemoveAt(index); + this.Items.Insert(--index, selectedItem); this.RaiseEvent(new ItemEventArgs(ItemMovedUpEvent, selectedItem)); - SelectedItem = selectedItem; + this.SelectedItem = selectedItem; } private void CanMoveUp(object sender, CanExecuteRoutedEventArgs e) { - if (e.Parameter != null && Items.IndexOf(e.Parameter) > 0 && !IsReadOnly) + if (e.Parameter != null && this.Items.IndexOf(e.Parameter) > 0 && !this.IsReadOnly) e.CanExecute = true; } @@ -560,16 +560,16 @@ private IEnumerable CreateItemsSource() { IEnumerable collection = null; - if (ItemsSourceType != null) + if (this.ItemsSourceType != null) { - System.Reflection.ConstructorInfo constructor = ItemsSourceType.GetConstructor(Type.EmptyTypes); + System.Reflection.ConstructorInfo constructor = this.ItemsSourceType.GetConstructor(Type.EmptyTypes); if (constructor != null) { collection = (IEnumerable)constructor.Invoke(null); } - else if (ItemsSourceType.IsArray) + else if (this.ItemsSourceType.IsArray) { - collection = Array.CreateInstance(ItemsSourceType.GetElementType(), Items.Count); + collection = Array.CreateInstance(this.ItemsSourceType.GetElementType(), this.Items.Count); } } @@ -583,10 +583,10 @@ private object CreateNewItem(Type type) private IEnumerable ComputeItemsSource() { - if (ItemsSource == null) - ItemsSource = CreateItemsSource(); + if (this.ItemsSource == null) + this.ItemsSource = CreateItemsSource(); - return ItemsSource; + return this.ItemsSource; } #endregion //Methods diff --git a/Source/Controls/H.Controls.PropertyGrid/CollectionControl/Implementation/CollectionControlDialog.xaml.cs b/Source/Controls/H.Controls.PropertyGrid/CollectionControl/Implementation/CollectionControlDialog.xaml.cs index 35352c09..5a9f6815 100644 --- a/Source/Controls/H.Controls.PropertyGrid/CollectionControl/Implementation/CollectionControlDialog.xaml.cs +++ b/Source/Controls/H.Controls.PropertyGrid/CollectionControl/Implementation/CollectionControlDialog.xaml.cs @@ -101,13 +101,13 @@ public CollectionControlDialog() public CollectionControlDialog(Type itemsourceType) : this() { - ItemsSourceType = itemsourceType; + this.ItemsSourceType = itemsourceType; } public CollectionControlDialog(Type itemsourceType, IList newItemTypes) : this(itemsourceType) { - NewItemTypes = newItemTypes; + this.NewItemTypes = newItemTypes; } #endregion //Constructors diff --git a/Source/Controls/H.Controls.PropertyGrid/CollectionControl/Implementation/ItemAddingEventArgs.cs b/Source/Controls/H.Controls.PropertyGrid/CollectionControl/Implementation/ItemAddingEventArgs.cs index 02447a96..84860ab5 100644 --- a/Source/Controls/H.Controls.PropertyGrid/CollectionControl/Implementation/ItemAddingEventArgs.cs +++ b/Source/Controls/H.Controls.PropertyGrid/CollectionControl/Implementation/ItemAddingEventArgs.cs @@ -11,7 +11,7 @@ public class ItemAddingEventArgs : CancelRoutedEventArgs public ItemAddingEventArgs(RoutedEvent itemAddingEvent, object itemAdding) : base(itemAddingEvent) { - Item = itemAdding; + this.Item = itemAdding; } #endregion diff --git a/Source/Controls/H.Controls.PropertyGrid/CollectionControl/Implementation/PrimitiveTypeCollectionControl.cs b/Source/Controls/H.Controls.PropertyGrid/CollectionControl/Implementation/PrimitiveTypeCollectionControl.cs index aef0d1d7..d2b27076 100644 --- a/Source/Controls/H.Controls.PropertyGrid/CollectionControl/Implementation/PrimitiveTypeCollectionControl.cs +++ b/Source/Controls/H.Controls.PropertyGrid/CollectionControl/Implementation/PrimitiveTypeCollectionControl.cs @@ -77,11 +77,11 @@ protected virtual void OnItemsSourceChanged(IList oldValue, IList newValue) if (newValue == null) return; - if (ItemsSourceType == null) - ItemsSourceType = newValue.GetType(); + if (this.ItemsSourceType == null) + this.ItemsSourceType = newValue.GetType(); - if (ItemType == null && newValue.GetType().ContainsGenericParameters) - ItemType = newValue.GetType().GetGenericArguments()[0]; + if (this.ItemType == null && newValue.GetType().ContainsGenericParameters) + this.ItemType = newValue.GetType().GetGenericArguments()[0]; SetText(newValue); } @@ -221,10 +221,10 @@ private IList ComputeItems() { IList items = new List(); - if (ItemType == null) + if (this.ItemType == null) return items; - string[] textArray = Text.Split('\n'); + string[] textArray = this.Text.Split('\n'); foreach (string s in textArray) { @@ -234,13 +234,13 @@ private IList ComputeItems() object value = null; try { - if (ItemType.IsEnum) + if (this.ItemType.IsEnum) { - value = Enum.Parse(ItemType, valueString); + value = Enum.Parse(this.ItemType, valueString); } else { - value = Convert.ChangeType(valueString, ItemType); + value = Convert.ChangeType(valueString, this.ItemType); } } catch @@ -259,24 +259,24 @@ private IList ComputeItems() private IList ComputeItemsSource() { - if (ItemsSource == null) + if (this.ItemsSource == null) { // Save current text since creating the ItemsSource will reset it string currentText = this.Text; - ItemsSource = CreateItemsSource(); + this.ItemsSource = CreateItemsSource(); this.Text = currentText; } - return ItemsSource; + return this.ItemsSource; } private IList CreateItemsSource() { IList list = null; - if (ItemsSourceType != null) + if (this.ItemsSourceType != null) { - ConstructorInfo constructor = ItemsSourceType.GetConstructor(Type.EmptyTypes); + ConstructorInfo constructor = this.ItemsSourceType.GetConstructor(Type.EmptyTypes); list = (IList)constructor.Invoke(null); } @@ -292,7 +292,7 @@ private void SetText(IEnumerable collection) builder.Append(obj2.ToString()); builder.AppendLine(); } - Text = builder.ToString().Trim(); + this.Text = builder.ToString().Trim(); _surpressTextChanged = false; } diff --git a/Source/Controls/H.Controls.PropertyGrid/ColorCanvas/Implementation/ColorCanvas.cs b/Source/Controls/H.Controls.PropertyGrid/ColorCanvas/Implementation/ColorCanvas.cs index 573a16d1..3cb21c93 100644 --- a/Source/Controls/H.Controls.PropertyGrid/ColorCanvas/Implementation/ColorCanvas.cs +++ b/Source/Controls/H.Controls.PropertyGrid/ColorCanvas/Implementation/ColorCanvas.cs @@ -219,7 +219,7 @@ private static void OnHexadecimalStringChanged(DependencyObject o, DependencyPro protected virtual void OnHexadecimalStringChanged(string oldValue, string newValue) { string newColorString = GetFormatedColorString(newValue); - string currentColorString = GetFormatedColorString(SelectedColor); + string currentColorString = GetFormatedColorString(this.SelectedColor); if (!currentColorString.Equals(newColorString)) { Color? col = null; @@ -295,7 +295,7 @@ private static void OnUsingAlphaChannelPropertyChanged(DependencyObject o, Depen protected virtual void OnUsingAlphaChannelChanged() { - SetHexadecimalStringProperty(GetFormatedColorString(SelectedColor), false); + SetHexadecimalStringProperty(GetFormatedColorString(this.SelectedColor), false); } #endregion //UsingAlphaChannel @@ -356,11 +356,11 @@ public override void OnApplyTemplate() if (_hexadecimalTextBox != null) _hexadecimalTextBox.LostFocus += new RoutedEventHandler(HexadecimalTextBox_LostFocus); - UpdateRGBValues(SelectedColor); - UpdateColorShadeSelectorPosition(SelectedColor); + UpdateRGBValues(this.SelectedColor); + UpdateColorShadeSelectorPosition(this.SelectedColor); // When changing theme, HexadecimalString needs to be set since it is not binded. - SetHexadecimalTextBoxTextProperty(GetFormatedColorString(SelectedColor)); + SetHexadecimalTextBoxTextProperty(GetFormatedColorString(this.SelectedColor)); } protected override void OnKeyDown(KeyEventArgs e) @@ -467,12 +467,12 @@ public event RoutedPropertyChangedEventHandler SelectedColorChanged private void UpdateSelectedColor() { - SelectedColor = Color.FromArgb(A, R, G, B); + this.SelectedColor = Color.FromArgb(this.A, this.R, this.G, this.B); } private void UpdateSelectedColor(Color? color) { - SelectedColor = ((color != null) && color.HasValue) + this.SelectedColor = ((color != null) && color.HasValue) ? Color.FromArgb(color.Value.A, color.Value.R, color.Value.G, color.Value.B) : null; } @@ -484,10 +484,10 @@ private void UpdateRGBValues(Color? color) _surpressPropertyChanged = true; - A = color.Value.A; - R = color.Value.R; - G = color.Value.G; - B = color.Value.B; + this.A = color.Value.A; + this.R = color.Value.R; + this.G = color.Value.G; + this.B = color.Value.B; _surpressPropertyChanged = false; } @@ -554,23 +554,23 @@ private void CalculateColor(Point p) V = 1 - p.Y }; Color currentColor = ColorUtilities.ConvertHsvToRgb(hsv.H, hsv.S, hsv.V); - currentColor.A = A; + currentColor.A = this.A; _updateSpectrumSliderValue = false; - SelectedColor = currentColor; + this.SelectedColor = currentColor; _updateSpectrumSliderValue = true; - SetHexadecimalStringProperty(GetFormatedColorString(SelectedColor), false); + SetHexadecimalStringProperty(GetFormatedColorString(this.SelectedColor), false); } private string GetFormatedColorString(Color? colorToFormat) { if ((colorToFormat == null) || !colorToFormat.HasValue) return string.Empty; - return ColorUtilities.FormatColorString(colorToFormat.ToString(), UsingAlphaChannel); + return ColorUtilities.FormatColorString(colorToFormat.ToString(), this.UsingAlphaChannel); } private string GetFormatedColorString(string stringToFormat) { - return ColorUtilities.FormatColorString(stringToFormat, UsingAlphaChannel); + return ColorUtilities.FormatColorString(stringToFormat, this.UsingAlphaChannel); } private void SetHexadecimalStringProperty(string newValue, bool modifyFromUI) @@ -589,18 +589,18 @@ private void SetHexadecimalStringProperty(string newValue, bool modifyFromUI) } ColorConverter.ConvertFromString(newValue); } - HexadecimalString = newValue; + this.HexadecimalString = newValue; } catch { //When HexadecimalString is changed via UI and hexadecimal format is bad, keep the previous HexadecimalString. - SetHexadecimalTextBoxTextProperty(HexadecimalString); + SetHexadecimalTextBoxTextProperty(this.HexadecimalString); } } else { //When HexadecimalString is changed via Code-Behind, hexadecimal format will be evaluated in OnCoerceHexadecimalString() - HexadecimalString = newValue; + this.HexadecimalString = newValue; } } diff --git a/Source/Controls/H.Controls.PropertyGrid/ColorCanvas/Implementation/ColorSpectrumSlider.cs b/Source/Controls/H.Controls.PropertyGrid/ColorCanvas/Implementation/ColorSpectrumSlider.cs index c8eaa0c7..83c3aba1 100644 --- a/Source/Controls/H.Controls.PropertyGrid/ColorCanvas/Implementation/ColorSpectrumSlider.cs +++ b/Source/Controls/H.Controls.PropertyGrid/ColorCanvas/Implementation/ColorSpectrumSlider.cs @@ -55,7 +55,7 @@ public override void OnApplyTemplate() _spectrumDisplay = (Rectangle)GetTemplateChild(PART_SpectrumDisplay); CreateSpectrum(); - OnValueChanged(Double.NaN, Value); + OnValueChanged(Double.NaN, this.Value); } protected override void OnValueChanged(double oldValue, double newValue) @@ -63,7 +63,7 @@ protected override void OnValueChanged(double oldValue, double newValue) base.OnValueChanged(oldValue, newValue); Color color = ColorUtilities.ConvertHsvToRgb(360 - newValue, 1, 1); - SelectedColor = color; + this.SelectedColor = color; } #endregion //Base Class Overrides diff --git a/Source/Controls/H.Controls.PropertyGrid/ColorPicker/Implementation/ColorItem.cs b/Source/Controls/H.Controls.PropertyGrid/ColorPicker/Implementation/ColorItem.cs index 58214c82..53ad805e 100644 --- a/Source/Controls/H.Controls.PropertyGrid/ColorPicker/Implementation/ColorItem.cs +++ b/Source/Controls/H.Controls.PropertyGrid/ColorPicker/Implementation/ColorItem.cs @@ -19,8 +19,8 @@ public string Name public ColorItem(Color? color, string name) { - Color = color; - Name = name; + this.Color = color; + this.Name = name; } public override bool Equals(object obj) @@ -28,7 +28,7 @@ public override bool Equals(object obj) ColorItem ci = obj as ColorItem; if (ci == null) return false; - return ci.Color.Equals(Color) && ci.Name.Equals(Name); + return ci.Color.Equals(this.Color) && ci.Name.Equals(this.Name); } public override int GetHashCode() diff --git a/Source/Controls/H.Controls.PropertyGrid/ColorPicker/Implementation/ColorPicker.cs b/Source/Controls/H.Controls.PropertyGrid/ColorPicker/Implementation/ColorPicker.cs index 8d5c8f47..c82fe56d 100644 --- a/Source/Controls/H.Controls.PropertyGrid/ColorPicker/Implementation/ColorPicker.cs +++ b/Source/Controls/H.Controls.PropertyGrid/ColorPicker/Implementation/ColorPicker.cs @@ -111,7 +111,7 @@ private void OnAvailableColorsSortingModeChanged(ColorSortingMode oldValue, Colo ListCollectionView lcv = (ListCollectionView)CollectionViewSource.GetDefaultView(this.AvailableColors); if (lcv != null) { - lcv.CustomSort = (AvailableColorsSortingMode == ColorSortingMode.HueSaturationBrightness) + lcv.CustomSort = (this.AvailableColorsSortingMode == ColorSortingMode.HueSaturationBrightness) ? new ColorSorter() : null; } @@ -326,7 +326,7 @@ private static void OnSelectedColorPropertyChanged(DependencyObject d, Dependenc private void OnSelectedColorChanged(Color? oldValue, Color? newValue) { - SelectedColorText = GetFormatedColorString(newValue); + this.SelectedColorText = GetFormatedColorString(newValue); RoutedPropertyChangedEventArgs args = new RoutedPropertyChangedEventArgs(oldValue, newValue); args.RoutedEvent = ColorPicker.SelectedColorChangedEvent; @@ -512,7 +512,7 @@ private static void OnUsingAlphaChannelPropertyChanged(DependencyObject d, Depen private void OnUsingAlphaChannelChanged() { - SelectedColorText = GetFormatedColorString(SelectedColor); + this.SelectedColorText = GetFormatedColorString(this.SelectedColor); } #endregion //UsingAlphaChannel @@ -596,11 +596,11 @@ protected override void OnMouseUp(MouseButtonEventArgs e) private void OnKeyDown(object sender, KeyEventArgs e) { - if (!IsOpen) + if (!this.IsOpen) { if (KeyboardUtilities.IsKeyModifyingPopupState(e)) { - IsOpen = true; + this.IsOpen = true; // Focus will be on ListBoxItem in Popup_Opened(). e.Handled = true; } @@ -633,7 +633,7 @@ private void Color_SelectionChanged(object sender, SelectionChangedEventArgs e) if (e.AddedItems.Count > 0) { ColorItem colorItem = (ColorItem)e.AddedItems[0]; - SelectedColor = colorItem.Color; + this.SelectedColor = colorItem.Color; if (!string.IsNullOrEmpty(colorItem.Name)) { this.SelectedColorText = colorItem.Name; @@ -646,13 +646,13 @@ private void Color_SelectionChanged(object sender, SelectionChangedEventArgs e) private void Popup_Opened(object sender, EventArgs e) { - if ((_availableColors != null) && ShowAvailableColors) + if ((_availableColors != null) && this.ShowAvailableColors) { FocusOnListBoxItem(_availableColors); } - else if ((_standardColors != null) && ShowStandardColors) + else if ((_standardColors != null) && this.ShowStandardColors) FocusOnListBoxItem(_standardColors); - else if ((_recentColors != null) && ShowRecentColors) + else if ((_recentColors != null) && this.ShowRecentColors) FocusOnListBoxItem(_recentColors); } @@ -726,22 +726,22 @@ public event RoutedEventHandler Closed private void CloseColorPicker(bool isFocusOnColorPicker) { - if (IsOpen) - IsOpen = false; + if (this.IsOpen) + this.IsOpen = false; ReleaseMouseCapture(); if (isFocusOnColorPicker && (_toggleButton != null)) _toggleButton.Focus(); - this.UpdateRecentColors(new ColorItem(SelectedColor, SelectedColorText)); + this.UpdateRecentColors(new ColorItem(this.SelectedColor, this.SelectedColorText)); } private void UpdateRecentColors(ColorItem colorItem) { - if (!RecentColors.Contains(colorItem)) - RecentColors.Add(colorItem); + if (!this.RecentColors.Contains(colorItem)) + this.RecentColors.Add(colorItem); - if (RecentColors.Count > 10) //don't allow more than ten, maybe make a property that can be set by the user. - RecentColors.RemoveAt(0); + if (this.RecentColors.Count > 10) //don't allow more than ten, maybe make a property that can be set by the user. + this.RecentColors.RemoveAt(0); } private string GetFormatedColorString(Color? colorToFormat) @@ -749,7 +749,7 @@ private string GetFormatedColorString(Color? colorToFormat) if ((colorToFormat == null) || !colorToFormat.HasValue) return string.Empty; - return ColorUtilities.FormatColorString(colorToFormat.Value.GetColorName(), UsingAlphaChannel); + return ColorUtilities.FormatColorString(colorToFormat.Value.GetColorName(), this.UsingAlphaChannel); } private static ObservableCollection CreateStandardColors() diff --git a/Source/Controls/H.Controls.PropertyGrid/Core/Converters/VisibilityToBoolConverter.cs b/Source/Controls/H.Controls.PropertyGrid/Core/Converters/VisibilityToBoolConverter.cs index 55bf01fa..6ee69c85 100644 --- a/Source/Controls/H.Controls.PropertyGrid/Core/Converters/VisibilityToBoolConverter.cs +++ b/Source/Controls/H.Controls.PropertyGrid/Core/Converters/VisibilityToBoolConverter.cs @@ -61,7 +61,7 @@ private object VisibilityToBool(object value) if (!(value is Visibility)) throw new InvalidOperationException(ErrorMessages.GetMessage("SuppliedValueWasNotVisibility")); - return (((Visibility)value) == Visibility.Visible) ^ Not; + return (((Visibility)value) == Visibility.Visible) ^ this.Not; } private object BoolToVisibility(object value) @@ -69,7 +69,7 @@ private object BoolToVisibility(object value) if (!(value is bool)) throw new InvalidOperationException(ErrorMessages.GetMessage("SuppliedValueWasNotBool")); - return ((bool)value ^ Not) ? Visibility.Visible : Visibility.Collapsed; + return ((bool)value ^ this.Not) ? Visibility.Visible : Visibility.Collapsed; } } } diff --git a/Source/Controls/H.Controls.PropertyGrid/Core/Input/InputValidationErrorEventArgs.cs b/Source/Controls/H.Controls.PropertyGrid/Core/Input/InputValidationErrorEventArgs.cs index 598893c5..6da091e6 100644 --- a/Source/Controls/H.Controls.PropertyGrid/Core/Input/InputValidationErrorEventArgs.cs +++ b/Source/Controls/H.Controls.PropertyGrid/Core/Input/InputValidationErrorEventArgs.cs @@ -12,7 +12,7 @@ public class InputValidationErrorEventArgs : EventArgs public InputValidationErrorEventArgs(Exception e) { - Exception = e; + this.Exception = e; } #endregion diff --git a/Source/Controls/H.Controls.PropertyGrid/Core/Utilities/Segment.cs b/Source/Controls/H.Controls.PropertyGrid/Core/Utilities/Segment.cs index c7b0cfee..32c28b32 100644 --- a/Source/Controls/H.Controls.PropertyGrid/Core/Utilities/Segment.cs +++ b/Source/Controls/H.Controls.PropertyGrid/Core/Utilities/Segment.cs @@ -148,7 +148,7 @@ public double Slope public bool Contains(Point point) { - if (IsEmpty) + if (this.IsEmpty) return false; // if the point is an endpoint, ensure that it is not excluded @@ -161,7 +161,7 @@ public bool Contains(Point point) bool result = false; // ensure that a line through P1 and the point is parallel to the current segment - if (DoubleHelper.AreVirtuallyEqual(Slope, new Segment(_p1, point).Slope)) + if (DoubleHelper.AreVirtuallyEqual(this.Slope, new Segment(_p1, point).Slope)) { // finally, ensure that the point is between the segment's endpoints result = (point.X >= Math.Min(_p1.X, _p2.X)) @@ -238,7 +238,7 @@ public Segment Intersection(Segment segment) double xProd = Vector.CrossProduct(v1, v2); // if segments are not parallel, then look for intersection on each segment - if (!DoubleHelper.AreVirtuallyEqual(Slope, segment.Slope)) + if (!DoubleHelper.AreVirtuallyEqual(this.Slope, segment.Slope)) { // check for intersection on other segment double s = Vector.CrossProduct(endpointVector, v1) / xProd; diff --git a/Source/Controls/H.Controls.PropertyGrid/DateTimeUpDown/Implementation/DateTimeUpDown.cs b/Source/Controls/H.Controls.PropertyGrid/DateTimeUpDown/Implementation/DateTimeUpDown.cs index 90561919..0eb40ff5 100644 --- a/Source/Controls/H.Controls.PropertyGrid/DateTimeUpDown/Implementation/DateTimeUpDown.cs +++ b/Source/Controls/H.Controls.PropertyGrid/DateTimeUpDown/Implementation/DateTimeUpDown.cs @@ -4,8 +4,6 @@ using System.Globalization; using System.Windows; -using System.Windows.Controls; - namespace H.Controls.PropertyGrid { @@ -185,7 +183,7 @@ public DateTimeUpDown() public override bool CommitInput() { - bool isSyncValid = this.SyncTextAndValueProperties(true, Text); + bool isSyncValid = this.SyncTextAndValueProperties(true, this.Text); _lastValidDate = this.Value; return isSyncValid; } @@ -254,17 +252,17 @@ protected override void OnTextChanged(string previousValue, string currentValue) protected override string ConvertValueToText() { - if (Value == null) + if (this.Value == null) return string.Empty; - return Value.Value.ToString(GetFormatString(Format), CultureInfo); + return this.Value.Value.ToString(GetFormatString(this.Format), this.CultureInfo); } protected override void SetValidSpinDirection() { ValidSpinDirections validDirections = ValidSpinDirections.None; - if (!IsReadOnly) + if (!this.IsReadOnly) { if (this.IsLowerThan(this.Value, this.Maximum) || !this.Value.HasValue || !this.Maximum.HasValue) validDirections = validDirections | ValidSpinDirections.Increase; @@ -315,11 +313,11 @@ protected override void OnValueChanged(DateTime? oldValue, DateTime? newValue) _lastValidDate = newValue; } - if (TextBox != null) + if (this.TextBox != null) { //we loose our selection when the Value is set so we need to reselect it without firing the selection changed event _fireSelectionChangedEvent = false; - TextBox.Select(info.StartPosition, info.Length); + this.TextBox.Select(info.StartPosition, info.Length); _fireSelectionChangedEvent = true; } } @@ -380,7 +378,7 @@ protected override void InitializeDateTimeInfoList(DateTime? value) _dateTimeInfoList.Clear(); _selectedDateTimeInfo = null; - string format = GetFormatString(Format); + string format = GetFormatString(this.Format); if (string.IsNullOrEmpty(format)) return; @@ -657,14 +655,14 @@ protected override void OnUpdateValueOnEnterKeyChanged(bool oldValue, bool newVa public void SelectAll() { _fireSelectionChangedEvent = false; - TextBox.SelectAll(); + this.TextBox.SelectAll(); _fireSelectionChangedEvent = true; } private void FormatUpdated() { InitializeDateTimeInfoList(this.Value); - if (Value != null) + if (this.Value != null) ParseValueIntoDateTimeInfo(this.Value); // Update the Text representation of the value. @@ -716,7 +714,7 @@ private void ParseValueIntoDateTimeInfo(DateTime? newDate) { DateTime date = newDate.Value; info.StartPosition = text.Length; - info.Content = date.ToString(info.Format, CultureInfo.DateTimeFormat); + info.Content = date.ToString(info.Format, this.CultureInfo.DateTimeFormat); info.Length = info.Content.Length; text += info.Content; } @@ -728,57 +726,57 @@ internal string GetFormatString(DateTimeFormat dateTimeFormat) switch (dateTimeFormat) { case DateTimeFormat.ShortDate: - return CultureInfo.DateTimeFormat.ShortDatePattern; + return this.CultureInfo.DateTimeFormat.ShortDatePattern; case DateTimeFormat.LongDate: - return CultureInfo.DateTimeFormat.LongDatePattern; + return this.CultureInfo.DateTimeFormat.LongDatePattern; case DateTimeFormat.ShortTime: - return CultureInfo.DateTimeFormat.ShortTimePattern; + return this.CultureInfo.DateTimeFormat.ShortTimePattern; case DateTimeFormat.LongTime: - return CultureInfo.DateTimeFormat.LongTimePattern; + return this.CultureInfo.DateTimeFormat.LongTimePattern; case DateTimeFormat.FullDateTime: - return CultureInfo.DateTimeFormat.FullDateTimePattern; + return this.CultureInfo.DateTimeFormat.FullDateTimePattern; case DateTimeFormat.MonthDay: - return CultureInfo.DateTimeFormat.MonthDayPattern; + return this.CultureInfo.DateTimeFormat.MonthDayPattern; case DateTimeFormat.RFC1123: - return CultureInfo.DateTimeFormat.RFC1123Pattern; + return this.CultureInfo.DateTimeFormat.RFC1123Pattern; case DateTimeFormat.SortableDateTime: - return CultureInfo.DateTimeFormat.SortableDateTimePattern; + return this.CultureInfo.DateTimeFormat.SortableDateTimePattern; case DateTimeFormat.UniversalSortableDateTime: - return CultureInfo.DateTimeFormat.UniversalSortableDateTimePattern; + return this.CultureInfo.DateTimeFormat.UniversalSortableDateTimePattern; case DateTimeFormat.YearMonth: - return CultureInfo.DateTimeFormat.YearMonthPattern; + return this.CultureInfo.DateTimeFormat.YearMonthPattern; case DateTimeFormat.Custom: { switch (this.FormatString) { case "d": - return CultureInfo.DateTimeFormat.ShortDatePattern; + return this.CultureInfo.DateTimeFormat.ShortDatePattern; case "t": - return CultureInfo.DateTimeFormat.ShortTimePattern; + return this.CultureInfo.DateTimeFormat.ShortTimePattern; case "T": - return CultureInfo.DateTimeFormat.LongTimePattern; + return this.CultureInfo.DateTimeFormat.LongTimePattern; case "D": - return CultureInfo.DateTimeFormat.LongDatePattern; + return this.CultureInfo.DateTimeFormat.LongDatePattern; case "f": - return CultureInfo.DateTimeFormat.LongDatePattern + " " + CultureInfo.DateTimeFormat.ShortTimePattern; + return this.CultureInfo.DateTimeFormat.LongDatePattern + " " + this.CultureInfo.DateTimeFormat.ShortTimePattern; case "F": - return CultureInfo.DateTimeFormat.FullDateTimePattern; + return this.CultureInfo.DateTimeFormat.FullDateTimePattern; case "g": - return CultureInfo.DateTimeFormat.ShortDatePattern + " " + CultureInfo.DateTimeFormat.ShortTimePattern; + return this.CultureInfo.DateTimeFormat.ShortDatePattern + " " + this.CultureInfo.DateTimeFormat.ShortTimePattern; case "G": - return CultureInfo.DateTimeFormat.ShortDatePattern + " " + CultureInfo.DateTimeFormat.LongTimePattern; + return this.CultureInfo.DateTimeFormat.ShortDatePattern + " " + this.CultureInfo.DateTimeFormat.LongTimePattern; case "m": - return CultureInfo.DateTimeFormat.MonthDayPattern; + return this.CultureInfo.DateTimeFormat.MonthDayPattern; case "y": - return CultureInfo.DateTimeFormat.YearMonthPattern; + return this.CultureInfo.DateTimeFormat.YearMonthPattern; case "r": - return CultureInfo.DateTimeFormat.RFC1123Pattern; + return this.CultureInfo.DateTimeFormat.RFC1123Pattern; case "s": - return CultureInfo.DateTimeFormat.SortableDateTimePattern; + return this.CultureInfo.DateTimeFormat.SortableDateTimePattern; case "u": - return CultureInfo.DateTimeFormat.UniversalSortableDateTimePattern; + return this.CultureInfo.DateTimeFormat.UniversalSortableDateTimePattern; default: - return FormatString; + return this.FormatString; } } default: @@ -871,7 +869,7 @@ private bool TryParseDateTime(string text, out DateTime result) ? this.Value.Value : DateTime.Parse(this.ContextNow.ToString(), this.CultureInfo.DateTimeFormat); - isValid = DateTimeParser.TryParse(text, this.GetFormatString(Format), current, this.CultureInfo, out result); + isValid = DateTimeParser.TryParse(text, this.GetFormatString(this.Format), current, this.CultureInfo, out result); } catch (FormatException) { diff --git a/Source/Controls/H.Controls.PropertyGrid/MultiLineTextEditor/Implementation/MultiLineTextEditor.cs b/Source/Controls/H.Controls.PropertyGrid/MultiLineTextEditor/Implementation/MultiLineTextEditor.cs index 5420fd25..f72fe348 100644 --- a/Source/Controls/H.Controls.PropertyGrid/MultiLineTextEditor/Implementation/MultiLineTextEditor.cs +++ b/Source/Controls/H.Controls.PropertyGrid/MultiLineTextEditor/Implementation/MultiLineTextEditor.cs @@ -86,7 +86,7 @@ protected virtual void OnIsOpenChanged(bool oldValue, bool newValue) if (_textBox != null) { // Focus the content of the popup, after its loaded - Dispatcher.BeginInvoke(new Action(() => _textBox.Focus()), DispatcherPriority.Background); + this.Dispatcher.BeginInvoke(new Action(() => _textBox.Focus()), DispatcherPriority.Background); } } @@ -225,11 +225,11 @@ public override void OnApplyTemplate() private void OnKeyDown(object sender, KeyEventArgs e) { - if (!IsOpen) + if (!this.IsOpen) { if (KeyboardUtilities.IsKeyModifyingPopupState(e)) { - IsOpen = true; + this.IsOpen = true; e.Handled = true; } } @@ -252,13 +252,13 @@ private void OnMouseDownOutsideCapturedElement(object sender, MouseButtonEventAr private void ResizeThumb_DragDelta(object sender, DragDeltaEventArgs e) { - double yadjust = DropDownHeight + e.VerticalChange; - double xadjust = DropDownWidth + e.HorizontalChange; + double yadjust = this.DropDownHeight + e.VerticalChange; + double xadjust = this.DropDownWidth + e.HorizontalChange; if ((xadjust >= 0) && (yadjust >= 0)) { - DropDownWidth = xadjust; - DropDownHeight = yadjust; + this.DropDownWidth = xadjust; + this.DropDownHeight = yadjust; } } @@ -268,8 +268,8 @@ private void ResizeThumb_DragDelta(object sender, DragDeltaEventArgs e) private void CloseEditor() { - if (IsOpen) - IsOpen = false; + if (this.IsOpen) + this.IsOpen = false; ReleaseMouseCapture(); if (_toggleButton != null) diff --git a/Source/Controls/H.Controls.PropertyGrid/NumericUpDown/Implementation/CommonNumericUpDown.cs b/Source/Controls/H.Controls.PropertyGrid/NumericUpDown/Implementation/CommonNumericUpDown.cs index 16288865..20945437 100644 --- a/Source/Controls/H.Controls.PropertyGrid/NumericUpDown/Implementation/CommonNumericUpDown.cs +++ b/Source/Controls/H.Controls.PropertyGrid/NumericUpDown/Implementation/CommonNumericUpDown.cs @@ -104,17 +104,17 @@ private bool IsGreaterThan(T? value1, T? value2) private bool HandleNullSpin() { - if (!Value.HasValue) + if (!this.Value.HasValue) { - T forcedValue = DefaultValue.HasValue - ? DefaultValue.Value + T forcedValue = this.DefaultValue.HasValue + ? this.DefaultValue.Value : default(T); - Value = CoerceValueMinMax(forcedValue); + this.Value = CoerceValueMinMax(forcedValue); return true; } - else if (!Increment.HasValue) + else if (!this.Increment.HasValue) { return true; } @@ -124,15 +124,15 @@ private bool HandleNullSpin() internal bool IsValid(T? value) { - return !IsLowerThan(value, Minimum) && !IsGreaterThan(value, Maximum); + return !IsLowerThan(value, this.Minimum) && !IsGreaterThan(value, this.Maximum); } private T? CoerceValueMinMax(T value) { - if (IsLowerThan(value, Minimum)) - return Minimum; - else if (IsGreaterThan(value, Maximum)) - return Maximum; + if (IsLowerThan(value, this.Minimum)) + return this.Minimum; + else if (IsGreaterThan(value, this.Maximum)) + return this.Maximum; else return value; } @@ -148,13 +148,13 @@ protected override void OnIncrement() if (this.UpdateValueOnEnterKey) { T? currentValue = this.ConvertTextToValue(this.TextBox.Text); - T result = this.IncrementValue(currentValue.Value, Increment.Value); + T result = this.IncrementValue(currentValue.Value, this.Increment.Value); T? newValue = this.CoerceValueMinMax(result); this.TextBox.Text = newValue.Value.ToString(this.FormatString, this.CultureInfo); } else { - T result = this.IncrementValue(Value.Value, Increment.Value); + T result = this.IncrementValue(this.Value.Value, this.Increment.Value); this.Value = this.CoerceValueMinMax(result); } } @@ -169,13 +169,13 @@ protected override void OnDecrement() if (this.UpdateValueOnEnterKey) { T? currentValue = this.ConvertTextToValue(this.TextBox.Text); - T result = this.DecrementValue(currentValue.Value, Increment.Value); + T result = this.DecrementValue(currentValue.Value, this.Increment.Value); T? newValue = this.CoerceValueMinMax(result); this.TextBox.Text = newValue.Value.ToString(this.FormatString, this.CultureInfo); } else { - T result = this.DecrementValue(Value.Value, Increment.Value); + T result = this.DecrementValue(this.Value.Value, this.Increment.Value); this.Value = this.CoerceValueMinMax(result); } } @@ -228,14 +228,14 @@ protected override void OnMaximumChanged(T? oldValue, T? newValue) protected override string ConvertValueToText() { - if (Value == null) + if (this.Value == null) return string.Empty; //Manage FormatString of type "{}{0:N2} °" (in xaml) or "{0:N2} °" in code-behind. - if (FormatString.Contains("{0")) - return string.Format(CultureInfo, FormatString, Value.Value); + if (this.FormatString.Contains("{0")) + return string.Format(this.CultureInfo, this.FormatString, this.Value.Value); - return Value.Value.ToString(FormatString, CultureInfo); + return this.Value.Value.ToString(this.FormatString, this.CultureInfo); } protected override void SetValidSpinDirection() @@ -243,17 +243,17 @@ protected override void SetValidSpinDirection() ValidSpinDirections validDirections = ValidSpinDirections.None; // Null increment always prevents spin. - if ((this.Increment != null) && !IsReadOnly) + if ((this.Increment != null) && !this.IsReadOnly) { - if (IsLowerThan(Value, Maximum) || !Value.HasValue || !Maximum.HasValue) + if (IsLowerThan(this.Value, this.Maximum) || !this.Value.HasValue || !this.Maximum.HasValue) validDirections = validDirections | ValidSpinDirections.Increase; - if (IsGreaterThan(Value, Minimum) || !Value.HasValue || !Minimum.HasValue) + if (IsGreaterThan(this.Value, this.Minimum) || !this.Value.HasValue || !this.Minimum.HasValue) validDirections = validDirections | ValidSpinDirections.Decrease; } - if (Spinner != null) - Spinner.ValidSpinDirection = validDirections; + if (this.Spinner != null) + this.Spinner.ValidSpinDirection = validDirections; } private bool IsPercent(string stringToTest) @@ -263,7 +263,7 @@ private bool IsPercent(string stringToTest) { //stringToTest contains a "P" between 2 "'", it's considered as text, not percent bool isText = stringToTest.Substring(0, PIndex).Contains("'") - && stringToTest.Substring(PIndex, FormatString.Length - PIndex).Contains("'"); + && stringToTest.Substring(PIndex, this.FormatString.Length - PIndex).Contains("'"); return !isText; } @@ -276,20 +276,20 @@ private bool IsPercent(string stringToTest) if (this.IsPercent(this.FormatString)) { - result = _fromDecimal(ParsePercent(text, CultureInfo)); + result = _fromDecimal(ParsePercent(text, this.CultureInfo)); } else { T outputValue = new T(); // Problem while converting new text - if (!_fromText(text, this.ParsingNumberStyle, CultureInfo, out outputValue)) + if (!_fromText(text, this.ParsingNumberStyle, this.CultureInfo, out outputValue)) { bool shouldThrow = true; // case 164198: Throw when replacing only the digit part of 99° through UI. // Check if CurrentValueText is also failing => it also contains special characters. ex : 90° T currentValueTextOutputValue; - if (!_fromText(currentValueText, this.ParsingNumberStyle, CultureInfo, out currentValueTextOutputValue)) + if (!_fromText(currentValueText, this.ParsingNumberStyle, this.CultureInfo, out currentValueTextOutputValue)) { // extract non-digit characters System.Collections.Generic.IEnumerable currentValueTextSpecialCharacters = currentValueText.Where(c => !Char.IsDigit(c)); @@ -302,7 +302,7 @@ private bool IsPercent(string stringToTest) text = text.Replace(character.ToString(), string.Empty); } // if without the special characters, parsing is good, do not throw - if (_fromText(text, this.ParsingNumberStyle, CultureInfo, out outputValue)) + if (_fromText(text, this.ParsingNumberStyle, this.CultureInfo, out outputValue)) { shouldThrow = false; } @@ -329,13 +329,13 @@ private bool IsPercent(string stringToTest) private void ValidateDefaultMinMax(T? value) { // DefaultValue is always accepted. - if (object.Equals(value, DefaultValue)) + if (object.Equals(value, this.DefaultValue)) return; - if (IsLowerThan(value, Minimum)) - throw new ArgumentOutOfRangeException("Minimum", String.Format("Value must be greater than MinValue of {0}", Minimum)); - else if (IsGreaterThan(value, Maximum)) - throw new ArgumentOutOfRangeException("Maximum", String.Format("Value must be less than MaxValue of {0}", Maximum)); + if (IsLowerThan(value, this.Minimum)) + throw new ArgumentOutOfRangeException("Minimum", String.Format("Value must be greater than MinValue of {0}", this.Minimum)); + else if (IsGreaterThan(value, this.Maximum)) + throw new ArgumentOutOfRangeException("Maximum", String.Format("Value must be less than MaxValue of {0}", this.Maximum)); } #endregion //Base Class Overrides diff --git a/Source/Controls/H.Controls.PropertyGrid/NumericUpDown/Implementation/DoubleUpDown.cs b/Source/Controls/H.Controls.PropertyGrid/NumericUpDown/Implementation/DoubleUpDown.cs index cdb6773b..4598a246 100644 --- a/Source/Controls/H.Controls.PropertyGrid/NumericUpDown/Implementation/DoubleUpDown.cs +++ b/Source/Controls/H.Controls.PropertyGrid/NumericUpDown/Implementation/DoubleUpDown.cs @@ -77,9 +77,9 @@ protected override double DecrementValue(double value, double increment) protected override void SetValidSpinDirection() { - if (Value.HasValue && double.IsInfinity(Value.Value) && (Spinner != null)) + if (this.Value.HasValue && double.IsInfinity(this.Value.Value) && (this.Spinner != null)) { - Spinner.ValidSpinDirection = ValidSpinDirections.None; + this.Spinner.ValidSpinDirection = ValidSpinDirections.None; } else { diff --git a/Source/Controls/H.Controls.PropertyGrid/NumericUpDown/Implementation/NumericUpDown.cs b/Source/Controls/H.Controls.PropertyGrid/NumericUpDown/Implementation/NumericUpDown.cs index 9e120f6e..66e5c810 100644 --- a/Source/Controls/H.Controls.PropertyGrid/NumericUpDown/Implementation/NumericUpDown.cs +++ b/Source/Controls/H.Controls.PropertyGrid/NumericUpDown/Implementation/NumericUpDown.cs @@ -77,7 +77,7 @@ private static void OnFormatStringChanged(DependencyObject o, DependencyProperty protected virtual void OnFormatStringChanged(string oldValue, string newValue) { - if (IsInitialized) + if (this.IsInitialized) { this.SyncTextAndValueProperties(false, null); } diff --git a/Source/Controls/H.Controls.PropertyGrid/NumericUpDown/Implementation/SingleUpDown.cs b/Source/Controls/H.Controls.PropertyGrid/NumericUpDown/Implementation/SingleUpDown.cs index 5e5f8b1c..1ace62bf 100644 --- a/Source/Controls/H.Controls.PropertyGrid/NumericUpDown/Implementation/SingleUpDown.cs +++ b/Source/Controls/H.Controls.PropertyGrid/NumericUpDown/Implementation/SingleUpDown.cs @@ -76,9 +76,9 @@ protected override float DecrementValue(float value, float increment) protected override void SetValidSpinDirection() { - if (Value.HasValue && float.IsInfinity(Value.Value) && (Spinner != null)) + if (this.Value.HasValue && float.IsInfinity(this.Value.Value) && (this.Spinner != null)) { - Spinner.ValidSpinDirection = ValidSpinDirections.None; + this.Spinner.ValidSpinDirection = ValidSpinDirections.None; } else { diff --git a/Source/Controls/H.Controls.PropertyGrid/Primitives/DateTimePickerBase.cs b/Source/Controls/H.Controls.PropertyGrid/Primitives/DateTimePickerBase.cs index 15086202..e949b87d 100644 --- a/Source/Controls/H.Controls.PropertyGrid/Primitives/DateTimePickerBase.cs +++ b/Source/Controls/H.Controls.PropertyGrid/Primitives/DateTimePickerBase.cs @@ -2,7 +2,6 @@ using System; using System.Windows; -using System.Windows.Controls; using System.Windows.Controls.Primitives; using System.Windows.Input; @@ -47,7 +46,7 @@ private static void OnIsOpenChanged(DependencyObject d, DependencyPropertyChange protected virtual void OnIsOpenChanged(bool oldValue, bool newValue) { if (newValue) - _initialValue = Value; + _initialValue = this.Value; } #endregion //IsOpen @@ -106,11 +105,11 @@ public override void OnApplyTemplate() protected virtual void HandleKeyDown(object sender, KeyEventArgs e) { - if (!IsOpen) + if (!this.IsOpen) { if (KeyboardUtilities.IsKeyModifyingPopupState(e)) { - IsOpen = true; + this.IsOpen = true; // Calendar will get focus in Calendar_Loaded(). e.Handled = true; } @@ -157,15 +156,15 @@ protected virtual void Popup_Opened(object sender, EventArgs e) protected void ClosePopup(bool isFocusOnTextBox) { - if (IsOpen) + if (this.IsOpen) { - IsOpen = false; + this.IsOpen = false; } ReleaseMouseCapture(); - if (isFocusOnTextBox && (TextBox != null)) - TextBox.Focus(); + if (isFocusOnTextBox && (this.TextBox != null)) + this.TextBox.Focus(); } #endregion //Methods diff --git a/Source/Controls/H.Controls.PropertyGrid/Primitives/DateTimeUpDownBase.cs b/Source/Controls/H.Controls.PropertyGrid/Primitives/DateTimeUpDownBase.cs index 0e04884d..4b40b2da 100644 --- a/Source/Controls/H.Controls.PropertyGrid/Primitives/DateTimeUpDownBase.cs +++ b/Source/Controls/H.Controls.PropertyGrid/Primitives/DateTimeUpDownBase.cs @@ -121,10 +121,10 @@ protected override void OnPreviewKeyDown(KeyEventArgs e) { case Key.Enter: { - if (!IsReadOnly) + if (!this.IsReadOnly) { _fireSelectionChangedEvent = false; - BindingExpression binding = BindingOperations.GetBindingExpression(TextBox, System.Windows.Controls.TextBox.TextProperty); + BindingExpression binding = BindingOperations.GetBindingExpression(this.TextBox, System.Windows.Controls.TextBox.TextProperty); binding.UpdateSource(); _fireSelectionChangedEvent = true; } @@ -204,7 +204,7 @@ protected virtual bool IsCurrentValueValid() protected virtual void PerformMouseSelection() { - DateTimeInfo dateTimeInfo = this.GetDateTimeInfo(TextBox.SelectionStart); + DateTimeInfo dateTimeInfo = this.GetDateTimeInfo(this.TextBox.SelectionStart); if ((dateTimeInfo != null) && (dateTimeInfo.Type == DateTimePart.Other)) { this.Dispatcher.BeginInvoke(DispatcherPriority.Background, new Action(() => diff --git a/Source/Controls/H.Controls.PropertyGrid/Primitives/Selector.cs b/Source/Controls/H.Controls.PropertyGrid/Primitives/Selector.cs index 5c287753..f0778c18 100644 --- a/Source/Controls/H.Controls.PropertyGrid/Primitives/Selector.cs +++ b/Source/Controls/H.Controls.PropertyGrid/Primitives/Selector.cs @@ -119,10 +119,10 @@ protected virtual void OnSelectedItemChanged(object oldValue, object newValue) return; _ignoreSelectedItemsCollectionChanged++; - SelectedItems.Clear(); + this.SelectedItems.Clear(); if (newValue != null) { - SelectedItems.Add(newValue); + this.SelectedItems.Add(newValue); } this.UpdateFromSelectedItems(); _ignoreSelectedItemsCollectionChanged--; @@ -295,7 +295,7 @@ protected IEnumerable ItemsCollection { get { - return ItemsSource ?? (IEnumerable)Items ?? (new object[0]); + return this.ItemsSource ?? (IEnumerable)this.Items ?? (new object[0]); } } @@ -322,7 +322,7 @@ protected override void PrepareContainerForItemOverride(DependencyObject element _surpressItemSelectionChanged = true; FrameworkElement selectorItem = element as FrameworkElement; - selectorItem.SetValue(SelectorItem.IsSelectedProperty, SelectedItems.Contains(item)); + selectorItem.SetValue(SelectorItem.IsSelectedProperty, this.SelectedItems.Contains(item)); _surpressItemSelectionChanged = false; } @@ -436,11 +436,11 @@ protected object GetItemValue(object item) protected object ResolveItemByValue(string value) { - if (!String.IsNullOrEmpty(ValueMemberPath)) + if (!String.IsNullOrEmpty(this.ValueMemberPath)) { - foreach (object item in ItemsCollection) + foreach (object item in this.ItemsCollection) { - PropertyInfo property = item.GetType().GetProperty(ValueMemberPath); + PropertyInfo property = item.GetType().GetProperty(this.ValueMemberPath); if (property != null) { object propertyValue = property.GetValue(item, null); @@ -458,13 +458,13 @@ internal void UpdateFromList(List selectedValues, Func G _ignoreSelectedItemsCollectionChanged++; // Just update the SelectedItems collection content // and let the synchronization be made from UpdateFromSelectedItems(); - SelectedItems.Clear(); + this.SelectedItems.Clear(); if ((selectedValues != null) && (selectedValues.Count > 0)) { ValueEqualityComparer comparer = new ValueEqualityComparer(); - foreach (object item in ItemsCollection) + foreach (object item in this.ItemsCollection) { object itemValue = GetItemfunction(item); @@ -473,7 +473,7 @@ internal void UpdateFromList(List selectedValues, Func G if (isSelected) { - SelectedItems.Add(item); + this.SelectedItems.Add(item); } } } @@ -585,13 +585,13 @@ private void OnItemSelectionChangedCore(RoutedEventArgs args, bool unselected) if (unselected) { - while (SelectedItems.Contains(item)) - SelectedItems.Remove(item); + while (this.SelectedItems.Contains(item)) + this.SelectedItems.Remove(item); } else { - if (!SelectedItems.Contains(item)) - SelectedItems.Add(item); + if (!this.SelectedItems.Contains(item)) + this.SelectedItems.Add(item); } OnItemSelectionChanged( @@ -634,13 +634,13 @@ private void OnValueMemberPathValuesChanged() private void UpdateSelectedMemberPathValuesBindings() { - _selectedMemberPathValuesHelper.UpdateValueSource(ItemsCollection, SelectedMemberPath); + _selectedMemberPathValuesHelper.UpdateValueSource(this.ItemsCollection, this.SelectedMemberPath); this.UpdateFromSelectedMemberPathValues(); } private void UpdateValueMemberPathValuesBindings() { - _valueMemberPathValuesHelper.UpdateValueSource(ItemsCollection, ValueMemberPath); + _valueMemberPathValuesHelper.UpdateValueSource(this.ItemsCollection, this.ValueMemberPath); } /// @@ -655,8 +655,8 @@ protected virtual void OnItemSelectionChanged(ItemSelectionChangedEventArgs args RaiseEvent(args); - if (Command != null) - Command.Execute(args.Item); + if (this.Command != null) + this.Command.Execute(args.Item); } /// @@ -667,12 +667,12 @@ private void UpdateSelectedValue() #if VS2008 string newValue = String.Join( Delimiter, SelectedItems.Cast().Select( x => GetItemValue( x ).ToString() ).ToArray() ); #else - string newValue = String.Join(Delimiter, SelectedItems.Cast().Select(x => GetItemValue(x))); + string newValue = String.Join(this.Delimiter, this.SelectedItems.Cast().Select(x => GetItemValue(x))); #endif - if (String.IsNullOrEmpty(SelectedValue) || !SelectedValue.Equals(newValue)) + if (String.IsNullOrEmpty(this.SelectedValue) || !this.SelectedValue.Equals(newValue)) { _ignoreSelectedValueChanged = true; - SelectedValue = newValue; + this.SelectedValue = newValue; _ignoreSelectedValueChanged = false; } } @@ -682,10 +682,10 @@ private void UpdateSelectedValue() /// private void UpdateSelectedItem() { - if (!SelectedItems.Contains(SelectedItem)) + if (!this.SelectedItems.Contains(this.SelectedItem)) { _ignoreSelectedItemChanged = true; - SelectedItem = (SelectedItems.Count > 0) ? SelectedItems[0] : null; + this.SelectedItem = (this.SelectedItems.Count > 0) ? this.SelectedItems[0] : null; _ignoreSelectedItemChanged = false; } } @@ -697,23 +697,23 @@ private void UpdateSelectedItem() private void UpdateFromSelectedMemberPathValues() { _ignoreSelectedItemsCollectionChanged++; - foreach (object item in ItemsCollection) + foreach (object item in this.ItemsCollection) { bool? isSelected = this.GetSelectedMemberPathValue(item); if (isSelected != null) { if (isSelected.Value) { - if (!SelectedItems.Contains(item)) + if (!this.SelectedItems.Contains(item)) { - SelectedItems.Add(item); + this.SelectedItems.Add(item); } } else { - if (SelectedItems.Contains(item)) + if (this.SelectedItems.Contains(item)) { - SelectedItems.Remove(item); + this.SelectedItems.Remove(item); } } } @@ -752,15 +752,15 @@ internal void UpdateSelectedItems(IList selectedItems) /// private void UpdateFromSelectedItems() { - foreach (object o in ItemsCollection) + foreach (object o in this.ItemsCollection) { - bool isSelected = SelectedItems.Contains(o); + bool isSelected = this.SelectedItems.Contains(o); _ignoreSelectedMemberPathValuesChanged++; this.SetSelectedMemberPathValue(o, isSelected); _ignoreSelectedMemberPathValuesChanged--; - SelectorItem selectorItem = ItemContainerGenerator.ContainerFromItem(o) as SelectorItem; + SelectorItem selectorItem = this.ItemContainerGenerator.ContainerFromItem(o) as SelectorItem; if (selectorItem != null) { selectorItem.IsSelected = isSelected; @@ -777,14 +777,14 @@ private void UpdateFromSelectedItems() private void RemoveUnavailableSelectedItems() { _ignoreSelectedItemsCollectionChanged++; - HashSet hash = new HashSet(ItemsCollection.Cast()); + HashSet hash = new HashSet(this.ItemsCollection.Cast()); - for (int i = 0; i < SelectedItems.Count; i++) + for (int i = 0; i < this.SelectedItems.Count; i++) { - if (!hash.Contains(SelectedItems[i])) + if (!hash.Contains(this.SelectedItems[i])) { - _removedItems.Add(SelectedItems[i]); - SelectedItems.RemoveAt(i); + _removedItems.Add(this.SelectedItems[i]); + this.SelectedItems.RemoveAt(i); i--; } } @@ -796,13 +796,13 @@ private void RemoveUnavailableSelectedItems() private void AddAvailableRemovedItems() { - HashSet hash = new HashSet(ItemsCollection.Cast()); + HashSet hash = new HashSet(this.ItemsCollection.Cast()); for (int i = 0; i < _removedItems.Count; i++) { if (hash.Contains(_removedItems[i])) { - SelectedItems.Add(_removedItems[i]); + this.SelectedItems.Add(_removedItems[i]); _removedItems.RemoveAt(i); i--; } @@ -816,9 +816,9 @@ private void AddAvailableRemovedItems() private void UpdateFromSelectedValue() { List selectedValues = null; - if (!String.IsNullOrEmpty(SelectedValue)) + if (!String.IsNullOrEmpty(this.SelectedValue)) { - selectedValues = SelectedValue.Split(new string[] { Delimiter }, StringSplitOptions.RemoveEmptyEntries).ToList(); + selectedValues = this.SelectedValue.Split(new string[] { this.Delimiter }, StringSplitOptions.RemoveEmptyEntries).ToList(); } this.UpdateFromList(selectedValues, this.GetItemValue); @@ -837,7 +837,7 @@ public bool ReceiveWeakEvent(Type managerType, object sender, EventArgs e) this.OnSelectedItemsCollectionChanged(sender, (NotifyCollectionChangedEventArgs)e); return true; } - else if (object.ReferenceEquals(ItemsCollection, sender)) + else if (object.ReferenceEquals(this.ItemsCollection, sender)) { this.OnItemsSourceCollectionChanged(sender, (NotifyCollectionChangedEventArgs)e); return true; @@ -885,8 +885,8 @@ public object Item public ItemSelectionChangedEventArgs(RoutedEvent routedEvent, object source, object item, bool isSelected) : base(routedEvent, source) { - Item = item; - IsSelected = isSelected; + this.Item = item; + this.IsSelected = isSelected; } } } diff --git a/Source/Controls/H.Controls.PropertyGrid/Primitives/UpDownBase.cs b/Source/Controls/H.Controls.PropertyGrid/Primitives/UpDownBase.cs index eac275e0..0342312b 100644 --- a/Source/Controls/H.Controls.PropertyGrid/Primitives/UpDownBase.cs +++ b/Source/Controls/H.Controls.PropertyGrid/Primitives/UpDownBase.cs @@ -130,9 +130,9 @@ private static void OnDisplayDefaultValueOnEmptyTextChanged(DependencyObject sou private void OnDisplayDefaultValueOnEmptyTextChanged(bool oldValue, bool newValue) { - if (this.IsInitialized && string.IsNullOrEmpty(Text)) + if (this.IsInitialized && string.IsNullOrEmpty(this.Text)) { - this.SyncTextAndValueProperties(false, Text); + this.SyncTextAndValueProperties(false, this.Text); } } @@ -162,9 +162,9 @@ private static void OnDefaultValueChanged(DependencyObject source, DependencyPro private void OnDefaultValueChanged(T oldValue, T newValue) { - if (this.IsInitialized && string.IsNullOrEmpty(Text)) + if (this.IsInitialized && string.IsNullOrEmpty(this.Text)) { - this.SyncTextAndValueProperties(true, Text); + this.SyncTextAndValueProperties(true, this.Text); } } @@ -453,8 +453,8 @@ internal UpDownBase() protected override void OnAccessKey(AccessKeyEventArgs e) { - if (TextBox != null) - TextBox.Focus(); + if (this.TextBox != null) + this.TextBox.Focus(); base.OnAccessKey(e); } @@ -463,28 +463,28 @@ public override void OnApplyTemplate() { base.OnApplyTemplate(); - if (TextBox != null) + if (this.TextBox != null) { - TextBox.TextChanged -= new TextChangedEventHandler(TextBox_TextChanged); - TextBox.RemoveHandler(Mouse.PreviewMouseDownEvent, new MouseButtonEventHandler(this.TextBox_PreviewMouseDown)); + this.TextBox.TextChanged -= new TextChangedEventHandler(TextBox_TextChanged); + this.TextBox.RemoveHandler(Mouse.PreviewMouseDownEvent, new MouseButtonEventHandler(this.TextBox_PreviewMouseDown)); } - TextBox = GetTemplateChild(PART_TextBox) as TextBox; + this.TextBox = GetTemplateChild(PART_TextBox) as TextBox; - if (TextBox != null) + if (this.TextBox != null) { - TextBox.Text = Text; - TextBox.TextChanged += new TextChangedEventHandler(TextBox_TextChanged); - TextBox.AddHandler(Mouse.PreviewMouseDownEvent, new MouseButtonEventHandler(this.TextBox_PreviewMouseDown), true); + this.TextBox.Text = this.Text; + this.TextBox.TextChanged += new TextChangedEventHandler(TextBox_TextChanged); + this.TextBox.AddHandler(Mouse.PreviewMouseDownEvent, new MouseButtonEventHandler(this.TextBox_PreviewMouseDown), true); } - if (Spinner != null) - Spinner.Spin -= OnSpinnerSpin; + if (this.Spinner != null) + this.Spinner.Spin -= OnSpinnerSpin; - Spinner = GetTemplateChild(PART_Spinner) as Spinner; + this.Spinner = GetTemplateChild(PART_Spinner) as Spinner; - if (Spinner != null) - Spinner.Spin += OnSpinnerSpin; + if (this.Spinner != null) + this.Spinner.Spin += OnSpinnerSpin; SetValidSpinDirection(); } @@ -514,19 +514,19 @@ protected override void OnTextChanged(string oldValue, string newValue) { if (!_isTextChangedFromUI) { - this.SyncTextAndValueProperties(true, Text); + this.SyncTextAndValueProperties(true, this.Text); } } else { - this.SyncTextAndValueProperties(true, Text); + this.SyncTextAndValueProperties(true, this.Text); } } } protected override void OnCultureInfoChanged(CultureInfo oldValue, CultureInfo newValue) { - if (IsInitialized) + if (this.IsInitialized) { SyncTextAndValueProperties(false, null); } @@ -569,13 +569,13 @@ private void HandleClickOutsideOfControlWithMouseCapture(object sender, RoutedEv private void OnSpinnerSpin(object sender, SpinEventArgs e) { - if (AllowSpin && !IsReadOnly) + if (this.AllowSpin && !this.IsReadOnly) { MouseWheelActiveTrigger activeTrigger = this.MouseWheelActiveTrigger; bool spin = !e.UsingMouseWheel; spin |= activeTrigger == MouseWheelActiveTrigger.MouseOver; - spin |= (TextBox != null) && TextBox.IsFocused && (activeTrigger == MouseWheelActiveTrigger.FocusedMouseOver); - spin |= (TextBox != null) && TextBox.IsFocused && (activeTrigger == MouseWheelActiveTrigger.Focused) && (Mouse.Captured is Spinner); + spin |= (this.TextBox != null) && this.TextBox.IsFocused && (activeTrigger == MouseWheelActiveTrigger.FocusedMouseOver); + spin |= (this.TextBox != null) && this.TextBox.IsFocused && (activeTrigger == MouseWheelActiveTrigger.Focused) && (Mouse.Captured is Spinner); if (spin) { @@ -653,7 +653,7 @@ protected override void OnInitialized(EventArgs e) && (BindingOperations.GetBinding(this, ValueProperty) == null) && object.Equals(this.Value, ValueProperty.DefaultMetadata.DefaultValue); - this.SyncTextAndValueProperties(updateValueFromText, Text, !updateValueFromText); + this.SyncTextAndValueProperties(updateValueFromText, this.Text, !updateValueFromText); } /// @@ -661,7 +661,7 @@ protected override void OnInitialized(EventArgs e) /// internal void DoDecrement() { - if (Spinner == null || (Spinner.ValidSpinDirection & ValidSpinDirections.Decrease) == ValidSpinDirections.Decrease) + if (this.Spinner == null || (this.Spinner.ValidSpinDirection & ValidSpinDirections.Decrease) == ValidSpinDirections.Decrease) { OnDecrement(); } @@ -672,7 +672,7 @@ internal void DoDecrement() /// internal void DoIncrement() { - if (Spinner == null || (Spinner.ValidSpinDirection & ValidSpinDirections.Increase) == ValidSpinDirections.Increase) + if (this.Spinner == null || (this.Spinner.ValidSpinDirection & ValidSpinDirections.Increase) == ValidSpinDirections.Increase) { OnIncrement(); } @@ -686,7 +686,7 @@ private void TextBox_TextChanged(object sender, TextChangedEventArgs e) try { _isTextChangedFromUI = true; - Text = ((TextBox)sender).Text; + this.Text = ((TextBox)sender).Text; } finally { @@ -717,7 +717,7 @@ private void RaiseInputValidationError(Exception e) public virtual bool CommitInput() { - return this.SyncTextAndValueProperties(true, Text); + return this.SyncTextAndValueProperties(true, this.Text); } protected bool SyncTextAndValueProperties(bool updateValueFromText, string text) @@ -770,19 +770,19 @@ private bool SyncTextAndValueProperties(bool updateValueFromText, string text, b if (!_isTextChangedFromUI) { // Don't replace the empty Text with the non-empty representation of DefaultValue. - bool shouldKeepEmpty = !forceTextUpdate && string.IsNullOrEmpty(Text) && object.Equals(Value, DefaultValue) && !this.DisplayDefaultValueOnEmptyText; + bool shouldKeepEmpty = !forceTextUpdate && string.IsNullOrEmpty(this.Text) && object.Equals(this.Value, this.DefaultValue) && !this.DisplayDefaultValueOnEmptyText; if (!shouldKeepEmpty) { string newText = ConvertValueToText(); if (!object.Equals(this.Text, newText)) { - Text = newText; + this.Text = newText; } } // Sync Text and textBox - if (TextBox != null) - TextBox.Text = Text; + if (this.TextBox != null) + this.TextBox.Text = this.Text; } if (_isTextChangedFromUI && !parsedTextIsValid) @@ -790,9 +790,9 @@ private bool SyncTextAndValueProperties(bool updateValueFromText, string text, b // Text input was made from the user and the text // repesents an invalid value. Disable the spinner // in this case. - if (Spinner != null) + if (this.Spinner != null) { - Spinner.ValidSpinDirection = ValidSpinDirections.None; + this.Spinner.ValidSpinDirection = ValidSpinDirections.None; } } else diff --git a/Source/Controls/H.Controls.PropertyGrid/PropertyGrid.xaml.cs b/Source/Controls/H.Controls.PropertyGrid/PropertyGrid.xaml.cs index a5582767..b81d82f7 100644 --- a/Source/Controls/H.Controls.PropertyGrid/PropertyGrid.xaml.cs +++ b/Source/Controls/H.Controls.PropertyGrid/PropertyGrid.xaml.cs @@ -801,14 +801,14 @@ public PropertyGrid() _propertyDefinitionsListener = new WeakEventListener(this.OnPropertyDefinitionsCollectionChanged); _editorDefinitionsListener = new WeakEventListener(this.OnEditorDefinitionsCollectionChanged); UpdateContainerHelper(); - EditorDefinitions = new EditorDefinitionCollection(); - PropertyDefinitions = new PropertyDefinitionCollection(); + this.EditorDefinitions = new EditorDefinitionCollection(); + this.PropertyDefinitions = new PropertyDefinitionCollection(); this.PropertyValueChanged += this.PropertyGrid_PropertyValueChanged; AddHandler(PropertyItemBase.ItemSelectionChangedEvent, new RoutedEventHandler(OnItemSelectionChanged)); AddHandler(PropertyItemsControl.PreparePropertyItemEvent, new PropertyItemEventHandler(OnPreparePropertyItemInternal)); AddHandler(PropertyItemsControl.ClearPropertyItemEvent, new PropertyItemEventHandler(OnClearPropertyItemInternal)); - CommandBindings.Add(new CommandBinding(PropertyGridCommands.ClearFilter, ClearFilter, CanClearFilter)); + this.CommandBindings.Add(new CommandBinding(PropertyGridCommands.ClearFilter, ClearFilter, CanClearFilter)); } #endregion //Constructors @@ -838,7 +838,7 @@ public override void OnApplyTemplate() //binding when it receives expected target type during visual tree traversal //ref : http://www.codeproject.com/Tips/124556/How-to-suppress-the-System-Windows-Data-Error-warn TranslateTransform _moveTransform = new TranslateTransform(); - _moveTransform.X = NameColumnWidth; + _moveTransform.X = this.NameColumnWidth; if (_dragThumb != null) { _dragThumb.RenderTransform = _moveTransform; @@ -886,13 +886,13 @@ private void OnItemSelectionChanged(object sender, RoutedEventArgs args) PropertyItemBase item = (PropertyItemBase)args.OriginalSource; if (item.IsSelected) { - SelectedPropertyItem = item; + this.SelectedPropertyItem = item; } else { - if (object.ReferenceEquals(item, SelectedPropertyItem)) + if (object.ReferenceEquals(item, this.SelectedPropertyItem)) { - SelectedPropertyItem = null; + this.SelectedPropertyItem = null; } } } @@ -917,7 +917,7 @@ private void OnClearPropertyItemInternal(object sender, PropertyItemEventArgs ar private void DragThumb_DragDelta(object sender, DragDeltaEventArgs e) { - NameColumnWidth = Math.Max(0, NameColumnWidth + e.HorizontalChange); + this.NameColumnWidth = Math.Max(0, this.NameColumnWidth + e.HorizontalChange); } @@ -949,12 +949,12 @@ private void PropertyGrid_PropertyValueChanged(object sender, PropertyValueChang private void ClearFilter(object sender, ExecutedRoutedEventArgs e) { - Filter = String.Empty; + this.Filter = String.Empty; } private void CanClearFilter(object sender, CanExecuteRoutedEventArgs e) { - e.CanExecute = !String.IsNullOrEmpty(Filter); + e.CanExecute = !String.IsNullOrEmpty(this.Filter); } #endregion //Commands @@ -1097,9 +1097,9 @@ private void UpdateContainerHelper() - if (SelectedObject != null) + if (this.SelectedObject != null) { - _containerHelper = new ObjectContainerHelper(this, SelectedObject); + _containerHelper = new ObjectContainerHelper(this, this.SelectedObject); ((ObjectContainerHelper)_containerHelper).GenerateProperties(); } @@ -1133,7 +1133,7 @@ private void UpdateThumb() { if (_dragThumb != null) { - if (IsCategorized) + if (this.IsCategorized) _dragThumb.Margin = new Thickness(6, 0, 0, 0); else _dragThumb.Margin = new Thickness(-1, 0, 0, 0); @@ -1443,8 +1443,8 @@ public object OldValue public PropertyValueChangedEventArgs(RoutedEvent routedEvent, object source, object oldValue, object newValue) : base(routedEvent, source) { - NewValue = newValue; - OldValue = oldValue; + this.NewValue = newValue; + this.OldValue = oldValue; } } #endregion diff --git a/Source/Controls/H.Controls.PropertyGrid/PropertyGrid/Implementation/Attributes/CategoryOrderAttribute.cs b/Source/Controls/H.Controls.PropertyGrid/PropertyGrid/Implementation/Attributes/CategoryOrderAttribute.cs index f41aca5e..3f5b96e7 100644 --- a/Source/Controls/H.Controls.PropertyGrid/PropertyGrid/Implementation/Attributes/CategoryOrderAttribute.cs +++ b/Source/Controls/H.Controls.PropertyGrid/PropertyGrid/Implementation/Attributes/CategoryOrderAttribute.cs @@ -25,7 +25,7 @@ public virtual string Category { get { - return CategoryValue; + return this.CategoryValue; } } @@ -52,8 +52,8 @@ public CategoryOrderAttribute() public CategoryOrderAttribute(string categoryName, int order) : this() { - CategoryValue = categoryName; - Order = order; + this.CategoryValue = categoryName; + this.Order = order; } #endregion diff --git a/Source/Controls/H.Controls.PropertyGrid/PropertyGrid/Implementation/Attributes/ItemsSourceAttribute.cs b/Source/Controls/H.Controls.PropertyGrid/PropertyGrid/Implementation/Attributes/ItemsSourceAttribute.cs index 1d483433..5a082db0 100644 --- a/Source/Controls/H.Controls.PropertyGrid/PropertyGrid/Implementation/Attributes/ItemsSourceAttribute.cs +++ b/Source/Controls/H.Controls.PropertyGrid/PropertyGrid/Implementation/Attributes/ItemsSourceAttribute.cs @@ -18,7 +18,7 @@ public ItemsSourceAttribute(Type type) if (valueSourceInterface == null) throw new ArgumentException("Type must implement the IItemsSource interface.", "type"); - Type = type; + this.Type = type; } } } diff --git a/Source/Controls/H.Controls.PropertyGrid/PropertyGrid/Implementation/Attributes/PropertyOrderAttribute.cs b/Source/Controls/H.Controls.PropertyGrid/PropertyGrid/Implementation/Attributes/PropertyOrderAttribute.cs index ff2abaaa..d08d3af7 100644 --- a/Source/Controls/H.Controls.PropertyGrid/PropertyGrid/Implementation/Attributes/PropertyOrderAttribute.cs +++ b/Source/Controls/H.Controls.PropertyGrid/PropertyGrid/Implementation/Attributes/PropertyOrderAttribute.cs @@ -47,8 +47,8 @@ public PropertyOrderAttribute(int order) public PropertyOrderAttribute(int order, UsageContextEnum usageContext) { - Order = order; - UsageContext = usageContext; + this.Order = order; + this.UsageContext = usageContext; } #endregion diff --git a/Source/Controls/H.Controls.PropertyGrid/PropertyGrid/Implementation/ContainerHelperBase.cs b/Source/Controls/H.Controls.PropertyGrid/PropertyGrid/Implementation/ContainerHelperBase.cs index 27742d8b..bd72c722 100644 --- a/Source/Controls/H.Controls.PropertyGrid/PropertyGrid/Implementation/ContainerHelperBase.cs +++ b/Source/Controls/H.Controls.PropertyGrid/PropertyGrid/Implementation/ContainerHelperBase.cs @@ -81,9 +81,9 @@ public virtual void ClearHelper() // container. Fortunately, the ItemsContainer will not re-prepare the items yet // (i.e., probably made on next measure pass), allowing us to set up the new // parent helper. - if (ChildrenItemsControl != null) + if (this.ChildrenItemsControl != null) { - ((IItemContainerGenerator)ChildrenItemsControl.ItemContainerGenerator).RemoveAll(); + ((IItemContainerGenerator)this.ChildrenItemsControl.ItemContainerGenerator).RemoveAll(); } this.IsCleaning = false; } diff --git a/Source/Controls/H.Controls.PropertyGrid/PropertyGrid/Implementation/CustomPropertyItem.cs b/Source/Controls/H.Controls.PropertyGrid/PropertyGrid/Implementation/CustomPropertyItem.cs index 859e85cd..dbbea5ab 100644 --- a/Source/Controls/H.Controls.PropertyGrid/PropertyGrid/Implementation/CustomPropertyItem.cs +++ b/Source/Controls/H.Controls.PropertyGrid/PropertyGrid/Implementation/CustomPropertyItem.cs @@ -128,7 +128,7 @@ private static void OnValueChanged(DependencyObject o, DependencyPropertyChanged protected virtual void OnValueChanged(object oldValue, object newValue) { - if (IsInitialized) + if (this.IsInitialized) { RaiseEvent(new PropertyValueChangedEventArgs(PropertyGrid.PropertyValueChangedEvent, this, oldValue, newValue)); } diff --git a/Source/Controls/H.Controls.PropertyGrid/PropertyGrid/Implementation/DescriptorPropertyDefinition.cs b/Source/Controls/H.Controls.PropertyGrid/PropertyGrid/Implementation/DescriptorPropertyDefinition.cs index 462ba87e..0e438e82 100644 --- a/Source/Controls/H.Controls.PropertyGrid/PropertyGrid/Implementation/DescriptorPropertyDefinition.cs +++ b/Source/Controls/H.Controls.PropertyGrid/PropertyGrid/Implementation/DescriptorPropertyDefinition.cs @@ -79,7 +79,7 @@ protected override BindingBase CreateValueBinding() Binding binding = new Binding(propertyName) { Source = this.GetValueInstance(selectedObject), - Mode = PropertyDescriptor.IsReadOnly ? BindingMode.OneWay : BindingMode.TwoWay, + Mode = this.PropertyDescriptor.IsReadOnly ? BindingMode.OneWay : BindingMode.TwoWay, ValidatesOnDataErrors = true, ValidatesOnExceptions = true, ConverterCulture = CultureInfo.CurrentCulture @@ -90,23 +90,23 @@ protected override BindingBase CreateValueBinding() protected override bool ComputeIsReadOnly() { - return PropertyDescriptor.IsReadOnly; + return this.PropertyDescriptor.IsReadOnly; } internal override ITypeEditor CreateDefaultEditor(PropertyItem propertyItem) { - return PropertyGridUtilities.CreateDefaultEditor(PropertyDescriptor.PropertyType, PropertyDescriptor.Converter, propertyItem); + return PropertyGridUtilities.CreateDefaultEditor(this.PropertyDescriptor.PropertyType, this.PropertyDescriptor.Converter, propertyItem); } protected override bool ComputeCanResetValue() { - if (!PropertyDescriptor.IsReadOnly) + if (!this.PropertyDescriptor.IsReadOnly) { object defaultValue = this.ComputeDefaultValueAttribute(); if (defaultValue != null) return true; - return PropertyDescriptor.CanResetValue(SelectedObject); + return this.PropertyDescriptor.CanResetValue(this.SelectedObject); } return false; @@ -115,7 +115,7 @@ protected override bool ComputeCanResetValue() protected override object ComputeAdvancedOptionsTooltip() { object tooltip; - UpdateAdvanceOptionsForItem(_markupObject, SelectedObject as DependencyObject, _dpDescriptor, out tooltip); + UpdateAdvanceOptionsForItem(_markupObject, this.SelectedObject as DependencyObject, _dpDescriptor, out tooltip); return tooltip; } @@ -125,24 +125,24 @@ protected override string ComputeCategory() #if VS2008 return PropertyDescriptor.Category; #else - DisplayAttribute displayAttribute = PropertyGridUtilities.GetAttribute(PropertyDescriptor); - return ((displayAttribute != null) && (displayAttribute.GetGroupName() != null)) ? displayAttribute.GetGroupName() : PropertyDescriptor.Category; + DisplayAttribute displayAttribute = PropertyGridUtilities.GetAttribute(this.PropertyDescriptor); + return ((displayAttribute != null) && (displayAttribute.GetGroupName() != null)) ? displayAttribute.GetGroupName() : this.PropertyDescriptor.Category; #endif } protected override string ComputeCategoryValue() { - return PropertyDescriptor.Category; + return this.PropertyDescriptor.Category; } protected override bool ComputeExpandableAttribute() { - return (bool)this.ComputeExpandableAttributeForItem(PropertyDescriptor); + return (bool)this.ComputeExpandableAttributeForItem(this.PropertyDescriptor); } protected override object ComputeDefaultValueAttribute() { - return this.ComputeDefaultValueAttributeForItem(PropertyDescriptor); + return this.ComputeDefaultValueAttributeForItem(this.PropertyDescriptor); } protected override bool ComputeIsExpandable() @@ -153,22 +153,22 @@ protected override bool ComputeIsExpandable() protected override IList ComputeNewItemTypes() { - return (IList)ComputeNewItemTypesForItem(PropertyDescriptor); + return (IList)ComputeNewItemTypesForItem(this.PropertyDescriptor); } protected override string ComputeDescription() { - return (string)ComputeDescriptionForItem(PropertyDescriptor); + return (string)ComputeDescriptionForItem(this.PropertyDescriptor); } protected override int ComputeDisplayOrder(bool isPropertyGridCategorized) { this.IsPropertyGridCategorized = isPropertyGridCategorized; - return (int)ComputeDisplayOrderForItem(PropertyDescriptor); + return (int)ComputeDisplayOrderForItem(this.PropertyDescriptor); } protected override void ResetValue() { - PropertyDescriptor.ResetValue(SelectedObject); + this.PropertyDescriptor.ResetValue(this.SelectedObject); } internal override ITypeEditor CreateAttributeEditor() @@ -218,7 +218,7 @@ internal override ITypeEditor CreateAttributeEditor() private T GetAttribute() where T : Attribute { - return PropertyGridUtilities.GetAttribute(PropertyDescriptor); + return PropertyGridUtilities.GetAttribute(this.PropertyDescriptor); } private void Init(PropertyDescriptor propertyDescriptor, object selectedObject) @@ -232,7 +232,7 @@ private void Init(PropertyDescriptor propertyDescriptor, object selectedObject) _propertyDescriptor = propertyDescriptor; _selectedObject = selectedObject; _dpDescriptor = DependencyPropertyDescriptor.FromProperty(propertyDescriptor); - _markupObject = MarkupWriter.GetMarkupObjectFor(SelectedObject); + _markupObject = MarkupWriter.GetMarkupObjectFor(this.SelectedObject); } #endregion //Private Methods diff --git a/Source/Controls/H.Controls.PropertyGrid/PropertyGrid/Implementation/DescriptorPropertyDefinitionBase.cs b/Source/Controls/H.Controls.PropertyGrid/PropertyGrid/Implementation/DescriptorPropertyDefinitionBase.cs index 2f653883..9b6c6bb2 100644 --- a/Source/Controls/H.Controls.PropertyGrid/PropertyGrid/Implementation/DescriptorPropertyDefinitionBase.cs +++ b/Source/Controls/H.Controls.PropertyGrid/PropertyGrid/Implementation/DescriptorPropertyDefinitionBase.cs @@ -144,7 +144,7 @@ internal void UpdateAdvanceOptionsForItem(MarkupObject markupObject, DependencyO bool isResource = false; bool isDynamicResource = false; - MarkupProperty markupProperty = markupObject.Properties.FirstOrDefault(p => p.Name == PropertyName); + MarkupProperty markupProperty = markupObject.Properties.FirstOrDefault(p => p.Name == this.PropertyName); if (markupProperty != null) { //TODO: need to find a better way to determine if a StaticResource has been applied to any property not just a style(maybe with StaticResourceExtension) @@ -258,7 +258,7 @@ internal object ComputeDisplayOrderForItem(object item) { PropertyDescriptor pd = item as PropertyDescriptor; #if !VS2008 - DisplayAttribute displayAttribute = PropertyGridUtilities.GetAttribute(PropertyDescriptor); + DisplayAttribute displayAttribute = PropertyGridUtilities.GetAttribute(this.PropertyDescriptor); if (displayAttribute != null) { int? order = displayAttribute.GetOrder(); @@ -310,7 +310,7 @@ internal object GetValueInstance(object sourceObject) { ICustomTypeDescriptor customTypeDescriptor = sourceObject as ICustomTypeDescriptor; if (customTypeDescriptor != null) - sourceObject = customTypeDescriptor.GetPropertyOwner(PropertyDescriptor); + sourceObject = customTypeDescriptor.GetPropertyOwner(this.PropertyDescriptor); return sourceObject; } @@ -343,11 +343,11 @@ private string ComputeDisplayName() #if VS2008 var displayName = PropertyDescriptor.DisplayName; #else - DisplayAttribute displayAttribute = PropertyGridUtilities.GetAttribute(PropertyDescriptor); - string displayName = (displayAttribute != null) ? displayAttribute.GetName() : PropertyDescriptor.DisplayName; + DisplayAttribute displayAttribute = PropertyGridUtilities.GetAttribute(this.PropertyDescriptor); + string displayName = (displayAttribute != null) ? displayAttribute.GetName() : this.PropertyDescriptor.DisplayName; #endif - ParenthesizePropertyNameAttribute attribute = PropertyGridUtilities.GetAttribute(PropertyDescriptor); + ParenthesizePropertyNameAttribute attribute = PropertyGridUtilities.GetAttribute(this.PropertyDescriptor); if ((attribute != null) && attribute.NeedParenthesis) { displayName = "(" + displayName + ")"; @@ -534,7 +534,7 @@ public string PropertyName get { // A common property which is present in all selectedObjects will always have the same name. - return PropertyDescriptor.Name; + return this.PropertyDescriptor.Name; } } @@ -542,7 +542,7 @@ public Type PropertyType { get { - return PropertyDescriptor.PropertyType; + return this.PropertyDescriptor.PropertyType; } } diff --git a/Source/Controls/H.Controls.PropertyGrid/PropertyGrid/Implementation/Editors/CheckBoxEditor.cs b/Source/Controls/H.Controls.PropertyGrid/PropertyGrid/Implementation/Editors/CheckBoxEditor.cs index 393fa09b..af9959ee 100644 --- a/Source/Controls/H.Controls.PropertyGrid/PropertyGrid/Implementation/Editors/CheckBoxEditor.cs +++ b/Source/Controls/H.Controls.PropertyGrid/PropertyGrid/Implementation/Editors/CheckBoxEditor.cs @@ -14,12 +14,12 @@ protected override CheckBox CreateEditor() protected override void SetControlProperties(PropertyItem propertyItem) { - Editor.Margin = new Thickness(5, 0, 0, 0); + this.Editor.Margin = new Thickness(5, 0, 0, 0); } protected override void SetValueDependencyProperty() { - ValueProperty = CheckBox.IsCheckedProperty; + this.ValueProperty = CheckBox.IsCheckedProperty; } } diff --git a/Source/Controls/H.Controls.PropertyGrid/PropertyGrid/Implementation/Editors/CollectionEditor.cs b/Source/Controls/H.Controls.PropertyGrid/PropertyGrid/Implementation/Editors/CollectionEditor.cs index aa0d5261..87779cf6 100644 --- a/Source/Controls/H.Controls.PropertyGrid/PropertyGrid/Implementation/Editors/CollectionEditor.cs +++ b/Source/Controls/H.Controls.PropertyGrid/PropertyGrid/Implementation/Editors/CollectionEditor.cs @@ -11,7 +11,7 @@ public class CollectionEditor : TypeEditor { protected override void SetValueDependencyProperty() { - ValueProperty = CollectionControlButton.ItemsSourceProperty; + this.ValueProperty = CollectionControlButton.ItemsSourceProperty; } protected override CollectionControlButton CreateEditor() @@ -24,11 +24,11 @@ protected override void ResolveValueBinding(PropertyItem propertyItem) { Type type = propertyItem.PropertyType; - Editor.ItemsSourceType = type; + this.Editor.ItemsSourceType = type; if (type.BaseType == typeof(System.Array)) { - Editor.NewItemTypes = new List() { type.GetElementType() }; + this.Editor.NewItemTypes = new List() { type.GetElementType() }; } else { @@ -36,7 +36,7 @@ protected override void ResolveValueBinding(PropertyItem propertyItem) && (propertyItem.DescriptorDefinition.NewItemTypes != null) && (propertyItem.DescriptorDefinition.NewItemTypes.Count > 0)) { - Editor.NewItemTypes = propertyItem.DescriptorDefinition.NewItemTypes; + this.Editor.NewItemTypes = propertyItem.DescriptorDefinition.NewItemTypes; } else { @@ -48,7 +48,7 @@ protected override void ResolveValueBinding(PropertyItem propertyItem) // We need to create EditableKeyValuePairs. // Create a EditableKeyValuePair< TKey, TValue> type from dictionary generic arguments type Type editableKeyValuePairType = ListUtilities.CreateEditableKeyValuePairType(dictionaryTypes[0], dictionaryTypes[1]); - Editor.NewItemTypes = new List() { editableKeyValuePairType }; + this.Editor.NewItemTypes = new List() { editableKeyValuePairType }; } else { @@ -56,7 +56,7 @@ protected override void ResolveValueBinding(PropertyItem propertyItem) Type listType = ListUtilities.GetListItemType(type); if (listType != null) { - Editor.NewItemTypes = new List() { listType }; + this.Editor.NewItemTypes = new List() { listType }; } else { @@ -64,7 +64,7 @@ protected override void ResolveValueBinding(PropertyItem propertyItem) Type colType = ListUtilities.GetCollectionItemType(type); if (colType != null) { - Editor.NewItemTypes = new List() { colType }; + this.Editor.NewItemTypes = new List() { colType }; } } } diff --git a/Source/Controls/H.Controls.PropertyGrid/PropertyGrid/Implementation/Editors/ColorEditor.cs b/Source/Controls/H.Controls.PropertyGrid/PropertyGrid/Implementation/Editors/ColorEditor.cs index f6d32ada..095fc112 100644 --- a/Source/Controls/H.Controls.PropertyGrid/PropertyGrid/Implementation/Editors/ColorEditor.cs +++ b/Source/Controls/H.Controls.PropertyGrid/PropertyGrid/Implementation/Editors/ColorEditor.cs @@ -13,12 +13,12 @@ protected override ColorPicker CreateEditor() protected override void SetControlProperties(PropertyItem propertyItem) { - Editor.BorderThickness = new System.Windows.Thickness(0); - Editor.DisplayColorAndName = true; + this.Editor.BorderThickness = new System.Windows.Thickness(0); + this.Editor.DisplayColorAndName = true; } protected override void SetValueDependencyProperty() { - ValueProperty = ColorPicker.SelectedColorProperty; + this.ValueProperty = ColorPicker.SelectedColorProperty; } } diff --git a/Source/Controls/H.Controls.PropertyGrid/PropertyGrid/Implementation/Editors/ComboBoxEditor.cs b/Source/Controls/H.Controls.PropertyGrid/PropertyGrid/Implementation/Editors/ComboBoxEditor.cs index f5e3d675..3c96e4ba 100644 --- a/Source/Controls/H.Controls.PropertyGrid/PropertyGrid/Implementation/Editors/ComboBoxEditor.cs +++ b/Source/Controls/H.Controls.PropertyGrid/PropertyGrid/Implementation/Editors/ComboBoxEditor.cs @@ -9,7 +9,7 @@ public abstract class ComboBoxEditor : TypeEditor 0) { - Editor.ItemType = typeArguments[0]; + this.Editor.ItemType = typeArguments[0]; } } diff --git a/Source/Controls/H.Controls.PropertyGrid/PropertyGrid/Implementation/Editors/TextBlockEditor.cs b/Source/Controls/H.Controls.PropertyGrid/PropertyGrid/Implementation/Editors/TextBlockEditor.cs index a720f47c..7a09e3b5 100644 --- a/Source/Controls/H.Controls.PropertyGrid/PropertyGrid/Implementation/Editors/TextBlockEditor.cs +++ b/Source/Controls/H.Controls.PropertyGrid/PropertyGrid/Implementation/Editors/TextBlockEditor.cs @@ -14,13 +14,13 @@ protected override TextBlock CreateEditor() protected override void SetValueDependencyProperty() { - ValueProperty = TextBlock.TextProperty; + this.ValueProperty = TextBlock.TextProperty; } protected override void SetControlProperties(PropertyItem propertyItem) { - Editor.Margin = new System.Windows.Thickness(5, 0, 0, 0); - Editor.TextTrimming = TextTrimming.CharacterEllipsis; + this.Editor.Margin = new System.Windows.Thickness(5, 0, 0, 0); + this.Editor.TextTrimming = TextTrimming.CharacterEllipsis; } } diff --git a/Source/Controls/H.Controls.PropertyGrid/PropertyGrid/Implementation/Editors/TextBoxEditor.cs b/Source/Controls/H.Controls.PropertyGrid/PropertyGrid/Implementation/Editors/TextBoxEditor.cs index 09e590c6..b205e78d 100644 --- a/Source/Controls/H.Controls.PropertyGrid/PropertyGrid/Implementation/Editors/TextBoxEditor.cs +++ b/Source/Controls/H.Controls.PropertyGrid/PropertyGrid/Implementation/Editors/TextBoxEditor.cs @@ -29,7 +29,7 @@ protected override void SetControlProperties(PropertyItem propertyItem) protected override void SetValueDependencyProperty() { - ValueProperty = TextBox.TextProperty; + this.ValueProperty = TextBox.TextProperty; } } diff --git a/Source/Controls/H.Controls.PropertyGrid/PropertyGrid/Implementation/Editors/TypeEditor.cs b/Source/Controls/H.Controls.PropertyGrid/PropertyGrid/Implementation/Editors/TypeEditor.cs index 8062ee3a..b4751aa2 100644 --- a/Source/Controls/H.Controls.PropertyGrid/PropertyGrid/Implementation/Editors/TypeEditor.cs +++ b/Source/Controls/H.Controls.PropertyGrid/PropertyGrid/Implementation/Editors/TypeEditor.cs @@ -27,11 +27,11 @@ protected DependencyProperty ValueProperty public virtual FrameworkElement ResolveEditor(PropertyItem propertyItem) { - Editor = this.CreateEditor(); + this.Editor = this.CreateEditor(); SetValueDependencyProperty(); SetControlProperties(propertyItem); ResolveValueBinding(propertyItem); - return Editor; + return this.Editor; } #endregion //ITypeEditor Members @@ -52,10 +52,10 @@ protected virtual void ResolveValueBinding(PropertyItem propertyItem) { Binding _binding = new Binding("Value"); _binding.Source = propertyItem; - _binding.UpdateSourceTrigger = (Editor is InputBase) ? UpdateSourceTrigger.PropertyChanged : UpdateSourceTrigger.Default; + _binding.UpdateSourceTrigger = (this.Editor is InputBase) ? UpdateSourceTrigger.PropertyChanged : UpdateSourceTrigger.Default; _binding.Mode = propertyItem.IsReadOnly ? BindingMode.OneWay : BindingMode.TwoWay; _binding.Converter = CreateValueConverter(); - BindingOperations.SetBinding(Editor, ValueProperty, _binding); + BindingOperations.SetBinding(this.Editor, this.ValueProperty, _binding); } protected virtual void SetControlProperties(PropertyItem propertyItem) diff --git a/Source/Controls/H.Controls.PropertyGrid/PropertyGrid/Implementation/Editors/UpDownEditors.cs b/Source/Controls/H.Controls.PropertyGrid/PropertyGrid/Implementation/Editors/UpDownEditors.cs index a51c5df8..8f7b0047 100644 --- a/Source/Controls/H.Controls.PropertyGrid/PropertyGrid/Implementation/Editors/UpDownEditors.cs +++ b/Source/Controls/H.Controls.PropertyGrid/PropertyGrid/Implementation/Editors/UpDownEditors.cs @@ -13,11 +13,11 @@ namespace H.Controls.PropertyGrid { protected override void SetControlProperties(PropertyItem propertyItem) { - Editor.TextAlignment = System.Windows.TextAlignment.Left; + this.Editor.TextAlignment = System.Windows.TextAlignment.Left; } protected override void SetValueDependencyProperty() { - ValueProperty = UpDownBase.ValueProperty; + this.ValueProperty = UpDownBase.ValueProperty; } #if !VS2008 @@ -29,8 +29,8 @@ internal void SetMinMaxFromRangeAttribute(PropertyDescriptor propertyDescriptor, RangeAttribute rangeAttribute = PropertyGridUtilities.GetAttribute(propertyDescriptor); if (rangeAttribute != null) { - Editor.Maximum = (TType)converter.ConvertFrom(rangeAttribute.Maximum.ToString()); - Editor.Minimum = (TType)converter.ConvertFrom(rangeAttribute.Minimum.ToString()); + this.Editor.Maximum = (TType)converter.ConvertFrom(rangeAttribute.Maximum.ToString()); + this.Editor.Minimum = (TType)converter.ConvertFrom(rangeAttribute.Minimum.ToString()); } } #endif @@ -78,7 +78,7 @@ protected override DoubleUpDown CreateEditor() protected override void SetControlProperties(PropertyItem propertyItem) { base.SetControlProperties(propertyItem); - Editor.AllowInputSpecialValues = AllowedSpecialValues.Any; + this.Editor.AllowInputSpecialValues = AllowedSpecialValues.Any; #if !VS2008 this.SetMinMaxFromRangeAttribute(propertyItem.PropertyDescriptor, TypeDescriptor.GetConverter(typeof(double))); #endif @@ -143,7 +143,7 @@ protected override SingleUpDown CreateEditor() protected override void SetControlProperties(PropertyItem propertyItem) { base.SetControlProperties(propertyItem); - Editor.AllowInputSpecialValues = AllowedSpecialValues.Any; + this.Editor.AllowInputSpecialValues = AllowedSpecialValues.Any; #if !VS2008 this.SetMinMaxFromRangeAttribute(propertyItem.PropertyDescriptor, TypeDescriptor.GetConverter(typeof(float))); #endif diff --git a/Source/Controls/H.Controls.PropertyGrid/PropertyGrid/Implementation/ObjectContainerHelper.cs b/Source/Controls/H.Controls.PropertyGrid/PropertyGrid/Implementation/ObjectContainerHelper.cs index 834dfcdd..cfed7b44 100644 --- a/Source/Controls/H.Controls.PropertyGrid/PropertyGrid/Implementation/ObjectContainerHelper.cs +++ b/Source/Controls/H.Controls.PropertyGrid/PropertyGrid/Implementation/ObjectContainerHelper.cs @@ -32,21 +32,21 @@ private object SelectedObject protected override string GetDefaultPropertyName() { - object selectedObject = SelectedObject; - return (selectedObject != null) ? ObjectContainerHelperBase.GetDefaultPropertyName(SelectedObject) : null; + object selectedObject = this.SelectedObject; + return (selectedObject != null) ? ObjectContainerHelperBase.GetDefaultPropertyName(this.SelectedObject) : null; } protected override IEnumerable GenerateSubPropertiesCore() { List propertyItems = new List(); - if (SelectedObject != null) + if (this.SelectedObject != null) { try { List descriptors = new List(); { - descriptors = ObjectContainerHelperBase.GetPropertyDescriptors(SelectedObject, this.PropertyContainer.HideInheritedProperties); + descriptors = ObjectContainerHelperBase.GetPropertyDescriptors(this.SelectedObject, this.PropertyContainer.HideInheritedProperties); } foreach (PropertyDescriptor descriptor in descriptors) @@ -105,13 +105,13 @@ protected override IEnumerable GenerateSubPropertiesCore() private PropertyItem CreatePropertyItem(PropertyDescriptor property, PropertyDefinition propertyDef) { - DescriptorPropertyDefinition definition = new DescriptorPropertyDefinition(property, SelectedObject, this.PropertyContainer); + DescriptorPropertyDefinition definition = new DescriptorPropertyDefinition(property, this.SelectedObject, this.PropertyContainer); definition.InitProperties(); this.InitializeDescriptorDefinition(definition, propertyDef); PropertyItem propertyItem = new PropertyItem(definition); - Debug.Assert(SelectedObject != null); - propertyItem.Instance = SelectedObject; + Debug.Assert(this.SelectedObject != null); + propertyItem.Instance = this.SelectedObject; propertyItem.CategoryOrder = this.GetCategoryOrder(definition.CategoryValue); propertyItem.WillRefreshPropertyGrid = this.GetWillRefreshPropertyGrid(property); @@ -120,13 +120,13 @@ private PropertyItem CreatePropertyItem(PropertyDescriptor property, PropertyDef private int GetCategoryOrder(object categoryValue) { - Debug.Assert(SelectedObject != null); + Debug.Assert(this.SelectedObject != null); if (categoryValue == null) return int.MaxValue; int order = int.MaxValue; - object selectedObject = SelectedObject; + object selectedObject = this.SelectedObject; CategoryOrderAttribute[] orderAttributes = (selectedObject != null) ? (CategoryOrderAttribute[])selectedObject.GetType().GetCustomAttributes(typeof(CategoryOrderAttribute), true) : new CategoryOrderAttribute[0]; diff --git a/Source/Controls/H.Controls.PropertyGrid/PropertyGrid/Implementation/ObjectContainerHelperBase.cs b/Source/Controls/H.Controls.PropertyGrid/PropertyGrid/Implementation/ObjectContainerHelperBase.cs index 8fe43a37..92af67c0 100644 --- a/Source/Controls/H.Controls.PropertyGrid/PropertyGrid/Implementation/ObjectContainerHelperBase.cs +++ b/Source/Controls/H.Controls.PropertyGrid/PropertyGrid/Implementation/ObjectContainerHelperBase.cs @@ -81,7 +81,7 @@ public override PropertyItemBase ContainerFromItem(object item) string propertyStr = item as string; if (propertyStr != null) - return PropertyItems.FirstOrDefault((prop) => propertyStr == prop.PropertyDescriptor.Name); + return this.PropertyItems.FirstOrDefault((prop) => propertyStr == prop.PropertyDescriptor.Name); return null; } @@ -99,7 +99,7 @@ public override object ItemFromContainer(PropertyItemBase container) public override void UpdateValuesFromSource() { - foreach (PropertyItem item in PropertyItems) + foreach (PropertyItem item in this.PropertyItems) { item.DescriptorDefinition.UpdateValueFromSource(); item.ContainerHelper.UpdateValuesFromSource(); @@ -108,7 +108,7 @@ public override void UpdateValuesFromSource() public void GenerateProperties() { - if (PropertyItems.Count == 0 + if (this.PropertyItems.Count == 0 ) { this.RegenerateProperties(); @@ -216,7 +216,7 @@ private void OnChildrenPropertyChanged(object sender, PropertyChangedEventArgs e if (this.ChildrenItemsControl.ItemContainerGenerator.Status != GeneratorStatus.GeneratingContainers && !_isPreparingItemFlag) { - PropertyItems.RefreshView(); + this.PropertyItems.RefreshView(); } } } @@ -235,15 +235,15 @@ private void RegenerateProperties() } //Remove the event callback from the previous children (if any) - foreach (PropertyItem propertyItem in PropertyItems) + foreach (PropertyItem propertyItem in this.PropertyItems) { propertyItem.PropertyChanged -= OnChildrenPropertyChanged; } - PropertyItems.UpdateItems(subProperties); + this.PropertyItems.UpdateItems(subProperties); //Add the event callback to the new childrens - foreach (PropertyItem propertyItem in PropertyItems) + foreach (PropertyItem propertyItem in this.PropertyItems) { propertyItem.PropertyChanged += OnChildrenPropertyChanged; } diff --git a/Source/Controls/H.Controls.PropertyGrid/PropertyGrid/Implementation/PropertyDefinitionBaseCollection.cs b/Source/Controls/H.Controls.PropertyGrid/PropertyGrid/Implementation/PropertyDefinitionBaseCollection.cs index ccbead82..dc0b8e9b 100644 --- a/Source/Controls/H.Controls.PropertyGrid/PropertyGrid/Implementation/PropertyDefinitionBaseCollection.cs +++ b/Source/Controls/H.Controls.PropertyGrid/PropertyGrid/Implementation/PropertyDefinitionBaseCollection.cs @@ -25,7 +25,7 @@ public virtual T this[object propertyId] { get { - foreach (T item in Items) + foreach (T item in this.Items) { if (item.TargetProperties.Contains(propertyId)) return item; diff --git a/Source/Controls/H.Controls.PropertyGrid/PropertyGrid/Implementation/PropertyItem.cs b/Source/Controls/H.Controls.PropertyGrid/PropertyGrid/Implementation/PropertyItem.cs index 82a93a2a..c67faaba 100644 --- a/Source/Controls/H.Controls.PropertyGrid/PropertyGrid/Implementation/PropertyItem.cs +++ b/Source/Controls/H.Controls.PropertyGrid/PropertyGrid/Implementation/PropertyItem.cs @@ -58,8 +58,8 @@ public Type PropertyType { get { - return (PropertyDescriptor != null) - ? PropertyDescriptor.PropertyType + return (this.PropertyDescriptor != null) + ? this.PropertyDescriptor.PropertyType : null; } } @@ -204,7 +204,7 @@ private void GenerateExpandedPropertyItems() { // This withholds the generation of all PropertyItem instances (recursively) // until the PropertyItem is expanded. - ObjectContainerHelperBase objectContainerHelper = ContainerHelper as ObjectContainerHelperBase; + ObjectContainerHelperBase objectContainerHelper = this.ContainerHelper as ObjectContainerHelperBase; if (objectContainerHelper != null) { objectContainerHelper.GenerateProperties(); diff --git a/Source/Controls/H.Controls.PropertyGrid/PropertyGrid/Implementation/PropertyItemBase.cs b/Source/Controls/H.Controls.PropertyGrid/PropertyGrid/Implementation/PropertyItemBase.cs index ff1f8fb1..6be2c96f 100644 --- a/Source/Controls/H.Controls.PropertyGrid/PropertyGrid/Implementation/PropertyItemBase.cs +++ b/Source/Controls/H.Controls.PropertyGrid/PropertyGrid/Implementation/PropertyItemBase.cs @@ -272,8 +272,8 @@ public Style PropertyContainerStyle { get { - return (ParentNode != null) - ? ParentNode.PropertyContainerStyle + return (this.ParentNode != null) + ? this.ParentNode.PropertyContainerStyle : null; } } @@ -417,7 +417,7 @@ public override void OnApplyTemplate() protected override void OnMouseDown(MouseButtonEventArgs e) { - IsSelected = true; + this.IsSelected = true; if (!this.IsKeyboardFocusWithin) { this.Focus(); @@ -430,7 +430,7 @@ protected override void OnMouseDown(MouseButtonEventArgs e) private void PropertyItemBase_GotFocus(object sender, RoutedEventArgs e) { - IsSelected = true; + this.IsSelected = true; // Handle the event; otherwise, the possible // parent property item will select itself too. e.Handled = true; diff --git a/Source/Controls/H.Controls.PropertyGrid/PropertyGrid/Implementation/PropertyItemCollection.cs b/Source/Controls/H.Controls.PropertyGrid/PropertyGrid/Implementation/PropertyItemCollection.cs index 902b2c7e..91d41f01 100644 --- a/Source/Controls/H.Controls.PropertyGrid/PropertyGrid/Implementation/PropertyItemCollection.cs +++ b/Source/Controls/H.Controls.PropertyGrid/PropertyGrid/Implementation/PropertyItemCollection.cs @@ -34,7 +34,7 @@ static PropertyItemCollection() public PropertyItemCollection(ObservableCollection editableCollection) : base(editableCollection) { - EditableCollection = editableCollection; + this.EditableCollection = editableCollection; } internal Predicate FilterPredicate @@ -82,7 +82,7 @@ internal void UpdateItems(IEnumerable newItems) _preventNotification = true; using (GetDefaultView().DeferRefresh()) { - EditableCollection.Clear(); + this.EditableCollection.Clear(); foreach (PropertyItem item in newItems) { this.EditableCollection.Add(item); diff --git a/Source/Controls/H.Controls.QRCoderBox/Extension.cs b/Source/Controls/H.Controls.QRCoderBox/Extension.cs index 073841c4..e9345b6c 100644 --- a/Source/Controls/H.Controls.QRCoderBox/Extension.cs +++ b/Source/Controls/H.Controls.QRCoderBox/Extension.cs @@ -1,10 +1,7 @@ -using H.Controls.QRCoderBox; -using System.Collections.Generic; - -namespace System +namespace System { public static class Extension { - + } } diff --git a/Source/Controls/H.Controls.QRCoderBox/QRCoderBox.xaml.cs b/Source/Controls/H.Controls.QRCoderBox/QRCoderBox.xaml.cs index ad55a568..0a7fb38a 100644 --- a/Source/Controls/H.Controls.QRCoderBox/QRCoderBox.xaml.cs +++ b/Source/Controls/H.Controls.QRCoderBox/QRCoderBox.xaml.cs @@ -1,7 +1,5 @@ -using QRCoder.Xaml; -using QRCoder; -using System; -using System.Linq; +using QRCoder; +using QRCoder.Xaml; using System.Windows; using System.Windows.Controls; using System.Windows.Media; diff --git a/Source/Controls/H.Controls.RepositoryBox/RepositoryBox.xaml.cs b/Source/Controls/H.Controls.RepositoryBox/RepositoryBox.xaml.cs index c9d94e69..e9a69f62 100644 --- a/Source/Controls/H.Controls.RepositoryBox/RepositoryBox.xaml.cs +++ b/Source/Controls/H.Controls.RepositoryBox/RepositoryBox.xaml.cs @@ -18,7 +18,7 @@ public Type Type set { SetValue(TypeProperty, value); } } - + public static readonly DependencyProperty TypeProperty = DependencyProperty.Register("Type", typeof(Type), typeof(RepositoryBox), new FrameworkPropertyMetadata(default(Type), (d, e) => { @@ -51,7 +51,7 @@ public bool UseAdd set { SetValue(UseAddProperty, value); } } - + public static readonly DependencyProperty UseAddProperty = DependencyProperty.Register("UseAdd", typeof(bool), typeof(RepositoryBox), new FrameworkPropertyMetadata(default(bool), (d, e) => { @@ -78,7 +78,7 @@ public bool UseDelete set { SetValue(UseDeleteProperty, value); } } - + public static readonly DependencyProperty UseDeleteProperty = DependencyProperty.Register("UseDelete", typeof(bool), typeof(RepositoryBox), new FrameworkPropertyMetadata(default(bool), (d, e) => { @@ -105,7 +105,7 @@ public bool UseCheckAll set { SetValue(UseCheckAllProperty, value); } } - + public static readonly DependencyProperty UseCheckAllProperty = DependencyProperty.Register("UseCheckAll", typeof(bool), typeof(RepositoryBox), new FrameworkPropertyMetadata(default(bool), (d, e) => { @@ -132,7 +132,7 @@ public bool UseClear set { SetValue(UseClearProperty, value); } } - + public static readonly DependencyProperty UseClearProperty = DependencyProperty.Register("UseClear", typeof(bool), typeof(RepositoryBox), new FrameworkPropertyMetadata(default(bool), (d, e) => { @@ -159,7 +159,7 @@ public bool UseEdit set { SetValue(UseEditProperty, value); } } - + public static readonly DependencyProperty UseEditProperty = DependencyProperty.Register("UseEdit", typeof(bool), typeof(RepositoryBox), new FrameworkPropertyMetadata(default(bool), (d, e) => { @@ -186,7 +186,7 @@ public bool UseExport set { SetValue(UseExportProperty, value); } } - + public static readonly DependencyProperty UseExportProperty = DependencyProperty.Register("UseExport", typeof(bool), typeof(RepositoryBox), new FrameworkPropertyMetadata(default(bool), (d, e) => { @@ -213,7 +213,7 @@ public bool UseView set { SetValue(UseViewProperty, value); } } - + public static readonly DependencyProperty UseViewProperty = DependencyProperty.Register("UseView", typeof(bool), typeof(RepositoryBox), new FrameworkPropertyMetadata(default(bool), (d, e) => { @@ -240,7 +240,7 @@ public bool UseDeleteChecked set { SetValue(UseDeleteCheckedProperty, value); } } - + public static readonly DependencyProperty UseDeleteCheckedProperty = DependencyProperty.Register("UseDeleteChecked", typeof(bool), typeof(RepositoryBox), new FrameworkPropertyMetadata(default(bool), (d, e) => { @@ -267,7 +267,7 @@ public bool UseSave set { SetValue(UseSaveProperty, value); } } - + public static readonly DependencyProperty UseSaveProperty = DependencyProperty.Register("UseSave", typeof(bool), typeof(RepositoryBox), new FrameworkPropertyMetadata(default(bool), (d, e) => { @@ -294,7 +294,7 @@ public bool UseNextPage set { SetValue(UseNextPageProperty, value); } } - + public static readonly DependencyProperty UseNextPageProperty = DependencyProperty.Register("UseNextPage", typeof(bool), typeof(RepositoryBox), new FrameworkPropertyMetadata(default(bool), (d, e) => { @@ -321,7 +321,7 @@ public bool UsePreviousPage set { SetValue(UsePreviousPageProperty, value); } } - + public static readonly DependencyProperty UsePreviousPageProperty = DependencyProperty.Register("UsePreviousPage", typeof(bool), typeof(RepositoryBox), new FrameworkPropertyMetadata(default(bool), (d, e) => { diff --git a/Source/Controls/H.Controls.RepositoryBox/RepositoryGrid.xaml.cs b/Source/Controls/H.Controls.RepositoryBox/RepositoryGrid.xaml.cs index 49c4c785..8d68eac4 100644 --- a/Source/Controls/H.Controls.RepositoryBox/RepositoryGrid.xaml.cs +++ b/Source/Controls/H.Controls.RepositoryBox/RepositoryGrid.xaml.cs @@ -18,7 +18,7 @@ public Type Type set { SetValue(TypeProperty, value); } } - + public static readonly DependencyProperty TypeProperty = DependencyProperty.Register("Type", typeof(Type), typeof(RepositoryGrid), new FrameworkPropertyMetadata(default(Type), (d, e) => { @@ -51,7 +51,7 @@ public bool UseAdd set { SetValue(UseAddProperty, value); } } - + public static readonly DependencyProperty UseAddProperty = DependencyProperty.Register("UseAdd", typeof(bool), typeof(RepositoryGrid), new FrameworkPropertyMetadata(default(bool), (d, e) => { @@ -78,7 +78,7 @@ public bool UseDelete set { SetValue(UseDeleteProperty, value); } } - + public static readonly DependencyProperty UseDeleteProperty = DependencyProperty.Register("UseDelete", typeof(bool), typeof(RepositoryGrid), new FrameworkPropertyMetadata(default(bool), (d, e) => { @@ -105,7 +105,7 @@ public bool UseCheckAll set { SetValue(UseCheckAllProperty, value); } } - + public static readonly DependencyProperty UseCheckAllProperty = DependencyProperty.Register("UseCheckAll", typeof(bool), typeof(RepositoryGrid), new FrameworkPropertyMetadata(default(bool), (d, e) => { @@ -132,7 +132,7 @@ public bool UseClear set { SetValue(UseClearProperty, value); } } - + public static readonly DependencyProperty UseClearProperty = DependencyProperty.Register("UseClear", typeof(bool), typeof(RepositoryGrid), new FrameworkPropertyMetadata(default(bool), (d, e) => { @@ -159,7 +159,7 @@ public bool UseEdit set { SetValue(UseEditProperty, value); } } - + public static readonly DependencyProperty UseEditProperty = DependencyProperty.Register("UseEdit", typeof(bool), typeof(RepositoryGrid), new FrameworkPropertyMetadata(default(bool), (d, e) => { @@ -186,7 +186,7 @@ public bool UseExport set { SetValue(UseExportProperty, value); } } - + public static readonly DependencyProperty UseExportProperty = DependencyProperty.Register("UseExport", typeof(bool), typeof(RepositoryGrid), new FrameworkPropertyMetadata(default(bool), (d, e) => { @@ -213,7 +213,7 @@ public bool UseView set { SetValue(UseViewProperty, value); } } - + public static readonly DependencyProperty UseViewProperty = DependencyProperty.Register("UseView", typeof(bool), typeof(RepositoryGrid), new FrameworkPropertyMetadata(default(bool), (d, e) => { @@ -240,7 +240,7 @@ public bool UseDeleteChecked set { SetValue(UseDeleteCheckedProperty, value); } } - + public static readonly DependencyProperty UseDeleteCheckedProperty = DependencyProperty.Register("UseDeleteChecked", typeof(bool), typeof(RepositoryGrid), new FrameworkPropertyMetadata(default(bool), (d, e) => { @@ -267,7 +267,7 @@ public bool UseSave set { SetValue(UseSaveProperty, value); } } - + public static readonly DependencyProperty UseSaveProperty = DependencyProperty.Register("UseSave", typeof(bool), typeof(RepositoryGrid), new FrameworkPropertyMetadata(default(bool), (d, e) => { @@ -294,7 +294,7 @@ public bool UseNextPage set { SetValue(UseNextPageProperty, value); } } - + public static readonly DependencyProperty UseNextPageProperty = DependencyProperty.Register("UseNextPage", typeof(bool), typeof(RepositoryGrid), new FrameworkPropertyMetadata(default(bool), (d, e) => { @@ -321,7 +321,7 @@ public bool UsePreviousPage set { SetValue(UsePreviousPageProperty, value); } } - + public static readonly DependencyProperty UsePreviousPageProperty = DependencyProperty.Register("UsePreviousPage", typeof(bool), typeof(RepositoryGrid), new FrameworkPropertyMetadata(default(bool), (d, e) => { diff --git a/Source/Controls/H.Controls.ScheduleBox/Job/HelloJob.cs b/Source/Controls/H.Controls.ScheduleBox/Job/HelloJob.cs index 15d69c08..77565156 100644 --- a/Source/Controls/H.Controls.ScheduleBox/Job/HelloJob.cs +++ b/Source/Controls/H.Controls.ScheduleBox/Job/HelloJob.cs @@ -22,7 +22,7 @@ public async Task Execute(IJobExecutionContext context) //IocSchedule.Instance.OnLogMessaged($"【触发时间】:{context.ScheduledFireTimeUtc?.LocalDateTime}"); //IocSchedule.Instance.OnLogMessaged($"【下次触发时间】:{context.NextFireTimeUtc?.LocalDateTime}"); } - catch (Exception ex) + catch (Exception) { diff --git a/Source/Controls/H.Controls.Step/ShowStepCommand.cs b/Source/Controls/H.Controls.Step/ShowStepCommand.cs index 15ec7dc4..ef04fc23 100644 --- a/Source/Controls/H.Controls.Step/ShowStepCommand.cs +++ b/Source/Controls/H.Controls.Step/ShowStepCommand.cs @@ -1,6 +1,5 @@ using H.Providers.Ioc; using H.Providers.Mvvm; -using System.ComponentModel.DataAnnotations.Schema; using System.Threading; namespace H.Controls.Step diff --git a/Source/Controls/H.Controls.Step/StepPresenter.xaml.cs b/Source/Controls/H.Controls.Step/StepPresenter.xaml.cs index f7bbe754..9c99df0b 100644 --- a/Source/Controls/H.Controls.Step/StepPresenter.xaml.cs +++ b/Source/Controls/H.Controls.Step/StepPresenter.xaml.cs @@ -8,7 +8,7 @@ namespace H.Controls.Step [Display(Name = "步骤")] public class StepPresenter : DisplayBindableBase { - private Orientation _orientation= Orientation.Horizontal; + private Orientation _orientation = Orientation.Horizontal; public Orientation Orientation { get { return _orientation; } diff --git a/Source/Controls/H.Controls.TagBox/Service/ITagService.cs b/Source/Controls/H.Controls.TagBox/Service/ITagService.cs index 1cc82a56..b37bc8af 100644 --- a/Source/Controls/H.Controls.TagBox/Service/ITagService.cs +++ b/Source/Controls/H.Controls.TagBox/Service/ITagService.cs @@ -1,7 +1,6 @@ using H.Providers.Ioc; using System; using System.Collections.Generic; -using System.Linq; namespace H.Controls.TagBox { diff --git a/Source/Controls/H.Controls.TagBox/Service/TagService.cs b/Source/Controls/H.Controls.TagBox/Service/TagService.cs index 6d6b415b..af4bf435 100644 --- a/Source/Controls/H.Controls.TagBox/Service/TagService.cs +++ b/Source/Controls/H.Controls.TagBox/Service/TagService.cs @@ -1,9 +1,6 @@ using Microsoft.Extensions.Options; -using System.Collections; using System.Collections.Generic; using System.ComponentModel.DataAnnotations; -using System.Windows.Documents; -using System.Xml.Linq; namespace H.Controls.TagBox { diff --git a/Source/Controls/H.Controls.TagBox/TagBox.xaml.cs b/Source/Controls/H.Controls.TagBox/TagBox.xaml.cs index 48e8354a..707e21cf 100644 --- a/Source/Controls/H.Controls.TagBox/TagBox.xaml.cs +++ b/Source/Controls/H.Controls.TagBox/TagBox.xaml.cs @@ -1,5 +1,4 @@ using H.Extensions.ValueConverter; -using H.Providers.Mvvm; using System; using System.Globalization; using System.Linq; @@ -94,14 +93,14 @@ protected override void OnSelectionChanged(SelectionChangedEventArgs e) if (this._flag) return; - if(e.AddedItems!=null) + if (e.AddedItems != null) { foreach (var item in e.AddedItems.OfType()) { item.Order++; } } - + var tags = this.SelectedItems.OfType(); this._flag = true; this.Tags = string.Join(",", tags.Select(x => x.Name)); diff --git a/Source/Controls/H.Controls.TagBox/TagFilterBox.xaml.cs b/Source/Controls/H.Controls.TagBox/TagFilterBox.xaml.cs index 7ac4e7c7..4e959d0b 100644 --- a/Source/Controls/H.Controls.TagBox/TagFilterBox.xaml.cs +++ b/Source/Controls/H.Controls.TagBox/TagFilterBox.xaml.cs @@ -62,7 +62,7 @@ private IEnumerable GetItemsSource() { if (this.UseCheckAll) yield return "全选"; - foreach (object value in IocTagService.Instance.Collection.Where(x => x.GroupName == this.GroupName).OrderByDescending(x=>x.Order)) + foreach (object value in IocTagService.Instance.Collection.Where(x => x.GroupName == this.GroupName).OrderByDescending(x => x.Order)) { yield return value; } diff --git a/Source/Controls/H.Controls.TagBox/TagsPresenter.xaml.cs b/Source/Controls/H.Controls.TagBox/TagsPresenter.xaml.cs index 434ca1da..073fc600 100644 --- a/Source/Controls/H.Controls.TagBox/TagsPresenter.xaml.cs +++ b/Source/Controls/H.Controls.TagBox/TagsPresenter.xaml.cs @@ -1,5 +1,4 @@ using H.Providers.Mvvm; -using System; using System.Collections.ObjectModel; namespace H.Controls.TagBox diff --git a/Source/Controls/H.Controls.TreeListView/GetLevelToIndentConverter.cs b/Source/Controls/H.Controls.TreeListView/GetLevelToIndentConverter.cs index 9fc37157..276e1cec 100644 --- a/Source/Controls/H.Controls.TreeListView/GetLevelToIndentConverter.cs +++ b/Source/Controls/H.Controls.TreeListView/GetLevelToIndentConverter.cs @@ -4,7 +4,6 @@ using System; using System.Globalization; using System.Windows; -using System.Windows.Data; namespace H.Controls.TreeListView { @@ -29,7 +28,7 @@ public class GetLevelToIndentConverter : MarkupValueConverterBase public override object Convert(object value, Type targetType, object parameter, CultureInfo culture) { - return new Thickness((int)value * IndentSize, 0, 0, 0); + return new Thickness((int)value * this.IndentSize, 0, 0, 0); } } } diff --git a/Source/Controls/H.Controls.TreeListView/TreeListView.xaml.cs b/Source/Controls/H.Controls.TreeListView/TreeListView.xaml.cs index 885768df..0103889e 100644 --- a/Source/Controls/H.Controls.TreeListView/TreeListView.xaml.cs +++ b/Source/Controls/H.Controls.TreeListView/TreeListView.xaml.cs @@ -1,7 +1,5 @@ // Copyright © 2024 By HeBianGu(QQ:908293466) https://github.com/HeBianGu/WPF-Control -using H.Extensions.ValueConverter; -using H.Providers.Mvvm; using System.Windows; using System.Windows.Controls; @@ -49,7 +47,7 @@ protected override void OnSelectedItemChanged(RoutedPropertyChangedEventArgs + CommandBinding binding = new CommandBinding(VlcPlayerCommands.FullScreen, (l, k) => { Style temp = this.Style; @@ -219,7 +218,7 @@ public bool IsFullScreen public override void OnApplyTemplate() { base.OnApplyTemplate(); - this._media_slider = Template.FindName("media_slider", this) as Slider; + this._media_slider = this.Template.FindName("media_slider", this) as Slider; this._media_slider.ValueChanged += media_slider_ValueChanged; } @@ -484,7 +483,7 @@ private void RefreshSlider() { this.Dispatcher.Invoke(() => { - if (this.IsPlaying == false|| this._vlc.IsLoaded==false) + if (this.IsPlaying == false || this._vlc.IsLoaded == false) return; this._media_slider.ValueChanged -= this.media_slider_ValueChanged; this._media_slider.Value = this._vlc.SourceProvider.MediaPlayer == null ? 0 : this._vlc.SourceProvider.MediaPlayer.Time; diff --git a/Source/Controls/H.Controls.Vlc/VlcSetting.cs b/Source/Controls/H.Controls.Vlc/VlcSetting.cs index 8dca0cc8..5a713362 100644 --- a/Source/Controls/H.Controls.Vlc/VlcSetting.cs +++ b/Source/Controls/H.Controls.Vlc/VlcSetting.cs @@ -7,7 +7,6 @@ using System.ComponentModel; using System.ComponentModel.DataAnnotations; using System.IO; -using System.Reflection; using System.Windows; namespace H.Controls.Vlc diff --git a/Source/Controls/H.Controls.ZoomBox/Provider/KeyModifierCollection.cs b/Source/Controls/H.Controls.ZoomBox/Provider/KeyModifierCollection.cs index 3058dc24..adc41d6a 100644 --- a/Source/Controls/H.Controls.ZoomBox/Provider/KeyModifierCollection.cs +++ b/Source/Controls/H.Controls.ZoomBox/Provider/KeyModifierCollection.cs @@ -16,7 +16,7 @@ public bool AreActive { get { - if (Count == 0) + if (this.Count == 0) return true; // if the Blocked modifier is present, then the action is not allowed diff --git a/Source/Controls/H.Controls.ZoomBox/Provider/PropertyChangedEventArgs.cs b/Source/Controls/H.Controls.ZoomBox/Provider/PropertyChangedEventArgs.cs index 53d5f3c5..48027896 100644 --- a/Source/Controls/H.Controls.ZoomBox/Provider/PropertyChangedEventArgs.cs +++ b/Source/Controls/H.Controls.ZoomBox/Provider/PropertyChangedEventArgs.cs @@ -13,7 +13,7 @@ public PropertyChangedEventArgs(RoutedEvent Event, T oldValue, T newValue) { _oldValue = oldValue; _newValue = newValue; - RoutedEvent = Event; + this.RoutedEvent = Event; } #endregion diff --git a/Source/Controls/H.Controls.ZoomBox/Provider/VisibilityToBoolConverter.cs b/Source/Controls/H.Controls.ZoomBox/Provider/VisibilityToBoolConverter.cs index 3cc94c2f..1631d0a0 100644 --- a/Source/Controls/H.Controls.ZoomBox/Provider/VisibilityToBoolConverter.cs +++ b/Source/Controls/H.Controls.ZoomBox/Provider/VisibilityToBoolConverter.cs @@ -46,12 +46,12 @@ public bool Not public object Convert(object value, Type targetType, object parameter, CultureInfo culture) { - return Inverted ? BoolToVisibility(value) : VisibilityToBool(value); + return this.Inverted ? BoolToVisibility(value) : VisibilityToBool(value); } public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) { - return Inverted ? VisibilityToBool(value) : BoolToVisibility(value); + return this.Inverted ? VisibilityToBool(value) : BoolToVisibility(value); } private object VisibilityToBool(object value) @@ -59,7 +59,7 @@ private object VisibilityToBool(object value) if (!(value is Visibility)) throw new InvalidOperationException(ErrorMessages.GetMessage("SuppliedValueWasNotVisibility")); - return (Visibility)value == Visibility.Visible ^ Not; + return (Visibility)value == Visibility.Visible ^ this.Not; } private object BoolToVisibility(object value) @@ -67,7 +67,7 @@ private object BoolToVisibility(object value) if (!(value is bool)) throw new InvalidOperationException(ErrorMessages.GetMessage("SuppliedValueWasNotBool")); - return (bool)value ^ Not ? Visibility.Visible : Visibility.Collapsed; + return (bool)value ^ this.Not ? Visibility.Visible : Visibility.Collapsed; } } } diff --git a/Source/Controls/H.Controls.ZoomBox/Zoombox.xaml.cs b/Source/Controls/H.Controls.ZoomBox/Zoombox.xaml.cs index b1d0675a..8e4fc0b1 100644 --- a/Source/Controls/H.Controls.ZoomBox/Zoombox.xaml.cs +++ b/Source/Controls/H.Controls.ZoomBox/Zoombox.xaml.cs @@ -993,7 +993,7 @@ private void OnViewStackIndexChanged(DependencyPropertyChangedEventArgs e) if (!this.IsUpdatingView) { int viewIndex = this.ViewStackIndex; - if (viewIndex >= 0 && viewIndex < ViewStack.Count) + if (viewIndex >= 0 && viewIndex < this.ViewStack.Count) { // update the current view, but don't allow the new view // to be added to the view stack @@ -1089,7 +1089,7 @@ public IEnumerable ViewStackSource { get { - return (_viewStack == null) ? null : ViewStack.Source; + return (_viewStack == null) ? null : this.ViewStack.Source; } set { @@ -1718,7 +1718,7 @@ private void GoHome(object sender, ExecutedRoutedEventArgs e) private void PanDownExecuted(object sender, ExecutedRoutedEventArgs e) { - this.Position = new Point(_basePosition.X, _basePosition.Y + PanDistance); + this.Position = new Point(_basePosition.X, _basePosition.Y + this.PanDistance); } #endregion @@ -2191,7 +2191,7 @@ private void ContentPresenterFirstArranged(object sender, EventArgs e) this.InvalidateVisual(); // temporarily disable animations - bool oldAnimated = IsAnimated; + bool oldAnimated = this.IsAnimated; this.IsAnimated = false; try { @@ -2239,7 +2239,7 @@ private void ContentPresenterFirstArranged(object sender, EventArgs e) if (!isInitialViewSet) { // set initial view according to the scale and position values and push it on the stack, as necessary - ZoomboxView initialView = new ZoomboxView(DoubleHelper.IsNaN(Scale) ? 1.0 : Scale, + ZoomboxView initialView = new ZoomboxView(DoubleHelper.IsNaN(this.Scale) ? 1.0 : this.Scale, PointHelper.IsEmpty(position) ? new Point() : position); if (this.EffectiveViewStackMode == ZoomboxViewStackMode.Auto) @@ -2256,13 +2256,13 @@ private void ContentPresenterFirstArranged(object sender, EventArgs e) else { // just set initial view according to the scale and position values - ZoomboxView initialView = new ZoomboxView(DoubleHelper.IsNaN(Scale) ? 1.0 : this.Scale, position); + ZoomboxView initialView = new ZoomboxView(DoubleHelper.IsNaN(this.Scale) ? 1.0 : this.Scale, position); this.UpdateView(initialView, false, false); } } finally { - IsAnimated = oldAnimated; + this.IsAnimated = oldAnimated; } //When ViewFinder is modified, this will refresh the ZoomboxViewFinderDisplay this.ZoomTo(this.Scale); @@ -2895,13 +2895,13 @@ private void UpdateView(ZoomboxView view, bool allowAnimation, bool allowStackAd { // USING ABSOLUTE POSITION AND SCALE VALUES // ensure that the scale value falls within the valid range - if (newRelativeScale > MaxScale) + if (newRelativeScale > this.MaxScale) { - newRelativeScale = MaxScale; + newRelativeScale = this.MaxScale; } - else if (newRelativeScale < MinScale) + else if (newRelativeScale < this.MinScale) { - newRelativeScale = MinScale; + newRelativeScale = this.MinScale; } } @@ -2923,7 +2923,7 @@ private void UpdateView(ZoomboxView view, bool allowAnimation, bool allowStackAd currentY = tt.Y; } - if (KeepContentInBounds == true) + if (this.KeepContentInBounds == true) { Rect boundsRect = new Rect(new Size(this.ContentRect.Width * newRelativeScale, this.ContentRect.Height * newRelativeScale)); @@ -3016,17 +3016,17 @@ private void UpdateView(ZoomboxView view, bool allowAnimation, bool allowStackAd Size initialContentSize = (_content is Viewbox) && ((Viewbox)_content).Child != null ? ((Viewbox)_content).Child.DesiredSize : this.RenderSize; Size scaledContentSize = new Size(initialContentSize.Width * newRelativeScale, initialContentSize.Height * newRelativeScale); - if (allowAnimation && IsAnimated) + if (allowAnimation && this.IsAnimated) { - DoubleAnimation daScale = new DoubleAnimation(currentScale, newRelativeScale / _viewboxFactor, AnimationDuration); + DoubleAnimation daScale = new DoubleAnimation(currentScale, newRelativeScale / _viewboxFactor, this.AnimationDuration); daScale.AccelerationRatio = this.AnimationAccelerationRatio; daScale.DecelerationRatio = this.AnimationDecelerationRatio; - DoubleAnimation daTranslateX = new DoubleAnimation(currentX, newRelativePosition.X, AnimationDuration); + DoubleAnimation daTranslateX = new DoubleAnimation(currentX, newRelativePosition.X, this.AnimationDuration); daTranslateX.AccelerationRatio = this.AnimationAccelerationRatio; daTranslateX.DecelerationRatio = this.AnimationDecelerationRatio; - DoubleAnimation daTranslateY = new DoubleAnimation(currentY, newRelativePosition.Y, AnimationDuration); + DoubleAnimation daTranslateY = new DoubleAnimation(currentY, newRelativePosition.Y, this.AnimationDuration); daTranslateY.AccelerationRatio = this.AnimationAccelerationRatio; daTranslateY.DecelerationRatio = this.AnimationDecelerationRatio; daTranslateY.CurrentTimeInvalidated += new EventHandler(this.UpdateViewport); @@ -3046,13 +3046,13 @@ private void UpdateView(ZoomboxView view, bool allowAnimation, bool allowStackAd DoubleAnimation verticalMaxAnimation = new DoubleAnimation(); verticalMaxAnimation.From = _verticalScrollBar.Maximum; verticalMaxAnimation.To = scaledContentSize.Height - _verticalScrollBar.ViewportSize; - verticalMaxAnimation.Duration = AnimationDuration; + verticalMaxAnimation.Duration = this.AnimationDuration; _verticalScrollBar.BeginAnimation(ScrollBar.MaximumProperty, verticalMaxAnimation); DoubleAnimation verticalValueAnimation = new DoubleAnimation(); verticalValueAnimation.From = _verticalScrollBar.Value; verticalValueAnimation.To = -newRelativePosition.Y; - verticalValueAnimation.Duration = AnimationDuration; + verticalValueAnimation.Duration = this.AnimationDuration; verticalValueAnimation.Completed += this.VerticalValueAnimation_Completed; _verticalScrollBar.BeginAnimation(ScrollBar.ValueProperty, verticalValueAnimation); @@ -3060,13 +3060,13 @@ private void UpdateView(ZoomboxView view, bool allowAnimation, bool allowStackAd DoubleAnimation horizontalMaxAnimation = new DoubleAnimation(); horizontalMaxAnimation.From = _horizontalScrollBar.Maximum; horizontalMaxAnimation.To = scaledContentSize.Width - _horizontalScrollBar.ViewportSize; - horizontalMaxAnimation.Duration = AnimationDuration; + horizontalMaxAnimation.Duration = this.AnimationDuration; _horizontalScrollBar.BeginAnimation(ScrollBar.MaximumProperty, horizontalMaxAnimation); DoubleAnimation horizontalValueAnimation = new DoubleAnimation(); horizontalValueAnimation.From = _horizontalScrollBar.Value; horizontalValueAnimation.To = -newRelativePosition.X; - horizontalValueAnimation.Duration = AnimationDuration; + horizontalValueAnimation.Duration = this.AnimationDuration; horizontalValueAnimation.Completed += this.HorizontalValueAnimation_Completed; _horizontalScrollBar.BeginAnimation(ScrollBar.ValueProperty, horizontalValueAnimation); } @@ -3214,7 +3214,7 @@ private void CalculatePositionAndScale(Rect region, ref Point newRelativePositio horizontalOffset = this.RenderSize.Width - (region.Width * newRelativeScale); break; } - switch (VerticalContentAlignment) + switch (this.VerticalContentAlignment) { case VerticalAlignment.Center: case VerticalAlignment.Stretch: @@ -3296,7 +3296,7 @@ private void UpdateViewport() Rect viewport = new Rect( this.TranslatePoint(new Point(0d, 0d), _trueContent), - this.TranslatePoint(new Point(RenderSize.Width, RenderSize.Height), _trueContent)); + this.TranslatePoint(new Point(this.RenderSize.Width, this.RenderSize.Height), _trueContent)); // if the viewport has changed, set the Viewport dependency property if (!DoubleHelper.AreVirtuallyEqual(viewport, this.Viewport)) @@ -3389,7 +3389,7 @@ private void ViewFinderDisplayBeginCapture(object sender, MouseButtonEventArgs e double scale = _viewFinderDisplay.Scale; Rect contentRect = _viewFinderDisplay.ContentBounds; Vector minVector = new Vector(direction.X * ARBITRARY_LARGE_VALUE, direction.Y * ARBITRARY_LARGE_VALUE); - Vector maxVector = new Vector(direction.X * contentRect.Width / MaxScale, direction.Y * contentRect.Height / MaxScale); + Vector maxVector = new Vector(direction.X * contentRect.Width / this.MaxScale, direction.Y * contentRect.Height / this.MaxScale); _resizeViewportBounds = new Rect(_resizeAnchorPoint + minVector, _resizeAnchorPoint + maxVector); } @@ -3623,7 +3623,7 @@ private Point GetZoomRelativePoint() { Point zoomPoint; - if (ZoomOn == ZoomboxZoomOn.View) + if (this.ZoomOn == ZoomboxZoomOn.View) { // Transform the viewport point to the content Point viewportZoomOrigin = new Point(); @@ -3655,7 +3655,7 @@ private Point GetZoomRelativePoint() } else { - zoomPoint = new Point(_content.RenderSize.Width * ZoomOrigin.X, _content.RenderSize.Height * ZoomOrigin.Y); + zoomPoint = new Point(_content.RenderSize.Width * this.ZoomOrigin.X, _content.RenderSize.Height * this.ZoomOrigin.Y); } return zoomPoint; @@ -3995,7 +3995,7 @@ public Size LastSize protected override void OnRender(DrawingContext drawingContext) { - drawingContext.DrawRectangle(Brush, Pen, Rect); + drawingContext.DrawRectangle(this.Brush, this.Pen, this.Rect); } private Point _cachedPosition; diff --git a/Source/Controls/H.Controls.ZoomBox/Zoombox/ZoomboxView.cs b/Source/Controls/H.Controls.ZoomBox/Zoombox/ZoomboxView.cs index 8fdc28c0..30de12c2 100644 --- a/Source/Controls/H.Controls.ZoomBox/Zoombox/ZoomboxView.cs +++ b/Source/Controls/H.Controls.ZoomBox/Zoombox/ZoomboxView.cs @@ -227,11 +227,11 @@ public override bool Equals(object o) { case ZoomboxViewKind.Absolute: result = DoubleHelper.AreVirtuallyEqual(_scaleWidth, other._scaleWidth) - && DoubleHelper.AreVirtuallyEqual(Position, other.Position); + && DoubleHelper.AreVirtuallyEqual(this.Position, other.Position); break; case ZoomboxViewKind.Region: - result = DoubleHelper.AreVirtuallyEqual(Region, other.Region); + result = DoubleHelper.AreVirtuallyEqual(this.Region, other.Region); break; default: @@ -245,7 +245,7 @@ public override bool Equals(object o) public override string ToString() { - switch (ViewKind) + switch (this.ViewKind) { case ZoomboxViewKind.Empty: return "ZoomboxView: Empty"; diff --git a/Source/Controls/H.Controls.ZoomBox/Zoombox/ZoomboxViewStack.cs b/Source/Controls/H.Controls.ZoomBox/Zoombox/ZoomboxViewStack.cs index f745b475..e5c00a9e 100644 --- a/Source/Controls/H.Controls.ZoomBox/Zoombox/ZoomboxViewStack.cs +++ b/Source/Controls/H.Controls.ZoomBox/Zoombox/ZoomboxViewStack.cs @@ -25,7 +25,7 @@ public ZoomboxView SelectedView get { int currentIndex = this.Zoombox.ViewStackIndex; - return (currentIndex < 0 || currentIndex > Count - 1) ? ZoomboxView.Empty : this[currentIndex]; + return (currentIndex < 0 || currentIndex > this.Count - 1) ? ZoomboxView.Empty : this[currentIndex]; } } @@ -163,7 +163,7 @@ internal void PushView(ZoomboxView view) int currentIndex = this.Zoombox.ViewStackIndex; while (this.Count - 1 > currentIndex) { - this.RemoveAt(Count - 1); + this.RemoveAt(this.Count - 1); } this.Add(view); } @@ -187,7 +187,7 @@ protected override void ClearItems() bool currentDeleted = this.Zoombox.CurrentViewIndex >= 0; base.ClearItems(); - this.Zoombox.SetViewStackCount(Count); + this.Zoombox.SetViewStackCount(this.Count); // if resetting the views due to a change in the view source collection, just return if (this.IsResettingViews) @@ -244,7 +244,7 @@ protected override void InsertItem(int index, ZoomboxView view) } base.InsertItem(index, view); - this.Zoombox.SetViewStackCount(Count); + this.Zoombox.SetViewStackCount(this.Count); } protected override void RemoveItem(int index) @@ -295,7 +295,7 @@ protected override void RemoveItem(int index) this.Zoombox.RefocusView(); } - this.Zoombox.SetViewStackCount(Count); + this.Zoombox.SetViewStackCount(this.Count); } protected override void SetItem(int index, ZoomboxView view) diff --git a/Source/DataBases/H.DataBases.Share/IDbSetting.cs b/Source/DataBases/H.DataBases.Share/IDbSetting.cs index 42abb342..357b18ba 100644 --- a/Source/DataBases/H.DataBases.Share/IDbSetting.cs +++ b/Source/DataBases/H.DataBases.Share/IDbSetting.cs @@ -4,9 +4,6 @@ #if NETCOREAPP #endif -using Microsoft.Extensions.DependencyInjection; -using System; - namespace H.DataBases.Share { public interface IDbSettable diff --git a/Source/DataBases/H.DataBases.Sqlite/DataContextFactory.cs b/Source/DataBases/H.DataBases.Sqlite/DataContextFactory.cs index 7b851c0d..3841ee40 100644 --- a/Source/DataBases/H.DataBases.Sqlite/DataContextFactory.cs +++ b/Source/DataBases/H.DataBases.Sqlite/DataContextFactory.cs @@ -4,10 +4,6 @@ #if NETCOREAPP #endif -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Design; -using Microsoft.EntityFrameworkCore.Infrastructure.Internal; - namespace H.DataBases.Sqlite { //public class DataContextFactory : IDesignTimeDbContextFactory where T : DbContext diff --git a/Source/Datas/H.Data.Test/GetTestViewModelsExtension.cs b/Source/Datas/H.Data.Test/GetTestViewModelsExtension.cs index 642209d7..7815d9c3 100644 --- a/Source/Datas/H.Data.Test/GetTestViewModelsExtension.cs +++ b/Source/Datas/H.Data.Test/GetTestViewModelsExtension.cs @@ -1,12 +1,7 @@ // Copyright © 2024 By HeBianGu(QQ:908293466) https://github.com/HeBianGu/WPF-Control using System; -using System.Collections.ObjectModel; -using System.ComponentModel.DataAnnotations; -using System.Globalization; using System.Linq; -using System.Reflection; -using System.Windows.Controls; using System.Windows.Markup; namespace H.Data.Test diff --git a/Source/Datas/H.Data.Test/Student.cs b/Source/Datas/H.Data.Test/Student.cs index ad621aa5..17c35d22 100644 --- a/Source/Datas/H.Data.Test/Student.cs +++ b/Source/Datas/H.Data.Test/Student.cs @@ -1,13 +1,12 @@ using H.Providers.Mvvm; using System; using System.Collections.Generic; -using System.ComponentModel; using System.ComponentModel.DataAnnotations; using System.Linq; namespace H.Data.Test { - public class Student :BindableBase,ICloneable + public class Student : BindableBase, ICloneable { [Display(Name = "姓名", GroupName = "基础信息")] [Required()] @@ -46,7 +45,7 @@ public class Student :BindableBase,ICloneable [RegularExpression(@"^1[3|4|5|7|8][0-9]{9}$", ErrorMessage = "手机号码不合法!")] public string Tel { get; set; } - private string _tag=string.Empty; + private string _tag = string.Empty; [Display(Name = "标签", GroupName = "基础信息")] [Required] public string Tag diff --git a/Source/Extensions/H.Extensions.ApplicationBase/ApplicationBase.Abstract.cs b/Source/Extensions/H.Extensions.ApplicationBase/ApplicationBase.Abstract.cs index 123e8950..52e81fae 100644 --- a/Source/Extensions/H.Extensions.ApplicationBase/ApplicationBase.Abstract.cs +++ b/Source/Extensions/H.Extensions.ApplicationBase/ApplicationBase.Abstract.cs @@ -6,7 +6,6 @@ using System.Linq; using System.Threading; using System.Windows; -using System.Windows.Controls; namespace H.Extensions.ApplicationBase { @@ -95,7 +94,7 @@ protected virtual void OnSplashScreen(StartupEventArgs e) }; if (presenter != null) { - bool? r = Dispatcher.Invoke(() => + bool? r = this.Dispatcher.Invoke(() => { return IocMessage.Window.ShowAction(presenter, x => { @@ -151,7 +150,7 @@ protected virtual void OnLogin(StartupEventArgs e) } { - + int sleep = 1000; var presenter = Ioc.Services.GetService(); Func func = (c, s) => @@ -166,7 +165,7 @@ protected virtual void OnLogin(StartupEventArgs e) if (s != null) s.Message = $"正在加载设置<{x.Name}>数据..."; Thread.Sleep(20); - },out string message); + }, out string message); if (r == false) s.Message = message; Thread.Sleep(sleep); @@ -201,7 +200,7 @@ protected virtual void OnLogin(StartupEventArgs e) }; if (presenter != null) { - bool? r = Dispatcher.Invoke(() => + bool? r = this.Dispatcher.Invoke(() => { return IocMessage.Window.ShowAction(presenter, x => { diff --git a/Source/Extensions/H.Extensions.ApplicationBase/ApplicationBase.cs b/Source/Extensions/H.Extensions.ApplicationBase/ApplicationBase.cs index ad1eae10..214006be 100644 --- a/Source/Extensions/H.Extensions.ApplicationBase/ApplicationBase.cs +++ b/Source/Extensions/H.Extensions.ApplicationBase/ApplicationBase.cs @@ -11,7 +11,7 @@ namespace H.Extensions.ApplicationBase { public abstract partial class ApplicationBase : Application { - public ApplicationBase() + public ApplicationBase() { this.OnExcetion(); this.OnRefreshIoc(); diff --git a/Source/Extensions/H.Extensions.Attach/Cattach.Animation.cs b/Source/Extensions/H.Extensions.Attach/Cattach.Animation.cs index a75c478a..6ce0283d 100644 --- a/Source/Extensions/H.Extensions.Attach/Cattach.Animation.cs +++ b/Source/Extensions/H.Extensions.Attach/Cattach.Animation.cs @@ -17,7 +17,7 @@ public static void SetFromDouble(DependencyObject obj, double value) obj.SetValue(FromDoubleProperty, value); } - + public static readonly DependencyProperty FromDoubleProperty = DependencyProperty.RegisterAttached("FromDouble", typeof(double), typeof(Cattach), new PropertyMetadata(default(double), OnFromDoubleChanged)); @@ -41,7 +41,7 @@ public static void SetToDouble(DependencyObject obj, double value) obj.SetValue(ToDoubleProperty, value); } - + public static readonly DependencyProperty ToDoubleProperty = DependencyProperty.RegisterAttached("ToDouble", typeof(double), typeof(Cattach), new PropertyMetadata(default(double), OnToDoubleChanged)); diff --git a/Source/Extensions/H.Extensions.Attach/Cattach.Attach.cs b/Source/Extensions/H.Extensions.Attach/Cattach.Attach.cs index 70750a82..78068894 100644 --- a/Source/Extensions/H.Extensions.Attach/Cattach.Attach.cs +++ b/Source/Extensions/H.Extensions.Attach/Cattach.Attach.cs @@ -240,7 +240,7 @@ public static void SetAttachDock(DependencyObject obj, Dock value) obj.SetValue(AttachDockProperty, value); } - + public static readonly DependencyProperty AttachDockProperty = DependencyProperty.RegisterAttached("AttachDock", typeof(Dock), typeof(Cattach), new PropertyMetadata(default(Dock), OnAttachDockChanged)); diff --git a/Source/Extensions/H.Extensions.Attach/Cattach.Caption.cs b/Source/Extensions/H.Extensions.Attach/Cattach.Caption.cs index e725cc97..5de090bf 100644 --- a/Source/Extensions/H.Extensions.Attach/Cattach.Caption.cs +++ b/Source/Extensions/H.Extensions.Attach/Cattach.Caption.cs @@ -20,7 +20,7 @@ public static void SetCaptionCornerRadius(DependencyObject obj, CornerRadius val obj.SetValue(CaptionCornerRadiusProperty, value); } - + public static readonly DependencyProperty CaptionCornerRadiusProperty = DependencyProperty.RegisterAttached("CaptionCornerRadius", typeof(CornerRadius), typeof(Cattach), new FrameworkPropertyMetadata(default(CornerRadius), FrameworkPropertyMetadataOptions.Inherits, OnCaptionCornerRadiusChanged)); @@ -44,7 +44,7 @@ public static void SetCaptionBackground(DependencyObject obj, Brush value) obj.SetValue(CaptionBackgroundProperty, value); } - + public static readonly DependencyProperty CaptionBackgroundProperty = DependencyProperty.RegisterAttached("CaptionBackground", typeof(Brush), typeof(Cattach), new FrameworkPropertyMetadata(default(Brush), FrameworkPropertyMetadataOptions.Inherits, OnCaptionBackgroundChanged)); @@ -68,7 +68,7 @@ public static void SetCaptionForeground(DependencyObject obj, Brush value) obj.SetValue(CaptionForegroundProperty, value); } - + public static readonly DependencyProperty CaptionForegroundProperty = DependencyProperty.RegisterAttached("CaptionForeground", typeof(Brush), typeof(Cattach), new FrameworkPropertyMetadata(default(Brush), FrameworkPropertyMetadataOptions.Inherits, OnCaptionForegroundChanged)); @@ -92,7 +92,7 @@ public static void SetCaptionBorderBrush(DependencyObject obj, Brush value) obj.SetValue(CaptionBorderBrushProperty, value); } - + public static readonly DependencyProperty CaptionBorderBrushProperty = DependencyProperty.RegisterAttached("CaptionBorderBrush", typeof(Brush), typeof(Cattach), new FrameworkPropertyMetadata(default(Brush), FrameworkPropertyMetadataOptions.Inherits, OnCaptionBorderBrushChanged)); @@ -116,7 +116,7 @@ public static void SetCaptionHeight(DependencyObject obj, double value) obj.SetValue(CaptionHeightProperty, value); } - + public static readonly DependencyProperty CaptionHeightProperty = DependencyProperty.RegisterAttached("CaptionHeight", typeof(double), typeof(Cattach), new FrameworkPropertyMetadata(default(double), FrameworkPropertyMetadataOptions.Inherits, OnCaptionHeightChanged)); @@ -140,7 +140,7 @@ public static void SetCaptionBorderThickness(DependencyObject obj, Thickness val obj.SetValue(CaptionBorderThicknessProperty, value); } - + public static readonly DependencyProperty CaptionBorderThicknessProperty = DependencyProperty.RegisterAttached("CaptionBorderThickness", typeof(Thickness), typeof(Cattach), new FrameworkPropertyMetadata(default(Thickness), FrameworkPropertyMetadataOptions.Inherits, OnCaptionBorderThicknessChanged)); @@ -164,7 +164,7 @@ public static void SetCaptionHorizontalAlignment(DependencyObject obj, Horizonta obj.SetValue(CaptionHorizontalAlignmentProperty, value); } - + public static readonly DependencyProperty CaptionHorizontalAlignmentProperty = DependencyProperty.RegisterAttached("CaptionHorizontalAlignment", typeof(HorizontalAlignment), typeof(Cattach), new PropertyMetadata(default(HorizontalAlignment), OnCaptionHorizontalAlignmentChanged)); @@ -188,7 +188,7 @@ public static void SetCaptionVerticalAlignment(DependencyObject obj, VerticalAli obj.SetValue(CaptionVerticalAlignmentProperty, value); } - + public static readonly DependencyProperty CaptionVerticalAlignmentProperty = DependencyProperty.RegisterAttached("CaptionVerticalAlignment", typeof(VerticalAlignment), typeof(Cattach), new PropertyMetadata(default(VerticalAlignment), OnCaptionVerticalAlignmentChanged)); @@ -212,7 +212,7 @@ public static void SetCaptionMargin(DependencyObject obj, Thickness value) obj.SetValue(CaptionMarginProperty, value); } - + public static readonly DependencyProperty CaptionMarginProperty = DependencyProperty.RegisterAttached("CaptionMargin", typeof(Thickness), typeof(Cattach), new PropertyMetadata(default(Thickness), OnCaptionMarginChanged)); @@ -236,7 +236,7 @@ public static void SetCaptionFontSize(DependencyObject obj, double value) obj.SetValue(CaptionFontSizeProperty, value); } - + public static readonly DependencyProperty CaptionFontSizeProperty = DependencyProperty.RegisterAttached("CaptionFontSize", typeof(double), typeof(Cattach), new PropertyMetadata(15.0, OnCaptionFontSizeChanged)); @@ -260,7 +260,7 @@ public static void SetCaptionLeftTemplate(DependencyObject obj, ControlTemplate obj.SetValue(CaptionLeftTemplateProperty, value); } - + public static readonly DependencyProperty CaptionLeftTemplateProperty = DependencyProperty.RegisterAttached("CaptionLeftTemplate", typeof(ControlTemplate), typeof(Cattach), new PropertyMetadata(default(ControlTemplate), OnCaptionLeftTemplateChanged)); @@ -284,7 +284,7 @@ public static void SetCaptionRightTemplate(DependencyObject obj, ControlTemplate obj.SetValue(CaptionRightTemplateProperty, value); } - + public static readonly DependencyProperty CaptionRightTemplateProperty = DependencyProperty.RegisterAttached("CaptionRightTemplate", typeof(ControlTemplate), typeof(Cattach), new PropertyMetadata(default(ControlTemplate), OnCaptionRightTemplateChanged)); @@ -308,7 +308,7 @@ public static void SetCaptionCenterTemplate(DependencyObject obj, ControlTemplat obj.SetValue(CaptionCenterTemplateProperty, value); } - + public static readonly DependencyProperty CaptionCenterTemplateProperty = DependencyProperty.RegisterAttached("CaptionCenterTemplate", typeof(ControlTemplate), typeof(Cattach), new PropertyMetadata(default(ControlTemplate), OnCaptionCenterTemplateChanged)); diff --git a/Source/Extensions/H.Extensions.Attach/Cattach.Check.cs b/Source/Extensions/H.Extensions.Attach/Cattach.Check.cs index 8aaeb443..52c89e0f 100644 --- a/Source/Extensions/H.Extensions.Attach/Cattach.Check.cs +++ b/Source/Extensions/H.Extensions.Attach/Cattach.Check.cs @@ -18,7 +18,7 @@ public static void SetIsChecked(DependencyObject obj, bool? value) obj.SetValue(IsCheckedProperty, value); } - + public static readonly DependencyProperty IsCheckedProperty = DependencyProperty.RegisterAttached("IsChecked", typeof(bool?), typeof(Cattach), new PropertyMetadata(default(bool?), OnIsCheckedChanged)); @@ -42,7 +42,7 @@ public static void SetCheckedIcon(DependencyObject obj, string value) obj.SetValue(CheckedIconProperty, value); } - + public static readonly DependencyProperty CheckedIconProperty = DependencyProperty.RegisterAttached("CheckedIcon", typeof(string), typeof(Cattach), new PropertyMetadata(default(string), OnCheckedIconChanged)); @@ -66,7 +66,7 @@ public static void SetUncheckedIcon(DependencyObject obj, string value) obj.SetValue(UncheckedIconProperty, value); } - + public static readonly DependencyProperty UncheckedIconProperty = DependencyProperty.RegisterAttached("UncheckedIcon", typeof(string), typeof(Cattach), new PropertyMetadata(default(string), OnUncheckedIconChanged)); @@ -114,7 +114,7 @@ public static void SetCheckedText(DependencyObject obj, string value) obj.SetValue(CheckedTextProperty, value); } - + public static readonly DependencyProperty CheckedTextProperty = DependencyProperty.RegisterAttached("CheckedText", typeof(string), typeof(Cattach), new PropertyMetadata(default(string), OnCheckedTextChanged)); @@ -138,7 +138,7 @@ public static void SetUncheckedText(DependencyObject obj, string value) obj.SetValue(UncheckedTextProperty, value); } - + public static readonly DependencyProperty UncheckedTextProperty = DependencyProperty.RegisterAttached("UncheckedText", typeof(string), typeof(Cattach), new PropertyMetadata(default(string), OnUncheckedTextChanged)); @@ -188,7 +188,7 @@ public static void SetCheckedForeground(DependencyObject obj, Brush value) obj.SetValue(CheckedForegroundProperty, value); } - + public static readonly DependencyProperty CheckedForegroundProperty = DependencyProperty.RegisterAttached("CheckedForeground", typeof(Brush), typeof(Cattach), new PropertyMetadata(default(Brush), OnCheckedForegroundChanged)); @@ -211,7 +211,7 @@ public static void SetUncheckForeground(DependencyObject obj, Brush value) obj.SetValue(UncheckForegroundProperty, value); } - + public static readonly DependencyProperty UncheckForegroundProperty = DependencyProperty.RegisterAttached("UncheckForeground", typeof(Brush), typeof(Cattach), new PropertyMetadata(default(Brush), OnUncheckForegroundChanged)); @@ -259,7 +259,7 @@ public static void SetCheckedBackground(DependencyObject obj, Brush value) obj.SetValue(CheckedBackgroundProperty, value); } - + public static readonly DependencyProperty CheckedBackgroundProperty = DependencyProperty.RegisterAttached("CheckedBackground", typeof(Brush), typeof(Cattach), new PropertyMetadata(default(Brush), OnCheckedBackgroundChanged)); @@ -283,7 +283,7 @@ public static void SetUncheckedBackground(DependencyObject obj, Brush value) obj.SetValue(UncheckedBackgroundProperty, value); } - + public static readonly DependencyProperty UncheckedBackgroundProperty = DependencyProperty.RegisterAttached("UncheckedBackground", typeof(Brush), typeof(Cattach), new PropertyMetadata(default(Brush), OnUncheckedBackgroundChanged)); @@ -331,7 +331,7 @@ public static void SetCheckedBorderBrush(DependencyObject obj, Brush value) obj.SetValue(CheckedBorderBrushProperty, value); } - + public static readonly DependencyProperty CheckedBorderBrushProperty = DependencyProperty.RegisterAttached("CheckedBorderBrush", typeof(Brush), typeof(Cattach), new PropertyMetadata(default(Brush), OnCheckedBorderBrushChanged)); @@ -355,7 +355,7 @@ public static void SetUnCheckedBorderBrush(DependencyObject obj, Brush value) obj.SetValue(UnCheckedBorderBrushProperty, value); } - + public static readonly DependencyProperty UnCheckedBorderBrushProperty = DependencyProperty.RegisterAttached("UnCheckedBorderBrush", typeof(Brush), typeof(Cattach), new PropertyMetadata(default(Brush), OnUnCheckedBorderBrushChanged)); @@ -403,7 +403,7 @@ public static void SetCheckedBorderThickness(DependencyObject obj, Thickness val obj.SetValue(CheckedBorderThicknessProperty, value); } - + public static readonly DependencyProperty CheckedBorderThicknessProperty = DependencyProperty.RegisterAttached("CheckedBorderThickness", typeof(Thickness), typeof(Cattach), new PropertyMetadata(default(Thickness), OnCheckedBorderThicknessChanged)); @@ -427,7 +427,7 @@ public static void SetUnCheckedBorderThickness(DependencyObject obj, Thickness v obj.SetValue(UnCheckedBorderThicknessProperty, value); } - + public static readonly DependencyProperty UnCheckedBorderThicknessProperty = DependencyProperty.RegisterAttached("UnCheckedBorderThickness", typeof(Thickness), typeof(Cattach), new PropertyMetadata(default(Thickness), OnUnCheckedBorderThicknessChanged)); @@ -475,7 +475,7 @@ public static void SetCheckedOpacity(DependencyObject obj, double value) obj.SetValue(CheckedOpacityProperty, value); } - + public static readonly DependencyProperty CheckedOpacityProperty = DependencyProperty.RegisterAttached("CheckedOpacity", typeof(double), typeof(Cattach), new PropertyMetadata(1.0, OnCheckedOpacityChanged)); @@ -499,7 +499,7 @@ public static void SetUncheckedOpacity(DependencyObject obj, double value) obj.SetValue(UncheckedOpacityProperty, value); } - + public static readonly DependencyProperty UncheckedOpacityProperty = DependencyProperty.RegisterAttached("UncheckedOpacity", typeof(double), typeof(Cattach), new PropertyMetadata(1.0, OnUncheckedOpacityChanged)); diff --git a/Source/Extensions/H.Extensions.Attach/Cattach.Dock.cs b/Source/Extensions/H.Extensions.Attach/Cattach.Dock.cs index 9b8b12dc..9562b8e2 100644 --- a/Source/Extensions/H.Extensions.Attach/Cattach.Dock.cs +++ b/Source/Extensions/H.Extensions.Attach/Cattach.Dock.cs @@ -17,7 +17,7 @@ public static void SetBottomTemplate(DependencyObject obj, ControlTemplate value obj.SetValue(BottomTemplateProperty, value); } - + public static readonly DependencyProperty BottomTemplateProperty = DependencyProperty.RegisterAttached("BottomTemplate", typeof(ControlTemplate), typeof(Cattach), new PropertyMetadata(default(ControlTemplate), OnBottomTemplateChanged)); @@ -40,7 +40,7 @@ public static void SetTopTemplate(DependencyObject obj, ControlTemplate value) obj.SetValue(TopTemplateProperty, value); } - + public static readonly DependencyProperty TopTemplateProperty = DependencyProperty.RegisterAttached("TopTemplate", typeof(ControlTemplate), typeof(Cattach), new PropertyMetadata(default(ControlTemplate), OnTopTemplateChanged)); @@ -63,7 +63,7 @@ public static void SetLeftTemplate(DependencyObject obj, ControlTemplate value) obj.SetValue(LeftTemplateProperty, value); } - + public static readonly DependencyProperty LeftTemplateProperty = DependencyProperty.RegisterAttached("LeftTemplate", typeof(ControlTemplate), typeof(Cattach), new PropertyMetadata(default(ControlTemplate), OnLeftTemplateChanged)); @@ -86,7 +86,7 @@ public static void SetRightTemplate(DependencyObject obj, ControlTemplate value) obj.SetValue(RightTemplateProperty, value); } - + public static readonly DependencyProperty RightTemplateProperty = DependencyProperty.RegisterAttached("RightTemplate", typeof(ControlTemplate), typeof(Cattach), new PropertyMetadata(default(ControlTemplate), OnRightTemplateChanged)); @@ -110,7 +110,7 @@ public static void SetCenterTemplate(DependencyObject obj, ControlTemplate value obj.SetValue(CenterTemplateProperty, value); } - + public static readonly DependencyProperty CenterTemplateProperty = DependencyProperty.RegisterAttached("CenterTemplate", typeof(ControlTemplate), typeof(Cattach), new PropertyMetadata(default(ControlTemplate), OnCenterTemplateChanged)); diff --git a/Source/Extensions/H.Extensions.Attach/Cattach.Except.cs b/Source/Extensions/H.Extensions.Attach/Cattach.Except.cs index 32cbb641..3305bbea 100644 --- a/Source/Extensions/H.Extensions.Attach/Cattach.Except.cs +++ b/Source/Extensions/H.Extensions.Attach/Cattach.Except.cs @@ -16,7 +16,7 @@ public static void SetIsExceptSelf(DependencyObject obj, bool value) obj.SetValue(IsExceptSelfProperty, value); } - + public static readonly DependencyProperty IsExceptSelfProperty = DependencyProperty.RegisterAttached("IsExceptSelf", typeof(bool), typeof(Cattach), new PropertyMetadata(false, OnIsExceptSelfChanged)); @@ -40,7 +40,7 @@ public static void SetIsExcepChildren(DependencyObject obj, bool value) obj.SetValue(IsExcepChildrenProperty, value); } - + public static readonly DependencyProperty IsExcepChildrenProperty = DependencyProperty.RegisterAttached("IsExcepChildren", typeof(bool), typeof(Cattach), new PropertyMetadata(false, OnIsExcepChildrenChanged)); diff --git a/Source/Extensions/H.Extensions.Attach/Cattach.Focus.cs b/Source/Extensions/H.Extensions.Attach/Cattach.Focus.cs index e615de8c..afc62d73 100644 --- a/Source/Extensions/H.Extensions.Attach/Cattach.Focus.cs +++ b/Source/Extensions/H.Extensions.Attach/Cattach.Focus.cs @@ -29,7 +29,7 @@ public static void SetFocusBorderThickness(DependencyObject obj, Thickness value obj.SetValue(FocusBorderThicknessProperty, value); } - + public static readonly DependencyProperty FocusBorderThicknessProperty = DependencyProperty.RegisterAttached("FocusBorderThickness", typeof(Thickness), typeof(Cattach), new FrameworkPropertyMetadata(new Thickness(1), OnFocusBorderThicknessChanged)); diff --git a/Source/Extensions/H.Extensions.Attach/Cattach.Guide.cs b/Source/Extensions/H.Extensions.Attach/Cattach.Guide.cs index 2edd11b3..e472480d 100644 --- a/Source/Extensions/H.Extensions.Attach/Cattach.Guide.cs +++ b/Source/Extensions/H.Extensions.Attach/Cattach.Guide.cs @@ -19,7 +19,7 @@ public static void SetUseGuide(DependencyObject obj, bool value) obj.SetValue(UseGuideProperty, value); } - + public static readonly DependencyProperty UseGuideProperty = DependencyProperty.RegisterAttached("UseGuide", typeof(bool), typeof(Cattach), new PropertyMetadata(false, OnUseGuideChanged)); @@ -40,7 +40,7 @@ public static void SetGuideTitle(DependencyObject obj, object value) obj.SetValue(GuideTitleProperty, value); } - + public static readonly DependencyProperty GuideTitleProperty = DependencyProperty.RegisterAttached("GuideTitle", typeof(object), typeof(Cattach), new PropertyMetadata(null, OnGuideTitleChanged)); @@ -64,7 +64,7 @@ public static void SetGuideParentTitle(DependencyObject obj, string value) obj.SetValue(GuideParentTitleProperty, value); } - + public static readonly DependencyProperty GuideParentTitleProperty = DependencyProperty.RegisterAttached("GuideParentTitle", typeof(string), typeof(Cattach), new PropertyMetadata(null, OnGuideParentTitleChanged)); @@ -88,7 +88,7 @@ public static void SetGuideData(DependencyObject obj, object value) obj.SetValue(GuideDataProperty, value); } - + public static readonly DependencyProperty GuideDataProperty = DependencyProperty.RegisterAttached("GuideData", typeof(object), typeof(Cattach), new PropertyMetadata(null, OnGuideDataChanged)); @@ -112,7 +112,7 @@ public static void SetGuideDataTemplate(DependencyObject obj, DataTemplate value obj.SetValue(GuideDataTemplateProperty, value); } - + public static readonly DependencyProperty GuideDataTemplateProperty = DependencyProperty.RegisterAttached("GuideDataTemplate", typeof(DataTemplate), typeof(Cattach), new PropertyMetadata(null, OnGuideDataTemplateChanged)); @@ -136,7 +136,7 @@ public static void SetIsGuide(DependencyObject obj, bool value) obj.SetValue(IsGuideProperty, value); } - + public static readonly DependencyProperty IsGuideProperty = DependencyProperty.RegisterAttached("IsGuide", typeof(bool), typeof(Cattach), new FrameworkPropertyMetadata(false, FrameworkPropertyMetadataOptions.BindsTwoWayByDefault, OnIsGuideChanged)); @@ -159,7 +159,7 @@ public static void SetGuideUseClick(DependencyObject obj, bool value) obj.SetValue(GuideUseClickProperty, value); } - + public static readonly DependencyProperty GuideUseClickProperty = DependencyProperty.RegisterAttached("GuideUseClick", typeof(bool), typeof(Cattach), new PropertyMetadata(false, OnGuideUseClickChanged)); diff --git a/Source/Extensions/H.Extensions.Attach/Cattach.Icon.cs b/Source/Extensions/H.Extensions.Attach/Cattach.Icon.cs index a285d2e3..08459ce9 100644 --- a/Source/Extensions/H.Extensions.Attach/Cattach.Icon.cs +++ b/Source/Extensions/H.Extensions.Attach/Cattach.Icon.cs @@ -17,7 +17,7 @@ public static void SetOpacity(DependencyObject obj, double value) obj.SetValue(OpacityProperty, value); } - + public static readonly DependencyProperty OpacityProperty = DependencyProperty.RegisterAttached("Opacity", typeof(double), typeof(Cattach), new PropertyMetadata(1.0, OnOpacityChanged)); @@ -93,7 +93,7 @@ public static void SetIconForeground(DependencyObject obj, Brush value) obj.SetValue(IconForegroundProperty, value); } - + public static readonly DependencyProperty IconForegroundProperty = DependencyProperty.RegisterAttached("IconForeground", typeof(Brush), typeof(Cattach), new PropertyMetadata(default(Brush), OnIconForegroundChanged)); diff --git a/Source/Extensions/H.Extensions.Attach/Cattach.Item.cs b/Source/Extensions/H.Extensions.Attach/Cattach.Item.cs index 315d724f..ea29124b 100644 --- a/Source/Extensions/H.Extensions.Attach/Cattach.Item.cs +++ b/Source/Extensions/H.Extensions.Attach/Cattach.Item.cs @@ -133,7 +133,7 @@ public static void SetItemBorderThickness(DependencyObject obj, Thickness value) obj.SetValue(ItemBorderThicknessProperty, value); } - + public static readonly DependencyProperty ItemBorderThicknessProperty = DependencyProperty.RegisterAttached("ItemBorderThickness", typeof(Thickness), typeof(Cattach), new FrameworkPropertyMetadata(default(Thickness), FrameworkPropertyMetadataOptions.Inherits, OnItemBorderThicknessChanged)); @@ -157,7 +157,7 @@ public static void SetItemHorizontalAlignment(DependencyObject obj, HorizontalAl obj.SetValue(ItemHorizontalAlignmentProperty, value); } - + public static readonly DependencyProperty ItemHorizontalAlignmentProperty = DependencyProperty.RegisterAttached("ItemHorizontalAlignment", typeof(HorizontalAlignment), typeof(Cattach), new PropertyMetadata(default(HorizontalAlignment), OnItemHorizontalAlignmentChanged)); @@ -181,7 +181,7 @@ public static void SetItemVerticalAlignment(DependencyObject obj, VerticalAlignm obj.SetValue(ItemVerticalAlignmentProperty, value); } - + public static readonly DependencyProperty ItemVerticalAlignmentProperty = DependencyProperty.RegisterAttached("ItemVerticalAlignment", typeof(VerticalAlignment), typeof(Cattach), new PropertyMetadata(default(VerticalAlignment), OnItemVerticalAlignmentChanged)); @@ -207,7 +207,7 @@ public static void SetItemMinHeight(DependencyObject obj, double value) obj.SetValue(ItemMinHeightProperty, value); } - + public static readonly DependencyProperty ItemMinHeightProperty = DependencyProperty.RegisterAttached("ItemMinHeight", typeof(double), typeof(Cattach), new PropertyMetadata(default(double), OnItemMinHeightChanged)); @@ -232,7 +232,7 @@ public static void SetItemMinWidth(DependencyObject obj, double value) obj.SetValue(ItemMinWidthProperty, value); } - + public static readonly DependencyProperty ItemMinWidthProperty = DependencyProperty.RegisterAttached("ItemMinWidth", typeof(double), typeof(Cattach), new PropertyMetadata(default(double), OnItemMinWidthChanged)); @@ -256,7 +256,7 @@ public static void SetItemMargin(DependencyObject obj, Thickness value) obj.SetValue(ItemMarginProperty, value); } - + public static readonly DependencyProperty ItemMarginProperty = DependencyProperty.RegisterAttached("ItemMargin", typeof(Thickness), typeof(Cattach), new PropertyMetadata(default(Thickness), OnItemMarginChanged)); @@ -280,7 +280,7 @@ public static void SetItemPadding(DependencyObject obj, Thickness value) obj.SetValue(ItemPaddingProperty, value); } - + public static readonly DependencyProperty ItemPaddingProperty = DependencyProperty.RegisterAttached("ItemPadding", typeof(Thickness), typeof(Cattach), new PropertyMetadata(default(Thickness), OnItemPaddingChanged)); @@ -304,7 +304,7 @@ public static void SetItemHorizontalContentAlignment(DependencyObject obj, Horiz obj.SetValue(ItemHorizontalContentAlignmentProperty, value); } - + public static readonly DependencyProperty ItemHorizontalContentAlignmentProperty = DependencyProperty.RegisterAttached("ItemHorizontalContentAlignment", typeof(HorizontalAlignment), typeof(Cattach), new PropertyMetadata(default(HorizontalAlignment), OnItemHorizontalContentAlignmentChanged)); @@ -328,7 +328,7 @@ public static void SetItemVerticalContentAlignment(DependencyObject obj, Vertica obj.SetValue(ItemVerticalContentAlignmentProperty, value); } - + public static readonly DependencyProperty ItemVerticalContentAlignmentProperty = DependencyProperty.RegisterAttached("ItemVerticalContentAlignment", typeof(VerticalAlignment), typeof(Cattach), new PropertyMetadata(default(VerticalAlignment), OnItemVerticalContentAlignmentChanged)); @@ -351,7 +351,7 @@ public static void SetItemOverTemplate(DependencyObject obj, ControlTemplate val obj.SetValue(ItemOverTemplateProperty, value); } - + public static readonly DependencyProperty ItemOverTemplateProperty = DependencyProperty.RegisterAttached("ItemOverTemplate", typeof(ControlTemplate), typeof(Cattach), new PropertyMetadata(default(ControlTemplate), OnItemOverTemplateChanged)); @@ -375,7 +375,7 @@ public static void SetItemsContianerWidth(DependencyObject obj, double value) obj.SetValue(ItemsContianerWidthProperty, value); } - + public static readonly DependencyProperty ItemsContianerWidthProperty = DependencyProperty.RegisterAttached("ItemsContianerWidth", typeof(double), typeof(Cattach), new PropertyMetadata(default(double), OnItemsContianerWidthChanged)); @@ -399,7 +399,7 @@ public static void SetSelectedItemTemplate(DependencyObject obj, DataTemplate va obj.SetValue(SelectedItemTemplateProperty, value); } - + public static readonly DependencyProperty SelectedItemTemplateProperty = DependencyProperty.RegisterAttached("SelectedItemTemplate", typeof(DataTemplate), typeof(Cattach), new PropertyMetadata(default(DataTemplate), OnSelectedItemTemplateChanged)); diff --git a/Source/Extensions/H.Extensions.Attach/Cattach.ItemsControl.cs b/Source/Extensions/H.Extensions.Attach/Cattach.ItemsControl.cs index dd2a6f0c..52e490e6 100644 --- a/Source/Extensions/H.Extensions.Attach/Cattach.ItemsControl.cs +++ b/Source/Extensions/H.Extensions.Attach/Cattach.ItemsControl.cs @@ -19,7 +19,7 @@ public static void SetInnerSource(DependencyObject obj, IEnumerable value) obj.SetValue(InnerSourceProperty, value); } - + public static readonly DependencyProperty InnerSourceProperty = DependencyProperty.RegisterAttached("InnerSource", typeof(IEnumerable), typeof(ItemsControlService), new PropertyMetadata(default(IEnumerable), OnInnerSourceChanged)); @@ -45,7 +45,7 @@ public static void SetTools(DependencyObject obj, object value) obj.SetValue(ToolsProperty, value); } - + public static readonly DependencyProperty ToolsProperty = DependencyProperty.RegisterAttached("Tools", typeof(object), typeof(ItemsControlService), new PropertyMetadata(default(object), OnToolsChanged)); @@ -71,7 +71,7 @@ public static void SetHomeTool(DependencyObject obj, ControlTemplate value) obj.SetValue(HomeToolProperty, value); } - + public static readonly DependencyProperty HomeToolProperty = DependencyProperty.RegisterAttached("HomeTool", typeof(ControlTemplate), typeof(ItemsControlService), new PropertyMetadata(null, OnHomeToolChanged)); @@ -94,7 +94,7 @@ public static void SetEndTool(DependencyObject obj, ControlTemplate value) obj.SetValue(EndToolProperty, value); } - + public static readonly DependencyProperty EndToolProperty = DependencyProperty.RegisterAttached("EndTool", typeof(ControlTemplate), typeof(ItemsControlService), new PropertyMetadata(null, OnEndToolChanged)); diff --git a/Source/Extensions/H.Extensions.Attach/Cattach.NewGuide.cs b/Source/Extensions/H.Extensions.Attach/Cattach.NewGuide.cs index 7eb5da83..6cbf7817 100644 --- a/Source/Extensions/H.Extensions.Attach/Cattach.NewGuide.cs +++ b/Source/Extensions/H.Extensions.Attach/Cattach.NewGuide.cs @@ -19,7 +19,7 @@ public static void SetUseNewGuide(DependencyObject obj, bool value) obj.SetValue(UseNewGuideProperty, value); } - + public static readonly DependencyProperty UseNewGuideProperty = DependencyProperty.RegisterAttached("UseNewGuide", typeof(bool), typeof(Cattach), new PropertyMetadata(false, OnUseNewGuideChanged)); @@ -41,7 +41,7 @@ public static void SetNewGuideTitle(DependencyObject obj, object value) obj.SetValue(NewGuideTitleProperty, value); } - + public static readonly DependencyProperty NewGuideTitleProperty = DependencyProperty.RegisterAttached("NewGuideTitle", typeof(object), typeof(Cattach), new PropertyMetadata(null, OnNewGuideTitleChanged)); @@ -65,7 +65,7 @@ public static void SetNewGuideParentTitle(DependencyObject obj, string value) obj.SetValue(NewGuideParentTitleProperty, value); } - + public static readonly DependencyProperty NewGuideParentTitleProperty = DependencyProperty.RegisterAttached("NewGuideParentTitle", typeof(string), typeof(Cattach), new PropertyMetadata(null, OnNewGuideParentTitleChanged)); @@ -89,7 +89,7 @@ public static void SetNewGuideData(DependencyObject obj, object value) obj.SetValue(NewGuideDataProperty, value); } - + public static readonly DependencyProperty NewGuideDataProperty = DependencyProperty.RegisterAttached("NewGuideData", typeof(object), typeof(Cattach), new PropertyMetadata(null, OnNewGuideDataChanged)); @@ -113,7 +113,7 @@ public static void SetNewGuideDataTemplate(DependencyObject obj, DataTemplate va obj.SetValue(NewGuideDataTemplateProperty, value); } - + public static readonly DependencyProperty NewGuideDataTemplateProperty = DependencyProperty.RegisterAttached("NewGuideDataTemplate", typeof(DataTemplate), typeof(Cattach), new PropertyMetadata(null, OnNewGuideDataTemplateChanged)); diff --git a/Source/Extensions/H.Extensions.Attach/Cattach.Search.cs b/Source/Extensions/H.Extensions.Attach/Cattach.Search.cs index 8ac5e38c..17cdc853 100644 --- a/Source/Extensions/H.Extensions.Attach/Cattach.Search.cs +++ b/Source/Extensions/H.Extensions.Attach/Cattach.Search.cs @@ -19,7 +19,7 @@ public static void SetUseSearch(DependencyObject obj, bool value) obj.SetValue(UseSearchProperty, value); } - + public static readonly DependencyProperty UseSearchProperty = DependencyProperty.RegisterAttached("UseSearch", typeof(bool), typeof(Cattach), new FrameworkPropertyMetadata(false, OnUseSearchChanged)); @@ -43,7 +43,7 @@ public static void SetSearchWidth(DependencyObject obj, double value) obj.SetValue(SearchWidthProperty, value); } - + public static readonly DependencyProperty SearchWidthProperty = DependencyProperty.RegisterAttached("SearchWidth", typeof(double), typeof(Cattach), new FrameworkPropertyMetadata(default(double), OnSearchWidthChanged)); @@ -67,7 +67,7 @@ public static void SetSearchDock(DependencyObject obj, Dock value) obj.SetValue(SearchDockProperty, value); } - + public static readonly DependencyProperty SearchDockProperty = DependencyProperty.RegisterAttached("SearchDock", typeof(Dock), typeof(Cattach), new FrameworkPropertyMetadata(Dock.Right, OnSearchDockChanged)); @@ -91,7 +91,7 @@ public static void SetSearchUseHistory(DependencyObject obj, bool value) obj.SetValue(SearchUseHistoryProperty, value); } - + public static readonly DependencyProperty SearchUseHistoryProperty = DependencyProperty.RegisterAttached("SearchUseHistory", typeof(bool), typeof(Cattach), new FrameworkPropertyMetadata(false, OnSearchUseHistoryChanged)); @@ -115,7 +115,7 @@ public static void SetSearchHeight(DependencyObject obj, double value) obj.SetValue(SearchHeightProperty, value); } - + public static readonly DependencyProperty SearchHeightProperty = DependencyProperty.RegisterAttached("SearchHeight", typeof(double), typeof(Cattach), new PropertyMetadata(default(double), OnSearchHeightChanged)); @@ -139,7 +139,7 @@ public static void SetSearchVerticalAlignment(DependencyObject obj, VerticalAlig obj.SetValue(SearchVerticalAlignmentProperty, value); } - + public static readonly DependencyProperty SearchVerticalAlignmentProperty = DependencyProperty.RegisterAttached("SearchVerticalAlignment", typeof(VerticalAlignment), typeof(Cattach), new PropertyMetadata(default(VerticalAlignment), OnSearchVerticalAlignmentChanged)); @@ -163,7 +163,7 @@ public static void SetSearchHorizontalAlignment(DependencyObject obj, Horizontal obj.SetValue(SearchHorizontalAlignmentProperty, value); } - + public static readonly DependencyProperty SearchHorizontalAlignmentProperty = DependencyProperty.RegisterAttached("SearchHorizontalAlignment", typeof(HorizontalAlignment), typeof(Cattach), new PropertyMetadata(default(HorizontalAlignment), OnSearchHorizontalAlignmentChanged)); @@ -187,7 +187,7 @@ public static void SetSearchMargin(DependencyObject obj, Thickness value) obj.SetValue(SearchMarginProperty, value); } - + public static readonly DependencyProperty SearchMarginProperty = DependencyProperty.RegisterAttached("SearchMargin", typeof(Thickness), typeof(Cattach), new PropertyMetadata(default(Thickness), OnSearchMarginChanged)); @@ -211,7 +211,7 @@ public static void SetSearchText(DependencyObject obj, string value) obj.SetValue(SearchTextProperty, value); } - + public static readonly DependencyProperty SearchTextProperty = DependencyProperty.RegisterAttached("SearchText", typeof(string), typeof(Cattach), new PropertyMetadata(default(string), OnSearchTextChanged)); diff --git a/Source/Extensions/H.Extensions.Attach/Cattach.Select.cs b/Source/Extensions/H.Extensions.Attach/Cattach.Select.cs index 9cf2634b..f80402ed 100644 --- a/Source/Extensions/H.Extensions.Attach/Cattach.Select.cs +++ b/Source/Extensions/H.Extensions.Attach/Cattach.Select.cs @@ -53,7 +53,7 @@ public static void SetSelectBorderThickness(DependencyObject obj, Thickness valu obj.SetValue(SelectBorderThicknessProperty, value); } - + public static readonly DependencyProperty SelectBorderThicknessProperty = DependencyProperty.RegisterAttached("SelectBorderThickness", typeof(Thickness), typeof(Cattach), new FrameworkPropertyMetadata(default(Thickness), OnSelectBorderThicknessChanged)); @@ -76,7 +76,7 @@ public static void SetSelectEffect(DependencyObject obj, Effect value) obj.SetValue(SelectEffectProperty, value); } - + public static readonly DependencyProperty SelectEffectProperty = DependencyProperty.RegisterAttached("SelectEffect", typeof(Effect), typeof(Cattach), new FrameworkPropertyMetadata(default(Effect), FrameworkPropertyMetadataOptions.Inherits, OnSelectEffectChanged)); diff --git a/Source/Extensions/H.Extensions.Attach/Cattach.Title.cs b/Source/Extensions/H.Extensions.Attach/Cattach.Title.cs index 09f8c72f..5a382564 100644 --- a/Source/Extensions/H.Extensions.Attach/Cattach.Title.cs +++ b/Source/Extensions/H.Extensions.Attach/Cattach.Title.cs @@ -115,7 +115,7 @@ public static void SetTitleMinWidth(DependencyObject obj, double value) obj.SetValue(TitleMinWidthProperty, value); } - + public static readonly DependencyProperty TitleMinWidthProperty = DependencyProperty.RegisterAttached("TitleMinWidth", typeof(double), typeof(Cattach), new PropertyMetadata(default(double), OnTitleMinWidthChanged)); @@ -289,7 +289,7 @@ public static void SetTitleFontSize(DependencyObject obj, double value) obj.SetValue(TitleFontSizeProperty, value); } - + public static readonly DependencyProperty TitleFontSizeProperty = DependencyProperty.RegisterAttached("TitleFontSize", typeof(double), typeof(Cattach), new PropertyMetadata(0.0, OnTitleFontSizeChanged)); diff --git a/Source/Extensions/H.Extensions.Attach/Cattach.cs b/Source/Extensions/H.Extensions.Attach/Cattach.cs index 56cbf5ae..8481a6d7 100644 --- a/Source/Extensions/H.Extensions.Attach/Cattach.cs +++ b/Source/Extensions/H.Extensions.Attach/Cattach.cs @@ -871,7 +871,7 @@ public static void SetDateTimeFormat(DependencyObject obj, string value) obj.SetValue(DateTimeFormatProperty, value); } - + public static readonly DependencyProperty DateTimeFormatProperty = DependencyProperty.RegisterAttached("DateTimeFormat", typeof(string), typeof(Cattach), new FrameworkPropertyMetadata("YYYY-MM-dd", OnDateTimeFormatChanged)); @@ -938,7 +938,7 @@ public static void SetDock(DependencyObject obj, Dock value) obj.SetValue(DockProperty, value); } - + public static readonly DependencyProperty DockProperty = DependencyProperty.RegisterAttached("Dock", typeof(Dock), typeof(Cattach), new PropertyMetadata(default(Dock), OnDockChanged)); diff --git a/Source/Extensions/H.Extensions.BackgroundImage/Class1.cs b/Source/Extensions/H.Extensions.BackgroundImage/Class1.cs index 42d1c83a..863a5fb6 100644 --- a/Source/Extensions/H.Extensions.BackgroundImage/Class1.cs +++ b/Source/Extensions/H.Extensions.BackgroundImage/Class1.cs @@ -1,10 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace H.Extensions.BackgroundImage +namespace H.Extensions.BackgroundImage { internal class Class1 { diff --git a/Source/Extensions/H.Extensions.Behvaiors/Adorner/Behavior.Adorner.Base.cs b/Source/Extensions/H.Extensions.Behvaiors/Adorner/Behavior.Adorner.Base.cs index cadcfef7..0228a4de 100644 --- a/Source/Extensions/H.Extensions.Behvaiors/Adorner/Behavior.Adorner.Base.cs +++ b/Source/Extensions/H.Extensions.Behvaiors/Adorner/Behavior.Adorner.Base.cs @@ -36,7 +36,7 @@ public Visual AdornerVisual set { SetValue(AdornerVisualProperty, value); } } - + public static readonly DependencyProperty AdornerVisualProperty = DependencyProperty.Register("AdornerVisual", typeof(Visual), typeof(AdornerBehaviorBase), new FrameworkPropertyMetadata(default(Visual), (d, e) => { @@ -61,7 +61,7 @@ public bool IsUse set { SetValue(IsUseProperty, value); } } - + public static readonly DependencyProperty IsUseProperty = DependencyProperty.Register("IsUse", typeof(bool), typeof(AdornerBehaviorBase), new FrameworkPropertyMetadata(true, (d, e) => { @@ -87,7 +87,7 @@ public bool IsHitTestVisible set { SetValue(IsHitTestVisibleProperty, value); } } - + public static readonly DependencyProperty IsHitTestVisibleProperty = DependencyProperty.Register("IsHitTestVisible", typeof(bool), typeof(AdornerBehaviorBase), new FrameworkPropertyMetadata(default(bool), (d, e) => { diff --git a/Source/Extensions/H.Extensions.Behvaiors/Adorner/Behavior.Adorner.HitTest.DragOver.cs b/Source/Extensions/H.Extensions.Behvaiors/Adorner/Behavior.Adorner.HitTest.DragOver.cs index 45ecb82e..73ee3a6e 100644 --- a/Source/Extensions/H.Extensions.Behvaiors/Adorner/Behavior.Adorner.HitTest.DragOver.cs +++ b/Source/Extensions/H.Extensions.Behvaiors/Adorner/Behavior.Adorner.HitTest.DragOver.cs @@ -17,7 +17,7 @@ public Type AdornerDropErrorType set { SetValue(AdornerDropErrorTypeProperty, value); } } - + public static readonly DependencyProperty AdornerDropErrorTypeProperty = DependencyProperty.Register("AdornerDropErrorType", typeof(Type), typeof(DragOverHitTestAdornerBehavior), new FrameworkPropertyMetadata(default(Type), (d, e) => { @@ -39,8 +39,8 @@ public Type AdornerDropErrorType protected override void OnAttached() { - AssociatedObject.DragOver += AssociatedObject_DragOver; - AssociatedObject.Drop += AssociatedObject_Drop; + this.AssociatedObject.DragOver += AssociatedObject_DragOver; + this.AssociatedObject.Drop += AssociatedObject_Drop; //AssociatedObject.DragEnter += AssociatedObject_DragEnter; //AssociatedObject.DragLeave += AssociatedObject_DragLeave; } @@ -56,7 +56,7 @@ public static void SetIsPreviewing(DependencyObject obj, bool value) obj.SetValue(IsPreviewingProperty, value); } - + public static readonly DependencyProperty IsPreviewingProperty = DependencyProperty.RegisterAttached("IsPreviewing", typeof(bool), typeof(DragOverHitTestAdornerBehavior), new PropertyMetadata(default(bool), OnIsPreviewingChanged)); @@ -87,7 +87,7 @@ protected virtual void Drop(object sender, DragEventArgs e) if (drag.CanDrop(_temp, e)) drag.Drop(_temp, e); } - else if (AssociatedObject is IHitTestElementDrop drop) + else if (this.AssociatedObject is IHitTestElementDrop drop) { if (drop.CanDrop(_temp, e)) drop.Drop(_temp, e); @@ -102,13 +102,13 @@ private void AssociatedObject_Drop(object sender, DragEventArgs e) private void AssociatedObject_DragOver(object sender, DragEventArgs e) { - if (AdornerType == null) + if (this.AdornerType == null) return; - if (AdornerVisual == null) - AdornerVisual = AssociatedObject; + if (this.AdornerVisual == null) + this.AdornerVisual = this.AssociatedObject; - Point point = e.GetPosition(AssociatedObject); - UIElement visualHit = AssociatedObject.HitTest(point, x => + Point point = e.GetPosition(this.AssociatedObject); + UIElement visualHit = this.AssociatedObject.HitTest(point, x => { if (GetIsHitTest(x) == false) return false; @@ -119,12 +119,12 @@ private void AssociatedObject_DragOver(object sender, DragEventArgs e) if (visualHit == null) { Clear(); - if (AssociatedObject != _temp) + if (this.AssociatedObject != _temp) { - DragEnter(AssociatedObject, e); + DragEnter(this.AssociatedObject, e); DragLeave(_temp, e); } - _temp = AssociatedObject; + _temp = this.AssociatedObject; } else { @@ -162,8 +162,8 @@ protected virtual void DragLeave(UIElement element, DragEventArgs e) protected override void OnDetaching() { - AssociatedObject.DragOver -= AssociatedObject_DragOver; - AssociatedObject.Drop -= AssociatedObject_Drop; + this.AssociatedObject.DragOver -= AssociatedObject_DragOver; + this.AssociatedObject.Drop -= AssociatedObject_Drop; //AssociatedObject.DragEnter -= AssociatedObject_DragEnter; //AssociatedObject.DragLeave -= AssociatedObject_DragLeave; Clear(); @@ -171,19 +171,19 @@ protected override void OnDetaching() protected override bool CheckAdorner(UIElement elment) { - return elment.GetAdorner(x => x.GetType() == AdornerType) == null; + return elment.GetAdorner(x => x.GetType() == this.AdornerType) == null; } protected override Adorner GetAdorner(UIElement elment) { - Adorner adorner = Activator.CreateInstance(AdornerType, elment) as Adorner; + Adorner adorner = Activator.CreateInstance(this.AdornerType, elment) as Adorner; object data = elment.GetDataContext(); if (data is IHitTestElementDrag drag) { if (drag.CanDrop(elment, null)) adorner = drag.GetDragAdorner(elment); else - adorner = Activator.CreateInstance(AdornerDropErrorType, elment) as Adorner; + adorner = Activator.CreateInstance(this.AdornerDropErrorType, elment) as Adorner; } if (data is IGetDropAdorner gdrag) diff --git a/Source/Extensions/H.Extensions.Behvaiors/Adorner/Behavior.Adorner.HitTest.MouseOver.cs b/Source/Extensions/H.Extensions.Behvaiors/Adorner/Behavior.Adorner.HitTest.MouseOver.cs index 57fa9b49..1706edd7 100644 --- a/Source/Extensions/H.Extensions.Behvaiors/Adorner/Behavior.Adorner.HitTest.MouseOver.cs +++ b/Source/Extensions/H.Extensions.Behvaiors/Adorner/Behavior.Adorner.HitTest.MouseOver.cs @@ -23,7 +23,7 @@ public static void SetIsMouseOver(DependencyObject obj, bool value) obj.SetValue(IsMouseOverProperty, value); } - + public static readonly DependencyProperty IsMouseOverProperty = DependencyProperty.RegisterAttached("IsMouseOver", typeof(bool), typeof(MouseOverHitTestAdornerBehavior), new PropertyMetadata(default(bool), OnIsMouseOverChanged)); @@ -38,17 +38,17 @@ public static void OnIsMouseOverChanged(DependencyObject d, DependencyPropertyCh protected override void OnAttached() { - AssociatedObject.MouseMove += AssociatedObject_MouseMove; + this.AssociatedObject.MouseMove += AssociatedObject_MouseMove; } private void AssociatedObject_MouseMove(object sender, MouseEventArgs e) { - if (AdornerType == null) + if (this.AdornerType == null) return; - if (AdornerVisual == null) - AdornerVisual = AssociatedObject; - Point point = e.GetPosition(AssociatedObject); - UIElement visualHit = AssociatedObject.HitTest(point, x => GetIsHitTest(x)); + if (this.AdornerVisual == null) + this.AdornerVisual = this.AssociatedObject; + Point point = e.GetPosition(this.AssociatedObject); + UIElement visualHit = this.AssociatedObject.HitTest(point, x => GetIsHitTest(x)); if (visualHit == null) { Clear(); @@ -65,7 +65,7 @@ private void AssociatedObject_MouseMove(object sender, MouseEventArgs e) protected override void OnDetaching() { - AssociatedObject.MouseMove -= AssociatedObject_MouseMove; + this.AssociatedObject.MouseMove -= AssociatedObject_MouseMove; Clear(); } diff --git a/Source/Extensions/H.Extensions.Behvaiors/Adorner/Behavior.Adorner.HitTest.Selected.cs b/Source/Extensions/H.Extensions.Behvaiors/Adorner/Behavior.Adorner.HitTest.Selected.cs index 1572d633..0257cf5e 100644 --- a/Source/Extensions/H.Extensions.Behvaiors/Adorner/Behavior.Adorner.HitTest.Selected.cs +++ b/Source/Extensions/H.Extensions.Behvaiors/Adorner/Behavior.Adorner.HitTest.Selected.cs @@ -40,11 +40,11 @@ static public void OnIsSelectedChanged(DependencyObject d, DependencyPropertyCha protected override void OnAttached() { - AssociatedObject.AddHandler(UIElement.MouseLeftButtonDownEvent, new MouseButtonEventHandler(AssociatedObject_MouseLeftButtonDown), true); + this.AssociatedObject.AddHandler(UIElement.MouseLeftButtonDownEvent, new MouseButtonEventHandler(AssociatedObject_MouseLeftButtonDown), true); } protected override void OnDetaching() { - AssociatedObject.RemoveHandler(UIElement.MouseLeftButtonDownEvent, new MouseButtonEventHandler(AssociatedObject_MouseLeftButtonDown)); + this.AssociatedObject.RemoveHandler(UIElement.MouseLeftButtonDownEvent, new MouseButtonEventHandler(AssociatedObject_MouseLeftButtonDown)); this.Clear(); } diff --git a/Source/Extensions/H.Extensions.Behvaiors/Adorner/Behavior.Adorner.HitTest.cs b/Source/Extensions/H.Extensions.Behvaiors/Adorner/Behavior.Adorner.HitTest.cs index d6985138..855c80e1 100644 --- a/Source/Extensions/H.Extensions.Behvaiors/Adorner/Behavior.Adorner.HitTest.cs +++ b/Source/Extensions/H.Extensions.Behvaiors/Adorner/Behavior.Adorner.HitTest.cs @@ -21,7 +21,7 @@ public static void SetHitTestAdornerType(DependencyObject obj, Type value) obj.SetValue(HitTestAdornerTypeProperty, value); } - + public static readonly DependencyProperty HitTestAdornerTypeProperty = DependencyProperty.RegisterAttached("HitTestAdornerType", typeof(Type), typeof(HitTestAdornerBehavior), new PropertyMetadata(default(Type), OnHitTestAdornerTypeChanged)); @@ -48,7 +48,7 @@ public static void SetIsHitTest(DependencyObject obj, bool value) obj.SetValue(IsHitTestProperty, value); } - + public static readonly DependencyProperty IsHitTestProperty = DependencyProperty.RegisterAttached("IsHitTest", typeof(bool), typeof(HitTestAdornerBehavior), new PropertyMetadata(default(bool), OnIsHitTestChanged)); @@ -63,7 +63,7 @@ public static void OnIsHitTestChanged(DependencyObject d, DependencyPropertyChan protected virtual void Clear() { - _temp?.ClearAdorner(x => x.GetType() == AdornerType); + _temp?.ClearAdorner(x => x.GetType() == this.AdornerType); if (_temp != null) MouseOverHitTestAdornerBehavior.SetIsMouseOver(_temp, false); if (_temp.GetDataContext() is IGetDropAdorner drop) @@ -99,18 +99,18 @@ protected virtual void AddAdorner(UIElement elment) { if (_temp == elment) return; - if (AdornerType == null) + if (this.AdornerType == null) return; if (CheckAdorner(elment) == false) return; - if (IsUse) + if (this.IsUse) { Adorner adorner = GetAdorner(elment); if (adorner == null) return; - adorner.IsHitTestVisible = IsHitTestVisible; + adorner.IsHitTestVisible = this.IsHitTestVisible; System.Diagnostics.Debug.WriteLine("IsHitTestVisible:" + adorner.IsHitTestVisible); @@ -123,7 +123,7 @@ protected virtual bool CheckAdorner(UIElement elment) Type custom = GetHitTestAdornerType(elment); if (custom != null) return elment.GetAdorner(x => x.GetType() == custom) == null; - return elment.GetAdorner(x => x.GetType() == AdornerType) == null; + return elment.GetAdorner(x => x.GetType() == this.AdornerType) == null; } protected virtual Adorner GetAdorner(UIElement elment) @@ -131,7 +131,7 @@ protected virtual Adorner GetAdorner(UIElement elment) Type custom = GetHitTestAdornerType(elment); if (custom != null) return Activator.CreateInstance(custom, elment) as Adorner; - return Activator.CreateInstance(AdornerType, elment) as Adorner; + return Activator.CreateInstance(this.AdornerType, elment) as Adorner; } protected override void OnDetaching() diff --git a/Source/Extensions/H.Extensions.Behvaiors/Adorner/Behavior.Adorner.Loaded.cs b/Source/Extensions/H.Extensions.Behvaiors/Adorner/Behavior.Adorner.Loaded.cs index 48fce412..2a03430b 100644 --- a/Source/Extensions/H.Extensions.Behvaiors/Adorner/Behavior.Adorner.Loaded.cs +++ b/Source/Extensions/H.Extensions.Behvaiors/Adorner/Behavior.Adorner.Loaded.cs @@ -15,7 +15,7 @@ public class LoadedAdornerBehavior : AdornerBehaviorBase { protected override void OnAttached() { - AssociatedObject.Loaded += AssociatedObject_Loaded; + this.AssociatedObject.Loaded += AssociatedObject_Loaded; } private void AssociatedObject_Loaded(object sender, RoutedEventArgs e) @@ -25,15 +25,15 @@ private void AssociatedObject_Loaded(object sender, RoutedEventArgs e) private void Refresh() { - if (AdornerType == null) return; + if (this.AdornerType == null) return; - if (AdornerVisual == null) - AdornerVisual = AssociatedObject; + if (this.AdornerVisual == null) + this.AdornerVisual = this.AssociatedObject; - AdornerLayer layer = AdornerLayer.GetAdornerLayer(AdornerVisual); + AdornerLayer layer = AdornerLayer.GetAdornerLayer(this.AdornerVisual); if (layer == null) return; - IEnumerable adorners = layer.GetAdorners(AdornerVisual as UIElement)?.Where(l => l.GetType() == AdornerType); + IEnumerable adorners = layer.GetAdorners(this.AdornerVisual as UIElement)?.Where(l => l.GetType() == this.AdornerType); if (adorners != null) { @@ -43,9 +43,9 @@ private void Refresh() } } - if (IsUse) + if (this.IsUse) { - Adorner adorner = Activator.CreateInstance(AdornerType, AssociatedObject) as Adorner; + Adorner adorner = Activator.CreateInstance(this.AdornerType, this.AssociatedObject) as Adorner; if (adorner == null) return; layer.Add(adorner); @@ -54,7 +54,7 @@ private void Refresh() protected override void OnDetaching() { - AssociatedObject.Loaded -= AssociatedObject_Loaded; + this.AssociatedObject.Loaded -= AssociatedObject_Loaded; } } diff --git a/Source/Extensions/H.Extensions.Behvaiors/Adorner/Behavior.Adorner.MouseOver.cs b/Source/Extensions/H.Extensions.Behvaiors/Adorner/Behavior.Adorner.MouseOver.cs index d45652bd..491349bc 100644 --- a/Source/Extensions/H.Extensions.Behvaiors/Adorner/Behavior.Adorner.MouseOver.cs +++ b/Source/Extensions/H.Extensions.Behvaiors/Adorner/Behavior.Adorner.MouseOver.cs @@ -23,8 +23,8 @@ public class MouseOverAdornerBehavior : AdornerBehaviorBase protected override void OnAttached() { - AssociatedObject.MouseEnter += AssociatedObject_MouseEnter; - AssociatedObject.MouseLeave += AssociatedObject_MouseLeave; + this.AssociatedObject.MouseEnter += AssociatedObject_MouseEnter; + this.AssociatedObject.MouseLeave += AssociatedObject_MouseLeave; } private void AssociatedObject_MouseLeave(object sender, MouseEventArgs e) @@ -37,20 +37,20 @@ private void AssociatedObject_MouseEnter(object sender, MouseEventArgs e) { System.Diagnostics.Debug.WriteLine("AssociatedObject_MouseEnter"); - if (AdornerType == null) + if (this.AdornerType == null) return; - if (AdornerVisual == null) - AdornerVisual = AssociatedObject; + if (this.AdornerVisual == null) + this.AdornerVisual = this.AssociatedObject; if (_adorner != null) return; - AdornerLayer layer = AdornerLayer.GetAdornerLayer(AssociatedObject); + AdornerLayer layer = AdornerLayer.GetAdornerLayer(this.AssociatedObject); if (layer == null) return; - IEnumerable adorners = layer.GetAdorners(AssociatedObject)?.Where(l => l.GetType() == AdornerType); + IEnumerable adorners = layer.GetAdorners(this.AssociatedObject)?.Where(l => l.GetType() == this.AdornerType); if (adorners != null) { foreach (Adorner item in adorners) @@ -58,9 +58,9 @@ private void AssociatedObject_MouseEnter(object sender, MouseEventArgs e) layer.Remove(item); } } - if (IsUse) + if (this.IsUse) { - Adorner adorner = Activator.CreateInstance(AdornerType, AdornerVisual) as Adorner; + Adorner adorner = Activator.CreateInstance(this.AdornerType, this.AdornerVisual) as Adorner; if (adorner == null) return; adorner.MouseLeave -= AssociatedObject_MouseLeave; @@ -73,8 +73,8 @@ private void AssociatedObject_MouseEnter(object sender, MouseEventArgs e) protected override void OnDetaching() { - AssociatedObject.MouseEnter -= AssociatedObject_MouseEnter; - AssociatedObject.MouseLeave -= AssociatedObject_MouseLeave; + this.AssociatedObject.MouseEnter -= AssociatedObject_MouseEnter; + this.AssociatedObject.MouseLeave -= AssociatedObject_MouseLeave; ClearAdorner(); } @@ -82,7 +82,7 @@ private void ClearAdorner() { if (_adorner == null) return; - AdornerLayer layer = AdornerLayer.GetAdornerLayer(AdornerVisual); + AdornerLayer layer = AdornerLayer.GetAdornerLayer(this.AdornerVisual); if (layer == null) return; _adorner.MouseLeave -= AssociatedObject_MouseLeave; diff --git a/Source/Extensions/H.Extensions.Behvaiors/Bebavior.ScrollViewer.cs b/Source/Extensions/H.Extensions.Behvaiors/Bebavior.ScrollViewer.cs index ad7acdf3..e7de93f7 100644 --- a/Source/Extensions/H.Extensions.Behvaiors/Bebavior.ScrollViewer.cs +++ b/Source/Extensions/H.Extensions.Behvaiors/Bebavior.ScrollViewer.cs @@ -3,8 +3,6 @@ using Microsoft.Xaml.Behaviors; using System.Windows; using System.Windows.Controls; -using System.Windows.Controls.Primitives; -using System.Windows.Data; namespace H.Extensions.Behvaiors { diff --git a/Source/Extensions/H.Extensions.Behvaiors/Bebavior.TextBox.cs b/Source/Extensions/H.Extensions.Behvaiors/Bebavior.TextBox.cs index 333902e9..c851f8ef 100644 --- a/Source/Extensions/H.Extensions.Behvaiors/Bebavior.TextBox.cs +++ b/Source/Extensions/H.Extensions.Behvaiors/Bebavior.TextBox.cs @@ -45,7 +45,7 @@ public Key Key private void AssociatedObject_KeyDown(object sender, System.Windows.Input.KeyEventArgs e) { - if(e.Key==this.Key) + if (e.Key == this.Key) { this.AssociatedObject.GetBindingExpression(TextBox.TextProperty).UpdateSource(); } diff --git a/Source/Extensions/H.Extensions.Behvaiors/Behavior.ContextMenu.cs b/Source/Extensions/H.Extensions.Behvaiors/Behavior.ContextMenu.cs index 5bdbb1e8..b380090b 100644 --- a/Source/Extensions/H.Extensions.Behvaiors/Behavior.ContextMenu.cs +++ b/Source/Extensions/H.Extensions.Behvaiors/Behavior.ContextMenu.cs @@ -2,9 +2,7 @@ using Microsoft.Xaml.Behaviors; using System; -using System.ComponentModel; using System.Windows; -using System.Windows.Controls; using System.Windows.Controls.Primitives; using System.Windows.Input; diff --git a/Source/Extensions/H.Extensions.Behvaiors/Behavior.TreeView.cs b/Source/Extensions/H.Extensions.Behvaiors/Behavior.TreeView.cs index 612a2c70..25253fe5 100644 --- a/Source/Extensions/H.Extensions.Behvaiors/Behavior.TreeView.cs +++ b/Source/Extensions/H.Extensions.Behvaiors/Behavior.TreeView.cs @@ -41,17 +41,17 @@ public static void SetIsSelected(DependencyObject obj, bool value) protected override void OnAttached() { - AssociatedObject.AddHandler(TreeViewItem.UnselectedEvent, new RoutedEventHandler(OnTreeViewItemUnselected), true); - AssociatedObject.AddHandler(TreeViewItem.SelectedEvent, new RoutedEventHandler(OnTreeViewItemSelected), true); - AssociatedObject.AddHandler(UIElement.KeyDownEvent, new KeyEventHandler(OnKeyDown), true); + this.AssociatedObject.AddHandler(TreeViewItem.UnselectedEvent, new RoutedEventHandler(OnTreeViewItemUnselected), true); + this.AssociatedObject.AddHandler(TreeViewItem.SelectedEvent, new RoutedEventHandler(OnTreeViewItemSelected), true); + this.AssociatedObject.AddHandler(UIElement.KeyDownEvent, new KeyEventHandler(OnKeyDown), true); base.OnAttached(); } protected override void OnDetaching() { - AssociatedObject.RemoveHandler(UIElement.KeyDownEvent, new KeyEventHandler(OnKeyDown)); - AssociatedObject.RemoveHandler(TreeViewItem.UnselectedEvent, new RoutedEventHandler(OnTreeViewItemUnselected)); - AssociatedObject.RemoveHandler(TreeViewItem.SelectedEvent, new RoutedEventHandler(OnTreeViewItemSelected)); + this.AssociatedObject.RemoveHandler(UIElement.KeyDownEvent, new KeyEventHandler(OnKeyDown)); + this.AssociatedObject.RemoveHandler(TreeViewItem.UnselectedEvent, new RoutedEventHandler(OnTreeViewItemUnselected)); + this.AssociatedObject.RemoveHandler(TreeViewItem.SelectedEvent, new RoutedEventHandler(OnTreeViewItemSelected)); base.OnDetaching(); } @@ -120,7 +120,7 @@ private static void OnSelectedChanged(DependencyObject sender, DependencyPropert private void OnKeyDown(object sender, KeyEventArgs e) { TreeView tree = (TreeView)sender; - Debug.Assert(tree == AssociatedObject); + Debug.Assert(tree == this.AssociatedObject); // If you press CTRL+A, do a full select. if (e.Key == Key.A && e.KeyboardDevice.Modifiers == ModifierKeys.Control) @@ -136,7 +136,7 @@ private void OnKeyDown(object sender, KeyEventArgs e) private IEnumerable GetExpandedTreeViewItems(ItemsControl container = null) { if (container == null) - container = AssociatedObject; + container = this.AssociatedObject; for (int i = 0; i < container.Items.Count; i++) { diff --git a/Source/Extensions/H.Extensions.Behvaiors/Behavior.TreeViewItem.cs b/Source/Extensions/H.Extensions.Behvaiors/Behavior.TreeViewItem.cs index 3f60a4ea..dad2a556 100644 --- a/Source/Extensions/H.Extensions.Behvaiors/Behavior.TreeViewItem.cs +++ b/Source/Extensions/H.Extensions.Behvaiors/Behavior.TreeViewItem.cs @@ -37,7 +37,7 @@ public bool Use protected override void OnAttached() { - AssociatedObject.PreviewMouseDown += AssociatedObject_MouseDown; ; + this.AssociatedObject.PreviewMouseDown += AssociatedObject_MouseDown; ; } private void AssociatedObject_MouseDown(object sender, System.Windows.Input.MouseButtonEventArgs e) @@ -50,7 +50,7 @@ private void AssociatedObject_MouseDown(object sender, System.Windows.Input.Mous protected override void OnDetaching() { - AssociatedObject.PreviewMouseDown -= AssociatedObject_MouseDown; + this.AssociatedObject.PreviewMouseDown -= AssociatedObject_MouseDown; } } @@ -81,8 +81,8 @@ static public void OnIsContainChanged(DependencyObject d, DependencyPropertyChan protected override void OnAttached() { - AssociatedObject.Selected += AssociatedObject_Selected; - AssociatedObject.Unselected += AssociatedObject_Unselected; + this.AssociatedObject.Selected += AssociatedObject_Selected; + this.AssociatedObject.Unselected += AssociatedObject_Unselected; } private void AssociatedObject_Unselected(object sender, RoutedEventArgs e) diff --git a/Source/Extensions/H.Extensions.Behvaiors/DataGrid/DataGridAutoColumnBehavior.cs b/Source/Extensions/H.Extensions.Behvaiors/DataGrid/DataGridAutoColumnBehavior.cs index 62ed627c..2510e4b2 100644 --- a/Source/Extensions/H.Extensions.Behvaiors/DataGrid/DataGridAutoColumnBehavior.cs +++ b/Source/Extensions/H.Extensions.Behvaiors/DataGrid/DataGridAutoColumnBehavior.cs @@ -16,13 +16,13 @@ public class DataGridAutoColumnBehavior : Behavior { protected override void OnAttached() { - AssociatedObject.AutoGeneratedColumns += AssociatedObject_AutoGeneratedColumns; - AssociatedObject.AutoGenerateColumns = false; + this.AssociatedObject.AutoGeneratedColumns += AssociatedObject_AutoGeneratedColumns; + this.AssociatedObject.AutoGenerateColumns = false; } protected override void OnDetaching() { - AssociatedObject.AutoGeneratedColumns -= AssociatedObject_AutoGeneratedColumns; + this.AssociatedObject.AutoGeneratedColumns -= AssociatedObject_AutoGeneratedColumns; } public Type Type @@ -148,7 +148,7 @@ private void GenerateColumns() { this.DelayInvoke(() => { - GenerateColunms(AssociatedObject); + GenerateColunms(this.AssociatedObject); }); } @@ -159,13 +159,13 @@ protected virtual void GenerateColunms(DataGrid dataGrid) if (dataGrid.IsInitialized == false) return; dataGrid.Columns.Clear(); - foreach (DataGridColumn item in HomeColumns) + foreach (DataGridColumn item in this.HomeColumns) { dataGrid.Columns.Add(item); } - if (Type == null) + if (this.Type == null) return; - PropertyInfo[] ps = Type.GetProperties(); + PropertyInfo[] ps = this.Type.GetProperties(); foreach (PropertyInfo p in ps) { BrowsableAttribute browsable = p.GetCustomAttribute(); @@ -187,7 +187,7 @@ protected virtual void GenerateColunms(DataGrid dataGrid) if (column is DataGridBoundColumn bound) { Binding binding = new Binding(); - string path = string.Format(BindingPath, string.Format(columnAttribute?.PropertyPath ?? "{0}", p.Name)); + string path = string.Format(this.BindingPath, string.Format(columnAttribute?.PropertyPath ?? "{0}", p.Name)); binding.Path = new PropertyPath(path); binding.Mode = readOnly?.IsReadOnly == true ? BindingMode.OneWay : BindingMode.TwoWay; bound.Binding = binding; @@ -196,7 +196,7 @@ protected virtual void GenerateColunms(DataGrid dataGrid) } dataGrid.Columns.Add(column); } - foreach (DataGridColumn item in EndColumns) + foreach (DataGridColumn item in this.EndColumns) { dataGrid.Columns.Add(item); } @@ -207,29 +207,29 @@ public DataGridColumn GetDataGridColumn(PropertyInfo propertyInfo) { if (propertyInfo.PropertyType == typeof(bool)) { - return new DataGridCheckBoxColumn() - { - Width = DataGridLength, - EditingElementStyle=null, - ElementStyle=null + return new DataGridCheckBoxColumn() + { + Width = this.DataGridLength, + EditingElementStyle = null, + ElementStyle = null }; } else if (propertyInfo.PropertyType.IsEnum) { - return new DataGridComboBoxColumn() - { - Width = DataGridLength, - EditingElementStyle = null, - ElementStyle = null + return new DataGridComboBoxColumn() + { + Width = this.DataGridLength, + EditingElementStyle = null, + ElementStyle = null }; } else { - return new DataGridTextColumn() - { - Width = DataGridLength, + return new DataGridTextColumn() + { + Width = this.DataGridLength, EditingElementStyle = null, - ElementStyle = null + ElementStyle = null }; } } diff --git a/Source/Extensions/H.Extensions.Behvaiors/DataGrid/DataGridColumnAttribute.cs b/Source/Extensions/H.Extensions.Behvaiors/DataGrid/DataGridColumnAttribute.cs index 3a4c71eb..85c9b1ea 100644 --- a/Source/Extensions/H.Extensions.Behvaiors/DataGrid/DataGridColumnAttribute.cs +++ b/Source/Extensions/H.Extensions.Behvaiors/DataGrid/DataGridColumnAttribute.cs @@ -10,14 +10,14 @@ public class DataGridColumnAttribute : Attribute, IDataGridColumn public DataGridColumnAttribute(string width) { DataGridLengthConverter converter = new DataGridLengthConverter(); - Width = (DataGridLength)converter.ConvertFromString(width); + this.Width = (DataGridLength)converter.ConvertFromString(width); } public DataGridColumnAttribute() { } public DataGridLength Width { get; set; } = DataGridLength.Auto; - public Type Template { get; set; } = typeof(DataGridTextColumn); + public Type Template { get; set; } = typeof(DataGridTextColumn); public Type ConvertyType { get; set; } /// /// "{0}.Property" @@ -25,23 +25,23 @@ public DataGridColumnAttribute() public string PropertyPath { get; set; } = "{0}"; public virtual DataGridColumn GetDataGridColumn(PropertyInfo propertyInfo) { - DataGridColumn dataGridColumn = Activator.CreateInstance(Template) as DataGridColumn; + DataGridColumn dataGridColumn = Activator.CreateInstance(this.Template) as DataGridColumn; if (dataGridColumn == null) { if (propertyInfo.PropertyType == typeof(bool)) { - return new DataGridCheckBoxColumn() { Width = Width, IsReadOnly = false }; + return new DataGridCheckBoxColumn() { Width = this.Width, IsReadOnly = false }; } else if (propertyInfo.PropertyType.IsEnum) { - return new DataGridComboBoxColumn() { Width = Width, IsReadOnly = false }; + return new DataGridComboBoxColumn() { Width = this.Width, IsReadOnly = false }; } else { - return new DataGridTextColumn() { Width = Width, IsReadOnly = false }; + return new DataGridTextColumn() { Width = this.Width, IsReadOnly = false }; } } - dataGridColumn.Width = Width; + dataGridColumn.Width = this.Width; return dataGridColumn; } } diff --git a/Source/Extensions/H.Extensions.Behvaiors/ItemsControl/Behavior.Button.AddItem.Base.cs b/Source/Extensions/H.Extensions.Behvaiors/ItemsControl/Behavior.Button.AddItem.Base.cs index 5694c5a2..d1ecc937 100644 --- a/Source/Extensions/H.Extensions.Behvaiors/ItemsControl/Behavior.Button.AddItem.Base.cs +++ b/Source/Extensions/H.Extensions.Behvaiors/ItemsControl/Behavior.Button.AddItem.Base.cs @@ -3,7 +3,6 @@ using System; using System.Collections; using System.Windows; -using System.Windows.Controls; namespace H.Extensions.Behvaiors { @@ -15,7 +14,7 @@ public object DefaultValue set { SetValue(DefaultValueProperty, value); } } - + public static readonly DependencyProperty DefaultValueProperty = DependencyProperty.Register("DefaultValue", typeof(object), typeof(AddItemButtonBehaviorBase), new FrameworkPropertyMetadata(default, (d, e) => { @@ -37,13 +36,13 @@ public object DefaultValue protected object CreateNewItem() { - if (DefaultValue == null && ItemsSource == null) + if (this.DefaultValue == null && this.ItemsSource == null) return null; - if (ItemsSource == null) - ItemsControl.ItemsSource = DefaultValue.GetType().CreateObservableCollection(); - if (DefaultValue is ICloneable cloneable) + if (this.ItemsSource == null) + this.ItemsControl.ItemsSource = this.DefaultValue.GetType().CreateObservableCollection(); + if (this.DefaultValue is ICloneable cloneable) return cloneable.Clone(); - if (ItemsSource.TryCreateItem(out object instance)) + if (this.ItemsSource.TryCreateItem(out object instance)) return instance; return null; } diff --git a/Source/Extensions/H.Extensions.Behvaiors/ItemsControl/Behavior.Button.AddItem.cs b/Source/Extensions/H.Extensions.Behvaiors/ItemsControl/Behavior.Button.AddItem.cs index 9941b94e..c61a7c73 100644 --- a/Source/Extensions/H.Extensions.Behvaiors/ItemsControl/Behavior.Button.AddItem.cs +++ b/Source/Extensions/H.Extensions.Behvaiors/ItemsControl/Behavior.Button.AddItem.cs @@ -9,7 +9,7 @@ protected override void OnClick() object addItem = CreateNewItem(); if (addItem == null) return; - ItemsSource.Add(addItem); + this.ItemsSource.Add(addItem); } } diff --git a/Source/Extensions/H.Extensions.Behvaiors/ItemsControl/Behavior.Button.Base.cs b/Source/Extensions/H.Extensions.Behvaiors/ItemsControl/Behavior.Button.Base.cs index 8455c144..6012a024 100644 --- a/Source/Extensions/H.Extensions.Behvaiors/ItemsControl/Behavior.Button.Base.cs +++ b/Source/Extensions/H.Extensions.Behvaiors/ItemsControl/Behavior.Button.Base.cs @@ -11,7 +11,7 @@ public abstract class ButtonBehaviorBase : Behavior