From 5aaa1fa6a412ec2b0fd19c314be4afa6dbd11419 Mon Sep 17 00:00:00 2001
From: mashed-potatoes <37037851+mashed-potatoes@users.noreply.github.com>
Date: Mon, 29 Jun 2020 13:13:02 +0500
Subject: [PATCH] Clean logbox on start
---
PotatoNV-next/Controls/LogBox.xaml.cs | 11 +++++++++++
PotatoNV-next/MainWindow.xaml | 2 +-
PotatoNV-next/MainWindow.xaml.cs | 23 +++++++++++++++++++++--
3 files changed, 33 insertions(+), 3 deletions(-)
diff --git a/PotatoNV-next/Controls/LogBox.xaml.cs b/PotatoNV-next/Controls/LogBox.xaml.cs
index 9c0d305..ac22292 100644
--- a/PotatoNV-next/Controls/LogBox.xaml.cs
+++ b/PotatoNV-next/Controls/LogBox.xaml.cs
@@ -73,6 +73,17 @@ namespace PotatoNV_next.Controls
}
}
+ public void Clear()
+ {
+ if (!Dispatcher.CheckAccess())
+ {
+ Dispatcher.Invoke(() => Clear());
+ return;
+ }
+
+ logBox.Clear();
+ }
+
public LogBox()
{
InitializeComponent();
diff --git a/PotatoNV-next/MainWindow.xaml b/PotatoNV-next/MainWindow.xaml
index 4d29487..3b6e4d5 100644
--- a/PotatoNV-next/MainWindow.xaml
+++ b/PotatoNV-next/MainWindow.xaml
@@ -37,6 +37,6 @@
-
+
diff --git a/PotatoNV-next/MainWindow.xaml.cs b/PotatoNV-next/MainWindow.xaml.cs
index cfe7dad..0f776c5 100644
--- a/PotatoNV-next/MainWindow.xaml.cs
+++ b/PotatoNV-next/MainWindow.xaml.cs
@@ -2,6 +2,7 @@
using PotatoNV_next.Utils;
using System;
using System.Collections.Generic;
+using System.Globalization;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
@@ -19,15 +20,33 @@ namespace PotatoNV_next
{
public partial class MainWindow : Window
{
+ Core core = new Core();
public MainWindow()
{
Icon = MediaConverter.ImageSourceFromBitmap(Properties.Resources.Fire.ToBitmap());
InitializeComponent();
- var core = new Core();
- nvFrom.OnFormSubmit += core.StartProcess;
+ nvFrom.OnFormSubmit += NvFrom_OnFormSubmit;
core.RunWorkerCompleted += Core_RunWorkerCompleted;
+
+ SetupLog();
+ }
+
+ private void NvFrom_OnFormSubmit(Controls.NVForm.FormEventArgs formEventArgs)
+ {
+ SetupLog();
+ core.StartProcess(formEventArgs);
+ }
+
+ public void SetupLog()
+ {
+ logBox.Clear();
+ Log.Info($"PotatoNV v{Controls.AboutTab.GetVersion()}");
+ Log.Info("User manual: https://kutt.it/pnv-"
+ + (CultureInfo.InstalledUICulture.TwoLetterISOLanguageName == "ru"
+ ? "ru"
+ : "en"));
}
private void Core_RunWorkerCompleted()