2026-06-30 12:10:29 +08:00
|
|
|
|
using System.Windows;
|
2026-07-03 14:16:15 +08:00
|
|
|
|
using System.Windows.Controls;
|
|
|
|
|
|
using System.Windows.Data;
|
|
|
|
|
|
using SSPCTester.UI.Controls;
|
2026-06-30 12:10:29 +08:00
|
|
|
|
using SSPCTester.UI.ViewModels;
|
|
|
|
|
|
|
|
|
|
|
|
namespace SSPCTester.UI.Views;
|
|
|
|
|
|
|
|
|
|
|
|
public partial class CurvePopupWindow : Window
|
|
|
|
|
|
{
|
2026-07-03 14:16:15 +08:00
|
|
|
|
public CurvePopupWindow()
|
2026-06-30 12:10:29 +08:00
|
|
|
|
{
|
|
|
|
|
|
InitializeComponent();
|
2026-07-03 14:16:15 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public CurvePopupWindow(CurveTestViewModel vm, string? curveKind)
|
|
|
|
|
|
: this()
|
|
|
|
|
|
{
|
2026-06-30 12:10:29 +08:00
|
|
|
|
DataContext = vm;
|
2026-07-03 14:16:15 +08:00
|
|
|
|
ConfigureCurve(curveKind);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private void ConfigureCurve(string? curveKind)
|
|
|
|
|
|
{
|
|
|
|
|
|
bool isFalling = string.Equals(curveKind, "Falling", StringComparison.OrdinalIgnoreCase);
|
|
|
|
|
|
string title = isFalling ? "关断曲线(电压下降,10% 阈值)" : "开启曲线(电压上升,90% 阈值)";
|
|
|
|
|
|
|
|
|
|
|
|
Title = title;
|
|
|
|
|
|
TitleRun.Text = $"{title} ";
|
|
|
|
|
|
CurveTitleText.Text = title;
|
|
|
|
|
|
CurvePlot.IsRising = !isFalling;
|
|
|
|
|
|
|
|
|
|
|
|
CurvePlot.SetBinding(CurvePlotControl.CurveProperty, new Binding(isFalling ? "FallingCurve" : "RisingCurve"));
|
|
|
|
|
|
CurvePlot.SetBinding(CurvePlotControl.ViewStartMsProperty, new Binding(isFalling ? "FallingViewStartMs" : "RisingViewStartMs"));
|
|
|
|
|
|
CurvePlot.SetBinding(CurvePlotControl.ViewEndMsProperty, new Binding(isFalling ? "FallingViewEndMs" : "RisingViewEndMs"));
|
|
|
|
|
|
|
|
|
|
|
|
StartTextBox.SetBinding(TextBox.TextProperty, new Binding(isFalling ? "FallingViewStartMs" : "RisingViewStartMs")
|
|
|
|
|
|
{
|
|
|
|
|
|
UpdateSourceTrigger = UpdateSourceTrigger.PropertyChanged,
|
|
|
|
|
|
TargetNullValue = ""
|
|
|
|
|
|
});
|
|
|
|
|
|
EndTextBox.SetBinding(TextBox.TextProperty, new Binding(isFalling ? "FallingViewEndMs" : "RisingViewEndMs")
|
|
|
|
|
|
{
|
|
|
|
|
|
UpdateSourceTrigger = UpdateSourceTrigger.PropertyChanged,
|
|
|
|
|
|
TargetNullValue = ""
|
|
|
|
|
|
});
|
|
|
|
|
|
ResetButton.SetBinding(Button.CommandProperty, new Binding(isFalling ? "ResetFallingCurveViewCommand" : "ResetRisingCurveViewCommand"));
|
2026-06-30 12:10:29 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private void Close_Click(object sender, RoutedEventArgs e) => Close();
|
|
|
|
|
|
}
|