8 changed files with 78 additions and 27 deletions
@ -0,0 +1,42 @@ |
|||||
|
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; |
||||
|
} |
||||
|
} |
||||
|
} |
||||
Loading…
Reference in new issue