int findSelectedItem(ContactsBox s, PointF p) { PointIn ptIn = new PointIn(); PointF pt = s.thisCont.ObjectTouches.MoveCenter; double ang = s.thisAngle + s.thisCont.RotateFilter.Target; ScrollViewer scroll = s.ContactslistBox.FindChild<ScrollViewer>() as ScrollViewer; for (int i = 0; i < s.contactsObjList.Count; i++) { if (ptIn.setPtinRect(s.window, s.contactsObjList.ElementAt(i), pt, ang)) { return i; } } return -1; }
void bt2_Click(object sender, RoutedEventArgs e) { if (!(main.Children.Contains(cBox))) { PointF globalPt = new PointF(thisCont.ObjectTouches.MoveCenter.X, thisCont.ObjectTouches.MoveCenter.Y); cBox = new ContactsBox(); main.Children.Add(cBox); cBoxProp.ElementSupport.AddSupportForAll(); cBoxCont = new MTSmoothContainer(cBox, main, cBoxProp); cBoxCont.SetPosition(globalPt.X, globalPt.Y, gridRotateTrans.Angle, 1.0); framework.RegisterElement(cBoxCont); cBox.setInit(main, window, framework, cBoxCont, gridRotateTrans.Angle, userIP); } else { main.Children.Remove(cBox); framework.UnregisterElement(cBoxCont.Id); cBoxCont.isRemoved = true; } }