/// <summary> /// Make the constructor private becasuse we want the GetInstance be used. /// </summary> /// <param name="userid">MapPoint userid</param> /// <param name="password">MapPoint password</param> private MapPointWebServiceHelper(string userid, string password) { try { netCreds = new NetworkCredential(userid, password); theMapPointFindService = new FindServiceSoap(); theMapPointFindService.Credentials = netCreds; theMapPointFindService.Timeout = MAPPOINT_DEFAULT_TIMEOUT; if (webProxy != null) { theMapPointFindService.Proxy = webProxy; } theMapPointRouteService = new RouteServiceSoap(); theMapPointRouteService.Credentials = netCreds; theMapPointRouteService.Timeout = MAPPOINT_DEFAULT_TIMEOUT; if (webProxy != null) { theMapPointRouteService.Proxy = webProxy; } // setup route distances to be in miles UserInfoRouteHeader routeHeader = new UserInfoRouteHeader(); // set distance in miles routeHeader.DefaultDistanceUnit = DistanceUnit.Mile; theMapPointRouteService.UserInfoRouteHeaderValue = routeHeader; theMapPointRenderService = new RenderServiceSoap(); theMapPointRenderService.Credentials = netCreds; theMapPointRenderService.Timeout = MAPPOINT_DEFAULT_TIMEOUT; if (webProxy != null) { theMapPointRenderService.Proxy = webProxy; } } catch (Exception e) { throw e; // app can handle it } }
/// <summary> /// Make the constructor private becasuse we want the GetInstance be used. /// </summary> /// <param name="userid">MapPoint userid</param> /// <param name="password">MapPoint password</param> private MapPointWebServiceHelper(string userid, string password) { try { netCreds = new NetworkCredential(userid, password); theMapPointFindService = new FindServiceSoap(); theMapPointFindService.Credentials = netCreds; theMapPointFindService.Timeout = MAPPOINT_DEFAULT_TIMEOUT; if (webProxy != null) theMapPointFindService.Proxy = webProxy; theMapPointRouteService = new RouteServiceSoap(); theMapPointRouteService.Credentials = netCreds; theMapPointRouteService.Timeout = MAPPOINT_DEFAULT_TIMEOUT; if (webProxy != null) theMapPointRouteService.Proxy = webProxy; // setup route distances to be in miles UserInfoRouteHeader routeHeader = new UserInfoRouteHeader(); // set distance in miles routeHeader.DefaultDistanceUnit = DistanceUnit.Mile; theMapPointRouteService.UserInfoRouteHeaderValue = routeHeader; theMapPointRenderService = new RenderServiceSoap(); theMapPointRenderService.Credentials = netCreds; theMapPointRenderService.Timeout = MAPPOINT_DEFAULT_TIMEOUT; if (webProxy != null) theMapPointRenderService.Proxy = webProxy; } catch (Exception e) { throw e; // app can handle it } }