Kyle MacLachlan was directed by David Koepp.
David Koepp . Koepp has directed six films over the course of his career : The Trigger Effect ( 1996 ) , Stir of Echoes ( 1999 ) , Secret Window ( 2004 ) , Ghost Town ( 2008 ) , Premium Rush ( 2012 ) , and Mortdecai ( 2015 ) . Kyle MacLachlan . He has also had prominent roles in television shows including appearing as Trey MacDougal in Sex and the City ( 2000 -- 2002 ) , Orson Hodge in Desperate Housewives ( 2006 -- 2012 ) , The Captain in How I Met Your Mother ( 2010 -- 14 ) , the Mayor of Portland in Portlandia ( 2011 -- 2017 ) , and Calvin Zabo in Agents of S.H.I.E.L.D. ( 2014 -- 2015 ) . The Trigger Effect is a 1996 American thriller film written and directed by David Koepp and starring Kyle MacLachlan , Elisabeth Shue and Dermot Mulroney .