rect.Contains(bounds);
и
rect.Contains(bounds.BottomLeft) && rect.Contains(bounds.BottomRight)
public static bool IsUserVisible(UIElement element)
{
if (!element.IsVisible)
return false;
var container = VisualTreeHelper.GetParent(element) as FrameworkElement;
if (container == null) throw new ArgumentNullException("container");
Rect bounds = element.TransformToAncestor(container).TransformBounds(new Rect(0.0, 0.0, element.RenderSize.Width, element.RenderSize.Height));
Rect rect = new Rect(0.0, 0.0, container.ActualWidth, container.ActualHeight);
return rect.IntersectsWith(bounds);
}
var CustomFieldsToChange_withData = lead["_embedded"]["leads"].Select(a => new Lead
{
id = (int)a["id"],
custom_fields_values = new[] { new custom_fields_values { field_id = 1961338, values = new[] { new ValueUrl { value = Uri } } },
new custom_fields_values { field_id = 1961340, values = new[] { new Value { value = result.Where(a1 => a1.CabinetURL == url).Select(z => z.ObjectCount).First() } } },
new custom_fields_values { field_id = 1961342, values = new[] { new Value { value = result.Where(a2 => a2.CabinetURL == url).Select(z => z.UserCount).First() } } },
new custom_fields_values { field_id = 1961344, values = new[] { new Value { value = result.Where(a3 => a3.CabinetURL == url).Select(z => z.UserActiveCount).First() } } },
new custom_fields_values { field_id = 1961346, values = new[] { new Value { value = result.Where(a4 => a4.CabinetURL == url).Select(z => z.DeviceCount).First() } } },
new custom_fields_values { field_id = 1961348, values = new[] { new Value { value = result.Where(a5 => a5.CabinetURL == url).Select(z => z.DeviceActiveCount).First() } } },
new custom_fields_values { field_id = 1961350, values = new[] { new Value { value = result.Where(a6 => a6.CabinetURL == url).Select(z => z.RegulatorCount).First() } } },
new custom_fields_values { field_id = 1961352, values = new[] { new Value { value = result.Where(a7 => a7.CabinetURL == url).Select(z => z.RegulatorActiveCount).First() } } },
new custom_fields_values { field_id = 1961354, values = new[] { new Value { value = result.Where(a8 => a8.CabinetURL == url).Select(z => z.TVCount).First() } } },
new custom_fields_values { field_id = 1961356, values = new[] { new Value { value = result.Where(a9 => a9.CabinetURL == url).Select(z => z.TVActiveCount).First() } } },
new custom_fields_values { field_id = 1961358, values = new[] { new ValueDateTime { value = DateTimeOffset.Now.ToUnixTimeSeconds() } } },
new custom_fields_values { field_id = 1961360, values = new[] { new Value { value = result.Where(a10 => a10.CabinetURL == url).Select(z => z.UserCount).First() } } },
new custom_fields_values { field_id = 1961362, values = new[] { new Value { value = result.Where(a11 => a11.CabinetURL == url).Select(z => z.UserActiveCount).First() } } },
new custom_fields_values { field_id = 1961364, values = new[] { new Value { value = result.Where(a12 => a12.CabinetURL == url).Select(z => z.UserMobileCount).First() } } }
}}).ToList();
CustomFieldsToChange.Add(CustomFieldsToChange_withData[lead_Index]);