Replies: 4 comments
-
你得OverlayDialogHost放在哪里了 |
Beta Was this translation helpful? Give feedback.
0 replies
-
也有可能是我没有想到先触发close,导致我在断点(主动调用 public class MesSystem : IMesSystem
{
public async Task<bool> LoginAsync()
{
var options = new OverlayDialogOptions
{
FullScreen = false,
HorizontalAnchor = HorizontalPosition.Center,
VerticalAnchor = VerticalPosition.Center,
HorizontalOffset = 0,
VerticalOffset = 0,
Title = "登录",
CanLightDismiss = true,
CanDragMove = true,
IsCloseButtonVisible = true,
CanResize = true
};
var vm = new LoginViewModel(Locator.Current.GetService<IUserServiceClient>()!,
Locator.Current.GetService<ISessionService>()!);
var result = await OverlayDialog.ShowCustomModal<LoginView, LoginViewModel, bool?>(vm
, null, options); |
Beta Was this translation helpful? Give feedback.
0 replies
-
主要问题在于我未指定 |
Beta Was this translation helpful? Give feedback.
0 replies
-
在Dialog还没关闭的时候销毁Dialog的所有者本身就是个很不合理的行为,可以考虑下这个层级是不是真的正确。 |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
标题:OverlayDialog.ShowCustomModal切换Content时触发IDialogContext.Close导致阻塞问题
问题描述:
在主界面使用
OverlayDialog.ShowCustomModal
显示对话框时,若在对话框的ViewModel中触发主界面Content切换(通过绑定更新ContentControl
的Content
属性),会导致以下异常现象:IDialogContext.Close
被意外提前触发await ShowCustomModal()
可能被阻塞或无法正常返回结果Close
方法返回的参数可能被覆盖或丢失复现步骤:
OverlayDialog.ShowCustomModal
显示模态对话框MainViewModel.Content = new XxxViewModel()
)IDialogContext.Close
被触发,导致异步等待中断预期行为:
对话框应保持打开状态直到显式调用
Close
,主界面Content切换不应干扰模态对话框的生命周期。实际行为:
IDialogContext.Close
被意外调用,实际我需要使用传参的public event EventHandler<object?>? RequestClose;
(可能由Content切换引发的上下文变更导致)await ShowCustomModal()
可能卡死或立即返回错误的参数附加信息:
await OverlayDialog.ShowCustomModal
会阻塞,即使弹窗被关闭,目前发现Close会被主动调用,修改切换Content的顺序解决了问题Beta Was this translation helpful? Give feedback.
All reactions