예제 #1
0
        private async void ManualTask(object sender, ElapsedEventArgs e)
        {
            CurrentTaskState = TaskState.WebProcessing;

            BandUtility band = BandUtility.Instance;

            // 예약 시간 검사.
            foreach (DateTime time in Settings.Instance.ReservedTimes)
            {
                // 소수점 이하 자리를 버리기 위해 버림 함수 사용.
                if ((int)Math.Truncate(DateTime.Now.TimeOfDay.TotalMinutes) == (int)time.TimeOfDay.TotalMinutes)
                {
                    List <string> posts = await band.GetFeedAsync();

                    foreach (string post in posts)
                    {
                        if (_postCaches.Contains(post))
                        {
                            continue;
                        }

                        await band.CheckAttendanceAsync(post);

                        _postCaches.Add(post);
                    }
                }
            }

            CurrentTaskState = TaskState.Running;
        }
예제 #2
0
        private async void AutomaticTask(object sender, ElapsedEventArgs e)
        {
            CurrentTaskState = TaskState.WebProcessing;

            BandUtility band = BandUtility.Instance;

            List <string> posts = await band.GetFeedAsync();

            foreach (string post in posts)
            {
                if (_postCaches.Contains(post))
                {
                    continue;
                }

                await band.CheckAttendanceAsync(post);

                _postCaches.Add(post);
            }

            CurrentTaskState = TaskState.Running;
        }