Skip to content

Commit 2b7c43c

Browse files
committed
use appendtext to log
1 parent 35015ca commit 2b7c43c

2 files changed

Lines changed: 10 additions & 18 deletions

File tree

LuaSTGEditorSharp/MainWindow.xaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -972,8 +972,8 @@
972972
</DataGrid>
973973
</TabItem>
974974
<TabItem x:Name="tabOutput" Header="Debug Log">
975-
<TextBox x:Name="debugOutput" VerticalScrollBarVisibility="Visible"
976-
Text="{Binding DebugString, ElementName=window}" IsReadOnly="True"/>
975+
<TextBox x:Name="debugOutput" VerticalScrollBarVisibility="Visible"
976+
IsReadOnly="True"/>
977977
</TabItem>
978978
</TabControl>
979979
<GridSplitter Grid.Row="1" HorizontalAlignment="Stretch" Opacity="0"/>

LuaSTGEditorSharp/MainWindow.xaml.cs

Lines changed: 8 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,6 @@ public partial class MainWindow : Window, INotifyPropertyChanged, IMainWindow
4848
{
4949
DocumentCollection Documents { get; } = new DocumentCollection();
5050

51-
private string debugString = "";
52-
5351
public ObservableCollection<ToolboxTab> toolboxData;
5452
public ObservableCollection<ToolboxTab> ToolboxData { get => toolboxData; }
5553

@@ -69,16 +67,6 @@ public partial class MainWindow : Window, INotifyPropertyChanged, IMainWindow
6967

7068
private bool packagingLocked = false;
7169

72-
public string DebugString
73-
{
74-
get => debugString;
75-
set
76-
{
77-
debugString = value;
78-
RaiseProertyChanged("DebugString");
79-
}
80-
}
81-
8270
public TreeNodeBase clipBoard = null;
8371

8472
public TreeNodeBase selectedNode = null;
@@ -647,7 +635,7 @@ private void ExportZip(bool run, TreeNodeBase SCDebugger = null, TreeNodeBase St
647635
TxtLine.Text = "";
648636
if (CompileWorker.IsBusy) throw new InvalidOperationException();
649637
CompileWorker.RunWorkerAsync(new object[] { current, SCDebugger, StageDebugger, run, saveMeta });
650-
DebugString = "";
638+
debugOutput.Clear();
651639
tabOutput.IsSelected = true;
652640
}
653641
catch (EXEPathNotSetException)
@@ -696,7 +684,7 @@ private void BeginPackaging(object sender, DoWorkEventArgs args)
696684
private void PackageProgressReport(object sender, ProgressChangedEventArgs args)
697685
{
698686
packagingLocked = true;
699-
DebugString += args.UserState?.ToString() + "\n";
687+
debugOutput.AppendText(args.UserState?.ToString() + "\n");
700688
debugOutput.ScrollToEnd();
701689
}
702690

@@ -724,10 +712,14 @@ private void RunLuaSTG(App currentApp, CompileProcess process)
724712
{
725713
ModName = process.projName
726714
});
727-
DebugString = "";
715+
debugOutput.Clear();
728716
PluginHandler.Plugin.Execution.Run((s) =>
729717
{
730-
DebugString += s + "\n";
718+
App.Current.Dispatcher.Invoke(() =>
719+
{
720+
debugOutput.AppendText(s + "\n");
721+
debugOutput.ScrollToEnd();
722+
});
731723
}
732724
, () => App.Current.Dispatcher.Invoke(() => debugOutput.ScrollToEnd()));
733725
}

0 commit comments

Comments
 (0)