namespace ShoopNCook.Views.Components; using Microsoft.Maui.Graphics; public partial class NoticePopup : ContentView { public NoticePopup(string message, string messageType) { InitializeComponent(); MessageLabel.Text = message; switch (messageType) { case "Error": this.BackgroundColor = Microsoft.Maui.Graphics.Colors.Red; break; case "Warning": this.BackgroundColor = Microsoft.Maui.Graphics.Colors.Yellow; break; case "Notice": this.BackgroundColor = Microsoft.Maui.Graphics.Colors.Blue; break; case "Success": this.BackgroundColor = Microsoft.Maui.Graphics.Colors.Green; break; } // Display the toast for 3 seconds Device.StartTimer(TimeSpan.FromSeconds(3), () => { // Close the toast // You need to replace this with your actual code to close the toast this.IsVisible = false; return false; }); } }