Esempio n. 1
0
        private DeviceUtils(IWindowWrapper windowWrapper)
        {
            MonitorUtils = MonitorUtils.Current(windowWrapper);
            WindowWrapper = windowWrapper ?? Common.WindowWrapper.Current();

            var di = windowWrapper.DisplayInformation();
            di.OrientationChanged += new Common.WeakReference<DeviceUtils, 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<DeviceUtils, ApplicationView, object>(this)
            {
                EventAction = (i, s, e) => i.Changed?.Invoke(i, EventArgs.Empty),
                DetachAction = (i, w) => av.VisibleBoundsChanged -= w.Handler
            }.Handler;
        }
Esempio n. 2
0
        private MonitorUtils(IWindowWrapper windowWrapper)
        {
            var di = windowWrapper.DisplayInformation();
            di.OrientationChanged += new 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 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);
        }
Esempio n. 3
0
        private MonitorUtils(IWindowWrapper windowWrapper)
        {
            var di = windowWrapper.DisplayInformation();

            di.OrientationChanged += new 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 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);
        }
Esempio n. 4
0
        private DeviceUtils(IWindowWrapper windowWrapper)
        {
            MonitorUtils  = MonitorUtils.Current(windowWrapper);
            WindowWrapper = windowWrapper ?? Locator.WindowWrapper.Current();

            var di = windowWrapper.DisplayInformation();

            di.OrientationChanged += new Common.WeakReference <DeviceUtils, 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 <DeviceUtils, ApplicationView, object>(this)
            {
                EventAction  = (i, s, e) => i.Changed?.Invoke(i, EventArgs.Empty),
                DetachAction = (i, w) => av.VisibleBoundsChanged -= w.Handler
            }.Handler;
        }