diff --git a/docs/essentials/accelerometer.md b/docs/essentials/accelerometer.md index 99431b65e..07aea0f4d 100644 --- a/docs/essentials/accelerometer.md +++ b/docs/essentials/accelerometer.md @@ -1,16 +1,13 @@ --- -title: "Xamarin.Essentials: Accelerometer" -description: "The Accelerometer class in Xamarin.Essentials lets you monitor the device's accelerometer sensor, which indicates the acceleration of the device in three dimensional space." -author: jamesmontemagno -ms.author: jamont -ms.date: 04/02/2019 -ms.custom: video -no-loc: [Xamarin.Forms, Xamarin.Essentials] +title: "Essentials: Accelerometer" +description: "The Accelerometer class in Microsoft.Maui.Essentials lets you monitor the device's accelerometer sensor, which indicates the acceleration of the device in 3D space." +ms.date: 08/02/2021 +no-loc: ["Microsoft.Maui", "Microsoft.Maui.Essentials", "A", "G", "X", "Y", "Z"] --- -# Xamarin.Essentials: Accelerometer +# Accelerometer -The **Accelerometer** class lets you monitor the device's accelerometer sensor, which indicates the acceleration of the device in three-dimensional space. +The `Microsoft.Maui.Essentials.Accelerometer` class lets you monitor the device's accelerometer sensor, which indicates the acceleration of the device in 3D space. ## Get started @@ -18,16 +15,15 @@ The **Accelerometer** class lets you monitor the device's accelerometer sensor, ## Using Accelerometer -Add a reference to Xamarin.Essentials in your class: +Add a reference to the `Microsoft.Maui.Essentials` namespace in your class: ```csharp -using Xamarin.Essentials; +using Microsoft.Maui.Essentials; ``` -The Accelerometer functionality works by calling the `Start` and `Stop` methods to listen for changes to the acceleration. Any changes are sent back through the `ReadingChanged` event. Here is sample usage: +The accelerometer functionality works by calling the `Start` and `Stop` methods to listen for changes to the acceleration. Any changes are sent back through the `ReadingChanged` event. Here's a sample of using the accelerometer: ```csharp - public class AccelerometerTest { // Set speed delay for monitoring changes. @@ -67,29 +63,23 @@ public class AccelerometerTest } ``` -Accelerometer readings are reported back in G. A G is a unit of gravitation force equal to that exerted by the earth's gravitational field (9.81 m/s^2). +Accelerometer readings are reported back in **G**. A **G** is a unit of gravitation force equal to the gravity exerted by the earth's gravitational field $(9.81 m/s^2)$. -The coordinate-system is defined relative to the screen of the phone in its default orientation. The axes are not swapped when the device's screen orientation changes. +The coordinate-system is defined relative to the screen of the device in its default orientation. The axes aren't swapped when the device's screen orientation changes. -The X axis is horizontal and points to the right, the Y axis is vertical and points up and the Z axis points towards the outside of the front face of the screen. In this system, coordinates behind the screen have negative Z values. +The **X** axis is horizontal and points to the right, the **Y** axis is vertical and points up and the **Z** axis points towards the outside of the front face of the screen. In this system, coordinates behind the screen have negative **Z** values. Examples: -- When the device lies flat on a table and is pushed on its left side toward the right, the x acceleration value is positive. +- When the device lies flat on a table and is pushed on its left side toward the right, the **X** acceleration value is positive. -- When the device lies flat on a table, the acceleration value is +1.00 G or (+9.81 m/s^2), which correspond to the acceleration of the device (0 m/s^2) minus the force of gravity (-9.81 m/s^2) and normalized as in G. +- When the device lies flat on a table, the acceleration value is +1.00 G or $(+9.81 m/s^2)$, which correspond to the acceleration of the device $(0 m/s^2)$ minus the force of gravity $(-9.81 m/s^2)$ and normalized as in G. -- When the device lies flat on a table and is pushed toward the sky with an acceleration of A m/s^2, the acceleration value is equal to A+9.81 which corresponds to the acceleration of the device (+A m/s^2) minus the force of gravity (-9.81 m/s^2) and normalized in G. +- When the device lies flat on a table and is pushed toward the sky with an acceleration of **A** $m/s^2$, the acceleration value is equal to $A+9.81$ which corresponds to the acceleration of the device $(+A m/s^2)$ minus the force of gravity $(-9.81 m/s^2)$ and normalized in **G**. [!INCLUDE [sensor-speed](includes/sensor-speed.md)] ## API -- [Accelerometer source code](https://github.com/xamarin/Essentials/tree/main/Xamarin.Essentials/Accelerometer) -- [Accelerometer API documentation](xref:Xamarin.Essentials.Accelerometer) - -## Related Video - -> [!Video https://channel9.msdn.com/Shows/XamarinShow/Accelerometer-XamarinEssentials-API-of-the-Week/player] - -[!INCLUDE [xamarin-show-essentials](includes/xamarin-show-essentials.md)] +- [Accelerometer source code](https://github.com/dotnet/maui/tree/main/src/Essentials/src/Accelerometer) + diff --git a/docs/essentials/app-actions.md b/docs/essentials/app-actions.md index 67a5438d4..3ba70210a 100644 --- a/docs/essentials/app-actions.md +++ b/docs/essentials/app-actions.md @@ -1,33 +1,33 @@ --- -title: "Xamarin.Essentials: App Actions" -description: "The Accelerometer class in Xamarin.Essentials lets you create and respond to app shortcuts from the app icon." -author: jamesmontemagno -ms.author: jamont -ms.date: 01/04/2021 -no-loc: [Xamarin.Forms, Xamarin.Essentials] +title: "Essentials: App Actions" +description: "The AppActions class in Microsoft.Maui.Essentials lets you create and respond to app shortcuts from the app icon." +ms.date: 08/02/2021 +no-loc: ["Microsoft.Maui", "Microsoft.Maui.Essentials", "AppDelegate.cs", "AppActions"] --- -# Xamarin.Essentials: App Actions +# App Actions -The **AppActions** class lets you create and respond to app shortcuts from the app icon. +The `Microsoft.Maui.Essentials.AppActions` class lets you create and respond to app shortcuts from the app icon. App shortcuts are helpful to users because they allow you, as the app developer, to present them with additional ways of starting your app. For example, if you were developing an email and calendar app, you could present two different app actions, one to open the app directly to the current day of the calendar, and another to open to the email inbox folder. ## Get started [!INCLUDE [get-started](includes/get-started.md)] -To access the **AppActions** functionality the following platform specific setup is required. +To access the `AppActions` functionality the following platform specific setup is required. + + # [Android](#tab/android) Add the intent filter to your `MainActivity` class: ```csharp -[IntentFilter( - new[] { Xamarin.Essentials.Platform.Intent.ActionAppAction }, - Categories = new[] { Android.Content.Intent.CategoryDefault })] -public class MainActivity : global::Xamarin.Forms.Platform.Android.FormsAppCompatActivity +[IntentFilter(new[] { Microsoft.Maui.Essentials.Platform.Intent.ActionAppAction }, + Categories = new[] { Android.Content.Intent.CategoryDefault })] +public class MainActivity : MauiAppCompatActivity { ... +} ``` Then add the following logic to handle actions: @@ -37,45 +37,52 @@ protected override void OnResume() { base.OnResume(); - Xamarin.Essentials.Platform.OnResume(this); + Microsoft.Maui.Essentials.Platform.OnResume(this); } protected override void OnNewIntent(Android.Content.Intent intent) { base.OnNewIntent(intent); - Xamarin.Essentials.Platform.OnNewIntent(intent); + Microsoft.Maui.Essentials.Platform.OnNewIntent(intent); } ``` # [iOS](#tab/ios) -In the `AppDelegate.cs` add the following logic to handle actions: +In the _AppDelegate.cs_ add the following logic to handle actions: ```csharp public override void PerformActionForShortcutItem(UIApplication application, UIApplicationShortcutItem shortcutItem, UIOperationHandler completionHandler) - => Xamarin.Essentials.Platform.PerformActionForShortcutItem(application, shortcutItem, completionHandler); + => Microsoft.Maui.Essentials.Platform.PerformActionForShortcutItem(application, shortcutItem, completionHandler); ``` -# [UWP](#tab/uwp) +# [Windows](#tab/windows) In the `App.xaml.cs` file in the `OnLaunched` method add the following logic at the bottom of the method: ```csharp -Xamarin.Essentials.Platform.OnLaunched(e); +protected override void OnLaunched(LaunchActivatedEventArgs args) +{ + // ... other code + + Microsoft.Maui.Essentials.Platform.OnLaunched(args); +} ``` ----- -## Create Actions + + +## Create actions -Add a reference to Xamarin.Essentials in your class: +Add a reference to the `Microsoft.Maui.Essentials` namespace in your class: ```csharp -using Xamarin.Essentials; +using Microsoft.Maui.Essentials; ``` -App Actions can be created at any time, but are often created when an application starts. Call the `SetAsync` method to create the list of actions for your app. +App Actions can be created at any time, but are often created when an application starts. Call the `SetAsync` method to create the list of actions for your app. ```csharp try @@ -90,18 +97,18 @@ catch (FeatureNotSupportedException ex) } ``` -If App Actions are not supported on the specific version of the operating system a `FeatureNotSupportedException` will be thrown. +If App Actions aren't supported on the specific version of the operating system a `FeatureNotSupportedException` will be thrown. The following properties can be set on an `AppAction`: -* Id: A unique identifier used to respond to the action tap. -* Title: the visible title to display. -* Subtitle: If supported a sub-title to display under the title. -* Icon: Must match icons in the corresponding resources directory on each platform. +- **Id**: A unique identifier used to respond to the action tap. +- **Title**: the visible title to display. +- **Subtitle**: If supported a sub-title to display under the title. +- **Icon**: Must match icons in the corresponding resources directory on each platform. -![App Actions on Homescreen.](images/appactions.png) +:::image type="content" source="images/appactions.png" alt-text="App actions on home screen."::: -## Responding To Actions +## Responding to actions When your application starts register for the `OnAppAction` event. When an app action is selected the event will be sent with information as to which action was selected. @@ -129,13 +136,10 @@ void AppActions_OnAppAction(object sender, AppActionEventArgs e) ``` ## GetActions + You can get the current list of App Actions by calling `AppActions.GetAsync()`. ## API -- [AppActions source code](https://github.com/xamarin/Essentials/tree/main/Xamarin.Essentials/AppActions) -- [AppActions API documentation](xref:Xamarin.Essentials.AppActions) - -## Related Video - -> [!Video https://channel9.msdn.com/Shows/XamarinShow/App-Actions-XamarinEssentials-API-of-the-Week/player] \ No newline at end of file +- [AppActions source code](https://github.com/dotnet/maui/tree/main/src/Essentials/src/AppActions) + diff --git a/docs/essentials/app-information.md b/docs/essentials/app-information.md index 788e4d482..3b98487d0 100644 --- a/docs/essentials/app-information.md +++ b/docs/essentials/app-information.md @@ -88,9 +88,3 @@ App information is taken from the `Package.appxmanifest` for the following field - [AppInfo source code](https://github.com/xamarin/Essentials/tree/main/Xamarin.Essentials/AppInfo) - [AppInfo API documentation](xref:Xamarin.Essentials.AppInfo) - -## Related Video - -> [!Video https://channel9.msdn.com/Shows/XamarinShow/App-Information-Essential-API-of-the-Week/player] - -[!INCLUDE [xamarin-show-essentials](includes/xamarin-show-essentials.md)] diff --git a/docs/essentials/app-theme.md b/docs/essentials/app-theme.md index 1001c8f9a..6feede59d 100644 --- a/docs/essentials/app-theme.md +++ b/docs/essentials/app-theme.md @@ -70,9 +70,3 @@ You can read more on the [UWP Requested Theme Documentation](/uwp/api/windows.ui - [AppInfo source code](https://github.com/xamarin/Essentials/tree/main/Xamarin.Essentials/AppInfo) - [AppInfo API documentation](xref:Xamarin.Essentials.AppInfo) - -## Related Video - -> [!Video https://channel9.msdn.com/Shows/XamarinShow/Theme-Detection-XamarinEssentials-API-of-the-Week/player] - -[!INCLUDE [xamarin-show-essentials](includes/xamarin-show-essentials.md)] diff --git a/docs/essentials/battery.md b/docs/essentials/battery.md index 766b8d622..07ac02d6e 100644 --- a/docs/essentials/battery.md +++ b/docs/essentials/battery.md @@ -179,9 +179,3 @@ No platform differences. - [Battery source code](https://github.com/xamarin/Essentials/tree/main/Xamarin.Essentials/Battery) - [Battery API documentation](xref:Xamarin.Essentials.Battery) - -## Related Video - -> [!Video https://channel9.msdn.com/Shows/XamarinShow/Battery-Essential-API-of-the-Week/player] - -[!INCLUDE [xamarin-show-essentials](includes/xamarin-show-essentials.md)] diff --git a/docs/essentials/clipboard.md b/docs/essentials/clipboard.md index 47f3e4b44..b544da0ec 100644 --- a/docs/essentials/clipboard.md +++ b/docs/essentials/clipboard.md @@ -67,9 +67,3 @@ public class ClipboardTest - [Clipboard source code](https://github.com/xamarin/Essentials/tree/main/Xamarin.Essentials/Clipboard) - [Clipboard API documentation](xref:Xamarin.Essentials.Clipboard) - -## Related Video - -> [!Video https://channel9.msdn.com/Shows/XamarinShow/Clipboard-XamarinEssentials-API-of-the-Week/player] - -[!INCLUDE [xamarin-show-essentials](includes/xamarin-show-essentials.md)] diff --git a/docs/essentials/color-converters.md b/docs/essentials/color-converters.md index 34d199586..441a944e7 100644 --- a/docs/essentials/color-converters.md +++ b/docs/essentials/color-converters.md @@ -79,9 +79,3 @@ The `ToSystemColor` method applies to Android.Graphics.Color, UIKit.UIColor, and - [Color Converters API documentation](xref:Xamarin.Essentials.ColorConverters) - [Color Extensions source code](https://github.com/xamarin/Essentials/tree/main/Xamarin.Essentials/Types/ColorConverters.shared.cs) - [Color Extensions API documentation](xref:Xamarin.Essentials.ColorExtensions) - -## Related Video - -> [!Video https://channel9.msdn.com/Shows/XamarinShow/Color-Converters-XamarinEssentials-API-of-the-Week/player] - -[!INCLUDE [xamarin-show-essentials](includes/xamarin-show-essentials.md)] diff --git a/docs/essentials/compass.md b/docs/essentials/compass.md index 4b67b5ad8..f5d997f38 100644 --- a/docs/essentials/compass.md +++ b/docs/essentials/compass.md @@ -94,9 +94,3 @@ This is only applied on the Android platform, and the parameter is ignored on iO - [Compass source code](https://github.com/xamarin/Essentials/tree/main/Xamarin.Essentials/Compass) - [Compass API documentation](xref:Xamarin.Essentials.Compass) - -## Related Video - -> [!Video https://channel9.msdn.com/Shows/XamarinShow/Compass-XamarinEssentials-API-of-the-Week/player] - -[!INCLUDE [xamarin-show-essentials](includes/xamarin-show-essentials.md)] diff --git a/docs/essentials/connectivity.md b/docs/essentials/connectivity.md index 9fc5851c6..e1b8b08e7 100644 --- a/docs/essentials/connectivity.md +++ b/docs/essentials/connectivity.md @@ -112,9 +112,3 @@ It is important to note that it is possible that `Internet` is reported by `Netw * [Connectivity source code](https://github.com/xamarin/Essentials/tree/main/Xamarin.Essentials/Connectivity) * [Connectivity API documentation](xref:Xamarin.Essentials.Connectivity) - -## Related Video - -> [!Video https://channel9.msdn.com/Shows/XamarinShow/Connectivity-Essential-API-of-the-Week/player] - -[!INCLUDE [xamarin-show-essentials](includes/xamarin-show-essentials.md)] diff --git a/docs/essentials/detect-shake.md b/docs/essentials/detect-shake.md index 29e6cc08f..288f2e1d9 100644 --- a/docs/essentials/detect-shake.md +++ b/docs/essentials/detect-shake.md @@ -75,9 +75,3 @@ The detect shake API uses raw readings from the accelerometer to calculate accel - [Accelerometer source code](https://github.com/xamarin/Essentials/tree/main/Xamarin.Essentials/Accelerometer) - [Accelerometer API documentation](xref:Xamarin.Essentials.Accelerometer) - -## Related Video - -> [!Video https://channel9.msdn.com/Shows/XamarinShow/Detect-Shake-XamarinEssentials-API-of-the-Week/player] - -[!INCLUDE [xamarin-show-essentials](includes/xamarin-show-essentials.md)] diff --git a/docs/essentials/device-display.md b/docs/essentials/device-display.md index 97c17ddc0..dd36b8b14 100644 --- a/docs/essentials/device-display.md +++ b/docs/essentials/device-display.md @@ -101,9 +101,3 @@ No differences. - [DeviceDisplay source code](https://github.com/xamarin/Essentials/tree/main/Xamarin.Essentials/DeviceDisplay) - [DeviceDisplay API documentation](xref:Xamarin.Essentials.DeviceDisplay) - -## Related Video - -> [!Video https://channel9.msdn.com/Shows/XamarinShow/Device-Display-Information-XamarinEssentials-API-of-the-Week/player] - -[!INCLUDE [xamarin-show-essentials](includes/xamarin-show-essentials.md)] diff --git a/docs/essentials/device-information.md b/docs/essentials/device-information.md index d9fd9b510..d98cead0d 100644 --- a/docs/essentials/device-information.md +++ b/docs/essentials/device-information.md @@ -85,9 +85,3 @@ iOS does not expose an API for developers to get the model of the specific iOS d - [DeviceInfo source code](https://github.com/xamarin/Essentials/tree/main/Xamarin.Essentials/DeviceInfo) - [DeviceInfo API documentation](xref:Xamarin.Essentials.DeviceInfo) - -## Related Video - -> [!Video https://channel9.msdn.com/Shows/XamarinShow/Device-Information-XamarinEssentials-API-of-the-Week/player] - -[!INCLUDE [xamarin-show-essentials](includes/xamarin-show-essentials.md)] diff --git a/docs/essentials/email.md b/docs/essentials/email.md index e04d0f66d..64c642b35 100644 --- a/docs/essentials/email.md +++ b/docs/essentials/email.md @@ -136,9 +136,3 @@ Not all email clients support sending attachments. See [documentation](/windows/ - [Email source code](https://github.com/xamarin/Essentials/tree/main/Xamarin.Essentials/Email) - [Email API documentation](xref:Xamarin.Essentials.Email) - -## Related Video - -> [!Video https://channel9.msdn.com/Shows/XamarinShow/Email-XamarinEssentials-API-of-the-Week/player] - -[!INCLUDE [xamarin-show-essentials](includes/xamarin-show-essentials.md)] diff --git a/docs/essentials/file-system-helpers.md b/docs/essentials/file-system-helpers.md index ca82a5572..0eccabaef 100644 --- a/docs/essentials/file-system-helpers.md +++ b/docs/essentials/file-system-helpers.md @@ -80,9 +80,3 @@ Add any file into the root in the UWP project and mark the Build Action as **Con - [File System Helpers source code](https://github.com/xamarin/Essentials/tree/main/Xamarin.Essentials/FileSystem) - [File System API documentation](xref:Xamarin.Essentials.FileSystem) - -## Related Video - -> [!Video https://channel9.msdn.com/Shows/XamarinShow/File-System-Helpers-XamarinEssentials-API-of-the-Week/player] - -[!INCLUDE [xamarin-show-essentials](includes/xamarin-show-essentials.md)] diff --git a/docs/essentials/flashlight.md b/docs/essentials/flashlight.md index 61bd4e98a..615eaf3cd 100644 --- a/docs/essentials/flashlight.md +++ b/docs/essentials/flashlight.md @@ -120,9 +120,3 @@ A camera surface texture is created to turn on or off the `FlashMode` of the cam - [Flashlight source code](https://github.com/xamarin/Essentials/tree/main/Xamarin.Essentials/Flashlight) - [Flashlight API documentation](xref:Xamarin.Essentials.Flashlight) - -## Related Video - -> [!Video https://channel9.msdn.com/Shows/XamarinShow/Flashlight-XamarinEssentials-API-of-the-Week/player] - -[!INCLUDE [xamarin-show-essentials](includes/xamarin-show-essentials.md)] diff --git a/docs/essentials/geocoding.md b/docs/essentials/geocoding.md index 85f6c2370..fa4d46c18 100644 --- a/docs/essentials/geocoding.md +++ b/docs/essentials/geocoding.md @@ -120,9 +120,3 @@ The [`Location`](xref:Xamarin.Essentials.Location) and [`LocationExtensions`](xr - [Geocoding source code](https://github.com/xamarin/Essentials/tree/main/Xamarin.Essentials/Geocoding) - [Geocoding API documentation](xref:Xamarin.Essentials.Geocoding) - -## Related Video - -> [!Video https://channel9.msdn.com/Shows/XamarinShow/Geocoding-XamarinEssentials-API-of-the-Week/player] - -[!INCLUDE [xamarin-show-essentials](includes/xamarin-show-essentials.md)] diff --git a/docs/essentials/geolocation.md b/docs/essentials/geolocation.md index f3797abac..15b656fc0 100644 --- a/docs/essentials/geolocation.md +++ b/docs/essentials/geolocation.md @@ -265,9 +265,3 @@ On UWP, altitude is returned in meters. See the [AltitudeReferenceSystem](/uwp/a - [Geolocation source code](https://github.com/xamarin/Essentials/tree/main/Xamarin.Essentials/Geolocation) - [Geolocation API documentation](xref:Xamarin.Essentials.Geolocation) - -## Related Video - -> [!Video https://channel9.msdn.com/Shows/XamarinShow/Geolocation-XamarinEssentials-API-of-the-Week/player] - -[!INCLUDE [xamarin-show-essentials](includes/xamarin-show-essentials.md)] diff --git a/docs/essentials/includes/android-permissions.md b/docs/essentials/includes/android-permissions.md index bdd5606a4..c2bb2864b 100644 --- a/docs/essentials/includes/android-permissions.md +++ b/docs/essentials/includes/android-permissions.md @@ -1,29 +1,28 @@ --- ms.topic: include -author: jamesmontemagno -ms.author: jamont -ms.date: 05/11/2020 +ms.date: 08/04/2021 --- -This API uses runtime permissions on Android. Please ensure that Xamarin.Essentials is fully initialized and permission handling is setup in your app. -In the Android project's `MainLauncher` or any `Activity` that is launched Xamarin.Essentials must be initialized in the `OnCreate` method: +This API uses runtime permissions on Android. Please ensure that .NET MAUI Essentials is fully initialized and permission handling is setup in your app. For more information, see [Get Started with .NET MAUI Essentials](../get-started.md). + +In the Android project's `MainLauncher` or any `Activity` that is launched, .NET MAUI Essentials must be initialized in the `OnCreate` method: ```csharp protected override void OnCreate(Bundle savedInstanceState) { //... base.OnCreate(savedInstanceState); - Xamarin.Essentials.Platform.Init(this, savedInstanceState); // add this line to your code, it may also be called: bundle + Microsoft.Maui.Essentials.Platform.Init(this, savedInstanceState); // add this line to your code, it may also be called: bundle //... } ``` -To handle runtime permissions on Android, Xamarin.Essentials must receive any `OnRequestPermissionsResult`. Add the following code to all `Activity` classes: +To handle runtime permissions on Android, .NET MAUI Essentials must receive any `OnRequestPermissionsResult`. Add the following code to all `Activity` classes: ```csharp public override void OnRequestPermissionsResult(int requestCode, string[] permissions, Android.Content.PM.Permission[] grantResults) { - Xamarin.Essentials.Platform.OnRequestPermissionsResult(requestCode, permissions, grantResults); + Microsoft.Maui.Essentials.Platform.OnRequestPermissionsResult(requestCode, permissions, grantResults); base.OnRequestPermissionsResult(requestCode, permissions, grantResults); } diff --git a/docs/essentials/includes/get-started.md b/docs/essentials/includes/get-started.md index f8372a99d..656ba8586 100644 --- a/docs/essentials/includes/get-started.md +++ b/docs/essentials/includes/get-started.md @@ -1,7 +1,6 @@ --- ms.topic: include -author: jamesmontemagno -ms.author: jamont -ms.date: 10/31/2018 +ms.date: 08/02/2021 --- -To start using this API, read the [getting started](~/essentials/get-started.md) guide for Xamarin.Essentials to ensure the library is properly installed and set up in your projects. + +To start using this API, read the [getting started](../get-started.md) guide for .NET MAUI Essentials to make sure it's correctly configured for your target platform. diff --git a/docs/essentials/includes/ios-PresentationSourceBounds.md b/docs/essentials/includes/ios-PresentationSourceBounds.md index 3c3b881ed..765c393e8 100644 --- a/docs/essentials/includes/ios-PresentationSourceBounds.md +++ b/docs/essentials/includes/ios-PresentationSourceBounds.md @@ -1,41 +1,41 @@ --- ms.topic: include -author: jamont -ms.author: jamont -ms.date: 01/16/2020 +ms.date: 08/04/2021 --- -When requesting a share or opening launcher on iPadOS you have the ability to present in a pop over control. This specifies where the pop over will appear and point an arrow directly to. This location is often the control that launched the action. You can specify the location using the `PresentationSourceBounds` property: +When requesting a share or opening launcher on iPadOS, you can present in a popover. This specifies where the pop over will appear and point an arrow directly to. This location is often the control that launched the action. You can specify the location using the `PresentationSourceBounds` property: ```csharp await Share.RequestAsync(new ShareFileRequest -{ - Title = Title, - File = new ShareFile(file), - PresentationSourceBounds = DeviceInfo.Platform== DevicePlatform.iOS && DeviceInfo.Idiom == DeviceIdiom.Tablet - ? new System.Drawing.Rectangle(0, 20, 0, 0) - : System.Drawing.Rectangle.Empty -}); + { + Title = Title, + File = new ShareFile(file), + PresentationSourceBounds = DeviceInfo.Platform== DevicePlatform.iOS && DeviceInfo.Idiom == DeviceIdiom.Tablet + ? new System.Drawing.Rectangle(0, 20, 0, 0) + : System.Drawing.Rectangle.Empty + }); ``` ```csharp await Launcher.OpenAsync(new OpenFileRequest -{ - File = new ReadOnlyFile(file), - PresentationSourceBounds = DeviceInfo.Platform== DevicePlatform.iOS && DeviceInfo.Idiom == DeviceIdiom.Tablet - ? new System.Drawing.Rectangle(0, 20, 0, 0) - : System.Drawing.Rectangle.Empty -}); + { + File = new ReadOnlyFile(file), + PresentationSourceBounds = DeviceInfo.Platform== DevicePlatform.iOS && DeviceInfo.Idiom == DeviceIdiom.Tablet + ? new System.Drawing.Rectangle(0, 20, 0, 0) + : System.Drawing.Rectangle.Empty + }); ``` + + Everything described here works equally for `Share` and `Launcher`. -If you are using Xamarin.Forms you are able to pass in a `View` and calculate the bounds: +Here are some extension methods that help calculate the bounds of a view: ```csharp public static class ViewHelpers { - public static Rectangle GetAbsoluteBounds(this Xamarin.Forms.View element) + public static Rectangle GetAbsoluteBounds(this Microsoft.Maui.Controls.View element) { Element looper = element; @@ -47,7 +47,7 @@ public static class ViewHelpers while (looper.Parent != null) { looper = looper.Parent; - if (looper is Xamarin.Forms.View v) + if (looper is Microsoft.Maui.Controls.View v) { absoluteX += v.X + v.Margin.Top; absoluteY += v.Y + v.Margin.Left; @@ -64,9 +64,12 @@ public static class ViewHelpers This can then be used when calling `RequstAsync`: + + ```csharp -public Command ShareCommand { get; } = new Command(Share); -async void Share(Xamarin.Forms.View element) +public Command ShareCommand { get; } = new Command(Share); + +async void Share(Microsoft.Maui.Controls.View element) { try { diff --git a/docs/essentials/includes/sensor-speed.md b/docs/essentials/includes/sensor-speed.md index 638dd9f83..d27feda96 100644 --- a/docs/essentials/includes/sensor-speed.md +++ b/docs/essentials/includes/sensor-speed.md @@ -1,11 +1,13 @@ --- ms.topic: include +ms.date: 08/02/2021 --- -## [Sensor Speed](xref:Xamarin.Essentials.SensorSpeed) + +## Sensor Speed - **Fastest** – Get the sensor data as fast as possible (not guaranteed to return on UI thread). - **Game** – Rate suitable for games (not guaranteed to return on UI thread). - **Default** – Default rate suitable for screen orientation changes. - **UI** – Rate suitable for general user interface. -If your event handler is not guaranteed to run on the UI thread, and if the event handler needs to access user-interface elements, use the [`MainThread.BeginInvokeOnMainThread`](~/essentials/main-thread.md) method to run that code on the UI thread. +If your event handler is not guaranteed to run on the UI thread, and if the event handler needs to access user-interface elements, use the [`MainThread.BeginInvokeOnMainThread`](../main-thread.md) method to run that code on the UI thread. diff --git a/docs/essentials/includes/tip-file-result.md b/docs/essentials/includes/tip-file-result.md index 0796ed979..8d3ba104e 100644 --- a/docs/essentials/includes/tip-file-result.md +++ b/docs/essentials/includes/tip-file-result.md @@ -1,9 +1,7 @@ --- ms.topic: include -author: dimonovdd -ms.author: jamont -ms.date: 04/16/2020 +ms.date: 08/04/2021 --- > [!TIP] -> The `FullPath` property does not always return the physical path to the file. To get the file, use the `OpenReadAsync` method. +> The `FullPath` property doesn't always return the physical path to the file. To get the file, use the `OpenReadAsync` method. diff --git a/docs/essentials/includes/xamarin-show-essentials.md b/docs/essentials/includes/xamarin-show-essentials.md deleted file mode 100644 index a628c4f0e..000000000 --- a/docs/essentials/includes/xamarin-show-essentials.md +++ /dev/null @@ -1,7 +0,0 @@ ---- -ms.topic: include -author: jamesmontemagno -ms.author: jamont -ms.date: 05/28/2019 ---- -Find more Xamarin videos on [Channel 9](https://channel9.msdn.com/Shows/XamarinShow) and [YouTube](https://www.youtube.com/c/XamarinDevelopers). diff --git a/docs/essentials/launcher.md b/docs/essentials/launcher.md index 5d0ff6815..8f9679f59 100644 --- a/docs/essentials/launcher.md +++ b/docs/essentials/launcher.md @@ -119,9 +119,3 @@ No platform differences. - [Launcher source code](https://github.com/xamarin/Essentials/tree/main/Xamarin.Essentials/Launcher) - [Launcher API documentation](xref:Xamarin.Essentials.Launcher) - -## Related Video - -> [!Video https://channel9.msdn.com/Shows/XamarinShow/Launcher-XamarinEssentials-API-of-the-Week/player] - -[!INCLUDE [xamarin-show-essentials](includes/xamarin-show-essentials.md)] diff --git a/docs/essentials/main-thread.md b/docs/essentials/main-thread.md index d9a49a4de..d6b5d634e 100644 --- a/docs/essentials/main-thread.md +++ b/docs/essentials/main-thread.md @@ -111,9 +111,3 @@ The `MainThread` class includes the following additional `static` methods that c - [MainThread source code](https://github.com/xamarin/Essentials/tree/main/Xamarin.Essentials/MainThread) - [MainThread API documentation](xref:Xamarin.Essentials.MainThread) - -## Related Video - -> [!Video https://channel9.msdn.com/Shows/XamarinShow/Main-Thread-XamarinEssentials-API-of-the-Week/player] - -[!INCLUDE [xamarin-show-essentials](includes/xamarin-show-essentials.md)] diff --git a/docs/essentials/maps.md b/docs/essentials/maps.md index 181f9d455..76b67f076 100644 --- a/docs/essentials/maps.md +++ b/docs/essentials/maps.md @@ -153,9 +153,3 @@ No platform-specific implementation details. - [Map source code](https://github.com/xamarin/Essentials/tree/main/Xamarin.Essentials/Map) - [Map API documentation](xref:Xamarin.Essentials.Map) - -## Related Video - -> [!Video https://channel9.msdn.com/Shows/XamarinShow/Maps-XamarinEssentials-API-of-the-Week/player] - -[!INCLUDE [xamarin-show-essentials](includes/xamarin-show-essentials.md)] diff --git a/docs/essentials/open-browser.md b/docs/essentials/open-browser.md index 6ed6dff5c..4cfc9a06b 100644 --- a/docs/essentials/open-browser.md +++ b/docs/essentials/open-browser.md @@ -129,9 +129,3 @@ The user's default browser will always be launched regardless of the `BrowserLau - [Browser source code](https://github.com/xamarin/Essentials/tree/main/Xamarin.Essentials/Browser) - [Browser API documentation](xref:Xamarin.Essentials.Browser) - -## Related Video - -> [!Video https://channel9.msdn.com/Shows/XamarinShow/Open-Browser-XamarinEssentials-API-of-the-Week/player] - -[!INCLUDE [xamarin-show-essentials](includes/xamarin-show-essentials.md)] diff --git a/docs/essentials/permissions.md b/docs/essentials/permissions.md index 491e13bd5..c01aa8a3e 100644 --- a/docs/essentials/permissions.md +++ b/docs/essentials/permissions.md @@ -266,10 +266,3 @@ Read more on the [App Capability Declaration](/windows/uwp/packaging/app-capabil - [Permissions source code](https://github.com/xamarin/Essentials/tree/main/Xamarin.Essentials/Permissions) - [Permissions API documentation](xref:Xamarin.Essentials.Permissions) - - -## Related Video - -> [!Video https://channel9.msdn.com/Shows/XamarinShow/Permissions-XamarinEssentials-API-of-the-Week/player] - -[!INCLUDE [xamarin-show-essentials](includes/xamarin-show-essentials.md)] diff --git a/docs/essentials/phone-dialer.md b/docs/essentials/phone-dialer.md index d5abd6900..fe57891cc 100644 --- a/docs/essentials/phone-dialer.md +++ b/docs/essentials/phone-dialer.md @@ -80,9 +80,3 @@ public class PhoneDialerTest - [Phone Dialer source code](https://github.com/xamarin/Essentials/tree/main/Xamarin.Essentials/PhoneDialer) - [Phone Dialer API documentation](xref:Xamarin.Essentials.PhoneDialer) - -## Related Video - -> [!Video https://channel9.msdn.com/Shows/XamarinShow/Phone-Dialer-XamarinEssentials-API-of-the-Week/player] - -[!INCLUDE [xamarin-show-essentials](includes/xamarin-show-essentials.md)] diff --git a/docs/essentials/preferences.md b/docs/essentials/preferences.md index f2d07a597..1c6b6792e 100644 --- a/docs/essentials/preferences.md +++ b/docs/essentials/preferences.md @@ -112,9 +112,3 @@ When storing a string, this API is intended to store small amounts of text. Perf - [Preferences source code](https://github.com/xamarin/Essentials/tree/main/Xamarin.Essentials/Preferences) - [Preferences API documentation](xref:Xamarin.Essentials.Preferences) - -## Related Video - -> [!Video https://channel9.msdn.com/Shows/XamarinShow/Preferences-Essential-API-of-the-Week/player] - -[!INCLUDE [xamarin-show-essentials](includes/xamarin-show-essentials.md)] diff --git a/docs/essentials/secure-storage.md b/docs/essentials/secure-storage.md index 3ebc08968..d1be7a33b 100644 --- a/docs/essentials/secure-storage.md +++ b/docs/essentials/secure-storage.md @@ -166,9 +166,3 @@ This API is intended to store small amounts of text. Performance may be slow if - [SecureStorage source code](https://github.com/xamarin/Essentials/tree/main/Xamarin.Essentials/SecureStorage) - [SecureStorage API documentation](xref:Xamarin.Essentials.SecureStorage) - -## Related Video - -> [!Video https://channel9.msdn.com/Shows/XamarinShow/Secure-Storage-XamarinEssentials-API-of-the-Week/player] - -[!INCLUDE [xamarin-show-essentials](includes/xamarin-show-essentials.md)] diff --git a/docs/essentials/share.md b/docs/essentials/share.md index d7475c94d..ae0c05233 100644 --- a/docs/essentials/share.md +++ b/docs/essentials/share.md @@ -138,9 +138,3 @@ await Share.RequestAsync(new ShareMultipleFilesRequest - [Share source code](https://github.com/xamarin/Essentials/tree/main/Xamarin.Essentials/Share) - [Share API documentation](xref:Xamarin.Essentials.Share) - -## Related Video - -> [!Video https://channel9.msdn.com/Shows/XamarinShow/Share-Essential-API-of-the-Week/player] - -[!INCLUDE [xamarin-show-essentials](includes/xamarin-show-essentials.md)] diff --git a/docs/essentials/sms.md b/docs/essentials/sms.md index 9dcf8c7f5..79200a6bc 100644 --- a/docs/essentials/sms.md +++ b/docs/essentials/sms.md @@ -103,9 +103,3 @@ public class SmsTest - [Sms source code](https://github.com/xamarin/Essentials/tree/main/Xamarin.Essentials/Sms) - [Sms API documentation](xref:Xamarin.Essentials.Sms) - -## Related Video - -> [!Video https://channel9.msdn.com/Shows/XamarinShow/SMS-XamarinEssentials-API-of-the-Week/player] - -[!INCLUDE [xamarin-show-essentials](includes/xamarin-show-essentials.md)] diff --git a/docs/essentials/text-to-speech.md b/docs/essentials/text-to-speech.md index f6d261452..08c26707b 100644 --- a/docs/essentials/text-to-speech.md +++ b/docs/essentials/text-to-speech.md @@ -146,9 +146,3 @@ public async Task SpeakNow() - [TextToSpeech source code](https://github.com/xamarin/Essentials/tree/main/Xamarin.Essentials/TextToSpeech) - [TextToSpeech API documentation](xref:Xamarin.Essentials.TextToSpeech) - -## Related Video - -> [!Video https://channel9.msdn.com/Shows/XamarinShow/Text-to-Speech-XamarinEssentials-API-of-the-Week/player] - -[!INCLUDE [xamarin-show-essentials](includes/xamarin-show-essentials.md)] diff --git a/docs/essentials/unit-converters.md b/docs/essentials/unit-converters.md index c09b60a82..f4d5bf97f 100644 --- a/docs/essentials/unit-converters.md +++ b/docs/essentials/unit-converters.md @@ -66,9 +66,3 @@ Here is a list of available conversions: - [Unit Converters source code](https://github.com/xamarin/Essentials/tree/main/Xamarin.Essentials/Types/UnitConverters.shared.cs) - [Unit Converters API documentation](xref:Xamarin.Essentials.UnitConverters) - -## Related Video - -> [!Video https://channel9.msdn.com/Shows/XamarinShow/Unit-Conversion-XamarinEssentials-API-of-the-Week/player] - -[!INCLUDE [xamarin-show-essentials](includes/xamarin-show-essentials.md)] diff --git a/docs/essentials/version-tracking.md b/docs/essentials/version-tracking.md index 714d307d9..541a195f6 100644 --- a/docs/essentials/version-tracking.md +++ b/docs/essentials/version-tracking.md @@ -76,9 +76,3 @@ All version information is stored using the [Preferences](preferences.md) API in - [Version Tracking source code](https://github.com/xamarin/Essentials/tree/main/Xamarin.Essentials/VersionTracking) - [Version Tracking API documentation](xref:Xamarin.Essentials.VersionTracking) - -## Related Video - -> [!Video https://channel9.msdn.com/Shows/XamarinShow/Version-Tracking-XamarinEssentials-API-of-the-Week/player] - -[!INCLUDE [xamarin-show-essentials](includes/xamarin-show-essentials.md)] diff --git a/docs/essentials/vibrate.md b/docs/essentials/vibrate.md index 72367374a..3a687b2b5 100644 --- a/docs/essentials/vibrate.md +++ b/docs/essentials/vibrate.md @@ -117,9 +117,3 @@ No platform differences. - [Vibration source code](https://github.com/xamarin/Essentials/tree/main/Xamarin.Essentials/Vibration) - [Vibration API documentation](xref:Xamarin.Essentials.Vibration) - -## Related Video - -> [!Video https://channel9.msdn.com/Shows/XamarinShow/Vibration-XamarinEssentials-API-of-the-Week/player] - -[!INCLUDE [xamarin-show-essentials](includes/xamarin-show-essentials.md)]