diff options
| author | Roy Ben Shabat <Roy.mail.net@gmail.com> | 2020-08-26 06:47:23 +0300 |
|---|---|---|
| committer | Roy Ben Shabat <Roy.mail.net@gmail.com> | 2020-08-26 06:47:23 +0300 |
| commit | 3b60105e6cd38e43c939d519648444f63b122e2d (patch) | |
| tree | fcb69720489dc58bc4f91af6fb0d693806813ff2 /Software/Visual_Studio/FSE/Tango.FSE.LogViewer.UI | |
| parent | 5a4580be41f7c5dd6ab650413a373008b7bceaa5 (diff) | |
| download | Tango-3b60105e6cd38e43c939d519648444f63b122e2d.tar.gz Tango-3b60105e6cd38e43c939d519648444f63b122e2d.zip | |
Improved log viewer tabs.
Improved log viewer loading.
Diffstat (limited to 'Software/Visual_Studio/FSE/Tango.FSE.LogViewer.UI')
5 files changed, 257 insertions, 115 deletions
diff --git a/Software/Visual_Studio/FSE/Tango.FSE.LogViewer.UI/Controls/LogTabsGrid.cs b/Software/Visual_Studio/FSE/Tango.FSE.LogViewer.UI/Controls/LogTabsGrid.cs new file mode 100644 index 000000000..6641b299e --- /dev/null +++ b/Software/Visual_Studio/FSE/Tango.FSE.LogViewer.UI/Controls/LogTabsGrid.cs @@ -0,0 +1,46 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows; +using System.Windows.Controls; + +namespace Tango.FSE.LogViewer.UI.Controls +{ + public class LogTabsGrid : Grid + { + public int Columns + { + get { return (int)GetValue(ColumnsProperty); } + set { SetValue(ColumnsProperty, value); } + } + public static readonly DependencyProperty ColumnsProperty = + DependencyProperty.Register("Columns", typeof(int), typeof(LogTabsGrid), new PropertyMetadata(0, (d, e) => (d as LogTabsGrid).OnColumnsChanged())); + + private void OnColumnsChanged() + { + ColumnDefinitions.Clear(); + + for (int i = 0; i < Columns; i++) + { + ColumnDefinitions.Add(new ColumnDefinition() { Width = new GridLength(1, GridUnitType.Star) }); + } + } + + protected override void OnVisualChildrenChanged(DependencyObject visualAdded, DependencyObject visualRemoved) + { + base.OnVisualChildrenChanged(visualAdded, visualRemoved); + + for (int i = 0; i < Children.Count; i++) + { + var element = Children[i] as FrameworkElement; + + if (element != null) + { + Grid.SetColumn(Children[i] as FrameworkElement, i); + } + } + } + } +} diff --git a/Software/Visual_Studio/FSE/Tango.FSE.LogViewer.UI/Resources/Styles.xaml b/Software/Visual_Studio/FSE/Tango.FSE.LogViewer.UI/Resources/Styles.xaml index dd9bced5c..3bb86eea4 100644 --- a/Software/Visual_Studio/FSE/Tango.FSE.LogViewer.UI/Resources/Styles.xaml +++ b/Software/Visual_Studio/FSE/Tango.FSE.LogViewer.UI/Resources/Styles.xaml @@ -29,6 +29,7 @@ <Style x:Key="LogViewer_TabItemStyle" TargetType="{x:Type TabItem}"> <Setter Property="FocusVisualStyle" Value="{x:Null}"/> <Setter Property="Foreground" Value="{StaticResource FSE_PrimaryForegroundBrush}"/> + <Setter Property="Visibility" Value="Collapsed"></Setter> <Setter Property="Background" Value="Transparent"/> <Setter Property="BorderBrush" Value="{StaticResource TabItem.Static.Border}"/> <Setter Property="BorderThickness" Value="0"></Setter> @@ -45,7 +46,6 @@ <Border x:Name="contentBorder" Padding="0 2" Panel.ZIndex="100"> <ContentPresenter x:Name="contentPresenter" ContentSource="Header" Focusable="False" HorizontalAlignment="{Binding HorizontalContentAlignment, RelativeSource={RelativeSource AncestorType={x:Type ItemsControl}}}" Margin="30 0" RecognizesAccessKey="True" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" VerticalAlignment="{Binding VerticalContentAlignment, RelativeSource={RelativeSource AncestorType={x:Type ItemsControl}}}"/> </Border> - <Polygon x:Name="polygon" HorizontalAlignment="Left" Points="{Binding ElementName=contentBorder,Path=ActualWidth,Converter={StaticResource PolygonTabToPointCollectionConverter}}" Fill="Transparent" Width="{Binding ElementName=contentBorder,Path=ActualWidth}" Stretch="Uniform" Stroke="{StaticResource FSE_PrimaryAccentBrush}"/> </Grid> <ControlTemplate.Triggers> <MultiDataTrigger> @@ -53,20 +53,17 @@ <Condition Binding="{Binding IsSelected, RelativeSource={RelativeSource Self}}" Value="false"/> </MultiDataTrigger.Conditions> <Setter Property="Panel.ZIndex" Value="0"/> - <Setter TargetName="polygon" Property="Fill" Value="{StaticResource FSE_PrimaryBackgroundBrush}"></Setter> </MultiDataTrigger> <MultiDataTrigger> <MultiDataTrigger.Conditions> <Condition Binding="{Binding IsMouseOver, RelativeSource={RelativeSource Self}}" Value="true"/> </MultiDataTrigger.Conditions> - <Setter TargetName="polygon" Property="Fill" Value="{StaticResource FSE_PrimaryBackgroundLightBrush}"></Setter> </MultiDataTrigger> <MultiDataTrigger> <MultiDataTrigger.Conditions> <Condition Binding="{Binding IsSelected, RelativeSource={RelativeSource Self}}" Value="true"/> </MultiDataTrigger.Conditions> <Setter Property="Panel.ZIndex" Value="1"/> - <Setter TargetName="polygon" Property="Fill" Value="{StaticResource FSE_PrimaryAccentBrush}"></Setter> </MultiDataTrigger> </ControlTemplate.Triggers> </ControlTemplate> diff --git a/Software/Visual_Studio/FSE/Tango.FSE.LogViewer.UI/Tango.FSE.LogViewer.UI.csproj b/Software/Visual_Studio/FSE/Tango.FSE.LogViewer.UI/Tango.FSE.LogViewer.UI.csproj index 9c9e246e1..04f50b3c7 100644 --- a/Software/Visual_Studio/FSE/Tango.FSE.LogViewer.UI/Tango.FSE.LogViewer.UI.csproj +++ b/Software/Visual_Studio/FSE/Tango.FSE.LogViewer.UI/Tango.FSE.LogViewer.UI.csproj @@ -59,6 +59,7 @@ <SubType>Designer</SubType> </ApplicationDefinition> <Compile Include="ArgsObject.cs" /> + <Compile Include="Controls\LogTabsGrid.cs" /> <Compile Include="Converters\PolygonTabToPointCollectionConverter.cs" /> <Compile Include="LoadFromTfsMode.cs" /> <Compile Include="LogViewerSettings.cs" /> diff --git a/Software/Visual_Studio/FSE/Tango.FSE.LogViewer.UI/ViewModels/LayoutViewVM.cs b/Software/Visual_Studio/FSE/Tango.FSE.LogViewer.UI/ViewModels/LayoutViewVM.cs index abc0e56aa..523f55d48 100644 --- a/Software/Visual_Studio/FSE/Tango.FSE.LogViewer.UI/ViewModels/LayoutViewVM.cs +++ b/Software/Visual_Studio/FSE/Tango.FSE.LogViewer.UI/ViewModels/LayoutViewVM.cs @@ -59,6 +59,13 @@ namespace Tango.FSE.LogViewer.UI.ViewModels set { _recentLogFiles = value; RaisePropertyChangedAuto(); } } + private bool _isTabsListOpened; + public bool IsTabsListOpened + { + get { return _isTabsListOpened; } + set { _isTabsListOpened = value; RaisePropertyChangedAuto(); } + } + public RelayCommand OpenLogFileCommand { get; set; } public RelayCommand<String> OpenRecentLogFileCommand { get; set; } public RelayCommand<LogFileTabViewVM> CloseLogFileCommand { get; set; } @@ -70,7 +77,7 @@ namespace Tango.FSE.LogViewer.UI.ViewModels WrapLines = true; RecentLogFiles = new List<string>(); LogFiles = new ObservableCollection<LogFileTabViewVM>(); - OpenLogFileCommand = new RelayCommand(OpenLogFile); + OpenLogFileCommand = new RelayCommand(OpenLogFiles); CloseLogFileCommand = new RelayCommand<LogFileTabViewVM>(CloseLogFile); SaveAsLogFileCommand = new RelayCommand(SaveAsLogFile); ExitCommand = new RelayCommand(ExitApplication); @@ -115,91 +122,109 @@ namespace Tango.FSE.LogViewer.UI.ViewModels } } - private async void OpenLogFile() + private async void OpenLogFiles() { var result = await StorageProvider.OpenFiles("Browse for log files", "Twine Log Files|*.log"); if (result.Confirmed) { - foreach (var file in result.SelectedItems) - { - await OpenLogFile(file); - } + await OpenLogFiles(result.SelectedItems); } } - private async Task OpenLogFile(String file) + private Task OpenLogFiles(String file) { - var existingLogFile = LogFiles.ToList().FirstOrDefault(x => x.File == file); + return OpenLogFiles(new List<String>() { file }); + } - if (existingLogFile != null) + private async Task OpenLogFiles(List<String> files) + { + using (var task = NotificationProvider.PushTaskItem($"Loading '{Path.GetFileName(files.FirstOrDefault())}'...")) { - SelectedLogFile = existingLogFile; - return; - } + bool setLastSelected = true; - if (!File.Exists(file)) - { - await NotificationProvider.ShowError($"Error loading log file '{Path.GetFileName(file)}'. The file could not be found."); - return; - } + foreach (var file in files) + { + task.UpdateProgress($"Loading '{Path.GetFileName(file)}'..."); - List<LogItemBase> logs = new List<LogItemBase>(); - LogFileTabViewVM logFile = new LogFileTabViewVM(); + var existingLogFile = LogFiles.ToList().FirstOrDefault(x => x.File == file); - try - { - using (NotificationProvider.PushTaskItem($"Loading '{Path.GetFileName(file)}'...")) - { - DateTime createdTime = File.GetCreationTime(file); + if (existingLogFile != null) + { + setLastSelected = false; + SelectedLogFile = existingLogFile; + continue; + } - await Task.Delay(1500); + if (!File.Exists(file)) + { + await NotificationProvider.ShowError($"Error loading log file '{Path.GetFileName(file)}'. The file could not be found."); + continue; + } - await Task.Factory.StartNew(() => + List<LogItemBase> logs = new List<LogItemBase>(); + LogFileTabViewVM logFile = new LogFileTabViewVM(); + + try { - if (!Path.GetFileName(file).StartsWith("Embedded")) - { - ApplicationLogFileParser parser = new ApplicationLogFileParser(); - logs = parser.Parse(file, createdTime); - } - else + DateTime createdTime = File.GetCreationTime(file); + + await Task.Delay(500); + + await Task.Factory.StartNew(() => { - EmbeddedLogFileParser parser = new EmbeddedLogFileParser(); - logs = parser.Parse(file, createdTime).Cast<LogItemBase>().ToList(); - logFile.IsEmbedded = true; - } + if (!Path.GetFileName(file).StartsWith("Embedded")) + { + ApplicationLogFileParser parser = new ApplicationLogFileParser(); + logs = parser.Parse(file, createdTime); + } + else + { + EmbeddedLogFileParser parser = new EmbeddedLogFileParser(); + logs = parser.Parse(file, createdTime).Cast<LogItemBase>().ToList(); + logFile.IsEmbedded = true; + } - logFile.Name = Path.GetFileName(file); - logFile.File = file; - logFile.Size = Core.Helpers.FileHelper.GetFriendlyFileSize(new FileInfo(file).Length); - logFile.StartTime = createdTime; - logFile.EndTime = logs.Last().TimeStamp; - }); + logFile.Name = Path.GetFileName(file); + logFile.File = file; + logFile.Size = Core.Helpers.FileHelper.GetFriendlyFileSize(new FileInfo(file).Length); + logFile.StartTime = createdTime; + logFile.EndTime = logs.Last().TimeStamp; + }); - logFile.Logs = new ObservableCollection<LogItemBase>(logs); - LogFiles.Add(logFile); - SelectedLogFile = logFile; + logFile.Logs = new ObservableCollection<LogItemBase>(logs); + LogFiles.Add(logFile); - Settings.RecentFiles.RemoveAll(x => x == logFile.File); - Settings.RecentFiles.Insert(0, logFile.File); - if (Settings.RecentFiles.Count > 10) + Settings.RecentFiles.RemoveAll(x => x == logFile.File); + Settings.RecentFiles.Insert(0, logFile.File); + if (Settings.RecentFiles.Count > 10) + { + Settings.RecentFiles.Remove(Settings.RecentFiles.Last()); + } + Settings.Save(); + RecentLogFiles = Settings.RecentFiles.ToList(); + + } + catch (Exception ex) { - Settings.RecentFiles.Remove(Settings.RecentFiles.Last()); + await NotificationProvider.ShowError($"Error loading log file '{Path.GetFileName(file)}'.\n{ex.FlattenMessage()}"); } - Settings.Save(); - RecentLogFiles = Settings.RecentFiles.ToList(); } - } - catch (Exception ex) - { - await NotificationProvider.ShowError($"Error loading log file '{Path.GetFileName(file)}'.\n{ex.FlattenMessage()}"); + + if (setLastSelected) + { + SelectedLogFile = LogFiles.LastOrDefault(); + } } } private void CloseLogFile(LogFileTabViewVM logFile) { int index = LogFiles.IndexOf(logFile); + int count = LogFiles.Count; + LogFileTabViewVM selectedLogFile = SelectedLogFile; + LogFiles.Remove(logFile); - if (SelectedLogFile == logFile) + if (selectedLogFile == logFile) { if (LogFiles.Count > index) { @@ -214,12 +239,12 @@ namespace Tango.FSE.LogViewer.UI.ViewModels SelectedLogFile = null; } } - - LogFiles.Remove(logFile); } private void OnSelectedLogFileChanged() { + IsTabsListOpened = false; + if (_view != null) { _view.Filter = null; @@ -336,17 +361,7 @@ namespace Tango.FSE.LogViewer.UI.ViewModels } else { - foreach (var file in args) - { - try - { - if (File.Exists(file)) - { - await OpenLogFile(file); - } - } - catch { } - } + await OpenLogFiles(args); } } @@ -376,7 +391,7 @@ namespace Tango.FSE.LogViewer.UI.ViewModels handler.Download(tempFile).Wait(); }); - await OpenLogFile(tempFile); + await OpenLogFiles(tempFile); } } catch (Exception ex) @@ -388,27 +403,21 @@ namespace Tango.FSE.LogViewer.UI.ViewModels internal async void OnFilesDropped(List<string> files) { - foreach (var file in files) - { - if (File.Exists(file)) - { - if (Path.GetExtension(file).ToLower() == ".log") - { - await OpenLogFile(file); - } - } - } + await OpenLogFiles(files.Where(x => File.Exists(x) && Path.GetExtension(x).ToLower() == ".log").ToList()); } private void OnWrapLinesChanged() { - Settings.WrapLines = WrapLines; - Settings.Save(); + if (Settings != null) + { + Settings.WrapLines = WrapLines; + Settings.Save(); + } } private async void OpenRecentLogFile(string file) { - await OpenLogFile(file); + await OpenLogFiles(file); } } } diff --git a/Software/Visual_Studio/FSE/Tango.FSE.LogViewer.UI/Views/LayoutView.xaml b/Software/Visual_Studio/FSE/Tango.FSE.LogViewer.UI/Views/LayoutView.xaml index 8ff1955bd..b86b40878 100644 --- a/Software/Visual_Studio/FSE/Tango.FSE.LogViewer.UI/Views/LayoutView.xaml +++ b/Software/Visual_Studio/FSE/Tango.FSE.LogViewer.UI/Views/LayoutView.xaml @@ -3,6 +3,7 @@ xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" + xmlns:controls="clr-namespace:Tango.FSE.LogViewer.UI.Controls" xmlns:local="clr-namespace:Tango.FSE.LogViewer.UI.Views" xmlns:global="clr-namespace:Tango.FSE.LogViewer.UI" xmlns:material="http://materialdesigninxaml.net/winfx/xaml/themes" @@ -18,7 +19,7 @@ <UserControl.Resources> <material:PackIcon x:Key="recentIcon" x:Shared="False" Kind="File" /> </UserControl.Resources> - + <Grid AllowDrop="True" PreviewDrop="OnFileDrop"> <DockPanel> <Grid DockPanel.Dock="Top"> @@ -82,7 +83,7 @@ <DockPanel> <DockPanel.Style> <Style TargetType="DockPanel"> - <Setter Property="Margin" Value="0"></Setter> + <Setter Property="Margin" Value="0 32 0 0"></Setter> <Style.Triggers> <DataTrigger Binding="{Binding LogFiles.Count}" Value="0"> <Setter Property="Margin" Value="0 32 0 0"></Setter> @@ -119,31 +120,119 @@ </Grid.ColumnDefinitions> <!--TABS--> - <TabControl Padding="0" ItemsSource="{Binding LogFiles}" SelectedItem="{Binding SelectedLogFile,Mode=TwoWay}" ItemContainerStyle="{StaticResource LogViewer_TabItemStyle}" BorderBrush="{StaticResource FSE_PrimaryAccentBrush}"> - <TabControl.Style> - <Style TargetType="TabControl" BasedOn="{StaticResource {x:Type TabControl}}"> - <Setter Property="BorderThickness" Value="0"></Setter> - <Style.Triggers> - <DataTrigger Binding="{Binding LogFiles.Count}" Value="0"> - <Setter Property="BorderThickness" Value="0 2 0 0"></Setter> - </DataTrigger> - </Style.Triggers> - </Style> - </TabControl.Style> - <TabControl.ItemTemplate> - <DataTemplate> - <DockPanel Background="Transparent" ToolTip="{Binding File}"> - <commonControls:IconButton Cursor="Hand" Command="{Binding RelativeSource={RelativeSource AncestorType=UserControl},Path=DataContext.CloseLogFileCommand}" CommandParameter="{Binding}" Margin="10 -2 0 0" Icon="Close" Width="18" Height="18" Padding="0" DockPanel.Dock="Right" VerticalAlignment="Center" /> - <TextBlock Text="{Binding Name}"/> - </DockPanel> - </DataTemplate> - </TabControl.ItemTemplate> - <TabControl.ContentTemplate> - <DataTemplate> - <local:LogFileTabView BorderBrush="{StaticResource FSE_PrimaryAccentBrush}" BorderThickness="0 2 0 0" /> - </DataTemplate> - </TabControl.ContentTemplate> - </TabControl> + <DockPanel> + <DockPanel DockPanel.Dock="Top"> + <Border DockPanel.Dock="Right" BorderThickness="0" BorderBrush="{StaticResource FSE_PrimaryAccentBrush}" CornerRadius="3"> + <Border.Style> + <Style TargetType="Border"> + <Setter Property="Visibility" Value="Collapsed"></Setter> + <Style.Triggers> + <DataTrigger Binding="{Binding LogFiles.Count,Converter={StaticResource GreaterThanToBooleanConverter},ConverterParameter=1}" Value="True"> + <Setter Property="Visibility" Value="Visible"></Setter> + </DataTrigger> + </Style.Triggers> + </Style> + </Border.Style> + <Grid> + <commonControls:ToggleIconButton x:Name="chkTabs" IsChecked="{Binding IsTabsListOpened,Mode=TwoWay}" Width="24" Height="24" UncheckedIcon="ChevronDown" CheckedIcon="ChevronDown" CheckedForeground="{StaticResource FSE_PrimaryAccentBrush}" /> + <Popup StaysOpen="False" AllowsTransparency="True" VerticalOffset="10" PlacementTarget="{Binding ElementName=chkTabs}" Placement="Bottom" IsOpen="{Binding ElementName=chkTabs,Path=IsChecked}"> + <Border BorderBrush="{StaticResource FSE_BorderBrush}" BorderThickness="1" CornerRadius="2" Background="{StaticResource FSE_PrimaryBackgroundBrush}"> + <ListBox FontSize="{StaticResource FSE_SmallFontSize}" ItemsSource="{Binding LogFiles}" SelectedItem="{Binding SelectedLogFile,Mode=TwoWay}"> + <ListBox.ItemTemplate> + <DataTemplate> + <DockPanel> + <material:PackIcon Kind="File" DockPanel.Dock="Left" VerticalAlignment="Center" Width="16" Height="16" /> + <TextBlock Margin="5 0 0 0" Text="{Binding Name}"></TextBlock> + </DockPanel> + </DataTemplate> + </ListBox.ItemTemplate> + </ListBox> + </Border> + </Popup> + </Grid> + </Border> + <ListBox FocusVisualStyle="{x:Null}" MinHeight="31" Style="{StaticResource FSE_BlankListBox}" ItemsSource="{Binding LogFiles}" SelectedIndex="{Binding ElementName=tabControl,Path=SelectedIndex,Mode=TwoWay}" Margin="0 0 0 0" ClipToBounds="False"> + <ListBox.ItemsPanel> + <ItemsPanelTemplate> + <controls:LogTabsGrid HorizontalAlignment="Left" Columns="{Binding LogFiles.Count}"/> + </ItemsPanelTemplate> + </ListBox.ItemsPanel> + <ListBox.ItemContainerStyle> + <Style TargetType="ListBoxItem"> + <Setter Property="FocusVisualStyle" Value="{x:Null}"></Setter> + <Setter Property="Margin" Value="0 0 -8 0"></Setter> + <Setter Property="HorizontalAlignment" Value="Left"></Setter> + <Setter Property="HorizontalContentAlignment" Value="Left"></Setter> + <Setter Property="Template"> + <Setter.Value> + <ControlTemplate> + <Grid Margin="0 0 0 0" ToolTip="{Binding File}"> + <Polygon x:Name="polygon" HorizontalAlignment="Left" Points="{Binding ElementName=contentBorder,Path=ActualWidth,Converter={StaticResource PolygonTabToPointCollectionConverter}}" Fill="{StaticResource FSE_PrimaryBackgroundBrush}" Width="{Binding ElementName=contentBorder,Path=ActualWidth}" Stretch="Uniform" Stroke="{StaticResource FSE_PrimaryAccentBrush}"/> + <Border HorizontalAlignment="Left" x:Name="contentBorder" Padding="30 5 20 5"> + <DockPanel> + <commonControls:IconButton Cursor="Hand" Command="{Binding RelativeSource={RelativeSource AncestorType=UserControl},Path=DataContext.CloseLogFileCommand}" CommandParameter="{Binding}" Margin="20 -2 0 0" Icon="Close" Width="18" Height="18" Padding="0" DockPanel.Dock="Right" VerticalAlignment="Center" /> + <Grid> + <TextBlock Visibility="Hidden" HorizontalAlignment="Left" VerticalAlignment="Center" Text="{Binding Name}" FontSize="{StaticResource FSE_SmallFontSize}"></TextBlock> + <TextBlock HorizontalAlignment="Right" FlowDirection="RightToLeft" VerticalAlignment="Center" Text="{Binding Name}" FontSize="{StaticResource FSE_SmallFontSize}"></TextBlock> + </Grid> + </DockPanel> + </Border> + </Grid> + <ControlTemplate.Triggers> + <MultiDataTrigger> + <MultiDataTrigger.Conditions> + <Condition Binding="{Binding IsSelected, RelativeSource={RelativeSource Self}}" Value="false"/> + </MultiDataTrigger.Conditions> + <Setter Property="Panel.ZIndex" Value="0"/> + <Setter TargetName="polygon" Property="Fill" Value="{StaticResource FSE_PrimaryBackgroundBrush}"></Setter> + </MultiDataTrigger> + <MultiDataTrigger> + <MultiDataTrigger.Conditions> + <Condition Binding="{Binding IsMouseOver, RelativeSource={RelativeSource Self}}" Value="true"/> + </MultiDataTrigger.Conditions> + <Setter TargetName="polygon" Property="Fill" Value="{StaticResource FSE_PrimaryBackgroundLightBrush}"></Setter> + </MultiDataTrigger> + <MultiDataTrigger> + <MultiDataTrigger.Conditions> + <Condition Binding="{Binding IsSelected, RelativeSource={RelativeSource Self}}" Value="true"/> + </MultiDataTrigger.Conditions> + <Setter Property="Panel.ZIndex" Value="1"/> + <Setter TargetName="polygon" Property="Fill" Value="{StaticResource FSE_PrimaryAccentBrush}"></Setter> + </MultiDataTrigger> + </ControlTemplate.Triggers> + </ControlTemplate> + </Setter.Value> + </Setter> + </Style> + </ListBox.ItemContainerStyle> + </ListBox> + </DockPanel> + <TabControl x:Name="tabControl" Padding="0" ItemsSource="{Binding LogFiles}" SelectedItem="{Binding SelectedLogFile,Mode=TwoWay}" ItemContainerStyle="{StaticResource LogViewer_TabItemStyle}" BorderBrush="{StaticResource FSE_PrimaryAccentBrush}"> + <TabControl.Style> + <Style TargetType="TabControl" BasedOn="{StaticResource {x:Type TabControl}}"> + <Setter Property="BorderThickness" Value="0"></Setter> + <Style.Triggers> + <DataTrigger Binding="{Binding LogFiles.Count}" Value="0"> + <Setter Property="BorderThickness" Value="0 2 0 0"></Setter> + </DataTrigger> + </Style.Triggers> + </Style> + </TabControl.Style> + <TabControl.ItemTemplate> + <DataTemplate> + <DockPanel Background="Transparent" ToolTip="{Binding File}"> + <commonControls:IconButton Cursor="Hand" Command="{Binding RelativeSource={RelativeSource AncestorType=UserControl},Path=DataContext.CloseLogFileCommand}" CommandParameter="{Binding}" Margin="10 -2 0 0" Icon="Close" Width="18" Height="18" Padding="0" DockPanel.Dock="Right" VerticalAlignment="Center" /> + <TextBlock Text="{Binding Name}"/> + </DockPanel> + </DataTemplate> + </TabControl.ItemTemplate> + <TabControl.ContentTemplate> + <DataTemplate> + <local:LogFileTabView BorderBrush="{StaticResource FSE_PrimaryAccentBrush}" BorderThickness="0 2 0 0" /> + </DataTemplate> + </TabControl.ContentTemplate> + </TabControl> + </DockPanel> <!--SPLITTER--> <GridSplitter Margin="0 32 0 0" Grid.Column="1" HorizontalAlignment="Center" Width="5" VerticalAlignment="Stretch"/> @@ -155,7 +244,7 @@ <Setter Property="Margin" Value="0 31 0 0"></Setter> <Style.Triggers> <DataTrigger Binding="{Binding LogFiles.Count}" Value="0"> - <Setter Property="Margin" Value="0 0 0 0"></Setter> + <Setter Property="Margin" Value="0 31 0 0"></Setter> </DataTrigger> </Style.Triggers> </Style> |
