Browse Source

Changed IScreenImpl.AllScreens return type so that it's not array.

pull/2358/head
José Pedro 8 years ago
parent
commit
e6e8907643
No known key found for this signature in database GPG Key ID: B8247B9301707B83
  1. 2
      samples/ControlCatalog/Pages/ScreenPage.cs
  2. 8
      src/Avalonia.Controls/Platform/IScreenImpl.cs
  3. 5
      src/Avalonia.Controls/Screens.cs
  4. 4
      src/Avalonia.DesignerSupport/Remote/Stubs.cs
  5. 3
      src/Avalonia.Native/ScreenImpl.cs
  6. 2
      src/Avalonia.X11/X11Screens.cs
  7. 5
      src/Gtk/Avalonia.Gtk3/ScreenImpl.cs
  8. 3
      src/Windows/Avalonia.Win32/ScreenImpl.cs

2
samples/ControlCatalog/Pages/ScreenPage.cs

@ -23,7 +23,7 @@ namespace ControlCatalog.Pages
{ {
base.Render(context); base.Render(context);
Window w = (Window)VisualRoot; Window w = (Window)VisualRoot;
Screen[] screens = w.Screens.All; var screens = w.Screens.All;
var scaling = ((IRenderRoot)w).RenderScaling; var scaling = ((IRenderRoot)w).RenderScaling;
Pen p = new Pen(Brushes.Black); Pen p = new Pen(Brushes.Black);

8
src/Avalonia.Controls/Platform/IScreenImpl.cs

@ -1,9 +1,11 @@
namespace Avalonia.Platform using System.Collections.Generic;
namespace Avalonia.Platform
{ {
public interface IScreenImpl public interface IScreenImpl
{ {
int ScreenCount { get; } int ScreenCount { get; }
Screen[] AllScreens { get; } IReadOnlyList<Screen> AllScreens { get; }
} }
} }

5
src/Avalonia.Controls/Screens.cs

@ -1,4 +1,5 @@
using System.Linq; using System.Collections.Generic;
using System.Linq;
using Avalonia.Platform; using Avalonia.Platform;
using Avalonia.Utilities; using Avalonia.Utilities;
using Avalonia.VisualTree; using Avalonia.VisualTree;
@ -10,7 +11,7 @@ namespace Avalonia.Controls
private readonly IScreenImpl _iScreenImpl; private readonly IScreenImpl _iScreenImpl;
public int ScreenCount => _iScreenImpl.ScreenCount; public int ScreenCount => _iScreenImpl.ScreenCount;
public Screen[] All => _iScreenImpl?.AllScreens; public IReadOnlyList<Screen> All => _iScreenImpl?.AllScreens;
public Screen Primary => All.FirstOrDefault(x => x.Primary); public Screen Primary => All.FirstOrDefault(x => x.Primary);
public Screens(IScreenImpl iScreenImpl) public Screens(IScreenImpl iScreenImpl)

4
src/Avalonia.DesignerSupport/Remote/Stubs.cs

@ -156,7 +156,7 @@ namespace Avalonia.DesignerSupport.Remote
{ {
public int ScreenCount => 1; public int ScreenCount => 1;
public Screen[] AllScreens { get; } = public IReadOnlyList<Screen> AllScreens { get; } =
{new Screen(new PixelRect(0, 0, 4000, 4000), new PixelRect(0, 0, 4000, 4000), true)}; new Screen[] { new Screen(new PixelRect(0, 0, 4000, 4000), new PixelRect(0, 0, 4000, 4000), true) };
} }
} }

3
src/Avalonia.Native/ScreenImpl.cs

@ -2,6 +2,7 @@
// Licensed under the MIT license. See licence.md file in the project root for full license information. // Licensed under the MIT license. See licence.md file in the project root for full license information.
using System; using System;
using System.Collections.Generic;
using Avalonia.Native.Interop; using Avalonia.Native.Interop;
using Avalonia.Platform; using Avalonia.Platform;
@ -18,7 +19,7 @@ namespace Avalonia.Native
public int ScreenCount => _native.GetScreenCount(); public int ScreenCount => _native.GetScreenCount();
public Screen[] AllScreens public IReadOnlyList<Screen> AllScreens
{ {
get get
{ {

2
src/Avalonia.X11/X11Screens.cs

@ -156,7 +156,7 @@ namespace Avalonia.X11
public int ScreenCount => _impl.Screens.Length; public int ScreenCount => _impl.Screens.Length;
public Screen[] AllScreens => public IReadOnlyList<Screen> AllScreens =>
_impl.Screens.Select(s => new Screen(s.Bounds, s.WorkingArea, s.Primary)).ToArray(); _impl.Screens.Select(s => new Screen(s.Bounds, s.WorkingArea, s.Primary)).ToArray();
} }

5
src/Gtk/Avalonia.Gtk3/ScreenImpl.cs

@ -1,4 +1,5 @@
using System; using System;
using System.Collections.Generic;
using Avalonia.Gtk3.Interop; using Avalonia.Gtk3.Interop;
using Avalonia.Platform; using Avalonia.Platform;
@ -8,11 +9,11 @@ namespace Avalonia.Gtk3
{ {
public int ScreenCount public int ScreenCount
{ {
get => AllScreens.Length; get => _allScreens.Length;
} }
private Screen[] _allScreens; private Screen[] _allScreens;
public Screen[] AllScreens public IReadOnlyList<Screen> AllScreens
{ {
get get
{ {

3
src/Windows/Avalonia.Win32/ScreenImpl.cs

@ -2,6 +2,7 @@
// Licensed under the MIT license. See licence.md file in the project root for full license information. // Licensed under the MIT license. See licence.md file in the project root for full license information.
using System; using System;
using System.Collections.Generic;
using Avalonia.Platform; using Avalonia.Platform;
using static Avalonia.Win32.Interop.UnmanagedMethods; using static Avalonia.Win32.Interop.UnmanagedMethods;
@ -15,7 +16,7 @@ namespace Avalonia.Win32
} }
private Screen[] _allScreens; private Screen[] _allScreens;
public Screen[] AllScreens public IReadOnlyList<Screen> AllScreens
{ {
get get
{ {

Loading…
Cancel
Save