private DeviceUtils(Common.WindowWrapper windowWrapper) { MonitorUtils = Utils.MonitorUtils.Current(windowWrapper); var di = windowWrapper.DisplayInformation(); di.OrientationChanged += new Common.WeakReference<DeviceUtils, DisplayInformation, object>(this) { EventAction = (i, s, e) => Changed?.Invoke(i, EventArgs.Empty), DetachAction = (i, w) => di.OrientationChanged -= w.Handler }.Handler; var av = windowWrapper.ApplicationView(); av.VisibleBoundsChanged += new Common.WeakReference<DeviceUtils, ApplicationView, object>(this) { EventAction = (i, s, e) => Changed?.Invoke(i, EventArgs.Empty), DetachAction = (i, w) => av.VisibleBoundsChanged -= w.Handler }.Handler; }
private MonitorUtils(Common.WindowWrapper windowWrapper) { var di = windowWrapper.DisplayInformation(); di.OrientationChanged += new Common.WeakReference<MonitorUtils, DisplayInformation, object>(this) { EventAction = (i, s, e) => i.Changed?.Invoke(i, EventArgs.Empty), DetachAction = (i, w) => di.OrientationChanged -= w.Handler }.Handler; var av = windowWrapper.ApplicationView(); av.VisibleBoundsChanged += new Common.WeakReference<MonitorUtils, ApplicationView, object>(this) { EventAction = (i, s, e) => i.Changed?.Invoke(i, EventArgs.Empty), DetachAction = (i, w) => av.VisibleBoundsChanged -= w.Handler }.Handler; Inches = new InchesInfo(windowWrapper); Pixels = new PixelsInfo(windowWrapper); }