private void ShowButton_Click(object sender, RoutedEventArgs e) { var candidate = new CandidateInfo() { Name = tbName.Text, Number = tbNumber.Text, Company = tbCompany.Text, Score = tbScore.Text, Score1 = tbScore1.Text, Score2 = tbScore2.Text }; CandidateInfoUpdated?.Invoke(this, candidate); }
public MainWindow(ConsoleWindow consoleWindow) { InitializeComponent(); this.consoleWindow = consoleWindow; this.consoleWindow.CandidateInfoUpdated += ConsoleWindow_CandidateInfoUpdated; this.consoleWindow.Closed += ConsoleWindow_Closed; this.consoleWindow.ToggleElements += ConsoleWindow_ToggleElements; this.DataContextChanged += MainWindow_DataContextChanged; this.consoleWindow.Show(); DataContext = new CandidateInfo() { Number = "1", Name = "米热班姑·买买提明", Company = "广州海关", Score = "92.6", Score1 = "95.6", Score2 = "3" }; }
private void ConsoleWindow_CandidateInfoUpdated(object sender, CandidateInfo e) { DataContext = e; }