From that answer you can say to yourself: "Then this is the behavior I want to reward!" For instance, let's say I want my own dog Poncho to be quiet while he is hanging out in the yard. I do allow him to bark once (to alert me, after all, that's part of his *job* description)... So, being out there and just being quiet gets him rewarded! I make sure to catch him in the act of doing what I want, then acknowledge it, and reward. "Thank you!" If it's a situation where I want him to bark I allow him to continue, if not, then I give him a separate cue for wanting quiet. If he follows it, he gets rewarded - food, play time, freedom in the yard - if not, then inside he goes. "Too bad for you."
Now he has the choice: stay outside following the rules gets rewarded - breaking the game rules gets him nothing.
This is the type of training steps I teach in my classes - it's simple, it works, plus it gets you focused on what you want, not what you don't want... So remember, the next time you find yourself frustrated with your dog, just ask yourself "What behavior do I want? What behavior do I want to reward?" Then do it!