summaryrefslogtreecommitdiffstats
path: root/win/CS
diff options
context:
space:
mode:
authorsr55 <[email protected]>2016-03-21 12:57:48 +0000
committersr55 <[email protected]>2016-03-21 12:57:48 +0000
commita3e695dd5c0d23692ed0e99624723e39305cdd8d (patch)
treef0e35b49e53372022af3a78245668a76193230b4 /win/CS
parent9e9167bb63f14f176913cc42521d45639512c15a (diff)
WinGui: Some fixes and tidyup of the new logging code.
Diffstat (limited to 'win/CS')
-rw-r--r--win/CS/HandBrake.ApplicationServices/Services/Logging/LogService.cs6
-rw-r--r--win/CS/HandBrake.ApplicationServices/Services/Logging/Model/LogMessageType.cs2
-rw-r--r--win/CS/HandBrakeWPF/Services/Encode/EncodeBase.cs10
-rw-r--r--win/CS/HandBrakeWPF/Services/Encode/LibEncode.cs2
-rw-r--r--win/CS/HandBrakeWPF/Views/LogView.xaml22
-rw-r--r--win/CS/HandBrakeWPF/Views/LogView.xaml.cs6
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);
}
/// <summary>
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
/// <summary>
/// The write file.
/// </summary>
- /// <param name="fileName">
- /// The file name.
- /// </param>
/// <param name="content">
/// The content.
/// </param>
- private void WriteFile(string fileName, string content)
+ /// <param name="fileName">
+ /// The file name.
+ /// </param>
+ 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
/// <param name="message">Log message content</param>
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 @@
<RowDefinition Height="Auto" />
<RowDefinition Height="*" />
</Grid.RowDefinitions>
+
<ToolBar Grid.Row="0"
ToolBar.OverflowMode="Never"
ToolBarTray.IsLocked="True"
@@ -38,7 +39,26 @@
</ToolBar>
- <TextBox Grid.Row="2" ScrollViewer.VerticalScrollBarVisibility="Visible" TextWrapping="Wrap" x:Name="logText" />
+ <TextBox Grid.Row="2" ScrollViewer.VerticalScrollBarVisibility="Visible" TextWrapping="Wrap" x:Name="logText">
+
+ <TextBox.ContextMenu>
+ <ContextMenu>
+ <MenuItem Header="{x:Static Properties:ResourcesUI.LogView_CopyClipboard}" cal:Message.Attach="[Event Click] = [Action CopyLog]" >
+ <MenuItem.Icon>
+ <Image Width="16" Source="Images/copy.png" />
+ </MenuItem.Icon>
+ </MenuItem>
+ <MenuItem Header="{x:Static Properties:ResourcesUI.LogView_OpenLogDir}" cal:Message.Attach="[Event Click] = [Action OpenLogDirectory]">
+ <MenuItem.Icon>
+ <Image Width="16" Source="Images/folder.png" />
+ </MenuItem.Icon>
+ </MenuItem>
+ <Separator />
+ <MenuItem Header="Auto Scroll" IsCheckable="True" IsChecked="True" x:Name="AutoScroll" />
+
+ </ContextMenu>
+ </TextBox.ContextMenu>
+ </TextBox>
</Grid>
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();
+ }
}
}