From a3e695dd5c0d23692ed0e99624723e39305cdd8d Mon Sep 17 00:00:00 2001 From: sr55 Date: Mon, 21 Mar 2016 12:57:48 +0000 Subject: WinGui: Some fixes and tidyup of the new logging code. --- .../Services/Logging/LogService.cs | 6 +++--- .../Services/Logging/Model/LogMessageType.cs | 2 +- win/CS/HandBrakeWPF/Services/Encode/EncodeBase.cs | 10 +++++----- win/CS/HandBrakeWPF/Services/Encode/LibEncode.cs | 2 +- win/CS/HandBrakeWPF/Views/LogView.xaml | 22 +++++++++++++++++++++- win/CS/HandBrakeWPF/Views/LogView.xaml.cs | 6 +++++- 6 files changed, 36 insertions(+), 12 deletions(-) diff --git a/win/CS/HandBrake.ApplicationServices/Services/Logging/LogService.cs b/win/CS/HandBrake.ApplicationServices/Services/Logging/LogService.cs index cd0d5a483..b0292ca31 100644 --- a/win/CS/HandBrake.ApplicationServices/Services/Logging/LogService.cs +++ b/win/CS/HandBrake.ApplicationServices/Services/Logging/LogService.cs @@ -120,7 +120,7 @@ namespace HandBrake.ApplicationServices.Services.Logging this.messageIndex = this.messageIndex + 1; msg = new LogMessage( "Log Service Pausing. Too Many Log messages. This may indicate a problem with your encode.", - LogMessageType.Vital, + LogMessageType.Application, LogLevel.Error, this.messageIndex); this.logMessages.Add(msg); @@ -204,7 +204,7 @@ namespace HandBrake.ApplicationServices.Services.Logging } catch (Exception exc) { - this.LogMessage("Failed to Initialise Disk Logging. " + Environment.NewLine + exc, LogMessageType.Vital, LogLevel.Error); + this.LogMessage("Failed to Initialise Disk Logging. " + Environment.NewLine + exc, LogMessageType.Application, LogLevel.Error); if (this.fileWriter != null) { @@ -227,7 +227,7 @@ namespace HandBrake.ApplicationServices.Services.Logging public void SetupLogHeader(string header) { this.logHeader = header; - this.LogMessage(header, LogMessageType.Vital, LogLevel.Info); + this.LogMessage(header, LogMessageType.Application, LogLevel.Info); } /// diff --git a/win/CS/HandBrake.ApplicationServices/Services/Logging/Model/LogMessageType.cs b/win/CS/HandBrake.ApplicationServices/Services/Logging/Model/LogMessageType.cs index 47302a872..dfa467b4a 100644 --- a/win/CS/HandBrake.ApplicationServices/Services/Logging/Model/LogMessageType.cs +++ b/win/CS/HandBrake.ApplicationServices/Services/Logging/Model/LogMessageType.cs @@ -17,6 +17,6 @@ namespace HandBrake.ApplicationServices.Services.Logging.Model ScanOrEncode, API, Progress, - Vital, + Application, } } diff --git a/win/CS/HandBrakeWPF/Services/Encode/EncodeBase.cs b/win/CS/HandBrakeWPF/Services/Encode/EncodeBase.cs index 801a8c9cc..ed06d2cf6 100644 --- a/win/CS/HandBrakeWPF/Services/Encode/EncodeBase.cs +++ b/win/CS/HandBrakeWPF/Services/Encode/EncodeBase.cs @@ -170,19 +170,19 @@ namespace HandBrakeWPF.Services.Encode /// /// The write file. /// - /// - /// The file name. - /// /// /// The content. /// - private void WriteFile(string fileName, string content) + /// + /// The file name. + /// + private void WriteFile(string content, string fileName) { try { using (StreamWriter fileWriter = new StreamWriter(fileName) { AutoFlush = true }) { - fileWriter.WriteLineAsync(content); + fileWriter.Write(content); } } catch (Exception exc) diff --git a/win/CS/HandBrakeWPF/Services/Encode/LibEncode.cs b/win/CS/HandBrakeWPF/Services/Encode/LibEncode.cs index e8b920c57..df86058df 100644 --- a/win/CS/HandBrakeWPF/Services/Encode/LibEncode.cs +++ b/win/CS/HandBrakeWPF/Services/Encode/LibEncode.cs @@ -205,7 +205,7 @@ namespace HandBrakeWPF.Services.Encode /// Log message content protected void ServiceLogMessage(string message) { - this.log.LogMessage(string.Format("# {0}", message), LogMessageType.ScanOrEncode, LogLevel.Info); + this.log.LogMessage(string.Format("{0}# {1}{0}", Environment.NewLine, message), LogMessageType.ScanOrEncode, LogLevel.Info); } #endregion } diff --git a/win/CS/HandBrakeWPF/Views/LogView.xaml b/win/CS/HandBrakeWPF/Views/LogView.xaml index 878fd430a..4745203ba 100644 --- a/win/CS/HandBrakeWPF/Views/LogView.xaml +++ b/win/CS/HandBrakeWPF/Views/LogView.xaml @@ -17,6 +17,7 @@ + - + + + + + + + + + + + + + + + + + + + + diff --git a/win/CS/HandBrakeWPF/Views/LogView.xaml.cs b/win/CS/HandBrakeWPF/Views/LogView.xaml.cs index af07ae509..2ab427752 100644 --- a/win/CS/HandBrakeWPF/Views/LogView.xaml.cs +++ b/win/CS/HandBrakeWPF/Views/LogView.xaml.cs @@ -77,7 +77,11 @@ namespace HandBrakeWPF.Views { // This works better than Data Binding because of the scroll. this.logText.AppendText(Environment.NewLine + e.Log.Content); - this.logText.ScrollToEnd(); + + if (this.AutoScroll.IsChecked) + { + this.logText.ScrollToEnd(); + } } } -- cgit v1.2.3