コード例 #1
0
        async Task ExecuteLoadItemsCommand()
        {
            if (IsBusy)
            {
                return;
            }

            IsBusy = true;

            try
            {
                Items.Clear();
                var items = await PubController.GetCategoryItems(targetPubId, targetCategoryId);

                foreach (var item in items)
                {
                    Items.Add(item);
                }
            }
            catch (Exception ex)
            {
                Debug.WriteLine(ex);
            }
            finally
            {
                IsBusy = false;
            }
        }
コード例 #2
0
        async Task ExecuteLoadCategoriesCommand()
        {
            if (IsBusy)
            {
                return;
            }

            IsBusy = true;

            try
            {
                Categories.Clear();
                var categories = await PubController.GetCategories(targetPubId);

                foreach (var category in categories)
                {
                    Categories.Add(category);
                }
            }
            catch (Exception ex)
            {
                Debug.WriteLine(ex);
            }
            finally
            {
                IsBusy = false;
            }
        }
コード例 #3
0
        /// <summary>
        /// Sets the pin in target scope.
        /// </summary>
        /// <param name="baselatitude">Baselatitude.</param>
        /// <param name="baselongitude">Baselongitude.</param>
        /// <param name="distance">Distance.</param>
        private async Task SetPinInTargetScope(double baselatitude, double baselongitude, double distance, DateTime targetDateTime)
        {
            ObservableCollection <Pub> pubs = await PubController.GetPubsInTargetScope(baselatitude, baselongitude, distance, targetDateTime);

            foreach (Pub pub in pubs)
            {
                var position = new Position(pub.Latitude, pub.Longitude);                 // Latitude, Longitude
                var pin      = new Pin
                {
                    Type     = PinType.Place,
                    Position = position,
                    Label    = pub.Name,
                    Address  = pub.Place
                };
                pin.Clicked += (e, sender) =>
                {
                    Device.OpenUri(new Uri(pub.HpUrl));
                };
                map.Pins.Add(pin);
            }
        }