From d1bf076c0e976e55bd816e2a21c34d4ed19992d0 Mon Sep 17 00:00:00 2001 From: "GukSang.Jin" Date: Wed, 1 Apr 2026 19:22:59 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Cardiopulmonarybypasssystems/MainWindow.xaml | 68 +++---------------- .../MainWindow.xaml.cs | 40 ++++++++++- 2 files changed, 47 insertions(+), 61 deletions(-) diff --git a/Cardiopulmonarybypasssystems/MainWindow.xaml b/Cardiopulmonarybypasssystems/MainWindow.xaml index f084e0f..dbf5243 100644 --- a/Cardiopulmonarybypasssystems/MainWindow.xaml +++ b/Cardiopulmonarybypasssystems/MainWindow.xaml @@ -1203,37 +1203,10 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + @@ -1305,18 +1278,9 @@ - - - - - - - - - - - - + + + - - - - - - - - - + - - - - - - - - diff --git a/Cardiopulmonarybypasssystems/MainWindow.xaml.cs b/Cardiopulmonarybypasssystems/MainWindow.xaml.cs index ffd8acd..d4af820 100644 --- a/Cardiopulmonarybypasssystems/MainWindow.xaml.cs +++ b/Cardiopulmonarybypasssystems/MainWindow.xaml.cs @@ -1,4 +1,8 @@ -using System.Windows; +using System.Globalization; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Data; +using System.Windows.Shapes; using Cardiopulmonarybypasssystems.ViewModels; namespace Cardiopulmonarybypasssystems; @@ -9,5 +13,39 @@ public partial class MainWindow : Window { InitializeComponent(); DataContext = viewModel; + ConfigureTrendBindings(); + } + + private void ConfigureTrendBindings() + { + var converter = (IMultiValueConverter)Resources["TrendPointCollectionConverter"]; + + BindTrendPolyline(ProximalPressureTrendPolyline, PressureTrendCanvas, converter, "ProximalPressureTrendValues", "PressureTrendMax"); + BindTrendPolyline(DistalPressureTrendPolyline, PressureTrendCanvas, converter, "DistalPressureTrendValues", "PressureTrendMax"); + BindTrendPolyline(DeltaPressureTrendPolyline, PressureTrendCanvas, converter, "DeltaPressureTrendValues", "PressureTrendMax"); + BindTrendPolyline(FlowTrendPrimaryPolyline, FlowTrendCanvas, converter, "ActiveFlowTrendPrimaryValues", "FlowTrendMax"); + BindTrendPolyline(FlowTrendSecondaryPolyline, FlowTrendCanvas, converter, "ActiveFlowTrendSecondaryValues", "FlowTrendMax"); + BindTrendPolyline(FlowTrendTertiaryPolyline, FlowTrendCanvas, converter, "ActiveFlowTrendTertiaryValues", "FlowTrendMax"); + } + + private static void BindTrendPolyline( + Polyline polyline, + Canvas canvas, + IMultiValueConverter converter, + string valuesPath, + string maxPath) + { + var binding = new MultiBinding + { + Converter = converter, + ConverterCulture = CultureInfo.CurrentCulture + }; + + binding.Bindings.Add(new Binding(valuesPath)); + binding.Bindings.Add(new Binding(nameof(ActualWidth)) { Source = canvas }); + binding.Bindings.Add(new Binding(nameof(ActualHeight)) { Source = canvas }); + binding.Bindings.Add(new Binding(maxPath)); + + BindingOperations.SetBinding(polyline, Polyline.PointsProperty, binding); } }