Direct writing of three-dimensional silver nanostructures and applications