From 89bfccc2937cd07362672c632f776aa5c293e16d Mon Sep 17 00:00:00 2001 From: Alexandre Zollinger Chohfi Date: Fri, 8 Nov 2019 03:25:33 -0500 Subject: [PATCH 001/157] Initial port to WinUI3. --- .gitignore | 3 + Directory.Build.props | 19 +- Directory.Build.targets | 2 +- GazeInputTest/App.xaml.cs | 6 +- GazeInputTest/MainPage.xaml.cs | 6 +- .../Core/DataProviderBase.cs | 2 +- .../Microsoft.Toolkit.Services.csproj | 8 +- .../Services/LinkedIn/LinkedInDataProvider.cs | 2 +- .../Uwp/MicrosoftGraphUserServicePhotos.cs | 2 +- .../MicrosoftTranslator/TranslatorService.cs | 2 +- .../Uwp/OneDriveStorageFilePlatform.cs | 2 +- .../ObservableBluetoothLEDevice.cs | 6 +- .../Microsoft.Toolkit.Uwp.Connectivity.csproj | 2 +- .../AlignmentGrid/AlignmentGrid.cs | 8 +- .../FocusTracker/FocusTracker.cs | 14 +- ...icrosoft.Toolkit.Uwp.DeveloperTools.csproj | 2 +- .../DwellInvokedRoutedEventArgs.h | 10 +- .../DwellProgressEventArgs.h | 3 +- .../DwellProgressState.h | 2 +- .../GazeCursor.cpp | 59 +++--- .../GazeCursor.h | 102 ++++------ .../GazeElement.h | 36 +++- .../GazeEventArgs.h | 8 +- .../GazeFeedbackPopupFactory.cpp | 30 +-- .../GazeFeedbackPopupFactory.h | 16 +- .../GazeHidParsers.cpp | 24 +-- .../GazeHidParsers.h | 54 ++--- .../GazeHistoryItem.h | 12 +- .../GazeInput.cpp | 128 ++++++------ .../GazeInput.h | 107 +++++----- .../GazePointer.cpp | 104 +++++----- .../GazePointer.h | 116 +++++------ .../GazePointerProxy.cpp | 40 ++-- .../GazePointerProxy.h | 20 +- .../GazeSettingsHelper.cpp | 12 +- .../GazeSettingsHelper.h | 6 +- .../GazeStats.cpp | 4 +- .../GazeStats.h | 38 ++-- .../GazeTargetItem.cpp | 97 +++++---- .../GazeTargetItem.h | 185 +++++++++-------- .../IGazeFilter.h | 24 +-- .../Interaction.h | 2 +- ...soft.Toolkit.UWP.Input.GazeInteraction.def | 3 + ....Toolkit.UWP.Input.GazeInteraction.vcxproj | 48 ++++- .../OneEuroFilter.cpp | 4 +- .../OneEuroFilter.h | 16 +- .../PointerState.h | 2 +- .../StateChangedEventArgs.h | 17 +- .../XamlMetaDataProvider.cpp | 3 + .../XamlMetaDataProvider.idl | 7 + .../packages.config | 5 + .../pch.h | 89 ++++---- .../Common/BaseElement.cs | 2 +- .../Common/XmlWriterHelper.cs | 4 +- ...Microsoft.Toolkit.Uwp.Notifications.csproj | 9 +- Microsoft.Toolkit.Uwp.SampleApp/App.xaml.cs | 8 +- .../Common/BoolStringConverter.cs | 2 +- .../Common/Constants.cs | 2 +- .../Common/DoubleTopThicknessConverter.cs | 4 +- .../Common/EnumConverter.cs | 2 +- .../Common/IXamlRenderListener.cs | 2 +- .../Common/SolidColorBrushConverter.cs | 6 +- .../Common/ThicknessConverter.cs | 4 +- .../Common/TimeSpanConverter.cs | 2 +- .../Controls/AadAuthControl.xaml.cs | 4 +- .../Controls/CodeRenderer.cs | 6 +- .../Controls/PropertyControl.xaml.cs | 12 +- .../Controls/SampleAppMarkdownRenderer.cs | 8 +- .../Controls/XamlCodeEditor.xaml.cs | 8 +- .../Controls/XamlRenderService.cs | 4 +- .../Data/DataGridDataSource.cs | 2 +- .../Data/PhotosDataSource.cs | 2 +- .../Microsoft.Toolkit.Uwp.SampleApp.csproj | 4 +- .../Models/Sample.cs | 2 +- .../Models/ThemeChangedArgs.cs | 2 +- .../Pages/About.xaml.cs | 10 +- .../Pages/SampleController.xaml.cs | 8 +- .../SamplePages/AadLogin/AadLoginPage.xaml.cs | 4 +- .../AdaptiveGridViewPage.xaml.cs | 2 +- .../AdvancedCollectionViewPage.xaml.cs | 2 +- .../AlignmentGrid/AlignmentGridPage.xaml.cs | 2 +- .../BackdropBlurBrushPage.xaml.cs | 4 +- .../BackdropGammaTransferBrushPage.xaml.cs | 4 +- .../BackdropInvertBrushPage.xaml.cs | 4 +- .../BackdropSaturationBrushPage.xaml.cs | 4 +- .../BackdropSepiaBrushPage.xaml.cs | 4 +- .../BackgroundTaskHelperPage.xaml.cs | 4 +- .../SamplePages/BladeView/BladePage.xaml.cs | 4 +- .../BluetoothLEHelperPage.xaml.cs | 6 +- .../SamplePages/Blur/BlurBehaviorPage.xaml.cs | 2 +- .../CameraHelper/CameraHelperPage.xaml.cs | 8 +- .../CameraPreview/CameraPreviewPage.xaml.cs | 8 +- .../SamplePages/Carousel/CarouselPage.xaml.cs | 6 +- .../ConnectedAnimationsPage.xaml.cs | 8 +- .../Pages/FirstPage.xaml.cs | 6 +- .../Pages/SecondPage.xaml.cs | 4 +- .../Pages/ThirdPage.xaml.cs | 4 +- .../SamplePages/DataGrid/DataGridPage.xaml.cs | 6 +- .../DispatcherHelperPage.xaml.cs | 2 +- .../DockPanel/DockPanelPage.xaml.cs | 10 +- .../DropShadowPanelPage.xaml.cs | 6 +- .../SamplePages/Expander/ExpanderPage.xaml.cs | 14 +- .../Eyedropper/EyedropperPage.xaml.cs | 4 +- .../Facebook Service/FacebookPage.xaml.cs | 4 +- .../FacebookPhotoTemplateSelector.cs | 4 +- .../SamplePages/Fade/FadeBehaviorPage.xaml.cs | 4 +- .../FadeHeader/FadeHeaderBehaviorPage.xaml.cs | 4 +- .../FocusTracker/FocusTrackerPage.xaml.cs | 2 +- .../FrameworkElementExtensionsPage.xaml.cs | 6 +- .../GazeInteractionPage.xaml.cs | 6 +- .../GazeTracing/GazeTracingPage.xaml.cs | 4 +- .../GridSplitter/GridSplitterPage.xaml.cs | 4 +- .../HeaderedContentControlPage.xaml.cs | 2 +- .../HeaderedItemsControlPage.xaml.cs | 4 +- .../HeaderedTextBlockPage.xaml.cs | 2 +- .../ImageBlendBrushPage.xaml.cs | 4 +- .../ImageCache/ImageCachePage.xaml.cs | 4 +- .../ImageCropper/ImageCropperPage.xaml.cs | 4 +- .../ImageEx/ImageExLazyLoadingControl.xaml.cs | 2 +- .../SamplePages/ImageEx/ImageExPage.xaml.cs | 6 +- .../ImplicitAnimationsPage.xaml.cs | 6 +- .../InAppNotificationPage.xaml.cs | 4 +- .../IncrementalLoadingCollectionPage.xaml.cs | 2 +- .../InfiniteCanvas/InfiniteCanvasPage.xaml.cs | 6 +- .../LayoutTransformControlPage.xaml.cs | 2 +- .../Light/LightBehaviorPage.xaml.cs | 2 +- .../LinkedIn Service/LinkedInPage.xaml.cs | 4 +- .../ListViewExtensionsPage.xaml.cs | 4 +- .../SamplePages/LiveTile/LiveTilePage.xaml.cs | 8 +- .../SamplePages/Loading/LoadingPage.xaml.cs | 4 +- .../MarkdownParser/MarkdownParserPage.xaml.cs | 2 +- .../MarkdownTextBlockPage.xaml.cs | 12 +- .../MasterDetailsViewPage.xaml.cs | 4 +- .../SamplePages/Menu/MenuPage.xaml.cs | 4 +- .../MicrosoftGraphPage.xaml.cs | 6 +- .../SendMessageContentDialog.xaml.cs | 4 +- .../MicrosoftTranslatorPage.xaml.cs | 2 +- .../NetworkHelper/NetworkHelperPage.xaml.cs | 2 +- .../Object Storage/ObjectStoragePage.xaml.cs | 2 +- .../Offset/OffsetBehaviorPage.xaml.cs | 2 +- .../SamplePages/OnDevice/OnDevicePage.xaml.cs | 2 +- .../FoldersPickerControl.xaml.cs | 4 +- .../OneDriveDataTemplateSelector.cs | 4 +- .../OneDrive Service/OneDrivePage.xaml.cs | 10 +- .../OneDrive Service/OneDriveSampleHelpers.cs | 6 +- .../OrbitView/OrbitViewPage.xaml.cs | 4 +- .../PeoplePicker/PeoplePickerPage.xaml.cs | 4 +- .../PlannerTaskListPage.xaml.cs | 4 +- .../PowerBIEmbeddedPage.xaml.cs | 4 +- .../PrintHelper/PrintHelperPage.xaml.cs | 8 +- .../ProfileCard/ProfileCardPage.xaml.cs | 6 +- .../RadialGauge/RadialGaugePage.xaml.cs | 2 +- .../RadialGradientBrushPage.xaml.cs | 4 +- .../RadialProgressBarPage.xaml.cs | 2 +- .../RemoteDeviceHelperPage.xaml.cs | 2 +- .../RemoteDevicePickerControlPage.xaml.cs | 4 +- .../ReorderGridPage.xaml.cs | 4 +- .../Rotate/RotateBehaviorPage.xaml.cs | 2 +- .../RotatorTile/RotatorTilePage.xaml.cs | 2 +- .../RssParser/RssParserPage.xaml.cs | 2 +- .../Saturation/SaturationBehaviorPage.xaml.cs | 2 +- .../Scale/ScaleBehaviorPage.xaml.cs | 2 +- .../ScrollHeader/ScrollHeaderPage.xaml.cs | 4 +- .../ScrollViewerExtensionsPage.xaml.cs | 6 +- .../SharePointFileListPage.xaml.cs | 4 +- .../StaggeredPanel/StaggeredPanelPage.xaml.cs | 4 +- .../StringExtensionsPage.xaml.cs | 2 +- .../SurfaceDialTextboxPage.xaml.cs | 2 +- .../SystemInformationPage.xaml.cs | 6 +- .../SamplePages/TabView/TabViewPage.xaml.cs | 4 +- .../TextBoxMask/TextBoxMaskPage.xaml.cs | 4 +- .../TextBoxRegex/TextBoxRegexPage.xaml.cs | 2 +- .../TextToolbar/TextToolbarPage.xaml.cs | 4 +- .../ThemeListener/ThemeListenerPage.xaml.cs | 4 +- .../TileControl/TileControlPage.xaml.cs | 2 +- .../SamplePages/Toast/ToastPage.xaml.cs | 6 +- .../TokenizingTextBox/SampleDataType.cs | 2 +- .../TokenizingTextBoxPage.xaml.cs | 4 +- .../Twitter Service/TwitterPage.xaml.cs | 6 +- .../TwitterTemplateSelector.cs | 4 +- .../ViewExtensions/ViewExtensionsPage.xaml.cs | 8 +- .../ViewportBehaviorPage.xaml.cs | 6 +- .../VisualExtensionsPage.xaml.cs | 2 +- .../WeatherLiveTileAndToastPage.xaml.cs | 6 +- .../Weibo Service/WeiboPage.xaml.cs | 4 +- .../WrapPanel/WrapPanelPage.xaml.cs | 4 +- .../Shell.SamplePicker.cs | 8 +- .../Shell.Search.cs | 6 +- Microsoft.Toolkit.Uwp.SampleApp/Shell.xaml.cs | 8 +- .../Styles/ThemeInjector.cs | 6 +- .../Microsoft.Toolkit.Uwp.Services.csproj | 2 +- .../AnimationSet.cs | 14 +- .../Behaviors/Blur.cs | 4 +- .../Behaviors/CompositionBehaviorBase.cs | 4 +- .../CompositionBehaviorBase.nongeneric.cs | 2 +- .../Behaviors/Fade.cs | 4 +- .../Behaviors/FadeHeaderBehavior.cs | 14 +- .../Behaviors/Light.cs | 6 +- .../Behaviors/Offset.cs | 4 +- .../Behaviors/QuickReturnHeaderBehavior.cs | 18 +- .../Behaviors/Rotate.cs | 2 +- .../Behaviors/Saturation.cs | 2 +- .../Behaviors/Scale.cs | 2 +- .../Behaviors/StickyHeaderBehavior.cs | 18 +- .../AnimationCollection.cs | 6 +- .../Animations/AnimationBase.cs | 8 +- .../Animations/OffsetAnimation.cs | 2 +- .../Animations/OpacityAnimation.cs | 2 +- .../Animations/RotationAnimation.cs | 2 +- .../Animations/RotationInDegreesAnimation.cs | 2 +- .../Animations/ScalarAnimation.cs | 2 +- .../Animations/ScaleAnimation.cs | 2 +- .../Animations/TranslationAnimation.cs | 4 +- .../Animations/TypedAnimationBase.cs | 4 +- .../Animations/Vector2Animation.cs | 2 +- .../Animations/Vector3Animation.cs | 2 +- .../Animations/Vector4Animation.cs | 2 +- .../KeyFrames/KeyFrame.cs | 2 +- .../KeyFrames/TypedKeyFrame.cs | 2 +- .../ConnectedAnimations/Connected.cs | 22 +- .../ConnectedAnimationHelper.cs | 16 +- .../ConnectedAnimationListProperty.cs | 2 +- .../ConnectedAnimationProperties.cs | 2 +- .../EffectAnimationDefinition.cs | 2 +- .../EffectDirectPropertyChangeDefinition.cs | 2 +- .../Effects/AnimationEffect.cs | 8 +- .../Effects/Blur.cs | 2 +- .../Effects/Saturation.cs | 2 +- .../Expressions/CompositionExtensions.cs | 8 +- .../Expressions/ExpressionNodes/ColorNode.cs | 10 +- .../ExpressionNodes/ExpressionNode.cs | 16 +- .../Expressions/ExpressionNodes/ScalarNode.cs | 2 +- .../ExpressionValues.Constant.cs | 4 +- .../AmbientLightReferenceNode.cs | 2 +- .../ReferenceNodes/ColorBrushReferenceNode.cs | 2 +- .../DistantLightReferenceNode.cs | 2 +- .../ReferenceNodes/DropShadowReferenceNode.cs | 2 +- .../ReferenceNodes/InsetClipReferenceNode.cs | 2 +- .../InteractionTrackerReferenceNode.cs | 2 +- .../ManipulationPropertySetReferenceNode.cs | 2 +- .../NineGridBrushReferenceNode.cs | 2 +- .../ReferenceNodes/PointLightReferenceNode.cs | 2 +- ...PointerPositionPropertySetReferenceNode.cs | 2 +- .../PropertySetReferenceNode.cs | 2 +- .../ReferenceNodes/ReferenceNode.cs | 4 +- .../ReferenceNodes/SpotLightReferenceNode.cs | 2 +- .../SurfaceBrushReferenceNode.cs | 2 +- .../ReferenceNodes/VisualReferenceNode.cs | 2 +- .../Extensions/AnimationExtensions.Blur.cs | 4 +- .../Extensions/AnimationExtensions.Fade.cs | 10 +- .../Extensions/AnimationExtensions.Light.cs | 25 ++- .../Extensions/AnimationExtensions.Offset.cs | 10 +- .../Extensions/AnimationExtensions.Rotate.cs | 10 +- .../AnimationExtensions.Saturation.cs | 4 +- .../Extensions/AnimationExtensions.Scale.cs | 10 +- .../Extensions/AnimationExtensions.cs | 8 +- .../Extensions/AnimationTools.cs | 2 +- .../Implicit.cs | 6 +- ...Microsoft.Toolkit.Uwp.UI.Animations.csproj | 4 +- .../ReorderGridAnimation.cs | 8 +- .../SurfaceLoader.cs | 23 ++- .../DataGridMetadata.cs | 170 ++++++++-------- .../MetadataRegistration.cs | 8 +- ...kit.Uwp.UI.Controls.DataGrid.Design.csproj | 8 +- .../CollectionViews/CollectionView.cs | 26 +-- .../EnumerableCollectionView.cs | 16 +- .../CollectionViews/ListCollectionView.cs | 2 +- .../Automation/DataGridAutomationPeer.cs | 18 +- .../Automation/DataGridCellAutomationPeer.cs | 10 +- .../DataGridColumnHeaderAutomationPeer.cs | 4 +- ...ridColumnHeadersPresenterAutomationPeer.cs | 2 +- .../DataGridDetailsPresenterAutomationPeer.cs | 2 +- .../DataGridGroupItemAutomationPeer.cs | 12 +- .../Automation/DataGridItemAutomationPeer.cs | 8 +- .../Automation/DataGridRowAutomationPeer.cs | 2 +- .../DataGridRowGroupHeaderAutomationPeer.cs | 2 +- .../DataGridRowHeaderAutomationPeer.cs | 2 +- .../DataGridRowsPresenterAutomationPeer.cs | 2 +- .../DataGrid/DataGrid.cs | 44 ++-- .../DataGridBeginningEditEventArgs.cs | 2 +- .../DataGrid/DataGridBoundColumn.cs | 4 +- .../DataGrid/DataGridCell.cs | 10 +- .../DataGridCellEditEndingEventArgs.cs | 2 +- .../DataGrid/DataGridCellsPresenter.cs | 6 +- .../DataGrid/DataGridCheckBoxColumn.cs | 10 +- .../DataGrid/DataGridColumn.cs | 8 +- .../DataGrid/DataGridColumnCollection.cs | 2 +- .../DataGrid/DataGridColumnHeader.cs | 19 +- .../DataGridColumnHeaderInteractionInfo.cs | 2 +- .../DataGridColumnHeadersPresenter.cs | 8 +- .../DataGridColumnReorderingEventArgs.cs | 2 +- .../DataGrid/DataGridColumns.cs | 6 +- .../DataGrid/DataGridComboBoxColumn.cs | 16 +- .../DataGrid/DataGridDataConnection.cs | 10 +- .../DataGrid/DataGridDetailsPresenter.cs | 8 +- .../DataGrid/DataGridDisplayData.cs | 10 +- .../DataGrid/DataGridError.cs | 2 +- .../DataGrid/DataGridFillerColumn.cs | 6 +- .../DataGrid/DataGridFrozenGrid.cs | 4 +- .../DataGrid/DataGridInteractionInfo.cs | 2 +- .../DataGridPreparingCellForEditEventArgs.cs | 2 +- .../DataGrid/DataGridRow.cs | 14 +- .../DataGrid/DataGridRowDetailsEventArgs.cs | 2 +- .../DataGrid/DataGridRowGroupHeader.cs | 16 +- .../DataGrid/DataGridRowGroupInfo.cs | 4 +- .../DataGrid/DataGridRowHeader.cs | 10 +- .../DataGrid/DataGridRows.cs | 10 +- .../DataGrid/DataGridRowsPresenter.cs | 16 +- .../DataGridSelectedItemsCollection.cs | 2 +- .../DataGrid/DataGridTemplateColumn.cs | 2 +- .../DataGrid/DataGridTextColumn.cs | 12 +- .../DataGrid/DataGridValueConverter.cs | 2 +- ...ft.Toolkit.Uwp.UI.Controls.DataGrid.csproj | 2 +- .../Properties/Resources.Designer.cs | 5 +- .../Utilities/BindingInfo.cs | 4 +- .../Utilities/Extensions.cs | 16 +- .../Utilities/IndexToValueTable.cs | 4 +- .../Utilities/KeyboardHelper.cs | 2 +- .../Utilities/TypeHelper.cs | 4 +- .../Utilities/ValidationUtil.cs | 10 +- .../Utilities/VisualStates.cs | 4 +- .../Utilities/WeakEventListener.cs | 2 +- .../AdaptiveGridViewMetadata.cs | 44 ++-- .../BladeItemMetadata.cs | 42 ++-- .../BladeViewMetadata.cs | 50 ++--- .../CarouselMetadata.cs | 34 ++-- .../Common/MetadataRegistrationBase.cs | 2 +- .../DropShadowPanelMetadata.cs | 62 +++--- .../ExpanderMetadata.cs | 26 +-- .../GridSplitterMetadata.cs | 34 ++-- .../HeaderedTextBlockMetadata.cs | 42 ++-- .../ImageExMetadata.cs | 14 +- .../InAppNotificationMetadata.cs | 14 +- .../LayoutTransitionControlMetadata.cs | 16 +- .../LoadingMetadata.cs | 14 +- .../MarkdownTextBlockMetadata.cs | 86 ++++---- .../MasterDetailsViewMetadata.cs | 52 ++--- .../MenuItemMetadata.cs | 56 +++--- .../MenuMetadata.cs | 32 +-- .../MetadataRegistration.cs | 8 +- ...soft.Toolkit.Uwp.UI.Controls.Design.csproj | 8 +- .../OrbitViewMetadata.cs | 34 ++-- .../RadialGaugeMetadata.cs | 58 +++--- .../RadialProgressBarMetadata.cs | 20 +- .../RangeSelectorMetadata.cs | 20 +- .../RotatorTileMetadata.cs | 30 +-- .../ScrollHeaderMetadata.cs | 14 +- .../TabViewItemMetadata.cs | 38 ++-- .../TabViewMetadata.cs | 64 +++--- .../TextToolbarMetadata.cs | 24 +-- .../TileControlMetadata.cs | 34 ++-- .../WrapPanelMetadata.cs | 30 +-- .../AadLogin/AadLogin.Events.cs | 2 +- .../AadLogin/AadLogin.Properties.cs | 6 +- .../AadLogin/AadLogin.cs | 6 +- ...osoft.Toolkit.Uwp.UI.Controls.Graph.csproj | 2 +- .../PeoplePicker/PeoplePicker.Events.cs | 8 +- .../PeoplePicker/PeoplePicker.Properties.cs | 4 +- .../PeoplePicker/PeoplePicker.cs | 6 +- .../PeopleSelectionChangedEventArgs.cs | 3 +- .../PlannerTaskItemSelector.cs | 4 +- .../PlannerTaskList/PlannerTaskList.Events.cs | 10 +- .../PlannerTaskList.Properties.cs | 2 +- .../PlannerTaskList/PlannerTaskList.cs | 4 +- .../PlannerTaskList/PlannerTaskViewModel.cs | 2 +- .../PlannerTaskList/SingleCalendarView.cs | 4 +- .../PowerBIEmbedded/PowerBIEmbedded.Events.cs | 6 +- .../PowerBIEmbedded.Properties.cs | 4 +- .../PowerBIEmbedded/PowerBIEmbedded.cs | 14 +- .../PowerBIEmbedded/PowerBIEmbedded.xaml | 5 +- .../ProfileCard/ProfileCard.Events.cs | 4 +- .../ProfileCard/ProfileCard.Properties.cs | 6 +- .../ProfileCard/ProfileCard.cs | 4 +- .../ProfileCard/ProfileCardItem.cs | 2 +- .../ProfileDisplayModeTemplateSelector.cs | 4 +- .../DriveItemIconConverter.cs | 2 +- .../SharePointFileList.Events.cs | 8 +- .../SharePointFileList.Properties.cs | 4 +- .../SharePointFileList/SharePointFileList.cs | 4 +- .../AdaptiveGridView.Properties.cs | 6 +- .../AdaptiveGridView/AdaptiveGridView.cs | 8 +- .../AdaptiveHeightValueConverter.cs | 8 +- .../BladeView/BladeItem.Events.cs | 2 +- .../BladeView/BladeItem.Properties.cs | 6 +- .../BladeView/BladeItem.cs | 6 +- .../BladeView/BladeView.Properties.cs | 4 +- .../BladeView/BladeView.cs | 4 +- .../CameraPreview/CameraPreview.Properties.cs | 4 +- .../CameraPreview/CameraPreview.cs | 35 ++-- .../CameraPreview/CameraPreview.xaml | 4 +- .../Carousel/Carousel.cs | 12 +- .../Carousel/CarouselItem.cs | 8 +- .../Carousel/CarouselPanel.cs | 18 +- .../ControlHelpers.Composition.cs | 6 +- .../ControlHelpers.Math.cs | 58 ++++++ .../DockPanel/DockPanel.Properties.cs | 2 +- .../DockPanel/DockPanel.cs | 4 +- .../DropShadowPanel.Properties.cs | 7 +- .../DropShadowPanel/DropShadowPanel.cs | 11 +- .../Expander/Expander.Properties.cs | 2 +- .../Expander/Expander.cs | 10 +- .../Eyedropper/Eyedropper.Logic.cs | 8 +- .../Eyedropper/Eyedropper.Properties.cs | 4 +- .../Eyedropper/Eyedropper.cs | 16 +- .../EyedropperToolButton.Properties.cs | 4 +- .../Eyedropper/EyedropperToolButton.cs | 6 +- .../GridSplitter/GridSplitter.Events.cs | 12 +- .../GridSplitter/GridSplitter.Helper.cs | 12 +- .../GridSplitter/GridSplitter.Options.cs | 6 +- .../GridSplitter/GridSplitter.cs | 11 +- .../GridSplitter/GripperHoverWrapper.cs | 4 +- .../HeaderedContentControl.cs | 4 +- .../HeaderedItemsControl.cs | 4 +- .../HeaderedTextBlock.Properties.cs | 4 +- .../HeaderedTextBlock/HeaderedTextBlock.cs | 6 +- .../ImageCropper/ImageCropper.Animations.cs | 38 +++- .../ImageCropper/ImageCropper.Events.cs | 6 +- .../ImageCropper/ImageCropper.Helpers.cs | 4 +- .../ImageCropper/ImageCropper.Logic.cs | 10 +- .../ImageCropper/ImageCropper.Properties.cs | 6 +- .../ImageCropper/ImageCropper.cs | 12 +- .../ImageCropper/ImageCropperThumb.cs | 8 +- .../ImageEx/ImageEx.Members.cs | 6 +- .../ImageEx/ImageExBase.Members.cs | 10 +- .../ImageEx/ImageExBase.Placeholder.cs | 4 +- .../ImageEx/ImageExBase.Source.cs | 8 +- .../ImageEx/ImageExBase.cs | 6 +- .../InAppNotification.AttachedProperties.cs | 19 +- .../InAppNotification.Events.cs | 6 +- .../InAppNotification.Properties.cs | 2 +- .../InAppNotification/InAppNotification.cs | 4 +- .../InAppNotification/NotificationOptions.cs | 2 +- .../Controls/InfiniteCanvasTextBox.cs | 4 +- ...initeCanvasVirtualDrawingSurface.Render.cs | 20 +- .../InfiniteCanvasVirtualDrawingSurface.cs | 31 ++- .../InfiniteCanvas/Drawables/InkDrawable.cs | 2 +- .../InfiniteCanvas/Drawables/TextDrawable.cs | 2 +- .../InfiniteCanvas/InfiniteCanvas.Events.cs | 11 +- .../InfiniteCanvas/InfiniteCanvas.TextBox.cs | 10 +- .../InfiniteCanvas/InfiniteCanvas.cs | 38 ++-- .../InfiniteCanvas/InfiniteCanvas.xaml | 4 +- .../InlineCollectionWrapper.cs | 12 +- .../LayoutTransformControl.Properties.cs | 6 +- .../LayoutTransformControl.cs | 12 +- .../PropertyChangeEventSource.cs | 4 +- .../Loading/Loading.Properties.cs | 4 +- .../Loading/Loading.cs | 4 +- .../CodeBlockResolvingEventArgs.cs | 2 +- .../ImageResolvingEventArgs.cs | 2 +- .../MarkdownTextBlock.Dimensions.cs | 4 +- .../MarkdownTextBlock.Events.cs | 8 +- .../MarkdownTextBlock.Methods.cs | 10 +- .../MarkdownTextBlock.Properties.cs | 8 +- .../MarkdownTextBlock/MarkdownTextBlock.cs | 4 +- .../Render/ICodeBlockResolver.cs | 2 +- .../Render/IImageResolver.cs | 2 +- .../MarkdownTextBlock/Render/ILinkRegister.cs | 4 +- .../Render/InlineRenderContext.cs | 2 +- .../Render/MarkdownRenderer.Blocks.cs | 22 +- .../Render/MarkdownRenderer.Dimensions.cs | 4 +- .../Render/MarkdownRenderer.Inlines.cs | 12 +- .../Render/MarkdownRenderer.Properties.cs | 6 +- .../Render/MarkdownRenderer.cs | 10 +- .../MarkdownTextBlock/Render/MarkdownTable.cs | 8 +- .../MarkdownTextBlock/Render/RenderContext.cs | 2 +- .../UIElementCollectionRenderContext.cs | 2 +- .../MasterDetailsView.Events.cs | 2 +- .../MasterDetailsView.Properties.cs | 6 +- .../MasterDetailsView/MasterDetailsView.cs | 10 +- .../Menu/Menu.Events.cs | 6 +- .../Menu/Menu.Extensions.cs | 2 +- .../Menu/Menu.Logic.cs | 8 +- .../Menu/Menu.cs | 6 +- .../Menu/MenuItem.cs | 12 +- .../Microsoft.Toolkit.Uwp.UI.Controls.csproj | 7 +- .../OrbitView/OrbitView.cs | 18 +- .../OrbitView/OrbitViewDataItem.cs | 6 +- .../OrbitView/OrbitViewElementProperties.cs | 2 +- .../OrbitView/OrbitViewItem.cs | 8 +- .../OrbitView/OrbitViewPanel.cs | 4 +- .../RadialGauge/RadialGauge.cs | 16 +- .../RadialGauge/RadialGaugeAutomationPeer.cs | 4 +- .../RadialProgressBar/RadialProgressBar.cs | 6 +- .../RangeSelector/RangeSelector.cs | 10 +- .../RemoteDevicePicker/RemoteDevicePicker.cs | 6 +- .../RemoteSystemKindToSymbolConverter.cs | 2 +- .../RotatorTile/RotatorTile.cs | 16 +- .../ScrollHeader/ScrollHeader.cs | 7 +- .../StaggeredPanel/StaggeredPanel.cs | 4 +- .../TabView/TabView.HeaderLayout.cs | 8 +- .../TabView/TabView.ItemSources.cs | 4 +- .../TabView/TabView.Properties.cs | 4 +- .../TabView/TabView.cs | 8 +- .../TabView/TabViewItem.Properties.cs | 4 +- .../TabView/TabViewItem.cs | 8 +- .../TabView/TabWidthMode.cs | 2 +- .../TextToolbar/EditorChangedArgs.cs | 2 +- .../TextToolbar/Formats/Formatter.cs | 4 +- .../Formats/MarkDown/MarkDownFormatter.cs | 16 +- .../Formats/RichText/RichTextFormatter.cs | 2 +- .../TextToolbar/ShortcutKeyRequestArgs.cs | 2 +- .../TextToolbar/Symbols/Symbol.cs | 10 +- .../TextToolbar/TextToolbar.Events.cs | 8 +- .../TextToolbar/TextToolbar.Methods.cs | 4 +- .../TextToolbar/TextToolbar.Properties.cs | 4 +- .../TextToolbar/TextToolbar.cs | 6 +- .../ToolbarFormatActiveConverter.cs | 2 +- .../Common/CommonButtons.Events.cs | 6 +- .../ToolbarItems/Common/CommonButtons.cs | 8 +- .../TextToolbar/ToolbarItems/DefaultButton.cs | 2 +- .../TextToolbar/ToolbarItems/IToolbarItem.cs | 2 +- .../TextToolbar/ToolbarItems/ToolbarButton.cs | 6 +- .../ToolbarItems/ToolbarSeparator.cs | 2 +- .../TileControl/TileControl.cs | 33 ++- .../TokenizingTextBox.Events.cs | 2 +- .../TokenizingTextBox.Properties.cs | 4 +- .../TokenizingTextBox/TokenizingTextBox.cs | 7 +- .../TokenizingTextBoxItem.cs | 6 +- .../UniformGrid/UniformGrid.Helpers.cs | 4 +- .../UniformGrid/UniformGrid.Properties.cs | 6 +- .../UniformGrid/UniformGrid.cs | 6 +- .../WrapPanel/WrapPanel.Data.cs | 4 +- .../WrapPanel/WrapPanel.cs | 4 +- .../Brushes/BackdropBlurBrush.cs | 8 +- .../Brushes/BackdropGammaTransferBrush.cs | 9 +- .../Brushes/BackdropInvertBrush.cs | 9 +- .../Brushes/BackdropSaturationBrush.cs | 9 +- .../Brushes/BackdropSepiaBrush.cs | 9 +- .../Brushes/CanvasBrushBase.cs | 16 +- .../Brushes/ImageBlendBrush.cs | 12 +- .../Brushes/RadialGradientBrush.Properties.cs | 4 +- .../Brushes/RadialGradientBrush.cs | 7 +- .../Brushes/RadialGradientBrushInterop.cs | 2 +- .../Microsoft.Toolkit.Uwp.UI.Media.csproj | 2 +- .../AdvancedCollectionView.Events.cs | 2 +- .../AdvancedCollectionView.cs | 5 +- .../IAdvancedCollectionView.cs | 2 +- .../Behaviors/BehaviorBase.cs | 2 +- .../Behaviors/ViewportBehavior.cs | 6 +- Microsoft.Toolkit.Uwp.UI/Cache/CacheBase.cs | 4 +- Microsoft.Toolkit.Uwp.UI/Cache/ImageCache.cs | 2 +- .../Converters/BoolNegationConverter.cs | 2 +- .../Converters/BoolToObjectConverter.cs | 4 +- .../Converters/BoolToVisibilityConverter.cs | 2 +- .../CollectionVisibilityConverter.cs | 2 +- .../Converters/ConverterTools.cs | 2 +- .../Converters/DoubleToObjectConverter.cs | 4 +- .../Converters/DoubleToVisibilityConverter.cs | 4 +- .../EmptyObjectToObjectConverter.cs | 4 +- .../FileSizeToFriendlyStringConverter.cs | 2 +- .../Converters/FormatStringConverter.cs | 2 +- .../ResourceNameToResourceStringConverter.cs | 2 +- .../Converters/StringFormatConverter.cs | 2 +- .../Converters/StringVisibilityConverter.cs | 2 +- .../Converters/VisibilityToBoolConverter.cs | 4 +- .../ApplicationViewExtensions.cs | 3 +- .../Extensions/DispatcherTimerExtensions.cs | 2 +- .../FrameworkElementExtensions.ActualSize.cs | 10 +- ...eworkElementExtensions.RelativeAncestor.cs | 4 +- .../Hyperlink/HyperlinkExtensions.cs | 44 ++-- .../ListViewBase/ListViewExtensions.cs | 82 ++++---- .../Extensions/Markup/NullableBool.cs | 4 +- .../Extensions/Markup/OnDevice.cs | 4 +- .../Extensions/Media/MatrixExtensions.cs | 59 +++++- .../Extensions/Media/MatrixHelperEx.cs | 8 +- .../Media/RotateTransformExtensions.cs | 4 +- .../Media/ScaleTransformExtensions.cs | 4 +- .../Media/SkewTransformExtensions.cs | 4 +- .../Media/TranslateTransformExtensions.cs | 4 +- .../Extensions/Mouse/Mouse.cs | 4 +- ...llViewerExtensions.MiddleClickScrolling.cs | 6 +- .../ScrollViewerExtensions.Properties.cs | 32 +-- .../ScrollViewer/ScrollViewerExtensions.cs | 8 +- .../StatusBar/StatusBarExtensions.cs | 7 +- .../SurfaceDialTextbox/SurfaceDialTextbox.cs | 6 +- .../TextBoxMask/TextBoxMask.Properties.cs | 4 +- .../Extensions/TextBoxMask/TextBoxMask.cs | 4 +- .../TextBoxRegEx/TextBoxRegex.Properties.cs | 4 +- .../Extensions/TextBoxRegEx/TextBoxRegex.cs | 4 +- .../Extensions/TitleBar/TitleBarExtensions.cs | 3 +- .../Extensions/Tree/LogicalTree.cs | 6 +- .../Extensions/Tree/VisualTree.cs | 4 +- .../Extensions/Visual/VisualExtensions.cs | 9 +- .../Extensions/WebView/WebViewExtensions.cs | 152 +++++++------- .../Helpers/BindableValueHolder.cs | 4 +- .../Helpers/DependencyPropertyWatcher.cs | 10 +- .../Helpers/ThemeListener.cs | 2 +- .../Microsoft.Toolkit.Uwp.UI.csproj | 4 +- Microsoft.Toolkit.Uwp/Helpers/ColorHelper.cs | 2 +- .../CollectionFormingDeepLinkParser.cs | 6 +- .../Helpers/DeepLinkParser/DeepLinkParser.cs | 10 +- .../QueryParameterCollection.cs | 3 +- .../Helpers/DispatcherHelper.cs | 190 +++++++++--------- .../Helpers/PrintHelper/PrintHelper.cs | 19 +- .../PrintHelper/PrintHelperStateBag.cs | 2 +- .../Helpers/WeakEventListener.cs | 2 +- .../IncrementalLoadingCollection.cs | 8 +- .../Microsoft.Toolkit.Uwp.csproj | 2 +- .../Test_AdaptiveHeightValueConverter.cs | 4 +- .../Converters/Test_BoolToObjectConverter.cs | 8 +- .../Test_EmptyCollectionToObjectConverter.cs | 8 +- .../Test_EmptyStringToObjectConverter.cs | 8 +- .../Helpers/ObjectWithNullableBoolProperty.cs | 4 +- .../Test_NullableBoolMarkupExtension.cs | 6 +- UnitTests/Markdown/TestBase.cs | 2 +- .../Controls/Test_UniformGrid_AutoLayout.cs | 6 +- .../Controls/Test_UniformGrid_Dimensions.cs | 4 +- .../Test_UniformGrid_RowColDefinitions.cs | 4 +- UnitTests/UnitTestApp.xaml.cs | 6 +- .../UnitTests.Notifications.NetCore.csproj | 6 +- .../UnitTestApp.xaml.cs | 6 +- .../UnitTestApp.xaml.cs | 14 +- UnitTests/UnitTests.csproj | 8 +- build/build.cake | 27 ++- version.json | 2 +- 615 files changed, 3383 insertions(+), 3042 deletions(-) create mode 100644 Microsoft.Toolkit.Uwp.Input.GazeInteraction/Microsoft.Toolkit.UWP.Input.GazeInteraction.def create mode 100644 Microsoft.Toolkit.Uwp.Input.GazeInteraction/XamlMetaDataProvider.cpp create mode 100644 Microsoft.Toolkit.Uwp.Input.GazeInteraction/XamlMetaDataProvider.idl create mode 100644 Microsoft.Toolkit.Uwp.Input.GazeInteraction/packages.config diff --git a/.gitignore b/.gitignore index ed0e87e25e0..55cee75b746 100644 --- a/.gitignore +++ b/.gitignore @@ -225,3 +225,6 @@ msbuild.binlog *.project.lock.json /build/tools/** !/build/tools/packages.config + +# Files generated by the VS build +**/Generated Files/** \ No newline at end of file diff --git a/Directory.Build.props b/Directory.Build.props index 4f6d23454b8..67bc0bc4414 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -15,9 +15,10 @@ $(MSBuildProjectName.Contains('Test')) $(MSBuildProjectName.Contains('Uwp')) $(MSBuildProjectName.Contains('Sample')) - 17763 - 16299 + 18362 + 17134 $(MSBuildThisFileDirectory)bin\nupkg + CS8002;CS8305 @@ -74,16 +75,22 @@ - + - - - $(NoWarn);8002 + true + WinUI-Alpha-Projects-Don-t-Use-SDK-Xaml-Tools + + + + + 3.0.0-alpha.191101.0 + + diff --git a/Directory.Build.targets b/Directory.Build.targets index ced73e00dd3..52bf508d6ab 100644 --- a/Directory.Build.targets +++ b/Directory.Build.targets @@ -1,6 +1,6 @@ - + 10.0.$(DefaultTargetPlatformVersion).0 diff --git a/GazeInputTest/App.xaml.cs b/GazeInputTest/App.xaml.cs index 8628a0a8e05..b96689f18df 100644 --- a/GazeInputTest/App.xaml.cs +++ b/GazeInputTest/App.xaml.cs @@ -6,9 +6,9 @@ using System; using Windows.ApplicationModel; using Windows.ApplicationModel.Activation; -using Windows.UI.Xaml; -using Windows.UI.Xaml.Controls; -using Windows.UI.Xaml.Navigation; +using Microsoft.UI.Xaml; +using Microsoft.UI.Xaml.Controls; +using Microsoft.UI.Xaml.Navigation; namespace GazeInputTest { diff --git a/GazeInputTest/MainPage.xaml.cs b/GazeInputTest/MainPage.xaml.cs index 3bb6d9cdf15..daf05bf62ea 100644 --- a/GazeInputTest/MainPage.xaml.cs +++ b/GazeInputTest/MainPage.xaml.cs @@ -6,9 +6,9 @@ using System; using Windows.ApplicationModel.Core; using Windows.UI.Core; -using Windows.UI.ViewManagement; -using Windows.UI.Xaml; -using Windows.UI.Xaml.Controls; +using Microsoft.UI.ViewManagement; +using Microsoft.UI.Xaml; +using Microsoft.UI.Xaml.Controls; namespace GazeInputTest { diff --git a/Microsoft.Toolkit.Services/Core/DataProviderBase.cs b/Microsoft.Toolkit.Services/Core/DataProviderBase.cs index ff8f320af42..ed8611b474c 100644 --- a/Microsoft.Toolkit.Services/Core/DataProviderBase.cs +++ b/Microsoft.Toolkit.Services/Core/DataProviderBase.cs @@ -32,7 +32,7 @@ public DataProviderBase() /// The zero-based index of the page that corresponds to the items to retrieve. /// Parser to use for results. /// Strong typed list of results. - [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Justification = "This is an async method, so nesting generic types is necessary.")] + [global::System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Justification = "This is an async method, so nesting generic types is necessary.")] public async Task> LoadDataAsync(TConfig config, int maxRecords, int pageIndex, Parsers.IParser parser) where TSchema : Parsers.SchemaBase { diff --git a/Microsoft.Toolkit.Services/Microsoft.Toolkit.Services.csproj b/Microsoft.Toolkit.Services/Microsoft.Toolkit.Services.csproj index 14436ee90ea..4bcca1c0ecd 100644 --- a/Microsoft.Toolkit.Services/Microsoft.Toolkit.Services.csproj +++ b/Microsoft.Toolkit.Services/Microsoft.Toolkit.Services.csproj @@ -1,7 +1,7 @@  - uap10.0.16299;netstandard2.0;NET462 + uap10.0.17134;netstandard2.0;NET462 Windows Community Toolkit .NET Standard Services This .NET standard library enables access to different data sources such as Microsoft Graph, OneDrive, Twitter, Microsoft Translator, and LinkedIn. It is part of the Windows Community Toolkit. @@ -16,7 +16,7 @@ CS8002 - + $(DefineConstants);WINRT @@ -32,7 +32,7 @@ - + @@ -69,7 +69,7 @@ - + diff --git a/Microsoft.Toolkit.Services/Services/LinkedIn/LinkedInDataProvider.cs b/Microsoft.Toolkit.Services/Services/LinkedIn/LinkedInDataProvider.cs index 73e84a59167..b9a3d71d6e0 100644 --- a/Microsoft.Toolkit.Services/Services/LinkedIn/LinkedInDataProvider.cs +++ b/Microsoft.Toolkit.Services/Services/LinkedIn/LinkedInDataProvider.cs @@ -210,7 +210,7 @@ public async Task> GetDataAsync(LinkedInDataConfig return parser.Parse(data); } - throw new RequestFailedException((System.Net.HttpStatusCode)response.StatusCode, data); + throw new RequestFailedException((global::System.Net.HttpStatusCode)response.StatusCode, data); } } } diff --git a/Microsoft.Toolkit.Services/Services/MicrosoftGraph/Platform/Uwp/MicrosoftGraphUserServicePhotos.cs b/Microsoft.Toolkit.Services/Services/MicrosoftGraph/Platform/Uwp/MicrosoftGraphUserServicePhotos.cs index f27085e5d63..7e864bc80cb 100644 --- a/Microsoft.Toolkit.Services/Services/MicrosoftGraph/Platform/Uwp/MicrosoftGraphUserServicePhotos.cs +++ b/Microsoft.Toolkit.Services/Services/MicrosoftGraph/Platform/Uwp/MicrosoftGraphUserServicePhotos.cs @@ -36,7 +36,7 @@ public async Task GetPhotoAsync(CancellationToken cancellationToken) IRandomAccessStream windowsPhotoStream = null; try { - System.IO.Stream photo = null; + global::System.IO.Stream photo = null; photo = await _graphProvider.Me.Photo.Content.Request().GetAsync(cancellationToken); if (photo != null) { diff --git a/Microsoft.Toolkit.Services/Services/MicrosoftTranslator/TranslatorService.cs b/Microsoft.Toolkit.Services/Services/MicrosoftTranslator/TranslatorService.cs index ac3680b266a..f6867943253 100644 --- a/Microsoft.Toolkit.Services/Services/MicrosoftTranslator/TranslatorService.cs +++ b/Microsoft.Toolkit.Services/Services/MicrosoftTranslator/TranslatorService.cs @@ -255,7 +255,7 @@ private HttpRequestMessage CreateHttpRequest(string uriString, HttpMethod method if (content != null) { var jsonRequest = JsonConvert.SerializeObject(content); - var requestContent = new StringContent(jsonRequest, System.Text.Encoding.UTF8, JsonMediaType); + var requestContent = new StringContent(jsonRequest, global::System.Text.Encoding.UTF8, JsonMediaType); request.Content = requestContent; } diff --git a/Microsoft.Toolkit.Services/Services/OneDrive/Platform/Uwp/OneDriveStorageFilePlatform.cs b/Microsoft.Toolkit.Services/Services/OneDrive/Platform/Uwp/OneDriveStorageFilePlatform.cs index a71c9bccdfb..bad17fc496f 100644 --- a/Microsoft.Toolkit.Services/Services/OneDrive/Platform/Uwp/OneDriveStorageFilePlatform.cs +++ b/Microsoft.Toolkit.Services/Services/OneDrive/Platform/Uwp/OneDriveStorageFilePlatform.cs @@ -97,7 +97,7 @@ public OneDriveStorageFilePlatform( IRandomAccessStream contentStream = null; try { - System.IO.Stream content = null; + global::System.IO.Stream content = null; content = await ((IDriveItemRequestBuilder)_oneDriveStorageFile.RequestBuilder).Content.Request().GetAsync(cancellationToken).ConfigureAwait(false); if (content != null) { diff --git a/Microsoft.Toolkit.Uwp.Connectivity/BluetoothLEHelper/ObservableBluetoothLEDevice.cs b/Microsoft.Toolkit.Uwp.Connectivity/BluetoothLEHelper/ObservableBluetoothLEDevice.cs index b39312d417a..c1d111976d3 100644 --- a/Microsoft.Toolkit.Uwp.Connectivity/BluetoothLEHelper/ObservableBluetoothLEDevice.cs +++ b/Microsoft.Toolkit.Uwp.Connectivity/BluetoothLEHelper/ObservableBluetoothLEDevice.cs @@ -11,20 +11,20 @@ using System.Runtime.CompilerServices; using System.Threading; using System.Threading.Tasks; +using Microsoft.UI.Xaml.Media.Imaging; using Windows.ApplicationModel.Core; using Windows.Devices.Bluetooth; using Windows.Devices.Bluetooth.GenericAttributeProfile; using Windows.Devices.Enumeration; using Windows.UI.Core; -using Windows.UI.Xaml.Media.Imaging; namespace Microsoft.Toolkit.Uwp.Connectivity { /// /// Wrapper around to make it bindable. /// - /// - /// + /// + /// public class ObservableBluetoothLEDevice : INotifyPropertyChanged, IEquatable { /// diff --git a/Microsoft.Toolkit.Uwp.Connectivity/Microsoft.Toolkit.Uwp.Connectivity.csproj b/Microsoft.Toolkit.Uwp.Connectivity/Microsoft.Toolkit.Uwp.Connectivity.csproj index e1a7784b70c..4fd052af37d 100644 --- a/Microsoft.Toolkit.Uwp.Connectivity/Microsoft.Toolkit.Uwp.Connectivity.csproj +++ b/Microsoft.Toolkit.Uwp.Connectivity/Microsoft.Toolkit.Uwp.Connectivity.csproj @@ -1,7 +1,7 @@  - uap10.0.16299 + uap10.0.17134 Windows Community Toolkit Devices This library enables easier consumption of connectivity Devices/Peripherals and handle its connection to Windows devices. It contains BluetoothLE and Network connectivity helpers. UWP Toolkit Windows Devices Bluetooth BluetoothLE BLE Networking diff --git a/Microsoft.Toolkit.Uwp.DeveloperTools/AlignmentGrid/AlignmentGrid.cs b/Microsoft.Toolkit.Uwp.DeveloperTools/AlignmentGrid/AlignmentGrid.cs index 5981e6b2652..821c99efc97 100644 --- a/Microsoft.Toolkit.Uwp.DeveloperTools/AlignmentGrid/AlignmentGrid.cs +++ b/Microsoft.Toolkit.Uwp.DeveloperTools/AlignmentGrid/AlignmentGrid.cs @@ -2,10 +2,10 @@ // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. -using Windows.UI.Xaml; -using Windows.UI.Xaml.Controls; -using Windows.UI.Xaml.Media; -using Windows.UI.Xaml.Shapes; +using Microsoft.UI.Xaml; +using Microsoft.UI.Xaml.Controls; +using Microsoft.UI.Xaml.Media; +using Microsoft.UI.Xaml.Shapes; namespace Microsoft.Toolkit.Uwp.DeveloperTools { diff --git a/Microsoft.Toolkit.Uwp.DeveloperTools/FocusTracker/FocusTracker.cs b/Microsoft.Toolkit.Uwp.DeveloperTools/FocusTracker/FocusTracker.cs index 7aef4dc2fed..d26d42d4b39 100644 --- a/Microsoft.Toolkit.Uwp.DeveloperTools/FocusTracker/FocusTracker.cs +++ b/Microsoft.Toolkit.Uwp.DeveloperTools/FocusTracker/FocusTracker.cs @@ -7,13 +7,13 @@ using System.Linq; using System.Text; using System.Threading.Tasks; -using Windows.UI.Xaml; -using Windows.UI.Xaml.Automation; -using Windows.UI.Xaml.Controls; -using Windows.UI.Xaml.Controls.Primitives; -using Windows.UI.Xaml.Input; -using Windows.UI.Xaml.Media; -using Windows.UI.Xaml.Shapes; +using Microsoft.UI.Xaml; +using Microsoft.UI.Xaml.Automation; +using Microsoft.UI.Xaml.Controls; +using Microsoft.UI.Xaml.Controls.Primitives; +using Microsoft.UI.Xaml.Input; +using Microsoft.UI.Xaml.Media; +using Microsoft.UI.Xaml.Shapes; namespace Microsoft.Toolkit.Uwp.DeveloperTools { diff --git a/Microsoft.Toolkit.Uwp.DeveloperTools/Microsoft.Toolkit.Uwp.DeveloperTools.csproj b/Microsoft.Toolkit.Uwp.DeveloperTools/Microsoft.Toolkit.Uwp.DeveloperTools.csproj index 01eb4a5424a..244269f5220 100644 --- a/Microsoft.Toolkit.Uwp.DeveloperTools/Microsoft.Toolkit.Uwp.DeveloperTools.csproj +++ b/Microsoft.Toolkit.Uwp.DeveloperTools/Microsoft.Toolkit.Uwp.DeveloperTools.csproj @@ -1,7 +1,7 @@  - uap10.0.16299 + uap10.0.17134 Windows Community Toolkit Developer Tools This library provides XAML user controls and services to help developers build their app. It is part of the Windows Community Toolkit. diff --git a/Microsoft.Toolkit.Uwp.Input.GazeInteraction/DwellInvokedRoutedEventArgs.h b/Microsoft.Toolkit.Uwp.Input.GazeInteraction/DwellInvokedRoutedEventArgs.h index 7ef31be8bb5..9f3546af078 100644 --- a/Microsoft.Toolkit.Uwp.Input.GazeInteraction/DwellInvokedRoutedEventArgs.h +++ b/Microsoft.Toolkit.Uwp.Input.GazeInteraction/DwellInvokedRoutedEventArgs.h @@ -9,20 +9,22 @@ BEGIN_NAMESPACE_GAZE_INPUT /// This parameter is passed to the GazeElement::Invoked event and allows /// the application to prevent default invocation when the user dwells on a control /// -public ref class DwellInvokedRoutedEventArgs : public RoutedEventArgs +class DwellInvokedRoutedEventArgs : public RoutedEventArgs { public: /// /// The application should set this value to true to prevent invoking the control when the user dwells on a control /// - property bool Handled; - -internal: + bool Handled() { return _handled; } + void Handled(bool const& value) { _handled = value; } DwellInvokedRoutedEventArgs() { } + +private: + bool _handled; }; END_NAMESPACE_GAZE_INPUT \ No newline at end of file diff --git a/Microsoft.Toolkit.Uwp.Input.GazeInteraction/DwellProgressEventArgs.h b/Microsoft.Toolkit.Uwp.Input.GazeInteraction/DwellProgressEventArgs.h index 86c5b2ef5eb..87245331f0f 100644 --- a/Microsoft.Toolkit.Uwp.Input.GazeInteraction/DwellProgressEventArgs.h +++ b/Microsoft.Toolkit.Uwp.Input.GazeInteraction/DwellProgressEventArgs.h @@ -10,7 +10,7 @@ BEGIN_NAMESPACE_GAZE_INPUT /// /// This parameter is passed to the GazeElement.DwellProgressFeedback event. The event is fired to inform the application of the user's progress towards completing dwelling on a control /// -public ref class DwellProgressEventArgs : public RoutedEventArgs +class DwellProgressEventArgs : public RoutedEventArgs { public: @@ -29,7 +29,6 @@ public ref class DwellProgressEventArgs : public RoutedEventArgs /// property bool Handled; -internal: DwellProgressEventArgs(DwellProgressState state, TimeSpan elapsedDuration, TimeSpan triggerDuration) { _state = state; diff --git a/Microsoft.Toolkit.Uwp.Input.GazeInteraction/DwellProgressState.h b/Microsoft.Toolkit.Uwp.Input.GazeInteraction/DwellProgressState.h index a60c0c54d9b..05032becd5f 100644 --- a/Microsoft.Toolkit.Uwp.Input.GazeInteraction/DwellProgressState.h +++ b/Microsoft.Toolkit.Uwp.Input.GazeInteraction/DwellProgressState.h @@ -8,7 +8,7 @@ BEGIN_NAMESPACE_GAZE_INPUT /// /// An enum that reflects the current state of progress towards dwell when a user is focused on a control /// -public enum class DwellProgressState +enum class DwellProgressState { /// /// User is not looking at the control diff --git a/Microsoft.Toolkit.Uwp.Input.GazeInteraction/GazeCursor.cpp b/Microsoft.Toolkit.Uwp.Input.GazeInteraction/GazeCursor.cpp index b8498d2dc22..6d25a41f290 100644 --- a/Microsoft.Toolkit.Uwp.Input.GazeInteraction/GazeCursor.cpp +++ b/Microsoft.Toolkit.Uwp.Input.GazeInteraction/GazeCursor.cpp @@ -3,76 +3,79 @@ #include "pch.h" #include "GazeCursor.h" +#include + +using namespace winrt::Microsoft::UI::Xaml::Media; BEGIN_NAMESPACE_GAZE_INPUT GazeCursor::GazeCursor() { - _gazePopup = ref new Popup(); - _gazePopup->IsHitTestVisible = false; + _gazePopup = Popup(); + _gazePopup.IsHitTestVisible = false; - auto gazeCursor = ref new Shapes::Ellipse(); - gazeCursor->Fill = ref new SolidColorBrush(Colors::IndianRed); - gazeCursor->VerticalAlignment = Windows::UI::Xaml::VerticalAlignment::Top; - gazeCursor->HorizontalAlignment = Windows::UI::Xaml::HorizontalAlignment::Left; - gazeCursor->Width = 2 * CursorRadius; - gazeCursor->Height = 2 * CursorRadius; - gazeCursor->Margin = Thickness(-CursorRadius, -CursorRadius, 0, 0); - gazeCursor->IsHitTestVisible = false; + auto gazeCursor = Shapes::Ellipse(); + gazeCursor.Fill = SolidColorBrush(Colors::IndianRed()); + gazeCursor.VerticalAlignment = winrt::Microsoft::UI::Xaml::VerticalAlignment::Top; + gazeCursor.HorizontalAlignment = winrt::Microsoft::UI::Xaml::HorizontalAlignment::Left; + gazeCursor.Width = 2 * CursorRadius(); + gazeCursor.Height = 2 * CursorRadius(); + gazeCursor.Margin = ThicknessHelper::FromLengths(-CursorRadius(), -CursorRadius(), 0, 0); + gazeCursor.IsHitTestVisible = false; - _gazePopup->Child = gazeCursor; + _gazePopup.Child = gazeCursor; } -void GazeCursor::CursorRadius::set(int value) +void GazeCursor::CursorRadius(int const& value) { _cursorRadius = value; - auto gazeCursor = CursorElement; + auto gazeCursor = CursorElement(); if (gazeCursor != nullptr) { - gazeCursor->Width = 2 * _cursorRadius; - gazeCursor->Height = 2 * _cursorRadius; - gazeCursor->Margin = Thickness(-_cursorRadius, -_cursorRadius, 0, 0); + gazeCursor.Width = 2 * _cursorRadius; + gazeCursor.Height = 2 * _cursorRadius; + gazeCursor.Margin = ThicknessHelper::FromLengths(-_cursorRadius, -_cursorRadius, 0, 0); } } -void GazeCursor::IsCursorVisible::set(bool value) +void GazeCursor::IsCursorVisible(bool const& value) { _isCursorVisible = value; SetVisibility(); } -void GazeCursor::IsGazeEntered::set(bool value) +void GazeCursor::IsGazeEntered(bool const& value) { _isGazeEntered = value; SetVisibility(); } -void GazeCursor::LoadSettings(ValueSet^ settings) +void GazeCursor::LoadSettings(ValueSet const& settings) { - if (settings->HasKey("GazeCursor.CursorRadius")) + if (settings.HasKey(L"GazeCursor.CursorRadius")) { - CursorRadius = (int)(settings->Lookup("GazeCursor.CursorRadius")); + CursorRadius(winrt::unbox_value(settings.Lookup(L"GazeCursor.CursorRadius"))); } - if (settings->HasKey("GazeCursor.CursorVisibility")) + if (settings.HasKey(L"GazeCursor.CursorVisibility")) { - IsCursorVisible = (bool)(settings->Lookup("GazeCursor.CursorVisibility")); + IsCursorVisible((bool)(settings.Lookup(L"GazeCursor.CursorVisibility"))); } } void GazeCursor::SetVisibility() { auto isOpen = _isCursorVisible && _isGazeEntered; - if (_gazePopup->IsOpen != isOpen) + if (_gazePopup.IsOpen != isOpen) { - _gazePopup->IsOpen = isOpen; + _gazePopup.IsOpen = isOpen; } else if (isOpen) { - auto topmost = VisualTreeHelper::GetOpenPopups(Window::Current)->First()->Current; + auto topmost = VisualTreeHelper::GetOpenPopups(Window::Current()).First().Current; if (_gazePopup != topmost) { - _gazePopup->IsOpen = false; - _gazePopup->IsOpen = true; + _gazePopup.IsOpen = false; + _gazePopup.IsOpen = true; } } } diff --git a/Microsoft.Toolkit.Uwp.Input.GazeInteraction/GazeCursor.h b/Microsoft.Toolkit.Uwp.Input.GazeInteraction/GazeCursor.h index db92c5a229d..173fbfa9883 100644 --- a/Microsoft.Toolkit.Uwp.Input.GazeInteraction/GazeCursor.h +++ b/Microsoft.Toolkit.Uwp.Input.GazeInteraction/GazeCursor.h @@ -3,86 +3,56 @@ #pragma once -using namespace Windows::Foundation::Collections; -using namespace Windows::UI; -using namespace Windows::UI::Xaml::Controls; -using namespace Windows::UI::Xaml::Controls::Primitives; +using namespace winrt::Windows::Foundation::Collections; +using namespace winrt::Microsoft::UI; +using namespace winrt::Microsoft::UI::Xaml; +using namespace winrt::Microsoft::UI::Xaml::Controls; +using namespace winrt::Microsoft::UI::Xaml::Controls::Primitives; BEGIN_NAMESPACE_GAZE_INPUT -private ref class GazeCursor sealed +class GazeCursor sealed { private: - const int DEFAULT_CURSOR_RADIUS = 5; - const bool DEFAULT_CURSOR_VISIBILITY = true; + const int DEFAULT_CURSOR_RADIUS = 5; + const bool DEFAULT_CURSOR_VISIBILITY = true; public: - void LoadSettings(ValueSet^ settings); - property int CursorRadius - { - int get() { return _cursorRadius; } - void set(int value); - } - - property bool IsCursorVisible - { - bool get() { return _isCursorVisible; } - void set(bool value); - } - - property bool IsGazeEntered - { - bool get() { return _isGazeEntered; } - void set(bool value); - } - - property Point Position - { - Point get() - { - return _cursorPosition; - } - - void set(Point value) - { - _cursorPosition = value; - _gazePopup->HorizontalOffset = value.X; - _gazePopup->VerticalOffset = value.Y; - SetVisibility(); - } - } - - property UIElement^ PopupChild - { - UIElement^ get() - { - return _gazePopup->Child; - } - void set(UIElement^ value) - { - _gazePopup->Child = value; - } - } + void LoadSettings(ValueSet const& settings); + int CursorRadius() { return _cursorRadius; } + void CursorRadius(int const& value); + + bool IsCursorVisible() { return _isCursorVisible; } + void IsCursorVisible(bool const& value); + + bool IsGazeEntered() { return _isGazeEntered; } + void IsGazeEntered(bool const& value) { _isGazeEntered = value; } - property FrameworkElement^ CursorElement + Point Position() { return _cursorPosition; } + void Position(Point const& value) { - FrameworkElement^ get() - { - return dynamic_cast(_gazePopup->Child); - } + _cursorPosition = value; + _gazePopup.HorizontalOffset = value.X; + _gazePopup.VerticalOffset = value.Y; + SetVisibility(); } -internal: - GazeCursor(); + UIElement PopupChild() { return _gazePopup.Child; }; + void PopupChild(UIElement value) { _gazePopup.Child = value; } + + + FrameworkElement CursorElement() { return _gazePopup.Child; } + + GazeCursor(); private: - void SetVisibility(); + void SetVisibility(); - Popup^ _gazePopup; - Point _cursorPosition = {}; - int _cursorRadius = DEFAULT_CURSOR_RADIUS; - bool _isCursorVisible = DEFAULT_CURSOR_VISIBILITY; - bool _isGazeEntered; + Popup _gazePopup; + Point _cursorPosition = {}; + int _cursorRadius = DEFAULT_CURSOR_RADIUS; + bool _isCursorVisible = DEFAULT_CURSOR_VISIBILITY; + bool _isGazeEntered; }; diff --git a/Microsoft.Toolkit.Uwp.Input.GazeInteraction/GazeElement.h b/Microsoft.Toolkit.Uwp.Input.GazeInteraction/GazeElement.h index cabd7df89d9..b4865f6dbef 100644 --- a/Microsoft.Toolkit.Uwp.Input.GazeInteraction/GazeElement.h +++ b/Microsoft.Toolkit.Uwp.Input.GazeInteraction/GazeElement.h @@ -7,48 +7,62 @@ #include "DwellProgressEventArgs.h" #include "StateChangedEventArgs.h" -using namespace Windows::Foundation; -using namespace Windows::UI::Xaml; +using namespace winrt::Windows::Foundation; +using namespace winrt::Microsoft::UI::Xaml; BEGIN_NAMESPACE_GAZE_INPUT /// /// Surrogate object attached to controls allowing subscription to per-control gaze events. /// -public ref class GazeElement sealed : public DependencyObject +class GazeElement sealed : public DependencyObject { public: /// /// This event is fired when the state of the user's gaze on a control has changed /// - event EventHandler^ StateChanged; + event EventHandler ; + + winrt::event_token StateChanged(Windows::Foundation::EventHandler const& handler) + { + return m_accountIsInDebitEvent.add(handler); + } + + void BankAccount::AccountIsInDebit(winrt::event_token const& token) noexcept + { + m_accountIsInDebitEvent.remove(token); + } /// /// This event is fired when the user completed dwelling on a control and the control is about to be invoked by default. This event is fired to give the application an opportunity to prevent default invocation /// - event EventHandler^ Invoked; + event EventHandler Invoked; /// /// This event is fired to inform the application of the progress towards dwell /// - event EventHandler^ DwellProgressFeedback; - -internal: + event EventHandler DwellProgressFeedback; - void RaiseStateChanged(Object^ sender, StateChangedEventArgs^ args) { StateChanged(sender, args); } + void RaiseStateChanged(Object sender, StateChangedEventArgs args) { StateChanged(sender, args); } - void RaiseInvoked(Object^ sender, DwellInvokedRoutedEventArgs^ args) + void RaiseInvoked(Object sender, DwellInvokedRoutedEventArgs args) { Invoked(sender, args); } - bool RaiseProgressFeedback(Object^ sender, DwellProgressState state, TimeSpan elapsedTime, TimeSpan triggerTime) + bool RaiseProgressFeedback(Object sender, DwellProgressState state, TimeSpan elapsedTime, TimeSpan triggerTime) { auto args = ref new DwellProgressEventArgs(state, elapsedTime, triggerTime); DwellProgressFeedback(sender, args); return args->Handled; } + +private: + winrt::event> m_stateChanged; + + winrt::event> m_invoked; + }; END_NAMESPACE_GAZE_INPUT \ No newline at end of file diff --git a/Microsoft.Toolkit.Uwp.Input.GazeInteraction/GazeEventArgs.h b/Microsoft.Toolkit.Uwp.Input.GazeInteraction/GazeEventArgs.h index 75f635d4aae..d3b36db3df3 100644 --- a/Microsoft.Toolkit.Uwp.Input.GazeInteraction/GazeEventArgs.h +++ b/Microsoft.Toolkit.Uwp.Input.GazeInteraction/GazeEventArgs.h @@ -5,11 +5,11 @@ BEGIN_NAMESPACE_GAZE_INPUT -public ref struct GazeEventArgs sealed +struct GazeEventArgs sealed { - property bool Handled; - property Point Location; - property TimeSpan Timestamp; + bool Handled; + Point Location; + TimeSpan Timestamp; GazeEventArgs() { diff --git a/Microsoft.Toolkit.Uwp.Input.GazeInteraction/GazeFeedbackPopupFactory.cpp b/Microsoft.Toolkit.Uwp.Input.GazeInteraction/GazeFeedbackPopupFactory.cpp index 8311455240f..fc2dc525171 100644 --- a/Microsoft.Toolkit.Uwp.Input.GazeInteraction/GazeFeedbackPopupFactory.cpp +++ b/Microsoft.Toolkit.Uwp.Input.GazeInteraction/GazeFeedbackPopupFactory.cpp @@ -7,37 +7,37 @@ BEGIN_NAMESPACE_GAZE_INPUT -Popup^ GazeFeedbackPopupFactory::Get() +Popup GazeFeedbackPopupFactory::Get() { - Popup^ popup; - ::Windows::UI::Xaml::Shapes::Rectangle^ rectangle; + Popup popup; + winrt::Microsoft::UI::Xaml::Shapes::Rectangle rectangle; - if (s_cache->Size != 0) + if (s_cache.size != 0) { - popup = s_cache->GetAt(0); - s_cache->RemoveAt(0); + popup = s_cache[0]; + s_cache.erase(s_cache.begin()); - rectangle = safe_cast<::Windows::UI::Xaml::Shapes::Rectangle^>(popup->Child); + rectangle = popup.Child; } else { - popup = ref new Popup(); + popup = Popup(); - rectangle = ref new ::Windows::UI::Xaml::Shapes::Rectangle(); - rectangle->IsHitTestVisible = false; + rectangle = winrt::Microsoft::UI::Xaml::Shapes::Rectangle(); + rectangle.IsHitTestVisible = false; - popup->Child = rectangle; + popup.Child = rectangle; } - rectangle->StrokeThickness = GazeInput::DwellStrokeThickness; + rectangle.StrokeThickness = GazeInput::DwellStrokeThickness; return popup; } -void GazeFeedbackPopupFactory::Return(Popup^ popup) +void GazeFeedbackPopupFactory::Return(Popup popup) { - popup->IsOpen = false; - s_cache->Append(popup); + popup.IsOpen = false; + s_cache.push_back(popup); } END_NAMESPACE_GAZE_INPUT \ No newline at end of file diff --git a/Microsoft.Toolkit.Uwp.Input.GazeInteraction/GazeFeedbackPopupFactory.h b/Microsoft.Toolkit.Uwp.Input.GazeInteraction/GazeFeedbackPopupFactory.h index 33b514e0b9e..9b0bf5b1013 100644 --- a/Microsoft.Toolkit.Uwp.Input.GazeInteraction/GazeFeedbackPopupFactory.h +++ b/Microsoft.Toolkit.Uwp.Input.GazeInteraction/GazeFeedbackPopupFactory.h @@ -3,22 +3,26 @@ #pragma once -using namespace Platform::Collections; -using namespace Windows::UI::Xaml::Controls::Primitives; +#include +#include + +using namespace std; +using namespace winrt::Windows::Foundation::Collections; +using namespace winrt::Microsoft::UI::Xaml::Controls::Primitives; BEGIN_NAMESPACE_GAZE_INPUT -private ref class GazeFeedbackPopupFactory +class GazeFeedbackPopupFactory { private: - Vector^ s_cache = ref new Vector(); + std::vector s_cache; public: - Popup^ Get(); + Popup Get(); - void Return(Popup^ popup); + void Return(Popup popup); }; END_NAMESPACE_GAZE_INPUT diff --git a/Microsoft.Toolkit.Uwp.Input.GazeInteraction/GazeHidParsers.cpp b/Microsoft.Toolkit.Uwp.Input.GazeInteraction/GazeHidParsers.cpp index 628016c41df..d06c361f36b 100644 --- a/Microsoft.Toolkit.Uwp.Input.GazeInteraction/GazeHidParsers.cpp +++ b/Microsoft.Toolkit.Uwp.Input.GazeInteraction/GazeHidParsers.cpp @@ -4,17 +4,17 @@ #include "pch.h" #include "GazeHidParsers.h" -using namespace Windows::Foundation::Collections; +using namespace winrt::Windows::Foundation::Collections; BEGIN_NAMESPACE_GAZE_INPUT namespace GazeHidParsers { - static HidNumericControlDescription ^ GetGazeUsageFromCollectionId( - GazeDevicePreview ^ gazeDevice, + static HidNumericControlDescription GetGazeUsageFromCollectionId( + GazeDevicePreview gazeDevice, uint16 childUsageId, uint16 parentUsageId) { - IVectorView ^ numericControls = gazeDevice->GetNumericControlDescriptions( + IVectorView numericControls = gazeDevice->GetNumericControlDescriptions( (USHORT)GazeHidUsages::UsagePage_EyeHeadTracker, childUsageId); for (unsigned int i = 0; i < numericControls->Size; i++) @@ -31,7 +31,7 @@ namespace GazeHidParsers { } #pragma region GazeHidPositionParser - GazeHidPositionParser::GazeHidPositionParser(GazeDevicePreview ^ gazeDevice, uint16 usage) + GazeHidPositionParser::GazeHidPositionParser(GazeDevicePreview gazeDevice, uint16 usage) { _usage = usage; @@ -42,9 +42,9 @@ namespace GazeHidParsers { _Z = GetGazeUsageFromCollectionId(gazeDevice, (USHORT)GazeHidUsages::Usage_PositionZ, _usage); } - GazeHidPosition^ GazeHidPositionParser::GetPosition(HidInputReport ^ report) + GazeHidPosition GazeHidPositionParser::GetPosition(HidInputReport report) { - GazeHidPosition^ result = nullptr; + GazeHidPosition result = nullptr; if (_X != nullptr && _Y != nullptr && @@ -79,7 +79,7 @@ namespace GazeHidParsers { #pragma endregion GazeHidPositionParser #pragma region GazeHidRotationParser - GazeHidRotationParser::GazeHidRotationParser(GazeDevicePreview ^ gazeDevice, uint16 usage) + GazeHidRotationParser::GazeHidRotationParser(GazeDevicePreview gazeDevice, uint16 usage) { _usage = usage; @@ -90,9 +90,9 @@ namespace GazeHidParsers { _Z = GetGazeUsageFromCollectionId(gazeDevice, (USHORT)GazeHidUsages::Usage_RotationZ, _usage); } - GazeHidPosition^ GazeHidRotationParser::GetRotation(HidInputReport ^ report) + GazeHidPosition GazeHidRotationParser::GetRotation(HidInputReport report) { - GazeHidPosition^ result = nullptr; + GazeHidPosition result = nullptr; if (_X != nullptr && _Y != nullptr && @@ -127,7 +127,7 @@ namespace GazeHidParsers { #pragma endregion GazeHidRotationParser #pragma region GazeHidPositionsParser - GazeHidPositionsParser::GazeHidPositionsParser(GazeDevicePreview ^ gazeDevice) + GazeHidPositionsParser::GazeHidPositionsParser(GazeDevicePreview gazeDevice) { _leftEyePositionParser = ref new GazeHidPositionParser(gazeDevice, (USHORT)GazeHidUsages::Usage_LeftEyePosition); _rightEyePositionParser = ref new GazeHidPositionParser(gazeDevice, (USHORT)GazeHidUsages::Usage_RightEyePosition); @@ -135,7 +135,7 @@ namespace GazeHidParsers { _headRotationParser = ref new GazeHidRotationParser(gazeDevice, (USHORT)GazeHidUsages::Usage_HeadDirectionPoint); } - GazeHidPositions ^ GazeHidPositionsParser::GetGazeHidPositions(HidInputReport ^ report) + GazeHidPositions GazeHidPositionsParser::GetGazeHidPositions(HidInputReport report) { auto retval = ref new GazeHidPositions(); diff --git a/Microsoft.Toolkit.Uwp.Input.GazeInteraction/GazeHidParsers.h b/Microsoft.Toolkit.Uwp.Input.GazeInteraction/GazeHidParsers.h index f8b862ee40e..56c80f72741 100644 --- a/Microsoft.Toolkit.Uwp.Input.GazeInteraction/GazeHidParsers.h +++ b/Microsoft.Toolkit.Uwp.Input.GazeInteraction/GazeHidParsers.h @@ -5,13 +5,13 @@ #include "GazeHidUsages.h" -using namespace Windows::Devices::HumanInterfaceDevice; -using namespace Windows::Devices::Input::Preview; +using namespace winrt::Windows::Devices::HumanInterfaceDevice; +using namespace winrt::Windows::Devices::Input::Preview; BEGIN_NAMESPACE_GAZE_INPUT namespace GazeHidParsers { - public ref class GazeHidPosition sealed + class GazeHidPosition sealed { public: property long long X; @@ -19,55 +19,55 @@ namespace GazeHidParsers { property long long Z; }; - public ref class GazeHidPositions sealed + class GazeHidPositions sealed { public: - property GazeHidPosition^ LeftEyePosition; - property GazeHidPosition^ RightEyePosition; - property GazeHidPosition^ HeadPosition; - property GazeHidPosition^ HeadRotation; + property GazeHidPosition LeftEyePosition; + property GazeHidPosition RightEyePosition; + property GazeHidPosition HeadPosition; + property GazeHidPosition HeadRotation; }; - public ref class GazeHidPositionParser sealed + class GazeHidPositionParser sealed { public: - GazeHidPositionParser(GazeDevicePreview ^ gazeDevice, uint16 usage); + GazeHidPositionParser(GazeDevicePreview gazeDevice, uint16 usage); - GazeHidPosition^ GetPosition(HidInputReport ^ report); + GazeHidPosition GetPosition(HidInputReport report); private: - HidNumericControlDescription ^ _X = nullptr; - HidNumericControlDescription ^ _Y = nullptr; - HidNumericControlDescription ^ _Z = nullptr; + HidNumericControlDescription _X = nullptr; + HidNumericControlDescription _Y = nullptr; + HidNumericControlDescription _Z = nullptr; uint16 _usage = 0x0000; }; - public ref class GazeHidRotationParser sealed + class GazeHidRotationParser sealed { public: - GazeHidRotationParser(GazeDevicePreview ^ gazeDevice, uint16 usage); + GazeHidRotationParser(GazeDevicePreview gazeDevice, uint16 usage); - GazeHidPosition^ GetRotation(HidInputReport^ report); + GazeHidPosition GetRotation(HidInputReport report); private: - HidNumericControlDescription ^ _X = nullptr; - HidNumericControlDescription ^ _Y = nullptr; - HidNumericControlDescription ^ _Z = nullptr; + HidNumericControlDescription _X = nullptr; + HidNumericControlDescription _Y = nullptr; + HidNumericControlDescription _Z = nullptr; uint16 _usage = 0x0000; }; - public ref class GazeHidPositionsParser sealed + class GazeHidPositionsParser sealed { public: - GazeHidPositionsParser(GazeDevicePreview ^ gazeDevice); + GazeHidPositionsParser(GazeDevicePreview gazeDevice); - GazeHidPositions^ GetGazeHidPositions(HidInputReport ^ report); + GazeHidPositions GetGazeHidPositions(HidInputReport report); private: - GazeHidPositionParser ^ _leftEyePositionParser; - GazeHidPositionParser ^ _rightEyePositionParser; - GazeHidPositionParser ^ _headPositionParser; - GazeHidRotationParser ^ _headRotationParser; + GazeHidPositionParser _leftEyePositionParser; + GazeHidPositionParser _rightEyePositionParser; + GazeHidPositionParser _headPositionParser; + GazeHidRotationParser _headRotationParser; }; } diff --git a/Microsoft.Toolkit.Uwp.Input.GazeInteraction/GazeHistoryItem.h b/Microsoft.Toolkit.Uwp.Input.GazeInteraction/GazeHistoryItem.h index b1c1121bb4f..8a7fbab0c19 100644 --- a/Microsoft.Toolkit.Uwp.Input.GazeInteraction/GazeHistoryItem.h +++ b/Microsoft.Toolkit.Uwp.Input.GazeInteraction/GazeHistoryItem.h @@ -3,17 +3,17 @@ #pragma once -using namespace Windows::Foundation; +using namespace winrt::Windows::Foundation; BEGIN_NAMESPACE_GAZE_INPUT -ref class GazeTargetItem; +class GazeTargetItem; -private ref struct GazeHistoryItem +struct GazeHistoryItem { - property GazeTargetItem^ HitTarget; - property TimeSpan Timestamp; - property TimeSpan Duration; + GazeTargetItem HitTarget; + TimeSpan Timestamp; + TimeSpan Duration; }; END_NAMESPACE_GAZE_INPUT \ No newline at end of file diff --git a/Microsoft.Toolkit.Uwp.Input.GazeInteraction/GazeInput.cpp b/Microsoft.Toolkit.Uwp.Input.GazeInteraction/GazeInput.cpp index 87f66b2cde2..3a7bcfae6bf 100644 --- a/Microsoft.Toolkit.Uwp.Input.GazeInteraction/GazeInput.cpp +++ b/Microsoft.Toolkit.Uwp.Input.GazeInteraction/GazeInput.cpp @@ -10,37 +10,37 @@ #include "GazeTargetItem.h" using namespace Platform; -using namespace Windows::Foundation::Collections; -using namespace Windows::UI; +using namespace winrt::Windows::Foundation::Collections; +using namespace winrt::Windows::UI; BEGIN_NAMESPACE_GAZE_INPUT -Brush^ GazeInput::DwellFeedbackEnterBrush::get() +Brush GazeInput::DwellFeedbackEnterBrush::get() { return GazePointer::Instance->_enterBrush; } -void GazeInput::DwellFeedbackEnterBrush::set(Brush^ value) +void GazeInput::DwellFeedbackEnterBrush::set(Brush value) { GazePointer::Instance->_enterBrush = value; } -Brush^ GazeInput::DwellFeedbackProgressBrush::get() +Brush GazeInput::DwellFeedbackProgressBrush::get() { return GazePointer::Instance->_progressBrush; } -void GazeInput::DwellFeedbackProgressBrush::set(Brush^ value) +void GazeInput::DwellFeedbackProgressBrush::set(Brush value) { GazePointer::Instance->_progressBrush = value; } -Brush^ GazeInput::DwellFeedbackCompleteBrush::get() +Brush GazeInput::DwellFeedbackCompleteBrush::get() { return GazePointer::Instance->_completeBrush; } -void GazeInput::DwellFeedbackCompleteBrush::set(Brush^ value) +void GazeInput::DwellFeedbackCompleteBrush::set(Brush value) { GazePointer::Instance->_completeBrush = value; } @@ -79,92 +79,92 @@ void GazeInput::Interaction::set(GazeInteraction::Interaction value) TimeSpan GazeInput::UnsetTimeSpan = { -1 }; -static void OnInteractionChanged(DependencyObject^ ob, DependencyPropertyChangedEventArgs^ args) +static void OnInteractionChanged(DependencyObject ob, DependencyPropertyChangedEventArgs args) { - auto element = safe_cast(ob); + auto element = safe_cast(ob); auto interaction = safe_cast(args->NewValue); GazePointerProxy::SetInteraction(element, interaction); } -static void OnIsCursorVisibleChanged(DependencyObject^ ob, DependencyPropertyChangedEventArgs^ args) +static void OnIsCursorVisibleChanged(DependencyObject ob, DependencyPropertyChangedEventArgs args) { GazePointer::Instance->IsCursorVisible = safe_cast(args->NewValue); } -static void OnCursorRadiusChanged(DependencyObject^ ob, DependencyPropertyChangedEventArgs^ args) +static void OnCursorRadiusChanged(DependencyObject ob, DependencyPropertyChangedEventArgs args) { GazePointer::Instance->CursorRadius = safe_cast(args->NewValue); } -static void OnIsSwitchEnabledChanged(DependencyObject^ ob, DependencyPropertyChangedEventArgs^ args) +static void OnIsSwitchEnabledChanged(DependencyObject ob, DependencyPropertyChangedEventArgs args) { GazePointer::Instance->IsSwitchEnabled = safe_cast(args->NewValue); } -static DependencyProperty^ s_interactionProperty = DependencyProperty::RegisterAttached("Interaction", Interaction::typeid, GazeInput::typeid, +static DependencyProperty s_interactionProperty = DependencyProperty::RegisterAttached("Interaction", Interaction::typeid, GazeInput::typeid, ref new PropertyMetadata(Interaction::Inherited, ref new PropertyChangedCallback(&OnInteractionChanged))); -static DependencyProperty^ s_isCursorVisibleProperty = DependencyProperty::RegisterAttached("IsCursorVisible", bool::typeid, GazeInput::typeid, +static DependencyProperty s_isCursorVisibleProperty = DependencyProperty::RegisterAttached("IsCursorVisible", bool::typeid, GazeInput::typeid, ref new PropertyMetadata(true, ref new PropertyChangedCallback(&OnIsCursorVisibleChanged))); -static DependencyProperty^ s_cursorRadiusProperty = DependencyProperty::RegisterAttached("CursorRadius", int::typeid, GazeInput::typeid, +static DependencyProperty s_cursorRadiusProperty = DependencyProperty::RegisterAttached("CursorRadius", int::typeid, GazeInput::typeid, ref new PropertyMetadata(6, ref new PropertyChangedCallback(&OnCursorRadiusChanged))); -static DependencyProperty^ s_gazeElementProperty = DependencyProperty::RegisterAttached("GazeElement", GazeElement::typeid, GazeInput::typeid, ref new PropertyMetadata(nullptr)); -static DependencyProperty^ s_fixationDurationProperty = DependencyProperty::RegisterAttached("FixationDuration", TimeSpan::typeid, GazeInput::typeid, ref new PropertyMetadata(GazeInput::UnsetTimeSpan)); -static DependencyProperty^ s_dwellDurationProperty = DependencyProperty::RegisterAttached("DwellDuration", TimeSpan::typeid, GazeInput::typeid, ref new PropertyMetadata(GazeInput::UnsetTimeSpan)); -static DependencyProperty^ s_repeatDelayDurationProperty = DependencyProperty::RegisterAttached("RepeatDelayDuration", TimeSpan::typeid, GazeInput::typeid, ref new PropertyMetadata(GazeInput::UnsetTimeSpan)); -static DependencyProperty^ s_dwellRepeatDurationProperty = DependencyProperty::RegisterAttached("DwellRepeatDuration", TimeSpan::typeid, GazeInput::typeid, ref new PropertyMetadata(GazeInput::UnsetTimeSpan)); -static DependencyProperty^ s_thresholdDurationProperty = DependencyProperty::RegisterAttached("ThresholdDuration", TimeSpan::typeid, GazeInput::typeid, ref new PropertyMetadata(GazeInput::UnsetTimeSpan)); -static DependencyProperty^ s_maxRepeatCountProperty = DependencyProperty::RegisterAttached("MaxDwellRepeatCount", int::typeid, GazeInput::typeid, ref new PropertyMetadata(safe_cast(0))); -static DependencyProperty^ s_isSwitchEnabledProperty = DependencyProperty::RegisterAttached("IsSwitchEnabled", bool::typeid, GazeInput::typeid, +static DependencyProperty s_gazeElementProperty = DependencyProperty::RegisterAttached("GazeElement", GazeElement::typeid, GazeInput::typeid, ref new PropertyMetadata(nullptr)); +static DependencyProperty s_fixationDurationProperty = DependencyProperty::RegisterAttached("FixationDuration", TimeSpan::typeid, GazeInput::typeid, ref new PropertyMetadata(GazeInput::UnsetTimeSpan)); +static DependencyProperty s_dwellDurationProperty = DependencyProperty::RegisterAttached("DwellDuration", TimeSpan::typeid, GazeInput::typeid, ref new PropertyMetadata(GazeInput::UnsetTimeSpan)); +static DependencyProperty s_repeatDelayDurationProperty = DependencyProperty::RegisterAttached("RepeatDelayDuration", TimeSpan::typeid, GazeInput::typeid, ref new PropertyMetadata(GazeInput::UnsetTimeSpan)); +static DependencyProperty s_dwellRepeatDurationProperty = DependencyProperty::RegisterAttached("DwellRepeatDuration", TimeSpan::typeid, GazeInput::typeid, ref new PropertyMetadata(GazeInput::UnsetTimeSpan)); +static DependencyProperty s_thresholdDurationProperty = DependencyProperty::RegisterAttached("ThresholdDuration", TimeSpan::typeid, GazeInput::typeid, ref new PropertyMetadata(GazeInput::UnsetTimeSpan)); +static DependencyProperty s_maxRepeatCountProperty = DependencyProperty::RegisterAttached("MaxDwellRepeatCount", int::typeid, GazeInput::typeid, ref new PropertyMetadata(safe_cast(0))); +static DependencyProperty s_isSwitchEnabledProperty = DependencyProperty::RegisterAttached("IsSwitchEnabled", bool::typeid, GazeInput::typeid, ref new PropertyMetadata(false, ref new PropertyChangedCallback(&OnIsSwitchEnabledChanged))); -DependencyProperty^ GazeInput::InteractionProperty::get() { return s_interactionProperty; } -DependencyProperty^ GazeInput::IsCursorVisibleProperty::get() { return s_isCursorVisibleProperty; } -DependencyProperty^ GazeInput::CursorRadiusProperty::get() { return s_cursorRadiusProperty; } -DependencyProperty^ GazeInput::GazeElementProperty::get() { return s_gazeElementProperty; } -DependencyProperty^ GazeInput::FixationDurationProperty::get() { return s_fixationDurationProperty; } -DependencyProperty^ GazeInput::DwellDurationProperty::get() { return s_dwellDurationProperty; } -DependencyProperty^ GazeInput::RepeatDelayDurationProperty::get() { return s_repeatDelayDurationProperty; } -DependencyProperty^ GazeInput::DwellRepeatDurationProperty::get() { return s_dwellRepeatDurationProperty; } -DependencyProperty^ GazeInput::ThresholdDurationProperty::get() { return s_thresholdDurationProperty; } -DependencyProperty^ GazeInput::MaxDwellRepeatCountProperty::get() { return s_maxRepeatCountProperty; } -DependencyProperty^ GazeInput::IsSwitchEnabledProperty::get() { return s_isSwitchEnabledProperty; } - -Interaction GazeInput::GetInteraction(UIElement^ element) { return safe_cast(element->GetValue(s_interactionProperty)); } -bool GazeInput::GetIsCursorVisible(UIElement^ element) { return safe_cast(element->GetValue(s_isCursorVisibleProperty)); } -int GazeInput::GetCursorRadius(UIElement^ element) { return safe_cast(element->GetValue(s_cursorRadiusProperty)); } -GazeElement^ GazeInput::GetGazeElement(UIElement^ element) { return safe_cast(element->GetValue(s_gazeElementProperty)); } -TimeSpan GazeInput::GetFixationDuration(UIElement^ element) { return safe_cast(element->GetValue(s_fixationDurationProperty)); } -TimeSpan GazeInput::GetDwellDuration(UIElement^ element) { return safe_cast(element->GetValue(s_dwellDurationProperty)); } -TimeSpan GazeInput::GetRepeatDelayDuration(UIElement^ element) { return safe_cast(element->GetValue(s_repeatDelayDurationProperty)); } -TimeSpan GazeInput::GetDwellRepeatDuration(UIElement^ element) { return safe_cast(element->GetValue(s_dwellRepeatDurationProperty)); } -TimeSpan GazeInput::GetThresholdDuration(UIElement^ element) { return safe_cast(element->GetValue(s_thresholdDurationProperty)); } -int GazeInput::GetMaxDwellRepeatCount(UIElement^ element) { return safe_cast(element->GetValue(s_maxRepeatCountProperty)); } -bool GazeInput::GetIsSwitchEnabled(UIElement^ element) { return safe_cast(element->GetValue(s_isSwitchEnabledProperty)); } - -void GazeInput::SetInteraction(UIElement^ element, GazeInteraction::Interaction value) { element->SetValue(s_interactionProperty, value); } -void GazeInput::SetIsCursorVisible(UIElement^ element, bool value) { element->SetValue(s_isCursorVisibleProperty, value); } -void GazeInput::SetCursorRadius(UIElement^ element, int value) { element->SetValue(s_cursorRadiusProperty, value); } -void GazeInput::SetGazeElement(UIElement^ element, GazeElement^ value) { element->SetValue(s_gazeElementProperty, value); } -void GazeInput::SetFixationDuration(UIElement^ element, TimeSpan span) { element->SetValue(s_fixationDurationProperty, span); } -void GazeInput::SetDwellDuration(UIElement^ element, TimeSpan span) { element->SetValue(s_dwellDurationProperty, span); } -void GazeInput::SetRepeatDelayDuration(UIElement^ element, TimeSpan span) { element->SetValue(s_repeatDelayDurationProperty, span); } -void GazeInput::SetDwellRepeatDuration(UIElement^ element, TimeSpan span) { element->SetValue(s_dwellRepeatDurationProperty, span); } -void GazeInput::SetThresholdDuration(UIElement^ element, TimeSpan span) { element->SetValue(s_thresholdDurationProperty, span); } -void GazeInput::SetMaxDwellRepeatCount(UIElement^ element, int value) { element->SetValue(s_maxRepeatCountProperty, value); } -void GazeInput::SetIsSwitchEnabled(UIElement^ element, bool value) { element->SetValue(s_isSwitchEnabledProperty, value); } - -GazePointer^ GazeInput::GetGazePointer(Page^ page) +DependencyProperty GazeInput::InteractionProperty::get() { return s_interactionProperty; } +DependencyProperty GazeInput::IsCursorVisibleProperty::get() { return s_isCursorVisibleProperty; } +DependencyProperty GazeInput::CursorRadiusProperty::get() { return s_cursorRadiusProperty; } +DependencyProperty GazeInput::GazeElementProperty::get() { return s_gazeElementProperty; } +DependencyProperty GazeInput::FixationDurationProperty::get() { return s_fixationDurationProperty; } +DependencyProperty GazeInput::DwellDurationProperty::get() { return s_dwellDurationProperty; } +DependencyProperty GazeInput::RepeatDelayDurationProperty::get() { return s_repeatDelayDurationProperty; } +DependencyProperty GazeInput::DwellRepeatDurationProperty::get() { return s_dwellRepeatDurationProperty; } +DependencyProperty GazeInput::ThresholdDurationProperty::get() { return s_thresholdDurationProperty; } +DependencyProperty GazeInput::MaxDwellRepeatCountProperty::get() { return s_maxRepeatCountProperty; } +DependencyProperty GazeInput::IsSwitchEnabledProperty::get() { return s_isSwitchEnabledProperty; } + +Interaction GazeInput::GetInteraction(UIElement element) { return safe_cast(element->GetValue(s_interactionProperty)); } +bool GazeInput::GetIsCursorVisible(UIElement element) { return safe_cast(element->GetValue(s_isCursorVisibleProperty)); } +int GazeInput::GetCursorRadius(UIElement element) { return safe_cast(element->GetValue(s_cursorRadiusProperty)); } +GazeElement GazeInput::GetGazeElement(UIElement element) { return safe_cast(element->GetValue(s_gazeElementProperty)); } +TimeSpan GazeInput::GetFixationDuration(UIElement element) { return safe_cast(element->GetValue(s_fixationDurationProperty)); } +TimeSpan GazeInput::GetDwellDuration(UIElement element) { return safe_cast(element->GetValue(s_dwellDurationProperty)); } +TimeSpan GazeInput::GetRepeatDelayDuration(UIElement element) { return safe_cast(element->GetValue(s_repeatDelayDurationProperty)); } +TimeSpan GazeInput::GetDwellRepeatDuration(UIElement element) { return safe_cast(element->GetValue(s_dwellRepeatDurationProperty)); } +TimeSpan GazeInput::GetThresholdDuration(UIElement element) { return safe_cast(element->GetValue(s_thresholdDurationProperty)); } +int GazeInput::GetMaxDwellRepeatCount(UIElement element) { return safe_cast(element->GetValue(s_maxRepeatCountProperty)); } +bool GazeInput::GetIsSwitchEnabled(UIElement element) { return safe_cast(element->GetValue(s_isSwitchEnabledProperty)); } + +void GazeInput::SetInteraction(UIElement element, GazeInteraction::Interaction value) { element->SetValue(s_interactionProperty, value); } +void GazeInput::SetIsCursorVisible(UIElement element, bool value) { element->SetValue(s_isCursorVisibleProperty, value); } +void GazeInput::SetCursorRadius(UIElement element, int value) { element->SetValue(s_cursorRadiusProperty, value); } +void GazeInput::SetGazeElement(UIElement element, GazeElement value) { element->SetValue(s_gazeElementProperty, value); } +void GazeInput::SetFixationDuration(UIElement element, TimeSpan span) { element->SetValue(s_fixationDurationProperty, span); } +void GazeInput::SetDwellDuration(UIElement element, TimeSpan span) { element->SetValue(s_dwellDurationProperty, span); } +void GazeInput::SetRepeatDelayDuration(UIElement element, TimeSpan span) { element->SetValue(s_repeatDelayDurationProperty, span); } +void GazeInput::SetDwellRepeatDuration(UIElement element, TimeSpan span) { element->SetValue(s_dwellRepeatDurationProperty, span); } +void GazeInput::SetThresholdDuration(UIElement element, TimeSpan span) { element->SetValue(s_thresholdDurationProperty, span); } +void GazeInput::SetMaxDwellRepeatCount(UIElement element, int value) { element->SetValue(s_maxRepeatCountProperty, value); } +void GazeInput::SetIsSwitchEnabled(UIElement element, bool value) { element->SetValue(s_isSwitchEnabledProperty, value); } + +GazePointer GazeInput::GetGazePointer(Page page) { return GazePointer::Instance; } -void GazeInput::Invoke(UIElement^ element) +void GazeInput::Invoke(UIElement element) { auto item = GazeTargetItem::GetOrCreate(element); item->Invoke(); } -void GazeInput::LoadSettings(ValueSet^ settings) +void GazeInput::LoadSettings(ValueSet settings) { GazePointer::Instance->LoadSettings(settings); } @@ -174,7 +174,7 @@ bool GazeInput::IsDeviceAvailable::get() return GazePointer::Instance->IsDeviceAvailable; } -EventRegistrationToken GazeInput::IsDeviceAvailableChanged::add(EventHandler^ handler) +EventRegistrationToken GazeInput::IsDeviceAvailableChanged::add(EventHandler handler) { return GazePointer::Instance->IsDeviceAvailableChanged += handler; } diff --git a/Microsoft.Toolkit.Uwp.Input.GazeInteraction/GazeInput.h b/Microsoft.Toolkit.Uwp.Input.GazeInteraction/GazeInput.h index 42ef822a8d9..a3f89077bd6 100644 --- a/Microsoft.Toolkit.Uwp.Input.GazeInteraction/GazeInput.h +++ b/Microsoft.Toolkit.Uwp.Input.GazeInteraction/GazeInput.h @@ -4,223 +4,230 @@ #pragma once #include "Interaction.h" +#include -using namespace Windows::Foundation::Collections; -using namespace Windows::UI::Xaml; -using namespace Windows::UI::Xaml::Controls; +using namespace winrt::Windows::Foundation::Collections; +using namespace winrt::Microsoft::UI::Xaml; +using namespace winrt::Microsoft::UI::Xaml::Controls; +using namespace winrt::Microsoft::UI::Xaml::Media; BEGIN_NAMESPACE_GAZE_INPUT -ref class GazeElement; -ref class GazePointer; +class GazeElement; +class GazePointer; /// /// Static class primarily providing access to attached properties controlling gaze behavior. /// -[Windows::Foundation::Metadata::WebHostHidden] -public ref class GazeInput sealed +//[Windows::Foundation::Metadata::WebHostHidden] +class GazeInput sealed { public: /// /// Identifyes the Interaction dependency property /// - static property DependencyProperty^ InteractionProperty { DependencyProperty^ get(); } + static DependencyProperty InteractionProperty(); /// /// Identifyes the IsCursorVisible dependency property /// - static property DependencyProperty^ IsCursorVisibleProperty { DependencyProperty^ get(); } + static DependencyProperty IsCursorVisibleProperty(); /// /// Identifyes the CursorRadius dependency property /// - static property DependencyProperty^ CursorRadiusProperty { DependencyProperty^ get(); } + static DependencyProperty CursorRadiusProperty(); /// /// Identifyes the GazeElement dependency property /// - static property DependencyProperty^ GazeElementProperty { DependencyProperty^ get(); } + static DependencyProperty GazeElementProperty(); /// /// Identifyes the FixationDuration dependency property /// - static property DependencyProperty^ FixationDurationProperty { DependencyProperty^ get(); } + static DependencyProperty FixationDurationProperty(); /// /// Identifies the DwellDuration dependency property /// - static property DependencyProperty^ DwellDurationProperty { DependencyProperty^ get(); } + static DependencyProperty DwellDurationProperty(); /// /// Identifies the RepeatDelayDuration dependency property /// - static property DependencyProperty^ RepeatDelayDurationProperty { DependencyProperty^ get(); } + static DependencyProperty RepeatDelayDurationProperty(); /// /// Identifies the DwellRepeatDuration dependency property /// - static property DependencyProperty^ DwellRepeatDurationProperty { DependencyProperty^ get(); } + static DependencyProperty DwellRepeatDurationProperty(); /// /// Identifies the ThresholdDuration dependency property /// - static property DependencyProperty^ ThresholdDurationProperty { DependencyProperty^ get(); } + static DependencyProperty ThresholdDurationProperty(); /// /// Identifies the MaxDwellRepeatCount dependency property /// - static property DependencyProperty^ MaxDwellRepeatCountProperty { DependencyProperty^ get(); } + static DependencyProperty MaxDwellRepeatCountProperty(); /// /// Identifyes the IsSwitchEnabled dependency property /// - static property DependencyProperty^ IsSwitchEnabledProperty { DependencyProperty^ get(); } + static DependencyProperty IsSwitchEnabledProperty(); /// /// Gets or sets the brush to use when displaying the default indication that gaze entered a control /// - static property Brush^ DwellFeedbackEnterBrush { Brush^ get(); void set(Brush^ value); } + static Brush DwellFeedbackEnterBrush(); + static void DwellFeedbackEnterBrush(Brush); /// /// Gets or sets the brush to use when displaying the default animation for dwell press /// - static property Brush^ DwellFeedbackProgressBrush { Brush^ get(); void set(Brush^ value); } + static Brush DwellFeedbackProgressBrush(); + static void DwellFeedbackProgressBrush(Brush); /// /// Gets or sets the brush to use when displaying the default animation for dwell complete /// - static property Brush^ DwellFeedbackCompleteBrush { Brush^ get(); void set(Brush^ value); } + static Brush DwellFeedbackCompleteBrush(); + static void DwellFeedbackCompleteBrush(Brush); /// /// Gets or sets the thickness of the lines animated for dwell. /// - static property double DwellStrokeThickness { double get(); void set(double value); } + static double DwellStrokeThickness(); + static void DwellStrokeThickness(double); /// /// Gets or sets the interaction default /// - static property GazeInteraction::Interaction Interaction { GazeInteraction::Interaction get(); void set(GazeInteraction::Interaction value); } + static GazeInteraction::Interaction Interaction(); + static void Interaction(GazeInteraction::Interaction); /// /// Gets the status of gaze interaction over that particular XAML element. /// - static GazeInteraction::Interaction GetInteraction(UIElement^ element); + static GazeInteraction::Interaction GetInteraction(UIElement element); /// /// Gets Boolean indicating whether cursor is shown while user is looking at the school. /// - static bool GetIsCursorVisible(UIElement^ element); + static bool GetIsCursorVisible(UIElement element); /// /// Gets the size of the gaze cursor radius. /// - static int GetCursorRadius(UIElement^ element); + static int GetCursorRadius(UIElement element); /// /// Gets the GazeElement associated with an UIElement. /// - static GazeElement^ GetGazeElement(UIElement^ element); + static GazeElement GetGazeElement(UIElement element); /// /// Gets the duration for the control to transition from the Enter state to the Fixation state. At this point, a StateChanged event is fired with PointerState set to Fixation. This event should be used to control the earliest visual feedback the application needs to provide to the user about the gaze location. The default is 350ms. /// - static TimeSpan GetFixationDuration(UIElement^ element); + static TimeSpan GetFixationDuration(UIElement element); /// /// Gets the duration for the control to transition from the Fixation state to the Dwell state. At this point, a StateChanged event is fired with PointerState set to Dwell. The Enter and Fixation states are typicaly achieved too rapidly for the user to have much control over. In contrast Dwell is conscious event. This is the point at which the control is invoked, e.g. a button click. The application can modify this property to control when a gaze enabled UI element gets invoked after a user starts looking at it. /// - static TimeSpan GetDwellDuration(UIElement^ element); + static TimeSpan GetDwellDuration(UIElement element); /// /// Gets the additional duration for the first repeat to occur.This prevents inadvertent repeated invocation. /// - static TimeSpan GetRepeatDelayDuration(UIElement^ element); + static TimeSpan GetRepeatDelayDuration(UIElement element); /// /// Gets the duration of repeated dwell invocations, should the user continue to dwell on the control. The first repeat will occur after an additional delay specified by RepeatDelayDuration. Subsequent repeats happen after every period of DwellRepeatDuration. A control is invoked repeatedly only if MaxDwellRepeatCount is set to greater than zero. /// - static TimeSpan GetDwellRepeatDuration(UIElement^ element); + static TimeSpan GetDwellRepeatDuration(UIElement element); /// /// Gets the duration that controls when the PointerState moves to either the Enter state or the Exit state. When this duration has elapsed after the user's gaze first enters a control, the PointerState is set to Enter. And when this duration has elapsed after the user's gaze has left the control, the PointerState is set to Exit. In both cases, a StateChanged event is fired. The default is 50ms. /// - static TimeSpan GetThresholdDuration(UIElement^ element); + static TimeSpan GetThresholdDuration(UIElement element); /// /// Gets the maximum times the control will invoked repeatedly without the user's gaze having to leave and re-enter the control. The default value is zero which disables repeated invocation of a control. Developers can set a higher value to enable repeated invocation. /// - static int GetMaxDwellRepeatCount(UIElement^ element); + static int GetMaxDwellRepeatCount(UIElement element); /// /// Gets the Boolean indicating whether gaze plus switch is enabled. /// - static bool GetIsSwitchEnabled(UIElement^ element); + static bool GetIsSwitchEnabled(UIElement element); /// /// Sets the status of gaze interaction over that particular XAML element. /// - static void SetInteraction(UIElement^ element, GazeInteraction::Interaction value); + static void SetInteraction(UIElement element, GazeInteraction::Interaction value); /// /// Sets Boolean indicating whether cursor is shown while user is looking at the school. /// - static void SetIsCursorVisible(UIElement^ element, bool value); + static void SetIsCursorVisible(UIElement element, bool value); /// /// Sets the size of the gaze cursor radius. /// - static void SetCursorRadius(UIElement^ element, int value); + static void SetCursorRadius(UIElement element, int value); /// /// Sets the GazeElement associated with an UIElement. /// - static void SetGazeElement(UIElement^ element, GazeElement^ value); + static void SetGazeElement(UIElement element, GazeElement value); /// /// Sets the duration for the control to transition from the Enter state to the Fixation state. At this point, a StateChanged event is fired with PointerState set to Fixation. This event should be used to control the earliest visual feedback the application needs to provide to the user about the gaze location. The default is 350ms. /// - static void SetFixationDuration(UIElement^ element, TimeSpan span); + static void SetFixationDuration(UIElement element, TimeSpan span); /// /// Sets the duration for the control to transition from the Fixation state to the Dwell state. At this point, a StateChanged event is fired with PointerState set to Dwell. The Enter and Fixation states are typicaly achieved too rapidly for the user to have much control over. In contrast Dwell is conscious event. This is the point at which the control is invoked, e.g. a button click. The application can modify this property to control when a gaze enabled UI element gets invoked after a user starts looking at it. /// - static void SetDwellDuration(UIElement^ element, TimeSpan span); + static void SetDwellDuration(UIElement element, TimeSpan span); /// /// Sets the additional duration for the first repeat to occur.This prevents inadvertent repeated invocation. /// - static void SetRepeatDelayDuration(UIElement^ element, TimeSpan span); + static void SetRepeatDelayDuration(UIElement element, TimeSpan span); /// /// Sets the duration of repeated dwell invocations, should the user continue to dwell on the control. The first repeat will occur after an additional delay specified by RepeatDelayDuration. Subsequent repeats happen after every period of DwellRepeatDuration. A control is invoked repeatedly only if MaxDwellRepeatCount is set to greater than zero. /// - static void SetDwellRepeatDuration(UIElement^ element, TimeSpan span); + static void SetDwellRepeatDuration(UIElement element, TimeSpan span); /// /// Sets the duration that controls when the PointerState moves to either the Enter state or the Exit state. When this duration has elapsed after the user's gaze first enters a control, the PointerState is set to Enter. And when this duration has elapsed after the user's gaze has left the control, the PointerState is set to Exit. In both cases, a StateChanged event is fired. The default is 50ms. /// - static void SetThresholdDuration(UIElement^ element, TimeSpan span); + static void SetThresholdDuration(UIElement element, TimeSpan span); /// /// Sets the maximum times the control will invoked repeatedly without the user's gaze having to leave and re-enter the control. The default value is zero which disables repeated invocation of a control. Developers can set a higher value to enable repeated invocation. /// - static void SetMaxDwellRepeatCount(UIElement^ element, int value); + static void SetMaxDwellRepeatCount(UIElement element, int value); /// /// Sets the Boolean indicating whether gaze plus switch is enabled. /// - static void SetIsSwitchEnabled(UIElement^ element, bool value); + static void SetIsSwitchEnabled(UIElement element, bool value); /// /// Gets the GazePointer object. /// - static GazePointer^ GetGazePointer(Page^ page); + static GazePointer GetGazePointer(Page page); /// /// Invoke the default action of the specified UIElement. /// - static void Invoke(UIElement^ element); + static void Invoke(UIElement element); /// /// Reports whether a gaze input device is available, and hence whether there is any possibility of gaze events occurring in the application. @@ -230,9 +237,9 @@ public ref class GazeInput sealed /// /// Event triggered whenever IsDeviceAvailable changes value. /// - static event EventHandler^ IsDeviceAvailableChanged + static event EventHandler IsDeviceAvailableChanged { - EventRegistrationToken add(EventHandler^ handler); + EventRegistrationToken add(EventHandler handler); void remove(EventRegistrationToken token); } @@ -241,7 +248,7 @@ public ref class GazeInput sealed /// Note: This must be loaded from a UI thread to be valid, since the GazeInput /// instance is tied to the UI thread. /// - static void LoadSettings(ValueSet^ settings); + static void LoadSettings(ValueSet settings); internal: diff --git a/Microsoft.Toolkit.Uwp.Input.GazeInteraction/GazePointer.cpp b/Microsoft.Toolkit.Uwp.Input.GazeInteraction/GazePointer.cpp index 9f4840bf23c..2293f079e68 100644 --- a/Microsoft.Toolkit.Uwp.Input.GazeInteraction/GazePointer.cpp +++ b/Microsoft.Toolkit.Uwp.Input.GazeInteraction/GazePointer.cpp @@ -10,33 +10,29 @@ #include "GazeTargetItem.h" #include "StateChangedEventArgs.h" -using namespace Platform; -using namespace Windows::Foundation; -using namespace Windows::UI::Xaml::Automation::Peers; +using namespace winrt::Windows::Foundation; +using namespace winrt::Windows::UI::Xaml::Automation::Peers; BEGIN_NAMESPACE_GAZE_INPUT -ref class NonInvokeGazeTargetItem sealed : GazeTargetItem +class NonInvokeGazeTargetItem sealed : GazeTargetItem { -internal: NonInvokeGazeTargetItem() - : GazeTargetItem(ref new Page()) + : GazeTargetItem(Page()) { } -internal: - - virtual property bool IsInvokable { bool get() override { return false; } } + virtual bool IsInvokable { bool get() override { return false; } } void Invoke() override { } }; -GazePointer^ GazePointer::Instance::get() +GazePointer GazePointer::Instance::get() { - thread_local static GazePointer^ value; + thread_local static GazePointer value; if (value == nullptr) { value = ref new GazePointer(); @@ -44,6 +40,16 @@ GazePointer^ GazePointer::Instance::get() return value; } +winrt::event_token GazePointer::GazeEvent(GazeEventHandler const& handler) +{ + return m_accountIsInDebitEvent.add(handler); +} + +void BankAccount::AccountIsInDebit(winrt::event_token const& token) noexcept +{ + m_accountIsInDebitEvent.remove(token); +} + void GazePointer::AddRoot(int proxyId) { _roots->InsertAt(0, proxyId); @@ -77,7 +83,7 @@ void GazePointer::RemoveRoot(int proxyId) GazePointer::GazePointer() { - _nonInvokeGazeTargetItem = ref new NonInvokeGazeTargetItem(); + _nonInvokeGazeTargetItem = NonInvokeGazeTargetItem(); // Default to not filtering sample data Filter = ref new NullFilter(); @@ -86,21 +92,21 @@ GazePointer::GazePointer() // timer that gets called back if there gaze samples haven't been received in a while _eyesOffTimer = ref new DispatcherTimer(); - _eyesOffTimer->Tick += ref new EventHandler(this, &GazePointer::OnEyesOff); + _eyesOffTimer->Tick += ref new EventHandler(this, &GazePointer::OnEyesOff); // provide a default of GAZE_IDLE_TIME microseconds to fire eyes off EyesOffDelay = GAZE_IDLE_TIME; InitializeHistogram(); - _devices = ref new Vector(); + _devices = ref new Vector(); _watcher = GazeInputSourcePreview::CreateWatcher(); - _watcher->Added += ref new TypedEventHandler(this, &GazePointer::OnDeviceAdded); - _watcher->Removed += ref new TypedEventHandler(this, &GazePointer::OnDeviceRemoved); + _watcher->Added += ref new TypedEventHandler(this, &GazePointer::OnDeviceAdded); + _watcher->Removed += ref new TypedEventHandler(this, &GazePointer::OnDeviceRemoved); _watcher->Start(); } -EventRegistrationToken GazePointer::GazeEvent::add(EventHandler^ handler) +EventRegistrationToken GazePointer::GazeEvent::add(EventHandler handler) { _gazeEventCount++; return _gazeEvent += handler; @@ -112,12 +118,12 @@ void GazePointer::GazeEvent::remove(EventRegistrationToken token) _gazeEvent -= token; } -void GazePointer::GazeEvent::raise(Object^ sender, GazeEventArgs^ e) +void GazePointer::GazeEvent::raise(Object sender, GazeEventArgs e) { _gazeEvent(sender, e); } -void GazePointer::OnDeviceAdded(GazeDeviceWatcherPreview^ sender, GazeDeviceWatcherAddedPreviewEventArgs^ args) +void GazePointer::OnDeviceAdded(GazeDeviceWatcherPreview sender, GazeDeviceWatcherAddedPreviewEventArgs args) { _devices->Append(args->Device); @@ -129,7 +135,7 @@ void GazePointer::OnDeviceAdded(GazeDeviceWatcherPreview^ sender, GazeDeviceWatc } } -void GazePointer::OnDeviceRemoved(GazeDeviceWatcherPreview^ sender, GazeDeviceWatcherRemovedPreviewEventArgs^ args) +void GazePointer::OnDeviceRemoved(GazeDeviceWatcherPreview sender, GazeDeviceWatcherRemovedPreviewEventArgs args) { auto index = 0u; while (index < _devices->Size && _devices->GetAt(index)->Id != args->Device->Id) @@ -165,7 +171,7 @@ GazePointer::~GazePointer() } } -void GazePointer::LoadSettings(ValueSet^ settings) +void GazePointer::LoadSettings(ValueSet settings) { _gazeCursor->LoadSettings(settings); Filter->LoadSettings(settings); @@ -220,14 +226,14 @@ void GazePointer::LoadSettings(ValueSet^ settings) void GazePointer::InitializeHistogram() { - _activeHitTargetTimes = ref new Vector(); + _activeHitTargetTimes = ref new Vector(); _offScreenElement = ref new UserControl(); SetElementStateDelay(_offScreenElement, PointerState::Fixation, _defaultFixation); SetElementStateDelay(_offScreenElement, PointerState::Dwell, _defaultDwell); _maxHistoryTime = DEFAULT_MAX_HISTORY_DURATION; // maintain about 3 seconds of history (in microseconds) - _gazeHistory = ref new Vector(); + _gazeHistory = ref new Vector(); } void GazePointer::InitializeGazeInputSource() @@ -244,11 +250,11 @@ void GazePointer::InitializeGazeInputSource() if (_gazeInputSource != nullptr) { _gazeEnteredToken = _gazeInputSource->GazeEntered += ref new TypedEventHandler< - GazeInputSourcePreview^, GazeEnteredPreviewEventArgs^>(this, &GazePointer::OnGazeEntered); + GazeInputSourcePreview, GazeEnteredPreviewEventArgs>(this, &GazePointer::OnGazeEntered); _gazeMovedToken = _gazeInputSource->GazeMoved += ref new TypedEventHandler< - GazeInputSourcePreview^, GazeMovedPreviewEventArgs^>(this, &GazePointer::OnGazeMoved); + GazeInputSourcePreview, GazeMovedPreviewEventArgs>(this, &GazePointer::OnGazeMoved); _gazeExitedToken = _gazeInputSource->GazeExited += ref new TypedEventHandler< - GazeInputSourcePreview^, GazeExitedPreviewEventArgs^>(this, &GazePointer::OnGazeExited); + GazeInputSourcePreview, GazeExitedPreviewEventArgs>(this, &GazePointer::OnGazeExited); _initialized = true; } @@ -268,7 +274,7 @@ void GazePointer::DeinitializeGazeInputSource() } } -static DependencyProperty^ GetProperty(PointerState state) +static DependencyProperty GetProperty(PointerState state) { switch (state) { @@ -294,7 +300,7 @@ TimeSpan GazePointer::GetDefaultPropertyValue(PointerState state) } } -void GazePointer::SetElementStateDelay(UIElement ^element, PointerState relevantState, TimeSpan stateDelay) +void GazePointer::SetElementStateDelay(UIElement element, PointerState relevantState, TimeSpan stateDelay) { auto property = GetProperty(relevantState); element->SetValue(property, stateDelay); @@ -308,17 +314,17 @@ void GazePointer::SetElementStateDelay(UIElement ^element, PointerState relevant /// /// Find the parent to inherit properties from. /// -static UIElement^ GetInheritenceParent(UIElement^ child) +static UIElement GetInheritenceParent(UIElement child) { // The result value. - Object^ parent = nullptr; + Object parent = nullptr; // Get the automation peer... auto peer = FrameworkElementAutomationPeer::FromElement(child); if (peer != nullptr) { // ...if it exists, get the peer's parent... - auto peerParent = dynamic_cast(peer->Navigate(AutomationNavigationDirection::Parent)); + auto peerParent = dynamic_cast(peer->Navigate(AutomationNavigationDirection::Parent)); if (peerParent != nullptr) { // ...and if it has a parent, get the corresponding object. @@ -334,13 +340,13 @@ static UIElement^ GetInheritenceParent(UIElement^ child) } // Safely pun the value we found to a UIElement reference. - return dynamic_cast(parent); + return dynamic_cast(parent); } -TimeSpan GazePointer::GetElementStateDelay(UIElement ^element, DependencyProperty^ property, TimeSpan defaultValue) +TimeSpan GazePointer::GetElementStateDelay(UIElement element, DependencyProperty property, TimeSpan defaultValue) { - UIElement^ walker = element; - Object^ valueAtWalker = walker->GetValue(property); + UIElement walker = element; + Object valueAtWalker = walker->GetValue(property); while (GazeInput::UnsetTimeSpan.Equals(valueAtWalker) && walker != nullptr) { @@ -357,7 +363,7 @@ TimeSpan GazePointer::GetElementStateDelay(UIElement ^element, DependencyPropert return ticks; } -TimeSpan GazePointer::GetElementStateDelay(UIElement ^element, PointerState pointerState) +TimeSpan GazePointer::GetElementStateDelay(UIElement element, PointerState pointerState) { auto property = GetProperty(pointerState); auto defaultValue = GetDefaultPropertyValue(pointerState); @@ -382,9 +388,9 @@ void GazePointer::Reset() _maxHistoryTime = DEFAULT_MAX_HISTORY_DURATION; } -GazeTargetItem^ GazePointer::GetHitTarget(Point gazePoint) +GazeTargetItem GazePointer::GetHitTarget(Point gazePoint) { - GazeTargetItem^ invokable; + GazeTargetItem invokable; switch (Window::Current->CoreWindow->ActivationMode) { @@ -409,7 +415,7 @@ GazeTargetItem^ GazePointer::GetHitTarget(Point gazePoint) while (element != nullptr && !invokable->IsInvokable) { - element = dynamic_cast(VisualTreeHelper::GetParent(element)); + element = dynamic_cast(VisualTreeHelper::GetParent(element)); if (element != nullptr) { @@ -450,7 +456,7 @@ GazeTargetItem^ GazePointer::GetHitTarget(Point gazePoint) return invokable; } -void GazePointer::ActivateGazeTargetItem(GazeTargetItem^ target) +void GazePointer::ActivateGazeTargetItem(GazeTargetItem target) { unsigned int index; if (!_activeHitTargetTimes->IndexOf(target, &index)) @@ -465,7 +471,7 @@ void GazePointer::ActivateGazeTargetItem(GazeTargetItem^ target) } } -GazeTargetItem^ GazePointer::ResolveHitTarget(Point gazePoint, TimeSpan timestamp) +GazeTargetItem GazePointer::ResolveHitTarget(Point gazePoint, TimeSpan timestamp) { // TODO: The existance of a GazeTargetItem should be used to indicate that // the target item is invokable. The method of invokation should be stored @@ -529,7 +535,7 @@ GazeTargetItem^ GazePointer::ResolveHitTarget(Point gazePoint, TimeSpan timestam return target; } -void GazePointer::OnEyesOff(Object ^sender, Object ^ea) +void GazePointer::OnEyesOff(Object sender, Object ea) { _eyesOffTimer->Stop(); @@ -588,15 +594,15 @@ wchar_t *PointerStates[] = { L"DwellRepeat" }; -void GazePointer::RaiseGazePointerEvent(GazeTargetItem^ target, PointerState state, TimeSpan elapsedTime) +void GazePointer::RaiseGazePointerEvent(GazeTargetItem target, PointerState state, TimeSpan elapsedTime) { auto control = target != nullptr ? target->TargetElement : nullptr; //assert(target != _rootElement); auto gpea = ref new StateChangedEventArgs(control, state, elapsedTime); - //auto buttonObj = dynamic_cast