WPF-非阻塞用户界面- [英] WPF - Non Blocking UI -

查看:116
本文介绍了WPF-非阻塞用户界面-的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



;我有一个WPF窗口,并且该窗口只有一个图像"窗口, Control.
;我创建了一个线程,该线程将从某个文件夹中获取图像文件,然后该线程
;将调用BeginInvoke以指定的
; interval顺序依次更新每个图像的Image控件.
==============================
从文件夹中获取图像
环绕所有图像
->创建ImageSource
-> BeginInvoke(以更新Image.Source)
EndLoop
======================= =======
问题:
#当我按住关闭按钮时,UI中的图像控件将不会继续使用新图像进行更新.当我从关闭按钮释放时,所有图像
将非常快地显示.

我要发生的事情:
即使要进行一些操作,我也要以指定的间隔继续显示图像.正在阻止UI线程.

有没有办法做到这一点?

请注意,
Mike


maytinaykel

Hi,

;I have a WPF window and that window has only one "Image" Control.
;I created a thread which will get image files from a certain folder then this thread
;will call BeginInvoke to update the Image control with each image sequentially at a specified
;interval.

===============================
Get images from folder
Loop all images
->Create ImageSource
->BeginInvoke (to update Image.Source)
EndLoop
===============================

Problem:
# When I press and hold the close button the image control in the UI will not continue to update with the new images. When i release from the close button, All the images
will display very fast.

What I want to happen:
I want to continue to display the images at a specified interval even if some operation is blocking the UI thread.

Is there a way to do this?

Regards,
Mike


maytinaykel

推荐答案

嘿,好问题.您看过调度员的概念吗?可能会对您有帮助.
Hey, great question. Have you seen the concept of dispatcher? that will probably help you.


这篇关于WPF-非阻塞用户界面-的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆