public TaskBox(ITaskBoxStorage storage, ITaskLogProvider logProvider, int threadNum) { this.Storage = storage; this.Log = logProvider; this._threadNum = threadNum; this._taskManager = new TaskQueue(this); //记录日志 //this.TaskStateChanged += this.Log.LogTaskState; }
public TaskBox(ITaskBoxStorage storage, ITaskLogProvider logProvider, int threadNum) { this.Storage = storage; this.Log = logProvider; this._threadNum = threadNum; this._taskManager = new TaskQueue(this); //��¼��־ //this.TaskStateChanged += this.Log.LogTaskState; }
/// <summary> /// 开启服务 /// </summary> public void Start(TaskBoxHandler handler, ITaskBoxStorage storage, ITaskLogProvider logProvider) { if (_isBooted == true) { throw new Exception("服务已经启动!"); } if (_box == null) { if (storage == null) { storage = new TaskBoxDbStorage(); } if (logProvider == null) { logProvider = new TaskLogProvider(storage); } _box = new TaskBox(storage, logProvider, 3); if (handler != null) { handler(_box); } //if (String.IsNullOrEmpty(_server) // || String.IsNullOrEmpty(_token)) // throw new ArgumentNullException("请使用RegistServer注册任务服务器信息!"); //HttpSyncClient client = new HttpSyncClient(_server, _token); //if (client.TestConnect()) //{ // //注册事件 // _box.OnTaskPosting += client.Post; //} //else //{ // throw new Exception("任务服务器连接失败"); //} } _isBooted = true; _box.StartWork(); }
/// <summary> /// ������� /// </summary> public void Start(TaskBoxHandler handler, ITaskBoxStorage storage, ITaskLogProvider logProvider) { if (_isBooted == true) throw new Exception("�����Ѿ����!"); if (_box == null) { if (storage == null) { storage = new TaskBoxDbStorage(); } if (logProvider == null) { logProvider = new TaskLogProvider(storage); } _box = new TaskBox(storage, logProvider, 3); if (handler != null) { handler(_box); } //if (String.IsNullOrEmpty(_server) // || String.IsNullOrEmpty(_token)) // throw new ArgumentNullException("��ʹ��RegistServerע�������������Ϣ!"); //HttpSyncClient client = new HttpSyncClient(_server, _token); //if (client.TestConnect()) //{ // //ע���¼� // _box.OnTaskPosting += client.Post; //} //else //{ // throw new Exception("�������������ʧ��"); //} } _isBooted = true; _box.StartWork(); }
public TaskLogProvider(ITaskBoxStorage storage) { this.Storage = storage; }
public TaskBox(ITaskBoxStorage storage, int threadNum) : this(storage, null, threadNum) { }
public TaskBox(ITaskBoxStorage storage) : this(storage, null, 5) { }