Shady nagy/net6 (#614)
* udated to .net6 * used the .net6 version RC2 * added editconfig. * App core new Scoped Namespaces style. * BlazorAdmin new Scoped Namespaces style. * Blazor Shared new Scoped Namespaces style. * Infra new Scoped Namespaces style. * public api new Scoped Namespaces style. * web new Scoped Namespaces style. * FunctionalTests new Scoped Namespaces style. * Integrational tests new Scoped Namespaces style. * unit tests new Scoped Namespaces style. * update github action. * update github action. * change the global.
This commit is contained in:
@@ -1,88 +1,87 @@
|
||||
using BlazorAdmin.Services;
|
||||
using System;
|
||||
using BlazorAdmin.Services;
|
||||
using Microsoft.AspNetCore.Components;
|
||||
using System;
|
||||
|
||||
namespace BlazorAdmin.Helpers
|
||||
namespace BlazorAdmin.Helpers;
|
||||
|
||||
public class ToastComponent : ComponentBase, IDisposable
|
||||
{
|
||||
public class ToastComponent : ComponentBase, IDisposable
|
||||
[Inject]
|
||||
ToastService ToastService
|
||||
{
|
||||
[Inject]
|
||||
ToastService ToastService
|
||||
get;
|
||||
set;
|
||||
}
|
||||
protected string Heading
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
protected string Message
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
protected bool IsVisible
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
protected string BackgroundCssClass
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
protected string IconCssClass
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
protected override void OnInitialized()
|
||||
{
|
||||
ToastService.OnShow += ShowToast;
|
||||
ToastService.OnHide += HideToast;
|
||||
}
|
||||
private void ShowToast(string message, ToastLevel level)
|
||||
{
|
||||
BuildToastSettings(level, message);
|
||||
IsVisible = true;
|
||||
StateHasChanged();
|
||||
}
|
||||
private void HideToast()
|
||||
{
|
||||
IsVisible = false;
|
||||
StateHasChanged();
|
||||
}
|
||||
private void BuildToastSettings(ToastLevel level, string message)
|
||||
{
|
||||
switch (level)
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
protected string Heading
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
protected string Message
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
protected bool IsVisible
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
protected string BackgroundCssClass
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
protected string IconCssClass
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
protected override void OnInitialized()
|
||||
{
|
||||
ToastService.OnShow += ShowToast;
|
||||
ToastService.OnHide += HideToast;
|
||||
}
|
||||
private void ShowToast(string message, ToastLevel level)
|
||||
{
|
||||
BuildToastSettings(level, message);
|
||||
IsVisible = true;
|
||||
StateHasChanged();
|
||||
}
|
||||
private void HideToast()
|
||||
{
|
||||
IsVisible = false;
|
||||
StateHasChanged();
|
||||
}
|
||||
private void BuildToastSettings(ToastLevel level, string message)
|
||||
{
|
||||
switch (level)
|
||||
{
|
||||
case ToastLevel.Info:
|
||||
BackgroundCssClass = "bg-info";
|
||||
IconCssClass = "info";
|
||||
Heading = "Info";
|
||||
break;
|
||||
case ToastLevel.Success:
|
||||
BackgroundCssClass = "bg-success";
|
||||
IconCssClass = "check";
|
||||
Heading = "Success";
|
||||
break;
|
||||
case ToastLevel.Warning:
|
||||
BackgroundCssClass = "bg-warning";
|
||||
IconCssClass = "exclamation";
|
||||
Heading = "Warning";
|
||||
break;
|
||||
case ToastLevel.Error:
|
||||
BackgroundCssClass = "bg-danger";
|
||||
IconCssClass = "times";
|
||||
Heading = "Error";
|
||||
break;
|
||||
}
|
||||
Message = message;
|
||||
}
|
||||
public void Dispose()
|
||||
{
|
||||
ToastService.OnShow -= ShowToast;
|
||||
case ToastLevel.Info:
|
||||
BackgroundCssClass = "bg-info";
|
||||
IconCssClass = "info";
|
||||
Heading = "Info";
|
||||
break;
|
||||
case ToastLevel.Success:
|
||||
BackgroundCssClass = "bg-success";
|
||||
IconCssClass = "check";
|
||||
Heading = "Success";
|
||||
break;
|
||||
case ToastLevel.Warning:
|
||||
BackgroundCssClass = "bg-warning";
|
||||
IconCssClass = "exclamation";
|
||||
Heading = "Warning";
|
||||
break;
|
||||
case ToastLevel.Error:
|
||||
BackgroundCssClass = "bg-danger";
|
||||
IconCssClass = "times";
|
||||
Heading = "Error";
|
||||
break;
|
||||
}
|
||||
Message = message;
|
||||
}
|
||||
public void Dispose()
|
||||
{
|
||||
ToastService.OnShow -= ShowToast;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user