From b9d31fba018a1ca63a3414783d384916b2f2db82 Mon Sep 17 00:00:00 2001 From: Gerald Versluis Date: Thu, 17 Nov 2022 11:29:04 +0100 Subject: [PATCH 1/2] Update Essentials DeviceInfo API Docs --- .../Microsoft.Maui.Essentials/DeviceInfo.xml | 163 ------------------ .../Microsoft.Maui.Essentials/DeviceType.xml | 69 -------- .../src/DeviceInfo/DeviceInfo.shared.cs | 82 +++++++-- .../src/DeviceInfo/DeviceInfo.uwp.cs | 3 + 4 files changed, 71 insertions(+), 246 deletions(-) delete mode 100644 src/Essentials/docs/Microsoft.Maui.Essentials/DeviceInfo.xml delete mode 100644 src/Essentials/docs/Microsoft.Maui.Essentials/DeviceType.xml diff --git a/src/Essentials/docs/Microsoft.Maui.Essentials/DeviceInfo.xml b/src/Essentials/docs/Microsoft.Maui.Essentials/DeviceInfo.xml deleted file mode 100644 index 04f92dd4a6ff..000000000000 --- a/src/Essentials/docs/Microsoft.Maui.Essentials/DeviceInfo.xml +++ /dev/null @@ -1,163 +0,0 @@ - - - - - - Microsoft.Maui.Essentials - 1.0.0.0 - - - System.Object - - - - Represents information about the device. - - - - - - - - Property - - 1.0.0.0 - Microsoft.Maui.Essentials - - - Microsoft.Maui.Essentials.DeviceType - - - Gets the type of device the application is running on. - The device type. - - - - - - - - Property - - 1.0.0.0 - Microsoft.Maui.Essentials - - - Microsoft.Maui.Essentials.DeviceIdiom - - - Gets the idiom of the device. - The idiom. - - - - - - - - Property - - 1.0.0.0 - Microsoft.Maui.Essentials - - - System.String - - - Gets the manufacturer of the device. - Device manufacturer. - - - - - - - - Property - - 1.0.0.0 - Microsoft.Maui.Essentials - - - System.String - - - Gets the model of the device. - Device model. - - - - - - - - Property - - 1.0.0.0 - Microsoft.Maui.Essentials - - - System.String - - - Gets the name of the device. - The name of the device (often specified by the user). - - - - - - - - Property - - 1.0.0.0 - Microsoft.Maui.Essentials - - - Microsoft.Maui.Essentials.DevicePlatform - - - Gets the platform or operating system of the device. - The platform of device. - - - - - - - - Property - - 1.0.0.0 - Microsoft.Maui.Essentials - - - System.Version - - - Gets the version of the operating system. - The device operating system. - - - - - - - - Property - - 1.0.0.0 - Microsoft.Maui.Essentials - - - System.String - - - Gets the version of the operating system. - The version of the operating system. - - - - - diff --git a/src/Essentials/docs/Microsoft.Maui.Essentials/DeviceType.xml b/src/Essentials/docs/Microsoft.Maui.Essentials/DeviceType.xml deleted file mode 100644 index 135bddf8d8e0..000000000000 --- a/src/Essentials/docs/Microsoft.Maui.Essentials/DeviceType.xml +++ /dev/null @@ -1,69 +0,0 @@ - - - - - - Microsoft.Maui.Essentials - 1.0.0.0 - - - System.Enum - - - Various types of devices. - - - - - - - - Field - - 1.0.0.0 - Microsoft.Maui.Essentials - - - Microsoft.Maui.Essentials.DeviceType - - 1 - - The device is a physical device, such as an iPhone, Android tablet or Windows desktop. - - - - - - - Field - - Microsoft.Maui.Essentials - 1.0.0.0 - - - Microsoft.Maui.Essentials.DeviceType - - 0 - - An unknown device type. - - - - - - - Field - - 1.0.0.0 - Microsoft.Maui.Essentials - - - Microsoft.Maui.Essentials.DeviceType - - 2 - - The device is virtual, such as the iOS simulators, Android emulators or Windows emulators. - - - - diff --git a/src/Essentials/src/DeviceInfo/DeviceInfo.shared.cs b/src/Essentials/src/DeviceInfo/DeviceInfo.shared.cs index 8a343de33276..50fff44adb5d 100644 --- a/src/Essentials/src/DeviceInfo/DeviceInfo.shared.cs +++ b/src/Essentials/src/DeviceInfo/DeviceInfo.shared.cs @@ -3,65 +3,119 @@ namespace Microsoft.Maui.Devices { - /// + /// + ///Types of devices. + /// public enum DeviceType { - /// + /// An unknown device type. Unknown = 0, - /// + + /// The device is a physical device, such as an iPhone, Android tablet or Windows/macOS desktop. Physical = 1, - /// + + /// The device is virtual, such as the iOS Simulator, Android emulators or Windows emulators. Virtual = 2 } + /// + /// Represents information about the device. + /// public interface IDeviceInfo { + /// + /// Gets the model of the device. + /// string Model { get; } + /// + /// Gets the manufacturer of the device. + /// string Manufacturer { get; } + /// + /// Gets the name of the device. + /// + /// This value is often specified by the user of the device. string Name { get; } + /// + /// Gets the string representation of the version of the operating system. + /// string VersionString { get; } + /// + /// Gets the version of the operating system. + /// Version Version { get; } + /// + /// Gets the platform or operating system of the device. + /// DevicePlatform Platform { get; } + /// + /// Gets the idiom (form factor) of the device. + /// DeviceIdiom Idiom { get; } + /// + /// Gets the type of device the application is running on. + /// DeviceType DeviceType { get; } } - /// + /// + /// Represents information about the device. + /// public static class DeviceInfo { - /// + /// + /// Gets the model of the device. + /// public static string Model => Current.Model; - /// + /// + /// Gets the manufacturer of the device. + /// public static string Manufacturer => Current.Manufacturer; - /// + /// + /// Gets the name of the device. + /// + /// This value is often specified by the user of the device. public static string Name => Current.Name; - /// + /// + /// Gets the string representation of the version of the operating system. + /// public static string VersionString => Current.VersionString; - /// + /// + /// Gets the version of the operating system. + /// public static Version Version => Current.Version; - /// + /// + /// Gets the platform or operating system of the device. + /// public static DevicePlatform Platform => Current.Platform; - /// + /// + /// Gets the idiom (form factor) of the device. + /// public static DeviceIdiom Idiom => Current.Idiom; - /// + /// + /// Gets the type of device the application is running on. + /// public static DeviceType DeviceType => Current.DeviceType; static IDeviceInfo? currentImplementation; - + + /// + /// Provides the default implementation for static usage of this API. + /// public static IDeviceInfo Current => currentImplementation ??= new DeviceInfoImplementation(); diff --git a/src/Essentials/src/DeviceInfo/DeviceInfo.uwp.cs b/src/Essentials/src/DeviceInfo/DeviceInfo.uwp.cs index 3c2713494297..c94c5940d078 100644 --- a/src/Essentials/src/DeviceInfo/DeviceInfo.uwp.cs +++ b/src/Essentials/src/DeviceInfo/DeviceInfo.uwp.cs @@ -15,6 +15,9 @@ class DeviceInfoImplementation : IDeviceInfo DeviceType currentType = DeviceType.Unknown; string systemProductName; + /// + /// Initializes a new instance of the class. + /// public DeviceInfoImplementation() { deviceInfo = new EasClientDeviceInformation(); From 9c80ca1fa74eda9cdfe8cee8b86445ab289f3c9b Mon Sep 17 00:00:00 2001 From: Gerald Versluis Date: Fri, 18 Nov 2022 20:38:05 +0100 Subject: [PATCH 2/2] Apply suggestions from code review Co-authored-by: E.Z. Hart --- src/Essentials/src/DeviceInfo/DeviceInfo.shared.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Essentials/src/DeviceInfo/DeviceInfo.shared.cs b/src/Essentials/src/DeviceInfo/DeviceInfo.shared.cs index 50fff44adb5d..97276ee6e1ca 100644 --- a/src/Essentials/src/DeviceInfo/DeviceInfo.shared.cs +++ b/src/Essentials/src/DeviceInfo/DeviceInfo.shared.cs @@ -11,10 +11,10 @@ public enum DeviceType /// An unknown device type. Unknown = 0, - /// The device is a physical device, such as an iPhone, Android tablet or Windows/macOS desktop. + /// The device is a physical device, such as an iPhone, Android tablet, or Windows/macOS desktop. Physical = 1, - /// The device is virtual, such as the iOS Simulator, Android emulators or Windows emulators. + /// The device is virtual, such as the iOS Simulator, Android emulators, or Windows emulators. Virtual = 2 }