feat(ui): Windows 11 정통 네이티브 리디자인 + Google AdMob 광고 연동
- Mica 베이스 + 왼쪽 위 8px 라운드 콘텐츠 레이어 (탐색기·설정 앱 2계층 구조) - 시스템 라이트/다크·강조색 자동 추종 (FsThemeService, FsPalette.Light/Dark) - 강조색은 시스템 강조색에서 WCAG AA 대비를 보정해 파생 (FsAccentPalette) - Segoe UI Variable 타입 램프, 최소 12px, 반경 4/8px, 카드 중첩 제거 - 네온 시안·더블 베젤·그라디언트 버튼·Inter 서체 폐기 - 전 창 적용: 메인·빠른 옵션/진행·설정·도구 설치·진단, 광고는 중립 카드로 - 결함 수정: 사이드바 체크박스 라벨 잘림, 행 체크박스 잘림, 입력란 이중 여백, 제목 표시줄 아이콘 검게 렌더, '큐'/'대기열' 용어 혼용 - Google AdMob 광고 단위 연동 (AdHtmlBuilder, 설정 창 AdMob 카드) - Win11NativeDesignTests 계약 테스트, VisualCaptureHarness 시각 E2E 캡처
This commit is contained in:
parent
50072124a9
commit
ab126a001a
35 changed files with 4221 additions and 2469 deletions
190
design.md
190
design.md
|
|
@ -1,88 +1,148 @@
|
|||
# design.md — Everything2Everything Windows 11 Flagship Acrylic & Neo Glass Design System
|
||||
# design.md — Everything2Everything 디자인 결정 SSOT
|
||||
|
||||
`designpaca` 스튜디오 파이프라인(0~6단계)과 사용자 인터뷰를 완벽히 준수하여 Everything2Everything의 시각 언어, 레이아웃 그리드, 큐 항목 카드, 컨트롤 덱을 개편한 디자인 시스템 SSOT 문서입니다.
|
||||
> 2026-10-06 리디자인: **Windows 11 정통 네이티브**. 이전 방향("아크릴 & 네오 글래스 + 네온 시안")은 폐기했다.
|
||||
> 폐기 이유는 §7, 바꿀 때 지켜야 할 계약은 `src/Everything2Everything.Tests/Win11NativeDesignTests.cs`.
|
||||
|
||||
---
|
||||
|
||||
## 1. 브리프 게이트 (0단계: 사용자 인터뷰 확정)
|
||||
- **무엇을**: Everything2Everything (.NET 9 WPF) 올인원 파일 변환 유틸리티의 UI/UX를 Windows 11 플래그십 아크릴 & 네오 글래스(Fluent 2) 스타일로 전면 개편하고, 선택된 포맷에 맞춰 동적으로 동작하는 스마트 프리셋 시스템을 구현.
|
||||
- **누구에게**: 대량의 미디어·문서·오디오를 다루며 세련된 감각과 정밀한 변환 옵션, 실시간 스펙(비트레이트, DPI, 품질, 코덱) 피드백을 원하는 크리에이터 및 전문가.
|
||||
- **제약**: .NET 9 WPF (`Wpf.Ui` FluentWindow), 10초 이내 전체 테스트 스위트 100% 통과(TDD 절대주의), 8px 그리드 시스템 준수, 기본 로케일 ko-KR 한국어 표준화.
|
||||
- **사용자 인터뷰 확정 결정사항**:
|
||||
1. **톤앤매너**: **`Windows 11 플래그십 아크릴 & 네오 글래스`** (부드러운 반투명 블러 깊이감, 네오모피즘 소프트 섀도우, 둥근 알약 캡슐 컨트롤, 은은한 앰비언트 글로우). 기존의 밋밋한 다크 박스 스타일을 완전히 탈피.
|
||||
2. **프리셋 시스템**: **`출력 형식 연동 스마트 프리셋 드롭다운 + 스펙 칩`** (출력 형식 선택 시 전용 프리셋이 드롭다운으로 반응하고, 하단에 [320 kbps] [48 kHz] 등의 스펙 칩이 실시간 동기화). 기존의 무관한 고정 4개 버튼 완전 퇴출.
|
||||
3. **레이아웃**: **`좌측 사이드바 전면 재편 + 모던 글래스 카드 리스트`** (포맷과 동적 프리셋을 하나의 '스마트 변환 덱'으로 유기적 통합하고, 중앙 작업 큐 행을 입체적인 글래스 카드로 강화).
|
||||
## 1. 브리프 (0단계 · 사용자 인터뷰 2026-10-06)
|
||||
|
||||
```
|
||||
무엇을: Everything2Everything(.NET 9 WPF + Wpf.Ui 4.3) 전 창을 Windows 11 정통 네이티브 언어로 리디자인
|
||||
누구에게: 탐색기 우클릭·일괄 변환을 쓰는 사용자 — 옵션을 빨리 고르고 결과를 믿고 넘기길 원함
|
||||
제약: 3분할 정보 구조 유지 · 광고 두 자리 유지 · 시스템 라이트/다크·강조색 추종 · TDD(실패 0)
|
||||
기본 언어 ko-KR 한국어, 영어는 기술 용어(EXIF·CRF·kbps 등)만
|
||||
```
|
||||
|
||||
| 인터뷰 질문 | 사용자 답 |
|
||||
|---|---|
|
||||
| 시각 방향 | **Windows 11 정통 네이티브** (Mica, 시스템 강조색, Segoe UI Variable, 라이트/다크 자동) |
|
||||
| 레이아웃 범위 | **3분할 유지 + 정돈** |
|
||||
| 대상 창 | **메인 · 우클릭 빠른 창(옵션/진행) · 설정 · 도구 설치 · 진단** 전부 |
|
||||
| 광고 | **현 두 자리 유지** (목록 하단 배너 + 미리보기 하단 카드) |
|
||||
|
||||
### 리디자인 전 감사 (무너져 있던 것)
|
||||
1. 사이드바 체크박스 라벨이 잘림 — "무손실(Lossless) 보존 (WebI…"
|
||||
2. 거의 검은 바탕 + 네온 시안 하나: AI 생성 디자인의 가장 흔한 지문. "네오 글래스"라 했지만 실제 렌더는 평평한 상자
|
||||
3. 카드 안 카드 4중 중첩, 10~11px 글자 남발, 3차 텍스트 대비 부족
|
||||
4. Mica를 켜 놓고 85% 불투명 흑색(#D80A0C10)으로 덮어 Mica가 보이지 않음
|
||||
5. "큐"와 "대기열"이 같은 대상을 두 이름으로 부름
|
||||
|
||||
---
|
||||
|
||||
## 2. 레퍼런스 조사 및 6축 해체 (1단계)
|
||||
| 슬롯 | 대상 및 출처 | 가져온 핵심 원리 (6축 기반) |
|
||||
## 2. 레퍼런스 (1단계 · 정본 실측)
|
||||
|
||||
| 슬롯 | 출처 | 가져온 것 (실측값) |
|
||||
|---|---|---|
|
||||
| **R1 (구조)** | **Windows 11 Fluent 2 & Apple macOS Media Converter** | **유기적 포맷-프리셋 바인딩**: 출력 형식을 고르면 그 포맷의 특화 옵션과 프리셋이 자동으로 하위 컴포넌트에 주입되는 반응형 덱 구조. |
|
||||
| **R2 (톤)** | **Windows 11 Acrylic & Neo Glassmorphism** | **빛과 깊이의 위계**: 흑요석 아크릴 베이스(`rgba(10, 12, 16, 0.9)`), 카드 상단 림라이트 보더(`LinearGradient` 14% -> 4%), 부드러운 앰비언트 소프트 섀도우(Blur 16, Opacity 0.35), 둥근 알약 캡슐(Pill CornerRadius 14~16px). |
|
||||
| **R3 (디테일)** | **Teenage Engineering & Ableton Live / Final Cut Pro** | **실시간 기술 스펙 칩 (Live Spec Chips)**: 선택된 프리셋의 핵심 매개변수(비트레이트, 샘플레이트, DPI, 해상도, 코덱)를 모노스페이스 캡슐 뱃지로 즉각 시각화. |
|
||||
| R1 구조 | learn.microsoft.com/windows/apps/design/signature-experiences/**layering** | 2계층: 베이스(Mica, 내비·명령) + 콘텐츠 레이어(앱의 중심 경험). 카드 elevation 8, 컨트롤 2, stroke 1 |
|
||||
| R2 톤 | …/signature-experiences/**typography** | Segoe UI Variable 12/16 캡션 · 14/20 본문 · 20/28 부제 · 28/36 제목. **최소 14 Semibold / 12 Regular**. 문장형 대소문자. Bold·Italic 대신 Semibold |
|
||||
| R3 디테일 | …/signature-experiences/**geometry** | 컨트롤·리스트 4px, 창·플라이아웃·대화상자 8px, 맞닿는 직선 모서리 0px |
|
||||
|
||||
탐색기·설정 앱의 서명인 **"사이드 영역은 Mica 위, 본문은 왼쪽 위 모서리만 둥근 콘텐츠 레이어"**를 그대로 차용했다.
|
||||
|
||||
---
|
||||
|
||||
## 3. 방향 결정 (2단계)
|
||||
> **"단순한 어두운 창이 아닌, 빛과 유리가 깃든 최신 윈도우 11 플래그십 마스터링 덱"**
|
||||
## 3. 방향 (2단계)
|
||||
|
||||
- **Aesthetic Direction**: Windows 11 Flagship Acrylic & Neo Glass
|
||||
- **감수한 리스크 (The One Risk Taken)**:
|
||||
- 기존의 평평한 단색 박스를 버리고, **부드러운 아크릴 심도와 네오 섀도우, 림라이트 그라디언트 보더를 도입하여 깊이감 있는 3D 글래스 서피스를 전면 배치**.
|
||||
- **표면 다이얼**:
|
||||
- 표현성: 3 (플루언트 2 글래스모피즘, 정교한 캡슐, 빛과 그림자)
|
||||
- 정보 밀도: 3 (동적 스펙 칩 및 세부 파라미터 시각화)
|
||||
- 모션: 2 (부드러운 호버 글로우 및 유연한 콤보박스 인터랙션)
|
||||
- 텔레메트리: 3 (절감률 게이지, 상태 뱃지, 실시간 스펙 칩)
|
||||
- **한 문장 컨셉**: 탐색기에서 이어지는 작업창. 우클릭에서 태어난 도구라 메인 창도 탐색기·설정 앱과 같은 재질과 위계를 쓴다.
|
||||
- **과감한 한 가지(표현 리스크)**: 85% 불투명 흑색 덮개를 걷고 **Mica를 실제로 비치게** 했다. 사이드바·제목 표시줄은 Mica 위(베이스), 대기열과 미리보기는 `CornerRadius="8,0,0,0"`인 하나의 콘텐츠 레이어(`ContentLayer`)에 올렸다.
|
||||
- 검증: 라이트/다크 실앱 캡처에서 두 층이 구분되는지, 텍스트가 4.5:1을 넘는지(자동 테스트)
|
||||
- **반사실 점검**: 이 선택은 "Windows 셸 확장 도구"라는 이 앱의 정체성에서만 나온다. 다른 업종의 랜딩 페이지라면 나오지 않는다.
|
||||
- **표면 다이얼**: 표현성 1 · 정보 밀도 2 · 모션 1(호버·눌림 상태만) · 텔레메트리 1(엔진 상태 점 하나)
|
||||
|
||||
---
|
||||
|
||||
## 4. 디자인 토큰 체계 (3단계)
|
||||
## 4. 토큰 (3단계)
|
||||
|
||||
### 4.1 색상 및 글래스 토큰 (`FormatShiftTheme.xaml`)
|
||||
* `FsBgBase`: `#0A0C10` (심해 흑요석 베이스)
|
||||
* `FsBgPanel`: `#11141C` (반투명 아크릴 사이드바/헤더)
|
||||
* `FsBgSurface`: `#171B26` (네오 글래스 카드 배경)
|
||||
* `FsBgSurfaceHover`: `#202535` (호버 시 은은한 아크릴 밝기)
|
||||
* `FsBorderSubtle`: `LinearGradientBrush` (상단 `rgba(255,255,255,0.14)`, 하단 `rgba(255,255,255,0.04)`) - 상단 광원 림라이트 효과
|
||||
* `FsBorderStrong`: `rgba(255, 255, 255, 0.20)` (포커스 및 악센트 경계)
|
||||
* `FsAccentCyan`: `#06B6D4` (사이버네틱 네온 시안 시그니처)
|
||||
* `FsAccentCyanGlow`: `#22D3EE` (소프트 글로우 림)
|
||||
### 4.1 색 — `Views/Themes/FsPalette.{Dark|Light}.xaml`
|
||||
값은 WinUI 공용 테마 리소스에서 가져왔다. 두 파일의 키 집합은 같아야 한다(테스트로 강제). 모든 Fs 색은 **DynamicResource**로 참조하며(테스트로 강제), `FsThemeService`가 시스템 테마에 맞춰 사전을 갈아 끼운다.
|
||||
|
||||
### 4.2 알약 캡슐 컨트롤 (Pill Capsules)
|
||||
* **메인 탭 (Active Queue / Past Results)**: `CornerRadius="16"`, `Height="32"`, 선택 시 시안 글로우 언더라인 및 하이라이트.
|
||||
* **필터 칩**: `CornerRadius="14"`, 패딩 `10,4`, 아크릴 반투명 배경.
|
||||
* **스펙 칩 (Live Spec Chips)**: `CornerRadius="6"`, 패딩 `8,3`, JetBrains Mono 11px, 은은한 시안 틴트 배경.
|
||||
| 역할 | 다크 | 라이트 | WinUI 원천 |
|
||||
|---|---|---|---|
|
||||
| FsBgBase | 투명 | 투명 | Mica가 비친다 |
|
||||
| FsBgLayer | #4C3A3A3A | #80FFFFFF | LayerFillColorDefault |
|
||||
| FsBgCard | #0DFFFFFF | #B3FFFFFF | CardBackgroundFillColorDefault |
|
||||
| FsBgControl | #0FFFFFFF | #B3FFFFFF | ControlFillColorDefault |
|
||||
| FsBorderSubtle | #19000000 | #0F000000 | CardStrokeColorDefault |
|
||||
| FsTextPrimary/Secondary | #FFFFFF / #C5FFFFFF | #E4000000 / #9E000000 | TextFillColor* |
|
||||
| FsTextTertiary | #87FFFFFF | **#8B000000** | WinUI 라이트 기본 #72는 3.3:1이라 4.5:1로 보정 |
|
||||
| 상태(성공/경고/위험/정보) | #6CCB5F · #FCE100 · #FF99A4 · #60CDFF | #0F7B0F · #9D5D00 · #C42B1C · #005FB8 | SystemFillColor* |
|
||||
|
||||
**강조색**은 고정값이 없다. `FsAccentPalette.From(시스템 강조색, 테마)`가 색상·채도는 유지하고 명도만 밀어, 다음을 보장한다(9가지 극단 강조색으로 테스트).
|
||||
- 다크: 밝은 채움 + 검정 글자 / 라이트: 어두운 채움 + 흰 글자 — 버튼 글자 ≥ 4.5:1(호버 포함)
|
||||
- 강조 텍스트(FsAccentText)는 가장 불리한 면에서도 ≥ 4.5:1
|
||||
|
||||
형식 색(FsFmt*)은 두 테마가 같다. 채움으로 쓰지 않고 **외곽선·점으로만** 써서, 형식 색이 무엇이든 글자는 본문색으로 대비를 유지한다.
|
||||
|
||||
### 4.2 타이포 — `FormatShiftTheme.xaml`
|
||||
- FsFontSans `Segoe UI Variable Text, Segoe UI, Malgun Gothic`(한글은 Malgun Gothic 폴백) · FsFontDisplay(Variable Display) · FsFontMono `Cascadia Mono, Consolas`(경로·키 입력에만)
|
||||
- 스타일: FsCaptionStyle 12/16 Secondary · FsBodyStyle·FsLabelStyle 14/20 · FsSectionHeaderStyle 14 Semibold · FsSubtitleStyle 20/28 Semibold · FsNumStyle(캡션 + tabular 숫자)
|
||||
- **최소 12px**(테스트로 강제). 숫자는 모노 서체 대신 Segoe의 고정폭 숫자를 쓴다.
|
||||
|
||||
### 4.3 기하 · 간격
|
||||
- CornerRadius ∈ {0, 2, 4, 8}(테스트로 강제). 컨트롤 4 · 카드·창·오버레이 8 · 탭 표시줄 2
|
||||
- 간격 4의 배수. 카드 패딩 16, 카드 간격 8, 창 가장자리 16/24
|
||||
- 컨트롤 높이 32, 사이드바 주 버튼 40, 제목 표시줄 48(메인, WinUI Tall) / 42(대화상자)
|
||||
|
||||
### 4.4 컴포넌트 문법
|
||||
- 버튼 위계: **FsAccentButtonStyle은 창마다 하나**(메인=변환 시작 / 빈 대기열=파일 찾기 / 설정=저장 / 도구 설치=설치 시작) · 나머지는 FsSecondaryButtonStyle · 아이콘만 있으면 FsIconButtonStyle
|
||||
- 카드: FsCardStyle 한 단계만. **카드 안에 카드 금지**(테스트로 강제)
|
||||
- 탭: 텍스트 + 강조색 밑줄 3×16px(WinUI SelectorBar)
|
||||
- 입력: 채움 + 1px 외곽, 포커스 시 강조색 하단선 2px
|
||||
- 슬라이더: 4px 트랙, 18px 썸(외곽 + 강조색 점, 호버 시 커지고 끌 때 작아짐)
|
||||
|
||||
### 4.5 성능 예산
|
||||
WPF 데스크톱이라 웹 예산은 적용하지 않는다. 추가 이펙트(블러·그림자·애니메이션)는 0개. 렌더 비용은 Mica(OS 합성)뿐이다.
|
||||
|
||||
---
|
||||
|
||||
## 5. 실측 검증 및 게이트 계획 (5단계)
|
||||
* TDD 절대주의: 실패하는 RED 테스트(`FormatPresetEngineTests`) 선행 작성.
|
||||
* 10초 이내 전체 테스트 100% 통과 (목표 실행 시간 1.5초 이내).
|
||||
- **15대 하드 게이트 통과 내역**:
|
||||
1. 토큰 밖 인라인 색상/폰트 없음: 통과 (100% 리소스 참조)
|
||||
2. 한 페이지 내 다중 강조색 없음: 통과 (네온 시안 단일 중심, 상태색/카테고리 분리)
|
||||
3. 일관된 border-radius: 통과 (Pill 14/20px, Card 6/8px, Tag 3/4px)
|
||||
4. 페이지 중간 테마 반전 없음: 통과 (일관된 Swiss Minimal 톤 유지)
|
||||
5. 불필요한 가로 스크롤 없음: 통과 (2~3열 반응형 그리드 및 TextWrapping)
|
||||
6. 버튼 라벨 2줄 접힘 없음: 통과 (수직 중앙 정렬 및 여유 폭 확보)
|
||||
7. 텍스트-배경 대비 4.5:1 이상: 통과 (최소 7.8:1, 최대 15.2:1, 버튼 9.8:1로 WCAG AAA 충족)
|
||||
8. 비정형 속성 애니메이션 배제: 통과
|
||||
9. 모바일/데스크톱 뷰포트 오버플로 없음: 통과
|
||||
10. 불필요한 이벤트 리스너 배제: 통과
|
||||
11. 가짜 통계 수치 배제: 통과 (기본값 정직한 0 노출)
|
||||
12. 가짜 스크린샷 배제: 통과
|
||||
13. 브랜드 표면 정합성: 통과
|
||||
14. 미사용 죽은 스타일/코드 배제: 통과
|
||||
15. 제3언어 클리셰 배제 및 한국어 표준화: 통과 (100% 정제된 한국어 표기)
|
||||
## 5. 화면별 결정 (4단계)
|
||||
|
||||
| 창 | 결정 |
|
||||
|---|---|
|
||||
| 메인 | 사이드바 = Mica 위 설정 카드 3장(변환 설정 · 저장 위치 · AI 작업). 통계 카드는 없애고 하단 한 줄 "오늘 변환 · 줄인 용량"으로. 콘텐츠 레이어 안에 검색 툴바 · 대기열/기록 · 미리보기. 빈 대기열은 **목록 영역 전체를 점선 드롭 대상**으로 보여 주고, 미선택 시 파일 정보 블록은 숨긴다 |
|
||||
| 우클릭 빠른 옵션 | Mica 적용(이전 None). 제목 20px, 값은 tabular 숫자 |
|
||||
| 빠른 진행 | 여백 24, 진행 막대 4px |
|
||||
| 설정 | 카드 3장(AI · 외부 도구 · 광고), 긴 체크박스 라벨은 줄바꿈, 하단 바는 레이어 면 |
|
||||
| 도구 설치 | 도구마다 카드 한 장, 카드 간격 4 |
|
||||
| 진단 | Mica 적용. 코드로 만드는 카드도 FsCardStyle과 팔레트 토큰을 쓰고 `SetResourceReference`로 테마를 따른다 |
|
||||
| 광고 | 자리 유지. **강조색을 쓰지 않는 중립 카드**로 낮춰 작업 도구보다 먼저 시선을 끌지 않게 했다(배지 "광고", CTA는 표준 버튼) |
|
||||
|
||||
### 카피
|
||||
- 같은 대상은 한 이름: "큐" → **"대기열"**(코드 문자열까지 테스트로 강제)
|
||||
- 사이드바 체크 라벨은 카드 안쪽 폭에서 한 줄(16자 이내). 한글이 낱자로 끊기지 않게 한다
|
||||
|
||||
---
|
||||
|
||||
## 6. 의도적으로 하지 않은 것과 그 이유 (6단계)
|
||||
1. **화려한 보라/파랑 그라디언트 및 드롭 섀도우 배제**:
|
||||
- 이유: 스위스 미니멀 원칙에 따라 거짓 입체감(그림자, 그라디언트) 대신 정직한 1px 경계선과 네온 시안으로 선명한 정렬과 위계를 구축함.
|
||||
2. **이모지 인라인 혼용 및 영문 라벨 배제**:
|
||||
- 이유: 아마추어 슬롭 패턴을 방지하고, 모든 액션 및 버튼을 정제된 벡터 아이콘과 표준 한국어로 통일함.
|
||||
3. **애니메이션 지연(Delay) 배제**:
|
||||
- 이유: 고속 일괄 작업 도구로서 즉각적인 반응성(`0.15s`)을 보장하기 위해 연출용 딜레이를 일체 넣지 않음.
|
||||
## 6. 검증 결과 (5단계)
|
||||
|
||||
- 자동: 전체 **429개 통과 · 실패 0 · 빌드 경고 0**. 새 계약 테스트는 `Win11NativeDesignTests`(강조색 대비 9종 × 테마, 팔레트 키 대칭·대비, 동적 참조, 하드코딩 색 금지, 최소 12px, 반경 단계, 카드 중첩 금지, Mica, 콘텐츠 레이어, 카피 어휘, 회귀 3종)
|
||||
- 시각: 실앱(E2E_THEME=dark/light) 캡처와 `VisualCaptureHarness`(창 6개 × 2테마, 채워진 대기열 포함)를 직접 열어 판정했다
|
||||
- 렌더 감사에서 잡아 게이트에 추가한 실측 결함 4건:
|
||||
1. 제목 표시줄(DWM 확장 영역) 안에서 **SymbolIcon이 Button의 직접 콘텐츠면 Foreground가 흰색이어도 검게 합성**됨 → 패널로 감쌈 (`TitleBarButtons_MustNotHostSymbolIconDirectly`)
|
||||
2. Wpf.Ui CheckBox 기본 MinWidth 때문에 32px 열의 행 체크박스가 반쯤 잘림 → `MinWidth="0"`
|
||||
3. TextBoxBase가 Padding을 콘텐츠 호스트에 넘기는데 바깥 Border에도 Padding을 줘서 글자가 22px 들여 씌어짐 → Border Padding 제거
|
||||
4. 이미 표시된 FluentWindow에 `ApplicationThemeManager.Apply(element)`를 걸면 AllowsTransparency 예외로 크래시 → 창을 만들기 전에만 테마 적용
|
||||
- 미검증: 실제 OS 테마를 실행 중에 바꿨을 때의 전환(코드 경로는 `SystemEvents.UserPreferenceChanged` → `ApplySystemTheme` → 팔레트 교체). 고대비 모드. 125%/150% 배율 실기기.
|
||||
|
||||
### 시각 검증 방법
|
||||
```powershell
|
||||
# 실앱 테마 강제 (QA 전용)
|
||||
$env:E2E_THEME="light"; .\Everything2Everything.exe
|
||||
# 오프스크린 캡처 (창 6개 × 라이트/다크)
|
||||
$env:E2E_CAPTURE_DIR="C:\temp\e2e"; dotnet test src/Everything2Everything.Tests --filter FullyQualifiedName~VisualCaptureHarness
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 7. 의도적으로 하지 않은 것과 그 이유
|
||||
|
||||
1. **네온 시안 · 고정 강조색 폐기** — 사용자가 OS에서 고른 강조색이 곧 이 앱의 강조색이다. 고정색은 "Windows의 일부" 컨셉과 충돌한다.
|
||||
2. **더블 베젤(카드 안 카드) · 그라디언트 섬 버튼 · 림라이트 폐기** — Windows 11에 없는 문법이고, 중첩은 위계를 흐린다.
|
||||
3. **Inter · JetBrains Mono 폐기** — 시스템에 없는 서체라 실제로는 Segoe/Consolas로 폴백되고 있었다. 시스템 서체를 명시했다.
|
||||
4. **10~11px 글자 폐기** — MS 최소 기준(12 Regular) 미만은 한글에서 특히 안 읽힌다.
|
||||
5. **광고에 강조색을 쓰지 않음** — 창마다 강조 버튼은 하나("변환 시작")라는 위계를 광고가 깨지 않게 했다.
|
||||
6. **진입 애니메이션 · 호버 글로우 없음** — 일괄 작업 도구는 즉시 반응이 미덕이다. 상태 변화(호버·눌림·포커스)만 표시한다.
|
||||
7. **레이아웃 3분할은 바꾸지 않음** — 사용자 결정. 비율과 위계, 빈 상태만 정돈했다.
|
||||
8. **배너 광고 HTML(`AdHtmlBuilder`)은 손대지 않음** — 커밋되지 않은 AdMob 작업이고, 실제 광고의 모양은 앱이 통제할 수 없다. 라이트 테마에서는 테스트 배너만 어둡게 보인다(후속 과제).
|
||||
9. **테스트 시간 10초 예산은 이번에 다루지 않음** — 리디자인 전부터 28초였다(현재 21초). 별도 과제.
|
||||
|
|
|
|||
|
|
@ -9,52 +9,10 @@
|
|||
<ResourceDictionary.MergedDictionaries>
|
||||
<ui:ThemesDictionary Theme="Dark"/>
|
||||
<ui:ControlsDictionary/>
|
||||
<!-- 시작 시 FsThemeService.FollowSystem 이 시스템 테마에 맞는 팔레트로 교체한다 -->
|
||||
<ResourceDictionary Source="Views/Themes/FsPalette.Dark.xaml"/>
|
||||
<ResourceDictionary Source="Views/FormatShiftTheme.xaml"/>
|
||||
</ResourceDictionary.MergedDictionaries>
|
||||
|
||||
<!-- Spacing tokens (Fluent 8pt grid) -->
|
||||
<Thickness x:Key="SpacingXS">4</Thickness>
|
||||
<Thickness x:Key="SpacingS">8</Thickness>
|
||||
<Thickness x:Key="SpacingM">16</Thickness>
|
||||
<Thickness x:Key="SpacingL">24</Thickness>
|
||||
<Thickness x:Key="SpacingXL">32</Thickness>
|
||||
|
||||
<!-- Typography (Fluent 2 type ramp, Segoe UI Variable) -->
|
||||
<Style x:Key="TextTitleLarge" TargetType="TextBlock">
|
||||
<Setter Property="FontFamily" Value="Segoe UI Variable Display, Segoe UI"/>
|
||||
<Setter Property="FontSize" Value="28"/>
|
||||
<Setter Property="FontWeight" Value="SemiBold"/>
|
||||
</Style>
|
||||
<Style x:Key="TextTitle" TargetType="TextBlock">
|
||||
<Setter Property="FontFamily" Value="Segoe UI Variable Display, Segoe UI"/>
|
||||
<Setter Property="FontSize" Value="20"/>
|
||||
<Setter Property="FontWeight" Value="SemiBold"/>
|
||||
</Style>
|
||||
<Style x:Key="TextSubtitle" TargetType="TextBlock">
|
||||
<Setter Property="FontFamily" Value="Segoe UI Variable Text, Segoe UI"/>
|
||||
<Setter Property="FontSize" Value="16"/>
|
||||
<Setter Property="FontWeight" Value="SemiBold"/>
|
||||
</Style>
|
||||
<Style x:Key="TextBodyStrong" TargetType="TextBlock">
|
||||
<Setter Property="FontFamily" Value="Segoe UI Variable Text, Segoe UI"/>
|
||||
<Setter Property="FontSize" Value="14"/>
|
||||
<Setter Property="FontWeight" Value="SemiBold"/>
|
||||
</Style>
|
||||
<Style x:Key="TextBody" TargetType="TextBlock">
|
||||
<Setter Property="FontFamily" Value="Segoe UI Variable Text, Segoe UI"/>
|
||||
<Setter Property="FontSize" Value="14"/>
|
||||
</Style>
|
||||
<Style x:Key="TextCaption" TargetType="TextBlock">
|
||||
<Setter Property="FontFamily" Value="Segoe UI Variable Small, Segoe UI"/>
|
||||
<Setter Property="FontSize" Value="12"/>
|
||||
<Setter Property="Foreground" Value="{DynamicResource TextFillColorSecondaryBrush}"/>
|
||||
</Style>
|
||||
|
||||
<!-- Status badge brushes -->
|
||||
<SolidColorBrush x:Key="BadgeReadyBrush" Color="#10B981"/>
|
||||
<SolidColorBrush x:Key="BadgeWarnBrush" Color="#F59E0B"/>
|
||||
<SolidColorBrush x:Key="BadgeInfoBrush" Color="#3B82F6"/>
|
||||
<SolidColorBrush x:Key="BadgeMutedBrush" Color="#6B7280"/>
|
||||
</ResourceDictionary>
|
||||
</Application.Resources>
|
||||
</Application>
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
using System.Windows;
|
||||
using Everything2Everything.App.Cli;
|
||||
using Everything2Everything.App.Theming;
|
||||
using Everything2Everything.App.Views;
|
||||
using Everything2Everything.Core;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
|
|
@ -30,6 +31,7 @@ public partial class App : Application
|
|||
base.OnStartup(e);
|
||||
|
||||
WireGlobalExceptionLogging();
|
||||
FsThemeService.FollowSystem(this);
|
||||
|
||||
var parsed = CliRouter.Parse(e.Args);
|
||||
|
||||
|
|
|
|||
|
|
@ -24,6 +24,7 @@
|
|||
<PackageReference Include="WPF-UI" />
|
||||
<PackageReference Include="CommunityToolkit.Mvvm" />
|
||||
<PackageReference Include="Microsoft.Xaml.Behaviors.Wpf" />
|
||||
<PackageReference Include="Microsoft.Web.WebView2" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
|
|
|||
167
src/Everything2Everything.App/Theming/FsTheme.cs
Normal file
167
src/Everything2Everything.App/Theming/FsTheme.cs
Normal file
|
|
@ -0,0 +1,167 @@
|
|||
using System.Windows;
|
||||
using System.Windows.Media;
|
||||
using Microsoft.Win32;
|
||||
using Wpf.Ui.Appearance;
|
||||
using Wpf.Ui.Controls;
|
||||
|
||||
namespace Everything2Everything.App.Theming;
|
||||
|
||||
public enum FsThemeMode { Light, Dark }
|
||||
|
||||
/// <summary>시스템 강조색에서 파생한, 대비가 보장된 강조 역할 색.</summary>
|
||||
public readonly record struct FsAccentColors(Color Fill, Color FillHover, Color Text, Color OnFill, Color Subtle);
|
||||
|
||||
/// <summary>WCAG 2.x 상대 휘도 대비와 알파 합성.</summary>
|
||||
public static class FsContrast
|
||||
{
|
||||
public static double Ratio(Color a, Color b)
|
||||
{
|
||||
double la = Luminance(a), lb = Luminance(b);
|
||||
return (Math.Max(la, lb) + 0.05) / (Math.Min(la, lb) + 0.05);
|
||||
}
|
||||
|
||||
/// <summary>top을 불투명한 bottom 위에 얹은 결과(불투명).</summary>
|
||||
public static Color Composite(Color top, Color bottom)
|
||||
{
|
||||
double a = top.A / 255.0;
|
||||
byte Mix(byte t, byte b) => (byte)Math.Round(t * a + b * (1 - a));
|
||||
return Color.FromRgb(Mix(top.R, bottom.R), Mix(top.G, bottom.G), Mix(top.B, bottom.B));
|
||||
}
|
||||
|
||||
private static double Luminance(Color c)
|
||||
{
|
||||
static double Lin(byte v)
|
||||
{
|
||||
double s = v / 255.0;
|
||||
return s <= 0.04045 ? s / 12.92 : Math.Pow((s + 0.055) / 1.055, 2.4);
|
||||
}
|
||||
return 0.2126 * Lin(c.R) + 0.7152 * Lin(c.G) + 0.0722 * Lin(c.B);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// WinUI 규칙(다크 = 밝은 강조 + 검정 글자, 라이트 = 어두운 강조 + 흰 글자)을 따르되,
|
||||
/// 사용자가 노랑·흰색 같은 극단 강조색을 골라도 4.5:1 이상이 되도록 명도만 밀어낸다(색상·채도는 유지).
|
||||
/// </summary>
|
||||
public static class FsAccentPalette
|
||||
{
|
||||
// 강조 텍스트가 놓일 수 있는 가장 불리한 면(다크: 가장 밝은 카드, 라이트: 가장 어두운 Mica)
|
||||
private static readonly Color DarkWorstSurface = Color.FromRgb(0x3C, 0x3C, 0x3C);
|
||||
private static readonly Color LightWorstSurface = Color.FromRgb(0xE8, 0xE8, 0xE8);
|
||||
private const double Target = 4.6;
|
||||
private const double HoverShift = 0.06;
|
||||
|
||||
public static FsAccentColors From(Color systemAccent, FsThemeMode mode)
|
||||
{
|
||||
var (h, s, l) = ToHsl(systemAccent);
|
||||
bool dark = mode == FsThemeMode.Dark;
|
||||
var onFill = dark ? Colors.Black : Colors.White;
|
||||
var worst = dark ? DarkWorstSurface : LightWorstSurface;
|
||||
double step = dark ? 0.01 : -0.01;
|
||||
|
||||
// 채움: 다크는 최소 Light2 근처(0.70)에서, 라이트는 최대 Dark1 근처(0.40)에서 출발
|
||||
double fillL = dark ? Math.Max(l, 0.70) : Math.Min(l, 0.40);
|
||||
while (!Passes(onFill, FromHsl(h, s, fillL)) || !Passes(onFill, FromHsl(h, s, fillL - step * HoverShift * 100)))
|
||||
fillL = Math.Clamp(fillL + step, 0, 1);
|
||||
|
||||
double textL = dark ? Math.Max(l, 0.78) : Math.Min(l, 0.32);
|
||||
while (FsContrast.Ratio(FromHsl(h, s, textL), worst) < Target && textL is > 0 and < 1)
|
||||
textL = Math.Clamp(textL + step, 0, 1);
|
||||
|
||||
var fill = FromHsl(h, s, fillL);
|
||||
var hover = FromHsl(h, s, fillL - step * HoverShift * 100);
|
||||
var subtle = Color.FromArgb(dark ? (byte)0x33 : (byte)0x26, fill.R, fill.G, fill.B);
|
||||
return new FsAccentColors(fill, hover, FromHsl(h, s, textL), onFill, subtle);
|
||||
|
||||
bool Passes(Color fg, Color bg) => FsContrast.Ratio(fg, bg) >= Target || fillL is <= 0 or >= 1;
|
||||
}
|
||||
|
||||
private static (double H, double S, double L) ToHsl(Color c)
|
||||
{
|
||||
double r = c.R / 255.0, g = c.G / 255.0, b = c.B / 255.0;
|
||||
double max = Math.Max(r, Math.Max(g, b)), min = Math.Min(r, Math.Min(g, b));
|
||||
double l = (max + min) / 2, d = max - min;
|
||||
if (d < 1e-9) return (0, 0, l);
|
||||
double s = l > 0.5 ? d / (2 - max - min) : d / (max + min);
|
||||
double h = max == r ? (g - b) / d + (g < b ? 6 : 0) : max == g ? (b - r) / d + 2 : (r - g) / d + 4;
|
||||
return (h / 6, s, l);
|
||||
}
|
||||
|
||||
private static Color FromHsl(double h, double s, double l)
|
||||
{
|
||||
l = Math.Clamp(l, 0, 1);
|
||||
if (s < 1e-9) { var v = (byte)Math.Round(l * 255); return Color.FromRgb(v, v, v); }
|
||||
double q = l < 0.5 ? l * (1 + s) : l + s - l * s, p = 2 * l - q;
|
||||
static double Hue(double p, double q, double t)
|
||||
{
|
||||
if (t < 0) t += 1; if (t > 1) t -= 1;
|
||||
return t < 1.0 / 6 ? p + (q - p) * 6 * t : t < 0.5 ? q : t < 2.0 / 3 ? p + (q - p) * (2.0 / 3 - t) * 6 : p;
|
||||
}
|
||||
return Color.FromRgb((byte)Math.Round(Hue(p, q, h + 1.0 / 3) * 255),
|
||||
(byte)Math.Round(Hue(p, q, h) * 255),
|
||||
(byte)Math.Round(Hue(p, q, h - 1.0 / 3) * 255));
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 시스템 라이트/다크·강조색을 앱 팔레트(Themes/FsPalette.*.xaml)에 반영한다.
|
||||
/// 모든 Fs 색 토큰은 DynamicResource로 참조되므로 사전 교체만으로 열린 창이 즉시 따라간다.
|
||||
/// QA용으로 환경 변수 E2E_THEME=light|dark 가 있으면 시스템 설정보다 우선한다.
|
||||
/// </summary>
|
||||
public static class FsThemeService
|
||||
{
|
||||
private const string PaletteMarker = "FsPalette.";
|
||||
|
||||
public static Uri PaletteUri(FsThemeMode mode)
|
||||
=> new($"pack://application:,,,/Everything2Everything;component/Views/Themes/FsPalette.{mode}.xaml", UriKind.Absolute);
|
||||
|
||||
public static void FollowSystem(Application app)
|
||||
{
|
||||
var forced = Environment.GetEnvironmentVariable("E2E_THEME")?.Trim().ToLowerInvariant();
|
||||
if (forced is "light" or "dark")
|
||||
{
|
||||
var theme = forced == "light" ? ApplicationTheme.Light : ApplicationTheme.Dark;
|
||||
ApplicationThemeManager.Apply(theme, WindowBackdropType.Mica, updateAccent: true);
|
||||
}
|
||||
else
|
||||
{
|
||||
ApplicationThemeManager.ApplySystemTheme(updateAccent: true);
|
||||
SystemEvents.UserPreferenceChanged += (_, e) =>
|
||||
{
|
||||
if (e.Category is UserPreferenceCategory.General or UserPreferenceCategory.Color)
|
||||
app.Dispatcher.BeginInvoke(() => ApplicationThemeManager.ApplySystemTheme(updateAccent: true));
|
||||
};
|
||||
}
|
||||
|
||||
// 창을 만들기 전에 테마가 정해지므로 FluentWindow는 생성 시점의 명암으로 Mica를 칠한다.
|
||||
Apply(app, CurrentMode(), ApplicationAccentColorManager.GetColorizationColor());
|
||||
ApplicationThemeManager.Changed += (theme, accent) =>
|
||||
Apply(app, theme == ApplicationTheme.Light ? FsThemeMode.Light : FsThemeMode.Dark, accent);
|
||||
}
|
||||
|
||||
public static FsThemeMode CurrentMode()
|
||||
=> ApplicationThemeManager.GetAppTheme() == ApplicationTheme.Light ? FsThemeMode.Light : FsThemeMode.Dark;
|
||||
|
||||
public static void Apply(Application app, FsThemeMode mode, Color systemAccent)
|
||||
{
|
||||
var merged = app.Resources.MergedDictionaries;
|
||||
var existing = merged.FirstOrDefault(d => d.Source?.OriginalString.Contains(PaletteMarker) == true);
|
||||
var next = new ResourceDictionary { Source = PaletteUri(mode) };
|
||||
if (existing == null) merged.Add(next);
|
||||
else merged[merged.IndexOf(existing)] = next;
|
||||
|
||||
var a = FsAccentPalette.From(systemAccent, mode);
|
||||
app.Resources["FsAccent"] = Frozen(a.Fill);
|
||||
app.Resources["FsAccentHover"] = Frozen(a.FillHover);
|
||||
app.Resources["FsAccentText"] = Frozen(a.Text);
|
||||
app.Resources["FsTextOnAccent"] = Frozen(a.OnFill);
|
||||
app.Resources["FsAccentSubtle"] = Frozen(a.Subtle);
|
||||
}
|
||||
|
||||
private static SolidColorBrush Frozen(Color c)
|
||||
{
|
||||
var b = new SolidColorBrush(c);
|
||||
b.Freeze();
|
||||
return b;
|
||||
}
|
||||
}
|
||||
|
|
@ -44,6 +44,13 @@ public class AdViewModel : INotifyPropertyChanged
|
|||
public ICommand ClickLargeAdCommand { get; }
|
||||
public ICommand DismissBannerCommand { get; }
|
||||
public ICommand DismissLargeCardCommand { get; }
|
||||
public IAdService AdService => _adService;
|
||||
|
||||
public void RefreshAds()
|
||||
{
|
||||
CurrentBannerAd = _adService.GetNextBannerAd();
|
||||
CurrentLargeAd = _adService.GetNextLargeCardAd();
|
||||
}
|
||||
|
||||
public AdViewModel(IAdService adService)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -2,10 +2,11 @@
|
|||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:ui="http://schemas.lepo.co/wpfui/2022/xaml"
|
||||
xmlns:wv2="clr-namespace:Microsoft.Web.WebView2.Wpf;assembly=Microsoft.Web.WebView2.Wpf"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
mc:Ignorable="d"
|
||||
d:DesignHeight="56" d:DesignWidth="800">
|
||||
d:DesignHeight="60" d:DesignWidth="800">
|
||||
<UserControl.Resources>
|
||||
<ResourceDictionary>
|
||||
<ResourceDictionary.MergedDictionaries>
|
||||
|
|
@ -15,11 +16,20 @@
|
|||
</ResourceDictionary>
|
||||
</UserControl.Resources>
|
||||
|
||||
<!-- 광고는 강조색을 쓰지 않는다: 작업 도구(강조 버튼)보다 시선을 먼저 끌지 않도록 중립 카드 -->
|
||||
<Border Visibility="{Binding IsBannerVisible, Converter={StaticResource BoolToVis}}"
|
||||
Style="{StaticResource FsDoubleBezelShellStyle}"
|
||||
Margin="0,4,0,0">
|
||||
<Border Style="{StaticResource FsDoubleBezelCoreStyle}" Padding="12,8">
|
||||
<Grid VerticalAlignment="Center">
|
||||
Style="{StaticResource FsCardStyle}"
|
||||
Padding="0"
|
||||
Height="56">
|
||||
<Grid>
|
||||
<!-- 1. WebView2 웹 광고 렌더러 (Google AdMob / AdSense) -->
|
||||
<wv2:WebView2 x:Name="AdWebView"
|
||||
Visibility="Collapsed"
|
||||
HorizontalAlignment="Stretch"
|
||||
VerticalAlignment="Stretch"/>
|
||||
|
||||
<!-- 2. 네이티브 백업 렌더러 -->
|
||||
<Grid x:Name="NativeAdFallback" VerticalAlignment="Center" Margin="12,0,8,0">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
<ColumnDefinition Width="*"/>
|
||||
|
|
@ -27,73 +37,71 @@
|
|||
<ColumnDefinition Width="Auto"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
|
||||
<!-- 1. [AD] / [스폰서] 배지 -->
|
||||
<Border Grid.Column="0"
|
||||
Margin="0,0,10,0"
|
||||
Padding="6,2"
|
||||
Margin="0,0,12,0"
|
||||
Padding="4,0"
|
||||
CornerRadius="4"
|
||||
Background="#1A00E5FF"
|
||||
BorderBrush="{StaticResource FsAccentCyan}"
|
||||
BorderBrush="{DynamicResource FsBorderStrong}"
|
||||
BorderThickness="1"
|
||||
VerticalAlignment="Center">
|
||||
<TextBlock Text="{Binding CurrentBannerAd.BadgeText, FallbackValue=AD}"
|
||||
FontSize="10"
|
||||
FontWeight="Bold"
|
||||
Foreground="{StaticResource FsAccentCyan}"
|
||||
<TextBlock Text="{Binding CurrentBannerAd.BadgeText, FallbackValue=광고}"
|
||||
Style="{StaticResource FsCaptionStyle}"
|
||||
VerticalAlignment="Center"
|
||||
TextTrimming="CharacterEllipsis"/>
|
||||
</Border>
|
||||
|
||||
<!-- 2. 광고 타이틀 및 설명 -->
|
||||
<StackPanel Grid.Column="1" VerticalAlignment="Center" Margin="0,0,12,0">
|
||||
<TextBlock Text="{Binding CurrentBannerAd.Title, FallbackValue=스폰서십 안내}"
|
||||
Style="{StaticResource FsLabelStyle}"
|
||||
Foreground="{StaticResource FsTextPrimary}"
|
||||
FontWeight="SemiBold"
|
||||
<StackPanel Grid.Column="1" VerticalAlignment="Center" Margin="0,0,8,0">
|
||||
<TextBlock Text="{Binding CurrentBannerAd.Title, FallbackValue='Google AdMob 공식 배너'}"
|
||||
Style="{StaticResource FsBodyStyle}"
|
||||
TextTrimming="CharacterEllipsis"
|
||||
VerticalAlignment="Center"/>
|
||||
<TextBlock Text="{Binding CurrentBannerAd.Description, FallbackValue=Everything2Everything을 후원하고 최신 기능을 가장 먼저 만나보세요.}"
|
||||
<TextBlock Text="{Binding CurrentBannerAd.Description, FallbackValue='스폰서 광고 단위가 연결되어 있습니다.'}"
|
||||
Style="{StaticResource FsCaptionStyle}"
|
||||
Foreground="{StaticResource FsTextSecondary}"
|
||||
Margin="0,2,0,0"
|
||||
TextTrimming="CharacterEllipsis"
|
||||
VerticalAlignment="Center"/>
|
||||
</StackPanel>
|
||||
|
||||
<!-- 3. CTA 액션 버튼 -->
|
||||
<Button Grid.Column="2"
|
||||
Margin="0,0,8,0"
|
||||
Padding="12,4"
|
||||
Height="28"
|
||||
Margin="0,0,4,0"
|
||||
Padding="12,0"
|
||||
Height="32"
|
||||
FontSize="12"
|
||||
VerticalAlignment="Center"
|
||||
Style="{StaticResource FsSecondaryButtonStyle}"
|
||||
Command="{Binding ClickBannerAdCommand}"
|
||||
ToolTip="광고 및 안내 링크 열기">
|
||||
ToolTip="광고 링크 열기">
|
||||
<StackPanel Orientation="Horizontal" VerticalAlignment="Center">
|
||||
<TextBlock Text="{Binding CurrentBannerAd.CtaText, FallbackValue='자세히 보기'}"
|
||||
FontSize="11"
|
||||
VerticalAlignment="Center"
|
||||
TextTrimming="CharacterEllipsis"/>
|
||||
<ui:SymbolIcon Symbol="Open24"
|
||||
FontSize="11"
|
||||
FontSize="14"
|
||||
Margin="4,0,0,0"
|
||||
VerticalAlignment="Center"/>
|
||||
</StackPanel>
|
||||
</Button>
|
||||
|
||||
<!-- 4. 광고 닫기 버튼 -->
|
||||
<Button Grid.Column="3"
|
||||
Width="24" Height="24"
|
||||
VerticalAlignment="Center"
|
||||
Style="{StaticResource FsIconButtonStyle}"
|
||||
Command="{Binding DismissBannerCommand}"
|
||||
ToolTip="광고 닫기">
|
||||
<ui:SymbolIcon Symbol="Dismiss24"
|
||||
FontSize="11"
|
||||
Foreground="{StaticResource FsTextTertiary}"
|
||||
VerticalAlignment="Center"/>
|
||||
ToolTip="광고 닫기" AutomationProperties.Name="광고 닫기">
|
||||
<ui:SymbolIcon Symbol="Dismiss24" FontSize="12" VerticalAlignment="Center"/>
|
||||
</Button>
|
||||
</Grid>
|
||||
</Border>
|
||||
|
||||
<!-- 3. 웹 광고 위 닫기 버튼 -->
|
||||
<Button x:Name="OverlayCloseBtn"
|
||||
HorizontalAlignment="Right"
|
||||
VerticalAlignment="Top"
|
||||
Margin="0,4,4,0"
|
||||
Width="24" Height="24"
|
||||
Visibility="Collapsed"
|
||||
Style="{StaticResource FsIconButtonStyle}"
|
||||
Command="{Binding DismissBannerCommand}"
|
||||
ToolTip="광고 닫기" AutomationProperties.Name="광고 닫기">
|
||||
<ui:SymbolIcon Symbol="Dismiss24" FontSize="12" VerticalAlignment="Center"/>
|
||||
</Button>
|
||||
</Grid>
|
||||
</Border>
|
||||
</UserControl>
|
||||
|
|
|
|||
|
|
@ -1,11 +1,121 @@
|
|||
using System;
|
||||
using System.IO;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using Microsoft.Web.WebView2.Core;
|
||||
|
||||
namespace Everything2Everything.App.Views;
|
||||
|
||||
public partial class AdBannerControl : UserControl
|
||||
{
|
||||
private bool _isInitialized;
|
||||
|
||||
public AdBannerControl()
|
||||
{
|
||||
InitializeComponent();
|
||||
Loaded += OnLoaded;
|
||||
DataContextChanged += OnDataContextChanged;
|
||||
}
|
||||
|
||||
private async void OnLoaded(object sender, RoutedEventArgs e)
|
||||
{
|
||||
if (_isInitialized) return;
|
||||
_isInitialized = true;
|
||||
await InitializeWebViewAsync();
|
||||
}
|
||||
|
||||
private async Task InitializeWebViewAsync()
|
||||
{
|
||||
try
|
||||
{
|
||||
if (AdWebView == null) return;
|
||||
var localAppData = Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData);
|
||||
var userDataFolder = Path.Combine(localAppData, "Everything2Everything", "WebView2");
|
||||
|
||||
var env = await CoreWebView2Environment.CreateAsync(null, userDataFolder);
|
||||
await AdWebView.EnsureCoreWebView2Async(env);
|
||||
|
||||
AdWebView.CoreWebView2.Settings.IsStatusBarEnabled = false;
|
||||
AdWebView.CoreWebView2.Settings.AreDevToolsEnabled = false;
|
||||
AdWebView.CoreWebView2.Settings.AreDefaultContextMenusEnabled = false;
|
||||
AdWebView.CoreWebView2.WebMessageReceived += OnWebMessageReceived;
|
||||
AdWebView.CoreWebView2.NewWindowRequested += (s, args) =>
|
||||
{
|
||||
args.Handled = true;
|
||||
if (!string.IsNullOrEmpty(args.Uri))
|
||||
{
|
||||
try
|
||||
{
|
||||
System.Diagnostics.Process.Start(new System.Diagnostics.ProcessStartInfo
|
||||
{
|
||||
FileName = args.Uri,
|
||||
UseShellExecute = true
|
||||
});
|
||||
}
|
||||
catch { }
|
||||
}
|
||||
};
|
||||
|
||||
File.AppendAllText(Path.Combine(Path.GetTempPath(), "AdBannerControl.log"),
|
||||
$"[{DateTime.Now}] WebView2 initialized successfully. DataContext: {DataContext?.GetType().Name}\n");
|
||||
|
||||
RenderAdHtml();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
File.AppendAllText(Path.Combine(Path.GetTempPath(), "AdBannerControl.log"),
|
||||
$"[{DateTime.Now}] WebView2 init error: {ex.Message}\n{ex}\n");
|
||||
// WebView2 미설치 또는 권한 문제 시 네이티브 백업 뷰 유지
|
||||
ShowNativeFallback();
|
||||
}
|
||||
}
|
||||
|
||||
private void OnDataContextChanged(object sender, DependencyPropertyChangedEventArgs e)
|
||||
{
|
||||
RenderAdHtml();
|
||||
}
|
||||
|
||||
private void RenderAdHtml()
|
||||
{
|
||||
var logPath = Path.Combine(Path.GetTempPath(), "AdBannerControl.log");
|
||||
if (DataContext is ViewModels.AdViewModel vm && vm.CurrentBannerAd != null)
|
||||
{
|
||||
var html = vm.CurrentBannerAd.HtmlContent;
|
||||
File.AppendAllText(logPath, $"[{DateTime.Now}] RenderAdHtml: HasHtml={!string.IsNullOrEmpty(html)}, WebViewReady={AdWebView?.CoreWebView2 != null}\n");
|
||||
if (!string.IsNullOrEmpty(html) && AdWebView?.CoreWebView2 != null)
|
||||
{
|
||||
AdWebView.NavigateToString(html);
|
||||
AdWebView.Visibility = Visibility.Visible;
|
||||
NativeAdFallback.Visibility = Visibility.Collapsed;
|
||||
OverlayCloseBtn.Visibility = Visibility.Visible;
|
||||
return;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
File.AppendAllText(logPath, $"[{DateTime.Now}] RenderAdHtml: DataContext is {DataContext?.GetType().FullName ?? "null"}\n");
|
||||
}
|
||||
|
||||
ShowNativeFallback();
|
||||
}
|
||||
|
||||
private void ShowNativeFallback()
|
||||
{
|
||||
if (AdWebView != null) AdWebView.Visibility = Visibility.Collapsed;
|
||||
if (NativeAdFallback != null) NativeAdFallback.Visibility = Visibility.Visible;
|
||||
if (OverlayCloseBtn != null) OverlayCloseBtn.Visibility = Visibility.Collapsed;
|
||||
}
|
||||
|
||||
private void OnWebMessageReceived(object? sender, CoreWebView2WebMessageReceivedEventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (DataContext is ViewModels.AdViewModel vm && vm.CurrentBannerAd != null)
|
||||
{
|
||||
vm.ClickBannerAdCommand.Execute(null);
|
||||
}
|
||||
}
|
||||
catch { }
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -15,103 +15,83 @@
|
|||
</ResourceDictionary>
|
||||
</UserControl.Resources>
|
||||
|
||||
<!-- 광고는 강조색을 쓰지 않는다: 미리보기의 열기·폴더 버튼과 같은 무게의 중립 카드 -->
|
||||
<Border Visibility="{Binding IsLargeCardVisible, Converter={StaticResource BoolToVis}}"
|
||||
Style="{StaticResource FsDoubleBezelShellStyle}"
|
||||
Margin="0,16,0,0">
|
||||
<Border Style="{StaticResource FsDoubleBezelCoreStyle}" Padding="16">
|
||||
<StackPanel>
|
||||
<!-- 1. 헤더: 스폰서 배지 + 닫기 버튼 -->
|
||||
<Grid Margin="0,0,0,12">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="*"/>
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<StackPanel Grid.Column="0" Orientation="Horizontal" VerticalAlignment="Center">
|
||||
<Border Padding="6,2"
|
||||
CornerRadius="4"
|
||||
Background="#1A3B82F6"
|
||||
BorderBrush="{StaticResource FsAccentBlue}"
|
||||
BorderThickness="1"
|
||||
VerticalAlignment="Center">
|
||||
<TextBlock Text="{Binding CurrentLargeAd.BadgeText, FallbackValue='스폰서 추천'}"
|
||||
FontSize="10"
|
||||
FontWeight="Bold"
|
||||
Foreground="{StaticResource FsAccentBlue}"
|
||||
VerticalAlignment="Center"
|
||||
TextTrimming="CharacterEllipsis"/>
|
||||
</Border>
|
||||
</StackPanel>
|
||||
Style="{StaticResource FsCardStyle}"
|
||||
Padding="12">
|
||||
<Grid>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
<ColumnDefinition Width="*"/>
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="Auto"/>
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<Button Grid.Column="1"
|
||||
Width="22" Height="22"
|
||||
VerticalAlignment="Center"
|
||||
Style="{StaticResource FsIconButtonStyle}"
|
||||
Command="{Binding DismissLargeCardCommand}"
|
||||
ToolTip="광고 닫기">
|
||||
<ui:SymbolIcon Symbol="Dismiss24"
|
||||
FontSize="10"
|
||||
Foreground="{StaticResource FsTextTertiary}"
|
||||
VerticalAlignment="Center"/>
|
||||
</Button>
|
||||
</Grid>
|
||||
<Border Grid.Column="0" Grid.Row="0"
|
||||
Width="32" Height="32"
|
||||
CornerRadius="4"
|
||||
Background="{DynamicResource FsBgControl}"
|
||||
BorderBrush="{DynamicResource FsBorderControl}"
|
||||
BorderThickness="1"
|
||||
Margin="0,0,12,0"
|
||||
VerticalAlignment="Top">
|
||||
<Image Width="16" Height="16"
|
||||
VerticalAlignment="Center"
|
||||
HorizontalAlignment="Center"
|
||||
RenderOptions.BitmapScalingMode="HighQuality"
|
||||
Source="pack://application:,,,/Everything2Everything;component/Assets/logo-mark.png"/>
|
||||
</Border>
|
||||
|
||||
<!-- 2. 본문: 아이콘/이미지 + 타이틀 + 설명 -->
|
||||
<Grid Margin="0,0,0,12">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
<ColumnDefinition Width="*"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
|
||||
<Border Grid.Column="0"
|
||||
Width="36" Height="36"
|
||||
CornerRadius="8"
|
||||
Background="{StaticResource FsBgInput}"
|
||||
BorderBrush="{StaticResource FsBorderSubtle}"
|
||||
BorderThickness="1"
|
||||
Margin="0,0,12,0"
|
||||
VerticalAlignment="Center">
|
||||
<Image Width="20" Height="20"
|
||||
VerticalAlignment="Center"
|
||||
HorizontalAlignment="Center"
|
||||
RenderOptions.BitmapScalingMode="HighQuality"
|
||||
Source="pack://application:,,,/Everything2Everything;component/Assets/logo-mark.png"/>
|
||||
</Border>
|
||||
|
||||
<StackPanel Grid.Column="1" VerticalAlignment="Center">
|
||||
<TextBlock Text="{Binding CurrentLargeAd.Title, FallbackValue='비즈니스 미디어 솔루션'}"
|
||||
Style="{StaticResource FsLabelStyle}"
|
||||
Foreground="{StaticResource FsTextPrimary}"
|
||||
FontWeight="SemiBold"
|
||||
FontSize="13"
|
||||
TextTrimming="CharacterEllipsis"
|
||||
VerticalAlignment="Center"/>
|
||||
<TextBlock Text="{Binding CurrentLargeAd.Description, FallbackValue='고성능 무손실 일괄 변환을 업무 환경에 적용하세요.'}"
|
||||
<StackPanel Grid.Column="1" Grid.Row="0" VerticalAlignment="Center">
|
||||
<StackPanel Orientation="Horizontal" VerticalAlignment="Center">
|
||||
<Border Padding="4,0" CornerRadius="4"
|
||||
BorderBrush="{DynamicResource FsBorderStrong}" BorderThickness="1"
|
||||
Margin="0,0,8,0" VerticalAlignment="Center">
|
||||
<TextBlock Text="{Binding CurrentLargeAd.BadgeText, FallbackValue='광고'}"
|
||||
Style="{StaticResource FsCaptionStyle}"
|
||||
Foreground="{StaticResource FsTextSecondary}"
|
||||
Margin="0,3,0,0"
|
||||
TextWrapping="Wrap"
|
||||
VerticalAlignment="Center"/>
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
|
||||
<!-- 3. 하단 전면 CTA 버튼 -->
|
||||
<Button Style="{StaticResource FsIslandPrimaryButtonStyle}"
|
||||
Height="34"
|
||||
Command="{Binding ClickLargeAdCommand}"
|
||||
ToolTip="자세히 보기">
|
||||
<StackPanel Orientation="Horizontal" VerticalAlignment="Center">
|
||||
<TextBlock Text="{Binding CurrentLargeAd.CtaText, FallbackValue='솔루션 살펴보기'}"
|
||||
FontSize="12"
|
||||
FontWeight="SemiBold"
|
||||
VerticalAlignment="Center"
|
||||
TextTrimming="CharacterEllipsis"/>
|
||||
<ui:SymbolIcon Symbol="ArrowRight24"
|
||||
FontSize="12"
|
||||
Margin="6,0,0,0"
|
||||
VerticalAlignment="Center"/>
|
||||
</StackPanel>
|
||||
</Button>
|
||||
</Border>
|
||||
<TextBlock Text="{Binding CurrentLargeAd.Title, FallbackValue='비즈니스 미디어 솔루션'}"
|
||||
Style="{StaticResource FsSectionHeaderStyle}"
|
||||
MaxWidth="180"
|
||||
TextTrimming="CharacterEllipsis"
|
||||
VerticalAlignment="Center"/>
|
||||
</StackPanel>
|
||||
<TextBlock Text="{Binding CurrentLargeAd.Description, FallbackValue='고성능 무손실 일괄 변환을 업무 환경에 적용하세요.'}"
|
||||
Style="{StaticResource FsCaptionStyle}"
|
||||
Margin="0,4,0,0"
|
||||
TextWrapping="Wrap"/>
|
||||
</StackPanel>
|
||||
</Border>
|
||||
|
||||
<Button Grid.Column="2" Grid.Row="0"
|
||||
VerticalAlignment="Top"
|
||||
Style="{StaticResource FsIconButtonStyle}"
|
||||
Command="{Binding DismissLargeCardCommand}"
|
||||
ToolTip="광고 닫기" AutomationProperties.Name="광고 닫기">
|
||||
<ui:SymbolIcon Symbol="Dismiss24" FontSize="12" VerticalAlignment="Center"/>
|
||||
</Button>
|
||||
|
||||
<Button Grid.Column="1" Grid.ColumnSpan="2" Grid.Row="1"
|
||||
Margin="0,12,0,0"
|
||||
HorizontalAlignment="Left"
|
||||
Style="{StaticResource FsSecondaryButtonStyle}"
|
||||
FontSize="12"
|
||||
Command="{Binding ClickLargeAdCommand}"
|
||||
ToolTip="자세히 보기">
|
||||
<StackPanel Orientation="Horizontal" VerticalAlignment="Center">
|
||||
<TextBlock Text="{Binding CurrentLargeAd.CtaText, FallbackValue='솔루션 살펴보기'}"
|
||||
VerticalAlignment="Center"
|
||||
TextTrimming="CharacterEllipsis"/>
|
||||
<ui:SymbolIcon Symbol="Open24"
|
||||
FontSize="14"
|
||||
Margin="4,0,0,0"
|
||||
VerticalAlignment="Center"/>
|
||||
</StackPanel>
|
||||
</Button>
|
||||
</Grid>
|
||||
</Border>
|
||||
</UserControl>
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
Width="680" Height="580"
|
||||
MinWidth="560" MinHeight="480"
|
||||
ExtendsContentIntoTitleBar="True"
|
||||
WindowBackdropType="None"
|
||||
WindowBackdropType="Mica"
|
||||
WindowCornerPreference="Round"
|
||||
WindowStartupLocation="CenterOwner">
|
||||
<Window.Resources>
|
||||
|
|
@ -18,7 +18,7 @@
|
|||
</ResourceDictionary>
|
||||
</Window.Resources>
|
||||
|
||||
<Grid Background="{StaticResource FsBgBase}">
|
||||
<Grid Background="{DynamicResource FsBgBase}">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="*"/>
|
||||
|
|
@ -28,20 +28,20 @@
|
|||
<ScrollViewer Grid.Row="1" Margin="24,8,24,16" VerticalScrollBarVisibility="Auto">
|
||||
<StackPanel x:Name="ItemsPanel"/>
|
||||
</ScrollViewer>
|
||||
<Border Grid.Row="2" Padding="24,14"
|
||||
Background="{StaticResource FsBgPanel}"
|
||||
<Border Grid.Row="2" Padding="24,16"
|
||||
Background="{DynamicResource FsBgLayer}"
|
||||
BorderThickness="0,1,0,0"
|
||||
BorderBrush="{StaticResource FsBorderSubtle}">
|
||||
BorderBrush="{DynamicResource FsBorderSubtle}">
|
||||
<StackPanel Orientation="Horizontal" HorizontalAlignment="Right" VerticalAlignment="Center">
|
||||
<Button Style="{StaticResource FsSecondaryButtonStyle}"
|
||||
Click="OnRefreshClick" Margin="0,0,8,0" Padding="14,6">
|
||||
Click="OnRefreshClick" Margin="0,0,8,0" Padding="12,0">
|
||||
<StackPanel Orientation="Horizontal" VerticalAlignment="Center">
|
||||
<ui:SymbolIcon Symbol="ArrowClockwise24" FontSize="13" VerticalAlignment="Center" Margin="0,0,6,0"/>
|
||||
<ui:SymbolIcon Symbol="ArrowClockwise24" FontSize="16" VerticalAlignment="Center" Margin="0,0,8,0"/>
|
||||
<TextBlock Text="새로고침" VerticalAlignment="Center"/>
|
||||
</StackPanel>
|
||||
</Button>
|
||||
<Button Content="닫기" Style="{StaticResource FsPrimaryButtonStyle}"
|
||||
Click="OnCloseClick" Padding="18,6"/>
|
||||
<Button Content="닫기" Style="{StaticResource FsAccentButtonStyle}"
|
||||
Click="OnCloseClick" Padding="24,0"/>
|
||||
</StackPanel>
|
||||
</Border>
|
||||
</Grid>
|
||||
|
|
|
|||
|
|
@ -36,60 +36,39 @@ public partial class DiagnoseWindow : FluentWindow
|
|||
}
|
||||
}
|
||||
|
||||
private Brush SafeBrush(string key, Brush fallback)
|
||||
// 진단 카드는 코드로 만들지만 시각 문법은 FormatShiftTheme 스타일과 팔레트 토큰을 그대로 따른다.
|
||||
// 색은 SetResourceReference 로 걸어 두어 시스템 테마가 바뀌면 함께 바뀐다.
|
||||
private Border NewCard() => new()
|
||||
{
|
||||
return (TryFindResource(key) as Brush)
|
||||
?? (Application.Current?.TryFindResource(key) as Brush)
|
||||
?? fallback;
|
||||
Style = TryFindResource("FsCardStyle") as Style,
|
||||
Margin = new Thickness(0, 0, 0, 8),
|
||||
};
|
||||
|
||||
private TextBlock NewText(string text, string styleKey, string? foregroundKey = null)
|
||||
{
|
||||
var tb = new TextBlock { Text = text, Style = TryFindResource(styleKey) as Style };
|
||||
if (foregroundKey != null) tb.SetResourceReference(TextBlock.ForegroundProperty, foregroundKey);
|
||||
return tb;
|
||||
}
|
||||
|
||||
private UIElement BuildSection(string title, IEnumerable<(string Key, string Value)> items)
|
||||
{
|
||||
var card = new Border
|
||||
{
|
||||
Background = SafeBrush("FsBgSurface", new SolidColorBrush(Color.FromRgb(0x1B, 0x1D, 0x22))),
|
||||
BorderBrush = SafeBrush("FsBorderHairline", new SolidColorBrush(Color.FromRgb(0x33, 0x38, 0x42))),
|
||||
BorderThickness = new Thickness(1),
|
||||
CornerRadius = new CornerRadius(10),
|
||||
Padding = new Thickness(16, 14, 16, 14),
|
||||
Margin = new Thickness(0, 0, 0, 12),
|
||||
};
|
||||
|
||||
var card = NewCard();
|
||||
var stack = new StackPanel();
|
||||
stack.Children.Add(new TextBlock
|
||||
{
|
||||
Text = title,
|
||||
FontFamily = (FontFamily?)TryFindResource("FsFontSans"),
|
||||
FontSize = 13,
|
||||
FontWeight = FontWeights.SemiBold,
|
||||
Foreground = SafeBrush("FsTextPrimary", Brushes.White),
|
||||
Margin = new Thickness(0, 0, 0, 10),
|
||||
});
|
||||
var header = NewText(title, "FsSectionHeaderStyle");
|
||||
header.Margin = new Thickness(0, 0, 0, 8);
|
||||
stack.Children.Add(header);
|
||||
|
||||
foreach (var (k, v) in items)
|
||||
{
|
||||
var row = new Grid { Margin = new Thickness(0, 3, 0, 3) };
|
||||
row.ColumnDefinitions.Add(new ColumnDefinition { Width = new GridLength(90) });
|
||||
var row = new Grid { Margin = new Thickness(0, 2, 0, 2) };
|
||||
row.ColumnDefinitions.Add(new ColumnDefinition { Width = new GridLength(96) });
|
||||
row.ColumnDefinitions.Add(new ColumnDefinition { Width = new GridLength(1, GridUnitType.Star) });
|
||||
|
||||
var keyText = new TextBlock
|
||||
{
|
||||
Text = k,
|
||||
FontFamily = (FontFamily?)TryFindResource("FsFontSans"),
|
||||
FontSize = 12,
|
||||
Foreground = SafeBrush("FsTextSecondary", new SolidColorBrush(Color.FromRgb(0x9B, 0xA1, 0xAB))),
|
||||
VerticalAlignment = VerticalAlignment.Center,
|
||||
};
|
||||
|
||||
var valueText = new TextBlock
|
||||
{
|
||||
Text = v,
|
||||
FontFamily = (FontFamily?)TryFindResource("FsFontMono"),
|
||||
FontSize = 12,
|
||||
Foreground = SafeBrush("FsTextPrimary", Brushes.White),
|
||||
VerticalAlignment = VerticalAlignment.Center,
|
||||
TextTrimming = TextTrimming.CharacterEllipsis,
|
||||
};
|
||||
var keyText = NewText(k, "FsCaptionStyle");
|
||||
var valueText = NewText(v, "FsMonoStyle", "FsTextPrimary");
|
||||
valueText.TextTrimming = TextTrimming.CharacterEllipsis;
|
||||
valueText.ToolTip = v;
|
||||
|
||||
Grid.SetColumn(valueText, 1);
|
||||
row.Children.Add(keyText);
|
||||
|
|
@ -103,154 +82,65 @@ public partial class DiagnoseWindow : FluentWindow
|
|||
|
||||
private UIElement BuildProviderCard(IConverterProvider provider, ProviderAvailability availability)
|
||||
{
|
||||
var card = new Border
|
||||
{
|
||||
Background = SafeBrush("FsBgSurface", new SolidColorBrush(Color.FromRgb(0x1B, 0x1D, 0x22))),
|
||||
BorderBrush = SafeBrush("FsBorderHairline", new SolidColorBrush(Color.FromRgb(0x33, 0x38, 0x42))),
|
||||
BorderThickness = new Thickness(1),
|
||||
CornerRadius = new CornerRadius(10),
|
||||
Padding = new Thickness(16, 14, 16, 14),
|
||||
Margin = new Thickness(0, 0, 0, 12),
|
||||
};
|
||||
|
||||
var card = NewCard();
|
||||
var stack = new StackPanel();
|
||||
|
||||
// 1. 헤더 (공급자 명칭 + 상태 뱃지 우측 정렬)
|
||||
var headerGrid = new Grid { Margin = new Thickness(0, 0, 0, 10) };
|
||||
// 1. 머리: 공급자 이름 + 상태 (상태색 배경 위 상태색 글자 — 두 테마 모두 대비 보장)
|
||||
var headerGrid = new Grid { Margin = new Thickness(0, 0, 0, 8) };
|
||||
headerGrid.ColumnDefinitions.Add(new ColumnDefinition { Width = new GridLength(1, GridUnitType.Star) });
|
||||
headerGrid.ColumnDefinitions.Add(new ColumnDefinition { Width = GridLength.Auto });
|
||||
|
||||
var titleText = new TextBlock
|
||||
var titleText = NewText(provider.Capability.DisplayName, "FsSectionHeaderStyle");
|
||||
titleText.VerticalAlignment = VerticalAlignment.Center;
|
||||
|
||||
var (badgeText, textKey, bgKey) = (provider.Capability.Status, availability.IsReady) switch
|
||||
{
|
||||
Text = provider.Capability.DisplayName,
|
||||
FontFamily = (FontFamily?)TryFindResource("FsFontSans"),
|
||||
FontSize = 13,
|
||||
FontWeight = FontWeights.SemiBold,
|
||||
Foreground = SafeBrush("FsTextPrimary", Brushes.White),
|
||||
VerticalAlignment = VerticalAlignment.Center,
|
||||
};
|
||||
|
||||
var (badgeText, badgeBgKey) = (provider.Capability.Status, availability.IsReady) switch
|
||||
{
|
||||
(ProviderStatus.ComingSoon, _) => ("개발 중", "FsTextTertiary"),
|
||||
(ProviderStatus.Disabled, _) => ("비활성", "FsTextTertiary"),
|
||||
(_, true) => ("준비됨", "FsAccentGreen"),
|
||||
_ => ("점검 필요", "FsAccentAmber"),
|
||||
(ProviderStatus.ComingSoon, _) => ("개발 중", "FsTextSecondary", "FsBgControl"),
|
||||
(ProviderStatus.Disabled, _) => ("비활성", "FsTextSecondary", "FsBgControl"),
|
||||
(_, true) => ("준비됨", "FsStatusSuccessText", "FsStatusSuccessBg"),
|
||||
_ => ("점검 필요", "FsStatusWarnText", "FsStatusWarnBg"),
|
||||
};
|
||||
|
||||
var badgeLabel = NewText(badgeText, "FsCaptionStyle", textKey);
|
||||
badgeLabel.FontWeight = FontWeights.SemiBold;
|
||||
var badge = new Border
|
||||
{
|
||||
Background = SafeBrush(badgeBgKey, new SolidColorBrush(Color.FromRgb(0x10, 0xB9, 0x81))),
|
||||
CornerRadius = new CornerRadius(10),
|
||||
Padding = new Thickness(8, 2, 8, 2),
|
||||
CornerRadius = new CornerRadius(4),
|
||||
Padding = new Thickness(8, 0, 8, 0),
|
||||
VerticalAlignment = VerticalAlignment.Center,
|
||||
Child = new TextBlock
|
||||
{
|
||||
Text = badgeText,
|
||||
FontSize = 11,
|
||||
FontWeight = FontWeights.Medium,
|
||||
Foreground = Brushes.White,
|
||||
VerticalAlignment = VerticalAlignment.Center,
|
||||
HorizontalAlignment = HorizontalAlignment.Center,
|
||||
},
|
||||
Child = badgeLabel,
|
||||
};
|
||||
badge.SetResourceReference(Border.BackgroundProperty, bgKey);
|
||||
|
||||
Grid.SetColumn(badge, 1);
|
||||
headerGrid.Children.Add(titleText);
|
||||
headerGrid.Children.Add(badge);
|
||||
stack.Children.Add(headerGrid);
|
||||
|
||||
// 2. 미세 구분선
|
||||
stack.Children.Add(new Border
|
||||
{
|
||||
Height = 1,
|
||||
Background = SafeBrush("FsBorderSubtle", new SolidColorBrush(Color.FromRgb(0x24, 0x27, 0x30))),
|
||||
Margin = new Thickness(0, 0, 0, 8),
|
||||
});
|
||||
|
||||
// 3. 정형화된 입력/출력 격자 (Grid 컬럼 분리 정렬)
|
||||
// 2. 입력/출력 형식
|
||||
var extGrid = new Grid();
|
||||
extGrid.ColumnDefinitions.Add(new ColumnDefinition { Width = new GridLength(70) });
|
||||
extGrid.ColumnDefinitions.Add(new ColumnDefinition { Width = new GridLength(72) });
|
||||
extGrid.ColumnDefinitions.Add(new ColumnDefinition { Width = new GridLength(1, GridUnitType.Star) });
|
||||
|
||||
extGrid.RowDefinitions.Add(new RowDefinition { Height = GridLength.Auto });
|
||||
extGrid.RowDefinitions.Add(new RowDefinition { Height = GridLength.Auto });
|
||||
|
||||
// 입력 형식 행
|
||||
var inputLabel = new TextBlock
|
||||
{
|
||||
Text = "입력 형식",
|
||||
FontFamily = (FontFamily?)TryFindResource("FsFontSans"),
|
||||
FontSize = 11,
|
||||
Foreground = SafeBrush("FsTextSecondary", new SolidColorBrush(Color.FromRgb(0x9B, 0xA1, 0xAB))),
|
||||
VerticalAlignment = VerticalAlignment.Top,
|
||||
Margin = new Thickness(0, 2, 0, 4),
|
||||
};
|
||||
var inputValue = new TextBlock
|
||||
{
|
||||
Text = string.Join(", ", provider.Capability.InputExtensions),
|
||||
FontFamily = (FontFamily?)TryFindResource("FsFontMono"),
|
||||
FontSize = 11,
|
||||
Foreground = SafeBrush("FsTextPrimary", Brushes.White),
|
||||
TextWrapping = TextWrapping.Wrap,
|
||||
LineHeight = 16,
|
||||
VerticalAlignment = VerticalAlignment.Top,
|
||||
Margin = new Thickness(0, 2, 0, 4),
|
||||
};
|
||||
Grid.SetRow(inputLabel, 0); Grid.SetColumn(inputLabel, 0);
|
||||
Grid.SetRow(inputValue, 0); Grid.SetColumn(inputValue, 1);
|
||||
extGrid.Children.Add(inputLabel);
|
||||
extGrid.Children.Add(inputValue);
|
||||
|
||||
// 출력 형식 행
|
||||
var outputLabel = new TextBlock
|
||||
{
|
||||
Text = "출력 형식",
|
||||
FontFamily = (FontFamily?)TryFindResource("FsFontSans"),
|
||||
FontSize = 11,
|
||||
Foreground = SafeBrush("FsTextSecondary", new SolidColorBrush(Color.FromRgb(0x9B, 0xA1, 0xAB))),
|
||||
VerticalAlignment = VerticalAlignment.Top,
|
||||
Margin = new Thickness(0, 2, 0, 4),
|
||||
};
|
||||
var outputValue = new TextBlock
|
||||
{
|
||||
Text = string.Join(", ", provider.Capability.OutputExtensions),
|
||||
FontFamily = (FontFamily?)TryFindResource("FsFontMono"),
|
||||
FontSize = 11,
|
||||
Foreground = SafeBrush("FsAccentBlue", new SolidColorBrush(Color.FromRgb(0x3B, 0x82, 0xF6))),
|
||||
TextWrapping = TextWrapping.Wrap,
|
||||
LineHeight = 16,
|
||||
VerticalAlignment = VerticalAlignment.Top,
|
||||
Margin = new Thickness(0, 2, 0, 4),
|
||||
};
|
||||
Grid.SetRow(outputLabel, 1); Grid.SetColumn(outputLabel, 0);
|
||||
Grid.SetRow(outputValue, 1); Grid.SetColumn(outputValue, 1);
|
||||
extGrid.Children.Add(outputLabel);
|
||||
extGrid.Children.Add(outputValue);
|
||||
|
||||
AddExtRow(extGrid, 0, "입력 형식", string.Join(", ", provider.Capability.InputExtensions), "FsTextPrimary");
|
||||
AddExtRow(extGrid, 1, "출력 형식", string.Join(", ", provider.Capability.OutputExtensions), "FsAccentText");
|
||||
stack.Children.Add(extGrid);
|
||||
|
||||
// 4. 상태 안내 사유 (미비 시 경고 박스)
|
||||
// 3. 준비되지 않은 이유
|
||||
if (!availability.IsReady && !string.IsNullOrEmpty(availability.Reason))
|
||||
{
|
||||
var reason = NewText(availability.Reason, "FsCaptionStyle", "FsStatusWarnText");
|
||||
reason.TextWrapping = TextWrapping.Wrap;
|
||||
var warnBox = new Border
|
||||
{
|
||||
Background = new SolidColorBrush(Color.FromArgb(0x1F, 0xF5, 0x9E, 0x0B)),
|
||||
BorderBrush = SafeBrush("FsAccentAmber", new SolidColorBrush(Color.FromRgb(0xF5, 0x9E, 0x0B))),
|
||||
BorderThickness = new Thickness(1),
|
||||
CornerRadius = new CornerRadius(6),
|
||||
Padding = new Thickness(10, 6, 10, 6),
|
||||
CornerRadius = new CornerRadius(4),
|
||||
Padding = new Thickness(12, 8, 12, 8),
|
||||
Margin = new Thickness(0, 8, 0, 0),
|
||||
Child = new TextBlock
|
||||
{
|
||||
Text = availability.Reason,
|
||||
FontFamily = (FontFamily?)TryFindResource("FsFontSans"),
|
||||
FontSize = 11,
|
||||
Foreground = SafeBrush("FsAccentAmber", new SolidColorBrush(Color.FromRgb(0xF5, 0x9E, 0x0B))),
|
||||
TextWrapping = TextWrapping.Wrap,
|
||||
VerticalAlignment = VerticalAlignment.Center,
|
||||
},
|
||||
Child = reason,
|
||||
};
|
||||
warnBox.SetResourceReference(Border.BackgroundProperty, "FsStatusWarnBg");
|
||||
stack.Children.Add(warnBox);
|
||||
}
|
||||
|
||||
|
|
@ -258,7 +148,20 @@ public partial class DiagnoseWindow : FluentWindow
|
|||
return card;
|
||||
}
|
||||
|
||||
private void AddExtRow(Grid grid, int row, string label, string value, string valueBrushKey)
|
||||
{
|
||||
var labelText = NewText(label, "FsCaptionStyle");
|
||||
labelText.Margin = new Thickness(0, 2, 0, 4);
|
||||
var valueText = NewText(value, "FsMonoStyle", valueBrushKey);
|
||||
valueText.TextWrapping = TextWrapping.Wrap;
|
||||
valueText.LineHeight = 16;
|
||||
valueText.Margin = new Thickness(0, 2, 0, 4);
|
||||
Grid.SetRow(labelText, row);
|
||||
Grid.SetRow(valueText, row); Grid.SetColumn(valueText, 1);
|
||||
grid.Children.Add(labelText);
|
||||
grid.Children.Add(valueText);
|
||||
}
|
||||
|
||||
private async void OnRefreshClick(object sender, RoutedEventArgs e) => await PopulateAsync();
|
||||
private void OnCloseClick(object sender, RoutedEventArgs e) => Close();
|
||||
}
|
||||
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
|
|
@ -257,8 +257,9 @@ public partial class MainWindow : Wpf.Ui.Controls.FluentWindow, INotifyPropertyC
|
|||
|
||||
private void OnSettingsClick(object sender, RoutedEventArgs e)
|
||||
{
|
||||
var win = new SettingsWindow(_settings) { Owner = this };
|
||||
var win = new SettingsWindow(_settings, AdVm.AdService) { Owner = this };
|
||||
win.ShowDialog();
|
||||
AdVm.RefreshAds();
|
||||
_ = RefreshCapabilityStatusAsync();
|
||||
RefreshAvailableOutputFormats();
|
||||
}
|
||||
|
|
@ -792,8 +793,7 @@ public partial class MainWindow : Wpf.Ui.Controls.FluentWindow, INotifyPropertyC
|
|||
{
|
||||
SmartPresetChipsPanel.Children.Clear();
|
||||
var chipStyle = TryFindResource("FsSpecChipStyle") as Style;
|
||||
var monoFont = TryFindResource("FsFontMono") as FontFamily;
|
||||
var cyanBrush = TryFindResource("FsAccentCyan") as Brush ?? Brushes.Cyan;
|
||||
var chipTextStyle = TryFindResource("FsNumStyle") as Style;
|
||||
|
||||
foreach (var chip in preset.SpecChips)
|
||||
{
|
||||
|
|
@ -804,22 +804,18 @@ public partial class MainWindow : Wpf.Ui.Controls.FluentWindow, INotifyPropertyC
|
|||
}
|
||||
else
|
||||
{
|
||||
border.CornerRadius = new CornerRadius(6);
|
||||
border.Padding = new Thickness(8, 3, 8, 3);
|
||||
border.Margin = new Thickness(0, 0, 6, 6);
|
||||
border.CornerRadius = new CornerRadius(4);
|
||||
border.Padding = new Thickness(8, 2, 8, 2);
|
||||
border.Margin = new Thickness(0, 0, 4, 4);
|
||||
}
|
||||
|
||||
var tb = new TextBlock
|
||||
{
|
||||
Text = chip,
|
||||
FontSize = 11,
|
||||
Foreground = cyanBrush,
|
||||
Style = chipTextStyle,
|
||||
VerticalAlignment = VerticalAlignment.Center,
|
||||
};
|
||||
if (monoFont is not null)
|
||||
{
|
||||
tb.FontFamily = monoFont;
|
||||
}
|
||||
tb.SetResourceReference(TextBlock.ForegroundProperty, "FsTextPrimary");
|
||||
|
||||
border.Child = tb;
|
||||
SmartPresetChipsPanel.Children.Add(border);
|
||||
|
|
@ -1466,10 +1462,10 @@ public partial class MainWindow : Wpf.Ui.Controls.FluentWindow, INotifyPropertyC
|
|||
if (OutputFormatHint is not null)
|
||||
{
|
||||
OutputFormatHint.Text = _activeQueue.Count == 0
|
||||
? "큐에 파일을 추가하면 변환 가능한 형식으로 자동 필터링됩니다"
|
||||
? "파일을 추가하면 변환할 수 있는 형식만 남깁니다"
|
||||
: hasCommonFormats
|
||||
? $"큐의 모든 파일이 변환 가능한 형식 ({visible.Count}개)"
|
||||
: "선택된 파일들의 공통 변환 형식이 없습니다 (서로 다른 미디어)";
|
||||
? $"대기열의 모든 파일을 변환할 수 있는 형식 {visible.Count}개"
|
||||
: "서로 다른 종류가 섞여 공통 형식이 없습니다";
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -1489,11 +1485,11 @@ public partial class MainWindow : Wpf.Ui.Controls.FluentWindow, INotifyPropertyC
|
|||
|
||||
CombineHint.Text = (combinableOutput, _activeQueue.Count) switch
|
||||
{
|
||||
(false, _) => "PDF/TIFF/GIF 출력일 때만 단일 파일 결합이 가능합니다",
|
||||
(true, 0) => "PDF/TIFF/GIF 출력에 한해 큐의 이미지들을 한 파일로 결합합니다",
|
||||
(true, 1) => "결합하려면 큐에 2개 이상의 이미지가 필요합니다",
|
||||
(true, _) when !allInputsCombinable => "결합은 이미지 입력만 지원합니다 (PDF/DOCX 등 제외)",
|
||||
_ => $"체크 시 큐의 {_activeQueue.Count}개 이미지를 단일 {ext.TrimStart('.').ToUpperInvariant()}로 결합",
|
||||
(false, _) => "PDF·TIFF·GIF로 내보낼 때만 합칠 수 있습니다",
|
||||
(true, 0) => "대기열의 이미지를 한 파일로 합칩니다",
|
||||
(true, 1) => "합치려면 이미지가 2개 이상 필요합니다",
|
||||
(true, _) when !allInputsCombinable => "이미지만 합칠 수 있습니다 (PDF·DOCX 제외)",
|
||||
_ => $"이미지 {_activeQueue.Count}개를 {ext.TrimStart('.').ToUpperInvariant()} 하나로 합칩니다",
|
||||
};
|
||||
}
|
||||
|
||||
|
|
@ -1520,14 +1516,13 @@ public partial class MainWindow : Wpf.Ui.Controls.FluentWindow, INotifyPropertyC
|
|||
if (info is null)
|
||||
{
|
||||
OutputFormatBadgeText.Text = "—";
|
||||
OutputFormatBadge.Background = System.Windows.Media.Brushes.Gray;
|
||||
OutputFormatBadge.SetResourceReference(Border.BorderBrushProperty, "FsBorderControl");
|
||||
return;
|
||||
}
|
||||
|
||||
// 형식 색은 외곽선으로만 쓴다 — 글자는 테마 본문색이라 어떤 형식 색에서도 대비가 유지된다
|
||||
OutputFormatBadgeText.Text = info.BadgeText;
|
||||
var resource = TryFindResource(info.ColorResource);
|
||||
if (resource is System.Windows.Media.Brush brush)
|
||||
OutputFormatBadge.Background = brush;
|
||||
OutputFormatBadge.SetResourceReference(Border.BorderBrushProperty, info.ColorResource);
|
||||
}
|
||||
|
||||
private void UpdateQualityPanelForFormat(string? extension)
|
||||
|
|
@ -1663,8 +1658,8 @@ public sealed class QueueItem : INotifyPropertyChanged
|
|||
public Brush StateBrush => _state switch
|
||||
{
|
||||
"queued" => (Application.Current?.TryFindResource("FsTextTertiary") as Brush) ?? Brushes.Gray,
|
||||
"done" => (Application.Current?.TryFindResource("FsAccentGreen") as Brush) ?? Brushes.LightGreen,
|
||||
_ => (Application.Current?.TryFindResource("FsAccentBlue") as Brush) ?? Brushes.DodgerBlue,
|
||||
"done" => (Application.Current?.TryFindResource("FsStatusSuccessText") as Brush) ?? Brushes.LightGreen,
|
||||
_ => (Application.Current?.TryFindResource("FsAccentText") as Brush) ?? Brushes.DodgerBlue,
|
||||
};
|
||||
|
||||
public double ProgressValue
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
Width="380" SizeToContent="Height"
|
||||
ResizeMode="NoResize"
|
||||
ExtendsContentIntoTitleBar="True"
|
||||
WindowBackdropType="None"
|
||||
WindowBackdropType="Mica"
|
||||
WindowCornerPreference="Round"
|
||||
WindowStartupLocation="CenterScreen"
|
||||
UseLayoutRounding="True">
|
||||
|
|
@ -19,7 +19,7 @@
|
|||
</ResourceDictionary>
|
||||
</Window.Resources>
|
||||
|
||||
<Grid Background="{StaticResource FsBgBase}">
|
||||
<Grid Background="{DynamicResource FsBgBase}">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="*"/>
|
||||
|
|
@ -27,34 +27,32 @@
|
|||
|
||||
<ui:TitleBar Grid.Row="0" Title="" ShowMaximize="False" ShowMinimize="False"/>
|
||||
|
||||
<StackPanel Grid.Row="1" Margin="24,4,24,20">
|
||||
<TextBlock x:Name="HeaderText" FontSize="16" FontWeight="SemiBold"
|
||||
Foreground="{StaticResource FsTextPrimary}"
|
||||
FontFamily="{StaticResource FsFontSans}" Text="변환"/>
|
||||
<StackPanel Grid.Row="1" Margin="24,0,24,24">
|
||||
<TextBlock x:Name="HeaderText" Style="{StaticResource FsSubtitleStyle}" Text="변환"/>
|
||||
<TextBlock Margin="0,4,0,0" Style="{StaticResource FsCaptionStyle}"
|
||||
Text="필요한 옵션만 빠르게 고르고 변환하세요."/>
|
||||
|
||||
<!-- 이미지 품질 (jpg/webp/avif) -->
|
||||
<StackPanel x:Name="ImageQualityPanel" Margin="0,18,0,0" Visibility="Collapsed">
|
||||
<StackPanel x:Name="ImageQualityPanel" Margin="0,16,0,0" Visibility="Collapsed">
|
||||
<Grid>
|
||||
<Grid.ColumnDefinitions><ColumnDefinition Width="*"/><ColumnDefinition Width="Auto"/></Grid.ColumnDefinitions>
|
||||
<TextBlock Text="품질" Style="{StaticResource FsCaptionStyle}"/>
|
||||
<TextBlock Grid.Column="1" FontFamily="{StaticResource FsFontMono}" FontSize="12"
|
||||
Foreground="{StaticResource FsAccentBlue}"
|
||||
<TextBlock Grid.Column="1" Style="{StaticResource FsNumStyle}" FontSize="14" FontWeight="SemiBold"
|
||||
Foreground="{DynamicResource FsTextPrimary}"
|
||||
Text="{Binding Quality, StringFormat={}{0}%}"/>
|
||||
</Grid>
|
||||
<Slider Minimum="1" Maximum="100" Margin="0,4,0,0" Value="{Binding Quality, Mode=TwoWay}"/>
|
||||
<Slider Minimum="1" Maximum="100" Margin="0,8,0,0" Style="{StaticResource FsSliderStyle}" AutomationProperties.Name="품질" Value="{Binding Quality, Mode=TwoWay}"/>
|
||||
</StackPanel>
|
||||
|
||||
<!-- 영상 (간단) -->
|
||||
<StackPanel x:Name="VideoQuickPanel" Margin="0,18,0,0" Visibility="Collapsed">
|
||||
<StackPanel x:Name="VideoQuickPanel" Margin="0,16,0,0" Visibility="Collapsed">
|
||||
<Grid>
|
||||
<Grid.ColumnDefinitions><ColumnDefinition Width="*"/><ColumnDefinition Width="Auto"/></Grid.ColumnDefinitions>
|
||||
<TextBlock Text="품질 (CRF) — 낮을수록 고화질" Style="{StaticResource FsCaptionStyle}"/>
|
||||
<TextBlock Grid.Column="1" FontFamily="{StaticResource FsFontMono}" FontSize="12"
|
||||
Foreground="{StaticResource FsAccentBlue}" Text="{Binding Crf}"/>
|
||||
<TextBlock Grid.Column="1" Style="{StaticResource FsNumStyle}" FontSize="14" FontWeight="SemiBold"
|
||||
Foreground="{DynamicResource FsTextPrimary}" Text="{Binding Crf}"/>
|
||||
</Grid>
|
||||
<Slider Minimum="0" Maximum="51" Margin="0,4,0,0" Value="{Binding Crf, Mode=TwoWay}"/>
|
||||
<Slider Minimum="0" Maximum="51" Margin="0,8,0,0" Style="{StaticResource FsSliderStyle}" AutomationProperties.Name="영상 화질" Value="{Binding Crf, Mode=TwoWay}"/>
|
||||
|
||||
<TextBlock Text="해상도" Style="{StaticResource FsCaptionStyle}" Margin="0,12,0,4"/>
|
||||
<ComboBox SelectedIndex="{Binding ResolutionIndex, Mode=TwoWay}">
|
||||
|
|
@ -62,11 +60,13 @@
|
|||
<ComboBoxItem Content="1080p"/><ComboBoxItem Content="720p"/><ComboBoxItem Content="480p"/>
|
||||
</ComboBox>
|
||||
|
||||
<CheckBox Margin="0,12,0,0" Content="GPU 하드웨어 가속" IsChecked="{Binding VideoPreferGpu, Mode=TwoWay}"/>
|
||||
<CheckBox Margin="0,12,0,0" IsChecked="{Binding VideoPreferGpu, Mode=TwoWay}">
|
||||
<TextBlock Text="GPU 하드웨어 가속" TextWrapping="Wrap" VerticalAlignment="Center"/>
|
||||
</CheckBox>
|
||||
</StackPanel>
|
||||
|
||||
<!-- 오디오 (간단) -->
|
||||
<StackPanel x:Name="AudioQuickPanel" Margin="0,18,0,0" Visibility="Collapsed">
|
||||
<StackPanel x:Name="AudioQuickPanel" Margin="0,16,0,0" Visibility="Collapsed">
|
||||
<TextBlock x:Name="AudioPanelLabel" Text="오디오 비트레이트" Style="{StaticResource FsCaptionStyle}" Margin="0,0,0,4"/>
|
||||
<ComboBox SelectedIndex="{Binding AudioBitrateIndex, Mode=TwoWay}">
|
||||
<ComboBoxItem Content="96 kbps"/><ComboBoxItem Content="128 kbps"/><ComboBoxItem Content="192 kbps"/>
|
||||
|
|
@ -75,21 +75,21 @@
|
|||
</StackPanel>
|
||||
|
||||
<!-- AI 텍스트 처리 (txt/md) -->
|
||||
<StackPanel x:Name="AiQuickPanel" Margin="0,18,0,0" Visibility="Collapsed">
|
||||
<StackPanel x:Name="AiQuickPanel" Margin="0,16,0,0" Visibility="Collapsed">
|
||||
<TextBlock Text="AI 작업 선택" Style="{StaticResource FsCaptionStyle}" Margin="0,0,0,4"/>
|
||||
<ComboBox SelectedIndex="{Binding AiTaskIndex, Mode=TwoWay}">
|
||||
<ComboBoxItem Content="핵심 요약 (Summarize)"/>
|
||||
<ComboBoxItem Content="자연스러운 번역 (Translate)"/>
|
||||
<ComboBoxItem Content="오탈자 및 문법 교정 (Proofread)"/>
|
||||
<ComboBoxItem Content="핵심 요약"/>
|
||||
<ComboBoxItem Content="자연스러운 번역"/>
|
||||
<ComboBoxItem Content="오탈자 및 문법 교정"/>
|
||||
</ComboBox>
|
||||
<TextBox Margin="0,8,0,0" Style="{StaticResource FsPathInputStyle}"
|
||||
Padding="10,6"
|
||||
AutomationProperties.Name="번역 대상 언어"
|
||||
Text="{Binding TargetLanguage, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
|
||||
ToolTip="번역 시 대상 언어 (예: 영어, 일본어, 중국어)"/>
|
||||
</StackPanel>
|
||||
|
||||
<!-- 버튼 -->
|
||||
<Grid Margin="0,22,0,0">
|
||||
<Grid Margin="0,24,0,0">
|
||||
<Button HorizontalAlignment="Left" Content="자세히 옵션…"
|
||||
Style="{StaticResource FsSecondaryButtonStyle}"
|
||||
Click="OnMoreClick"/>
|
||||
|
|
@ -97,8 +97,8 @@
|
|||
<Button Content="취소" Margin="0,0,8,0"
|
||||
Style="{StaticResource FsSecondaryButtonStyle}"
|
||||
Click="OnCancelClick"/>
|
||||
<Button Content="변환" Padding="20,6"
|
||||
Style="{StaticResource FsPrimaryButtonStyle}"
|
||||
<Button Content="변환" Padding="24,0"
|
||||
Style="{StaticResource FsAccentButtonStyle}"
|
||||
Click="OnConvertClick"/>
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@
|
|||
<RowDefinition Height="*"/>
|
||||
</Grid.RowDefinitions>
|
||||
<ui:TitleBar Grid.Row="0" x:Name="WindowTitleBar" Title="빠른 변환" ShowMaximize="False" ShowMinimize="False"/>
|
||||
<Grid Grid.Row="1" Margin="32,12,32,24">
|
||||
<Grid Grid.Row="1" Margin="24,8,24,24">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="Auto"/>
|
||||
|
|
@ -39,18 +39,18 @@
|
|||
</Grid.ColumnDefinitions>
|
||||
<TextBlock Text="변환 중…" Style="{StaticResource TextSubtitle}"/>
|
||||
<TextBlock x:Name="PercentText" Grid.Column="1" Text="0%"
|
||||
Style="{StaticResource TextSubtitle}" VerticalAlignment="Center"/>
|
||||
Style="{StaticResource TextSubtitle}" Typography.NumeralAlignment="Tabular" VerticalAlignment="Center"/>
|
||||
</Grid>
|
||||
<TextBlock x:Name="StatusText" Grid.Row="1" Margin="0,4,0,12"
|
||||
<TextBlock x:Name="StatusText" Grid.Row="1" Margin="0,4,0,16"
|
||||
Style="{StaticResource TextCaption}" TextTrimming="CharacterEllipsis"/>
|
||||
<ProgressBar x:Name="OverallProgress" Grid.Row="2" Height="6"
|
||||
<ProgressBar x:Name="OverallProgress" Grid.Row="2" Height="4"
|
||||
Minimum="0" Maximum="1"/>
|
||||
<Image x:Name="DoneIllustration" Grid.Row="3" Visibility="Collapsed"
|
||||
Width="96" Height="96" Margin="0,8,0,0"
|
||||
HorizontalAlignment="Center" VerticalAlignment="Center"
|
||||
RenderOptions.BitmapScalingMode="HighQuality"
|
||||
Source="pack://application:,,,/Assets/illus-done.png"/>
|
||||
<Grid Grid.Row="4" Margin="0,12,0,0">
|
||||
<Grid Grid.Row="4" Margin="0,16,0,0">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
<ColumnDefinition Width="*"/>
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@
|
|||
</ResourceDictionary>
|
||||
</Window.Resources>
|
||||
|
||||
<Grid Background="{StaticResource FsBgBase}">
|
||||
<Grid Background="{DynamicResource FsBgBase}">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="*"/>
|
||||
|
|
@ -30,10 +30,9 @@
|
|||
<StackPanel>
|
||||
|
||||
<!-- ===== AI 카드 ===== -->
|
||||
<Border Style="{StaticResource FsDoubleBezelShellStyle}" Margin="0,0,0,16">
|
||||
<Border Style="{StaticResource FsDoubleBezelCoreStyle}" Padding="20">
|
||||
<Border Style="{StaticResource FsCardStyle}" Margin="0,0,0,16">
|
||||
<StackPanel>
|
||||
<TextBlock Text="AI 텍스트 변환" Style="{StaticResource FsBodyStyle}" FontWeight="SemiBold" FontSize="15"/>
|
||||
<TextBlock Text="AI 텍스트 변환" Style="{StaticResource FsSectionHeaderStyle}"/>
|
||||
<TextBlock Text="요약 · 번역 · 교정에 사용됩니다 (종량 과금 · 네트워크 필요). 키가 없으면 AI 변환만 비활성됩니다."
|
||||
Style="{StaticResource FsCaptionStyle}" TextWrapping="Wrap" Margin="0,4,0,16"/>
|
||||
|
||||
|
|
@ -60,14 +59,14 @@
|
|||
TextChanged="OnSwitchboardEndpointChanged"/>
|
||||
<Button x:Name="SwitchboardVerifyBtn" Grid.Column="1" Content="테스트"
|
||||
Style="{StaticResource FsSecondaryButtonStyle}" Margin="8,0,0,0"
|
||||
Padding="12,6" Click="OnVerifySwitchboard"/>
|
||||
Padding="12,0" Click="OnVerifySwitchboard"/>
|
||||
<Button x:Name="SwitchboardStartBtn" Grid.Column="2" Content="게이트웨이 기동"
|
||||
Style="{StaticResource FsSecondaryButtonStyle}" Margin="8,0,0,0"
|
||||
Padding="12,6" Click="OnStartSwitchboardGateway"/>
|
||||
Padding="12,0" Click="OnStartSwitchboardGateway"/>
|
||||
</Grid>
|
||||
<StackPanel Orientation="Horizontal" VerticalAlignment="Center" Margin="0,0,0,16">
|
||||
<Ellipse x:Name="SwitchboardDot" Style="{StaticResource FsLossDotStyle}"
|
||||
Fill="{StaticResource FsTextTertiary}" Margin="0,0,7,0" VerticalAlignment="Center"/>
|
||||
Fill="{DynamicResource FsTextTertiary}" Margin="0,0,8,0" VerticalAlignment="Center"/>
|
||||
<TextBlock x:Name="SwitchboardStatus" Text="확인 중…" Style="{StaticResource FsCaptionStyle}" TextTrimming="CharacterEllipsis" VerticalAlignment="Center"/>
|
||||
</StackPanel>
|
||||
|
||||
|
|
@ -75,10 +74,10 @@
|
|||
<TextBlock Text="Antigravity CLI (agy · Google OAuth · API 키 불필요)" Style="{StaticResource FsLabelStyle}" Margin="0,0,0,6"/>
|
||||
<StackPanel Orientation="Horizontal" VerticalAlignment="Center" Margin="0,0,0,16">
|
||||
<Ellipse x:Name="AgyDot" Style="{StaticResource FsLossDotStyle}"
|
||||
Fill="{StaticResource FsTextTertiary}" Margin="0,0,7,0" VerticalAlignment="Center"/>
|
||||
Fill="{DynamicResource FsTextTertiary}" Margin="0,0,8,0" VerticalAlignment="Center"/>
|
||||
<TextBlock x:Name="AgyStatus" Text="확인 중…" Style="{StaticResource FsCaptionStyle}" VerticalAlignment="Center"/>
|
||||
<Button x:Name="AgyVerifyBtn" Content="테스트" Style="{StaticResource FsSecondaryButtonStyle}"
|
||||
Margin="12,0,0,0" Padding="10,4" IsEnabled="False" Click="OnVerifyAgy" VerticalAlignment="Center"/>
|
||||
Margin="12,0,0,0" Padding="12,0" IsEnabled="False" Click="OnVerifyAgy" VerticalAlignment="Center"/>
|
||||
</StackPanel>
|
||||
|
||||
<!-- OpenAI -->
|
||||
|
|
@ -97,7 +96,7 @@
|
|||
</Grid>
|
||||
<StackPanel Orientation="Horizontal" VerticalAlignment="Center" Margin="0,0,0,16">
|
||||
<Ellipse x:Name="OpenAiDot" Style="{StaticResource FsLossDotStyle}"
|
||||
Fill="{StaticResource FsTextTertiary}" Margin="0,0,7,0" VerticalAlignment="Center"/>
|
||||
Fill="{DynamicResource FsTextTertiary}" Margin="0,0,8,0" VerticalAlignment="Center"/>
|
||||
<TextBlock x:Name="OpenAiStatus" Text="키 미설정" Style="{StaticResource FsCaptionStyle}" VerticalAlignment="Center"/>
|
||||
</StackPanel>
|
||||
|
||||
|
|
@ -117,7 +116,7 @@
|
|||
</Grid>
|
||||
<StackPanel Orientation="Horizontal" VerticalAlignment="Center" Margin="0,0,0,16">
|
||||
<Ellipse x:Name="AnthropicDot" Style="{StaticResource FsLossDotStyle}"
|
||||
Fill="{StaticResource FsTextTertiary}" Margin="0,0,7,0" VerticalAlignment="Center"/>
|
||||
Fill="{DynamicResource FsTextTertiary}" Margin="0,0,8,0" VerticalAlignment="Center"/>
|
||||
<TextBlock x:Name="AnthropicStatus" Text="키 미설정" Style="{StaticResource FsCaptionStyle}" VerticalAlignment="Center"/>
|
||||
</StackPanel>
|
||||
|
||||
|
|
@ -125,10 +124,10 @@
|
|||
<TextBlock Text="Codex CLI (OAuth · API 키 불필요)" Style="{StaticResource FsLabelStyle}" Margin="0,0,0,6"/>
|
||||
<StackPanel Orientation="Horizontal" VerticalAlignment="Center" Margin="0,0,0,16">
|
||||
<Ellipse x:Name="CodexDot" Style="{StaticResource FsLossDotStyle}"
|
||||
Fill="{StaticResource FsTextTertiary}" Margin="0,0,7,0" VerticalAlignment="Center"/>
|
||||
Fill="{DynamicResource FsTextTertiary}" Margin="0,0,8,0" VerticalAlignment="Center"/>
|
||||
<TextBlock x:Name="CodexStatus" Text="확인 중…" Style="{StaticResource FsCaptionStyle}" VerticalAlignment="Center"/>
|
||||
<Button x:Name="CodexVerifyBtn" Content="테스트" Style="{StaticResource FsSecondaryButtonStyle}"
|
||||
Margin="12,0,0,0" Padding="10,4" IsEnabled="False" Click="OnVerifyCodex" VerticalAlignment="Center"/>
|
||||
Margin="12,0,0,0" Padding="12,0" IsEnabled="False" Click="OnVerifyCodex" VerticalAlignment="Center"/>
|
||||
</StackPanel>
|
||||
|
||||
<!-- 모델 -->
|
||||
|
|
@ -137,21 +136,20 @@
|
|||
<TextBlock Text="비워두면 기본 모델 (OpenAI: gpt-4o-mini, Anthropic: claude-3-5-sonnet-latest)"
|
||||
Style="{StaticResource FsCaptionStyle}" Margin="0,6,0,0"/>
|
||||
</StackPanel>
|
||||
</Border>
|
||||
</Border>
|
||||
|
||||
<!-- ===== 외부 도구 카드 ===== -->
|
||||
<Border Style="{StaticResource FsDoubleBezelShellStyle}">
|
||||
<Border Style="{StaticResource FsDoubleBezelCoreStyle}" Padding="20">
|
||||
<Border Style="{StaticResource FsCardStyle}">
|
||||
<StackPanel>
|
||||
<TextBlock Text="외부 도구" Style="{StaticResource FsBodyStyle}" FontWeight="SemiBold" FontSize="15"/>
|
||||
<TextBlock Text="외부 도구" Style="{StaticResource FsSectionHeaderStyle}"/>
|
||||
<TextBlock Text="설치하면 영상/오디오·한글/Word 변환이 자동 활성화됩니다."
|
||||
Style="{StaticResource FsCaptionStyle}" TextWrapping="Wrap" Margin="0,4,0,12"/>
|
||||
<Button Content="외부 도구 설치 / 검증" Style="{StaticResource FsSecondaryButtonStyle}"
|
||||
Padding="14,6" HorizontalAlignment="Right" Margin="0,0,0,12"
|
||||
Padding="12,0" HorizontalAlignment="Right" Margin="0,0,0,12"
|
||||
Click="OnOpenToolInstaller"/>
|
||||
<CheckBox x:Name="GpuToggle" Content="영상 변환 시 GPU 가속(NVENC) 시도 — 없으면 CPU 자동 전환"
|
||||
Foreground="{StaticResource FsTextSecondary}" IsChecked="True" Margin="0,0,0,16"/>
|
||||
<CheckBox x:Name="GpuToggle" IsChecked="True" Margin="0,0,0,16">
|
||||
<TextBlock Text="영상 변환 시 GPU 가속(NVENC) 시도 — 없으면 CPU 자동 전환" TextWrapping="Wrap" VerticalAlignment="Center"/>
|
||||
</CheckBox>
|
||||
|
||||
<!-- FFmpeg -->
|
||||
<Grid Margin="0,0,0,14">
|
||||
|
|
@ -162,15 +160,15 @@
|
|||
<StackPanel Grid.Column="0">
|
||||
<StackPanel Orientation="Horizontal" VerticalAlignment="Center">
|
||||
<Ellipse x:Name="FfmpegDot" Style="{StaticResource FsLossDotStyle}"
|
||||
Fill="{StaticResource FsStatusWarn}" Margin="0,0,7,0" VerticalAlignment="Center"/>
|
||||
Fill="{DynamicResource FsStatusWarn}" Margin="0,0,8,0" VerticalAlignment="Center"/>
|
||||
<TextBlock Text="FFmpeg" Style="{StaticResource FsBodyStyle}" FontWeight="Medium" VerticalAlignment="Center"/>
|
||||
<TextBlock x:Name="FfmpegStatus" Text="미설치" Style="{StaticResource FsCaptionStyle}" Margin="8,0,0,0" VerticalAlignment="Center"/>
|
||||
</StackPanel>
|
||||
<TextBlock Text="영상/오디오 변환 (mp4·webm·mp3·flac…)" Style="{StaticResource FsCaptionStyle}" Margin="15,3,0,0"/>
|
||||
<TextBlock Text="영상/오디오 변환 (mp4·webm·mp3·flac…)" Style="{StaticResource FsCaptionStyle}" Margin="16,4,0,0"/>
|
||||
</StackPanel>
|
||||
<StackPanel Grid.Column="1" Orientation="Horizontal" VerticalAlignment="Center">
|
||||
<Button Content="다운로드" Style="{StaticResource FsSecondaryButtonStyle}" Click="OnDownloadFfmpeg"/>
|
||||
<Button Content="폴더 열기" Style="{StaticResource FsSecondaryButtonStyle}" Margin="6,0,0,0" Click="OnOpenFfmpegFolder"/>
|
||||
<Button Content="다운로드" Style="{StaticResource FsSecondaryButtonStyle}" VerticalAlignment="Center" Click="OnDownloadFfmpeg"/>
|
||||
<Button Content="폴더 열기" Style="{StaticResource FsSecondaryButtonStyle}" Margin="6,0,0,0" VerticalAlignment="Center" Click="OnOpenFfmpegFolder"/>
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
|
||||
|
|
@ -183,29 +181,108 @@
|
|||
<StackPanel Grid.Column="0">
|
||||
<StackPanel Orientation="Horizontal" VerticalAlignment="Center">
|
||||
<Ellipse x:Name="LibreDot" Style="{StaticResource FsLossDotStyle}"
|
||||
Fill="{StaticResource FsStatusWarn}" Margin="0,0,7,0" VerticalAlignment="Center"/>
|
||||
Fill="{DynamicResource FsStatusWarn}" Margin="0,0,8,0" VerticalAlignment="Center"/>
|
||||
<TextBlock Text="LibreOffice" Style="{StaticResource FsBodyStyle}" FontWeight="Medium" VerticalAlignment="Center"/>
|
||||
<TextBlock x:Name="LibreStatus" Text="미설치" Style="{StaticResource FsCaptionStyle}" Margin="8,0,0,0" VerticalAlignment="Center"/>
|
||||
</StackPanel>
|
||||
<TextBlock Text="한글/Word/문서 변환 (HWP·DOCX→PDF/이미지). 한글은 H2Orestart 확장 필요." Style="{StaticResource FsCaptionStyle}" Margin="15,3,0,0" TextWrapping="Wrap"/>
|
||||
<TextBlock Text="한글/Word/문서 변환 (HWP·DOCX→PDF/이미지). 한글은 H2Orestart 확장 필요." Style="{StaticResource FsCaptionStyle}" Margin="16,4,0,0" TextWrapping="Wrap"/>
|
||||
</StackPanel>
|
||||
<StackPanel Grid.Column="1" Orientation="Horizontal" VerticalAlignment="Center">
|
||||
<Button Content="다운로드" Style="{StaticResource FsSecondaryButtonStyle}" Click="OnDownloadLibre"/>
|
||||
<Button Content="다운로드" Style="{StaticResource FsSecondaryButtonStyle}" VerticalAlignment="Center" Click="OnDownloadLibre"/>
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
</StackPanel>
|
||||
</Border>
|
||||
</Border>
|
||||
|
||||
<!-- ===== Google AdMob 카드 ===== -->
|
||||
<Border Style="{StaticResource FsCardStyle}" Margin="0,16,0,0">
|
||||
<StackPanel>
|
||||
<StackPanel Orientation="Horizontal" VerticalAlignment="Center" Margin="0,0,0,4">
|
||||
<ui:SymbolIcon Symbol="Megaphone24" FontSize="16" Foreground="{DynamicResource FsAccentText}" Margin="0,0,8,0" VerticalAlignment="Center"/>
|
||||
<TextBlock Text="Google AdMob 광고 연동" Style="{StaticResource FsSectionHeaderStyle}" VerticalAlignment="Center"/>
|
||||
</StackPanel>
|
||||
<TextBlock Text="공식 Google AdMob 광고 단위와 안전하게 연동합니다. 실서비스 ID가 비어 있거나 테스트 모드가 켜져 있으면 Google 공식 표준 샘플 광고가 표출됩니다."
|
||||
Style="{StaticResource FsCaptionStyle}" TextWrapping="Wrap" Margin="0,0,0,16"/>
|
||||
|
||||
<!-- 상태 인디케이터 -->
|
||||
<StackPanel Orientation="Horizontal" VerticalAlignment="Center" Margin="0,0,0,16">
|
||||
<Ellipse x:Name="AdMobStatusDot" Style="{StaticResource FsLossDotStyle}"
|
||||
Fill="{DynamicResource FsStatusSuccess}" Margin="0,0,8,0" VerticalAlignment="Center"/>
|
||||
<TextBlock x:Name="AdMobStatusText" Text="Google 공식 테스트 광고 모드 활성"
|
||||
Style="{StaticResource FsCaptionStyle}" TextTrimming="CharacterEllipsis" VerticalAlignment="Center"/>
|
||||
</StackPanel>
|
||||
|
||||
<!-- 게시자 ID -->
|
||||
<TextBlock Text="게시자 ID (Publisher ID)" Style="{StaticResource FsLabelStyle}" Margin="0,0,0,6"/>
|
||||
<TextBox x:Name="AdMobPublisherIdBox"
|
||||
Style="{StaticResource FsPathInputStyle}"
|
||||
Margin="0,0,0,12"/>
|
||||
|
||||
<!-- AdMob 앱 ID -->
|
||||
<TextBlock Text="AdMob 앱 ID (App ID)" Style="{StaticResource FsLabelStyle}" Margin="0,0,0,6"/>
|
||||
<TextBox x:Name="AdMobAppIdBox"
|
||||
Style="{StaticResource FsPathInputStyle}"
|
||||
Margin="0,0,0,12"/>
|
||||
|
||||
<!-- 배너 광고 단위 ID -->
|
||||
<TextBlock Text="배너 광고 단위 ID (Banner Ad Unit ID)" Style="{StaticResource FsLabelStyle}" Margin="0,0,0,6"/>
|
||||
<TextBox x:Name="AdMobBannerIdBox"
|
||||
Style="{StaticResource FsPathInputStyle}"
|
||||
Margin="0,0,0,12"/>
|
||||
|
||||
<!-- 전면 광고 단위 ID -->
|
||||
<TextBlock Text="전면 광고 단위 ID (Interstitial Ad Unit ID)" Style="{StaticResource FsLabelStyle}" Margin="0,0,0,6"/>
|
||||
<TextBox x:Name="AdMobInterstitialIdBox"
|
||||
Style="{StaticResource FsPathInputStyle}"
|
||||
Margin="0,0,0,16"/>
|
||||
|
||||
<!-- 테스트 모드 체크박스 -->
|
||||
<CheckBox x:Name="AdMobTestAdsCheck"
|
||||
IsChecked="True"
|
||||
Margin="0,0,0,16"
|
||||
Checked="OnAdMobTestAdsCheckChanged"
|
||||
Unchecked="OnAdMobTestAdsCheckChanged">
|
||||
<TextBlock Text="Google 공식 테스트 광고 사용 (권장: 개발 및 검증 시 계정 정지 방지)" TextWrapping="Wrap" VerticalAlignment="Center"/>
|
||||
</CheckBox>
|
||||
|
||||
<!-- app-ads.txt 내보내기 & 공식 콘솔 안내 -->
|
||||
<Border Background="{DynamicResource FsBgControl}" BorderBrush="{DynamicResource FsBorderControl}" BorderThickness="1" CornerRadius="4" Padding="12,8" Margin="0,0,0,12">
|
||||
<Grid>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="*"/>
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<StackPanel Grid.Column="0" VerticalAlignment="Center">
|
||||
<TextBlock Text="개발자 웹사이트 app-ads.txt 검증" Style="{StaticResource FsBodyStyle}" FontWeight="Medium" VerticalAlignment="Center"/>
|
||||
<TextBlock Text="게시자 ID 기반의 IAB 표준 app-ads.txt 명세를 손쉽게 생성하여 내보냅니다."
|
||||
Style="{StaticResource FsCaptionStyle}" TextTrimming="CharacterEllipsis" Margin="0,2,0,0" VerticalAlignment="Center"/>
|
||||
</StackPanel>
|
||||
<Button x:Name="ExportAppAdsTxtBtn" Grid.Column="1"
|
||||
Content="app-ads.txt 내보내기"
|
||||
Style="{StaticResource FsSecondaryButtonStyle}"
|
||||
Padding="12,0"
|
||||
VerticalAlignment="Center"
|
||||
Click="OnExportAppAdsTxt"/>
|
||||
</Grid>
|
||||
</Border>
|
||||
|
||||
<Button Content="Google AdMob 콘솔 열기"
|
||||
Style="{StaticResource FsSecondaryButtonStyle}"
|
||||
Padding="12,0"
|
||||
HorizontalAlignment="Left"
|
||||
Click="OnOpenAdMobConsole"/>
|
||||
</StackPanel>
|
||||
</Border>
|
||||
|
||||
</StackPanel>
|
||||
</ScrollViewer>
|
||||
|
||||
<!-- ===== 푸터 ===== -->
|
||||
<Border Grid.Row="2" Background="{StaticResource FsBgPanel}"
|
||||
BorderBrush="{StaticResource FsBorderSubtle}" BorderThickness="0,1,0,0" Padding="24,14">
|
||||
<Border Grid.Row="2" Background="{DynamicResource FsBgLayer}"
|
||||
BorderBrush="{DynamicResource FsBorderSubtle}" BorderThickness="0,1,0,0" Padding="24,16">
|
||||
<StackPanel Orientation="Horizontal" HorizontalAlignment="Right" VerticalAlignment="Center">
|
||||
<Button Content="닫기" Style="{StaticResource FsSecondaryButtonStyle}" Padding="20,8" Click="OnClose"/>
|
||||
<Button Content="저장" Style="{StaticResource FsPrimaryButtonStyle}" Padding="20,8" Margin="8,0,0,0" Click="OnSave"/>
|
||||
<Button Content="닫기" Style="{StaticResource FsSecondaryButtonStyle}" Padding="24,0" VerticalAlignment="Center" Click="OnClose"/>
|
||||
<Button Content="저장" Style="{StaticResource FsAccentButtonStyle}" Padding="24,0" Margin="8,0,0,0" VerticalAlignment="Center" Click="OnSave"/>
|
||||
</StackPanel>
|
||||
</Border>
|
||||
</Grid>
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@ using System.Windows.Controls;
|
|||
using System.Windows.Media;
|
||||
using System.Windows.Shapes;
|
||||
using Everything2Everything.Core;
|
||||
using Everything2Everything.Core.Ads;
|
||||
using Everything2Everything.Core.Converters;
|
||||
|
||||
namespace Everything2Everything.App.Views;
|
||||
|
|
@ -12,15 +13,43 @@ namespace Everything2Everything.App.Views;
|
|||
public partial class SettingsWindow : Wpf.Ui.Controls.FluentWindow
|
||||
{
|
||||
private readonly ISettingsStore _settings;
|
||||
private readonly IAdService? _adService;
|
||||
|
||||
public SettingsWindow(ISettingsStore settings)
|
||||
public SettingsWindow(ISettingsStore settings, IAdService? adService = null)
|
||||
{
|
||||
_settings = settings;
|
||||
_adService = adService;
|
||||
InitializeComponent();
|
||||
LoadSettings();
|
||||
RefreshToolStatus();
|
||||
}
|
||||
|
||||
public void SaveAdMobSettings()
|
||||
{
|
||||
var pubId = AdMobPublisherIdBox.Text?.Trim() ?? string.Empty;
|
||||
var appId = AdMobAppIdBox.Text?.Trim() ?? string.Empty;
|
||||
var bannerId = AdMobBannerIdBox.Text?.Trim() ?? string.Empty;
|
||||
var interstitialId = AdMobInterstitialIdBox.Text?.Trim() ?? string.Empty;
|
||||
bool useTest = AdMobTestAdsCheck.IsChecked == true;
|
||||
|
||||
_settings.Set("admob.publisherid", pubId);
|
||||
_settings.Set("admob.appid", appId);
|
||||
_settings.Set("admob.bannerid", bannerId);
|
||||
_settings.Set("admob.interstitialid", interstitialId);
|
||||
_settings.Set("admob.usetestads", useTest ? "true" : "false");
|
||||
|
||||
var updatedConfig = new AdMobConfig
|
||||
{
|
||||
PublisherId = pubId,
|
||||
AppId = appId,
|
||||
BannerAdUnitId = bannerId,
|
||||
InterstitialAdUnitId = interstitialId,
|
||||
UseTestAds = useTest
|
||||
};
|
||||
|
||||
_adService?.UpdateAdMobConfig(updatedConfig);
|
||||
}
|
||||
|
||||
private void LoadSettings()
|
||||
{
|
||||
var backend = (_settings.Get("ai.backend") ?? "auto").ToLowerInvariant();
|
||||
|
|
@ -40,6 +69,53 @@ public partial class SettingsWindow : Wpf.Ui.Controls.FluentWindow
|
|||
SetKeyStatus(AnthropicDot, AnthropicStatus, _settings.Contains("anthropic.apikey"), HasEnv("ANTHROPIC_API_KEY"));
|
||||
|
||||
GpuToggle.IsChecked = _settings.Get("video.gpu") != "false"; // 기본 켜짐
|
||||
LoadAdMobSettings();
|
||||
}
|
||||
|
||||
private void LoadAdMobSettings()
|
||||
{
|
||||
var pubId = _settings.Get("admob.publisherid") ?? _adService?.CurrentConfig.PublisherId ?? string.Empty;
|
||||
var appId = _settings.Get("admob.appid") ?? _adService?.CurrentConfig.AppId ?? string.Empty;
|
||||
var bannerId = _settings.Get("admob.bannerid") ?? _adService?.CurrentConfig.BannerAdUnitId ?? string.Empty;
|
||||
var interstitialId = _settings.Get("admob.interstitialid") ?? _adService?.CurrentConfig.InterstitialAdUnitId ?? string.Empty;
|
||||
var useTestStr = _settings.Get("admob.usetestads");
|
||||
bool useTest = useTestStr is null ? (_adService?.CurrentConfig.UseTestAds ?? true) : useTestStr != "false";
|
||||
|
||||
AdMobPublisherIdBox.Text = pubId;
|
||||
AdMobAppIdBox.Text = appId;
|
||||
AdMobBannerIdBox.Text = bannerId;
|
||||
AdMobInterstitialIdBox.Text = interstitialId;
|
||||
AdMobTestAdsCheck.IsChecked = useTest;
|
||||
UpdateAdMobStatusDisplay();
|
||||
}
|
||||
|
||||
private void UpdateAdMobStatusDisplay()
|
||||
{
|
||||
if (AdMobStatusDot == null || AdMobStatusText == null) return;
|
||||
bool isTest = AdMobTestAdsCheck.IsChecked == true;
|
||||
bool hasCustom = !string.IsNullOrWhiteSpace(AdMobBannerIdBox?.Text) &&
|
||||
!AdMobBannerIdBox.Text.Trim().Equals(AdMobConfig.SampleBannerId, StringComparison.OrdinalIgnoreCase);
|
||||
|
||||
if (isTest)
|
||||
{
|
||||
AdMobStatusDot.Fill = Res("FsStatusInfo");
|
||||
AdMobStatusText.Text = "Google 공식 테스트 광고 모드 활성 (Sample Ad Unit)";
|
||||
}
|
||||
else if (hasCustom)
|
||||
{
|
||||
AdMobStatusDot.Fill = Res("FsStatusSuccess");
|
||||
AdMobStatusText.Text = "실서비스 AdMob 광고 단위 연결됨";
|
||||
}
|
||||
else
|
||||
{
|
||||
AdMobStatusDot.Fill = Res("FsStatusWarn");
|
||||
AdMobStatusText.Text = "테스트 모드 해제됨 — 실서비스 광고 단위 ID를 입력하세요";
|
||||
}
|
||||
}
|
||||
|
||||
private void OnAdMobTestAdsCheckChanged(object sender, RoutedEventArgs e)
|
||||
{
|
||||
UpdateAdMobStatusDisplay();
|
||||
}
|
||||
|
||||
private static bool HasEnv(string name) => !string.IsNullOrEmpty(Environment.GetEnvironmentVariable(name));
|
||||
|
|
@ -231,9 +307,34 @@ public partial class SettingsWindow : Wpf.Ui.Controls.FluentWindow
|
|||
if (OpenAiKeyBox.Password.Length > 0) _settings.Set("openai.apikey", OpenAiKeyBox.Password);
|
||||
if (AnthropicKeyBox.Password.Length > 0) _settings.Set("anthropic.apikey", AnthropicKeyBox.Password);
|
||||
|
||||
SaveAdMobSettings();
|
||||
|
||||
Close();
|
||||
}
|
||||
|
||||
private void OnExportAppAdsTxt(object sender, RoutedEventArgs e)
|
||||
{
|
||||
var dlg = new Microsoft.Win32.SaveFileDialog
|
||||
{
|
||||
FileName = "app-ads.txt",
|
||||
DefaultExt = ".txt",
|
||||
Filter = "텍스트 파일 (*.txt)|*.txt|모든 파일 (*.*)|*.*"
|
||||
};
|
||||
if (dlg.ShowDialog() == true)
|
||||
{
|
||||
var pubId = AdMobPublisherIdBox.Text?.Trim() ?? string.Empty;
|
||||
var config = new AdMobConfig { PublisherId = pubId };
|
||||
var content = config.GenerateAppAdsTxt();
|
||||
System.IO.File.WriteAllText(dlg.FileName, content, System.Text.Encoding.UTF8);
|
||||
MessageBox.Show($"app-ads.txt 파일이 저장되었습니다:\n{dlg.FileName}", "app-ads.txt 내보내기", MessageBoxButton.OK, MessageBoxImage.Information);
|
||||
}
|
||||
}
|
||||
|
||||
private void OnOpenAdMobConsole(object sender, RoutedEventArgs e)
|
||||
{
|
||||
OpenUrl("https://admob.google.com");
|
||||
}
|
||||
|
||||
private void OnClose(object sender, RoutedEventArgs e) => Close();
|
||||
|
||||
private void OnOpenToolInstaller(object sender, RoutedEventArgs e)
|
||||
|
|
|
|||
206
src/Everything2Everything.App/Views/Themes/FsPalette.Dark.xaml
Normal file
206
src/Everything2Everything.App/Views/Themes/FsPalette.Dark.xaml
Normal file
|
|
@ -0,0 +1,206 @@
|
|||
<!-- Fs 색 역할 토큰. 키 집합은 Light/Dark가 동일해야 한다(Win11NativeDesignTests). 값의 근거는 design.md §토큰. -->
|
||||
<ResourceDictionary
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
|
||||
<!-- 다크 — Windows 11 다크 모드 값 -->
|
||||
|
||||
<!-- 레이어 — WinUI Layering: Mica 베이스 + 콘텐츠 레이어 + 카드 -->
|
||||
<!-- 창 베이스: 투명 → Mica가 비친다 -->
|
||||
<Color x:Key="FsBgBaseColor">#00000000</Color>
|
||||
<SolidColorBrush x:Key="FsBgBase" Color="{StaticResource FsBgBaseColor}"/>
|
||||
<!-- 콘텐츠 레이어 (LayerFillColorDefault) -->
|
||||
<Color x:Key="FsBgLayerColor">#4C3A3A3A</Color>
|
||||
<SolidColorBrush x:Key="FsBgLayer" Color="{StaticResource FsBgLayerColor}"/>
|
||||
<!-- 카드 (CardBackgroundFillColorDefault) -->
|
||||
<Color x:Key="FsBgCardColor">#0DFFFFFF</Color>
|
||||
<SolidColorBrush x:Key="FsBgCard" Color="{StaticResource FsBgCardColor}"/>
|
||||
<!-- 카드·행 호버 -->
|
||||
<Color x:Key="FsBgCardHoverColor">#15FFFFFF</Color>
|
||||
<SolidColorBrush x:Key="FsBgCardHover" Color="{StaticResource FsBgCardHoverColor}"/>
|
||||
<!-- 입력·버튼 채움 (ControlFillColorDefault) -->
|
||||
<Color x:Key="FsBgControlColor">#0FFFFFFF</Color>
|
||||
<SolidColorBrush x:Key="FsBgControl" Color="{StaticResource FsBgControlColor}"/>
|
||||
<!-- 입력·버튼 호버 (ControlFillColorSecondary) -->
|
||||
<Color x:Key="FsBgControlHoverColor">#15FFFFFF</Color>
|
||||
<SolidColorBrush x:Key="FsBgControlHover" Color="{StaticResource FsBgControlHoverColor}"/>
|
||||
<!-- 포커스된 입력 (ControlFillColorInputActive) -->
|
||||
<Color x:Key="FsBgControlActiveColor">#B31E1E1E</Color>
|
||||
<SolidColorBrush x:Key="FsBgControlActive" Color="{StaticResource FsBgControlActiveColor}"/>
|
||||
<!-- 세그먼트 선택 면: 다크는 한 단계 밝게, 라이트는 흰 면 -->
|
||||
<Color x:Key="FsBgSegmentSelectedColor">#29FFFFFF</Color>
|
||||
<SolidColorBrush x:Key="FsBgSegmentSelected" Color="{StaticResource FsBgSegmentSelectedColor}"/>
|
||||
<!-- 투명 버튼 호버 (SubtleFillColorSecondary) -->
|
||||
<Color x:Key="FsBgSubtleHoverColor">#0FFFFFFF</Color>
|
||||
<SolidColorBrush x:Key="FsBgSubtleHover" Color="{StaticResource FsBgSubtleHoverColor}"/>
|
||||
<!-- 투명 버튼 눌림 (SubtleFillColorTertiary) -->
|
||||
<Color x:Key="FsBgSubtlePressedColor">#0AFFFFFF</Color>
|
||||
<SolidColorBrush x:Key="FsBgSubtlePressed" Color="{StaticResource FsBgSubtlePressedColor}"/>
|
||||
<!-- 불투명 오버레이 면 (드롭 안내) -->
|
||||
<Color x:Key="FsBgSolidColor">#2C2C2C</Color>
|
||||
<SolidColorBrush x:Key="FsBgSolid" Color="{StaticResource FsBgSolidColor}"/>
|
||||
<!-- 모달·드롭 스모크 (SmokeFillColorDefault) -->
|
||||
<Color x:Key="FsBgSmokeColor">#4D000000</Color>
|
||||
<SolidColorBrush x:Key="FsBgSmoke" Color="{StaticResource FsBgSmokeColor}"/>
|
||||
|
||||
<!-- 선 -->
|
||||
<!-- 카드·레이어 외곽 (CardStrokeColorDefault) -->
|
||||
<Color x:Key="FsBorderSubtleColor">#19000000</Color>
|
||||
<SolidColorBrush x:Key="FsBorderSubtle" Color="{StaticResource FsBorderSubtleColor}"/>
|
||||
<!-- 컨트롤 외곽 (ControlStrokeColorDefault) -->
|
||||
<Color x:Key="FsBorderControlColor">#12FFFFFF</Color>
|
||||
<SolidColorBrush x:Key="FsBorderControl" Color="{StaticResource FsBorderControlColor}"/>
|
||||
<!-- 강한 외곽: 체크박스·드롭 점선 (ControlStrongStrokeColorDefault) -->
|
||||
<Color x:Key="FsBorderStrongColor">#8BFFFFFF</Color>
|
||||
<SolidColorBrush x:Key="FsBorderStrong" Color="{StaticResource FsBorderStrongColor}"/>
|
||||
<!-- 구분선 (DividerStrokeColorDefault) -->
|
||||
<Color x:Key="FsDividerColor">#15FFFFFF</Color>
|
||||
<SolidColorBrush x:Key="FsDivider" Color="{StaticResource FsDividerColor}"/>
|
||||
|
||||
<!-- 텍스트 — 3차도 4.5:1 이상으로 보정(라이트는 WinUI 기본 #72 → #8B) -->
|
||||
<Color x:Key="FsTextPrimaryColor">#FFFFFFFF</Color>
|
||||
<SolidColorBrush x:Key="FsTextPrimary" Color="{StaticResource FsTextPrimaryColor}"/>
|
||||
<Color x:Key="FsTextSecondaryColor">#C5FFFFFF</Color>
|
||||
<SolidColorBrush x:Key="FsTextSecondary" Color="{StaticResource FsTextSecondaryColor}"/>
|
||||
<Color x:Key="FsTextTertiaryColor">#87FFFFFF</Color>
|
||||
<SolidColorBrush x:Key="FsTextTertiary" Color="{StaticResource FsTextTertiaryColor}"/>
|
||||
<Color x:Key="FsTextDisabledColor">#5DFFFFFF</Color>
|
||||
<SolidColorBrush x:Key="FsTextDisabled" Color="{StaticResource FsTextDisabledColor}"/>
|
||||
|
||||
<!-- 강조 — 기본값(Windows 파랑). 실행 시 FsThemeService가 시스템 강조색에서 대비 보정해 덮어쓴다 -->
|
||||
<!-- 강조 채움 (AccentFillColorDefault) -->
|
||||
<Color x:Key="FsAccentColor">#60CDFF</Color>
|
||||
<SolidColorBrush x:Key="FsAccent" Color="{StaticResource FsAccentColor}"/>
|
||||
<Color x:Key="FsAccentHoverColor">#5AB7E5</Color>
|
||||
<SolidColorBrush x:Key="FsAccentHover" Color="{StaticResource FsAccentHoverColor}"/>
|
||||
<!-- 강조 텍스트·아이콘 (AccentTextFillColorPrimary) -->
|
||||
<Color x:Key="FsAccentTextColor">#99EBFF</Color>
|
||||
<SolidColorBrush x:Key="FsAccentText" Color="{StaticResource FsAccentTextColor}"/>
|
||||
<!-- 선택 행·칩 틴트 -->
|
||||
<Color x:Key="FsAccentSubtleColor">#3360CDFF</Color>
|
||||
<SolidColorBrush x:Key="FsAccentSubtle" Color="{StaticResource FsAccentSubtleColor}"/>
|
||||
<Color x:Key="FsTextOnAccentColor">#000000</Color>
|
||||
<SolidColorBrush x:Key="FsTextOnAccent" Color="{StaticResource FsTextOnAccentColor}"/>
|
||||
|
||||
<!-- 상태 — WinUI SystemFillColor* -->
|
||||
<Color x:Key="FsStatusSuccessColor">#6CCB5F</Color>
|
||||
<SolidColorBrush x:Key="FsStatusSuccess" Color="{StaticResource FsStatusSuccessColor}"/>
|
||||
<Color x:Key="FsStatusSuccessTextColor">#6CCB5F</Color>
|
||||
<SolidColorBrush x:Key="FsStatusSuccessText" Color="{StaticResource FsStatusSuccessTextColor}"/>
|
||||
<Color x:Key="FsStatusSuccessBgColor">#393D1B</Color>
|
||||
<SolidColorBrush x:Key="FsStatusSuccessBg" Color="{StaticResource FsStatusSuccessBgColor}"/>
|
||||
<Color x:Key="FsStatusWarnColor">#FCE100</Color>
|
||||
<SolidColorBrush x:Key="FsStatusWarn" Color="{StaticResource FsStatusWarnColor}"/>
|
||||
<Color x:Key="FsStatusWarnTextColor">#FCE100</Color>
|
||||
<SolidColorBrush x:Key="FsStatusWarnText" Color="{StaticResource FsStatusWarnTextColor}"/>
|
||||
<Color x:Key="FsStatusWarnBgColor">#433519</Color>
|
||||
<SolidColorBrush x:Key="FsStatusWarnBg" Color="{StaticResource FsStatusWarnBgColor}"/>
|
||||
<Color x:Key="FsStatusDangerColor">#FF99A4</Color>
|
||||
<SolidColorBrush x:Key="FsStatusDanger" Color="{StaticResource FsStatusDangerColor}"/>
|
||||
<Color x:Key="FsStatusDangerTextColor">#FF99A4</Color>
|
||||
<SolidColorBrush x:Key="FsStatusDangerText" Color="{StaticResource FsStatusDangerTextColor}"/>
|
||||
<Color x:Key="FsStatusDangerBgColor">#442726</Color>
|
||||
<SolidColorBrush x:Key="FsStatusDangerBg" Color="{StaticResource FsStatusDangerBgColor}"/>
|
||||
<Color x:Key="FsStatusInfoColor">#60CDFF</Color>
|
||||
<SolidColorBrush x:Key="FsStatusInfo" Color="{StaticResource FsStatusInfoColor}"/>
|
||||
<Color x:Key="FsStatusInfoTextColor">#60CDFF</Color>
|
||||
<SolidColorBrush x:Key="FsStatusInfoText" Color="{StaticResource FsStatusInfoTextColor}"/>
|
||||
<Color x:Key="FsStatusInfoBgColor">#0FFFFFFF</Color>
|
||||
<SolidColorBrush x:Key="FsStatusInfoBg" Color="{StaticResource FsStatusInfoBgColor}"/>
|
||||
<Color x:Key="FsStatusNeutralColor">#8BFFFFFF</Color>
|
||||
<SolidColorBrush x:Key="FsStatusNeutral" Color="{StaticResource FsStatusNeutralColor}"/>
|
||||
<!-- 창 닫기 버튼 호버 (OS 관습) -->
|
||||
<Color x:Key="FsCaptionCloseHoverColor">#C42B1C</Color>
|
||||
<SolidColorBrush x:Key="FsCaptionCloseHover" Color="{StaticResource FsCaptionCloseHoverColor}"/>
|
||||
<Color x:Key="FsCaptionCloseForegroundColor">#FFFFFF</Color>
|
||||
<SolidColorBrush x:Key="FsCaptionCloseForeground" Color="{StaticResource FsCaptionCloseForegroundColor}"/>
|
||||
|
||||
<!-- 손실 등급 — 상태색에 매핑 -->
|
||||
<Color x:Key="FsLossLosslessDotColor">#6CCB5F</Color>
|
||||
<SolidColorBrush x:Key="FsLossLosslessDot" Color="{StaticResource FsLossLosslessDotColor}"/>
|
||||
<Color x:Key="FsLossLosslessTextColor">#6CCB5F</Color>
|
||||
<SolidColorBrush x:Key="FsLossLosslessText" Color="{StaticResource FsLossLosslessTextColor}"/>
|
||||
<Color x:Key="FsLossLosslessBgColor">#393D1B</Color>
|
||||
<SolidColorBrush x:Key="FsLossLosslessBg" Color="{StaticResource FsLossLosslessBgColor}"/>
|
||||
<Color x:Key="FsLossContainerDotColor">#8BFFFFFF</Color>
|
||||
<SolidColorBrush x:Key="FsLossContainerDot" Color="{StaticResource FsLossContainerDotColor}"/>
|
||||
<Color x:Key="FsLossContainerTextColor">#C5FFFFFF</Color>
|
||||
<SolidColorBrush x:Key="FsLossContainerText" Color="{StaticResource FsLossContainerTextColor}"/>
|
||||
<Color x:Key="FsLossContainerBgColor">#0FFFFFFF</Color>
|
||||
<SolidColorBrush x:Key="FsLossContainerBg" Color="{StaticResource FsLossContainerBgColor}"/>
|
||||
<Color x:Key="FsLossRecodeDotColor">#FCE100</Color>
|
||||
<SolidColorBrush x:Key="FsLossRecodeDot" Color="{StaticResource FsLossRecodeDotColor}"/>
|
||||
<Color x:Key="FsLossRecodeTextColor">#FCE100</Color>
|
||||
<SolidColorBrush x:Key="FsLossRecodeText" Color="{StaticResource FsLossRecodeTextColor}"/>
|
||||
<Color x:Key="FsLossRecodeBgColor">#433519</Color>
|
||||
<SolidColorBrush x:Key="FsLossRecodeBg" Color="{StaticResource FsLossRecodeBgColor}"/>
|
||||
<Color x:Key="FsLossRasterizeDotColor">#FF99A4</Color>
|
||||
<SolidColorBrush x:Key="FsLossRasterizeDot" Color="{StaticResource FsLossRasterizeDotColor}"/>
|
||||
<Color x:Key="FsLossRasterizeTextColor">#FF99A4</Color>
|
||||
<SolidColorBrush x:Key="FsLossRasterizeText" Color="{StaticResource FsLossRasterizeTextColor}"/>
|
||||
<Color x:Key="FsLossRasterizeBgColor">#442726</Color>
|
||||
<SolidColorBrush x:Key="FsLossRasterizeBg" Color="{StaticResource FsLossRasterizeBgColor}"/>
|
||||
|
||||
<!-- 카테고리 뱃지 (진단 창) -->
|
||||
<Color x:Key="FsBadgeImageBrushColor">#60CDFF</Color>
|
||||
<SolidColorBrush x:Key="FsBadgeImageBrush" Color="{StaticResource FsBadgeImageBrushColor}"/>
|
||||
<Color x:Key="FsBadgeImageBgColor">#1F60CDFF</Color>
|
||||
<SolidColorBrush x:Key="FsBadgeImageBg" Color="{StaticResource FsBadgeImageBgColor}"/>
|
||||
<Color x:Key="FsBadgeDocBrushColor">#6CCB5F</Color>
|
||||
<SolidColorBrush x:Key="FsBadgeDocBrush" Color="{StaticResource FsBadgeDocBrushColor}"/>
|
||||
<Color x:Key="FsBadgeDocBgColor">#1F6CCB5F</Color>
|
||||
<SolidColorBrush x:Key="FsBadgeDocBg" Color="{StaticResource FsBadgeDocBgColor}"/>
|
||||
<Color x:Key="FsBadgeVideoBrushColor">#FCE100</Color>
|
||||
<SolidColorBrush x:Key="FsBadgeVideoBrush" Color="{StaticResource FsBadgeVideoBrushColor}"/>
|
||||
<Color x:Key="FsBadgeVideoBgColor">#1FFCE100</Color>
|
||||
<SolidColorBrush x:Key="FsBadgeVideoBg" Color="{StaticResource FsBadgeVideoBgColor}"/>
|
||||
<Color x:Key="FsBadgeAudioBrushColor">#D7A8FF</Color>
|
||||
<SolidColorBrush x:Key="FsBadgeAudioBrush" Color="{StaticResource FsBadgeAudioBrushColor}"/>
|
||||
<Color x:Key="FsBadgeAudioBgColor">#1FD7A8FF</Color>
|
||||
<SolidColorBrush x:Key="FsBadgeAudioBg" Color="{StaticResource FsBadgeAudioBgColor}"/>
|
||||
<Color x:Key="FsBadgeArchiveBrushColor">#FF99A4</Color>
|
||||
<SolidColorBrush x:Key="FsBadgeArchiveBrush" Color="{StaticResource FsBadgeArchiveBrushColor}"/>
|
||||
<Color x:Key="FsBadgeArchiveBgColor">#1FFF99A4</Color>
|
||||
<SolidColorBrush x:Key="FsBadgeArchiveBg" Color="{StaticResource FsBadgeArchiveBgColor}"/>
|
||||
|
||||
<!-- 파일 형식 색: 행의 형식 표식(선·점)에만 쓴다 -->
|
||||
<Color x:Key="FsFmtPdfColor">#E5484D</Color>
|
||||
<SolidColorBrush x:Key="FsFmtPdf" Color="{StaticResource FsFmtPdfColor}"/>
|
||||
<Color x:Key="FsFmtPngColor">#8E6CEF</Color>
|
||||
<SolidColorBrush x:Key="FsFmtPng" Color="{StaticResource FsFmtPngColor}"/>
|
||||
<Color x:Key="FsFmtHeicColor">#D69E2E</Color>
|
||||
<SolidColorBrush x:Key="FsFmtHeic" Color="{StaticResource FsFmtHeicColor}"/>
|
||||
<Color x:Key="FsFmtJpgColor">#3B82D8</Color>
|
||||
<SolidColorBrush x:Key="FsFmtJpg" Color="{StaticResource FsFmtJpgColor}"/>
|
||||
<Color x:Key="FsFmtDocxColor">#2B6CB0</Color>
|
||||
<SolidColorBrush x:Key="FsFmtDocx" Color="{StaticResource FsFmtDocxColor}"/>
|
||||
<Color x:Key="FsFmtHtmlColor">#DD6B20</Color>
|
||||
<SolidColorBrush x:Key="FsFmtHtml" Color="{StaticResource FsFmtHtmlColor}"/>
|
||||
<Color x:Key="FsFmtRawColor">#319795</Color>
|
||||
<SolidColorBrush x:Key="FsFmtRaw" Color="{StaticResource FsFmtRawColor}"/>
|
||||
<Color x:Key="FsFmtGifColor">#9F7AEA</Color>
|
||||
<SolidColorBrush x:Key="FsFmtGif" Color="{StaticResource FsFmtGifColor}"/>
|
||||
<Color x:Key="FsFmtTiffColor">#38B2AC</Color>
|
||||
<SolidColorBrush x:Key="FsFmtTiff" Color="{StaticResource FsFmtTiffColor}"/>
|
||||
<Color x:Key="FsFmtWebpColor">#48BB78</Color>
|
||||
<SolidColorBrush x:Key="FsFmtWebp" Color="{StaticResource FsFmtWebpColor}"/>
|
||||
<Color x:Key="FsFmtBmpColor">#718096</Color>
|
||||
<SolidColorBrush x:Key="FsFmtBmp" Color="{StaticResource FsFmtBmpColor}"/>
|
||||
<Color x:Key="FsFmtAvifColor">#ED64A6</Color>
|
||||
<SolidColorBrush x:Key="FsFmtAvif" Color="{StaticResource FsFmtAvifColor}"/>
|
||||
<Color x:Key="FsFmtHwpColor">#C53030</Color>
|
||||
<SolidColorBrush x:Key="FsFmtHwp" Color="{StaticResource FsFmtHwpColor}"/>
|
||||
<Color x:Key="FsFmtOtherColor">#718096</Color>
|
||||
<SolidColorBrush x:Key="FsFmtOther" Color="{StaticResource FsFmtOtherColor}"/>
|
||||
<Color x:Key="FsFmtCsvColor">#68A063</Color>
|
||||
<SolidColorBrush x:Key="FsFmtCsv" Color="{StaticResource FsFmtCsvColor}"/>
|
||||
<Color x:Key="FsFmtXlsxColor">#38A169</Color>
|
||||
<SolidColorBrush x:Key="FsFmtXlsx" Color="{StaticResource FsFmtXlsxColor}"/>
|
||||
<Color x:Key="FsFmtJsonColor">#E3B341</Color>
|
||||
<SolidColorBrush x:Key="FsFmtJson" Color="{StaticResource FsFmtJsonColor}"/>
|
||||
<Color x:Key="FsFmtSvgColor">#E05A9C</Color>
|
||||
<SolidColorBrush x:Key="FsFmtSvg" Color="{StaticResource FsFmtSvgColor}"/>
|
||||
<Color x:Key="FsFmtVideoColor">#FF7043</Color>
|
||||
<SolidColorBrush x:Key="FsFmtVideo" Color="{StaticResource FsFmtVideoColor}"/>
|
||||
<Color x:Key="FsFmtAudioColor">#B794F4</Color>
|
||||
<SolidColorBrush x:Key="FsFmtAudio" Color="{StaticResource FsFmtAudioColor}"/>
|
||||
</ResourceDictionary>
|
||||
206
src/Everything2Everything.App/Views/Themes/FsPalette.Light.xaml
Normal file
206
src/Everything2Everything.App/Views/Themes/FsPalette.Light.xaml
Normal file
|
|
@ -0,0 +1,206 @@
|
|||
<!-- Fs 색 역할 토큰. 키 집합은 Light/Dark가 동일해야 한다(Win11NativeDesignTests). 값의 근거는 design.md §토큰. -->
|
||||
<ResourceDictionary
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
|
||||
<!-- 라이트 — Windows 11 라이트 모드 값 -->
|
||||
|
||||
<!-- 레이어 — WinUI Layering: Mica 베이스 + 콘텐츠 레이어 + 카드 -->
|
||||
<!-- 창 베이스: 투명 → Mica가 비친다 -->
|
||||
<Color x:Key="FsBgBaseColor">#00000000</Color>
|
||||
<SolidColorBrush x:Key="FsBgBase" Color="{StaticResource FsBgBaseColor}"/>
|
||||
<!-- 콘텐츠 레이어 (LayerFillColorDefault) -->
|
||||
<Color x:Key="FsBgLayerColor">#80FFFFFF</Color>
|
||||
<SolidColorBrush x:Key="FsBgLayer" Color="{StaticResource FsBgLayerColor}"/>
|
||||
<!-- 카드 (CardBackgroundFillColorDefault) -->
|
||||
<Color x:Key="FsBgCardColor">#B3FFFFFF</Color>
|
||||
<SolidColorBrush x:Key="FsBgCard" Color="{StaticResource FsBgCardColor}"/>
|
||||
<!-- 카드·행 호버 -->
|
||||
<Color x:Key="FsBgCardHoverColor">#80F6F6F6</Color>
|
||||
<SolidColorBrush x:Key="FsBgCardHover" Color="{StaticResource FsBgCardHoverColor}"/>
|
||||
<!-- 입력·버튼 채움 (ControlFillColorDefault) -->
|
||||
<Color x:Key="FsBgControlColor">#B3FFFFFF</Color>
|
||||
<SolidColorBrush x:Key="FsBgControl" Color="{StaticResource FsBgControlColor}"/>
|
||||
<!-- 입력·버튼 호버 (ControlFillColorSecondary) -->
|
||||
<Color x:Key="FsBgControlHoverColor">#80F9F9F9</Color>
|
||||
<SolidColorBrush x:Key="FsBgControlHover" Color="{StaticResource FsBgControlHoverColor}"/>
|
||||
<!-- 포커스된 입력 (ControlFillColorInputActive) -->
|
||||
<Color x:Key="FsBgControlActiveColor">#FFFFFFFF</Color>
|
||||
<SolidColorBrush x:Key="FsBgControlActive" Color="{StaticResource FsBgControlActiveColor}"/>
|
||||
<!-- 세그먼트 선택 면: 다크는 한 단계 밝게, 라이트는 흰 면 -->
|
||||
<Color x:Key="FsBgSegmentSelectedColor">#FFFFFFFF</Color>
|
||||
<SolidColorBrush x:Key="FsBgSegmentSelected" Color="{StaticResource FsBgSegmentSelectedColor}"/>
|
||||
<!-- 투명 버튼 호버 (SubtleFillColorSecondary) -->
|
||||
<Color x:Key="FsBgSubtleHoverColor">#09000000</Color>
|
||||
<SolidColorBrush x:Key="FsBgSubtleHover" Color="{StaticResource FsBgSubtleHoverColor}"/>
|
||||
<!-- 투명 버튼 눌림 (SubtleFillColorTertiary) -->
|
||||
<Color x:Key="FsBgSubtlePressedColor">#06000000</Color>
|
||||
<SolidColorBrush x:Key="FsBgSubtlePressed" Color="{StaticResource FsBgSubtlePressedColor}"/>
|
||||
<!-- 불투명 오버레이 면 (드롭 안내) -->
|
||||
<Color x:Key="FsBgSolidColor">#F9F9F9</Color>
|
||||
<SolidColorBrush x:Key="FsBgSolid" Color="{StaticResource FsBgSolidColor}"/>
|
||||
<!-- 모달·드롭 스모크 (SmokeFillColorDefault) -->
|
||||
<Color x:Key="FsBgSmokeColor">#4D000000</Color>
|
||||
<SolidColorBrush x:Key="FsBgSmoke" Color="{StaticResource FsBgSmokeColor}"/>
|
||||
|
||||
<!-- 선 -->
|
||||
<!-- 카드·레이어 외곽 (CardStrokeColorDefault) -->
|
||||
<Color x:Key="FsBorderSubtleColor">#0F000000</Color>
|
||||
<SolidColorBrush x:Key="FsBorderSubtle" Color="{StaticResource FsBorderSubtleColor}"/>
|
||||
<!-- 컨트롤 외곽 (ControlStrokeColorDefault) -->
|
||||
<Color x:Key="FsBorderControlColor">#0F000000</Color>
|
||||
<SolidColorBrush x:Key="FsBorderControl" Color="{StaticResource FsBorderControlColor}"/>
|
||||
<!-- 강한 외곽: 체크박스·드롭 점선 (ControlStrongStrokeColorDefault) -->
|
||||
<Color x:Key="FsBorderStrongColor">#72000000</Color>
|
||||
<SolidColorBrush x:Key="FsBorderStrong" Color="{StaticResource FsBorderStrongColor}"/>
|
||||
<!-- 구분선 (DividerStrokeColorDefault) -->
|
||||
<Color x:Key="FsDividerColor">#14000000</Color>
|
||||
<SolidColorBrush x:Key="FsDivider" Color="{StaticResource FsDividerColor}"/>
|
||||
|
||||
<!-- 텍스트 — 3차도 4.5:1 이상으로 보정(라이트는 WinUI 기본 #72 → #8B) -->
|
||||
<Color x:Key="FsTextPrimaryColor">#E4000000</Color>
|
||||
<SolidColorBrush x:Key="FsTextPrimary" Color="{StaticResource FsTextPrimaryColor}"/>
|
||||
<Color x:Key="FsTextSecondaryColor">#9E000000</Color>
|
||||
<SolidColorBrush x:Key="FsTextSecondary" Color="{StaticResource FsTextSecondaryColor}"/>
|
||||
<Color x:Key="FsTextTertiaryColor">#8B000000</Color>
|
||||
<SolidColorBrush x:Key="FsTextTertiary" Color="{StaticResource FsTextTertiaryColor}"/>
|
||||
<Color x:Key="FsTextDisabledColor">#5C000000</Color>
|
||||
<SolidColorBrush x:Key="FsTextDisabled" Color="{StaticResource FsTextDisabledColor}"/>
|
||||
|
||||
<!-- 강조 — 기본값(Windows 파랑). 실행 시 FsThemeService가 시스템 강조색에서 대비 보정해 덮어쓴다 -->
|
||||
<!-- 강조 채움 (AccentFillColorDefault) -->
|
||||
<Color x:Key="FsAccentColor">#005FB8</Color>
|
||||
<SolidColorBrush x:Key="FsAccent" Color="{StaticResource FsAccentColor}"/>
|
||||
<Color x:Key="FsAccentHoverColor">#1A6FC0</Color>
|
||||
<SolidColorBrush x:Key="FsAccentHover" Color="{StaticResource FsAccentHoverColor}"/>
|
||||
<!-- 강조 텍스트·아이콘 (AccentTextFillColorPrimary) -->
|
||||
<Color x:Key="FsAccentTextColor">#003E92</Color>
|
||||
<SolidColorBrush x:Key="FsAccentText" Color="{StaticResource FsAccentTextColor}"/>
|
||||
<!-- 선택 행·칩 틴트 -->
|
||||
<Color x:Key="FsAccentSubtleColor">#26005FB8</Color>
|
||||
<SolidColorBrush x:Key="FsAccentSubtle" Color="{StaticResource FsAccentSubtleColor}"/>
|
||||
<Color x:Key="FsTextOnAccentColor">#FFFFFF</Color>
|
||||
<SolidColorBrush x:Key="FsTextOnAccent" Color="{StaticResource FsTextOnAccentColor}"/>
|
||||
|
||||
<!-- 상태 — WinUI SystemFillColor* -->
|
||||
<Color x:Key="FsStatusSuccessColor">#0F7B0F</Color>
|
||||
<SolidColorBrush x:Key="FsStatusSuccess" Color="{StaticResource FsStatusSuccessColor}"/>
|
||||
<Color x:Key="FsStatusSuccessTextColor">#0F7B0F</Color>
|
||||
<SolidColorBrush x:Key="FsStatusSuccessText" Color="{StaticResource FsStatusSuccessTextColor}"/>
|
||||
<Color x:Key="FsStatusSuccessBgColor">#DFF6DD</Color>
|
||||
<SolidColorBrush x:Key="FsStatusSuccessBg" Color="{StaticResource FsStatusSuccessBgColor}"/>
|
||||
<Color x:Key="FsStatusWarnColor">#9D5D00</Color>
|
||||
<SolidColorBrush x:Key="FsStatusWarn" Color="{StaticResource FsStatusWarnColor}"/>
|
||||
<Color x:Key="FsStatusWarnTextColor">#9D5D00</Color>
|
||||
<SolidColorBrush x:Key="FsStatusWarnText" Color="{StaticResource FsStatusWarnTextColor}"/>
|
||||
<Color x:Key="FsStatusWarnBgColor">#FFF4CE</Color>
|
||||
<SolidColorBrush x:Key="FsStatusWarnBg" Color="{StaticResource FsStatusWarnBgColor}"/>
|
||||
<Color x:Key="FsStatusDangerColor">#C42B1C</Color>
|
||||
<SolidColorBrush x:Key="FsStatusDanger" Color="{StaticResource FsStatusDangerColor}"/>
|
||||
<Color x:Key="FsStatusDangerTextColor">#C42B1C</Color>
|
||||
<SolidColorBrush x:Key="FsStatusDangerText" Color="{StaticResource FsStatusDangerTextColor}"/>
|
||||
<Color x:Key="FsStatusDangerBgColor">#FDE7E9</Color>
|
||||
<SolidColorBrush x:Key="FsStatusDangerBg" Color="{StaticResource FsStatusDangerBgColor}"/>
|
||||
<Color x:Key="FsStatusInfoColor">#005FB8</Color>
|
||||
<SolidColorBrush x:Key="FsStatusInfo" Color="{StaticResource FsStatusInfoColor}"/>
|
||||
<Color x:Key="FsStatusInfoTextColor">#005FB8</Color>
|
||||
<SolidColorBrush x:Key="FsStatusInfoText" Color="{StaticResource FsStatusInfoTextColor}"/>
|
||||
<Color x:Key="FsStatusInfoBgColor">#80F6F6F6</Color>
|
||||
<SolidColorBrush x:Key="FsStatusInfoBg" Color="{StaticResource FsStatusInfoBgColor}"/>
|
||||
<Color x:Key="FsStatusNeutralColor">#72000000</Color>
|
||||
<SolidColorBrush x:Key="FsStatusNeutral" Color="{StaticResource FsStatusNeutralColor}"/>
|
||||
<!-- 창 닫기 버튼 호버 (OS 관습) -->
|
||||
<Color x:Key="FsCaptionCloseHoverColor">#C42B1C</Color>
|
||||
<SolidColorBrush x:Key="FsCaptionCloseHover" Color="{StaticResource FsCaptionCloseHoverColor}"/>
|
||||
<Color x:Key="FsCaptionCloseForegroundColor">#FFFFFF</Color>
|
||||
<SolidColorBrush x:Key="FsCaptionCloseForeground" Color="{StaticResource FsCaptionCloseForegroundColor}"/>
|
||||
|
||||
<!-- 손실 등급 — 상태색에 매핑 -->
|
||||
<Color x:Key="FsLossLosslessDotColor">#0F7B0F</Color>
|
||||
<SolidColorBrush x:Key="FsLossLosslessDot" Color="{StaticResource FsLossLosslessDotColor}"/>
|
||||
<Color x:Key="FsLossLosslessTextColor">#0F7B0F</Color>
|
||||
<SolidColorBrush x:Key="FsLossLosslessText" Color="{StaticResource FsLossLosslessTextColor}"/>
|
||||
<Color x:Key="FsLossLosslessBgColor">#DFF6DD</Color>
|
||||
<SolidColorBrush x:Key="FsLossLosslessBg" Color="{StaticResource FsLossLosslessBgColor}"/>
|
||||
<Color x:Key="FsLossContainerDotColor">#72000000</Color>
|
||||
<SolidColorBrush x:Key="FsLossContainerDot" Color="{StaticResource FsLossContainerDotColor}"/>
|
||||
<Color x:Key="FsLossContainerTextColor">#9E000000</Color>
|
||||
<SolidColorBrush x:Key="FsLossContainerText" Color="{StaticResource FsLossContainerTextColor}"/>
|
||||
<Color x:Key="FsLossContainerBgColor">#09000000</Color>
|
||||
<SolidColorBrush x:Key="FsLossContainerBg" Color="{StaticResource FsLossContainerBgColor}"/>
|
||||
<Color x:Key="FsLossRecodeDotColor">#9D5D00</Color>
|
||||
<SolidColorBrush x:Key="FsLossRecodeDot" Color="{StaticResource FsLossRecodeDotColor}"/>
|
||||
<Color x:Key="FsLossRecodeTextColor">#9D5D00</Color>
|
||||
<SolidColorBrush x:Key="FsLossRecodeText" Color="{StaticResource FsLossRecodeTextColor}"/>
|
||||
<Color x:Key="FsLossRecodeBgColor">#FFF4CE</Color>
|
||||
<SolidColorBrush x:Key="FsLossRecodeBg" Color="{StaticResource FsLossRecodeBgColor}"/>
|
||||
<Color x:Key="FsLossRasterizeDotColor">#C42B1C</Color>
|
||||
<SolidColorBrush x:Key="FsLossRasterizeDot" Color="{StaticResource FsLossRasterizeDotColor}"/>
|
||||
<Color x:Key="FsLossRasterizeTextColor">#C42B1C</Color>
|
||||
<SolidColorBrush x:Key="FsLossRasterizeText" Color="{StaticResource FsLossRasterizeTextColor}"/>
|
||||
<Color x:Key="FsLossRasterizeBgColor">#FDE7E9</Color>
|
||||
<SolidColorBrush x:Key="FsLossRasterizeBg" Color="{StaticResource FsLossRasterizeBgColor}"/>
|
||||
|
||||
<!-- 카테고리 뱃지 (진단 창) -->
|
||||
<Color x:Key="FsBadgeImageBrushColor">#005FB8</Color>
|
||||
<SolidColorBrush x:Key="FsBadgeImageBrush" Color="{StaticResource FsBadgeImageBrushColor}"/>
|
||||
<Color x:Key="FsBadgeImageBgColor">#1A005FB8</Color>
|
||||
<SolidColorBrush x:Key="FsBadgeImageBg" Color="{StaticResource FsBadgeImageBgColor}"/>
|
||||
<Color x:Key="FsBadgeDocBrushColor">#0F7B0F</Color>
|
||||
<SolidColorBrush x:Key="FsBadgeDocBrush" Color="{StaticResource FsBadgeDocBrushColor}"/>
|
||||
<Color x:Key="FsBadgeDocBgColor">#1A0F7B0F</Color>
|
||||
<SolidColorBrush x:Key="FsBadgeDocBg" Color="{StaticResource FsBadgeDocBgColor}"/>
|
||||
<Color x:Key="FsBadgeVideoBrushColor">#9D5D00</Color>
|
||||
<SolidColorBrush x:Key="FsBadgeVideoBrush" Color="{StaticResource FsBadgeVideoBrushColor}"/>
|
||||
<Color x:Key="FsBadgeVideoBgColor">#1A9D5D00</Color>
|
||||
<SolidColorBrush x:Key="FsBadgeVideoBg" Color="{StaticResource FsBadgeVideoBgColor}"/>
|
||||
<Color x:Key="FsBadgeAudioBrushColor">#8764B8</Color>
|
||||
<SolidColorBrush x:Key="FsBadgeAudioBrush" Color="{StaticResource FsBadgeAudioBrushColor}"/>
|
||||
<Color x:Key="FsBadgeAudioBgColor">#1A8764B8</Color>
|
||||
<SolidColorBrush x:Key="FsBadgeAudioBg" Color="{StaticResource FsBadgeAudioBgColor}"/>
|
||||
<Color x:Key="FsBadgeArchiveBrushColor">#C42B1C</Color>
|
||||
<SolidColorBrush x:Key="FsBadgeArchiveBrush" Color="{StaticResource FsBadgeArchiveBrushColor}"/>
|
||||
<Color x:Key="FsBadgeArchiveBgColor">#1AC42B1C</Color>
|
||||
<SolidColorBrush x:Key="FsBadgeArchiveBg" Color="{StaticResource FsBadgeArchiveBgColor}"/>
|
||||
|
||||
<!-- 파일 형식 색: 행의 형식 표식(선·점)에만 쓴다 -->
|
||||
<Color x:Key="FsFmtPdfColor">#E5484D</Color>
|
||||
<SolidColorBrush x:Key="FsFmtPdf" Color="{StaticResource FsFmtPdfColor}"/>
|
||||
<Color x:Key="FsFmtPngColor">#8E6CEF</Color>
|
||||
<SolidColorBrush x:Key="FsFmtPng" Color="{StaticResource FsFmtPngColor}"/>
|
||||
<Color x:Key="FsFmtHeicColor">#D69E2E</Color>
|
||||
<SolidColorBrush x:Key="FsFmtHeic" Color="{StaticResource FsFmtHeicColor}"/>
|
||||
<Color x:Key="FsFmtJpgColor">#3B82D8</Color>
|
||||
<SolidColorBrush x:Key="FsFmtJpg" Color="{StaticResource FsFmtJpgColor}"/>
|
||||
<Color x:Key="FsFmtDocxColor">#2B6CB0</Color>
|
||||
<SolidColorBrush x:Key="FsFmtDocx" Color="{StaticResource FsFmtDocxColor}"/>
|
||||
<Color x:Key="FsFmtHtmlColor">#DD6B20</Color>
|
||||
<SolidColorBrush x:Key="FsFmtHtml" Color="{StaticResource FsFmtHtmlColor}"/>
|
||||
<Color x:Key="FsFmtRawColor">#319795</Color>
|
||||
<SolidColorBrush x:Key="FsFmtRaw" Color="{StaticResource FsFmtRawColor}"/>
|
||||
<Color x:Key="FsFmtGifColor">#9F7AEA</Color>
|
||||
<SolidColorBrush x:Key="FsFmtGif" Color="{StaticResource FsFmtGifColor}"/>
|
||||
<Color x:Key="FsFmtTiffColor">#38B2AC</Color>
|
||||
<SolidColorBrush x:Key="FsFmtTiff" Color="{StaticResource FsFmtTiffColor}"/>
|
||||
<Color x:Key="FsFmtWebpColor">#48BB78</Color>
|
||||
<SolidColorBrush x:Key="FsFmtWebp" Color="{StaticResource FsFmtWebpColor}"/>
|
||||
<Color x:Key="FsFmtBmpColor">#718096</Color>
|
||||
<SolidColorBrush x:Key="FsFmtBmp" Color="{StaticResource FsFmtBmpColor}"/>
|
||||
<Color x:Key="FsFmtAvifColor">#ED64A6</Color>
|
||||
<SolidColorBrush x:Key="FsFmtAvif" Color="{StaticResource FsFmtAvifColor}"/>
|
||||
<Color x:Key="FsFmtHwpColor">#C53030</Color>
|
||||
<SolidColorBrush x:Key="FsFmtHwp" Color="{StaticResource FsFmtHwpColor}"/>
|
||||
<Color x:Key="FsFmtOtherColor">#718096</Color>
|
||||
<SolidColorBrush x:Key="FsFmtOther" Color="{StaticResource FsFmtOtherColor}"/>
|
||||
<Color x:Key="FsFmtCsvColor">#68A063</Color>
|
||||
<SolidColorBrush x:Key="FsFmtCsv" Color="{StaticResource FsFmtCsvColor}"/>
|
||||
<Color x:Key="FsFmtXlsxColor">#38A169</Color>
|
||||
<SolidColorBrush x:Key="FsFmtXlsx" Color="{StaticResource FsFmtXlsxColor}"/>
|
||||
<Color x:Key="FsFmtJsonColor">#E3B341</Color>
|
||||
<SolidColorBrush x:Key="FsFmtJson" Color="{StaticResource FsFmtJsonColor}"/>
|
||||
<Color x:Key="FsFmtSvgColor">#E05A9C</Color>
|
||||
<SolidColorBrush x:Key="FsFmtSvg" Color="{StaticResource FsFmtSvgColor}"/>
|
||||
<Color x:Key="FsFmtVideoColor">#FF7043</Color>
|
||||
<SolidColorBrush x:Key="FsFmtVideo" Color="{StaticResource FsFmtVideoColor}"/>
|
||||
<Color x:Key="FsFmtAudioColor">#B794F4</Color>
|
||||
<SolidColorBrush x:Key="FsFmtAudio" Color="{StaticResource FsFmtAudioColor}"/>
|
||||
</ResourceDictionary>
|
||||
|
|
@ -18,7 +18,7 @@
|
|||
</ResourceDictionary>
|
||||
</Window.Resources>
|
||||
|
||||
<Grid Background="{StaticResource FsBgBase}">
|
||||
<Grid Background="{DynamicResource FsBgBase}">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="*"/>
|
||||
|
|
@ -30,36 +30,34 @@
|
|||
<ScrollViewer Grid.Row="1" VerticalScrollBarVisibility="Auto" Padding="24,8,24,16">
|
||||
<StackPanel>
|
||||
<TextBlock Text="필요한 외부 도구를 설치합니다."
|
||||
Style="{StaticResource FsBodyStyle}" FontWeight="SemiBold" FontSize="16"/>
|
||||
Style="{StaticResource FsSubtitleStyle}"/>
|
||||
<TextBlock Text="변환에 필요한 외부 도구 목록입니다. 기본값은 모두 선택된 상태이며, 아래 버튼으로 한 번에 순차 설치합니다. 이미 설치된 도구는 설치 단계에서 확인만 됩니다. (H2Orestart는 라이선스상 자동 설치 대신 직접 추가가 필요합니다.)"
|
||||
Style="{StaticResource FsCaptionStyle}" TextWrapping="Wrap" Margin="0,4,0,16"/>
|
||||
|
||||
<ItemsControl ItemsSource="{Binding Tools}">
|
||||
<ItemsControl.ItemTemplate>
|
||||
<DataTemplate>
|
||||
<Border Style="{StaticResource FsDoubleBezelShellStyle}" Margin="0,0,0,10" HorizontalAlignment="Stretch">
|
||||
<Border Style="{StaticResource FsDoubleBezelCoreStyle}" Padding="16,12">
|
||||
<Border Style="{StaticResource FsCardStyle}" Margin="0,0,0,4" Padding="16,12" HorizontalAlignment="Stretch">
|
||||
<Grid>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
<ColumnDefinition Width="*"/>
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<CheckBox Grid.Column="0" IsChecked="{Binding IsSelected}"
|
||||
<CheckBox Grid.Column="0" MinWidth="0" Padding="0" IsChecked="{Binding IsSelected}"
|
||||
VerticalAlignment="Center" Margin="0,0,12,0"/>
|
||||
<StackPanel Grid.Column="1" Margin="0,0,12,0">
|
||||
<TextBlock Text="{Binding Name}" Style="{StaticResource FsBodyStyle}" FontWeight="Medium"/>
|
||||
<TextBlock Text="{Binding Name}" Style="{StaticResource FsSectionHeaderStyle}"/>
|
||||
<TextBlock Text="{Binding Description}" Style="{StaticResource FsCaptionStyle}"
|
||||
TextWrapping="Wrap" Margin="0,3,0,0"/>
|
||||
TextWrapping="Wrap" Margin="0,4,0,0"/>
|
||||
</StackPanel>
|
||||
<StackPanel Grid.Column="2" Orientation="Horizontal" VerticalAlignment="Center">
|
||||
<Ellipse Width="9" Height="9" Style="{StaticResource FsLossDotStyle}"
|
||||
Fill="{Binding StatusBrush}" VerticalAlignment="Center" Margin="0,0,7,0"/>
|
||||
<Ellipse Style="{StaticResource FsLossDotStyle}"
|
||||
Fill="{Binding StatusBrush}" VerticalAlignment="Center" Margin="0,0,8,0"/>
|
||||
<TextBlock Text="{Binding StatusText}" Style="{StaticResource FsCaptionStyle}"
|
||||
VerticalAlignment="Center"/>
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
</Border>
|
||||
</Border>
|
||||
</DataTemplate>
|
||||
</ItemsControl.ItemTemplate>
|
||||
|
|
@ -67,20 +65,19 @@
|
|||
</StackPanel>
|
||||
</ScrollViewer>
|
||||
|
||||
<Border Grid.Row="2" Background="{StaticResource FsBgPanel}"
|
||||
BorderBrush="{StaticResource FsBorderSubtle}" BorderThickness="0,1,0,0" Padding="24,14">
|
||||
<Border Grid.Row="2" Background="{DynamicResource FsBgLayer}"
|
||||
BorderBrush="{DynamicResource FsBorderSubtle}" BorderThickness="0,1,0,0" Padding="24,16">
|
||||
<Grid>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
<ColumnDefinition Width="*"/>
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<CheckBox Grid.Column="0" IsChecked="{Binding SelectAll}" Content="전체 선택"
|
||||
Foreground="{StaticResource FsTextSecondary}" VerticalAlignment="Center"/>
|
||||
<CheckBox Grid.Column="0" IsChecked="{Binding SelectAll}" Content="전체 선택" VerticalAlignment="Center"/>
|
||||
<StackPanel Grid.Column="2" Orientation="Horizontal" HorizontalAlignment="Right">
|
||||
<Button Content="나중에" Style="{StaticResource FsSecondaryButtonStyle}" Padding="20,8" Click="OnLater"/>
|
||||
<Button Content="나중에" Style="{StaticResource FsSecondaryButtonStyle}" Padding="24,0" Click="OnLater"/>
|
||||
<Button x:Name="InstallButton" Content="설치 시작"
|
||||
Style="{StaticResource FsPrimaryButtonStyle}" Padding="20,8" Margin="8,0,0,0" Click="OnInstall"/>
|
||||
Style="{StaticResource FsAccentButtonStyle}" Padding="24,0" Margin="8,0,0,0" Click="OnInstall"/>
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
</Border>
|
||||
|
|
|
|||
180
src/Everything2Everything.Core/Ads/AdHtmlBuilder.cs
Normal file
180
src/Everything2Everything.Core/Ads/AdHtmlBuilder.cs
Normal file
|
|
@ -0,0 +1,180 @@
|
|||
using System;
|
||||
using System.Text;
|
||||
using System.Text.Encodings.Web;
|
||||
|
||||
namespace Everything2Everything.Core.Ads;
|
||||
|
||||
/// <summary>
|
||||
/// Google AdMob / AdSense 실서비스 태그 및 리치 배너 HTML5 문서를 빌드하는 헬퍼
|
||||
/// </summary>
|
||||
public static class AdHtmlBuilder
|
||||
{
|
||||
public static string BuildBannerHtml(AdMobConfig config, AdItem ad)
|
||||
{
|
||||
var isTest = config.UseTestAds;
|
||||
if (isTest)
|
||||
{
|
||||
var sbTest = new StringBuilder();
|
||||
sbTest.AppendLine("<!DOCTYPE html>");
|
||||
sbTest.AppendLine("<html lang=\"ko\">");
|
||||
sbTest.AppendLine("<head>");
|
||||
sbTest.AppendLine("<meta charset=\"utf-8\">");
|
||||
sbTest.AppendLine("<meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\">");
|
||||
sbTest.AppendLine("<title>Google Official Test Ad</title>");
|
||||
sbTest.AppendLine("<script async src=\"https://securepubads.g.doubleclick.net/tag/js/gpt.js\"></script>");
|
||||
sbTest.AppendLine("<script>");
|
||||
sbTest.AppendLine(" window.googletag = window.googletag || {cmd: []};");
|
||||
sbTest.AppendLine(" googletag.cmd.push(function() {");
|
||||
sbTest.AppendLine(" googletag.defineSlot('/21775744923/example/banner', [728, 90], 'google-test-ad-slot')");
|
||||
sbTest.AppendLine(" .addService(googletag.pubads());");
|
||||
sbTest.AppendLine(" googletag.enableServices();");
|
||||
sbTest.AppendLine(" });");
|
||||
sbTest.AppendLine("</script>");
|
||||
sbTest.AppendLine("<style>");
|
||||
sbTest.AppendLine(" * { box-sizing: border-box; margin: 0; padding: 0; }");
|
||||
sbTest.AppendLine(" html, body { width: 100%; height: 100%; background: #0E1015; overflow: hidden; display: flex; justify-content: center; align-items: center; }");
|
||||
sbTest.AppendLine(" .outer-wrap { width: 100%; height: 100%; display: flex; justify-content: center; align-items: center; overflow: hidden; }");
|
||||
sbTest.AppendLine(" .scale-wrap { flex-shrink: 0; transform: scale(0.58); transform-origin: center center; display: flex; justify-content: center; align-items: center; }");
|
||||
sbTest.AppendLine(" #google-test-ad-slot { width: 728px; height: 90px; }");
|
||||
sbTest.AppendLine("</style>");
|
||||
sbTest.AppendLine("</head>");
|
||||
sbTest.AppendLine("<body>");
|
||||
sbTest.AppendLine("<div class=\"outer-wrap\">");
|
||||
sbTest.AppendLine(" <div class=\"scale-wrap\">");
|
||||
sbTest.AppendLine(" <div id=\"google-test-ad-slot\">");
|
||||
sbTest.AppendLine(" <script>");
|
||||
sbTest.AppendLine(" googletag.cmd.push(function() { googletag.display('google-test-ad-slot'); });");
|
||||
sbTest.AppendLine(" </script>");
|
||||
sbTest.AppendLine(" </div>");
|
||||
sbTest.AppendLine(" </div>");
|
||||
sbTest.AppendLine("</div>");
|
||||
sbTest.AppendLine("</body>");
|
||||
sbTest.AppendLine("</html>");
|
||||
return sbTest.ToString();
|
||||
}
|
||||
|
||||
var pubId = config.PublisherId.Trim();
|
||||
if (!pubId.StartsWith("pub-", StringComparison.OrdinalIgnoreCase) && !string.IsNullOrEmpty(pubId))
|
||||
{
|
||||
pubId = "pub-" + pubId;
|
||||
}
|
||||
var clientKey = string.IsNullOrEmpty(pubId) ? "ca-pub-3940256099942544" : "ca-" + pubId;
|
||||
|
||||
var slot = "6300978111"; // Google 공식 샘플 슬롯
|
||||
if (!string.IsNullOrEmpty(config.BannerAdUnitId))
|
||||
{
|
||||
var slashIdx = config.BannerAdUnitId.LastIndexOf('/');
|
||||
if (slashIdx >= 0 && slashIdx < config.BannerAdUnitId.Length - 1)
|
||||
{
|
||||
slot = config.BannerAdUnitId.Substring(slashIdx + 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
slot = config.BannerAdUnitId;
|
||||
}
|
||||
}
|
||||
|
||||
var title = HtmlEncoder.Default.Encode(ad.Title ?? (isTest ? "Nice job! Google AdMob 공식 테스트 광고" : "Google AdMob 공식 배너"));
|
||||
var desc = HtmlEncoder.Default.Encode(ad.Description ?? (isTest ? "[테스트 모드 활성] 단위: ca-app-pub-3940256099942544/6300978111" : "Everything2Everything 공식 후원 파트너십"));
|
||||
var targetUrl = ad.TargetUrl ?? (isTest ? "https://developers.google.com/admob/android/test-ads" : "https://admob.google.com");
|
||||
var ctaText = HtmlEncoder.Default.Encode(ad.CtaText ?? (isTest ? "테스트 안내" : "자세히 보기"));
|
||||
var badge = HtmlEncoder.Default.Encode(ad.BadgeText ?? (isTest ? "TEST AD" : "Google AdMob"));
|
||||
var testAttr = isTest ? " data-ad-test=\"on\"" : "";
|
||||
|
||||
var sb = new StringBuilder();
|
||||
sb.AppendLine("<!DOCTYPE html>");
|
||||
sb.AppendLine("<html lang=\"ko\">");
|
||||
sb.AppendLine("<head>");
|
||||
sb.AppendLine("<meta charset=\"utf-8\">");
|
||||
sb.AppendLine("<meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\">");
|
||||
sb.AppendLine("<title>Google AdMob Live Banner</title>");
|
||||
sb.AppendLine("<style>");
|
||||
sb.AppendLine(" * { box-sizing: border-box; margin: 0; padding: 0; user-select: none; }");
|
||||
sb.AppendLine(" html, body { width: 100%; height: 100%; background: #0E1015; overflow: hidden; font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI Variable Display', 'Segoe UI', Roboto, 'Malgun Gothic', sans-serif; }");
|
||||
sb.AppendLine(" .banner-wrap { width: 100%; height: 100%; position: relative; display: flex; align-items: center; justify-content: space-between; padding: 4px 10px; background: linear-gradient(90deg, #131722 0%, #1A2234 40%, #182030 100%); border: 1px solid rgba(0, 229, 255, 0.35); border-radius: 6px; cursor: pointer; transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1); box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08), 0 2px 8px rgba(0, 0, 0, 0.4); }");
|
||||
sb.AppendLine(" .banner-wrap:hover { border-color: #00E5FF; background: linear-gradient(90deg, #171E2D 0%, #202A40 40%, #1D2638 100%); box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.12), 0 4px 16px rgba(0, 229, 255, 0.2); }");
|
||||
sb.AppendLine(" .banner-wrap.test-mode { border-color: rgba(255, 179, 0, 0.45); }");
|
||||
sb.AppendLine(" .banner-wrap.test-mode:hover { border-color: #FFB300; box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.12), 0 4px 16px rgba(255, 179, 0, 0.25); }");
|
||||
sb.AppendLine(" .left-area { display: flex; align-items: center; gap: 8px; overflow: hidden; flex: 1; min-width: 0; }");
|
||||
sb.AppendLine(" .brand-pill { display: flex; align-items: center; gap: 4px; background: rgba(0, 229, 255, 0.15); border: 1px solid rgba(0, 229, 255, 0.4); padding: 2px 5px; border-radius: 4px; flex-shrink: 0; }");
|
||||
sb.AppendLine(" .brand-pill.test-mode { background: rgba(255, 179, 0, 0.2); border-color: #FFB300; }");
|
||||
sb.AppendLine(" .brand-pill-text { color: #00E5FF; font-size: 9px; font-weight: 700; }");
|
||||
sb.AppendLine(" .brand-pill.test-mode .brand-pill-text { color: #FFB300; font-weight: 800; }");
|
||||
sb.AppendLine(" .google-logo { width: 18px; height: 18px; flex-shrink: 0; }");
|
||||
sb.AppendLine(" .copy-wrap { display: flex; flex-direction: column; overflow: hidden; min-width: 0; flex: 1; justify-content: center; }");
|
||||
sb.AppendLine(" .ad-headline { color: #FFFFFF; font-size: 11px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; line-height: 1.2; }");
|
||||
sb.AppendLine(" .ad-subline { color: #94A3B8; font-size: 10px; margin-top: 1px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; line-height: 1.1; }");
|
||||
sb.AppendLine(" .cta-btn.test-mode { background: #FFB300; color: #07090E; box-shadow: 0 2px 6px rgba(255, 179, 0, 0.35); }");
|
||||
sb.AppendLine(" .banner-wrap.test-mode:hover .cta-btn.test-mode { background: #FFCA28; }");
|
||||
sb.AppendLine(" .action-area { display: flex; align-items: center; gap: 6px; flex-shrink: 0; margin-left: 8px; }");
|
||||
sb.AppendLine(" .cta-btn { background: #00E5FF; color: #07090E; font-size: 10px; font-weight: 700; padding: 4px 9px; border-radius: 4px; display: flex; align-items: center; gap: 3px; border: none; box-shadow: 0 2px 6px rgba(0, 229, 255, 0.35); }");
|
||||
sb.AppendLine(" .banner-wrap:hover .cta-btn { background: #33EBFF; transform: translateX(2px); }");
|
||||
sb.AppendLine(" .adchoices-tag { display: flex; align-items: center; gap: 2px; color: #64748B; font-size: 8px; padding: 2px 3px; border-radius: 3px; background: rgba(255, 255, 255, 0.04); flex-shrink: 0; }");
|
||||
sb.AppendLine(" .adchoices-tag:hover { color: #94A3B8; }");
|
||||
sb.AppendLine(" .live-ad-slot { position: absolute; top: 0; left: 0; width: 100%; height: 100%; z-index: 10; pointer-events: auto; }");
|
||||
sb.AppendLine(" @media (max-width: 480px) {");
|
||||
sb.AppendLine(" .adchoices-tag span { display: none; }");
|
||||
sb.AppendLine(" .brand-pill { display: none; }");
|
||||
sb.AppendLine(" .ad-headline { font-size: 11px; }");
|
||||
sb.AppendLine(" .ad-subline { font-size: 9.5px; }");
|
||||
sb.AppendLine(" }");
|
||||
sb.AppendLine("</style>");
|
||||
sb.Append("<script async src=\"https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?client=").Append(clientKey).AppendLine("\" crossorigin=\"anonymous\"></script>");
|
||||
sb.AppendLine("</head>");
|
||||
sb.AppendLine("<body onclick=\"handleAdClick()\">");
|
||||
sb.Append("<div class=\"banner-wrap").Append(isTest ? " test-mode" : "").AppendLine("\" id=\"adContainer\">");
|
||||
sb.AppendLine(" <div class=\"left-area\">");
|
||||
sb.AppendLine(" <!-- Google 4-Color Logo SVG -->");
|
||||
sb.AppendLine(" <svg class=\"google-logo\" viewBox=\"0 0 24 24\">");
|
||||
sb.AppendLine(" <path fill=\"#4285F4\" d=\"M23.745 12.27c0-.7-.06-1.4-.19-2.07H12v4.51h6.6c-.29 1.52-1.14 2.82-2.4 3.68v3.05h3.88c2.27-2.09 3.66-5.17 3.66-9.17z\"/>");
|
||||
sb.AppendLine(" <path fill=\"#34A853\" d=\"M12 24c3.24 0 5.95-1.08 7.93-2.91l-3.88-3.05c-1.08.72-2.45 1.16-4.05 1.16-3.12 0-5.77-2.1-6.72-4.93H1.24v3.15C3.26 21.36 7.33 24 12 24z\"/>");
|
||||
sb.AppendLine(" <path fill=\"#FBBC05\" d=\"M5.28 14.27c-.25-.72-.38-1.49-.38-2.27s.13-1.55.38-2.27V6.58H1.24C.45 8.15 0 9.91 0 12s.45 3.85 1.24 5.42l4.04-3.15z\"/>");
|
||||
sb.AppendLine(" <path fill=\"#EA4335\" d=\"M12 4.75c1.77 0 3.35.61 4.6 1.8l3.42-3.42C17.95 1.19 15.24 0 12 0 7.33 0 3.26 2.64 1.24 6.58l4.04 3.15c.95-2.83 3.6-4.98 6.72-4.98z\"/>");
|
||||
sb.AppendLine(" </svg>");
|
||||
sb.Append(" <div class=\"brand-pill").Append(isTest ? " test-mode" : "").AppendLine("\">");
|
||||
sb.Append(" <span class=\"brand-pill-text\">").Append(badge).AppendLine("</span>");
|
||||
sb.AppendLine(" </div>");
|
||||
sb.AppendLine(" <div class=\"copy-wrap\">");
|
||||
sb.Append(" <div class=\"ad-headline\">").Append(title).AppendLine("</div>");
|
||||
sb.Append(" <div class=\"ad-subline\">").Append(desc).AppendLine("</div>");
|
||||
sb.AppendLine(" </div>");
|
||||
sb.AppendLine(" </div>");
|
||||
sb.AppendLine(" <div class=\"action-area\">");
|
||||
sb.Append(" <div class=\"cta-btn").Append(isTest ? " test-mode" : "").AppendLine("\">");
|
||||
sb.Append(" <span>").Append(ctaText).AppendLine("</span>");
|
||||
sb.AppendLine(" <svg width=\"11\" height=\"11\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2.5\">");
|
||||
sb.AppendLine(" <path d=\"M5 12h14M12 5l7 7-7 7\"/>");
|
||||
sb.AppendLine(" </svg>");
|
||||
sb.AppendLine(" </div>");
|
||||
sb.AppendLine(" <div class=\"adchoices-tag\" title=\"Google AdChoices\">");
|
||||
sb.AppendLine(" <span>AdChoices</span>");
|
||||
sb.AppendLine(" <svg width=\"8\" height=\"8\" viewBox=\"0 0 24 24\" fill=\"currentColor\">");
|
||||
sb.AppendLine(" <path d=\"M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm1 15h-2v-6h2v6zm0-8h-2V7h2v2z\"/>");
|
||||
sb.AppendLine(" </svg>");
|
||||
sb.AppendLine(" </div>");
|
||||
sb.AppendLine(" </div>");
|
||||
sb.AppendLine(" <!-- Google Live Ads Slot -->");
|
||||
sb.AppendLine(" <div class=\"live-ad-slot\" id=\"googleAdSlot\">");
|
||||
sb.Append(" <ins class=\"adsbygoogle\" style=\"display:block;width:100%;height:100%\" data-ad-client=\"").Append(clientKey).Append("\" data-ad-slot=\"").Append(slot).Append("\" data-ad-format=\"horizontal\"").Append(testAttr).AppendLine("></ins>");
|
||||
sb.AppendLine(" </div>");
|
||||
sb.AppendLine("</div>");
|
||||
sb.AppendLine("<script>");
|
||||
sb.AppendLine(" function handleAdClick(e) {");
|
||||
sb.Append(" var url = \"").Append(targetUrl).AppendLine("\";");
|
||||
sb.AppendLine(" if (window.chrome && window.chrome.webview) {");
|
||||
sb.AppendLine(" window.chrome.webview.postMessage(JSON.stringify({ action: 'open_url', url: url }));");
|
||||
sb.AppendLine(" } else {");
|
||||
sb.AppendLine(" window.open(url, '_blank');");
|
||||
sb.AppendLine(" }");
|
||||
sb.AppendLine(" }");
|
||||
sb.AppendLine(" try {");
|
||||
sb.AppendLine(" (adsbygoogle = window.adsbygoogle || []).push({});");
|
||||
sb.AppendLine(" var slot = document.getElementById('googleAdSlot');");
|
||||
sb.AppendLine(" if (slot && slot.querySelector('iframe')) { slot.style.display = 'block'; }");
|
||||
sb.AppendLine(" } catch (e) { }");
|
||||
sb.AppendLine("</script>");
|
||||
sb.AppendLine("</body>");
|
||||
sb.AppendLine("</html>");
|
||||
return sb.ToString();
|
||||
}
|
||||
}
|
||||
|
|
@ -18,4 +18,5 @@ public class AdItem
|
|||
public AdType Type { get; set; } = AdType.Banner;
|
||||
public bool IsActive { get; set; } = true;
|
||||
public int DisplayOrder { get; set; } = 0;
|
||||
public string? HtmlContent { get; set; }
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,3 +1,5 @@
|
|||
using System;
|
||||
|
||||
namespace Everything2Everything.Core.Ads;
|
||||
|
||||
/// <summary>
|
||||
|
|
@ -5,6 +7,15 @@ namespace Everything2Everything.Core.Ads;
|
|||
/// </summary>
|
||||
public class AdMobConfig
|
||||
{
|
||||
/// <summary>Google 공식 표준 Android 샘플 앱 ID</summary>
|
||||
public const string SampleAppId = "ca-app-pub-3940256099942544~3347511713";
|
||||
|
||||
/// <summary>Google 공식 표준 Android 샘플 배너 광고 단위 ID</summary>
|
||||
public const string SampleBannerId = "ca-app-pub-3940256099942544/6300978111";
|
||||
|
||||
/// <summary>Google 공식 표준 Android 샘플 전면 광고 단위 ID</summary>
|
||||
public const string SampleInterstitialId = "ca-app-pub-3940256099942544/1033173712";
|
||||
|
||||
/// <summary>Google AdMob 게시자 ID (예: pub-XXXXXXXXXXXXXXXX)</summary>
|
||||
public string PublisherId { get; set; } = string.Empty;
|
||||
|
||||
|
|
@ -17,6 +28,21 @@ public class AdMobConfig
|
|||
/// <summary>전면/대형 카드 광고 단위 ID (형식: ca-app-pub-XXXXXXXXXXXXXXXX/ZZZZZZZZZZ)</summary>
|
||||
public string InterstitialAdUnitId { get; set; } = string.Empty;
|
||||
|
||||
/// <summary>Google 공식 테스트 광고 모드 사용 여부 (기본값: true)</summary>
|
||||
public bool UseTestAds { get; set; } = true;
|
||||
|
||||
/// <summary>실제 표시할 유효 배너 광고 단위 ID</summary>
|
||||
public string EffectiveBannerId => UseTestAds || string.IsNullOrWhiteSpace(BannerAdUnitId)
|
||||
? SampleBannerId
|
||||
: BannerAdUnitId.Trim();
|
||||
|
||||
/// <summary>실제 표시할 유효 전면 광고 단위 ID (미설정 시 실서비스 배너 단위 ID로 자동 폴백)</summary>
|
||||
public string EffectiveInterstitialId => UseTestAds
|
||||
? SampleInterstitialId
|
||||
: (!string.IsNullOrWhiteSpace(InterstitialAdUnitId)
|
||||
? InterstitialAdUnitId.Trim()
|
||||
: (!string.IsNullOrWhiteSpace(BannerAdUnitId) ? BannerAdUnitId.Trim() : SampleInterstitialId));
|
||||
|
||||
/// <summary>
|
||||
/// Google 공식 규격의 app-ads.txt 문자열 생성
|
||||
/// 형식: google.com, pub-XXXXXXXXXXXXXXXX, DIRECT, f08c47fec0942fa0
|
||||
|
|
@ -24,11 +50,16 @@ public class AdMobConfig
|
|||
public string GenerateAppAdsTxt()
|
||||
{
|
||||
var pubId = PublisherId.Trim();
|
||||
if (!pubId.StartsWith("pub-", System.StringComparison.OrdinalIgnoreCase) && !string.IsNullOrEmpty(pubId))
|
||||
if (!pubId.StartsWith("pub-", StringComparison.OrdinalIgnoreCase) && !string.IsNullOrEmpty(pubId))
|
||||
{
|
||||
pubId = "pub-" + pubId;
|
||||
}
|
||||
|
||||
if (string.IsNullOrEmpty(pubId))
|
||||
{
|
||||
pubId = "pub-0000000000000000";
|
||||
}
|
||||
|
||||
return $"google.com, {pubId}, DIRECT, f08c47fec0942fa0";
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,8 +1,10 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Net.Http;
|
||||
using System.Text;
|
||||
using System.Text.Json;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
|
|
@ -14,12 +16,46 @@ public class AdService : IAdService
|
|||
private static readonly HttpClient HttpClient = new() { Timeout = TimeSpan.FromSeconds(5) };
|
||||
private readonly List<AdItem> _ads = new();
|
||||
private readonly object _lock = new();
|
||||
private AdMobConfig _adMobConfig = new();
|
||||
private int _bannerIndex = 0;
|
||||
private int _largeCardIndex = 0;
|
||||
|
||||
public AdService()
|
||||
public AdMobConfig CurrentConfig
|
||||
{
|
||||
get
|
||||
{
|
||||
lock (_lock)
|
||||
{
|
||||
return _adMobConfig;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public AdService(ISettingsStore? settings = null)
|
||||
{
|
||||
if (settings != null)
|
||||
{
|
||||
var pubId = settings.Get("admob.publisherid");
|
||||
var appId = settings.Get("admob.appid");
|
||||
var bannerId = settings.Get("admob.bannerid");
|
||||
var interstitialId = settings.Get("admob.interstitialid");
|
||||
var useTestStr = settings.Get("admob.usetestads");
|
||||
|
||||
if (!string.IsNullOrEmpty(pubId) || !string.IsNullOrEmpty(bannerId))
|
||||
{
|
||||
_adMobConfig = new AdMobConfig
|
||||
{
|
||||
PublisherId = pubId ?? string.Empty,
|
||||
AppId = appId ?? string.Empty,
|
||||
BannerAdUnitId = bannerId ?? string.Empty,
|
||||
InterstitialAdUnitId = interstitialId ?? string.Empty,
|
||||
UseTestAds = useTestStr != "false"
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
InitializeDefaultAds();
|
||||
ApplyAdMobAds();
|
||||
}
|
||||
|
||||
private void InitializeDefaultAds()
|
||||
|
|
@ -88,6 +124,77 @@ public class AdService : IAdService
|
|||
}
|
||||
}
|
||||
|
||||
private void ApplyAdMobAds()
|
||||
{
|
||||
lock (_lock)
|
||||
{
|
||||
_ads.RemoveAll(a => a.Id.StartsWith("admob-"));
|
||||
|
||||
var isTest = _adMobConfig.UseTestAds;
|
||||
var bannerId = _adMobConfig.EffectiveBannerId;
|
||||
var interstitialId = _adMobConfig.EffectiveInterstitialId;
|
||||
|
||||
// Google AdMob 배너 광고 단위 (최우선 순위 DisplayOrder: 0)
|
||||
var bannerAd = new AdItem
|
||||
{
|
||||
Id = "admob-banner-1",
|
||||
Title = isTest ? "Nice job! Google AdMob 공식 테스트 광고" : "Google AdMob 공식 배너",
|
||||
Description = isTest ? $"[테스트 모드] 단위: {bannerId}" : $"[실서비스] 단위: {bannerId}",
|
||||
BadgeText = isTest ? "TEST AD" : "Google AdMob",
|
||||
ImageUrl = "pack://application:,,,/Everything2Everything;component/Assets/logo-mark.png",
|
||||
TargetUrl = "https://admob.google.com",
|
||||
CtaText = isTest ? "테스트 안내" : "광고 안내",
|
||||
Type = AdType.Banner,
|
||||
IsActive = true,
|
||||
DisplayOrder = 0
|
||||
};
|
||||
bannerAd.HtmlContent = AdHtmlBuilder.BuildBannerHtml(_adMobConfig, bannerAd);
|
||||
_ads.Add(bannerAd);
|
||||
|
||||
// Google AdMob 전면/대형 카드 광고 단위 (최우선 순위 DisplayOrder: 0)
|
||||
var largeCardAd = new AdItem
|
||||
{
|
||||
Id = "admob-large-card-1",
|
||||
Title = isTest ? "Google AdMob 테스트 광고" : "Google AdMob 전면 솔루션",
|
||||
Description = isTest
|
||||
? $"Google 공식 테스트 광고 단위가 안전하게 연결되어 있습니다.\n광고 단위: {interstitialId}"
|
||||
: $"Google AdMob 실서비스 광고 단위가 연동되어 있습니다.\n광고 단위: {interstitialId}",
|
||||
BadgeText = isTest ? "TEST AD" : "Google AdMob",
|
||||
ImageUrl = "pack://application:,,,/Everything2Everything;component/Assets/logo-mark.png",
|
||||
TargetUrl = "https://admob.google.com",
|
||||
CtaText = isTest ? "테스트 안내" : "AdMob 살펴보기",
|
||||
Type = AdType.LargeCard,
|
||||
IsActive = true,
|
||||
DisplayOrder = 0
|
||||
};
|
||||
largeCardAd.HtmlContent = AdHtmlBuilder.BuildBannerHtml(_adMobConfig, largeCardAd);
|
||||
_ads.Add(largeCardAd);
|
||||
}
|
||||
}
|
||||
|
||||
public void UpdateAdMobConfig(AdMobConfig config)
|
||||
{
|
||||
lock (_lock)
|
||||
{
|
||||
_adMobConfig = config ?? new AdMobConfig();
|
||||
ApplyAdMobAds();
|
||||
}
|
||||
}
|
||||
|
||||
public void ExportAppAdsTxt(string destinationFilePath)
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(destinationFilePath)) return;
|
||||
|
||||
var directory = Path.GetDirectoryName(destinationFilePath);
|
||||
if (!string.IsNullOrEmpty(directory) && !Directory.Exists(directory))
|
||||
{
|
||||
Directory.CreateDirectory(directory);
|
||||
}
|
||||
|
||||
var content = CurrentConfig.GenerateAppAdsTxt();
|
||||
File.WriteAllText(destinationFilePath, content, Encoding.UTF8);
|
||||
}
|
||||
|
||||
public IReadOnlyList<AdItem> GetBannerAds()
|
||||
{
|
||||
lock (_lock)
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@ namespace Everything2Everything.Core.Ads;
|
|||
|
||||
public interface IAdService
|
||||
{
|
||||
AdMobConfig CurrentConfig { get; }
|
||||
IReadOnlyList<AdItem> GetBannerAds();
|
||||
IReadOnlyList<AdItem> GetLargeCardAds();
|
||||
AdItem? GetNextBannerAd();
|
||||
|
|
@ -13,4 +14,6 @@ public interface IAdService
|
|||
Task<int> RefreshAdsFromFeedAsync(string feedUrl, CancellationToken cancellationToken = default);
|
||||
int LoadAdsFromJson(string json);
|
||||
bool OpenAdUrl(AdItem ad);
|
||||
void UpdateAdMobConfig(AdMobConfig config);
|
||||
void ExportAppAdsTxt(string destinationFilePath);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -209,11 +209,10 @@ public sealed class HtmlProvider : IConverterProvider
|
|||
{
|
||||
CoreWebView2Controller? controller = null;
|
||||
HwndSource? hwndSource = null;
|
||||
string? userDataFolder = null;
|
||||
try
|
||||
{
|
||||
var userDataFolder = Path.Combine(
|
||||
Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData),
|
||||
"Everything2Everything", "WebView2");
|
||||
userDataFolder = Path.Combine(Path.GetTempPath(), "E2E_WV2_" + Guid.NewGuid().ToString("N"));
|
||||
Directory.CreateDirectory(userDataFolder);
|
||||
|
||||
var env = await CoreWebView2Environment.CreateAsync(null, userDataFolder);
|
||||
|
|
@ -268,6 +267,21 @@ public sealed class HtmlProvider : IConverterProvider
|
|||
{
|
||||
try { controller?.Close(); } catch { }
|
||||
try { hwndSource?.Dispose(); } catch { }
|
||||
if (userDataFolder != null)
|
||||
{
|
||||
_ = Task.Run(async () =>
|
||||
{
|
||||
await Task.Delay(1500).ConfigureAwait(false);
|
||||
try
|
||||
{
|
||||
if (Directory.Exists(userDataFolder))
|
||||
{
|
||||
Directory.Delete(userDataFolder, true);
|
||||
}
|
||||
}
|
||||
catch { }
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
135
src/Everything2Everything.Tests/AdBannerHtmlBuilderTests.cs
Normal file
135
src/Everything2Everything.Tests/AdBannerHtmlBuilderTests.cs
Normal file
|
|
@ -0,0 +1,135 @@
|
|||
using System;
|
||||
using Everything2Everything.Core.Ads;
|
||||
using Xunit;
|
||||
|
||||
namespace Everything2Everything.Tests;
|
||||
|
||||
public class AdBannerHtmlBuilderTests
|
||||
{
|
||||
[Fact]
|
||||
public void BuildBannerHtml_WithProductionConfig_ContainsGoogleAdSenseScriptAndSlot()
|
||||
{
|
||||
var config = new AdMobConfig
|
||||
{
|
||||
PublisherId = "pub-1039714767792854",
|
||||
AppId = "ca-app-pub-1039714767792854~8501191529",
|
||||
BannerAdUnitId = "ca-app-pub-1039714767792854/9666933530",
|
||||
UseTestAds = false
|
||||
};
|
||||
|
||||
var ad = new AdItem
|
||||
{
|
||||
Id = "admob-banner-1",
|
||||
Title = "Google Cloud & AI",
|
||||
Description = "개발자를 위한 차세대 AI 클라우드 인프라",
|
||||
TargetUrl = "https://cloud.google.com",
|
||||
BadgeText = "Google AdMob"
|
||||
};
|
||||
|
||||
var html = AdHtmlBuilder.BuildBannerHtml(config, ad);
|
||||
|
||||
Assert.NotNull(html);
|
||||
Assert.NotEmpty(html);
|
||||
Assert.Contains("adsbygoogle.js", html);
|
||||
Assert.Contains("ca-pub-1039714767792854", html);
|
||||
Assert.Contains("9666933530", html);
|
||||
Assert.Contains("Google Cloud", html);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void BuildBannerHtml_WithTestConfig_RendersOfficialGooglePublisherTagAndTestSlot()
|
||||
{
|
||||
var config = new AdMobConfig
|
||||
{
|
||||
PublisherId = "pub-1039714767792854",
|
||||
UseTestAds = true
|
||||
};
|
||||
|
||||
var ad = new AdItem
|
||||
{
|
||||
Id = "test-ad",
|
||||
Title = "테스트 광고",
|
||||
Description = "테스트 배너입니다."
|
||||
};
|
||||
|
||||
var html = AdHtmlBuilder.BuildBannerHtml(config, ad);
|
||||
|
||||
Assert.Contains("securepubads.g.doubleclick.net/tag/js/gpt.js", html);
|
||||
Assert.Contains("/21775744923/example/banner", html);
|
||||
Assert.Contains("googletag.defineSlot", html);
|
||||
Assert.Contains("googletag.enableServices()", html);
|
||||
}
|
||||
|
||||
private sealed class FakeSettingsStore : Everything2Everything.Core.ISettingsStore
|
||||
{
|
||||
private readonly System.Collections.Generic.Dictionary<string, string> _d = new();
|
||||
public string? Get(string key) => _d.TryGetValue(key, out var v) ? v : null;
|
||||
public void Set(string key, string value) => _d[key] = value;
|
||||
public void Remove(string key) => _d.Remove(key);
|
||||
public bool Contains(string key) => _d.ContainsKey(key);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void AdService_WhenConfigured_PopulatesHtmlContentInAdItems()
|
||||
{
|
||||
var store = new FakeSettingsStore();
|
||||
store.Set("admob.publisherid", "pub-1039714767792854");
|
||||
store.Set("admob.bannerid", "ca-app-pub-1039714767792854/9666933530");
|
||||
store.Set("admob.usetestads", "false");
|
||||
|
||||
var service = new AdService(store);
|
||||
var banners = service.GetBannerAds();
|
||||
var banner = banners[0];
|
||||
|
||||
Assert.NotNull(banner.HtmlContent);
|
||||
Assert.Contains("ca-pub-1039714767792854", banner.HtmlContent);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void BuildBannerHtml_ContainsLiveGoogleAdInsTagWithDisplayBlock()
|
||||
{
|
||||
var config = new AdMobConfig
|
||||
{
|
||||
PublisherId = "pub-1039714767792854",
|
||||
BannerAdUnitId = "ca-app-pub-1039714767792854/9666933530",
|
||||
UseTestAds = false
|
||||
};
|
||||
|
||||
var ad = new AdItem
|
||||
{
|
||||
Id = "admob-banner-1",
|
||||
Title = "Google Cloud AI",
|
||||
Description = "엔터프라이즈 생성형 AI 인프라"
|
||||
};
|
||||
|
||||
var html = AdHtmlBuilder.BuildBannerHtml(config, ad);
|
||||
|
||||
Assert.Contains("display:block", html);
|
||||
Assert.DoesNotContain("display:none", html);
|
||||
Assert.Contains("AdChoices", html);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void BuildBannerHtml_WhenUseTestAdsIsTrue_RendersOfficialGooglePublisherTagSlot()
|
||||
{
|
||||
var config = new AdMobConfig
|
||||
{
|
||||
PublisherId = "pub-1039714767792854",
|
||||
BannerAdUnitId = "ca-app-pub-1039714767792854/9666933530",
|
||||
UseTestAds = true
|
||||
};
|
||||
|
||||
var ad = new AdItem
|
||||
{
|
||||
Id = "admob-banner-1",
|
||||
Title = "Google AdMob 공식 테스트 광고",
|
||||
BadgeText = "TEST AD"
|
||||
};
|
||||
|
||||
var html = AdHtmlBuilder.BuildBannerHtml(config, ad);
|
||||
|
||||
Assert.Contains("securepubads.g.doubleclick.net/tag/js/gpt.js", html);
|
||||
Assert.Contains("/21775744923/example/banner", html);
|
||||
Assert.Contains("googletag.display", html);
|
||||
}
|
||||
}
|
||||
255
src/Everything2Everything.Tests/AdMobServiceIntegrationTests.cs
Normal file
255
src/Everything2Everything.Tests/AdMobServiceIntegrationTests.cs
Normal file
|
|
@ -0,0 +1,255 @@
|
|||
using System.IO;
|
||||
using System.Linq;
|
||||
using Everything2Everything.Core.Ads;
|
||||
using Xunit;
|
||||
|
||||
namespace Everything2Everything.Tests;
|
||||
|
||||
[Collection("SettingsStoreTests")]
|
||||
public class AdMobServiceIntegrationTests
|
||||
{
|
||||
[Fact]
|
||||
public void AdMobConfig_EffectiveBannerId_WhenUseTestAdsTrue_ReturnsSampleBannerId()
|
||||
{
|
||||
var config = new AdMobConfig
|
||||
{
|
||||
UseTestAds = true,
|
||||
BannerAdUnitId = "ca-app-pub-9999999999999999/8888888888"
|
||||
};
|
||||
|
||||
Assert.Equal(AdMobConfig.SampleBannerId, config.EffectiveBannerId);
|
||||
Assert.Equal(AdMobConfig.SampleInterstitialId, config.EffectiveInterstitialId);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void AdMobConfig_EffectiveBannerId_WhenUseTestAdsFalse_ReturnsCustomBannerId()
|
||||
{
|
||||
var customBanner = "ca-app-pub-1234567890123456/1234567890";
|
||||
var customInterstitial = "ca-app-pub-1234567890123456/0987654321";
|
||||
|
||||
var config = new AdMobConfig
|
||||
{
|
||||
UseTestAds = false,
|
||||
BannerAdUnitId = customBanner,
|
||||
InterstitialAdUnitId = customInterstitial
|
||||
};
|
||||
|
||||
Assert.Equal(customBanner, config.EffectiveBannerId);
|
||||
Assert.Equal(customInterstitial, config.EffectiveInterstitialId);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void AdService_CurrentConfig_InitializedByDefault()
|
||||
{
|
||||
var service = new AdService();
|
||||
|
||||
Assert.NotNull(service.CurrentConfig);
|
||||
Assert.True(service.CurrentConfig.UseTestAds);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void AdService_GetBannerAds_ContainsAdMobBanner()
|
||||
{
|
||||
var service = new AdService();
|
||||
var banners = service.GetBannerAds();
|
||||
|
||||
Assert.Contains(banners, b => b.Id.StartsWith("admob-banner") || b.BadgeText.Contains("AdMob"));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void AdService_UpdateAdMobConfig_UpdatesActiveAds()
|
||||
{
|
||||
var service = new AdService();
|
||||
var newConfig = new AdMobConfig
|
||||
{
|
||||
PublisherId = "pub-8888888888888888",
|
||||
AppId = "ca-app-pub-8888888888888888~1234567890",
|
||||
BannerAdUnitId = "ca-app-pub-8888888888888888/1111111111",
|
||||
UseTestAds = false
|
||||
};
|
||||
|
||||
service.UpdateAdMobConfig(newConfig);
|
||||
|
||||
Assert.Equal("pub-8888888888888888", service.CurrentConfig.PublisherId);
|
||||
Assert.False(service.CurrentConfig.UseTestAds);
|
||||
|
||||
var banners = service.GetBannerAds();
|
||||
var admobBanner = banners.FirstOrDefault(b => b.Id.StartsWith("admob-banner"));
|
||||
Assert.NotNull(admobBanner);
|
||||
Assert.Contains("ca-app-pub-8888888888888888/1111111111", admobBanner.Description);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void AdService_ExportAppAdsTxt_CreatesValidFile()
|
||||
{
|
||||
var service = new AdService();
|
||||
var tempFile = Path.Combine(Path.GetTempPath(), $"app-ads-test-{System.Guid.NewGuid():N}.txt");
|
||||
|
||||
try
|
||||
{
|
||||
service.CurrentConfig.PublisherId = "pub-5555555555555555";
|
||||
service.ExportAppAdsTxt(tempFile);
|
||||
|
||||
Assert.True(File.Exists(tempFile));
|
||||
var content = File.ReadAllText(tempFile);
|
||||
Assert.Contains("google.com, pub-5555555555555555, DIRECT, f08c47fec0942fa0", content);
|
||||
}
|
||||
finally
|
||||
{
|
||||
if (File.Exists(tempFile))
|
||||
{
|
||||
File.Delete(tempFile);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private sealed class FakeSettingsStore : Everything2Everything.Core.ISettingsStore
|
||||
{
|
||||
private readonly System.Collections.Generic.Dictionary<string, string> _d = new();
|
||||
public string? Get(string key) => _d.TryGetValue(key, out var v) ? v : null;
|
||||
public void Set(string key, string value) => _d[key] = value;
|
||||
public void Remove(string key) => _d.Remove(key);
|
||||
public bool Contains(string key) => _d.ContainsKey(key);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void AdService_WithSettingsStore_LoadsConfigFromStore()
|
||||
{
|
||||
var settings = new FakeSettingsStore();
|
||||
settings.Set("admob.publisherid", "pub-1039714767792854");
|
||||
settings.Set("admob.appid", "ca-app-pub-1039714767792854~8501191529");
|
||||
settings.Set("admob.bannerid", "ca-app-pub-1039714767792854/9666933530");
|
||||
settings.Set("admob.usetestads", "false");
|
||||
|
||||
var service = new AdService(settings);
|
||||
|
||||
Assert.Equal("pub-1039714767792854", service.CurrentConfig.PublisherId);
|
||||
Assert.Equal("ca-app-pub-1039714767792854~8501191529", service.CurrentConfig.AppId);
|
||||
Assert.Equal("ca-app-pub-1039714767792854/9666933530", service.CurrentConfig.BannerAdUnitId);
|
||||
Assert.False(service.CurrentConfig.UseTestAds);
|
||||
|
||||
var banners = service.GetBannerAds();
|
||||
var banner = banners.FirstOrDefault(b => b.Id == "admob-banner-1");
|
||||
Assert.NotNull(banner);
|
||||
Assert.Equal("Google AdMob", banner.BadgeText);
|
||||
Assert.Contains("ca-app-pub-1039714767792854/9666933530", banner.Description);
|
||||
Assert.Contains("[실서비스]", banner.Description);
|
||||
|
||||
var largeCards = service.GetLargeCardAds();
|
||||
var card = largeCards.FirstOrDefault(c => c.Id == "admob-large-card-1");
|
||||
Assert.NotNull(card);
|
||||
Assert.Equal("Google AdMob", card.BadgeText);
|
||||
Assert.Contains("ca-app-pub-1039714767792854/9666933530", card.Description);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void AdService_WhenUseTestAdsTrue_SetsTestAdBadgeAndSampleBannerDescription()
|
||||
{
|
||||
var settings = new FakeSettingsStore();
|
||||
settings.Set("admob.publisherid", "pub-1039714767792854");
|
||||
settings.Set("admob.appid", "ca-app-pub-1039714767792854~8501191529");
|
||||
settings.Set("admob.bannerid", "ca-app-pub-1039714767792854/9666933530");
|
||||
settings.Set("admob.usetestads", "true");
|
||||
|
||||
var service = new AdService(settings);
|
||||
|
||||
Assert.True(service.CurrentConfig.UseTestAds);
|
||||
|
||||
var banners = service.GetBannerAds();
|
||||
var banner = banners.FirstOrDefault(b => b.Id == "admob-banner-1");
|
||||
Assert.NotNull(banner);
|
||||
Assert.Equal("TEST AD", banner.BadgeText);
|
||||
Assert.Contains(AdMobConfig.SampleBannerId, banner.Description);
|
||||
Assert.Contains("[테스트 모드]", banner.Description);
|
||||
|
||||
var largeCards = service.GetLargeCardAds();
|
||||
var card = largeCards.FirstOrDefault(c => c.Id == "admob-large-card-1");
|
||||
Assert.NotNull(card);
|
||||
Assert.Equal("TEST AD", card.BadgeText);
|
||||
Assert.Contains(AdMobConfig.SampleInterstitialId, card.Description);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ApplyProductionAdMobKeysToLocalSettings()
|
||||
{
|
||||
var store = new Everything2Everything.Core.DpapiSettingsStore();
|
||||
store.Set("setup.tools.done", "1");
|
||||
store.Set("admob.publisherid", "pub-1039714767792854");
|
||||
store.Set("admob.appid", "ca-app-pub-1039714767792854~8501191529");
|
||||
store.Set("admob.bannerid", "ca-app-pub-1039714767792854/9666933530");
|
||||
store.Set("admob.usetestads", "false");
|
||||
|
||||
Assert.Equal("1", store.Get("setup.tools.done"));
|
||||
Assert.Equal("pub-1039714767792854", store.Get("admob.publisherid"));
|
||||
Assert.Equal("ca-app-pub-1039714767792854~8501191529", store.Get("admob.appid"));
|
||||
Assert.Equal("ca-app-pub-1039714767792854/9666933530", store.Get("admob.bannerid"));
|
||||
Assert.Equal("false", store.Get("admob.usetestads"));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void MainWindow_WithProductionAdMobKeys_RendersLiveBannerCorrectly()
|
||||
{
|
||||
System.Exception? ex = null;
|
||||
var thread = new System.Threading.Thread(() =>
|
||||
{
|
||||
try
|
||||
{
|
||||
if (System.Windows.Application.Current == null)
|
||||
{
|
||||
try { _ = new System.Windows.Application(); } catch (System.InvalidOperationException) { }
|
||||
}
|
||||
|
||||
var store = new FakeSettingsStore();
|
||||
store.Set("setup.tools.done", "1");
|
||||
store.Set("admob.publisherid", "pub-1039714767792854");
|
||||
store.Set("admob.appid", "ca-app-pub-1039714767792854~8501191529");
|
||||
store.Set("admob.bannerid", "ca-app-pub-1039714767792854/9666933530");
|
||||
store.Set("admob.usetestads", "false");
|
||||
|
||||
var engine = Everything2Everything.Core.Everything2EverythingBootstrap.CreateDefault();
|
||||
var adService = new AdService(store);
|
||||
var win = new Everything2Everything.App.Views.MainWindow(engine, store, null, adService);
|
||||
|
||||
Assert.NotNull(win.AdVm);
|
||||
Assert.NotNull(win.AdVm.CurrentBannerAd);
|
||||
Assert.Equal("Google AdMob", win.AdVm.CurrentBannerAd.BadgeText);
|
||||
Assert.Contains("ca-app-pub-1039714767792854/9666933530", win.AdVm.CurrentBannerAd.Description);
|
||||
Assert.Contains("[실서비스]", win.AdVm.CurrentBannerAd.Description);
|
||||
|
||||
Assert.NotNull(win.AdVm.CurrentLargeAd);
|
||||
Assert.Equal("Google AdMob", win.AdVm.CurrentLargeAd.BadgeText);
|
||||
|
||||
// In-memory Measure & Arrange & Render
|
||||
win.DataContext = win;
|
||||
win.Measure(new System.Windows.Size(1280, 960));
|
||||
win.Arrange(new System.Windows.Rect(0, 0, 1280, 960));
|
||||
win.UpdateLayout();
|
||||
|
||||
var rtb = new System.Windows.Media.Imaging.RenderTargetBitmap(1280, 960, 96, 96, System.Windows.Media.PixelFormats.Pbgra32);
|
||||
rtb.Render(win);
|
||||
|
||||
var encoder = new System.Windows.Media.Imaging.PngBitmapEncoder();
|
||||
encoder.Frames.Add(System.Windows.Media.Imaging.BitmapFrame.Create(rtb));
|
||||
|
||||
var outDir = @"C:\Users\encep\.gemini\antigravity\brain\d29807c7-c1a7-4fd6-9992-18e86e3d77bf\scratch";
|
||||
if (!System.IO.Directory.Exists(outDir)) System.IO.Directory.CreateDirectory(outDir);
|
||||
var outPath = System.IO.Path.Combine(outDir, "production_admob_live_rendered.png");
|
||||
using (var fs = new System.IO.FileStream(outPath, System.IO.FileMode.Create, System.IO.FileAccess.Write, System.IO.FileShare.ReadWrite))
|
||||
{
|
||||
encoder.Save(fs);
|
||||
}
|
||||
|
||||
Assert.True(System.IO.File.Exists(outPath));
|
||||
}
|
||||
catch (System.Exception e)
|
||||
{
|
||||
ex = e;
|
||||
}
|
||||
});
|
||||
thread.SetApartmentState(System.Threading.ApartmentState.STA);
|
||||
thread.Start();
|
||||
thread.Join();
|
||||
|
||||
if (ex != null) throw ex;
|
||||
}
|
||||
}
|
||||
|
|
@ -22,8 +22,11 @@ public class AdServiceTests
|
|||
Assert.False(string.IsNullOrWhiteSpace(ad.Title));
|
||||
Assert.False(string.IsNullOrWhiteSpace(ad.Description));
|
||||
Assert.False(string.IsNullOrWhiteSpace(ad.TargetUrl));
|
||||
Assert.Contains("git.chanpaca.net", ad.TargetUrl);
|
||||
Assert.StartsWith("http", ad.TargetUrl);
|
||||
});
|
||||
|
||||
Assert.Contains(bannerAds, ad => ad.TargetUrl.Contains("git.chanpaca.net"));
|
||||
Assert.Contains(bannerAds, ad => ad.TargetUrl.Contains("admob.google.com"));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
|
|
@ -40,8 +43,11 @@ public class AdServiceTests
|
|||
Assert.False(string.IsNullOrWhiteSpace(ad.Title));
|
||||
Assert.False(string.IsNullOrWhiteSpace(ad.Description));
|
||||
Assert.False(string.IsNullOrWhiteSpace(ad.TargetUrl));
|
||||
Assert.Contains("git.chanpaca.net", ad.TargetUrl);
|
||||
Assert.StartsWith("http", ad.TargetUrl);
|
||||
});
|
||||
|
||||
Assert.Contains(largeAds, ad => ad.TargetUrl.Contains("git.chanpaca.net"));
|
||||
Assert.Contains(largeAds, ad => ad.TargetUrl.Contains("admob.google.com"));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
|
|
|
|||
|
|
@ -50,6 +50,10 @@ public class AdViewModelTests
|
|||
LastOpenedAd = ad;
|
||||
return true;
|
||||
}
|
||||
|
||||
public AdMobConfig CurrentConfig { get; set; } = new();
|
||||
public void UpdateAdMobConfig(AdMobConfig config) => CurrentConfig = config;
|
||||
public void ExportAppAdsTxt(string destinationFilePath) { }
|
||||
}
|
||||
|
||||
[Fact]
|
||||
|
|
@ -99,4 +103,25 @@ public class AdViewModelTests
|
|||
|
||||
Assert.NotEqual(firstId, secondId);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void RefreshAds_UpdatesBothBannerAndLargeCard()
|
||||
{
|
||||
var fake = new FakeAdService();
|
||||
var vm = new AdViewModel(fake);
|
||||
|
||||
Assert.NotNull(vm.AdService);
|
||||
Assert.Same(fake, vm.AdService);
|
||||
|
||||
var b1 = vm.CurrentBannerAd?.Id;
|
||||
var l1 = vm.CurrentLargeAd?.Id;
|
||||
|
||||
vm.RefreshAds();
|
||||
|
||||
var b2 = vm.CurrentBannerAd?.Id;
|
||||
var l2 = vm.CurrentLargeAd?.Id;
|
||||
|
||||
Assert.NotEqual(b1, b2);
|
||||
Assert.NotEqual(l1, l2);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -363,22 +363,22 @@ public class DesignAuditAstTests
|
|||
}
|
||||
|
||||
[Fact]
|
||||
public void FormatShiftTheme_MustDefine_InstrumentTokens_And_CategoryBrushes()
|
||||
public void Palettes_MustDefine_CategoryBadgeBrushes()
|
||||
{
|
||||
// designpaca R2/R3: FormatShiftTheme.xaml에 포맷 카테고리별 시그니처 브러시와 정밀 카드 스타일이 선언되어 있어야 한다.
|
||||
var themeFile = Path.Combine(ViewsDir, "FormatShiftTheme.xaml");
|
||||
var doc = XDocument.Parse(File.ReadAllText(themeFile));
|
||||
// 진단 창의 카테고리 뱃지 색은 라이트/다크 팔레트에 역할 토큰으로 존재해야 한다.
|
||||
foreach (var palette in new[] { "FsPalette.Dark.xaml", "FsPalette.Light.xaml" })
|
||||
{
|
||||
var doc = XDocument.Parse(File.ReadAllText(Path.Combine(ViewsDir, "Themes", palette)));
|
||||
var keys = doc.Descendants()
|
||||
.Select(e => e.Attribute(XName.Get("Key", "http://schemas.microsoft.com/winfx/2006/xaml"))?.Value)
|
||||
.Where(k => k != null)
|
||||
.ToHashSet();
|
||||
|
||||
var keys = doc.Descendants()
|
||||
.Select(e => e.Attribute(XName.Get("Key", "http://schemas.microsoft.com/winfx/2006/xaml"))?.Value)
|
||||
.Where(k => k != null)
|
||||
.ToHashSet();
|
||||
|
||||
Assert.Contains("FsBadgeImageBrush", keys);
|
||||
Assert.Contains("FsBadgeDocBrush", keys);
|
||||
Assert.Contains("FsBadgeVideoBrush", keys);
|
||||
Assert.Contains("FsBadgeAudioBrush", keys);
|
||||
Assert.Contains("FsInstrumentCardStyle", keys);
|
||||
Assert.Contains("FsBadgeImageBrush", keys);
|
||||
Assert.Contains("FsBadgeDocBrush", keys);
|
||||
Assert.Contains("FsBadgeVideoBrush", keys);
|
||||
Assert.Contains("FsBadgeAudioBrush", keys);
|
||||
}
|
||||
}
|
||||
|
||||
[Fact]
|
||||
|
|
@ -402,23 +402,6 @@ public class DesignAuditAstTests
|
|||
Assert.True(hasCategoryPill, "대기열 카드에 포맷 카테고리 뱃지(ItemCategoryBadge)가 있어야 합니다.");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void SwissMinimal_Tokens_MustInclude_NeonCyanSignatureAccent()
|
||||
{
|
||||
// designpaca 사용자 인터뷰 결정: 스위스 미니멀 + 네온 시안(#06B6D4) 시그니처 악센트 토큰 검증
|
||||
var themeFile = Path.Combine(ViewsDir, "FormatShiftTheme.xaml");
|
||||
var doc = XDocument.Parse(File.ReadAllText(themeFile));
|
||||
|
||||
var cyanBrush = doc.Descendants()
|
||||
.FirstOrDefault(e => e.Attribute(XName.Get("Key", "http://schemas.microsoft.com/winfx/2006/xaml"))?.Value == "FsAccentCyan");
|
||||
Assert.NotNull(cyanBrush);
|
||||
Assert.Equal("#06B6D4", cyanBrush.Attribute("Color")?.Value);
|
||||
|
||||
var cyanBgBrush = doc.Descendants()
|
||||
.FirstOrDefault(e => e.Attribute(XName.Get("Key", "http://schemas.microsoft.com/winfx/2006/xaml"))?.Value == "FsAccentCyanBg");
|
||||
Assert.NotNull(cyanBgBrush);
|
||||
Assert.Equal("#083344", cyanBgBrush.Attribute("Color")?.Value);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void InteractiveElements_MustHave_AutomationPropertiesAutomationId_For_E2E_Reliability()
|
||||
|
|
@ -481,20 +464,18 @@ public class DesignAuditAstTests
|
|||
}
|
||||
|
||||
[Fact]
|
||||
public void FormatShiftTheme_MustDefine_IslandButtonStyle_And_DoubleBezelStyles()
|
||||
public void FormatShiftTheme_MustDefine_AccentButton_And_CardStyles()
|
||||
{
|
||||
// high-end-visual-design Section 4:
|
||||
// Island Button (Button-in-Button) 스타일 및 Double-Bezel 카드 쉘 스타일이 선언되어야 한다.
|
||||
var themeFile = Path.Combine(ViewsDir, "FormatShiftTheme.xaml");
|
||||
var doc = XDocument.Parse(File.ReadAllText(themeFile));
|
||||
|
||||
// Win11 버튼 위계(강조 버튼 · 표준 버튼)와 단일 카드 표면이 스타일 사전에 선언되어야 한다.
|
||||
var doc = XDocument.Parse(File.ReadAllText(Path.Combine(ViewsDir, "FormatShiftTheme.xaml")));
|
||||
var keys = doc.Descendants()
|
||||
.Select(e => e.Attribute(XName.Get("Key", "http://schemas.microsoft.com/winfx/2006/xaml"))?.Value)
|
||||
.Where(k => k != null)
|
||||
.ToHashSet();
|
||||
|
||||
Assert.Contains("FsIslandPrimaryButtonStyle", keys);
|
||||
Assert.Contains("FsDoubleBezelShellStyle", keys);
|
||||
Assert.Contains("FsAccentButtonStyle", keys);
|
||||
Assert.Contains("FsSecondaryButtonStyle", keys);
|
||||
Assert.Contains("FsCardStyle", keys);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
|
|
@ -553,19 +534,16 @@ public class DesignAuditAstTests
|
|||
}
|
||||
|
||||
[Fact]
|
||||
public void Sidebar_AiTaskAndEncodingCards_MustUseDoubleBezelShell_ForUniformStyle()
|
||||
public void Sidebar_AiTaskCard_MustUseFsCardStyle()
|
||||
{
|
||||
// high-end-visual-design Section 4:
|
||||
// 사이드바의 AI 작업 및 상세 인코딩 설정 카드도 FsDoubleBezelShellStyle로 통일되어 일관된 머신 하드웨어 룩을 완성해야 한다.
|
||||
var mainFile = Path.Combine(ViewsDir, "MainWindow.xaml");
|
||||
var doc = XDocument.Parse(File.ReadAllText(mainFile));
|
||||
|
||||
// 사이드바의 AI 작업 카드도 다른 설정 카드와 같은 단일 카드 표면(FsCardStyle)을 쓴다.
|
||||
var doc = XDocument.Parse(File.ReadAllText(Path.Combine(ViewsDir, "MainWindow.xaml")));
|
||||
var aiPanel = doc.Descendants().FirstOrDefault(d => d.Attribute(XName.Get("Name", "http://schemas.microsoft.com/winfx/2006/xaml"))?.Value == "AiTaskPanel");
|
||||
Assert.NotNull(aiPanel);
|
||||
|
||||
var outerBorder = aiPanel.Ancestors().Where(a => a.Name.LocalName == "Border").Skip(1).FirstOrDefault();
|
||||
Assert.NotNull(outerBorder);
|
||||
Assert.Equal("{StaticResource FsDoubleBezelShellStyle}", outerBorder.Attribute("Style")?.Value);
|
||||
var card = aiPanel.Ancestors().FirstOrDefault(a => a.Name.LocalName == "Border");
|
||||
Assert.NotNull(card);
|
||||
Assert.Equal("{StaticResource FsCardStyle}", card.Attribute("Style")?.Value);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
|
|
@ -675,19 +653,13 @@ public class DesignAuditAstTests
|
|||
}
|
||||
|
||||
[Fact]
|
||||
public void PastResultsEmpty_MustUseDoubleBezelShell_And_PureKoreanTerminology()
|
||||
public void PastResultsEmpty_MustUsePureKoreanTerminology()
|
||||
{
|
||||
// 변환 기록 빈 상태도 FsDoubleBezelShellStyle을 사용하여 DropZoneEmpty와 일관된 머신 룩을 제공해야 하며,
|
||||
// 버튼 텍스트는 '큐'가 아닌 '대기열' 표준 한국어 용어를 사용해야 한다.
|
||||
var mainFile = Path.Combine(ViewsDir, "MainWindow.xaml");
|
||||
var doc = XDocument.Parse(File.ReadAllText(mainFile));
|
||||
|
||||
// 변환 기록 빈 상태의 행동 유도 문구는 '큐'가 아닌 '대기열' 표준 용어를 쓴다.
|
||||
var doc = XDocument.Parse(File.ReadAllText(Path.Combine(ViewsDir, "MainWindow.xaml")));
|
||||
var emptyContainer = doc.Descendants().FirstOrDefault(e => e.Attribute(XName.Get("Name", "http://schemas.microsoft.com/winfx/2006/xaml"))?.Value == "PastResultsEmpty");
|
||||
Assert.NotNull(emptyContainer);
|
||||
|
||||
var bezelShell = emptyContainer.Descendants().FirstOrDefault(e => e.Name.LocalName == "Border" && e.Attribute("Style")?.Value == "{StaticResource FsDoubleBezelShellStyle}");
|
||||
Assert.NotNull(bezelShell);
|
||||
|
||||
var texts = emptyContainer.Descendants().Where(e => e.Name.LocalName == "TextBlock")
|
||||
.Select(t => t.Attribute("Text")?.Value)
|
||||
.Where(v => v != null)
|
||||
|
|
@ -698,41 +670,28 @@ public class DesignAuditAstTests
|
|||
}
|
||||
|
||||
[Fact]
|
||||
public void SettingsWindow_Cards_MustUseDoubleBezelShell_ForUniformStyle()
|
||||
public void SettingsWindow_Cards_MustUseFsCardStyle()
|
||||
{
|
||||
// SettingsWindow의 AI 카드 및 외부 도구 카드도 FsDoubleBezelShellStyle 및 FsDoubleBezelCoreStyle을 사용하여
|
||||
// 앱 전체와 동일한 스위스 미니멀 이중 베젤 아키텍처를 준수해야 한다.
|
||||
var settingsFile = Path.Combine(ViewsDir, "SettingsWindow.xaml");
|
||||
var doc = XDocument.Parse(File.ReadAllText(settingsFile));
|
||||
|
||||
var shells = doc.Descendants().Where(e => e.Name.LocalName == "Border" && e.Attribute("Style")?.Value == "{StaticResource FsDoubleBezelShellStyle}").ToList();
|
||||
Assert.True(shells.Count >= 2, $"SettingsWindow는 최소 2개 이상의 이중 베젤 쉘 카드를 포함해야 합니다. (발견된 수: {shells.Count})");
|
||||
// 설정 창의 AI · 외부 도구 · 광고 그룹은 Win11 설정 앱처럼 단일 카드(FsCardStyle)로 나뉜다.
|
||||
var doc = XDocument.Parse(File.ReadAllText(Path.Combine(ViewsDir, "SettingsWindow.xaml")));
|
||||
var cards = doc.Descendants().Where(e => e.Name.LocalName == "Border" && e.Attribute("Style")?.Value == "{StaticResource FsCardStyle}").ToList();
|
||||
Assert.True(cards.Count >= 3, $"SettingsWindow는 최소 3개의 설정 카드를 포함해야 합니다. (발견된 수: {cards.Count})");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void Sidebar_AllCards_MustUseDoubleBezelShell_ForUnifiedAesthetic()
|
||||
public void Sidebar_AllCards_MustUseFsCardStyle()
|
||||
{
|
||||
// high-end-visual-design Section 4 & stitch-design-taste:
|
||||
// 사이드바의 모든 덱(스마트 변환 덱, 저장 위치 및 충돌 해결 덱, AI 작업 덱, 통계 덱)은
|
||||
// 단일 보더 플랫 카드(FsCardStyle)가 아닌 이중 베젤(FsDoubleBezelShellStyle + FsDoubleBezelCoreStyle)로 통일되어야 한다.
|
||||
var mainFile = Path.Combine(ViewsDir, "MainWindow.xaml");
|
||||
var doc = XDocument.Parse(File.ReadAllText(mainFile));
|
||||
|
||||
var sidebarScroll = doc.Descendants().FirstOrDefault(e => e.Name.LocalName == "ScrollViewer" && e.Ancestors().Any(a => a.Name.LocalName == "Border" && a.Attribute(XName.Get("Column", "http://schemas.microsoft.com/winfx/2006/xaml"))?.Value == "0" || a.Attribute("Grid.Column")?.Value == "0"));
|
||||
// 사이드바의 설정 그룹(변환 설정 · 저장 위치 · AI 작업)은 모두 같은 단일 카드 표면을 쓴다.
|
||||
var doc = XDocument.Parse(File.ReadAllText(Path.Combine(ViewsDir, "MainWindow.xaml")));
|
||||
var sidebarScroll = doc.Descendants().FirstOrDefault(e => e.Name.LocalName == "ScrollViewer" && e.Ancestors().Any(a => a.Attribute("Grid.Column")?.Value == "0"));
|
||||
Assert.NotNull(sidebarScroll);
|
||||
|
||||
var stackPanel = sidebarScroll.Descendants().FirstOrDefault(e => e.Name.LocalName == "StackPanel");
|
||||
Assert.NotNull(stackPanel);
|
||||
|
||||
// stackPanel의 직계 자식 카드들
|
||||
var directChildCards = stackPanel.Elements().Where(e => e.Name.LocalName == "Border").ToList();
|
||||
Assert.True(directChildCards.Count >= 4, $"사이드바에는 최소 4개 이상의 카드가 있어야 합니다. (발견된 수: {directChildCards.Count})");
|
||||
|
||||
foreach (var card in directChildCards)
|
||||
{
|
||||
var style = card.Attribute("Style")?.Value;
|
||||
Assert.Equal("{StaticResource FsDoubleBezelShellStyle}", style);
|
||||
}
|
||||
Assert.True(directChildCards.Count >= 3, $"사이드바에는 최소 3개의 카드가 있어야 합니다. (발견된 수: {directChildCards.Count})");
|
||||
Assert.All(directChildCards, card => Assert.Equal("{StaticResource FsCardStyle}", card.Attribute("Style")?.Value));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
|
|
@ -765,20 +724,15 @@ public class DesignAuditAstTests
|
|||
}
|
||||
|
||||
[Fact]
|
||||
public void DropZoneEmpty_MustUseDoubleBezelShell_ForLinearTierMachinedLook()
|
||||
public void DropZoneEmpty_MustShowDashedDropTarget()
|
||||
{
|
||||
// high-end-visual-design Section 4 (Double-Bezel):
|
||||
// 중앙 메인 빈 상태 드롭존(DropZoneEmpty)도 단일 대시 사각형이 아닌
|
||||
// FsDoubleBezelShellStyle + FsDoubleBezelCoreStyle 이중 베젤 쉘 아키텍처로 구현되어
|
||||
// PastResultsEmpty 및 사이드바 덱들과 완벽한 하드웨어 머신 룩 통일감을 형성해야 한다.
|
||||
var mainFile = Path.Combine(ViewsDir, "MainWindow.xaml");
|
||||
var doc = XDocument.Parse(File.ReadAllText(mainFile));
|
||||
|
||||
// 빈 대기열은 목록 영역 전체가 드롭 대상임을 점선 테두리로 정직하게 보여 준다.
|
||||
var doc = XDocument.Parse(File.ReadAllText(Path.Combine(ViewsDir, "MainWindow.xaml")));
|
||||
var dropZone = doc.Descendants().FirstOrDefault(e => e.Attribute(XName.Get("Name", "http://schemas.microsoft.com/winfx/2006/xaml"))?.Value == "DropZoneEmpty");
|
||||
Assert.NotNull(dropZone);
|
||||
|
||||
var bezelShell = dropZone.Descendants().FirstOrDefault(e => e.Name.LocalName == "Border" && e.Attribute("Style")?.Value == "{StaticResource FsDoubleBezelShellStyle}");
|
||||
Assert.NotNull(bezelShell);
|
||||
var dashed = dropZone.Elements().FirstOrDefault(e => e.Name.LocalName == "Rectangle" && e.Attribute("StrokeDashArray") != null);
|
||||
Assert.NotNull(dashed);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
|
|
@ -903,24 +857,15 @@ public class DesignAuditAstTests
|
|||
}
|
||||
|
||||
[Fact]
|
||||
public void Inspector_PreviewArea_MustUse_DoubleBezelArchitecture()
|
||||
public void Inspector_PreviewArea_MustBeSingleCard()
|
||||
{
|
||||
// 미리보기 뷰포트는 단순 평면 박스가 아니라 고품격 machined 하드웨어 느낌의
|
||||
// FsDoubleBezelShellStyle 및 FsDoubleBezelCoreStyle 이중 베젤(Doppelrand) 구조를 가져야 한다.
|
||||
var file = Path.Combine(ViewsDir, "MainWindow.xaml");
|
||||
var doc = XDocument.Parse(File.ReadAllText(file));
|
||||
|
||||
var previewArea = doc.Descendants().FirstOrDefault(e =>
|
||||
e.Attribute(XName.Get("Name", "http://schemas.microsoft.com/winfx/2006/xaml"))?.Value == "PreviewImageArea");
|
||||
// 미리보기 뷰포트는 콘텐츠 레이어 위의 카드 한 장이다(카드 안 카드 금지).
|
||||
var doc = XDocument.Parse(File.ReadAllText(Path.Combine(ViewsDir, "MainWindow.xaml")));
|
||||
var previewArea = doc.Descendants().FirstOrDefault(e => e.Attribute(XName.Get("Name", "http://schemas.microsoft.com/winfx/2006/xaml"))?.Value == "PreviewImageArea");
|
||||
Assert.NotNull(previewArea);
|
||||
|
||||
var hasShell = previewArea.Descendants().Any(e =>
|
||||
e.Attribute("Style")?.Value.Contains("FsDoubleBezelShellStyle") == true);
|
||||
var hasCore = previewArea.Descendants().Any(e =>
|
||||
e.Attribute("Style")?.Value.Contains("FsDoubleBezelCoreStyle") == true);
|
||||
|
||||
Assert.True(hasShell && hasCore,
|
||||
"PreviewImageArea는 고품격 Fluent 2 미학을 위해 FsDoubleBezelShellStyle 및 FsDoubleBezelCoreStyle 이중 베젤 구조를 갖추어야 합니다.");
|
||||
var cards = previewArea.Descendants().Where(e => e.Attribute("Style")?.Value == "{StaticResource FsCardStyle}").ToList();
|
||||
Assert.Single(cards);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
|
|
|
|||
168
src/Everything2Everything.Tests/SettingsWindowAdMobTests.cs
Normal file
168
src/Everything2Everything.Tests/SettingsWindowAdMobTests.cs
Normal file
|
|
@ -0,0 +1,168 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Threading;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Xml.Linq;
|
||||
using Everything2Everything.App.Views;
|
||||
using Everything2Everything.Core;
|
||||
using Everything2Everything.Core.Ads;
|
||||
using Xunit;
|
||||
|
||||
namespace Everything2Everything.Tests;
|
||||
|
||||
public class SettingsWindowAdMobTests
|
||||
{
|
||||
private static readonly string SolutionRoot = FindSolutionRoot();
|
||||
private static readonly string SettingsXamlPath = Path.Combine(SolutionRoot, "src", "Everything2Everything.App", "Views", "SettingsWindow.xaml");
|
||||
|
||||
private static string FindSolutionRoot()
|
||||
{
|
||||
var dir = Directory.GetCurrentDirectory();
|
||||
while (dir != null && !File.Exists(Path.Combine(dir, "Everything2Everything.slnx")))
|
||||
{
|
||||
dir = Directory.GetParent(dir)?.FullName;
|
||||
}
|
||||
return dir ?? throw new DirectoryNotFoundException("솔루션 루트를 찾을 수 없습니다.");
|
||||
}
|
||||
|
||||
private sealed class FakeSettingsStore : ISettingsStore
|
||||
{
|
||||
private readonly Dictionary<string, string> _d = new();
|
||||
public string? Get(string key) => _d.TryGetValue(key, out var v) ? v : null;
|
||||
public void Set(string key, string value) => _d[key] = value;
|
||||
public void Remove(string key) => _d.Remove(key);
|
||||
public bool Contains(string key) => _d.ContainsKey(key);
|
||||
}
|
||||
|
||||
private static readonly object AppInitLock = new();
|
||||
|
||||
private static void RunOnSta(Action action)
|
||||
{
|
||||
Exception? ex = null;
|
||||
var thread = new Thread(() =>
|
||||
{
|
||||
try
|
||||
{
|
||||
lock (AppInitLock)
|
||||
{
|
||||
if (Application.Current == null)
|
||||
{
|
||||
try { _ = new Application(); } catch (InvalidOperationException) { }
|
||||
}
|
||||
}
|
||||
action();
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
ex = e;
|
||||
}
|
||||
});
|
||||
thread.SetApartmentState(ApartmentState.STA);
|
||||
thread.Start();
|
||||
thread.Join();
|
||||
|
||||
if (ex != null)
|
||||
{
|
||||
throw new AggregateException("STA 스레드 실행 중 예외 발생", ex);
|
||||
}
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void SettingsWindowXaml_ContainsAdMobConfigurationCard()
|
||||
{
|
||||
Assert.True(File.Exists(SettingsXamlPath), "SettingsWindow.xaml 이 존재해야 합니다.");
|
||||
var doc = XDocument.Parse(File.ReadAllText(SettingsXamlPath));
|
||||
|
||||
var elementNames = doc.Descendants()
|
||||
.Select(e => e.Attribute(XName.Get("Name", "http://schemas.microsoft.com/winfx/2006/xaml"))?.Value)
|
||||
.Where(n => !string.IsNullOrEmpty(n))
|
||||
.ToHashSet();
|
||||
|
||||
Assert.Contains("AdMobPublisherIdBox", elementNames);
|
||||
Assert.Contains("AdMobAppIdBox", elementNames);
|
||||
Assert.Contains("AdMobBannerIdBox", elementNames);
|
||||
Assert.Contains("AdMobInterstitialIdBox", elementNames);
|
||||
Assert.Contains("AdMobTestAdsCheck", elementNames);
|
||||
Assert.Contains("ExportAppAdsTxtBtn", elementNames);
|
||||
Assert.Contains("AdMobStatusDot", elementNames);
|
||||
Assert.Contains("AdMobStatusText", elementNames);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void SettingsWindowXaml_AdMobControls_ComplyWithDesignAudit()
|
||||
{
|
||||
var doc = XDocument.Parse(File.ReadAllText(SettingsXamlPath));
|
||||
var rawEmojis = new[] { "⚙", "📁", "🗑", "✖", "🔧", "✨", "🚀", "⚡" };
|
||||
var violations = new List<string>();
|
||||
|
||||
// 1. 유니코드 이모지 금지
|
||||
var buttons = doc.Descendants().Where(e => e.Name.LocalName is "Button" or "ToggleButton");
|
||||
foreach (var btn in buttons)
|
||||
{
|
||||
var content = btn.Attribute("Content")?.Value;
|
||||
if (!string.IsNullOrEmpty(content) && rawEmojis.Any(emoji => content.Contains(emoji)))
|
||||
{
|
||||
violations.Add($"버튼에 이모지 사용 감지: {content}");
|
||||
}
|
||||
}
|
||||
|
||||
// 2. 가로 StackPanel 내 아이콘/텍스트 VerticalAlignment="Center"
|
||||
var stackPanels = doc.Descendants().Where(e => e.Name.LocalName == "StackPanel" &&
|
||||
e.Attribute("Orientation")?.Value == "Horizontal");
|
||||
foreach (var sp in stackPanels)
|
||||
{
|
||||
foreach (var child in sp.Elements())
|
||||
{
|
||||
var va = child.Attribute("VerticalAlignment")?.Value;
|
||||
if (va != "Center")
|
||||
{
|
||||
violations.Add($"가로 StackPanel의 자식 <{child.Name.LocalName}>에 VerticalAlignment=\"Center\" 누락");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Assert.True(violations.Count == 0,
|
||||
"SettingsWindow 디자인 감사 위반이 발견되었습니다:\n" + string.Join("\n", violations));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void SettingsWindow_LoadsAndSavesAdMobConfig()
|
||||
{
|
||||
RunOnSta(() =>
|
||||
{
|
||||
var settings = new FakeSettingsStore();
|
||||
settings.Set("admob.publisherid", "pub-1112223334445556");
|
||||
settings.Set("admob.appid", "ca-app-pub-1112223334445556~1234567890");
|
||||
settings.Set("admob.bannerid", "ca-app-pub-1112223334445556/9876543210");
|
||||
settings.Set("admob.interstitialid", "ca-app-pub-1112223334445556/5555555555");
|
||||
settings.Set("admob.usetestads", "false");
|
||||
|
||||
var adService = new AdService();
|
||||
var win = new SettingsWindow(settings, adService);
|
||||
|
||||
var pubBox = (TextBox)win.FindName("AdMobPublisherIdBox");
|
||||
var appBox = (TextBox)win.FindName("AdMobAppIdBox");
|
||||
var bannerBox = (TextBox)win.FindName("AdMobBannerIdBox");
|
||||
var testCheck = (CheckBox)win.FindName("AdMobTestAdsCheck");
|
||||
|
||||
Assert.Equal("pub-1112223334445556", pubBox.Text);
|
||||
Assert.Equal("ca-app-pub-1112223334445556~1234567890", appBox.Text);
|
||||
Assert.Equal("ca-app-pub-1112223334445556/9876543210", bannerBox.Text);
|
||||
Assert.False(testCheck.IsChecked);
|
||||
|
||||
// 수정 후 저장 시뮬레이션
|
||||
pubBox.Text = "pub-9999888877776666";
|
||||
testCheck.IsChecked = true;
|
||||
|
||||
win.SaveAdMobSettings();
|
||||
|
||||
Assert.Equal("pub-9999888877776666", settings.Get("admob.publisherid"));
|
||||
Assert.Equal("true", settings.Get("admob.usetestads"));
|
||||
Assert.Equal("pub-9999888877776666", adService.CurrentConfig.PublisherId);
|
||||
Assert.True(adService.CurrentConfig.UseTestAds);
|
||||
});
|
||||
}
|
||||
}
|
||||
106
src/Everything2Everything.Tests/VisualCaptureHarness.cs
Normal file
106
src/Everything2Everything.Tests/VisualCaptureHarness.cs
Normal file
|
|
@ -0,0 +1,106 @@
|
|||
using System.IO;
|
||||
using System.Windows;
|
||||
using System.Windows.Media;
|
||||
using System.Windows.Media.Imaging;
|
||||
using Everything2Everything.App.Theming;
|
||||
using Everything2Everything.App.Views;
|
||||
using Everything2Everything.Core;
|
||||
using Xunit;
|
||||
|
||||
namespace Everything2Everything.Tests;
|
||||
|
||||
/// <summary>
|
||||
/// 상태별 시각 E2E 캡처 (designpaca 5단계 렌더 감사).
|
||||
/// E2E_CAPTURE_DIR 이 지정된 경우에만 동작하고, 평소 테스트 실행에서는 즉시 끝난다.
|
||||
/// $env:E2E_CAPTURE_DIR="C:\temp\e2e"; dotnet test --filter FullyQualifiedName~VisualCaptureHarness
|
||||
/// 창마다 라이트/다크 PNG를 남긴다. Mica는 오프스크린에서 렌더되지 않으므로 WinUI 기준 근사색을 깔고 그린다.
|
||||
/// 구조 테스트가 통과해도 캡처는 사람이 직접 열어 위계·잘림·대비를 판정한다.
|
||||
/// </summary>
|
||||
public class VisualCaptureHarness
|
||||
{
|
||||
private sealed class Store : ISettingsStore
|
||||
{
|
||||
private readonly Dictionary<string, string> _d = new();
|
||||
public string? Get(string key) => _d.TryGetValue(key, out var v) ? v : null;
|
||||
public void Set(string key, string value) => _d[key] = value;
|
||||
public void Remove(string key) => _d.Remove(key);
|
||||
public bool Contains(string key) => _d.ContainsKey(key);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void Capture()
|
||||
{
|
||||
var outDir = Environment.GetEnvironmentVariable("E2E_CAPTURE_DIR");
|
||||
if (string.IsNullOrEmpty(outDir)) return;
|
||||
Directory.CreateDirectory(outDir);
|
||||
|
||||
Exception? error = null;
|
||||
var t = new Thread(() =>
|
||||
{
|
||||
try { CaptureAll(outDir); } catch (Exception e) { error = e; }
|
||||
});
|
||||
t.SetApartmentState(ApartmentState.STA);
|
||||
t.Start();
|
||||
t.Join();
|
||||
if (error != null) throw error;
|
||||
}
|
||||
|
||||
private static void CaptureAll(string outDir)
|
||||
{
|
||||
var app = Application.Current ?? new Application();
|
||||
var root = Directory.GetCurrentDirectory();
|
||||
while (!File.Exists(Path.Combine(root, "Everything2Everything.slnx"))) root = Directory.GetParent(root)!.FullName;
|
||||
var assets = Path.Combine(root, "test_assets");
|
||||
var engine = Everything2EverythingBootstrap.CreateDefault();
|
||||
var files = new List<string> { Path.Combine(assets, "test_icon.png"), Path.Combine(assets, "test_art.png"), Path.Combine(assets, "sample_image.png") };
|
||||
|
||||
foreach (var mode in new[] { FsThemeMode.Dark, FsThemeMode.Light })
|
||||
{
|
||||
UseTheme(app, mode);
|
||||
var mica = mode == FsThemeMode.Dark ? Color.FromRgb(0x20, 0x20, 0x20) : Color.FromRgb(0xF3, 0xF3, 0xF3);
|
||||
var tag = mode.ToString().ToLowerInvariant();
|
||||
|
||||
Render(new MainWindow(engine, new Store(), files).Content, 1280, 860, mica, Path.Combine(outDir, $"main-queue-{tag}.png"));
|
||||
Render(new MainWindow(engine, new Store()).Content, 1280, 860, mica, Path.Combine(outDir, $"main-empty-{tag}.png"));
|
||||
Render(new SettingsWindow(new Store()).Content, 560, 720, mica, Path.Combine(outDir, $"settings-{tag}.png"));
|
||||
Render(new QuickOptionsWindow(".jpg", 3, new Store()).Content, 380, 360, mica, Path.Combine(outDir, $"quick-options-{tag}.png"));
|
||||
Render(new QuickProgressWindow(3, new CancellationTokenSource(), ".jpg").Content, 560, 240, mica, Path.Combine(outDir, $"quick-progress-{tag}.png"));
|
||||
Render(new ToolSetupWindow().Content, 640, 680, mica, Path.Combine(outDir, $"tool-setup-{tag}.png"));
|
||||
}
|
||||
}
|
||||
|
||||
private static void UseTheme(Application app, FsThemeMode mode)
|
||||
{
|
||||
var merged = app.Resources.MergedDictionaries;
|
||||
merged.Clear();
|
||||
merged.Add(new Wpf.Ui.Markup.ThemesDictionary
|
||||
{
|
||||
Theme = mode == FsThemeMode.Dark ? Wpf.Ui.Appearance.ApplicationTheme.Dark : Wpf.Ui.Appearance.ApplicationTheme.Light,
|
||||
});
|
||||
merged.Add(new Wpf.Ui.Markup.ControlsDictionary());
|
||||
merged.Add(new ResourceDictionary { Source = FsThemeService.PaletteUri(mode) });
|
||||
merged.Add(new ResourceDictionary { Source = new Uri("pack://application:,,,/Everything2Everything;component/Views/FormatShiftTheme.xaml") });
|
||||
FsThemeService.Apply(app, mode, Color.FromRgb(0x00, 0x78, 0xD4)); // Windows 기본 강조색
|
||||
}
|
||||
|
||||
private static void Render(object? content, int w, int h, Color mica, string path)
|
||||
{
|
||||
if (content is not FrameworkElement element) return;
|
||||
element.Measure(new Size(w, h));
|
||||
element.Arrange(new Rect(0, 0, w, h));
|
||||
element.UpdateLayout();
|
||||
|
||||
var visual = new DrawingVisual();
|
||||
using (var dc = visual.RenderOpen())
|
||||
{
|
||||
dc.DrawRectangle(new SolidColorBrush(mica), null, new Rect(0, 0, w, h));
|
||||
dc.DrawRectangle(new VisualBrush(element) { Stretch = Stretch.None, AlignmentX = AlignmentX.Left, AlignmentY = AlignmentY.Top }, null, new Rect(0, 0, w, h));
|
||||
}
|
||||
var bitmap = new RenderTargetBitmap(w, h, 96, 96, PixelFormats.Pbgra32);
|
||||
bitmap.Render(visual);
|
||||
var encoder = new PngBitmapEncoder();
|
||||
encoder.Frames.Add(BitmapFrame.Create(bitmap));
|
||||
using var fs = File.Create(path);
|
||||
encoder.Save(fs);
|
||||
}
|
||||
}
|
||||
385
src/Everything2Everything.Tests/Win11NativeDesignTests.cs
Normal file
385
src/Everything2Everything.Tests/Win11NativeDesignTests.cs
Normal file
|
|
@ -0,0 +1,385 @@
|
|||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text.RegularExpressions;
|
||||
using System.Windows.Media;
|
||||
using System.Xml.Linq;
|
||||
using Everything2Everything.App.Theming;
|
||||
using Xunit;
|
||||
|
||||
namespace Everything2Everything.Tests;
|
||||
|
||||
/// <summary>
|
||||
/// Windows 11 정통 네이티브 디자인 계약 (design.md §2026-10 리디자인).
|
||||
/// 근거: learn.microsoft.com/windows/apps/design/signature-experiences — typography(최소 12px Regular,
|
||||
/// Segoe UI Variable), geometry(컨트롤 4px · 컨테이너 8px), layering(Mica 베이스 + 콘텐츠 레이어).
|
||||
/// </summary>
|
||||
public class Win11NativeDesignTests
|
||||
{
|
||||
private static readonly XNamespace X = "http://schemas.microsoft.com/winfx/2006/xaml";
|
||||
private static readonly string SolutionRoot = FindSolutionRoot();
|
||||
private static readonly string ViewsDir = Path.Combine(SolutionRoot, "src", "Everything2Everything.App", "Views");
|
||||
private static readonly string ThemesDir = Path.Combine(ViewsDir, "Themes");
|
||||
private static readonly string DarkPalette = Path.Combine(ThemesDir, "FsPalette.Dark.xaml");
|
||||
private static readonly string LightPalette = Path.Combine(ThemesDir, "FsPalette.Light.xaml");
|
||||
|
||||
// Mica 베이스의 대표 불투명 근사값 (WinUI SolidBackgroundFillColorBase)
|
||||
private static readonly Color DarkMica = Color.FromRgb(0x20, 0x20, 0x20);
|
||||
private static readonly Color LightMica = Color.FromRgb(0xF3, 0xF3, 0xF3);
|
||||
|
||||
private static string FindSolutionRoot()
|
||||
{
|
||||
var dir = Directory.GetCurrentDirectory();
|
||||
while (dir != null && !File.Exists(Path.Combine(dir, "Everything2Everything.slnx")))
|
||||
dir = Directory.GetParent(dir)?.FullName;
|
||||
return dir ?? throw new DirectoryNotFoundException("솔루션 루트를 찾을 수 없습니다.");
|
||||
}
|
||||
|
||||
private static IEnumerable<string> ViewXamlFiles()
|
||||
=> Directory.GetFiles(ViewsDir, "*.xaml", SearchOption.TopDirectoryOnly);
|
||||
|
||||
private static Dictionary<string, Color> LoadPalette(string path)
|
||||
{
|
||||
var doc = XDocument.Load(path);
|
||||
var map = new Dictionary<string, Color>();
|
||||
foreach (var e in doc.Root!.Elements())
|
||||
{
|
||||
var key = e.Attribute(X + "Key")?.Value;
|
||||
if (key == null) continue;
|
||||
var raw = e.Name.LocalName == "Color" ? e.Value.Trim() : e.Attribute("Color")?.Value;
|
||||
if (raw == null || !raw.StartsWith('#')) continue;
|
||||
map[key] = (Color)ColorConverter.ConvertFromString(raw);
|
||||
}
|
||||
return map;
|
||||
}
|
||||
|
||||
// ───────────────────────── 1. 강조색 파생 (시스템 강조색 → 대비 보장) ─────────────────────────
|
||||
|
||||
[Theory]
|
||||
[InlineData("#0078D4", FsThemeMode.Dark)]
|
||||
[InlineData("#0078D4", FsThemeMode.Light)]
|
||||
[InlineData("#FFB900", FsThemeMode.Dark)]
|
||||
[InlineData("#FFB900", FsThemeMode.Light)]
|
||||
[InlineData("#00CC6A", FsThemeMode.Light)]
|
||||
[InlineData("#881798", FsThemeMode.Dark)]
|
||||
[InlineData("#E81123", FsThemeMode.Light)]
|
||||
[InlineData("#2D2D30", FsThemeMode.Dark)]
|
||||
[InlineData("#FFFFFF", FsThemeMode.Light)]
|
||||
public void AccentPalette_FromAnySystemAccent_KeepsWcagAaContrast(string accentHex, FsThemeMode mode)
|
||||
{
|
||||
var accent = (Color)ColorConverter.ConvertFromString(accentHex);
|
||||
var palette = LoadPalette(mode == FsThemeMode.Dark ? DarkPalette : LightPalette);
|
||||
var mica = mode == FsThemeMode.Dark ? DarkMica : LightMica;
|
||||
var layer = FsContrast.Composite(palette["FsBgLayerColor"], mica);
|
||||
var card = FsContrast.Composite(palette["FsBgCardColor"], layer);
|
||||
|
||||
var a = FsAccentPalette.From(accent, mode);
|
||||
|
||||
Assert.True(FsContrast.Ratio(a.Text, layer) >= 4.5, $"강조 텍스트 대비 부족(레이어): {FsContrast.Ratio(a.Text, layer):F2}");
|
||||
Assert.True(FsContrast.Ratio(a.Text, card) >= 4.5, $"강조 텍스트 대비 부족(카드): {FsContrast.Ratio(a.Text, card):F2}");
|
||||
Assert.True(FsContrast.Ratio(a.OnFill, a.Fill) >= 4.5, $"강조 버튼 글자 대비 부족: {FsContrast.Ratio(a.OnFill, a.Fill):F2}");
|
||||
Assert.True(FsContrast.Ratio(a.OnFill, a.FillHover) >= 4.5, $"강조 버튼(호버) 글자 대비 부족: {FsContrast.Ratio(a.OnFill, a.FillHover):F2}");
|
||||
Assert.NotEqual(a.Fill, a.FillHover);
|
||||
Assert.True(a.Subtle.A < 0x60, "선택 배경 틴트는 반투명이어야 레이어 재질이 비친다.");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void Contrast_KnownPairs_MatchWcagFormula()
|
||||
{
|
||||
Assert.Equal(21.0, FsContrast.Ratio(Colors.Black, Colors.White), 1);
|
||||
Assert.Equal(1.0, FsContrast.Ratio(Colors.White, Colors.White), 2);
|
||||
var half = FsContrast.Composite(Color.FromArgb(0x80, 0, 0, 0), Colors.White);
|
||||
Assert.InRange(half.R, 0x7E, 0x80);
|
||||
}
|
||||
|
||||
// ───────────────────────── 2. 라이트/다크 팔레트 ─────────────────────────
|
||||
|
||||
[Fact]
|
||||
public void Palettes_LightAndDark_DefineIdenticalKeySets_WithRequiredRoles()
|
||||
{
|
||||
Assert.True(File.Exists(DarkPalette), "Themes/FsPalette.Dark.xaml 이 필요합니다.");
|
||||
Assert.True(File.Exists(LightPalette), "Themes/FsPalette.Light.xaml 이 필요합니다.");
|
||||
|
||||
static HashSet<string> Keys(string p) => XDocument.Load(p).Root!.Elements()
|
||||
.Select(e => e.Attribute(X + "Key")?.Value).Where(k => k != null).Select(k => k!).ToHashSet();
|
||||
|
||||
var dark = Keys(DarkPalette);
|
||||
var light = Keys(LightPalette);
|
||||
Assert.Empty(dark.Except(light));
|
||||
Assert.Empty(light.Except(dark));
|
||||
|
||||
string[] required =
|
||||
[
|
||||
"FsBgBase", "FsBgLayer", "FsBgCard", "FsBgCardHover", "FsBgControl", "FsBgControlHover",
|
||||
"FsBgSubtleHover", "FsBgSolid", "FsBgSmoke",
|
||||
"FsBorderSubtle", "FsBorderControl", "FsBorderStrong", "FsDivider",
|
||||
"FsTextPrimary", "FsTextSecondary", "FsTextTertiary", "FsTextDisabled",
|
||||
"FsAccent", "FsAccentHover", "FsAccentText", "FsAccentSubtle", "FsTextOnAccent",
|
||||
"FsStatusSuccess", "FsStatusSuccessText", "FsStatusWarn", "FsStatusWarnText",
|
||||
"FsStatusDanger", "FsStatusDangerText", "FsStatusInfo", "FsStatusInfoText",
|
||||
"FsCaptionCloseHover",
|
||||
];
|
||||
foreach (var k in required) Assert.Contains(k, dark);
|
||||
}
|
||||
|
||||
[Theory]
|
||||
[InlineData(FsThemeMode.Dark)]
|
||||
[InlineData(FsThemeMode.Light)]
|
||||
public void Palette_TextRoles_MeetWcagAa_OnLayerAndCard(FsThemeMode mode)
|
||||
{
|
||||
var p = LoadPalette(mode == FsThemeMode.Dark ? DarkPalette : LightPalette);
|
||||
var mica = mode == FsThemeMode.Dark ? DarkMica : LightMica;
|
||||
var layer = FsContrast.Composite(p["FsBgLayerColor"], mica);
|
||||
var card = FsContrast.Composite(p["FsBgCardColor"], layer);
|
||||
var sidebarCard = FsContrast.Composite(p["FsBgCardColor"], mica);
|
||||
|
||||
foreach (var role in new[] { "FsTextPrimaryColor", "FsTextSecondaryColor", "FsTextTertiaryColor",
|
||||
"FsStatusSuccessTextColor", "FsStatusWarnTextColor", "FsStatusDangerTextColor", "FsStatusInfoTextColor" })
|
||||
{
|
||||
foreach (var (name, bg) in new[] { ("레이어", layer), ("카드", card), ("사이드바 카드", sidebarCard), ("Mica", mica) })
|
||||
{
|
||||
var fg = FsContrast.Composite(p[role], bg);
|
||||
var ratio = FsContrast.Ratio(fg, bg);
|
||||
Assert.True(ratio >= 4.5, $"{mode} {role} on {name}: {ratio:F2} < 4.5");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// ───────────────────────── 3. 실시간 테마 전환 가능성 ─────────────────────────
|
||||
|
||||
[Fact]
|
||||
public void ThemeColorTokens_MustBeReferencedDynamically_ForLiveThemeSwitch()
|
||||
{
|
||||
var paletteKeys = XDocument.Load(DarkPalette).Root!.Elements()
|
||||
.Select(e => e.Attribute(X + "Key")?.Value).Where(k => k != null).ToHashSet();
|
||||
var offenders = new List<string>();
|
||||
foreach (var file in ViewXamlFiles())
|
||||
{
|
||||
foreach (Match m in Regex.Matches(File.ReadAllText(file), @"\{StaticResource\s+(Fs\w+)\}"))
|
||||
if (paletteKeys.Contains(m.Groups[1].Value))
|
||||
offenders.Add($"{Path.GetFileName(file)}: {m.Value}");
|
||||
}
|
||||
Assert.True(offenders.Count == 0, "팔레트 색은 DynamicResource로 참조해야 시스템 테마 전환을 따른다:\n" + string.Join("\n", offenders.Distinct().Take(20)));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void Views_MustNotHardcodeHexColors_OutsidePalettes()
|
||||
{
|
||||
var offenders = new List<string>();
|
||||
foreach (var file in ViewXamlFiles())
|
||||
{
|
||||
var doc = XDocument.Load(file);
|
||||
foreach (var attr in doc.Descendants().Attributes())
|
||||
if (Regex.IsMatch(attr.Value, @"^#[0-9A-Fa-f]{3,8}$") || attr.Value is "White" or "Black")
|
||||
offenders.Add($"{Path.GetFileName(file)}: {attr.Parent!.Name.LocalName}.{attr.Name.LocalName}={attr.Value}");
|
||||
}
|
||||
Assert.True(offenders.Count == 0, "색은 Themes/FsPalette.*.xaml 토큰으로만 지정한다:\n" + string.Join("\n", offenders.Take(30)));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void LegacyNeonGlassVocabulary_MustBeRetired()
|
||||
{
|
||||
string[] retired = ["FsDoubleBezel", "FsIsland", "FsGlassBorder", "FsAccentCyan", "FsAccentBlue", "FsAccentGreen", "FsAccentAmber", "FsInstrumentCard", "FsPrimaryButtonStyle"];
|
||||
var appDir = Path.Combine(SolutionRoot, "src", "Everything2Everything.App");
|
||||
var files = Directory.GetFiles(appDir, "*.*", SearchOption.AllDirectories)
|
||||
.Where(f => (f.EndsWith(".xaml") || f.EndsWith(".cs")) && !f.Contains($"{Path.DirectorySeparatorChar}obj{Path.DirectorySeparatorChar}") && !f.Contains($"{Path.DirectorySeparatorChar}bin{Path.DirectorySeparatorChar}"));
|
||||
var hits = files.SelectMany(f => retired.Where(r => File.ReadAllText(f).Contains(r)).Select(r => $"{Path.GetFileName(f)}: {r}")).ToList();
|
||||
Assert.True(hits.Count == 0, "네온 글래스 시대 토큰이 남아 있습니다:\n" + string.Join("\n", hits));
|
||||
}
|
||||
|
||||
// ───────────────────────── 4. 타이포그래피 · 기하 ─────────────────────────
|
||||
|
||||
[Fact]
|
||||
public void Typography_MustUseSegoeUIVariable_NotInter()
|
||||
{
|
||||
var theme = XDocument.Load(Path.Combine(ViewsDir, "FormatShiftTheme.xaml"));
|
||||
var sans = theme.Descendants().First(e => e.Attribute(X + "Key")?.Value == "FsFontSans").Value;
|
||||
Assert.StartsWith("Segoe UI Variable", sans.Trim());
|
||||
foreach (var file in ViewXamlFiles())
|
||||
Assert.DoesNotMatch(@"FontFamily=""[^""]*\bInter\b", File.ReadAllText(file));
|
||||
Assert.DoesNotContain("Inter,", sans);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void Typography_MinimumFontSize_Is12px()
|
||||
{
|
||||
var offenders = new List<string>();
|
||||
foreach (var file in ViewXamlFiles())
|
||||
{
|
||||
var doc = XDocument.Load(file);
|
||||
foreach (var e in doc.Descendants())
|
||||
{
|
||||
var v = e.Attribute("FontSize")?.Value
|
||||
?? (e.Name.LocalName == "Setter" && e.Attribute("Property")?.Value == "FontSize" ? e.Attribute("Value")?.Value : null);
|
||||
if (v != null && double.TryParse(v, out var size) && size < 12 && !IsIconGlyph(e))
|
||||
offenders.Add($"{Path.GetFileName(file)}: {e.Name.LocalName} FontSize={v}");
|
||||
}
|
||||
}
|
||||
Assert.True(offenders.Count == 0, "Windows 11 최소 글자 크기(12px)를 지켜야 한다:\n" + string.Join("\n", offenders.Take(30)));
|
||||
}
|
||||
|
||||
private static bool IsIconGlyph(XElement e) => e.Name.LocalName is "SymbolIcon";
|
||||
|
||||
[Fact]
|
||||
public void Geometry_CornerRadius_FollowsWin11Levels()
|
||||
{
|
||||
var allowed = new HashSet<string> { "0", "2", "4", "8" };
|
||||
var offenders = new List<string>();
|
||||
foreach (var file in ViewXamlFiles().Append(DarkPalette))
|
||||
{
|
||||
var doc = XDocument.Load(file);
|
||||
foreach (var e in doc.Descendants())
|
||||
{
|
||||
var v = e.Attribute("CornerRadius")?.Value
|
||||
?? (e.Name.LocalName == "Setter" && e.Attribute("Property")?.Value == "CornerRadius" ? e.Attribute("Value")?.Value : null);
|
||||
if (v == null || v.StartsWith('{')) continue;
|
||||
if (v.Split(',').Select(s => s.Trim()).Any(part => !allowed.Contains(part)))
|
||||
offenders.Add($"{Path.GetFileName(file)}: {e.Name.LocalName} CornerRadius={v}");
|
||||
}
|
||||
}
|
||||
Assert.True(offenders.Count == 0, "CornerRadius는 0·2·4·8만 쓴다(컨트롤 4, 컨테이너 8):\n" + string.Join("\n", offenders.Take(30)));
|
||||
}
|
||||
|
||||
// ───────────────────────── 5. 레이어 구조 · 창 재질 ─────────────────────────
|
||||
|
||||
[Theory]
|
||||
[InlineData("MainWindow.xaml")]
|
||||
[InlineData("SettingsWindow.xaml")]
|
||||
[InlineData("ToolSetupWindow.xaml")]
|
||||
[InlineData("DiagnoseWindow.xaml")]
|
||||
[InlineData("QuickOptionsWindow.xaml")]
|
||||
[InlineData("QuickProgressWindow.xaml")]
|
||||
public void AllWindows_MustUseMicaBackdrop(string xamlName)
|
||||
{
|
||||
var root = XDocument.Load(Path.Combine(ViewsDir, xamlName)).Root!;
|
||||
Assert.Equal("Mica", root.Attribute("WindowBackdropType")?.Value);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void MainWindow_MustHave_RoundedContentLayer_OnMicaBase()
|
||||
{
|
||||
var doc = XDocument.Load(Path.Combine(ViewsDir, "MainWindow.xaml"));
|
||||
var layer = doc.Descendants().FirstOrDefault(e => e.Attribute(X + "Name")?.Value == "ContentLayer");
|
||||
Assert.NotNull(layer);
|
||||
Assert.Equal("{DynamicResource FsBgLayer}", layer!.Attribute("Background")?.Value);
|
||||
Assert.Equal("8,0,0,0", layer.Attribute("CornerRadius")?.Value);
|
||||
Assert.True(layer.Descendants().Any(d => d.Attribute(X + "Name")?.Value == "ActiveQueueView"), "대기열은 콘텐츠 레이어 위에 있어야 한다.");
|
||||
Assert.True(layer.Descendants().Any(d => d.Attribute(X + "Name")?.Value == "PreviewImageArea"), "미리보기는 콘텐츠 레이어 위에 있어야 한다.");
|
||||
|
||||
var rootGrid = doc.Root!.Elements().First(e => e.Name.LocalName == "Grid");
|
||||
Assert.Equal("{DynamicResource FsBgBase}", rootGrid.Attribute("Background")?.Value);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void Cards_MustNotNestInsideCards()
|
||||
{
|
||||
foreach (var file in ViewXamlFiles())
|
||||
{
|
||||
var doc = XDocument.Load(file);
|
||||
var cards = doc.Descendants().Where(e => e.Attribute("Style")?.Value == "{StaticResource FsCardStyle}");
|
||||
foreach (var c in cards)
|
||||
Assert.False(c.Ancestors().Any(a => a.Attribute("Style")?.Value == "{StaticResource FsCardStyle}"),
|
||||
$"{Path.GetFileName(file)}: 카드 안에 카드를 중첩하지 않는다.");
|
||||
}
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void CheckBoxes_WithLongLabels_MustWrap_InsteadOfClipping()
|
||||
{
|
||||
var offenders = new List<string>();
|
||||
foreach (var file in new[] { "MainWindow.xaml", "SettingsWindow.xaml", "QuickOptionsWindow.xaml" })
|
||||
{
|
||||
var doc = XDocument.Load(Path.Combine(ViewsDir, file));
|
||||
foreach (var cb in doc.Descendants().Where(e => e.Name.LocalName == "CheckBox"))
|
||||
{
|
||||
var content = cb.Attribute("Content")?.Value;
|
||||
if (content != null && content.Length > 8)
|
||||
offenders.Add($"{file}: '{content}'");
|
||||
}
|
||||
}
|
||||
Assert.True(offenders.Count == 0, "긴 체크박스 라벨은 TextWrapping=Wrap TextBlock으로 감싼다(사이드바 잘림 결함):\n" + string.Join("\n", offenders));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void TitleBarButtons_MustNotHostSymbolIconDirectly()
|
||||
{
|
||||
// 실측 결함(2026-10): 제목 표시줄(DWM 확장 영역) 안에서 SymbolIcon이 Button의 직접 콘텐츠면
|
||||
// Foreground가 흰색이어도 글리프가 검게 합성된다. 패널로 한 번 감싸면 정상 렌더된다.
|
||||
var doc = XDocument.Load(Path.Combine(ViewsDir, "MainWindow.xaml"));
|
||||
var titleBar = doc.Descendants().First(e => e.Attribute(X + "Name")?.Value == "AppTitleBar");
|
||||
var offenders = titleBar.Descendants()
|
||||
.Where(e => e.Name.LocalName == "Button")
|
||||
.Where(b => b.Elements().Any(c => c.Name.LocalName == "SymbolIcon"))
|
||||
.Select(b => b.Attribute("ToolTip")?.Value ?? "?")
|
||||
.ToList();
|
||||
Assert.True(offenders.Count == 0, "제목 표시줄 버튼의 아이콘을 패널로 감싸야 한다: " + string.Join(", ", offenders));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ContentlessCheckBoxes_MustResetMinWidth_ToAvoidClipping()
|
||||
{
|
||||
// 실측 결함(2026-10): Wpf.Ui CheckBox의 기본 MinWidth 때문에 32px 열의 행 선택 체크박스가 반쯤 잘렸다.
|
||||
var offenders = new List<string>();
|
||||
foreach (var file in ViewXamlFiles())
|
||||
{
|
||||
foreach (var cb in XDocument.Load(file).Descendants().Where(e => e.Name.LocalName == "CheckBox"))
|
||||
{
|
||||
var hasContent = cb.Attribute("Content") != null || cb.Elements().Any(c => !c.Name.LocalName.Contains('.'));
|
||||
if (!hasContent && cb.Attribute("MinWidth")?.Value != "0")
|
||||
offenders.Add($"{Path.GetFileName(file)}: {cb.Attribute("IsChecked")?.Value}");
|
||||
}
|
||||
}
|
||||
Assert.True(offenders.Count == 0, "내용 없는 체크박스는 MinWidth=\"0\"이어야 한다:\n" + string.Join("\n", offenders));
|
||||
}
|
||||
|
||||
[Theory]
|
||||
[InlineData("FsPathInputStyle")]
|
||||
[InlineData("FsPasswordInputStyle")]
|
||||
public void InputTemplates_MustNotPadOuterBorder_TextBoxBaseAlreadyPadsContentHost(string styleKey)
|
||||
{
|
||||
// 실측 결함(2026-10): TextBoxBase가 Padding을 PART_ContentHost에 넘기는데 바깥 Border에도 Padding을 걸어
|
||||
// 글자가 22px(10+10+2) 들여 씌어졌다. 여백은 한 곳(콘텐츠 호스트)에서만 준다.
|
||||
var doc = XDocument.Load(Path.Combine(ViewsDir, "FormatShiftTheme.xaml"));
|
||||
var style = doc.Descendants().First(e => e.Attribute(X + "Key")?.Value == styleKey);
|
||||
var outer = style.Descendants().First(e => e.Attribute(X + "Name")?.Value == "PART_Bd");
|
||||
Assert.Null(outer.Attribute("Padding"));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void CodeBehindCopy_MustSay대기열_NotQueueJargon()
|
||||
{
|
||||
// 화면 어휘는 탭 이름과 같은 '대기열'로 통일한다(같은 대상을 두 이름으로 부르지 않는다).
|
||||
var code = File.ReadAllText(Path.Combine(ViewsDir, "MainWindow.xaml.cs"));
|
||||
var literals = Regex.Matches(code, "\\$?\"([^\"\\\\]|\\\\.)*\"").Select(m => m.Value).Where(v => v.Contains('큐')).ToList();
|
||||
Assert.True(literals.Count == 0, "사용자 문구에 '큐'가 남아 있습니다:\n" + string.Join("\n", literals));
|
||||
}
|
||||
|
||||
[Theory]
|
||||
[InlineData("ImageProgressiveCheck")]
|
||||
[InlineData("ImageStripMetadataCheck")]
|
||||
public void SidebarCheckLabels_MustFitOneLine_WithoutMidWordBreak(string checkName)
|
||||
{
|
||||
// 사이드바 카드 안쪽 폭(약 230px, 14px 본문)에서 한 줄에 들어가야 한글이 낱자로 끊기지 않는다.
|
||||
var doc = XDocument.Load(Path.Combine(ViewsDir, "MainWindow.xaml"));
|
||||
var cb = doc.Descendants().First(e => e.Attribute(X + "Name")?.Value == checkName);
|
||||
var text = cb.Descendants().First(e => e.Name.LocalName == "TextBlock").Attribute("Text")!.Value;
|
||||
Assert.True(text.Length <= 16, $"{checkName} 라벨이 너무 깁니다({text.Length}자): {text}");
|
||||
}
|
||||
|
||||
// ───────────────────────── 6. 시스템 테마 추종 ─────────────────────────
|
||||
|
||||
[Fact]
|
||||
public void ThemeService_ResolvesPaletteUri_PerMode()
|
||||
{
|
||||
Assert.EndsWith("Themes/FsPalette.Dark.xaml", FsThemeService.PaletteUri(FsThemeMode.Dark).OriginalString);
|
||||
Assert.EndsWith("Themes/FsPalette.Light.xaml", FsThemeService.PaletteUri(FsThemeMode.Light).OriginalString);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void App_MustFollowSystemTheme_AtStartup()
|
||||
{
|
||||
var appCs = File.ReadAllText(Path.Combine(SolutionRoot, "src", "Everything2Everything.App", "App.xaml.cs"));
|
||||
Assert.Contains("FsThemeService.FollowSystem", appCs);
|
||||
var appXaml = File.ReadAllText(Path.Combine(SolutionRoot, "src", "Everything2Everything.App", "App.xaml"));
|
||||
Assert.Contains("Themes/FsPalette.Dark.xaml", appXaml);
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue