Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update Essentials DeviceDisplay API Docs #11429

Merged
merged 2 commits into from
Nov 22, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
72 changes: 0 additions & 72 deletions src/Essentials/docs/Microsoft.Maui.Essentials/DeviceDisplay.xml

This file was deleted.

This file was deleted.

44 changes: 37 additions & 7 deletions src/Essentials/src/DeviceDisplay/DeviceDisplay.shared.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,40 +3,67 @@

namespace Microsoft.Maui.Devices
{
/// <summary>
/// Represents information about the device screen.
/// </summary>
public interface IDeviceDisplay
{
/// <summary>
/// Gets or sets if the screen should be kept on.
/// </summary>
bool KeepScreenOn { get; set; }

/// <summary>
/// Gets the main screens display info.
jfversluis marked this conversation as resolved.
Show resolved Hide resolved
/// </summary>
DisplayInfo MainDisplayInfo { get; }

/// <summary>
/// Occurs when the main display info changes.
jfversluis marked this conversation as resolved.
Show resolved Hide resolved
/// </summary>
event EventHandler<DisplayInfoChangedEventArgs> MainDisplayInfoChanged;
}

/// <include file="../../docs/Microsoft.Maui.Essentials/DisplayInfoChangedEventArgs.xml" path="Type[@FullName='Microsoft.Maui.Essentials.DisplayInfoChangedEventArgs']/Docs/*" />
/// <summary>
/// Main display information event arguments.
/// </summary>
public class DisplayInfoChangedEventArgs : EventArgs
{
/// <include file="../../docs/Microsoft.Maui.Essentials/DisplayInfoChangedEventArgs.xml" path="//Member[@MemberName='.ctor']/Docs/*" />
/// <summary>
/// Initializes a new instance of the <see cref="DisplayInfoChangedEventArgs"/> class.
/// </summary>
/// <param name="displayInfo">The display info associated to this event.</param>
public DisplayInfoChangedEventArgs(DisplayInfo displayInfo) =>
DisplayInfo = displayInfo;

/// <include file="../../docs/Microsoft.Maui.Essentials/DisplayInfoChangedEventArgs.xml" path="//Member[@MemberName='DisplayInfo']/Docs/*" />
/// <summary>
/// Gets the current display info for the main display associated to this event.
/// </summary>
public DisplayInfo DisplayInfo { get; }
}

/// <include file="../../docs/Microsoft.Maui.Essentials/DeviceDisplay.xml" path="Type[@FullName='Microsoft.Maui.Essentials.DeviceDisplay']/Docs/*" />
/// <summary>
/// Represents information about the device screen.
/// </summary>
public static class DeviceDisplay
{
/// <include file="../../docs/Microsoft.Maui.Essentials/DeviceDisplay.xml" path="//Member[@MemberName='KeepScreenOn']/Docs/*" />
/// <summary>
/// Gets or sets if the screen should be kept on.
/// </summary>
public static bool KeepScreenOn
{
get => Current.KeepScreenOn;
set => Current.KeepScreenOn = value;
}

/// <include file="../../docs/Microsoft.Maui.Essentials/DeviceDisplay.xml" path="//Member[@MemberName='MainDisplayInfo']/Docs/*" />
/// <summary>
/// Gets the main screens display info.
jfversluis marked this conversation as resolved.
Show resolved Hide resolved
/// </summary>
public static DisplayInfo MainDisplayInfo => Current.MainDisplayInfo;

/// <include file="../../docs/Microsoft.Maui.Essentials/DeviceDisplay.xml" path="//Member[@MemberName='MainDisplayInfoChanged']/Docs/*" />
/// <summary>
/// Occurs when the main display info changes.
jfversluis marked this conversation as resolved.
Show resolved Hide resolved
/// </summary>
public static event EventHandler<DisplayInfoChangedEventArgs> MainDisplayInfoChanged
{
add => Current.MainDisplayInfoChanged += value;
Expand All @@ -51,6 +78,9 @@ public static event EventHandler<DisplayInfoChangedEventArgs> MainDisplayInfoCha

static IDeviceDisplay? currentImplementation;

/// <summary>
/// Provides the default implementation for static usage of this API.
/// </summary>
public static IDeviceDisplay Current =>
currentImplementation ??= new DeviceDisplayImplementation();

Expand Down
3 changes: 3 additions & 0 deletions src/Essentials/src/DeviceDisplay/DeviceDisplay.uwp.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@ partial class DeviceDisplayImplementation

DisplayRequest? displayRequest;

/// <summary>
/// Initializes a new instance of the <see cref="DeviceDisplayImplementation"/> class.
/// </summary>
public DeviceDisplayImplementation()
{
_activeWindowTracker = new(WindowStateManager.Default);
Expand Down