So, learn to identify the opportunities in between your thoughts. A simple way to do that is to become immediately aware that feelings of gloom, anger, pessimism or criticism are signals that you are not in harmony with your inner being. These are moments of choice.
Once you realize this moment, you will decide, hopefully, to look for the opportunity, or to reframe what is going on so that you stay in a higher vibration mode. This is not Pollyanna stuff - it's simply energetics. Like attracts like. You can even ask yourself, "Do I want more of this?" If not, then change your reaction, and create what you do want.
Just remember, you can't control anyone's behavior, but you can control your reaction to it.
And one last thing: if you put a little energy into what is positive and good about a situation and/or person, you might find that things turn around pretty quickly.