2024-08-05 10:11:58 +08:00
|
|
|
|
using System.Windows;
|
|
|
|
|
|
|
|
|
|
|
|
namespace Serein.WorkBench
|
|
|
|
|
|
{
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// DebugWindow.xaml 的交互逻辑
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
public partial class LogWindow : Window
|
|
|
|
|
|
{
|
|
|
|
|
|
public LogWindow()
|
|
|
|
|
|
{
|
|
|
|
|
|
InitializeComponent();
|
|
|
|
|
|
}
|
2024-09-20 10:50:32 +08:00
|
|
|
|
|
2024-08-05 10:11:58 +08:00
|
|
|
|
public void AppendText(string text)
|
|
|
|
|
|
{
|
|
|
|
|
|
Dispatcher.BeginInvoke(() =>
|
|
|
|
|
|
{
|
|
|
|
|
|
LogTextBox.AppendText(text);
|
|
|
|
|
|
LogTextBox.ScrollToEnd();
|
|
|
|
|
|
});
|
|
|
|
|
|
}
|
2024-09-20 10:50:32 +08:00
|
|
|
|
public void Clear()
|
|
|
|
|
|
{
|
|
|
|
|
|
Dispatcher.BeginInvoke(() =>
|
|
|
|
|
|
{
|
|
|
|
|
|
LogTextBox.Clear();
|
|
|
|
|
|
});
|
|
|
|
|
|
}
|
2024-08-05 10:11:58 +08:00
|
|
|
|
private void ClearLog_Click(object sender, RoutedEventArgs e)
|
|
|
|
|
|
{
|
|
|
|
|
|
LogTextBox.Clear();
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private void Window_Closing(object sender, System.ComponentModel.CancelEventArgs e)
|
|
|
|
|
|
{
|
|
|
|
|
|
e.Cancel = true; // 取消关闭操作
|
|
|
|
|
|
this.Hide(); // 隐藏窗体而不是关闭
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|