You'd better use your computer under light but not in the dim light, this will make the screen of your computer weak. Sunglasses can prevent you from some glare and radiation, but they cann't prevent you from computer vision syndrome, such as dry eyes, headaches, eye strains, etc. You should do to your eye doctor for a pair of prescribed computer glasses.
It is ok to wear sunglasses that has a anti-glare coating for computer use. However, sunglasses can't relieve the eye strain while working on a computer. You'd better go to an optician to get computer glasses that are specially designed for computer use.