public static DeviceUtils Current(WindowWrapper windowWrapper = null) { windowWrapper = windowWrapper ?? WindowWrapper.Current(); if (!Cache.ContainsKey(windowWrapper)) { var item = new DeviceUtils(windowWrapper); Cache.Add(windowWrapper, item); windowWrapper.ApplicationView().Consolidated += new WeakReference <DeviceUtils, ApplicationView, object>(item) { EventAction = (i, s, e) => Cache.Remove(windowWrapper), DetachAction = (i, w) => windowWrapper.ApplicationView().Consolidated -= w.Handler }.Handler; } return(Cache[windowWrapper]); }
public static DeviceUtils Current(WindowWrapper windowWrapper = null) { windowWrapper = windowWrapper ?? WindowWrapper.Current(); if (!Cache.ContainsKey(windowWrapper)) { var item = new DeviceUtils(windowWrapper); Cache.Add(windowWrapper, item); windowWrapper.ApplicationView().Consolidated += new WeakReference<DeviceUtils, ApplicationView, object>(item) { EventAction = (i, s, e) => Cache.Remove(windowWrapper), DetachAction = (i, w) => windowWrapper.ApplicationView().Consolidated -= w.Handler }.Handler; } return Cache[windowWrapper]; }