/// <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(); }
/// <summary> /// 开启服务,使用内置的存储及日志记录 /// </summary> public void Start(TaskBoxHandler handler) { Start(handler, null, null); }
/// <summary> /// �������,ʹ�����õĴ洢����־��¼ /// </summary> public void Start(TaskBoxHandler handler) { Start(handler, null, null); }