mirror of
https://gitee.com/ant-design-blazor/ant-design-blazor.git
synced 2024-12-15 09:21:24 +08:00
6bf817d1ea
* refactor: change the name of ModalRef to ConfirmRef in order to create a Modal dialog in service mode BREAKING CHANGE: all using of ModalRef must rename to ConfirmRef * refactor: chang the name of ModalTemplate to ConfirmTemplate in order to create a Modal dialog in service mode BREAKING CHANGE: all using of ModalTemplate must rename to ConfirmTemplate * feat(module: modal): support creating Modal dialog from ModalService Co-authored-by: James Yeung <shunjiey@hotmail.com>
43 lines
969 B
C#
43 lines
969 B
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
|
|
namespace AntDesign
|
|
{
|
|
public class ModalRef
|
|
{
|
|
internal readonly ModalOptions Config;
|
|
private readonly ModalService _service;
|
|
|
|
internal ModalRef(ModalOptions config, ModalService modalService)
|
|
{
|
|
Config = config;
|
|
_service = modalService;
|
|
}
|
|
|
|
/// <summary>
|
|
/// open the Modal dialog
|
|
/// </summary>
|
|
/// <returns></returns>
|
|
public async Task OpenAsync()
|
|
{
|
|
if (!Config.Visible)
|
|
{
|
|
Config.Visible = true;
|
|
}
|
|
|
|
await _service.CreateOrOpenModalAsync(this);
|
|
}
|
|
|
|
/// <summary>
|
|
/// close the Modal dialog
|
|
/// </summary>
|
|
/// <returns></returns>
|
|
public async Task CloseAsync()
|
|
{
|
|
await _service.CloseModalAsync(this);
|
|
}
|
|
}
|
|
}
|