It may depend on what kind of a remote control you have and whether your Samsung has CEC and/or ARC in its HDMI connections.
If you are using a remote like one of the Harmony remotes then I would simply connect the soundbar to the tv with the optical connection and connect the blue ray and Direct TV box via two of the HDMI connections on the Samsung. Then the Harmony can easily be configured to control all the operations on all of the inputs.
Assuming you don't have that kind of a remote and simply plan on controlling the volume on the Vizio with your tv remote then:
1. If you have CEC and ARC in the Samsung you can connect the Vizio to the Samsung via the designated HDMI on the Vizio and one of the Samsung's HDMI connections. This will allow you to control the Vizio volume with the TV and also hear the sound on the Vizio. I would still connect the Blu-Ray and Direct TV box to the remaining HDMI connections on the Samsung.
2. If you only have CEC (no ARC) in the Samsung then I would still connect the Vizio to one of the Samsung's HDMI connections AND also to the optical connections. Then you would receive sound via the optical and be able to control the volume via the HDMI connection on the tv.
If you plan to simply use your Vizio remote to control its volume, then just connect it via Optical on the Samsung.