110,534
社区成员
发帖
与我相关
我的任务
分享
public void Route_StartCamareEvent(string name)
{
//网上说可以用ParameterizedThreadStart,但是wince下没有这个
//求这边到底怎么传参数比较好
threadwcf =new Thread(new ThreadStart(wcfrun);
threadtime = new Thread(new ThreadStart(timerun));
threadwcf.Start(name);//这边报错,貌似不可以这么用的
threadtime.Start();
}
private void timerun()
{
for (var i = 3000; i > 0; i--)
{
if (i < 100)
{
this.statusBar1.Text = Status.wlanTimeOut;
threadwcf.Abort();
FTPClient ft = new FTPClient();
ft.CopyFiles(Path.PicPath, Path.TemporaryPath);
threadtime.Abort();
return;
}
Thread.Sleep(2);
}
}
public void wcfrun(string name)
{
picCount.Add(name);
threadwcf.Abort();
threadtime.Abort();
}
threadwcf =new Thread(()=>wcfrun(name));
using System;
namespace System.Threading
{
// 摘要:
// 表示在 System.Threading.Thread 上执行的方法。
public delegate void ThreadStart();
}
没有ParameterizedThreadStart,可以自己添加吗?public void Start();
这边 threadwcf.Start(name);//这边代码没改,肯定不是这么写的,参数不知道在哪传
//
// 摘要:
// 使操作系统将当前实例的状态更改为 System.Threading.ThreadState.Running,并选择提供包含线程执行的方法要使用的数据的对象。
//
// 参数:
// parameter:
// 一个对象,包含线程执行的方法要使用的数据。
//
// 异常:
// System.Threading.ThreadStateException:
// 线程已启动。
//
// System.OutOfMemoryException:
// 没有足够的可用内存来启动此线程。
//
// System.InvalidOperationException:
// 此线程是使用 System.Threading.ThreadStart 委托(而不是 System.Threading.ParameterizedThreadStart
// 委托)创建的。
[SecuritySafeCritical]
public void Start(object parameter);