[Phase L5-6] 자동화 스케줄러 구현 완료

ScheduleEntry 모델 (AppSettings.Models.cs):
- Id(8자 GUID), Name, Enabled, TriggerType(daily/weekdays/weekly/once)
- TriggerTime(HH:mm), WeekDays(List<int>), TriggerDate(nullable), LastRun(nullable)
- ActionType(app/notification), ActionTarget, ActionArgs

AppSettings.cs:
- [JsonPropertyName("schedules")] public List<ScheduleEntry> Schedules 추가

Services/SchedulerService.cs (197줄 신규):
- System.Threading.Timer 30초 간격 백그라운드 체크
- ShouldFire(): ±1분 윈도우, LastRun.Date == today 중복 방지, once 자동 비활성화
- ExecuteAction(): 앱 실행(ProcessStartInfo) / 알림(NotificationService.Notify)
- ComputeNextRun(): 다음 실행 예정 시각 계산 (핸들러·편집기 공유)
- TriggerLabel(): 트리거 유형 표시명 반환

Handlers/ScheduleHandler.cs (171줄 신규):
- prefix="sched", 서브커맨드: new / edit 이름 / del 이름
- 목록: 트리거 라벨·시각·액션 아이콘·다음 실행 시각 표시
- Enter: 활성/비활성 토글 + 저장

Views/ScheduleEditorWindow.xaml (307줄 신규):
- 트리거 유형 4-세그먼트(매일/주중/매주/한번), 요일 7버튼, 날짜 입력
- 액션 2-세그먼트(앱 실행/알림), 앱 경로+찾아보기+인자, 알림 메시지
- 활성화 ToggleSwitch, 저장/취소 하단바

Views/ScheduleEditorWindow.xaml.cs (230줄 신규):
- OnLoaded에서 기존 항목 로드 (편집) 또는 기본값 초기화
- SetTriggerUi(): 세그먼트 색상·WeekDaysPanel/DatePanel 표시 전환
- WeekDay_Click/SetDaySelected(): 요일 다중 토글
- SetActionUi(): 앱경로 패널 / 알림 패널 전환
- BtnSave_Click(): HH:mm 파싱 + 날짜 검증 + ScheduleEntry 생성·수정 저장

App.xaml.cs:
- _schedulerService 필드 + Phase L5-6 등록 블록 추가
- schedulerService.Start() 호출

docs/LAUNCHER_ROADMAP.md:
- L5-6  완료 표시 + 구현 내용 상세 기록

빌드: 경고 0, 오류 0
This commit is contained in:
2026-04-04 13:07:12 +09:00
parent 2d3e5f6a72
commit e92800165d
8 changed files with 1049 additions and 1 deletions

View File

@@ -310,6 +310,61 @@ public class SessionApp
public int DelayMs { get; set; } = 0;
}
// ─── 자동화 스케줄러 ─────────────────────────────────────────────────────────────
/// <summary>
/// 자동화 스케줄 항목.
/// 지정 시각에 앱 실행 또는 알림을 자동으로 발생시킵니다.
/// </summary>
public class ScheduleEntry
{
[JsonPropertyName("id")]
public string Id { get; set; } = Guid.NewGuid().ToString("N")[..8];
[JsonPropertyName("name")]
public string Name { get; set; } = "";
[JsonPropertyName("enabled")]
public bool Enabled { get; set; } = true;
// ─── 트리거 ───────────────────────────────────────────────────────────
/// <summary>실행 주기. daily | weekdays | weekly | once</summary>
[JsonPropertyName("triggerType")]
public string TriggerType { get; set; } = "daily";
/// <summary>실행 시각 (HH:mm 형식). 예: "09:00"</summary>
[JsonPropertyName("triggerTime")]
public string TriggerTime { get; set; } = "09:00";
/// <summary>weekly 트리거: 요일 목록. 0=일, 1=월 … 6=토</summary>
[JsonPropertyName("weekDays")]
public List<int> WeekDays { get; set; } = new();
/// <summary>once 트리거: 실행 날짜 (yyyy-MM-dd). 한 번만 실행 후 비활성화.</summary>
[JsonPropertyName("triggerDate")]
public string? TriggerDate { get; set; }
// ─── 액션 ─────────────────────────────────────────────────────────────
/// <summary>실행 동작 유형. app | notification</summary>
[JsonPropertyName("actionType")]
public string ActionType { get; set; } = "app";
/// <summary>앱 경로 또는 알림 메시지 본문</summary>
[JsonPropertyName("actionTarget")]
public string ActionTarget { get; set; } = "";
/// <summary>앱 실행 시 추가 인자</summary>
[JsonPropertyName("actionArgs")]
public string ActionArgs { get; set; } = "";
// ─── 상태 ─────────────────────────────────────────────────────────────
[JsonPropertyName("lastRun")]
public DateTime? LastRun { get; set; }
}
// ─── 잠금 해제 알림 설정 ───────────────────────────────────────────────────────
public class ReminderSettings