private void _list_PreviewTouchUp(object sender, TouchEventArgs e)
{
if (test_thumb_feedback(e))
{
e.Handled = true;
return;
}
//double dv = 0;
//if (touch_points.Count > 0)
// dv = e.GetTouchPoint(this._list).Position.Y - touch_points[0].Position.Y;
bool can_scroll = false;
if (!touch_points.ContainsKey(e.TouchDevice.Id)) return;
if (touch_points[e.TouchDevice.Id].is_tap)
{
//if (touch_points[e.TouchDevice.Id].points.Count < 2) return;
//double dv = touch_points[e.TouchDevice.Id].points[touch_points[e.TouchDevice.Id].points.Count - 1].Position.Y - touch_points[e.TouchDevice.Id].points[0].Position.Y;
//double dh = touch_points[e.TouchDevice.Id].points[touch_points[e.TouchDevice.Id].points.Count - 1].Position.X - touch_points[e.TouchDevice.Id].points[0].Position.X;
//bool should_tap = true;
//if (is_horizontal && dh > configurations.tap_error)
// should_tap = false;
//if (!is_horizontal && dv > configurations.tap_error)
// should_tap = false;
//if (should_tap)
//{
//FrameworkElement findSource = e.OriginalSource as FrameworkElement;
//ListBoxItem element = null;
//while (element == null && findSource != null)
// if ((element = findSource as ListBoxItem) == null)
// findSource = VisualTreeHelper.GetParent(findSource) as FrameworkElement;
////
if (configurations.manual_tap || selectable)
{
UIElement selected_item = null;
if (collection_list)
selected_item = HitTestOverItem(e, false, false, false, true);
else if (comment_list)
selected_item = HitTestOverItem(e, false, false, true, false);
else
selected_item = HitTestOverItem(e, false, true, false, false);
if (selected_item != null)
{
//_list.SelectedItem = element;
try
{
_list_select_item(selected_item, e);
}
catch (Exception e2) { log.WriteErrorLog(e2); }
}
}
//}
}
else
can_scroll = true;
if (can_scroll)
{
//ScrollViewer scroll = configurations.GetDescendantByType(this._list, typeof(ScrollViewer)) as ScrollViewer;
////double dv = e.GetTouchPoint(this.contributions).Position.X - touch_points[touch_points.Count - 1].Position.X;
//try
//{
// //scroll.ScrollToHorizontalOffset(scroll.HorizontalOffset + (-2 * dv));
// scroll.ScrollToVerticalOffset(last_scroll_offset + (-1 * dv));
//}
//catch (Exception) { }
//last_scroll_offset = scroll.VerticalOffset;
if (collection_list)
log.WriteInteractionLog(24, this.content_name, e.TouchDevice);
else if (comment_list)
log.WriteInteractionLog(25, this.content_name, e.TouchDevice);
else
log.WriteInteractionLog(1, this.content_name, e.TouchDevice);
}
if (touch_points[e.TouchDevice.Id].initial_attended_item != null)
attend_on_item(false, touch_points[e.TouchDevice.Id].initial_attended_item);
touch_points[e.TouchDevice.Id].points.Clear();
touch_points.Remove(e.TouchDevice.Id);
UIElement element2 = sender as UIElement;
element2.ReleaseTouchCapture(e.TouchDevice);
}