ksj09406 9af4bf3bdb 플랫폼 묶음 - 트레이 · 창 자리 기억 · 세 갈래 묻는 창 · 탭 줄 크기
새 플랫폼(UbisamBase.Launcher 로 켜는 구조) 위에서 쌓인 변경을 한 번에 담는다.
자세한 것은 doc/history/changelog.md · doc/platform-guide.md.

- 트레이 아이콘(TrayIcon): 최소화하면 알림 영역으로, 왼쪽 단추로 되살리기 ·
  오른쪽 단추로 [열기]/[종료]. WinForms 의존 없이 Shell_NotifyIcon 만 쓴다
- 셸 창 모양 기억(ShellPlacement · ShellWindowPlacement.json): 마지막 모드와
  창모드 자리 · 크기. 켤 때 모니터 안으로 되돌리고(FitToMonitors), 배율이 크게 다른
  모니터에서 최대화가 오른쪽 · 아래로 넘치던 것을 고쳤다(NeedsMaximizeFix)
- 탭 줄 접기: 하단 [탭 접기]와 F11, 접으면 얇은 띠만 남고 띠를 누르면 펴진다
- MessageUtil.ShowChoice(DialogChoice): 세 갈래로 묻는 창 -
  예/아니오로는 버리고 가기와 그만두기를 가를 수 없다
- 덮는 창을 본 창의 실제 자리 가운데로(OwnerCentering) - 전체화면에서 세로로 어긋나던 것
- D 드라이브가 없는 PC 대응(ConfigLocation): %LOCALAPPDATA%\UbisamConfig 로 넘어가고,
  두 자리 다 못 쓰면 까닭을 적은 안내창(StartupMessages)
- 켤 때 터지면 창 없이 죽지 않고 로그 자리를 적은 안내창을 띄우고 끝낸다
- 설정 중복 등록 방지(SettingsService.RegisterSettings) - 코드가 쓰는 객체와
  설정 화면이 고치는 객체가 갈라지던 문제
- PlatformChrome.FullBleed 를 쓰는 화면을 위한 손질
- 하단 탭 줄 항목을 한 단계 작게(74 -> 61 DIP, 실측 133 -> 109px).
  모든 소비 프로그램의 탭 줄 높이가 함께 바뀐다(MergeHub 12차 C-2)

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-09-28 13:21:21 +09:00

61 lines
2.1 KiB
C#
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

using System;
using System.Text.Json;
using System.Text.Json.Nodes;
namespace UbisamBase.Core.Settings;
/// <summary>
/// <c>UiSettingsService.json</c> 에서 <b>한 항목만</b> 읽고 고쳐 쓴다(MergeHub 11차 F-4).
///
/// 아래 탭 줄 접기는 누를 때마다 바로 기억해야 한다. 그런데 <see cref="UiSettingsService.Save"/> 는
/// 지금 메모리의 값을 통째로 쓰므로, 설정 화면에서 바꾸고 아직 [저장] 하지 않은 테마 · 배율까지 함께 저장된다.
/// 그래서 파일의 다른 값(모르는 항목 포함)은 그대로 두고 이 항목만 바꾼다.
/// </summary>
public static class UiSettingsFile
{
public const string NavCollapsedKey = "NavCollapsed";
private static readonly JsonSerializerOptions Indented = new() { WriteIndented = true };
/// <summary>아래 탭 줄을 접어 둔 상태인지. 항목이 없거나 글이 망가졌으면 펼침(false).</summary>
public static bool ReadNavCollapsed(string? json)
{
try
{
return Parse(json) is JsonObject obj &&
obj[NavCollapsedKey] is JsonValue value &&
value.TryGetValue(out bool collapsed) && collapsed;
}
catch (Exception e) when (e is JsonException || e is InvalidOperationException || e is FormatException)
{
return false;
}
}
/// <summary>
/// 접기 항목만 바꾼 글. 글이 없거나 망가졌으면 그 항목만 든 새 글 - 망가진 파일은 어차피
/// <see cref="UiSettingsService.Initialize"/> 가 무시하고 기본값을 쓴다.
/// </summary>
public static string WithNavCollapsed(string? json, bool collapsed)
{
JsonObject obj;
try
{
obj = Parse(json) as JsonObject ?? new JsonObject();
}
catch (JsonException)
{
obj = new JsonObject();
}
obj[NavCollapsedKey] = collapsed;
return obj.ToJsonString(Indented);
}
private static JsonNode? Parse(string? json)
{
if (string.IsNullOrWhiteSpace(json)) return null;
return JsonNode.Parse(json!.TrimStart(''));
}
}