From 0cd80bcef984c2a7b491239153727221598e4682 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ahmet=20=C3=87otur?= Date: Tue, 15 Sep 2020 18:11:04 +0300 Subject: [PATCH] Added different message methods to UIMessageService --- .../WebAssembly/IUiMessageService.cs | 8 +++++++ .../WebAssembly/UiMessageService.cs | 22 ++++++++++++++++++- 2 files changed, 29 insertions(+), 1 deletion(-) diff --git a/framework/src/Volo.Abp.AspNetCore.Components.WebAssembly/Volo/Abp/AspNetCore/Components/WebAssembly/IUiMessageService.cs b/framework/src/Volo.Abp.AspNetCore.Components.WebAssembly/Volo/Abp/AspNetCore/Components/WebAssembly/IUiMessageService.cs index bad1bab7fc..2c834ddc87 100644 --- a/framework/src/Volo.Abp.AspNetCore.Components.WebAssembly/Volo/Abp/AspNetCore/Components/WebAssembly/IUiMessageService.cs +++ b/framework/src/Volo.Abp.AspNetCore.Components.WebAssembly/Volo/Abp/AspNetCore/Components/WebAssembly/IUiMessageService.cs @@ -4,6 +4,14 @@ namespace Volo.Abp.AspNetCore.Components.WebAssembly { public interface IUiMessageService { + Task InfoAsync(string message, string title = null); + + Task SuccessAsync(string message, string title = null); + + Task WarnAsync(string message, string title = null); + + Task ErrorAsync(string message, string title = null); + Task ConfirmAsync(string message, string title = null); } } diff --git a/framework/src/Volo.Abp.AspNetCore.Components.WebAssembly/Volo/Abp/AspNetCore/Components/WebAssembly/UiMessageService.cs b/framework/src/Volo.Abp.AspNetCore.Components.WebAssembly/Volo/Abp/AspNetCore/Components/WebAssembly/UiMessageService.cs index 2e353b5e54..16fe041de4 100644 --- a/framework/src/Volo.Abp.AspNetCore.Components.WebAssembly/Volo/Abp/AspNetCore/Components/WebAssembly/UiMessageService.cs +++ b/framework/src/Volo.Abp.AspNetCore.Components.WebAssembly/Volo/Abp/AspNetCore/Components/WebAssembly/UiMessageService.cs @@ -4,6 +4,7 @@ using Volo.Abp.DependencyInjection; namespace Volo.Abp.AspNetCore.Components.WebAssembly { + //TODO: Implement with sweetalert in a new package public class UiMessageService : IUiMessageService, ITransientDependency { protected IJSRuntime JsRuntime { get; } @@ -13,9 +14,28 @@ namespace Volo.Abp.AspNetCore.Components.WebAssembly JsRuntime = jsRuntime; } + public async Task InfoAsync(string message, string title = null) + { + await JsRuntime.InvokeVoidAsync("alert", message); + } + + public async Task SuccessAsync(string message, string title = null) + { + await JsRuntime.InvokeVoidAsync("alert", message); + } + + public async Task WarnAsync(string message, string title = null) + { + await JsRuntime.InvokeVoidAsync("alert", message); + } + + public async Task ErrorAsync(string message, string title = null) + { + await JsRuntime.InvokeVoidAsync("alert", message); + } + public async Task ConfirmAsync(string message, string title = null) { - //TODO: Implement with sweetalert in a new package return await JsRuntime.InvokeAsync("confirm", message); } }