コード例 #1
0
        public void StoreAllFinder()
        {
            var storeFinderService = new STFStoreFinderService();

            var queryDictionary = new Dictionary <string, string>();

            queryDictionary.Add(STFConstants.KDocumentString, STFConstants.KExtendedString);
            queryDictionary.Add(STFConstants.KLimitString, STFConstants.KSearchLimitValue.ToString());
            queryDictionary.Add(STFConstants.KBannerGEKeyString, STFConstants.KBannerGEValueString);
            //queryDictionary.Add(STFConstants.KBannerGGKeyString, STFConstants.KBannerGGValueString);
            //queryDictionary.Add(STFConstants.KBannerMDKeyString, STFConstants.KBannerMDValueString);

            storeFinderService.Query(queryDictionary);
            storeFinderService.Build();

            //Task.Run(async () =>
            //{

            //	var fetchTask = storeFinderService.GetAsync();
            //	await fetchTask;
            //	Console.WriteLine(fetchTask.Result);
            //	Assert.That(fetchTask.Result != null);

            //}).GetAwaiter().OnCompleted(() =>
            //{

            //	Console.WriteLine("Done");

            //});
        }
コード例 #2
0
        private async Task GetStoreFinderAsync(string storeAddressString,
                                               Dictionary <string, string> additionalQueryDictionary)
        {
            if (string.IsNullOrEmpty(storeAddressString) == true)
            {
                return;
            }

            var   geocodingTask = GetGeocodingAsync(storeAddressString);
            await geocodingTask;
            var   geocodingModel = geocodingTask.Result;

            if (geocodingModel == null)
            {
                StoreViewModels = null;
                return;
            }

            var storeFinderService = new STFStoreFinderService();

            var queryDictionary = new Dictionary <string, string>();

            queryDictionary.Add(STFConstants.KLatiudeString, geocodingModel.Latitude.ToString());
            queryDictionary.Add(STFConstants.KLongitudeString, geocodingModel.Longitude.ToString());
            queryDictionary.Add(STFConstants.KDocumentString, STFConstants.KExtendedString);
            queryDictionary.Add(STFConstants.KLimitString, STFConstants.KSearchLimitValue.ToString());

            foreach (var addtionalQuery in additionalQueryDictionary)
            {
                queryDictionary.Add(addtionalQuery.Key, addtionalQuery.Value);
            }

            storeFinderService = storeFinderService.Query(queryDictionary).Build() as STFStoreFinderService;

            var storeFinderAdapter = new STFStoreFinderAdapter(storeFinderService);

            _storeAdapter = storeFinderAdapter;

            var   fetchTask = storeFinderAdapter.GetStoreFinderAsync();
            await fetchTask;

            var result = fetchTask.Result;

            ConvertToViewModel(result);
        }