wpf - 在外部浏览器进程中拖放到 WEB 页面后,我的窗口 (WPF) 没有响应
问题描述
在我的 WPF 应用程序中,调用并以模态方式显示一个小窗口,用户(使用拖放)必须将两个字符串从该窗口拖到 WEP 页面上,该页面显示在单独的浏览器进程中。只要在显示 WPF 窗口时用户不在 WEP 页面上执行进一步的活动,这也很有效。
public partial class WidgetWnd : Window
{
public WidgetWnd(string WindowTitle, string UserIdent, string Password)
{
InitializeComponent();
}
private void LeftBtn_PreviewMouseMove(object sender, MouseEventArgs e)
{
leftBtn = sender as Button;
if ((leftBtn != null) && (e.LeftButton == MouseButtonState.Pressed))
{
DragDrop.DoDragDrop(leftBtn, UserIdent, DragDropEffects.Copy);
}
}
private void RightBtn_PreviewMouseMove(object sender, MouseEventArgs e)
{
rightBtn = sender as Button;
if ((rightBtn != null) && (e.LeftButton == MouseButtonState.Pressed))
{
DragDrop.DoDragDrop(rightBtn, Password, DragDropEffects.Copy);
}
}
private void Window_Closing(object sender, System.ComponentModel.CancelEventArgs e)
{
e.Cancel = false;
}
}
如果用户现在关闭窗口,或者在他已经关闭 WEB 页面后关闭,则 WPF 窗口和整个程序都会被阻止(无响应)。那有什么问题?这不会发生在小型测试程序(System.Windows.Forms)中!
解决方案
推荐阅读
- ios - 如何在重新加载 CollectionView 时防止单元格内的代码运行
- javascript - 如何根据javascript中的权重值从数组中获取n个值
- css - 如何响应地设置 Material-UI 的 Grid 项目的高度等于其宽度?
- python-3.x - 下面的代码给了我错误,例如“视图 home.views.edit 没有返回 HttpResponse 对象。它返回了 None 。”
- react-native - React-Native 购物车 - 无法将数据传递到购物车屏幕
- macos - 无法在 macos 上安装/链接 wget
- apache-spark - 在 Pyspark 中从 Rest Api 创建数据框时出错
- php - 使用 codeigniter 版本 4 显示 xml
- python - 多次附加用户输入
- java - java spring mvc 404未找到示例Spring MVC的错误