Add project files.
This commit is contained in:
68
Debug.xaml.cs
Normal file
68
Debug.xaml.cs
Normal file
@@ -0,0 +1,68 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Data;
|
||||
using System.Windows.Documents;
|
||||
using System.Windows.Input;
|
||||
using System.Windows.Media;
|
||||
using System.Windows.Media.Imaging;
|
||||
using System.Windows.Shapes;
|
||||
using Microsoft.Win32;
|
||||
|
||||
namespace AnotherReplayReader
|
||||
{
|
||||
public sealed class DebugMessageWrapper : INotifyPropertyChanged
|
||||
{
|
||||
public event PropertyChangedEventHandler PropertyChanged;
|
||||
public string DebugMessage
|
||||
{
|
||||
get => _debugMessage;
|
||||
set
|
||||
{
|
||||
_debugMessage = value;
|
||||
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs("DebugMessage"));
|
||||
}
|
||||
}
|
||||
|
||||
private string _debugMessage;
|
||||
}
|
||||
/// <summary>
|
||||
/// Debug.xaml 的交互逻辑
|
||||
/// </summary>
|
||||
public sealed partial class Debug : Window
|
||||
{
|
||||
public static readonly DebugMessageWrapper Instance = new DebugMessageWrapper();
|
||||
|
||||
public Debug()
|
||||
{
|
||||
DataContext = Instance;
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
private void OnExport_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
var saveFileDialog = new SaveFileDialog
|
||||
{
|
||||
Filter = "文本文档 (*.txt)|*.txt|所有文件 (*.*)|*.*",
|
||||
OverwritePrompt = true,
|
||||
};
|
||||
|
||||
var result = saveFileDialog.ShowDialog(this);
|
||||
if (result == true)
|
||||
{
|
||||
using (var file = saveFileDialog.OpenFile())
|
||||
using (var writer = new StreamWriter(file))
|
||||
{
|
||||
writer.Write(Instance.DebugMessage);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user