2020-07-12 23:19:55 +08:00
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.Text;
|
|
|
|
|
using System.Threading.Tasks;
|
|
|
|
|
|
|
|
|
|
namespace AntDesign
|
|
|
|
|
{
|
|
|
|
|
public class ModalRef
|
|
|
|
|
{
|
2020-10-14 15:09:11 +08:00
|
|
|
|
internal readonly ModalOptions Config;
|
|
|
|
|
private readonly ModalService _service;
|
2020-07-12 23:19:55 +08:00
|
|
|
|
|
2020-10-14 15:09:11 +08:00
|
|
|
|
internal ModalRef(ModalOptions config, ModalService modalService)
|
2020-07-12 23:19:55 +08:00
|
|
|
|
{
|
|
|
|
|
Config = config;
|
2020-10-14 15:09:11 +08:00
|
|
|
|
_service = modalService;
|
2020-07-12 23:19:55 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
2020-10-14 15:09:11 +08:00
|
|
|
|
/// open the Modal dialog
|
2020-07-12 23:19:55 +08:00
|
|
|
|
/// </summary>
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
public async Task OpenAsync()
|
|
|
|
|
{
|
2020-10-14 15:09:11 +08:00
|
|
|
|
if (!Config.Visible)
|
|
|
|
|
{
|
|
|
|
|
Config.Visible = true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
await _service.CreateOrOpenModalAsync(this);
|
2020-07-12 23:19:55 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
2020-10-14 15:09:11 +08:00
|
|
|
|
/// close the Modal dialog
|
2020-07-12 23:19:55 +08:00
|
|
|
|
/// </summary>
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
public async Task CloseAsync()
|
|
|
|
|
{
|
2020-10-14 15:09:11 +08:00
|
|
|
|
await _service.CloseModalAsync(this);
|
2020-07-12 23:19:55 +08:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|