Display logs in a separate window.

This commit is contained in:
Tichau committed 2015-05-26 16:01:17 +02:00
1 parent 6944180acd
commit 5b49da745a
6 files changed
+72 -31

No files matched your search

@@ -75,11 +75,18 @@
<Compile Include="ConversionPreset.cs" />
<Compile Include="ValueConverters\InputTypesToBool.cs" />
<Compile Include="Settings.cs" />
<Compile Include="Windows\DiagnosticsWindow.xaml.cs">
<DependentUpon>DiagnosticsWindow.xaml</DependentUpon>
</Compile>
<Compile Include="Windows\SettingsWindow.xaml.cs">
<DependentUpon>SettingsWindow.xaml</DependentUpon>
</Compile>
<Compile Include="Version.cs" />
<Compile Include="XmlHelpers.cs" />
<Page Include="Windows\DiagnosticsWindow.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="Windows\MainWindow.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
@@ -0,0 +1,20 @@
<Window x:Class="FileConverter.Windows.DiagnosticsWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:FileConverter.Windows"
xmlns:fileConverter="clr-namespace:FileConverter"
mc:Ignorable="d"
Title="Diagnostics" Height="600" Width="800">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="30" />
<RowDefinition Height="*" />
</Grid.RowDefinitions>
<Label Grid.Row="0" Content="Logs" VerticalAlignment="Top" Height="30" FontSize="16" FontWeight="Bold" />
<ScrollViewer Grid.Row="1" VerticalScrollBarVisibility="Auto" HorizontalScrollBarVisibility="Auto" CanContentScroll="True">
<TextBlock Name="Diagnostics" TextWrapping="NoWrap" Text="{Binding Path=(fileConverter:Diagnostics.Content), Mode=OneWay}" FontFamily="Consolas" Foreground="#FF272727"/>
</ScrollViewer>
</Grid>
</Window>
@@ -0,0 +1,27 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;
namespace FileConverter.Windows
{
/// <summary>
/// Interaction logic for DiagnosticsWindow.xaml
/// </summary>
public partial class DiagnosticsWindow : Window
{
public DiagnosticsWindow()
{
InitializeComponent();
}
}
}
@@ -16,7 +16,6 @@
<Grid Margin="10">
<Grid.RowDefinitions>
<RowDefinition Height="30" />
<RowDefinition Height="2*" />
<RowDefinition Height="*" />
</Grid.RowDefinitions>
@@ -24,10 +23,12 @@
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
<ColumnDefinition Width="100" />
<ColumnDefinition Width="100" />
</Grid.ColumnDefinitions>
<Label Name="Title" Grid.Column="0" Content="Files to convert" VerticalAlignment="Top" Height="30" FontSize="16" FontWeight="Bold"/>
<Button Name="SettingsButton" Grid.Column="1" Content="Settings" Margin="0,3" Click="SettingsButton_OnClick"></Button>
<Button Name="DiagnosticsButton" Grid.Column="1" Content="Logs" Margin="3,3" Click="DiagnosticsButton_OnClick"/>
<Button Name="SettingsButton" Grid.Column="2" Content="Settings" Margin="3,3" Click="SettingsButton_OnClick"/>
</Grid>
<ScrollViewer x:Name="ScrollViewer" Grid.Row="1" VerticalScrollBarVisibility="Auto" CanContentScroll="True">
@@ -67,16 +68,5 @@
</ItemsControl.ItemTemplate>
</ItemsControl>
</ScrollViewer>
<Grid Grid.Row="2" Visibility="{Binding VerboseMode, Converter={StaticResource BooleanToVisibilityConverter}, ElementName=FileConverterMainWindow, Mode=OneWay}">
<Grid.RowDefinitions>
<RowDefinition Height="30" />
<RowDefinition Height="*" />
</Grid.RowDefinitions>
<Label Grid.Row="0" Content="Log" VerticalAlignment="Top" Height="30" FontSize="16" FontWeight="Bold" />
<ScrollViewer Grid.Row="1" VerticalScrollBarVisibility="Auto" HorizontalScrollBarVisibility="Auto" CanContentScroll="True">
<TextBlock Name="Diagnostics" TextWrapping="NoWrap" Text="{Binding Path=(local:Diagnostics.Content), Mode=OneWay}" FontFamily="Consolas" Foreground="#FF272727"/>
</ScrollViewer>
</Grid>
</Grid>
</Window>
@@ -7,6 +7,7 @@ namespace FileConverter
using System.Windows;
using FileConverter.Annotations;
using FileConverter.Windows;
public partial class MainWindow : Window, INotifyPropertyChanged
{
@@ -19,7 +20,11 @@ namespace FileConverter
Application application = Application.Current as Application;
this.ConverterJobsList.ItemsSource = application.ConvertionJobs;
this.VerboseMode = application.Verbose;
if (application.Verbose)
{
DiagnosticsWindow window = new DiagnosticsWindow();
window.Show();
}
if (application.ShowSettings)
{
@@ -31,21 +36,7 @@ namespace FileConverter
}
public event PropertyChangedEventHandler PropertyChanged;
public bool VerboseMode
{
get
{
return this.verboseMode;
}
set
{
this.verboseMode = value;
this.OnPropertyChanged();
}
}
[NotifyPropertyChangedInvocator]
protected virtual void OnPropertyChanged([CallerMemberName] string propertyName = null)
{
@@ -66,5 +57,11 @@ namespace FileConverter
{
this.Close();
}
private void DiagnosticsButton_OnClick(object sender, RoutedEventArgs e)
{
DiagnosticsWindow window = new DiagnosticsWindow();
window.Show();
}
}
}
@@ -1,7 +1,7 @@
<Window x:Name="window" x:Class="FileConverter.SettingsWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:local="clr-namespace:FileConverter"
Height="350" Width="538" MinHeight="225" MinWidth="440"
Height="340" Width="520" MinHeight="340" MinWidth="440"
WindowStartupLocation="CenterScreen">
<Window.Resources>
<local:InputTypesToBool x:Key="InputTypesToBool"/>
@@ -86,7 +86,7 @@
<Button Name="AddPresetButton" Grid.Row="2" Content="+" HorizontalAlignment="Left" Width="28" Margin="18,4,0,0" Click="AddPresetButton_Click"/>
<Button Name="RemovePresetButton" Grid.Row="2" Content="-" HorizontalAlignment="Left" Width="28" Margin="54,4,0,0" Click="RemovePresetButton_Click"/>
<Button Name="CloseButton" Grid.Row="2" Content="Close" HorizontalAlignment="Right" Width="100" Margin="0,4,105,0" Click="CloseButton_Click" />
<Button Name="SaveButton" Grid.Row="2" Content="Save" HorizontalAlignment="Right" Width="100" Margin="0,4,0,0" Click="SaveButton_Click"/>