Esempio n. 1
0
 public static MonitorUtils Current(Common.WindowWrapper windowWrapper = null)
 {
     windowWrapper = windowWrapper ?? Common.WindowWrapper.Current();
     if (!Cache.ContainsKey(windowWrapper))
     {
         var item = new MonitorUtils(windowWrapper);
         Cache.Add(windowWrapper, item);
         windowWrapper.ApplicationView().Consolidated += new Common.WeakReference <MonitorUtils, ApplicationView, object>(item)
         {
             EventAction  = (i, s, e) => Cache.Remove(windowWrapper),
             DetachAction = (i, w) => windowWrapper.ApplicationView().Consolidated -= w.Handler
         }.Handler;
     }
     return(Cache[windowWrapper]);
 }
Esempio n. 2
0
        private DeviceUtils(Common.WindowWrapper 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) => 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;
        }
Esempio n. 3
0
        private MonitorUtils(Common.WindowWrapper windowWrapper)
        {
            var di = windowWrapper.DisplayInformation();
            di.OrientationChanged += new Common.WeakReference<MonitorUtils, 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<MonitorUtils, ApplicationView, object>(this)
            {
                EventAction = (i, s, e) => 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(Common.WindowWrapper 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) => 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;
        }
Esempio n. 5
0
 public InchesInfo(Common.WindowWrapper windowWrapper)
 {
     WindowWrapper = windowWrapper;
 }
Esempio n. 6
0
 public PixelsInfo(Common.WindowWrapper windowWrapper)
 {
     WindowWrapper = windowWrapper;
 }
Esempio n. 7
0
 public InchesInfo(Common.WindowWrapper windowWrapper)
 {
     WindowWrapper = windowWrapper;
 }
Esempio n. 8
0
 public PixelsInfo(Common.WindowWrapper windowWrapper)
 {
     WindowWrapper = windowWrapper;
 }