mirror of
https://gitee.com/ant-design-blazor/ant-design-blazor.git
synced 2024-12-05 21:47:38 +08:00
ef4701b6ed
* refactor(module: modal): refactor the code of Modal, Confirm and Dialog refactor details: - Add DialogWrapper compontent to control the logic of dialog removal from DOM - Add the appropriate folders for Dialog, Modal, and Confirm - Remove methods with the same logic but different names in ConfirmService - Split Title into Title (string) and Titletemplate (renderfragment) - Add comments to code - Rename ConfirmDialog to Confirm - Specification of method name in ConfirmService - Adjust the time of throttle function for draggabe modal - Extract the common part of ModalOptions, ConfirmOptions and DialogOptions as DialogOptionsBase * refactor: move DefaultCloseIcon etc. static members to DialogOptionsBase * docs(module: modal): update docs * fix: dialog incorrect waiting * fix: pickup missing pr/7
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);
|
|
}
|
|
}
|
|
}
|