Foliated Bundles, Invariant Measures and Flat Manifolds