private bool AllGatesPortsHaveConnectedWires(SchemeView scheme) { var gates = scheme.Gates; return(gates.All(g => { var connectedInWires = NavigationHelper.ConnectedInputWires(scheme, g).Count(); var connectedOutWires = NavigationHelper.ConnectedOutputWires(scheme, g).Count(); var inputsCount = g.Inputs.Count(); var outputsCount = g.Outputs.Count(); return connectedInWires == inputsCount && connectedOutWires >= outputsCount; })); }