From 1efa4385ea9d73a747e02b136d9d2721b14413a8 Mon Sep 17 00:00:00 2001 From: Andy De George Date: Tue, 3 Aug 2021 16:55:16 -0700 Subject: [PATCH 1/6] First two articles ported --- docs/essentials/accelerometer.md | 44 ++++++--------- docs/essentials/app-actions.md | 71 ++++++++++++------------ docs/essentials/includes/get-started.md | 6 +- docs/essentials/includes/sensor-speed.md | 5 +- 4 files changed, 58 insertions(+), 68 deletions(-) diff --git a/docs/essentials/accelerometer.md b/docs/essentials/accelerometer.md index 99431b65e..474b922a9 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 class lets you monitor the device's accelerometer sensor, which indicates the acceleration of the device in 3D space. The `Accelerometer` class is part of the .NET MAUI Essentials library that is included with the .NET MAUI Workload. ## 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 and methods to listen for changes to the acceleration. Any changes are sent back through the 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) +- [Accelerometer API documentation](xref:Microsoft.Maui.Essentials.Accelerometer) diff --git a/docs/essentials/app-actions.md b/docs/essentials/app-actions.md index 67a5438d4..354ac6f2f 100644 --- a/docs/essentials/app-actions.md +++ b/docs/essentials/app-actions.md @@ -1,33 +1,32 @@ --- -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 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 })] +[Activity(Theme = "@style/Maui.SplashTheme", MainLauncher = true, ConfigurationChanges = ConfigChanges.ScreenSize | ConfigChanges.Orientation | ConfigChanges.UiMode | ConfigChanges.ScreenLayout | ConfigChanges.SmallestScreenSize)] +public class MainActivity : MauiAppCompatActivity { ... +} ``` Then add the following logic to handle actions: @@ -37,24 +36,24 @@ protected override void OnResume() { base.OnResume(); - Xamarin.Essentials.Platform.OnResume(this); + Microsoft.Maui.Essentials.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) @@ -62,20 +61,25 @@ public override void PerformActionForShortcutItem(UIApplication application, UIA 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 +94,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 +133,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) +- [AppActions API documentation](xref:Microsft.Maui.Essentials.AppActions) diff --git a/docs/essentials/includes/get-started.md b/docs/essentials/includes/get-started.md index f8372a99d..2fff8faf6 100644 --- a/docs/essentials/includes/get-started.md +++ b/docs/essentials/includes/get-started.md @@ -1,7 +1,5 @@ --- 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 Xamarin.Essentials to ensure the library is properly installed and set up in your projects. diff --git a/docs/essentials/includes/sensor-speed.md b/docs/essentials/includes/sensor-speed.md index 638dd9f83..cf642bfa8 100644 --- a/docs/essentials/includes/sensor-speed.md +++ b/docs/essentials/includes/sensor-speed.md @@ -1,11 +1,12 @@ --- ms.topic: include +ms.date: 08/02/2021 --- -## [Sensor Speed](xref:Xamarin.Essentials.SensorSpeed) +## [Sensor Speed](xref:Microsoft.Maui.Essentials.SensorSpeed) - **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. From 00657562bce45d77421d2b63104c5bd10bebe23b Mon Sep 17 00:00:00 2001 From: Andy De George Date: Wed, 4 Aug 2021 13:01:14 -0700 Subject: [PATCH 2/6] Feedback --- docs/essentials/accelerometer.md | 6 +++--- docs/essentials/app-actions.md | 15 +++++++++------ docs/essentials/includes/get-started.md | 3 ++- docs/essentials/includes/sensor-speed.md | 3 ++- 4 files changed, 16 insertions(+), 11 deletions(-) diff --git a/docs/essentials/accelerometer.md b/docs/essentials/accelerometer.md index 474b922a9..07aea0f4d 100644 --- a/docs/essentials/accelerometer.md +++ b/docs/essentials/accelerometer.md @@ -7,7 +7,7 @@ no-loc: ["Microsoft.Maui", "Microsoft.Maui.Essentials", "A", "G", "X", "Y", "Z"] # Accelerometer -The class lets you monitor the device's accelerometer sensor, which indicates the acceleration of the device in 3D space. The `Accelerometer` class is part of the .NET MAUI Essentials library that is included with the .NET MAUI Workload. +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 @@ -21,7 +21,7 @@ Add a reference to the `Microsoft.Maui.Essentials` namespace in your class: using Microsoft.Maui.Essentials; ``` -The accelerometer functionality works by calling the and methods to listen for changes to the acceleration. Any changes are sent back through the event. Here's a sample of using the accelerometer: +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 @@ -82,4 +82,4 @@ Examples: ## API - [Accelerometer source code](https://github.com/dotnet/maui/tree/main/src/Essentials/src/Accelerometer) -- [Accelerometer API documentation](xref:Microsoft.Maui.Essentials.Accelerometer) + diff --git a/docs/essentials/app-actions.md b/docs/essentials/app-actions.md index 354ac6f2f..3ba70210a 100644 --- a/docs/essentials/app-actions.md +++ b/docs/essentials/app-actions.md @@ -7,7 +7,7 @@ no-loc: ["Microsoft.Maui", "Microsoft.Maui.Essentials", "AppDelegate.cs", "AppAc # App Actions -The 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. +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 @@ -15,6 +15,8 @@ The class lets you create and respon To access the `AppActions` functionality the following platform specific setup is required. + + # [Android](#tab/android) Add the intent filter to your `MainActivity` class: @@ -22,7 +24,6 @@ Add the intent filter to your `MainActivity` class: ```csharp [IntentFilter(new[] { Microsoft.Maui.Essentials.Platform.Intent.ActionAppAction }, Categories = new[] { Android.Content.Intent.CategoryDefault })] -[Activity(Theme = "@style/Maui.SplashTheme", MainLauncher = true, ConfigurationChanges = ConfigChanges.ScreenSize | ConfigChanges.Orientation | ConfigChanges.UiMode | ConfigChanges.ScreenLayout | ConfigChanges.SmallestScreenSize)] public class MainActivity : MauiAppCompatActivity { ... @@ -36,7 +37,7 @@ protected override void OnResume() { base.OnResume(); - Microsoft.Maui.Essentials.Essentials.Platform.OnResume(this); + Microsoft.Maui.Essentials.Platform.OnResume(this); } protected override void OnNewIntent(Android.Content.Intent intent) @@ -56,7 +57,7 @@ public override void PerformActionForShortcutItem(UIApplication application, UIA => 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: @@ -71,6 +72,8 @@ protected override void OnLaunched(LaunchActivatedEventArgs args) ----- + + ## Create actions Add a reference to the `Microsoft.Maui.Essentials` namespace in your class: @@ -103,7 +106,7 @@ The following properties can be set on an `AppAction`: - **Subtitle**: If supported a sub-title to display under the title. - **Icon**: Must match icons in the corresponding resources directory on each platform. -:::image type="content" source="images/appactions.png" alt-text="App actions on home screen"::: +:::image type="content" source="images/appactions.png" alt-text="App actions on home screen."::: ## Responding to actions @@ -139,4 +142,4 @@ You can get the current list of App Actions by calling `AppActions.GetAsync()`. ## API - [AppActions source code](https://github.com/dotnet/maui/tree/main/src/Essentials/src/AppActions) -- [AppActions API documentation](xref:Microsft.Maui.Essentials.AppActions) + diff --git a/docs/essentials/includes/get-started.md b/docs/essentials/includes/get-started.md index 2fff8faf6..656ba8586 100644 --- a/docs/essentials/includes/get-started.md +++ b/docs/essentials/includes/get-started.md @@ -2,4 +2,5 @@ ms.topic: include ms.date: 08/02/2021 --- -To start using this API, read the [getting started](../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/sensor-speed.md b/docs/essentials/includes/sensor-speed.md index cf642bfa8..d27feda96 100644 --- a/docs/essentials/includes/sensor-speed.md +++ b/docs/essentials/includes/sensor-speed.md @@ -2,7 +2,8 @@ ms.topic: include ms.date: 08/02/2021 --- -## [Sensor Speed](xref:Microsoft.Maui.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). From f0c1c3d744a88823e1a3d85614c92b1cfc0e3a54 Mon Sep 17 00:00:00 2001 From: Andy De George Date: Wed, 4 Aug 2021 15:43:23 -0700 Subject: [PATCH 3/6] Fix includes --- .../includes/android-permissions.md | 15 +++--- .../includes/ios-PresentationSourceBounds.md | 47 ++++++++++--------- docs/essentials/includes/tip-file-result.md | 6 +-- 3 files changed, 34 insertions(+), 34 deletions(-) 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/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/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. From 8b7bb306f22874b135b3a19990d194fcd407e26e Mon Sep 17 00:00:00 2001 From: Andy De George Date: Wed, 4 Aug 2021 15:46:32 -0700 Subject: [PATCH 4/6] Remove xamarin vid include & vid sections --- docs/essentials/app-information.md | 6 ------ docs/essentials/app-theme.md | 6 ------ docs/essentials/battery.md | 6 ------ docs/essentials/clipboard.md | 6 ------ docs/essentials/color-converters.md | 6 ------ docs/essentials/compass.md | 6 ------ docs/essentials/connectivity.md | 6 ------ docs/essentials/detect-shake.md | 6 ------ docs/essentials/device-display.md | 6 ------ docs/essentials/device-information.md | 6 ------ docs/essentials/email.md | 6 ------ docs/essentials/file-system-helpers.md | 6 ------ docs/essentials/flashlight.md | 6 ------ docs/essentials/geocoding.md | 6 ------ docs/essentials/geolocation.md | 6 ------ docs/essentials/includes/xamarin-show-essentials.md | 7 ------- docs/essentials/launcher.md | 6 ------ docs/essentials/main-thread.md | 6 ------ docs/essentials/maps.md | 6 ------ docs/essentials/open-browser.md | 6 ------ docs/essentials/permissions.md | 7 ------- docs/essentials/phone-dialer.md | 6 ------ docs/essentials/preferences.md | 6 ------ docs/essentials/secure-storage.md | 6 ------ docs/essentials/share.md | 6 ------ docs/essentials/sms.md | 6 ------ docs/essentials/text-to-speech.md | 6 ------ docs/essentials/unit-converters.md | 6 ------ docs/essentials/version-tracking.md | 6 ------ docs/essentials/vibrate.md | 6 ------ 30 files changed, 182 deletions(-) delete mode 100644 docs/essentials/includes/xamarin-show-essentials.md 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/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)] From fd0b9648498505cd00a89c468bd96ed511072029 Mon Sep 17 00:00:00 2001 From: Andy De George Date: Wed, 4 Aug 2021 16:38:03 -0700 Subject: [PATCH 5/6] Add new include 4 essentials namespace --- docs/essentials/includes/essentials-namespace.md | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 docs/essentials/includes/essentials-namespace.md diff --git a/docs/essentials/includes/essentials-namespace.md b/docs/essentials/includes/essentials-namespace.md new file mode 100644 index 000000000..9b9a4e70e --- /dev/null +++ b/docs/essentials/includes/essentials-namespace.md @@ -0,0 +1,10 @@ +--- +ms.topic: include +ms.date: 08/04/2021 +--- + +Import the `Microsoft.Maui.Essentials` namespace in your class: + +```csharp +using Microsoft.Maui.Essentials; +``` \ No newline at end of file From dc8fca0ad837ea9b1aded14da871c78fb24a9164 Mon Sep 17 00:00:00 2001 From: Andy De George Date: Wed, 4 Aug 2021 16:38:12 -0700 Subject: [PATCH 6/6] Article updates --- docs/essentials/accelerometer.md | 6 +-- docs/essentials/app-actions.md | 6 +-- docs/essentials/app-information.md | 37 +++++++++--------- docs/essentials/app-theme.md | 61 ++++++++++++++---------------- docs/essentials/barometer.md | 37 +++++++++--------- 5 files changed, 66 insertions(+), 81 deletions(-) diff --git a/docs/essentials/accelerometer.md b/docs/essentials/accelerometer.md index 07aea0f4d..3f3a09628 100644 --- a/docs/essentials/accelerometer.md +++ b/docs/essentials/accelerometer.md @@ -15,11 +15,7 @@ The `Microsoft.Maui.Essentials.Accelerometer` class lets you monitor the device' ## Using Accelerometer -Add a reference to the `Microsoft.Maui.Essentials` namespace in your class: - -```csharp -using Microsoft.Maui.Essentials; -``` +[!INCLUDE [essentials-namespace](includes/essentials-namespace.md)] 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: diff --git a/docs/essentials/app-actions.md b/docs/essentials/app-actions.md index 3ba70210a..abf5b623d 100644 --- a/docs/essentials/app-actions.md +++ b/docs/essentials/app-actions.md @@ -76,11 +76,7 @@ protected override void OnLaunched(LaunchActivatedEventArgs args) ## Create actions -Add a reference to the `Microsoft.Maui.Essentials` namespace in your class: - -```csharp -using Microsoft.Maui.Essentials; -``` +[!INCLUDE [essentials-namespace](includes/essentials-namespace.md)] 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. diff --git a/docs/essentials/app-information.md b/docs/essentials/app-information.md index 3b98487d0..1816104a8 100644 --- a/docs/essentials/app-information.md +++ b/docs/essentials/app-information.md @@ -1,14 +1,11 @@ --- -title: "Xamarin.Essentials: App Information" -description: "This document describes the AppInfo class in Xamarin.Essentials, which provides information about your application. For example, it exposes the app name and version." -author: jamesmontemagno -ms.author: jamont -ms.date: 01/29/2019 -ms.custom: video -no-loc: [Xamarin.Forms, Xamarin.Essentials] +title: "Essentials: App Information" +description: "Describes the AppInfo class in Microsoft.Maui.Essentials, which provides information about your application. For example, it exposes the app name and version." +ms.date: 08/04/2021 +no-loc: ["Microsoft.Maui", "Microsoft.Maui.Essentials"] --- -# Xamarin.Essentials: App Information +# App Information The **AppInfo** class provides information about your application. @@ -18,13 +15,9 @@ The **AppInfo** class provides information about your application. ## Using AppInfo -Add a reference to Xamarin.Essentials in your class: +[!INCLUDE [essentials-namespace](includes/essentials-namespace.md)] -```csharp -using Xamarin.Essentials; -``` - -## Obtaining Application Information: +## Read the app information The following information is exposed through the API: @@ -42,7 +35,7 @@ var version = AppInfo.VersionString; var build = AppInfo.BuildString; ``` -## Displaying Application Settings +## Display app settings The **AppInfo** class can also display a page of settings maintained by the operating system for the application: @@ -53,7 +46,11 @@ AppInfo.ShowSettingsUI(); This settings page allows the user to change application permissions and perform other platform-specific tasks. -## Platform Implementation Specifics +## Platform specifics + +This section describes platform-specific implementation details related to the `AppInfo` type. + + # [Android](#tab/android) @@ -73,7 +70,7 @@ App information is taken from the `Info.plist` for the following fields: - **PackageName**: `CFBundleIdentifier` - **VersionString** – `CFBundleShortVersionString` -# [UWP](#tab/uwp) +# [Windows](#tab/windows) App information is taken from the `Package.appxmanifest` for the following fields: @@ -84,7 +81,9 @@ App information is taken from the `Package.appxmanifest` for the following field -------------- + + ## API -- [AppInfo source code](https://github.com/xamarin/Essentials/tree/main/Xamarin.Essentials/AppInfo) -- [AppInfo API documentation](xref:Xamarin.Essentials.AppInfo) +- [AppInfo source code](https://github.com/dotnet/maui/tree/main/src/Essentials/src/AppInfo) + diff --git a/docs/essentials/app-theme.md b/docs/essentials/app-theme.md index 6feede59d..4f05dd666 100644 --- a/docs/essentials/app-theme.md +++ b/docs/essentials/app-theme.md @@ -1,16 +1,13 @@ --- -title: "Xamarin.Essentials: App Theme" -description: "This document describes the Requested App Theme API in Xamarin.Essentials, which provides information as to what theme style is requested for the running app." -author: jamesmontemagno -ms.custom: video -ms.author: jamont -ms.date: 01/06/2020 -no-loc: [Xamarin.Forms, Xamarin.Essentials] +title: "Essentials: App Theme" +description: "Describes the AppInfo class in the Microsoft.Maui.Essentials namespace and how it can be used to detect the requested app theme." +ms.date: 08/04/2021 +no-loc: ["Microsoft.Maui", "Microsoft.Maui.Essentials", "RequestedTheme"] --- -# Xamarin.Essentials: App Theme +# App Theme -The **RequestedTheme** API is part of the [`AppInfo`](app-information.md) class and provides information as to what theme is requested for your running app by the system. +The `RequestedTheme` API is part of the [`AppInfo`](app-information.md) class and provides information as to what theme is requested by the system for your running app. ## Get started @@ -18,55 +15,53 @@ The **RequestedTheme** API is part of the [`AppInfo`](app-information.md) class ## Using RequestedTheme -Add a reference to Xamarin.Essentials in your class: +[!INCLUDE [essentials-namespace](includes/essentials-namespace.md)] -```csharp -using Xamarin.Essentials; -``` +## Read the theme setting -## Obtaining Theme Information - -The requested application theme can be detected with the following API: +The requested app theme can be detected with the following code: ```csharp AppTheme appTheme = AppInfo.RequestedTheme; - ``` -This will provide the current requested theme by the system for your application. The return value will be one of the following: +This class provides the current requested theme by the system for your application. One of the following values is returned: -* Unspecified -* Light -* Dark +- Unspecified +- Light +- Dark -Unspecified will be returned when the operating system does not have a specific user interface style to request. An example of this is on devices running versions of iOS older than 13.0. +_Unspecified_ is returned when the operating system doesn't have a specific user interface style. An example of this is on devices running versions of iOS older than 13.0. +## Platform specifics -## Platform Implementation Specifics +This section describes platform-specific implementation details related to the `AppInfo.RequestedTheme` property. + + # [Android](#tab/android) -Android uses configuration modes to specify the type of theme to request from the user. Based on the version of Android, it can be changed by the user or is changed when battery saver mode is enabled. +Android uses configuration modes to specify the type of theme to request from the user. Based on the version of Android, it can be changed by the user or may be changed when battery saver mode is enabled. You can read more on the official [Android documentation for Dark Theme](https://developer.android.com/guide/topics/ui/look-and-feel/darktheme). - # [iOS](#tab/ios) -Unspecified will always be returned on versions of iOS older than 13.0 +_Unspecified_ is always returned on versions of iOS older than 13.0 +# [Windows](#tab/windows) -# [UWP](#tab/uwp) +Code that accesses the `AppInfo.RequestedTheme` property must be called on the UI thread or an exception will be thrown. -Calling `RequestedTheme` must be called on the UI thread or an exception will be thrown. +Windows applications respect the **RequestedTheme** property setting in the Windows _App.xaml_. If it's set to a specific theme, this API always returns this setting. To use the dynamic theme of the OS, remove this property from your application. When your app is run, it returns the theme set by the user in Windows settings: **Settings** > **Personalization** > **Colors** > **Choose your default app mode**. -UWP applications will respect your setting in the UWP App.xaml under **RequestedTheme**. If it is set to a specific theme, Xamarin.Essentials will always return this setting. To use dynamic theme of the OS remove this node from your application and then when your app is run it will return the theme set by the user in Windows settings (**Settings > Personalization > Colors > Choose your default app mode**). - -You can read more on the [UWP Requested Theme Documentation](/uwp/api/windows.ui.xaml.application.requestedtheme). + -------------- + + ## API -- [AppInfo source code](https://github.com/xamarin/Essentials/tree/main/Xamarin.Essentials/AppInfo) -- [AppInfo API documentation](xref:Xamarin.Essentials.AppInfo) +- [AppInfo source code](https://github.com/dotnet/maui/tree/main/src/Essentials/src/AppInfo) + diff --git a/docs/essentials/barometer.md b/docs/essentials/barometer.md index 87aa1cc6c..228019545 100644 --- a/docs/essentials/barometer.md +++ b/docs/essentials/barometer.md @@ -1,15 +1,13 @@ --- -title: "Xamarin.Essentials: Barometer" -description: "The Barometer class in Xamarin.Essentials lets you monitor the device's barometer sensor, which measures pressure." -author: jamesmontemagno -ms.author: jamont -ms.date: 11/04/2018 -no-loc: [Xamarin.Forms, Xamarin.Essentials] +title: "Essentials: Barometer" +description: "Describes the Barometer class in the Microsoft.Maui.Essentials namespace, which lets you monitor the device's barometer sensor." +ms.date: 08/04/2021 +no-loc: ["Microsoft.Maui", "Microsoft.Maui.Essentials"] --- -# Xamarin.Essentials: Barometer +# Barometer -The **Barometer** class lets you monitor the device's barometer sensor, which measures pressure. +The `Barometer` class lets you monitor the device's barometer sensor, which measures pressure. ## Get started @@ -17,16 +15,11 @@ The **Barometer** class lets you monitor the device's barometer sensor, which me ## Using Barometer -Add a reference to Xamarin.Essentials in your class: +[!INCLUDE [essentials-namespace](includes/essentials-namespace.md)] -```csharp -using Xamarin.Essentials; -``` - -The Barometer functionality works by calling the `Start` and `Stop` methods to listen for changes to the barometer's pressure reading in hectopascals. Any changes are sent back through the `ReadingChanged` event. Here is sample usage: +The Barometer functionality works by calling the `Start` and `Stop` methods to listen for changes to the barometer's pressure reading. The pressure reading is represented in hectopascals. Any changes are sent back through the `ReadingChanged` event. The following code example demonstrates reading the barometer sensor: ```csharp - public class BarometerTest { // Set speed delay for monitoring changes. @@ -68,7 +61,11 @@ public class BarometerTest [!INCLUDE [sensor-speed](includes/sensor-speed.md)] -## Platform Implementation Specifics +## Platform specifics + +This section describes platform-specific implementation details related to the barometer. + + # [Android](#tab/android) @@ -80,13 +77,15 @@ This API uses [CMAltimeter](https://developer.apple.com/documentation/coremotion `SensorSpeed` is not used as it is not supported on iOS. -# [UWP](#tab/uwp) +# [Windows](#tab/windows) No platform-specific implementation details. ----- + + ## API -- [Barometer source code](https://github.com/xamarin/Essentials/tree/main/Xamarin.Essentials/Barometer) -- [Barometer API documentation](xref:Xamarin.Essentials.Barometer) +- [Barometer source code](https://github.com/dotnet/maui/tree/main/src/Essentials/src/Barometer) +