초기 커밋: SheetMe 서식생성기 (P0~P5 완료 상태)
레거시 서식생성기(VB.NET WinForms) 대체용 C#/.NET 10 WPF 디자이너. 기준선: 실DB 활성 디자인 1,271건 왕복 의미론 diff 0 / 예외 0, 단위 테스트 49/49. 이 커밋에 함께 포함된 자격증명 분리: - appsettings.json 을 __HOST__/__PASSWORD__ 플레이스홀더로 전환 - 실접속 정보는 appsettings.Development.json 으로 분리(.gitignore 제외, csproj Debug 조건부 복사라 Release 산출물에 실리지 않음) - ConfigLoader 를 환경변수 > Development > appsettings 순 레이어링으로 변경, 미치환 플레이스홀더는 '미설정'으로 간주 Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,73 @@
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Documents;
|
||||
using SheetMe.Designer.Services;
|
||||
using SheetMe.Designer.ViewModels;
|
||||
|
||||
namespace SheetMe.Designer.Views;
|
||||
|
||||
/// <summary>미리보기 창 — 편집 크롬 없는 페이지 렌더(인쇄와 동일 비주얼) + 줌/인쇄.</summary>
|
||||
public partial class PreviewWindow : Window
|
||||
{
|
||||
#region Member Fields
|
||||
private readonly DesignerViewModel designer;
|
||||
private double zoom = 1.0;
|
||||
#endregion
|
||||
|
||||
#region Constructors
|
||||
public PreviewWindow(DesignerViewModel designer)
|
||||
{
|
||||
this.designer = designer;
|
||||
InitializeComponent();
|
||||
BuildPages();
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Methods
|
||||
private void BuildPages()
|
||||
{
|
||||
PagesHost.Children.Clear();
|
||||
foreach (var page in designer.Pages)
|
||||
{
|
||||
var frame = new Border
|
||||
{
|
||||
Background = page.PaperBrush,
|
||||
BorderBrush = System.Windows.Media.Brushes.LightGray,
|
||||
BorderThickness = new Thickness(1),
|
||||
Margin = new Thickness(0, 0, 0, 20),
|
||||
Child = PrintService.BuildPageVisual(page),
|
||||
Width = page.WidthDip,
|
||||
Height = page.HeightDip,
|
||||
};
|
||||
PagesHost.Children.Add(frame);
|
||||
}
|
||||
}
|
||||
|
||||
private void OnPrint(object sender, RoutedEventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
PrintService.Print(designer, designer.Document.Title.Length > 0
|
||||
? designer.Document.Title
|
||||
: designer.Document.FormId);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show($"인쇄 중 오류가 발생했습니다.\n\n{ex.Message}", "오류",
|
||||
MessageBoxButton.OK, MessageBoxImage.Error);
|
||||
}
|
||||
}
|
||||
|
||||
private void OnZoomIn(object sender, RoutedEventArgs e) => ApplyZoom(zoom * 1.15);
|
||||
|
||||
private void OnZoomOut(object sender, RoutedEventArgs e) => ApplyZoom(zoom / 1.15);
|
||||
|
||||
private void ApplyZoom(double value)
|
||||
{
|
||||
zoom = Math.Clamp(value, 0.25, 3.0);
|
||||
ZoomTransform.ScaleX = zoom;
|
||||
ZoomTransform.ScaleY = zoom;
|
||||
ZoomText.Text = $"{zoom * 100:0}%";
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
Reference in New Issue
Block a user