This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
using System.Windows;
|
||||
using MembranePoreTester.ViewModels;
|
||||
using System.Windows;
|
||||
|
||||
namespace MembranePoreTester.Views
|
||||
{
|
||||
@@ -7,6 +8,37 @@ namespace MembranePoreTester.Views
|
||||
public MainWindow()
|
||||
{
|
||||
InitializeComponent();
|
||||
HistoryWindow.LoadRecordEvent += OnLoadRecord;
|
||||
}
|
||||
|
||||
private void OnLoadRecord(object sender, LoadRecordEventArgs e)
|
||||
{
|
||||
var mainVM = DataContext as MainViewModel;
|
||||
if (mainVM == null) return;
|
||||
|
||||
// 根据工位和类型找到对应的 ViewModel
|
||||
if (e.Type == "泡点法")
|
||||
{
|
||||
var targetVM = mainVM.Stations[e.TargetStation - 1].BubblePointVM;
|
||||
targetVM.LoadFromDatabase(e.RecordId);
|
||||
}
|
||||
else
|
||||
{
|
||||
var targetVM = mainVM.Stations[e.TargetStation - 1].PoreDistributionVM;
|
||||
targetVM.LoadFromDatabase(e.RecordId);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private void OpenHistory_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
var mainVM = DataContext as MainViewModel;
|
||||
if (mainVM == null) return;
|
||||
|
||||
// 获取当前选中的工位(可选)
|
||||
int currentStation = 1; // 可获取当前Tab索引+1
|
||||
var historyWin = new HistoryWindow { SelectedStation = currentStation };
|
||||
historyWin.ShowDialog();
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user