public MythServiceHost(string mythTvPath, string username, string password) { _password = password; _userName = username; _mythTvPath = new Uri(mythTvPath); _binding = new BasicHttpBinding(); _binding.MaxReceivedMessageSize = int.MaxValue; if (!string.IsNullOrWhiteSpace(username) || !string.IsNullOrWhiteSpace(password)) { _binding.Security.Transport.ClientCredentialType = HttpClientCredentialType.Basic; } _mythAddress = new EndpointAddress(string.Format("{0}/Myth", mythTvPath)); _guideAddress = new EndpointAddress(string.Format("{0}/Guide", mythTvPath)); _videoAddress = new EndpointAddress(string.Format("{0}/Video", mythTvPath)); _dvrAddress = new EndpointAddress(string.Format("{0}/Dvr", mythTvPath)); _contentAddress = new EndpointAddress(string.Format("{0}/Content", mythTvPath)); _channelAddress = new EndpointAddress(string.Format("{0}/Channel", mythTvPath)); _captureAddress = new EndpointAddress(string.Format("{0}/Capture", mythTvPath)); DvrService = new DvrClient(_binding, _dvrAddress); MythService = new MythClient(_binding, _mythAddress); GuideService = new GuideClient(_binding, _guideAddress); VideoService = new VideoClient(_binding, _videoAddress); ContentService = new ContentClient(_binding, _contentAddress); ChannelService = new ChannelClient(_binding, _channelAddress); CaptureService = new CaptureClient(_binding, _captureAddress); DvrService.ClientCredentials.UserName.UserName = _userName; DvrService.ClientCredentials.UserName.Password = _password; MythService.ClientCredentials.UserName.UserName = _userName; MythService.ClientCredentials.UserName.Password = _password; GuideService.ClientCredentials.UserName.UserName = _userName; GuideService.ClientCredentials.UserName.Password = _password; VideoService.ClientCredentials.UserName.UserName = _userName; VideoService.ClientCredentials.UserName.Password = _password; ContentService.ClientCredentials.UserName.UserName = _userName; ContentService.ClientCredentials.UserName.Password = _password; ChannelService.ClientCredentials.UserName.UserName = _userName; ChannelService.ClientCredentials.UserName.Password = _password; CaptureService.ClientCredentials.UserName.UserName = _userName; CaptureService.ClientCredentials.UserName.Password = _password; }