Example #1
0
        public GetAllMapsResult GetAllMaps()
        {
            var service = new DOMAService();

            service.Url = WebServiceUrl;

            var request = new GetAllMapsRequest
            {
                Username = Username,
                Password = Password
            };

            var response = service.GetAllMaps(request);
            var result   = new GetAllMapsResult
            {
                ErrorMessage = response.ErrorMessage,
                Success      = response.Success,
            };

            if (response.Success)
            {
                result.Maps = new List <MapInfo>();
                foreach (var map in response.Maps)
                {
                    result.Maps.Add(TranslateMapInfo(map));
                }
            }
            return(result);
        }
Example #2
0
        public void GetAllMaps()
        {
            if (!IsConnectionOk)
                return;

            var doma = CreateDomaClient();

            var getAllCategoriesRequest = new GetAllCategoriesRequest { Username = Username, Password = Password };
            var getCategoriesTask = Task<GetAllCategoriesResponse>.Factory.FromAsync(doma.BeginGetAllCategories, doma.EndGetAllCategories, getAllCategoriesRequest, null);

            var getAllMapsRequest = new GetAllMapsRequest { Username = Username, Password = Password };
            var getAllMapsTask = Task<GetAllMapsResponse>.Factory.FromAsync(doma.BeginGetAllMaps, doma.EndGetAllMaps, getAllMapsRequest, null);

            Task.WaitAll(getCategoriesTask, getAllMapsTask);

            Categories = getCategoriesTask.Result.Categories.ToList();

            var baseUri = GetBaseUri();
            var supportsBlankMapImage = SupportsPublishWithPreUpload;

            Maps = (from map in getAllMapsTask.Result.Maps
                    join category in Categories on map.CategoryID equals category.ID
                    select new TransferMap(category, map, supportsBlankMapImage, baseUri, _imageDownloader)).ToList();

            UserId = Categories.First().UserID;
        }