public void start() { if (!readConfig) { //等OPCSERVER启动 Thread.Sleep(Program.waitMillionSecond); ReadConfig(); readConfig = true; } if (getConfig && !started) { CreateMeters(); started = true; UpdateCycle = new CycleTask(); RemoteCtrl = new CycleTask(); Program.RemoteCycle = RemoteCtrl; UpdateCycle.WorkStateChanged += new CycleTask.dgtWorkStateChange(UpdateCycle_WorkStateChanged); RemoteCtrl.WorkStateChanged += new CycleTask.dgtWorkStateChange(RemoteCtrl_WorkStateChanged); UpdateCycle.Run(update2, System.Threading.ThreadPriority.BelowNormal); RemoteCtrl.Run(remoteCtrl, System.Threading.ThreadPriority.BelowNormal); Start.SetExit = true; } Thread.Sleep(200); }
/// <summary> /// 使用多个ItemManage创建OpcGateway实例 /// </summary> /// <param name="itemManager"></param> public OpcGateway(IList <MicroDAQ.DataItem.IDataItemManage> itemManager, IList <IDatabaseManage> databaseManager) { ItemManagers = itemManager; UpdateCycle = new CycleTask(); RemoteCtrlCycle = new CycleTask(); UpdateCycle.WorkStateChanged += new CycleTask.dgtWorkStateChange(UpdateCycle_WorkStateChanged); //RemoteCtrlCycle.WorkStateChanged += new CycleTask.dgtWorkStateChange(RemoteCtrl_WorkStateChanged); }
/// <summary> /// 使用多个ItemManage创建OpcGateway实例 /// </summary> /// <param name="itemManager"></param> public OpcGateway(IList<MicroDAQ.DataItem.IDataItemManage> itemManager, IList<IDatabaseManage> databaseManager) { ItemManagers = itemManager; UpdateCycle = new CycleTask(); RemoteCtrlCycle = new CycleTask(); UpdateCycle.WorkStateChanged += new CycleTask.dgtWorkStateChange(UpdateCycle_WorkStateChanged); //RemoteCtrlCycle.WorkStateChanged += new CycleTask.dgtWorkStateChange(RemoteCtrl_WorkStateChanged); }
private void btnStart_Click(object sender, EventArgs e) { this.btnStart.Enabled = false; Start = new CycleTask(); Start.Run(start, ThreadPriority.Lowest); }
/// <summary> /// 暂停参数指定的任务对象 /// </summary> /// <param name="task">要暂停的任务对象</param> private void Stop(CycleTask task) { task.SetExit = true; }
/// <summary> /// 继续参数指定的任务对象 /// </summary> /// <param name="task">要继续的任务对象</param> public void Continue(CycleTask task) { task.SetPause = false; }
/// <summary> /// 暂停参数指定的任务对象 /// </summary> /// <param name="task">要暂停的任务对象</param> public void Pause(CycleTask task) { task.SetPause = true; }