private float SumStripCurrentSize(StripDefinitionCollection definitions) { var sum = 0f; foreach (var def in definitions) // do not use linq to avoid allocations { sum += def.ActualSize; } return(sum); }
private static float SumStripCurrentSize(StripDefinitionCollection definitions) { var sum = 0f; // ReSharper disable once LoopCanBeConvertedToQuery foreach (var def in definitions) // do not use linq to avoid allocations { sum += def.ActualSize; } return(sum); }
private static void CreateDefaultStripIfNecessary(ref StripDefinitionCollection computedCollection, StripDefinitionCollection userCollection) { if (userCollection.Count > 0) { computedCollection = userCollection; } else if (computedCollection == userCollection || computedCollection == null) { // Need to create default collection (it will be kept until user one is not empty again) computedCollection = new StripDefinitionCollection { new StripDefinition() }; } }
/// <summary> /// Set the size of all the fix-sized strips, and initialize the size of auto/star-sized strips to their minimal size. /// </summary> /// <param name="definitions">The strip definitions</param> private static void InitializeStripDefinitionActualSize(StripDefinitionCollection definitions) { foreach (var definition in definitions) { var stripSize = 0f; if (definition.Type == StripType.Fixed) { stripSize = definition.SizeValue; } definition.ActualSize = definition.ClampSizeByMinimumMaximum(stripSize); } }
private float SumStripAutoAndFixedSize(StripDefinitionCollection definitions) { var sum = 0f; foreach (var def in definitions) // do not use linq to avoid allocations { if (def.Type != StripType.Star) { sum += def.ActualSize; } } return(sum); }
private static float SumStripAutoAndFixedSize(StripDefinitionCollection definitions) { var sum = 0f; // ReSharper disable once LoopCanBeConvertedToQuery foreach (var def in definitions) // do not use linq to avoid allocations { if (def.Type != StripType.Star) { sum += def.ActualSize; } } return(sum); }
private static float SumStripAutoAndFixedSize(StripDefinitionCollection definitions) { var sum = 0f; // ReSharper disable once LoopCanBeConvertedToQuery try { foreach (var def in definitions) // do not use linq to avoid allocations { if (def.Type != StripType.Star) { sum += def.ActualSize; } } } catch (Exception e) { throw new InvalidOperationException("Grid measuring problem. Are you trying to render the same UIElement or Page 2+ times? More info: " + e.ToString()); } return(sum); }
private float SumStripAutoAndFixedSize(StripDefinitionCollection definitions) { var sum = 0f; foreach (var def in definitions) // do not use linq to avoid allocations if (def.Type != StripType.Star) sum += def.ActualSize; return sum; }
private float SumStripCurrentSize(StripDefinitionCollection definitions) { var sum = 0f; foreach (var def in definitions) // do not use linq to avoid allocations sum += def.ActualSize; return sum; }
/// <summary> /// Set the size of all the fix-sized strips, and initialize the size of auto/star-sized strips to their minimal size. /// </summary> /// <param name="definitions">The strip definitions</param> private static void InitializeStripDefinitionActualSize(StripDefinitionCollection definitions) { foreach (var definition in definitions) { var stripSize = 0f; if (definition.Type == StripType.Fixed) stripSize = definition.SizeValue; definition.ActualSize = definition.ClampSizeByMinimumMaximum(stripSize); } }
private static float SumStripAutoAndFixedSize(StripDefinitionCollection definitions) { var sum = 0f; // ReSharper disable once LoopCanBeConvertedToQuery foreach (var def in definitions) // do not use linq to avoid allocations if (def.Type != StripType.Star) sum += def.ActualSize; return sum; }
private static float SumStripCurrentSize(StripDefinitionCollection definitions) { var sum = 0f; // ReSharper disable once LoopCanBeConvertedToQuery foreach (var def in definitions) // do not use linq to avoid allocations sum += def.ActualSize; return sum; }
private void TestDefinitionsDefaultState(StripDefinitionCollection definitions) { Assert.AreEqual(0, definitions.Count); }
private void CreateFixedSizeDefinition(StripDefinitionCollection definitions, List<float> sizes) { definitions.Clear(); foreach (var size in sizes) definitions.Add(new StripDefinition(StripType.Fixed, size)); }
private void CheckFixedSizeStripSize(StripDefinitionCollection definitions, List<float> sizes) { for (var i=0; i<definitions.Count; ++i) Assert.AreEqual(sizes[i], definitions[i].ActualSize); }