csharpc-sharpdotnetxamlavaloniauicross-platformcross-platform-xamlavaloniaguimulti-platformuser-interfacedotnetcore
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
45 lines
1.1 KiB
45 lines
1.1 KiB
// Copyright (c) The Avalonia Project. All rights reserved.
|
|
// Licensed under the MIT license. See licence.md file in the project root for full license information.
|
|
|
|
using System;
|
|
using Avalonia.Native.Interop;
|
|
using Avalonia.Platform;
|
|
|
|
namespace Avalonia.Native
|
|
{
|
|
class ScreenImpl : IScreenImpl, IDisposable
|
|
{
|
|
private IAvnScreens _native;
|
|
|
|
public ScreenImpl(IAvnScreens native)
|
|
{
|
|
_native = native;
|
|
}
|
|
|
|
public int ScreenCount => _native.GetScreenCount();
|
|
|
|
public Screen[] AllScreens
|
|
{
|
|
get
|
|
{
|
|
var count = ScreenCount;
|
|
var result = new Screen[count];
|
|
|
|
for(int i = 0; i < count; i++)
|
|
{
|
|
var screen = _native.GetScreen(i);
|
|
|
|
result[i] = new Screen(screen.Bounds.ToAvaloniaRect(), screen.WorkingArea.ToAvaloniaRect(), screen.Primary);
|
|
}
|
|
|
|
return result;
|
|
}
|
|
}
|
|
|
|
public void Dispose ()
|
|
{
|
|
_native.Dispose();
|
|
_native = null;
|
|
}
|
|
}
|
|
}
|
|
|