// Provides Peer if exist in Weak Reference Storage private DateTimeAutomationPeer GetPeerFromWeakRefStorage(DateTimeCalendarModePair dateTimeCalendarModePairKey) { DateTimeAutomationPeer returnPeer = null; WeakReference weakRefEP = null; WeakRefElementProxyStorage.TryGetValue(dateTimeCalendarModePairKey, out weakRefEP); if (weakRefEP != null) { ElementProxy provider = weakRefEP.Target as ElementProxy; if (provider != null) { returnPeer = PeerFromProvider(provider as IRawElementProviderSimple) as DateTimeAutomationPeer; if (returnPeer == null) { WeakRefElementProxyStorage.Remove(dateTimeCalendarModePairKey); } } else { WeakRefElementProxyStorage.Remove(dateTimeCalendarModePairKey); } } return(returnPeer); }
// UpdateChildrenIntenal is called with ItemsInvalidateLimit to ensure we don’t fire unnecessary structure change events when items are just scrolled in/out of view in case of // virtualized controls. override internal IDisposable UpdateChildren() { UpdateChildrenInternal(AutomationInteropProvider.ItemsInvalidateLimit); WeakRefElementProxyStorage.PurgeWeakRefCollection(); return(AccessibilitySwitches.UseNetFx472CompatibleAccessibilityFeatures ? null : new UpdateChildrenHelper(this)); }
// Called by DateTimeAutomationPeer internal void AddProxyToWeakRefStorage(WeakReference wr, DateTimeAutomationPeer dateTimePeer) { DateTimeCalendarModePair key = new DateTimeCalendarModePair(dateTimePeer.Date, dateTimePeer.ButtonMode); if (GetPeerFromWeakRefStorage(key) == null) { WeakRefElementProxyStorage.Add(key, wr); } }
// override internal void UpdateChildren() { // To ensure that the Updation of children should be initiated from DataPeer so as to have the right parent value stored for children TreeViewDataItemAutomationPeer dataPeer = EventsSource as TreeViewDataItemAutomationPeer; if (dataPeer != null) { dataPeer.UpdateChildrenInternal(AutomationInteropProvider.ItemsInvalidateLimit); } else { UpdateChildrenInternal(AutomationInteropProvider.ItemsInvalidateLimit); } WeakRefElementProxyStorage.PurgeWeakRefCollection(); }
// Provides Peer if exist in Weak Reference Storage private DataGridCellItemAutomationPeer GetPeerFromWeakRefStorage(object column) { DataGridCellItemAutomationPeer returnPeer = null; WeakReference weakRefEP = WeakRefElementProxyStorage[column]; if (weakRefEP != null) { ElementProxy provider = weakRefEP.Target as ElementProxy; if (provider != null) { returnPeer = PeerFromProvider(provider as IRawElementProviderSimple) as DataGridCellItemAutomationPeer; if (returnPeer == null) { WeakRefElementProxyStorage.Remove(column); } } else { WeakRefElementProxyStorage.Remove(column); } } return(returnPeer); }
// Provides Peer if exist in Weak Reference Storage internal ItemAutomationPeer GetPeerFromWeakRefStorage(object item) { ItemAutomationPeer returnPeer = null; WeakReference weakRefEP = WeakRefElementProxyStorage[item]; if (weakRefEP != null) { ElementProxy provider = weakRefEP.Target as ElementProxy; if (provider != null) { returnPeer = PeerFromProvider(provider as IRawElementProviderSimple) as ItemAutomationPeer; if (returnPeer == null) { WeakRefElementProxyStorage.Remove(item); } } else { WeakRefElementProxyStorage.Remove(item); } } return(returnPeer); }
// UpdateChildrenIntenal is called with ItemsInvalidateLimit to ensure we don’t fire unnecessary structure change events when items are just scrolled in/out of view in case of // virtualized controls. override internal void UpdateChildren() { UpdateChildrenInternal(AutomationInteropProvider.ItemsInvalidateLimit); WeakRefElementProxyStorage.PurgeWeakRefCollection(); }