Merge pull request 'Add toasts to notify user' (#55) from user-notifier into master
continuous-integration/drone/push Build is passing
Details
continuous-integration/drone/push Build is passing
Details
Reviewed-on: ShopNCook/ShopNCook#55master
commit
e6ccd28f20
@ -1,4 +1,7 @@
|
|||||||
[*.cs]
|
[*.cs]
|
||||||
|
|
||||||
|
# CS0618: Le type ou le membre est obsolète
|
||||||
|
dotnet_diagnostic.CS0618.severity = silent
|
||||||
|
|
||||||
# CS1998: Async method lacks 'await' operators and will run synchronously
|
# CS1998: Async method lacks 'await' operators and will run synchronously
|
||||||
dotnet_diagnostic.CS1998.severity = none
|
dotnet_diagnostic.CS1998.severity = none
|
After Width: | Height: | Size: 826 B |
After Width: | Height: | Size: 499 B |
After Width: | Height: | Size: 812 B |
After Width: | Height: | Size: 633 B |
@ -0,0 +1,10 @@
|
|||||||
|
<ContentView xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
|
||||||
|
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
|
||||||
|
x:Class="ShoopNCook.Views.Components.NoticePopup">
|
||||||
|
<VerticalStackLayout>
|
||||||
|
<Label
|
||||||
|
x:Name="MessageLabel"
|
||||||
|
VerticalOptions="Center"
|
||||||
|
HorizontalOptions="Center" />
|
||||||
|
</VerticalStackLayout>
|
||||||
|
</ContentView>
|
@ -0,0 +1,39 @@
|
|||||||
|
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;
|
||||||
|
});
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in new issue