예제 #1
0
        /// <summary>
        /// 任务开始运行
        /// </summary>
        /// <param name="task">任务基类</param>
        public void Start(TaskBase task)
        {
            if (task == null)
                return;           //如果任务为空则返回

            if (!CheckTaskRunState(TaskRunState.Starting)) //是否可以进入启动状态
            {
                Logger.Error("无法启动,当前任务“{0}”状态:{1}".FormatWith(_task.Name,TaskRunState.ToString()));
                return;
            }

            _task = task;         //否则当前任务等于task
            _taskEventArg = new TaskEventArg{ Context=task.Context};
            Window = task.Context.Role.Window;  //当前窗口等于当前角色所在窗口

            if (_workThread == null)           //没有在执行任务,则获取任务线程
            {
                _workThread = GetWorkThread(); //获取任务线程
            }
            Logger.Debug(string.Format("任务“{0}”正在启动...",_task.Name));

            TaskRunState = TaskRunState.Starting;  //任务状态改为正在启动
            DoEventHandler(OnStateChanged,_taskEventArg);
            DoEventHandler(OnStarting,_taskEventArg);
            _workThread.Start();                  //线程启动
        }
예제 #2
0
파일: Role.cs 프로젝트: AiDaTou/DnTool
 public Role(int hwnd)
 {
     _window = new DmWindow(hwnd,new DmPlugin());
 }
예제 #3
0
파일: Role.cs 프로젝트: rhjv55/Utilities
 public Role(int hwnd,DmPlugin dm)
 {
     _window=new DmWindow(hwnd,dm);
     _dm = dm;
 }