The Sunnah of Positive Thinking at Times of Distress

How do we get through hardtimes and hardships in a positive manner? How did Prophet Muhammad (peace be upon him) deal with trials and tribulations? What can we learn from his Sunnah?