private async Task RefreshAsync()
        {
            _appInsightsService.LogEvent("farmers/display", "Displaying farmers from local repository!");

            // Loading the farmers from the repository
            var farmers = await _farmerRepo.GetFarmers();

            var farmersObservable = new ObservableCollection <FarmerModel>(farmers);

            // Next add them to the observable collection of this view model
            Execute.OnUIThread(() =>
            {
                this.Farmers = farmersObservable;
            });
        }
Ejemplo n.º 2
0
        private void RefreshAsync()
        {
            _appInsightsService.LogEvent("search/sheep", "Searching for Sheeps...");

            Task.Run(() =>
            {
                try
                {
                    var images = _imageSearchAgent.SearchAsync("Sheep").Result
                                 .Take(10).ToList();
                    var result = new ObservableCollection <Sheep>();

                    for (int i = 0; i < 9; i++)
                    {
                        result.Add(new Sheep()
                        {
                            Name    = string.Format("Sheep {0}", (i + 1)),
                            Picture = images[i]
                        });
                    }

                    Execute.OnUIThread(() => this.Items = result);
                }
                catch (Exception ex)
                {
                    _appInsightsService.LogError("search/error", "Unable to search sheeps from Internet", ex);
                }
            });
        }
Ejemplo n.º 3
0
        public async Task InitializeAsync()
        {
            _appInsightsService.LogEvent("modules/loadModule2", "Loading module #2 into app...");

            _hubMetadataService.AddHubSection("M2", "Cats", typeof(CatListView).AssemblyQualifiedName);

            await Task.FromResult <object>(null);
        }
Ejemplo n.º 4
0
        public async Task InitializeAsync()
        {
            _appInsightsService.LogEvent("modules/loadModule3", "Loading module #3 into app...");

            _hubMetadataService.AddHubSection
            (
                "M3",
                "Farmers and Animals",
                typeof(FarmersView).AssemblyQualifiedName
            );

            await Task.FromResult <object>(null);
        }