Пример #1
0
 private CreateGamePageViewModel(GameChoiceServiceClient gameService, MapServiceClient mapService)
 {
     _gameService      = gameService;
     _mapService       = mapService;
     Maps              = new ObservableCollection <CMapInfo>();
     CreateGameCommand = new CRelayCommand(CreateGameExecute, CreateGameCanExecute);
 }
Пример #2
0
 public void GetMap(Action<MapModel> callback, int mapId)
 {
     MapServiceClient mapSvc = new MapServiceClient();
     GetMapCallback = callback;
     mapSvc.SelectMapByIdAsync(mapId);
     mapSvc.SelectMapByIdCompleted += new EventHandler
         <SelectMapByIdCompletedEventArgs>(mapSvc_SelectMapByIdCompleted);
 }
Пример #3
0
        private void ConfigClient()
        {
            Binding          binding = new BasicHttpBinding();
            BasicHttpBinding b       = binding as BasicHttpBinding;
            //b.MaxReceivedMessageSize = long.MaxValue;
            //b.MaxBufferSize = int.MaxValue;
            EndpointAddress  endpoint = new EndpointAddress(_url);
            MapServiceClient proxy    = new MapServiceClient(binding, endpoint);

            _mapServiceClient = proxy;
        }
Пример #4
0
 public void SaveMap(Action<List<int>> callback, List<MapModel> mapModels)
 {
     MapServiceClient mapSvc = new MapServiceClient();
     SaveCallback = callback;
     listSize = mapModels.Count;
     mapSvc.InsertMapCompleted += new EventHandler
         <InsertMapCompletedEventArgs>(mapSvc_InsertMapCompleted);
     foreach (MapModel mm in mapModels)
     {
         Map map =MappingMapModelToMap(mm);
         mapSvc.InsertMapAsync(map);
     }
 }
Пример #5
0
        /// <summary>
        /// Initialize map spatial reference and map scalebar units from server
        /// </summary>
        /// <param name="isInitializationInProgress">True if initialization is in progress,
        /// otherwise false..</param>
        private void _GetMapLayerProperties(bool isInitializationInProgress)
        {
            if (_layers.Count > 0)
            {
                // TODO: check spatial references from other layers and remove hardcode
                // Create client
                MapLayer mapLayer = _layers[0];
                _mapServer = ((AgsMapLayer)mapLayer).Server;

                if (_mapServer.State == AgsServerState.Authorized)
                {
                    MapServiceClient mapservice = new MapServiceClient(
                        mapLayer.Url,
                        _mapServer.OpenConnection());

                    // Get map service info
                    ESRI.ArcLogistics.MapService.MapServerInfo serverInfo =
                        mapservice.GetServerInfo(mapservice.GetDefaultMapName());

                    // Get spatial reference ID
                    _spatialReferenceId = serverInfo.SpatialReference.WKID;
                    _scaleBarUnits      = _ConvertScalebarUnits(serverInfo.Units);

                    // Now map is initialized.
                    _inited = true;
                }
                else
                {
                    // Subscribe on server state changed in case of Map is not inited
                    if (isInitializationInProgress)
                    {
                        _mapServer.StateChanged += new EventHandler(_Server_StateChanged);
                    }
                }
            }
        }
Пример #6
0
        ///////////////////////////////////////////////////////////////////////////////////////////
        ///////////////////////////////////////////////////////////////////////////////////////////
        ///////////////////////////////////////////////////////////////////////////////////////////

        /// <summary>
        /// Initializes routine (support reinit).
        /// </summary>
        /// <param name="mapLayer">Layer for creating images.</param>
        public void Init(MapLayer mapLayer)
        {
            Debug.Assert(null != mapLayer);
            Debug.Assert(!_serviceInWorkedState); // only once

            AgsServer server = ((AgsMapLayer)mapLayer).Server;

            ServiceHelper.ValidateServerState(server);

            _mapService = new MapServiceClient(mapLayer.Url, server.OpenConnection());

            _mapInfo        = _mapService.GetServerInfo(_mapService.GetDefaultMapName());
            _mapDescription = _mapInfo.DefaultMapDescription;

            var imgType = new ImageType();

            imgType.ImageFormat     = esriImageFormat.esriImagePNG;
            imgType.ImageReturnType = esriImageReturnType.esriImageReturnMimeData;

            _imgDescription           = new ImageDescription();
            _imgDescription.ImageType = imgType;

            _serviceInWorkedState = true;
        }
Пример #7
0
 private CMapServiceProvider()
 {
     Service = new MapServiceClient("NetTcpBinding_IMapService");
 }
Пример #8
0
 public DefaultMapTileProvider(MapServiceClient mapServiceClient)
 {
     _mapServiceClient = mapServiceClient;
 }
Пример #9
0
 private void CreateMapServiceClient()
 {
     _mapsrv = _mapServerAgent.MapServiceClient;
 }
        ///////////////////////////////////////////////////////////////////////////////////////////
        ///////////////////////////////////////////////////////////////////////////////////////////
        ///////////////////////////////////////////////////////////////////////////////////////////
        /// <summary>
        /// Initializes routine (support reinit).
        /// </summary>
        /// <param name="mapLayer">Layer for creating images.</param>
        public void Init(MapLayer mapLayer)
        {
            Debug.Assert(null != mapLayer);
            Debug.Assert(!_serviceInWorkedState); // only once

            AgsServer server = ((AgsMapLayer)mapLayer).Server;
            ServiceHelper.ValidateServerState(server);

            _mapService = new MapServiceClient(mapLayer.Url, server.OpenConnection());

            _mapInfo = _mapService.GetServerInfo(_mapService.GetDefaultMapName());
            _mapDescription = _mapInfo.DefaultMapDescription;

            var imgType = new ImageType();
            imgType.ImageFormat = esriImageFormat.esriImagePNG;
            imgType.ImageReturnType = esriImageReturnType.esriImageReturnMimeData;

            _imgDescription = new ImageDescription();
            _imgDescription.ImageType = imgType;

            _serviceInWorkedState = true;
        }
Пример #11
0
        /// <summary>
        /// Initialize map spatial reference and map scalebar units from server
        /// </summary>
        /// <param name="isInitializationInProgress">True if initialization is in progress,
        /// otherwise false..</param>
        private void _GetMapLayerProperties(bool isInitializationInProgress)
        {
            if (_layers.Count > 0)
            {
                // TODO: check spatial references from other layers and remove hardcode
                // Create client
                MapLayer mapLayer = _layers[0];
                _mapServer = ((AgsMapLayer)mapLayer).Server;

                if (_mapServer.State == AgsServerState.Authorized)
                {
                    MapServiceClient mapservice = new MapServiceClient(
                        mapLayer.Url,
                        _mapServer.OpenConnection());

                    // Get map service info
                    ESRI.ArcLogistics.MapService.MapServerInfo serverInfo =
                        mapservice.GetServerInfo(mapservice.GetDefaultMapName());

                    // Get spatial reference ID
                    _spatialReferenceId = serverInfo.SpatialReference.WKID;
                    _scaleBarUnits = _ConvertScalebarUnits(serverInfo.Units);

                    // Now map is initialized.
                    _inited = true;
                }
                else
                {
                    // Subscribe on server state changed in case of Map is not inited
                    if (isInitializationInProgress)
                    {
                        _mapServer.StateChanged += new EventHandler(_Server_StateChanged);
                    }
                }
            }
        }