public void OnTimerEvent(object source, EventArgs e) { if (tasks.Count > 0) { DateTime k = tasks.First().Key; Task v = tasks.First().Value; if (v.type == Constants.TASK_TYPE_GET_ITEM) { control.Print("종목정보취득태스크. 종목: " + v.code); tasks.Remove(k); Task t = new Task(); t.type = Constants.TASK_TYPE_GET_DAY; t.code = v.code; t.startDate = OpenDays.GetPrevDay(Constants.DAY_GET_COUNT); t.endDate = OpenDays.GetToday(); tasks.Add(DateTime.Now, t); } else if (v.type == Constants.TASK_TYPE_GET_DAY) { control.Print("일봉정보취득태스크. 종목: " + v.code + ", 시작일: " + v.startDate + ", 종료일: " + v.endDate); tasks.Remove(k); } } }
private void StartButtonClick(object sender, EventArgs e) { if (!control.IsRealtimeMode()) { control.InquireButtonClick(null, null); if (!String.IsNullOrEmpty(control.GetCode()) && (control.itemList == null || control.itemList.Count == 0)) // TODO or empty { // TODO for loop for start date to end date OpenDays.SetToday(this.startDateTextBox.Text); Task t = new Task(); t.type = Constants.TASK_TYPE_API_GET_ITEM; t.code = control.GetCode(); apiTasks.Add(DateTime.Now, t); } else { Console.WriteLine(control.itemList.Count); } } else { } }