在不中断UI的情况下线程化并播放声音 [英] Threading and play sound without interrupting the UI

查看:46
本文介绍了在不中断UI的情况下线程化并播放声音的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,

我正在使用Windows CE,NET CF 3.5和WS 2008.我一直在开发使用手持终端的RFID项目

I am using Windows CE, NET CF 3.5 and  WS 2008. I have been developing  a RFID project using handheld terminal

在没有一个问题的情况下顺利进行

Everthing is going well without one issue

在一种方法中,我正在阅读我周围的标签并在UI上显示为列表视图

In a method, I am reading tags around me and show them on the UI as a listview

如果列表中有过期的标签,请关注第一个并发出哔声,直到从列表中删除它为止。然后专注于下一个过期的标签,如果存在等等。

If there is an expired tags in the list, focusing on the fist one and making beep sound until delete it from the list. then focusing on the next expired tag if exists  so on.

此哔声的持续时间取决于标签位置。如果标签非常接近我,声音必须非常频繁(如汽车的传感器)

This beep sound's duration depends on the tag location. If the tag is very close to me sound must be very frequently (Like car's sensor )

我认为 问题是,使用该主题。

我该怎么称呼声音功能(线程或backgraundworker) 没有减慢UI。  

How can I call sound function (thread or backgraundworker)  without slow down the UI.  

如果有人给我一些想法,我将不胜感激

I will appreciate if anyone gives me some ideas

谢谢

GetAccessTag(字符串EPC)

GetAccessTag(string EPC)

{

//获取标签号

//检查它是否已过期

// check if it is expired or not

if(tagexpired)

if (tagexpired)

调用makesound();

call makesound();

else

//继续阅读下一步一个

// continute to read next one

}

private void makeSound()

{

//查看过期代码的接近程度 

// check how close to the expired tag 

 播放声音()

 play sound()

}

推荐答案

Hello
kazankiran,

根据您的描述,您有与线程相关的信息; Windows CE,NET CF 3.5,所以C#论坛不是
相应的论坛。我将把您的案例移至 Windows Embedded Compact   Windows
嵌入式紧凑平台开发
论坛,以获得更好的支持。

According to your description, you thread related to Windows CE, NET CF 3.5, so C# forum is not an appropriate forum. I will move your case to Windows Embedded Compact Windows Embedded Compact Platform Development forum for better support.


这篇关于在不中断UI的情况下线程化并播放声音的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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