using Blahblah.FlowerApp.Data; using Microsoft.Extensions.Logging; namespace Blahblah.FlowerApp; public partial class MainPage : ContentPage { int count = 0; readonly FlowerDatabase database; readonly ILogger logger; public MainPage(FlowerDatabase database, ILogger logger) { this.database = database; this.logger = logger; InitializeComponent(); } protected override void OnAppearing() { base.OnAppearing(); Task.Run(async () => { try { var list = await database.GetFlowers(); logger.LogInformation("got {count} flowers.", list.Length); } catch (Exception ex) { logger.LogError("error occurs in MainPage, {exception}", ex); } }); } //private void OnCounterClicked(object sender, EventArgs e) //{ // count++; // if (count == 1) // CounterBtn.Text = $"Clicked {count} time"; // else // CounterBtn.Text = $"Clicked {count} times"; // SemanticScreenReader.Announce(CounterBtn.Text); //} }