void SetUnstagedSwitchVms() { for (var i = 0; i < SorterEval.KeyPairCount; i++) { if ((SorterEval.SwitchEvals[i].UseCount == 0) && !ShowUnusedSwitches) { continue; } var keyPair = SorterEval.KeyPair(i); var switchBrushIndex = Math.Ceiling( (SorterEval.SwitchEvals[i].UseCount * SwitchBrushes.Count) / SorterEval.SwitchableGroupCount ); SwitchVms.Add(new SwitchGraphicVm(keyPair, SorterEval.KeyCount, LineBrushes, Width) { SwitchBrush = SwitchBrushes[(int)switchBrushIndex] }); } }
public UnstagedSorterVmImpl ( ISorterEval sorterEval, List <Brush> lineBrushes, List <Brush> switchBrushes, int width, int height, bool showUnusedSwitches ) { _sorterEval = sorterEval; _lineBrushes = lineBrushes; _switchBrushes = switchBrushes; _showUnusedSwitches = showUnusedSwitches; _height = height; _width = width; for (var i = 0; i < SorterEval.KeyPairCount; i++) { if ((SorterEval.SwitchEvals[i].UseCount < 1) && !ShowUnusedSwitches) { continue; } var keyPair = SorterEval.KeyPair(i); var switchBrushIndex = Math.Ceiling( (SorterEval.SwitchEvals[i].UseCount * (SwitchBrushes.Count - 1)) / SorterEval.SwitchableGroupCount ); SwitchVms.Add(new SwitchGraphicVm(keyPair, SorterEval.KeyCount, LineBrushes, Width) { SwitchBrush = SwitchBrushes[(int)switchBrushIndex] }); } }