You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
ShopNCook/Views/Components/NoticePopup.xaml.cs

40 lines
1.1 KiB

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;
});
}
}