From d54f5b8e22717e26be8d51a550d5d8bb13990d1a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=9A=D1=83=D1=80=D0=BD=D0=B0=D1=82=20=D0=90=D0=BD=D0=B4?= =?UTF-8?q?=D1=80=D0=B5=D0=B9?= Date: Mon, 23 Mar 2026 06:07:50 +0300 Subject: [PATCH] edit --- XLAB/MainWindow.xaml | 2 + XLAB/MainWindow.xaml.cs | 7 + XLAB/PlanningDialogService.cs | 70 ++++ XLAB/PlanningEditWindow.xaml | 111 ++++++ XLAB/PlanningEditWindow.xaml.cs | 20 + XLAB/PlanningEditWindowViewModel.cs | 250 +++++++++++++ XLAB/PlanningModels.cs | 157 ++++++++ XLAB/PlanningService.cs | 394 ++++++++++++++++++++ XLAB/PlanningWindow.xaml | 161 ++++++++ XLAB/PlanningWindow.xaml.cs | 33 ++ XLAB/PlanningWindowViewModel.cs | 546 ++++++++++++++++++++++++++++ XLAB/XLAB.csproj | 21 ++ 12 files changed, 1772 insertions(+) create mode 100644 XLAB/PlanningDialogService.cs create mode 100644 XLAB/PlanningEditWindow.xaml create mode 100644 XLAB/PlanningEditWindow.xaml.cs create mode 100644 XLAB/PlanningEditWindowViewModel.cs create mode 100644 XLAB/PlanningModels.cs create mode 100644 XLAB/PlanningService.cs create mode 100644 XLAB/PlanningWindow.xaml create mode 100644 XLAB/PlanningWindow.xaml.cs create mode 100644 XLAB/PlanningWindowViewModel.cs diff --git a/XLAB/MainWindow.xaml b/XLAB/MainWindow.xaml index ba3789f..13a0139 100644 --- a/XLAB/MainWindow.xaml +++ b/XLAB/MainWindow.xaml @@ -46,6 +46,8 @@ Click="TypeSizeDirectoryMenuItem_Click" /> + diff --git a/XLAB/MainWindow.xaml.cs b/XLAB/MainWindow.xaml.cs index b82cd8f..135b1e1 100644 --- a/XLAB/MainWindow.xaml.cs +++ b/XLAB/MainWindow.xaml.cs @@ -100,6 +100,13 @@ namespace XLAB window.ShowDialog(); } + private void PlanningMenuItem_Click(object sender, RoutedEventArgs e) + { + var window = new PlanningWindow(); + window.Owner = this; + window.ShowDialog(); + } + private void SpoiDirectoryMenuItem_Click(object sender, RoutedEventArgs e) { var window = new SpoiDirectoryWindow(); diff --git a/XLAB/PlanningDialogService.cs b/XLAB/PlanningDialogService.cs new file mode 100644 index 0000000..e8f6e0b --- /dev/null +++ b/XLAB/PlanningDialogService.cs @@ -0,0 +1,70 @@ +using System.Collections.Generic; +using System.Windows; + +namespace XLAB +{ + internal interface IPlanningDialogService + { + PlanningEditResult ShowPlanningEditDialog(PlanningEditSeed seed, bool isNew, IReadOnlyList instruments, PlanningService service); + + EkzDirectoryItem ShowEkzEditDialog(EkzDirectoryItem seed, bool isNew, IReadOnlyList existingItems, EkzDirectoryService service); + + bool Confirm(string message); + + void ShowError(string message); + + void ShowInfo(string message); + + void ShowWarning(string message); + } + + internal sealed class PlanningDialogService : IPlanningDialogService + { + private readonly Window _owner; + + public PlanningDialogService(Window owner) + { + _owner = owner; + } + + public bool Confirm(string message) + { + return MessageBox.Show(_owner, message, "ПСВ", MessageBoxButton.YesNo, MessageBoxImage.Question) == MessageBoxResult.Yes; + } + + public EkzDirectoryItem ShowEkzEditDialog(EkzDirectoryItem seed, bool isNew, IReadOnlyList existingItems, EkzDirectoryService service) + { + var viewModel = new EkzEditWindowViewModel(seed, isNew, existingItems, service); + var window = new EkzEditWindow(viewModel); + window.Owner = _owner; + + var result = window.ShowDialog(); + return result.HasValue && result.Value ? viewModel.ToResult() : null; + } + + public void ShowError(string message) + { + MessageBox.Show(_owner, message, "ПСВ", MessageBoxButton.OK, MessageBoxImage.Error); + } + + public void ShowInfo(string message) + { + MessageBox.Show(_owner, message, "ПСВ", MessageBoxButton.OK, MessageBoxImage.Information); + } + + public PlanningEditResult ShowPlanningEditDialog(PlanningEditSeed seed, bool isNew, IReadOnlyList instruments, PlanningService service) + { + var viewModel = new PlanningEditWindowViewModel(seed, isNew, instruments, service); + var window = new PlanningEditWindow(viewModel); + window.Owner = _owner; + + var result = window.ShowDialog(); + return result.HasValue && result.Value ? viewModel.ToResult() : null; + } + + public void ShowWarning(string message) + { + MessageBox.Show(_owner, message, "ПСВ", MessageBoxButton.OK, MessageBoxImage.Warning); + } + } +} diff --git a/XLAB/PlanningEditWindow.xaml b/XLAB/PlanningEditWindow.xaml new file mode 100644 index 0000000..f07613c --- /dev/null +++ b/XLAB/PlanningEditWindow.xaml @@ -0,0 +1,111 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +