Avoid The Bell
Instead of having the children ringing the doorbell and setting off the dogs, we all go out on the front porch. The dogs are much happier being able to watch the commotion than hearing it from inside. So instead of putting your dogs away, get them out into the action. (On leash, of course.)
Good Ol' Down-Stay
Once we're on the porch, I have a blanket or dog bed (for Miss Jenny) and put the dogs in a down. They rest on their blanket as Jack and I hand out the candy. If a child wants to pet the dog, I closely supervise as some of the costumes can be "scary" for the dog. They may be thinking, "What kind of person is this? He's got a funny face and weird hands!"
The best compliment I ever got was from a father taking his children trick or treating. He looked at my dogs as we were handing out the candy and said, "Now that takes work. Nice dogs." Thanks. It *does* take work, but it's worth it to be able to have my dogs with me.