public static UIElementsList BuildDifference(UIElementsList newList, UIElementsList oldList) { if (oldList == null) { return(newList); } if (newList == null) { return(null); } UIElementsList result = new UIElementsList(oldList.NewOver); result.list.AddRange(oldList.list); foreach (DependencyObject obj in oldList.list) { result.states.Add(obj, ContactState.Removed); } result.NewOver = newList.NewOver; foreach (DependencyObject obj in newList.list) { if (result.states.ContainsKey(obj)) { result.states[obj] = ContactState.Moved; } else { result.list.Add(obj); result.states.Add(obj, ContactState.New); } } return(result); }
static UIElementsList BuildElementsList(RawMultitouchReport report, DependencyObject newOver, UIElementsList oldList, out UIElementsList mergedList) { UIElementsList newList = null; if (newOver != null) { newList = new UIElementsList(newOver); if (!report.CleanUp) { BuildElementsList(newList, newOver); } } mergedList = UIElementsList.BuildDifference(newList, oldList); return(newList); }
static void RaiseEnterLeave(Contact contact, UIElementsList list) { foreach (DependencyObject treeElement in list) { ContactState state = list.GetState(treeElement); switch (state) { case ContactState.New: RaiseEnterLeaveEvents(contact, treeElement, MultitouchScreen.ContactEnterEvent); break; case ContactState.Removed: RaiseEnterLeaveEvents(contact, treeElement, MultitouchScreen.ContactLeaveEvent); break; } } }
static void BuildElementsList(UIElementsList list, DependencyObject over) { if (!list.Contains(over)) { list.Add(over, ContactState.New); DependencyObject visualParent = over is Visual?VisualTreeHelper.GetParent(over) : null; DependencyObject logicalParent = LogicalTreeHelper.GetParent(over); if (visualParent != null) { BuildElementsList(list, visualParent); } if (logicalParent != null && logicalParent != visualParent) { BuildElementsList(list, logicalParent); } } }