修了一堆东西

This commit is contained in:
2021-10-13 16:42:38 +02:00
parent 1f5f1c8e6c
commit 6fd0bf0046
5 changed files with 164 additions and 227 deletions

View File

@@ -1,37 +1,31 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using Microsoft.Win32;
using System;
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 sealed class DebugMessageWrapper
{
public event PropertyChangedEventHandler PropertyChanged;
public string DebugMessage
public readonly struct Proxy
{
get => _debugMessage;
set
public readonly string Payload;
public Proxy(string text)
{
_debugMessage = value;
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs("DebugMessage"));
Payload = text;
}
public static Proxy operator +(Proxy p, string text)
{
return string.IsNullOrEmpty(p.Payload) ? new Proxy(text) : new Proxy(p.Payload + text);
}
}
private string _debugMessage;
public event Action<string> NewText;
public Proxy DebugMessage
{
get => new Proxy();
set => NewText?.Invoke(value.Payload);
}
}
/// <summary>
/// Debug.xaml 的交互逻辑
@@ -42,8 +36,8 @@ namespace AnotherReplayReader
public Debug()
{
DataContext = Instance;
InitializeComponent();
Instance.NewText += t => Dispatcher.Invoke(() => _textBox.AppendText(t));
}
private void OnExport_Click(object sender, RoutedEventArgs e)
@@ -64,5 +58,10 @@ namespace AnotherReplayReader
}
}
}
private void OnClear_Click(object sender, RoutedEventArgs e)
{
_textBox.Clear();
}
}
}