Skip to content

Commit 5aaa1fa

Browse files
Clean logbox on start
1 parent bdc4efe commit 5aaa1fa

File tree

3 files changed

+33
-3
lines changed

3 files changed

+33
-3
lines changed

PotatoNV-next/Controls/LogBox.xaml.cs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,17 @@ private void OnProgress(ProgressEventArgs progressEventArgs)
7373
}
7474
}
7575

76+
public void Clear()
77+
{
78+
if (!Dispatcher.CheckAccess())
79+
{
80+
Dispatcher.Invoke(() => Clear());
81+
return;
82+
}
83+
84+
logBox.Clear();
85+
}
86+
7687
public LogBox()
7788
{
7889
InitializeComponent();

PotatoNV-next/MainWindow.xaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,6 @@
3737
</TabItem>
3838
</TabControl>
3939

40-
<controls:LogBox />
40+
<controls:LogBox x:Name="logBox" />
4141
</UniformGrid>
4242
</Window>

PotatoNV-next/MainWindow.xaml.cs

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
using PotatoNV_next.Utils;
33
using System;
44
using System.Collections.Generic;
5+
using System.Globalization;
56
using System.Linq;
67
using System.Text;
78
using System.Threading.Tasks;
@@ -19,15 +20,33 @@ namespace PotatoNV_next
1920
{
2021
public partial class MainWindow : Window
2122
{
23+
Core core = new Core();
2224

2325
public MainWindow()
2426
{
2527
Icon = MediaConverter.ImageSourceFromBitmap(Properties.Resources.Fire.ToBitmap());
2628
InitializeComponent();
2729

28-
var core = new Core();
29-
nvFrom.OnFormSubmit += core.StartProcess;
30+
nvFrom.OnFormSubmit += NvFrom_OnFormSubmit;
3031
core.RunWorkerCompleted += Core_RunWorkerCompleted;
32+
33+
SetupLog();
34+
}
35+
36+
private void NvFrom_OnFormSubmit(Controls.NVForm.FormEventArgs formEventArgs)
37+
{
38+
SetupLog();
39+
core.StartProcess(formEventArgs);
40+
}
41+
42+
public void SetupLog()
43+
{
44+
logBox.Clear();
45+
Log.Info($"PotatoNV v{Controls.AboutTab.GetVersion()}");
46+
Log.Info("User manual: https://kutt.it/pnv-"
47+
+ (CultureInfo.InstalledUICulture.TwoLetterISOLanguageName == "ru"
48+
? "ru"
49+
: "en"));
3150
}
3251

3352
private void Core_RunWorkerCompleted()

0 commit comments

Comments
 (0)