Browse Source

Remove test code from the startup template.

pull/5786/head
Halil İbrahim Kalkan 6 years ago
parent
commit
674f1282b6
  1. 23
      templates/app/aspnet-core/src/MyCompanyName.MyProjectName.Blazor/Pages/Index.razor
  2. 57
      templates/app/aspnet-core/src/MyCompanyName.MyProjectName.Blazor/Pages/Index.razor.cs

23
templates/app/aspnet-core/src/MyCompanyName.MyProjectName.Blazor/Pages/Index.razor

@ -13,29 +13,6 @@
<h5 class="m-1"> <i class="fas fa-rocket"></i> Congratulations, <strong>MyProjectName</strong> is successfully running!</h5>
</Badge>
<Card>
<CardHeader>
<CardTitle>UI Message Tests</CardTitle>
</CardHeader>
<CardBody>
<Button Color="Color.Info" Clicked="@OnInfoTestClicked">
INFO
</Button>
<Button Color="Color.Success" Clicked="@OnSuccessTestClicked">
SUCCESS
</Button>
<Button Color="Color.Warning" Clicked="@OnWarningTestClicked">
WARNING
</Button>
<Button Color="Color.Danger" Clicked="@OnErrorTestClicked">
DANGER
</Button>
<Button Color="Color.Secondary" Clicked="@OnConfirmTestClicked">
CONFIRM
</Button>
</CardBody>
</Card>
<h1>Welcome to the Application</h1>
<p class="lead px-lg-5 mx-lg-5">@L["LongWelcomeMessage"]</p>

57
templates/app/aspnet-core/src/MyCompanyName.MyProjectName.Blazor/Pages/Index.razor.cs

@ -1,62 +1,7 @@
using System;
using System.Collections.Generic;
using System.Security.Claims;
using System.Threading.Tasks;
using Blazorise;
using Microsoft.AspNetCore.Components;
using Volo.Abp.AspNetCore.Components.WebAssembly;
namespace MyCompanyName.MyProjectName.Blazor.Pages
namespace MyCompanyName.MyProjectName.Blazor.Pages
{
public partial class Index
{
private IEnumerable<Claim> _claims;
protected override async Task OnInitializedAsync()
{
var authState = await AuthenticationStateProvider.GetAuthenticationStateAsync();
if ( authState.User.Identity.IsAuthenticated )
{
_claims = authState.User.Claims;
}
}
Task OnInfoTestClicked()
{
return UiMessageService.InfoAsync( "This is the Info message", "Info", options =>
{
options.OkButtonIcon = IconName.InfoCircle;
options.OkButtonText = "Hello info";
} );
}
Task OnSuccessTestClicked()
{
return UiMessageService.SuccessAsync( "This is the Success message", "Success" );
}
Task OnWarningTestClicked()
{
return UiMessageService.WarnAsync( "This is the Warning message", "Warning" );
}
Task OnErrorTestClicked()
{
return UiMessageService.ErrorAsync( "This is the Error message", "Error" );
}
async Task OnConfirmTestClicked()
{
if ( await UiMessageService.ConfirmAsync( "Are you sure you want to delete the item?", "Confirm", options =>
{
options.CancelButtonText = "Do not delete it";
options.ConfirmButtonText = "Yes I'm sure";
} ) )
{
Console.WriteLine( "Confirmed" );
}
}
[Inject] IUiMessageService UiMessageService { get; set; }
}
}

Loading…
Cancel
Save