If one is wearing dark black sunglasses, then how will eye contact work? Sharingan user won't be able to tell when he has eye contact? I haven't finished shippuden yet, so may be answer lies ahead but I am curious.
The only known way to avoid the effects of the Sharingan have been to avert or completely cover one's eyes, or at least be able to block out the vision/chakra reach of the technique. However, it's not necessarily the case that just doing that alone will help.
Given that the Sharingan's main strength are powerful genjutsu (illusion tactics), it's well within the realm of experienced/expert Sharingan users to be able to control more senses than just vision, and thus, averting eyes alone isn't quite enough to protect from the illusions. I don't think sunglasses would help - you can still see through them, after all, so you would be able to have your vision compromised just as if you weren't wearing any.
Since you're still getting through the series, I won't spoil anything for you, but the fact that averting eyes isn't enough to avoid the powerful genjutsu produced by it plays a pivotal role towards the end of the series.
The abilities provided by Sharingan are not just limited to the eye-contact between user and the opponent.
Although one of the formidable abilities provided by Sharingan(Genjutsu) is shown in the manga/anime to happen through eye-contact, there are still many other ways to cast Genjutsu.
In fact a skilled Genjutsu user can use different body parts or things to cast Genjutsu.
Spoiler Ahead !!
1. Itachi Uchiha can cast Genjutsu just by using his fingers - [Naruto Chapter - 259]
2. Jiraya uses frog’s croak to trap Pain in Genjutsu - [Naruto Chapter - 379 ]
So answering your question by slightly reframing it,
Can wearing sunglasses prevent the victim from Genjutsu?
1. Genjutsu is based on eye-contact: Yes, if the opponent restrains himself or somehow blocks the Genjutsu caster from having the eye-contact, he can protect himself from being caught in Genjutsu.
2. Genjutsu is not based on eye-contact No, this time, since the medium of Genjutsu is not through eye-contact, the opponent can't prevent himself from falling in Genjutsu just by avoiding eye-contact.