using System.Windows; namespace PluginListener { /// /// Alert.xaml 的交互逻辑 /// public partial class Alert : Window { public Alert() { InitializeComponent(); } public void Open(string msg) { Dispatcher.Invoke(() => { label.Content = msg; this.Show(); }); } public void DoHide() { Dispatcher.Invoke(() => { this.Hide(); }); } public void DoClose() { Dispatcher.Invoke(() => { this.Close(); }); } protected override void OnClosing(System.ComponentModel.CancelEventArgs e) { e.Cancel = true; } private void Button_Click(object sender, RoutedEventArgs e) { this.Hide(); } } }