ScreenInfo.cs
 1  // Copyright (c) Microsoft Corporation
 2  // The Microsoft Corporation licenses this file to you under the MIT license.
 3  // See the LICENSE file in the project root for more information.
 4  
 5  namespace MouseJump.Common.Models.Drawing;
 6  
 7  /// <summary>
 8  /// Immutable version of a System.Windows.Forms.Screen object so we don't need to
 9  /// take a dependency on WinForms just for screen info.
10  /// </summary>
11  public sealed class ScreenInfo
12  {
13      public ScreenInfo(int handle, bool primary, RectangleInfo displayArea, RectangleInfo workingArea)
14      {
15          // this.Handle is a HMONITOR that has been cast to an int because we don't want
16          // to expose the HMONITOR type outside the current assembly.
17          this.Handle = handle;
18          this.Primary = primary;
19          this.DisplayArea = displayArea ?? throw new ArgumentNullException(nameof(displayArea));
20          this.WorkingArea = workingArea ?? throw new ArgumentNullException(nameof(workingArea));
21      }
22  
23      public int Handle
24      {
25          get;
26      }
27  
28      public bool Primary
29      {
30          get;
31      }
32  
33      public RectangleInfo DisplayArea
34      {
35          get;
36      }
37  
38      public RectangleInfo WorkingArea
39      {
40          get;
41      }
42  }