aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Software/Visual_Studio/FSE/Tango.FSE.LogViewer.UI/App.xaml8
-rw-r--r--Software/Visual_Studio/FSE/Tango.FSE.LogViewer.UI/Converters/PolygonTabToPointCollectionConverter.cs38
-rw-r--r--Software/Visual_Studio/FSE/Tango.FSE.LogViewer.UI/LogViewerViewModel.cs4
-rw-r--r--Software/Visual_Studio/FSE/Tango.FSE.LogViewer.UI/Resources/Styles.xaml76
-rw-r--r--Software/Visual_Studio/FSE/Tango.FSE.LogViewer.UI/Tango.FSE.LogViewer.UI.csproj21
-rw-r--r--Software/Visual_Studio/FSE/Tango.FSE.LogViewer.UI/ViewModelLocator.cs4
-rw-r--r--Software/Visual_Studio/FSE/Tango.FSE.LogViewer.UI/ViewModels/LayoutViewVM.cs162
-rw-r--r--Software/Visual_Studio/FSE/Tango.FSE.LogViewer.UI/ViewModels/LogFileTabViewVM.cs46
-rw-r--r--Software/Visual_Studio/FSE/Tango.FSE.LogViewer.UI/Views/LayoutView.xaml154
-rw-r--r--Software/Visual_Studio/FSE/Tango.FSE.LogViewer.UI/Views/LogFileTabView.xaml37
-rw-r--r--Software/Visual_Studio/FSE/Tango.FSE.LogViewer.UI/Views/LogFileTabView.xaml.cs28
-rw-r--r--Software/Visual_Studio/Tango.SharedUI/Tango.SharedUI.csproj2
12 files changed, 572 insertions, 8 deletions
diff --git a/Software/Visual_Studio/FSE/Tango.FSE.LogViewer.UI/App.xaml b/Software/Visual_Studio/FSE/Tango.FSE.LogViewer.UI/App.xaml
index d33871cb1..6f7c3c5fe 100644
--- a/Software/Visual_Studio/FSE/Tango.FSE.LogViewer.UI/App.xaml
+++ b/Software/Visual_Studio/FSE/Tango.FSE.LogViewer.UI/App.xaml
@@ -2,6 +2,7 @@
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes"
+ xmlns:converters="clr-namespace:Tango.FSE.LogViewer.UI.Converters"
xmlns:local="clr-namespace:Tango.FSE.LogViewer.UI"
StartupUri="MainWindow.xaml">
<Application.Resources>
@@ -89,6 +90,13 @@
<SolidColorBrush x:Key="MahApps.Metro.Brushes.ToggleSwitchButton.ThumbIndicatorCheckedBrush.Win10" Color="{DynamicResource Primary500Foreground}" />
</ResourceDictionary>
+
+ <ResourceDictionary>
+ <converters:PolygonTabToPointCollectionConverter x:Key="PolygonTabToPointCollectionConverter" />
+ </ResourceDictionary>
+
+ <ResourceDictionary Source="/Resources/Styles.xaml" />
+
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</Application.Resources>
diff --git a/Software/Visual_Studio/FSE/Tango.FSE.LogViewer.UI/Converters/PolygonTabToPointCollectionConverter.cs b/Software/Visual_Studio/FSE/Tango.FSE.LogViewer.UI/Converters/PolygonTabToPointCollectionConverter.cs
new file mode 100644
index 000000000..cd8caf959
--- /dev/null
+++ b/Software/Visual_Studio/FSE/Tango.FSE.LogViewer.UI/Converters/PolygonTabToPointCollectionConverter.cs
@@ -0,0 +1,38 @@
+using System;
+using System.Collections.Generic;
+using System.Globalization;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows;
+using System.Windows.Data;
+using System.Windows.Media;
+
+namespace Tango.FSE.LogViewer.UI.Converters
+{
+ public class PolygonTabToPointCollectionConverter : IValueConverter
+ {
+ public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
+ {
+ PointCollection points = new PointCollection();
+
+ try
+ {
+ double width = System.Convert.ToDouble(value);
+
+ points.Add(new Point(0, 30));
+ points.Add(new Point(15, 0));
+ points.Add(new Point(width - 15, 0));
+ points.Add(new Point(width, 30));
+ }
+ catch { }
+
+ return points;
+ }
+
+ public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
+ {
+ throw new NotImplementedException();
+ }
+ }
+}
diff --git a/Software/Visual_Studio/FSE/Tango.FSE.LogViewer.UI/LogViewerViewModel.cs b/Software/Visual_Studio/FSE/Tango.FSE.LogViewer.UI/LogViewerViewModel.cs
index f61984b7d..e90956353 100644
--- a/Software/Visual_Studio/FSE/Tango.FSE.LogViewer.UI/LogViewerViewModel.cs
+++ b/Software/Visual_Studio/FSE/Tango.FSE.LogViewer.UI/LogViewerViewModel.cs
@@ -5,6 +5,7 @@ using System.Text;
using System.Threading.Tasks;
using Tango.Core.DI;
using Tango.FSE.Common.Notifications;
+using Tango.FSE.Common.Storage;
using Tango.SharedUI;
namespace Tango.FSE.LogViewer.UI
@@ -13,5 +14,8 @@ namespace Tango.FSE.LogViewer.UI
{
[TangoInject]
public INotificationProvider NotificationProvider { get; set; }
+
+ [TangoInject]
+ public IStorageProvider StorageProvider { get; set; }
}
}
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
new file mode 100644
index 000000000..dd9bced5c
--- /dev/null
+++ b/Software/Visual_Studio/FSE/Tango.FSE.LogViewer.UI/Resources/Styles.xaml
@@ -0,0 +1,76 @@
+<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
+ xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
+ xmlns:local="clr-namespace:Tango.FSE.LogViewer.UI.Resources">
+
+ <Style x:Key="FocusVisual">
+ <Setter Property="Control.Template">
+ <Setter.Value>
+ <ControlTemplate>
+ <Rectangle Margin="2" SnapsToDevicePixels="true" Stroke="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}" StrokeThickness="1" StrokeDashArray="1 2"/>
+ </ControlTemplate>
+ </Setter.Value>
+ </Setter>
+ </Style>
+ <LinearGradientBrush x:Key="TabItem.Static.Background" EndPoint="0,1" StartPoint="0,0">
+ <GradientStop Color="{StaticResource FSE_PrimaryBackgroundLightColor}" Offset="0.0"/>
+ <GradientStop Color="{StaticResource FSE_PrimaryBackgroundLightColor}" Offset="1.0"/>
+ </LinearGradientBrush>
+ <SolidColorBrush x:Key="TabItem.Static.Border" Color="#ACACAC"/>
+ <LinearGradientBrush x:Key="TabItem.MouseOver.Background" EndPoint="0,1" StartPoint="0,0">
+ <GradientStop Color="{StaticResource FSE_PrimaryBackgroundLighterColor}" Offset="0.0"/>
+ <GradientStop Color="{StaticResource FSE_PrimaryBackgroundLighterColor}" Offset="1.0"/>
+ </LinearGradientBrush>
+ <SolidColorBrush x:Key="TabItem.MouseOver.Border" Color="{StaticResource FSE_PrimaryBackgroundLightColor}"/>
+ <SolidColorBrush x:Key="TabItem.Disabled.Background" Color="{StaticResource FSE_PrimaryBackgroundLightColor}"/>
+ <SolidColorBrush x:Key="TabItem.Disabled.Border" Color="{StaticResource FSE_PrimaryBackgroundLightColor}"/>
+ <SolidColorBrush x:Key="TabItem.Selected.Border" Color="{StaticResource FSE_PrimaryBackgroundDarkColor}"/>
+ <SolidColorBrush x:Key="TabItem.Selected.Background" Color="{StaticResource FSE_PrimaryBackgroundDarkColor}"/>
+
+ <Style x:Key="LogViewer_TabItemStyle" TargetType="{x:Type TabItem}">
+ <Setter Property="FocusVisualStyle" Value="{x:Null}"/>
+ <Setter Property="Foreground" Value="{StaticResource FSE_PrimaryForegroundBrush}"/>
+ <Setter Property="Background" Value="Transparent"/>
+ <Setter Property="BorderBrush" Value="{StaticResource TabItem.Static.Border}"/>
+ <Setter Property="BorderThickness" Value="0"></Setter>
+ <Setter Property="Margin" Value="0 0 0 -2"/>
+ <Setter Property="Padding" Value="0"/>
+ <Setter Property="FontSize" Value="{StaticResource FSE_SmallFontSize}"></Setter>
+ <Setter Property="HorizontalContentAlignment" Value="Left"/>
+ <Setter Property="VerticalContentAlignment" Value="Stretch"/>
+ <Setter Property="HorizontalAlignment" Value="Left"></Setter>
+ <Setter Property="Template">
+ <Setter.Value>
+ <ControlTemplate TargetType="{x:Type TabItem}">
+ <Grid x:Name="templateRoot" SnapsToDevicePixels="true" Margin="0 0 -8 0" Background="Transparent">
+ <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>
+ <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>
+</ResourceDictionary> \ No newline at end of file
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 399ae3a39..0e68f5d58 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
@@ -55,13 +55,18 @@
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</ApplicationDefinition>
+ <Compile Include="Converters\PolygonTabToPointCollectionConverter.cs" />
<Compile Include="LogViewerViewModel.cs" />
<Compile Include="ViewModelLocator.cs" />
<Compile Include="ViewModels\LayoutViewVM.cs" />
+ <Compile Include="ViewModels\LogFileTabViewVM.cs" />
<Compile Include="ViewModels\MainViewVM.cs" />
<Compile Include="Views\LayoutView.xaml.cs">
<DependentUpon>LayoutView.xaml</DependentUpon>
</Compile>
+ <Compile Include="Views\LogFileTabView.xaml.cs">
+ <DependentUpon>LogFileTabView.xaml</DependentUpon>
+ </Compile>
<Compile Include="Views\MainView.xaml.cs">
<DependentUpon>MainView.xaml</DependentUpon>
</Compile>
@@ -80,10 +85,18 @@
<DependentUpon>MainWindow.xaml</DependentUpon>
<SubType>Code</SubType>
</Compile>
+ <Page Include="Resources\Styles.xaml">
+ <SubType>Designer</SubType>
+ <Generator>MSBuild:Compile</Generator>
+ </Page>
<Page Include="Views\LayoutView.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
+ <Page Include="Views\LogFileTabView.xaml">
+ <SubType>Designer</SubType>
+ <Generator>MSBuild:Compile</Generator>
+ </Page>
<Page Include="Views\MainView.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
@@ -128,6 +141,14 @@
<Project>{a34ee0f0-649d-41c8-8489-b6f1cc6924ee}</Project>
<Name>Tango.Core</Name>
</ProjectReference>
+ <ProjectReference Include="..\..\Tango.Integration\Tango.Integration.csproj">
+ <Project>{4206ac58-3b57-4699-8835-90bf6db01a61}</Project>
+ <Name>Tango.Integration</Name>
+ </ProjectReference>
+ <ProjectReference Include="..\..\Tango.Logging\Tango.Logging.csproj">
+ <Project>{bc932dbd-7cdb-488c-99e4-f02cf441f55e}</Project>
+ <Name>Tango.Logging</Name>
+ </ProjectReference>
<ProjectReference Include="..\..\Tango.Settings\Tango.Settings.csproj">
<Project>{d8f1ad85-526a-4f50-b6dc-d437af63d8d8}</Project>
<Name>Tango.Settings</Name>
diff --git a/Software/Visual_Studio/FSE/Tango.FSE.LogViewer.UI/ViewModelLocator.cs b/Software/Visual_Studio/FSE/Tango.FSE.LogViewer.UI/ViewModelLocator.cs
index e5cae3106..177409e7d 100644
--- a/Software/Visual_Studio/FSE/Tango.FSE.LogViewer.UI/ViewModelLocator.cs
+++ b/Software/Visual_Studio/FSE/Tango.FSE.LogViewer.UI/ViewModelLocator.cs
@@ -5,8 +5,10 @@ using System.Text;
using System.Threading.Tasks;
using Tango.Core.DI;
using Tango.FSE.Common.Notifications;
+using Tango.FSE.Common.Storage;
using Tango.FSE.LogViewer.UI.ViewModels;
using Tango.FSE.UI.Notifications;
+using Tango.FSE.UI.Storage;
namespace Tango.FSE.LogViewer.UI
{
@@ -15,8 +17,10 @@ namespace Tango.FSE.LogViewer.UI
static ViewModelLocator()
{
TangoIOC.Default.Unregister<INotificationProvider>();
+ TangoIOC.Default.Unregister<IStorageProvider>();
TangoIOC.Default.Register<INotificationProvider, DefaultNotificationProvider>();
+ TangoIOC.Default.Register<IStorageProvider, DefaultStorageProvider>();
TangoIOC.Default.Register<MainViewVM>();
TangoIOC.Default.Register<LayoutViewVM>();
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 be185a8df..cf1c2d810 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
@@ -1,24 +1,178 @@
using System;
using System.Collections.Generic;
+using System.Collections.ObjectModel;
+using System.ComponentModel;
+using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
+using System.Windows.Data;
using Tango.Core.Commands;
+using Tango.Integration.Logging;
+using Tango.Logging;
namespace Tango.FSE.LogViewer.UI.ViewModels
{
public class LayoutViewVM : LogViewerViewModel
{
- public RelayCommand TestCommand { get; set; }
+ private ICollectionView _view;
+
+ public ObservableCollection<LogFileTabViewVM> LogFiles { get; set; }
+
+ private LogFileTabViewVM _selectedLogFile;
+ public LogFileTabViewVM SelectedLogFile
+ {
+ get { return _selectedLogFile; }
+ set { _selectedLogFile = value; RaisePropertyChangedAuto(); OnSelectedLogFileChanged(); }
+ }
+
+ private String _filter;
+ public String Filter
+ {
+ get { return _filter; }
+ set { _filter = value; RaisePropertyChangedAuto(); OnFilterChanged(); }
+ }
+
+ public RelayCommand OpenLogFileCommand { get; set; }
+ public RelayCommand<LogFileTabViewVM> CloseLogFileCommand { get; set; }
public LayoutViewVM()
{
- TestCommand = new RelayCommand(Test);
+ LogFiles = new ObservableCollection<LogFileTabViewVM>();
+ OpenLogFileCommand = new RelayCommand(OpenLogFile);
+ CloseLogFileCommand = new RelayCommand<LogFileTabViewVM>(CloseLogFile);
+
+ LogFiles.Add(new LogFileTabViewVM() { Name = "Log File 1.log" });
+ LogFiles.Add(new LogFileTabViewVM() { Name = "Log File With Long File Name 2.log" });
+ LogFiles.Add(new LogFileTabViewVM() { Name = "Log File 3.log" });
}
- private async void Test()
+ private async void OpenLogFile()
{
- await NotificationProvider.ShowInfo("This is a test message.");
+ 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);
+ }
+ }
+ }
+
+ private async Task OpenLogFile(String file)
+ {
+ List<LogItemBase> logs = new List<LogItemBase>();
+ LogFileTabViewVM logFile = new LogFileTabViewVM();
+
+ using (NotificationProvider.PushTaskItem($"Loading '{Path.GetFileName(file)}'..."))
+ {
+ DateTime createdTime = File.GetCreationTime(file);
+
+ await Task.Delay(1500);
+
+ await Task.Factory.StartNew(() =>
+ {
+ if (!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.Logs = new ObservableCollection<LogItemBase>(logs);
+ LogFiles.Add(logFile);
+ SelectedLogFile = logFile;
+ }
+ }
+
+ private void CloseLogFile(LogFileTabViewVM logFile)
+ {
+ int index = LogFiles.IndexOf(logFile);
+
+ if (SelectedLogFile == logFile)
+ {
+ if (LogFiles.Count > index)
+ {
+ SelectedLogFile = LogFiles[index];
+ }
+ else if (LogFiles.Count > 0)
+ {
+ SelectedLogFile = LogFiles[index - 1];
+ }
+ else
+ {
+ SelectedLogFile = null;
+ }
+ }
+
+ LogFiles.Remove(logFile);
+ }
+
+ private void OnSelectedLogFileChanged()
+ {
+ if (_view != null)
+ {
+ _view.Filter = null;
+ _view.Refresh();
+ }
+
+ if (SelectedLogFile != null)
+ {
+ _view = CollectionViewSource.GetDefaultView(SelectedLogFile.Logs);
+ _view.Filter = FilterLogs;
+ }
+ }
+
+ private void OnFilterChanged()
+ {
+ _view?.Refresh();
+ }
+
+ private bool FilterLogs(object obj)
+ {
+ LogItemBase log = obj as LogItemBase;
+ if (String.IsNullOrWhiteSpace(Filter)) return true;
+
+ if (Filter.Contains("|"))
+ {
+ List<String> keywords = Filter.Split('|').ToList();
+
+ if (keywords.Any(x => log.Category.ToString().ToLower() == x.ToLower()))
+ {
+ return true;
+ }
+ }
+ else
+ {
+ if (log.Category.ToString().ToLower() == Filter.ToLower())
+ {
+ return true;
+ }
+ }
+
+ if (log.TimeStamp.ToString("HH:mm:ss").Contains(Filter))
+ {
+ return true;
+ }
+
+ if (log.Message.ToLower().Contains(Filter.ToLower()))
+ {
+ return true;
+ }
+
+ return false;
}
}
}
diff --git a/Software/Visual_Studio/FSE/Tango.FSE.LogViewer.UI/ViewModels/LogFileTabViewVM.cs b/Software/Visual_Studio/FSE/Tango.FSE.LogViewer.UI/ViewModels/LogFileTabViewVM.cs
new file mode 100644
index 000000000..e18709a9e
--- /dev/null
+++ b/Software/Visual_Studio/FSE/Tango.FSE.LogViewer.UI/ViewModels/LogFileTabViewVM.cs
@@ -0,0 +1,46 @@
+using System;
+using System.Collections.Generic;
+using System.Collections.ObjectModel;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using Tango.Core.DI;
+using Tango.Logging;
+
+namespace Tango.FSE.LogViewer.UI.ViewModels
+{
+ public class LogFileTabViewVM : LogViewerViewModel
+ {
+ public String Name { get; set; }
+ public String File { get; set; }
+ public String Size { get; set; }
+ public bool IsEmbedded { get; set; }
+ public DateTime StartTime { get; set; }
+ public DateTime EndTime { get; set; }
+
+ public TimeSpan Duration
+ {
+ get { return EndTime - StartTime; }
+ }
+
+ public ObservableCollection<LogItemBase> Logs { get; set; }
+
+ private LogItemBase _selectedLog;
+ public LogItemBase SelectedLog
+ {
+ get { return _selectedLog; }
+ set { _selectedLog = value; RaisePropertyChangedAuto(); }
+ }
+
+ public LogFileTabViewVM()
+ {
+ TangoIOC.Default.Inject(this);
+ Logs = new ObservableCollection<LogItemBase>();
+ }
+
+ public override string ToString()
+ {
+ return Name;
+ }
+ }
+}
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 908796d0e..0f92a4abb 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
@@ -7,6 +7,7 @@
xmlns:global="clr-namespace:Tango.FSE.LogViewer.UI"
xmlns:material="http://materialdesigninxaml.net/winfx/xaml/themes"
xmlns:vm="clr-namespace:Tango.FSE.LogViewer.UI.ViewModels"
+ xmlns:commonControls="clr-namespace:Tango.FSE.Common.Controls;assembly=Tango.FSE.Common"
mc:Ignorable="d"
d:DesignHeight="450" d:DesignWidth="800"
d:DataContext="{d:DesignInstance Type=vm:LayoutViewVM, IsDesignTimeCreatable=False}"
@@ -14,8 +15,155 @@
Background="{StaticResource FSE_PrimaryBackgroundBrush}"
Foreground="{StaticResource FSE_PrimaryForegroundBrush}">
<Grid>
- <StackPanel HorizontalAlignment="Center" VerticalAlignment="Center">
- <Button Width="200" Height="50" Command="{Binding TestCommand}" Style="{StaticResource FSE_RaisedButton_Dark_Hover}">TEST ME</Button>
- </StackPanel>
+ <DockPanel>
+ <Grid DockPanel.Dock="Top">
+ <!--MENU-->
+ <Menu IsMainMenu="True">
+ <MenuItem Header="_File">
+ <MenuItem Header="_Open" Command="{Binding OpenLogFileCommand}" MinWidth="200" InputGestureText="CTRL+O">
+ <MenuItem.Icon>
+ <material:PackIcon Kind="File" />
+ </MenuItem.Icon>
+ </MenuItem>
+ <MenuItem Header="_Save As" Command="{Binding SaveAsLogFileCommand}" MinWidth="200" InputGestureText="CTRL+Shit+S">
+ <MenuItem.Icon>
+ <material:PackIcon Kind="ContentSaveAll" />
+ </MenuItem.Icon>
+ </MenuItem>
+ <Separator/>
+ <MenuItem Header="_Quit" Command="{Binding ExitCommand}" MinWidth="200" InputGestureText="CTRL+Q">
+ <MenuItem.Icon>
+ <material:PackIcon Kind="CloseBox" />
+ </MenuItem.Icon>
+ </MenuItem>
+ </MenuItem>
+ </Menu>
+
+ <Grid HorizontalAlignment="Right" Height="30" Margin="0 5 10 0">
+ <Grid.ToolTip>
+ <DockPanel>
+ <material:PackIcon Kind="InfoCircleOutline" Width="12" Height="12" />
+ <TextBlock Margin="5 0 0 0" FontSize="{StaticResource FSE_SmallFontSize}">
+ <Run>• Search log item by message...</Run>
+ <LineBreak/>
+ <Run>• Search log item by categories like error|warning...</Run>
+ <LineBreak/>
+ <Run>• Search log item by date like hh:mm:ss...</Run>
+ </TextBlock>
+ </DockPanel>
+ </Grid.ToolTip>
+ <TextBox Padding="5 0 30 0" Text="{Binding Filter,UpdateSourceTrigger=PropertyChanged,Delay=300}" Width="{Binding ElementName=borderMessage,Path=ActualWidth}" Style="{StaticResource FSE_Rounded_Corners_TextBox}"></TextBox>
+ <material:PackIcon Kind="Search" HorizontalAlignment="Right" Width="25" Height="25" Opacity="0.5" VerticalAlignment="Center" Margin="0 0 5 0" />
+ </Grid>
+ </Grid>
+
+ <!--CONTENT-->
+ <Grid Margin="10" >
+ <DockPanel>
+ <DockPanel.Style>
+ <Style TargetType="DockPanel">
+ <Setter Property="Margin" Value="0"></Setter>
+ <Style.Triggers>
+ <DataTrigger Binding="{Binding LogFiles.Count}" Value="0">
+ <Setter Property="Margin" Value="0 32 0 0"></Setter>
+ </DataTrigger>
+ </Style.Triggers>
+ </Style>
+ </DockPanel.Style>
+
+ <!--STATUS-->
+ <Border Margin="0 5 0 0" CornerRadius="0 0 15 15" DockPanel.Dock="Bottom" Padding="8" Background="{StaticResource FSE_PrimaryBackgroundDarkBrush}">
+ <TextBlock FontSize="{StaticResource FSE_SmallFontSize}" Foreground="{StaticResource FSE_GrayBrush}">
+ <Run Foreground="{StaticResource FSE_PrimaryAccentBrush}" Text="{Binding SelectedLogFile.Name,Mode=OneWay}"></Run>
+ <Run/>
+ <Run>|</Run>
+ <Run/>
+ <Run Foreground="{StaticResource FSE_PrimaryAccentBrush}" Text="{Binding SelectedLogFile.Size,Mode=OneWay}"></Run>
+ <Run/>
+ <Run>|</Run>
+ <Run/>
+ <Run Foreground="{StaticResource FSE_PrimaryAccentBrush}" Text="{Binding SelectedLogFile.Logs.Count,Mode=OneWay}"></Run>
+ <Run>Items</Run>
+ <Run/>
+ <Run>|</Run>
+ <Run/>
+ <Run>Duration:</Run>
+ <Run Foreground="{StaticResource FSE_PrimaryAccentBrush}" Text="{Binding SelectedLogFile.Duration,Mode=OneWay,StringFormat='hh\\:mm\\:ss'}"></Run>
+ </TextBlock>
+ </Border>
+ <Grid>
+ <Grid.ColumnDefinitions>
+ <ColumnDefinition Width="100*"/>
+ <ColumnDefinition Width="5"/>
+ <ColumnDefinition Width="40*" />
+ </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>
+
+ <!--SPLITTER-->
+ <GridSplitter Margin="0 32 0 0" Grid.Column="1" HorizontalAlignment="Center" Width="5" VerticalAlignment="Stretch"/>
+
+ <!--MESSAGE-->
+ <Border x:Name="borderMessage" Grid.Column="2" Background="{StaticResource FSE_PrimaryBackgroundDarkBrush}" BorderThickness="0 2 0 0" BorderBrush="{StaticResource FSE_PrimaryAccentBrush}">
+ <Border.Style>
+ <Style TargetType="Border">
+ <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>
+ </DataTrigger>
+ </Style.Triggers>
+ </Style>
+ </Border.Style>
+
+ <DockPanel>
+ <Border Padding="10" Height="51" DockPanel.Dock="Top" BorderBrush="{StaticResource FSE_BorderBrush}" BorderThickness="0 0 0 0.5">
+ <CheckBox x:Name="chkWrap" IsChecked="True">WRAP LINES</CheckBox>
+ </Border>
+ <TextBox BorderThickness="0" Padding="5" FontSize="{StaticResource FSE_SmallFontSize}" Foreground="{StaticResource FSE_GrayBrush}" Text="{Binding SelectedLogFile.SelectedLog.Message,Mode=OneWay}" IsReadOnly="True" AcceptsReturn="False" VerticalScrollBarVisibility="Auto" Background="{StaticResource FSE_PrimaryBackgroundDarkBrush}">
+ <TextBox.Style>
+ <Style TargetType="TextBox">
+ <Setter Property="TextWrapping" Value="NoWrap"></Setter>
+ <Setter Property="HorizontalScrollBarVisibility" Value="Auto"></Setter>
+ <Style.Triggers>
+ <DataTrigger Binding="{Binding ElementName=chkWrap, Path=IsChecked}" Value="True">
+ <Setter Property="TextWrapping" Value="Wrap"></Setter>
+ <Setter Property="HorizontalScrollBarVisibility" Value="Hidden"></Setter>
+ </DataTrigger>
+ </Style.Triggers>
+ </Style>
+ </TextBox.Style>
+ </TextBox>
+ </DockPanel>
+ </Border>
+ </Grid>
+ </DockPanel>
+ </Grid>
+ </DockPanel>
</Grid>
</UserControl>
diff --git a/Software/Visual_Studio/FSE/Tango.FSE.LogViewer.UI/Views/LogFileTabView.xaml b/Software/Visual_Studio/FSE/Tango.FSE.LogViewer.UI/Views/LogFileTabView.xaml
new file mode 100644
index 000000000..a2f99bfe3
--- /dev/null
+++ b/Software/Visual_Studio/FSE/Tango.FSE.LogViewer.UI/Views/LogFileTabView.xaml
@@ -0,0 +1,37 @@
+<UserControl x:Class="Tango.FSE.LogViewer.UI.Views.LogFileTabView"
+ xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
+ 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:global="clr-namespace:Tango.FSE.LogViewer.UI"
+ xmlns:material="http://materialdesigninxaml.net/winfx/xaml/themes"
+ xmlns:vm="clr-namespace:Tango.FSE.LogViewer.UI.ViewModels"
+ xmlns:local="clr-namespace:Tango.FSE.LogViewer.UI.Views"
+ xmlns:components="clr-namespace:Tango.SharedUI.Components;assembly=Tango.SharedUI"
+ xmlns:helpers="clr-namespace:Tango.SharedUI.Helpers;assembly=Tango.SharedUI"
+ mc:Ignorable="d"
+ d:DesignHeight="720"
+ d:DesignWidth="1280"
+ d:DataContext="{d:DesignInstance Type=vm:LogFileTabViewVM, IsDesignTimeCreatable=False}"
+ Background="{StaticResource FSE_PrimaryBackgroundDarkBrush}"
+ Foreground="{StaticResource FSE_PrimaryForegroundBrush}">
+ <Grid>
+ <DataGrid x:Name="dataGridLogs" Margin="0 5 0 0" Style="{StaticResource FSE_LogsGridStyle}" ItemsSource="{Binding Logs}" SelectedItem="{Binding SelectedLog}" CellStyle="{StaticResource FSE_LogsGridCellStyle}" CanUserSortColumns="True">
+ <DataGrid.Resources>
+ <components:BindingProxy x:Key="proxy" Data="{Binding}" />
+ </DataGrid.Resources>
+ <DataGrid.Columns>
+ <DataGridTemplateColumn Header="#" Width="40" CellTemplate="{StaticResource FSE_LogIcon_Cell}"/>
+ <DataGridTextColumn Header="DATE TIME" Binding="{Binding TimeStamp,StringFormat='HH:mm:ss.ff'}" Width="100" />
+ <DataGridTextColumn Header="SERVICE" Binding="{Binding ClassName}" Width="200" />
+ <DataGridTemplateColumn Header="MESSAGE" Width="1*" >
+ <DataGridTemplateColumn.CellTemplate>
+ <DataTemplate>
+ <TextBlock TextWrapping="NoWrap" Text="{Binding Message,Converter={StaticResource StringToOneLineConverter},ConverterParameter='120'}"></TextBlock>
+ </DataTemplate>
+ </DataGridTemplateColumn.CellTemplate>
+ </DataGridTemplateColumn>
+ </DataGrid.Columns>
+ </DataGrid>
+ </Grid>
+</UserControl>
diff --git a/Software/Visual_Studio/FSE/Tango.FSE.LogViewer.UI/Views/LogFileTabView.xaml.cs b/Software/Visual_Studio/FSE/Tango.FSE.LogViewer.UI/Views/LogFileTabView.xaml.cs
new file mode 100644
index 000000000..f86d36dac
--- /dev/null
+++ b/Software/Visual_Studio/FSE/Tango.FSE.LogViewer.UI/Views/LogFileTabView.xaml.cs
@@ -0,0 +1,28 @@
+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.Navigation;
+using System.Windows.Shapes;
+
+namespace Tango.FSE.LogViewer.UI.Views
+{
+ /// <summary>
+ /// Interaction logic for LogFileTabView.xaml
+ /// </summary>
+ public partial class LogFileTabView : UserControl
+ {
+ public LogFileTabView()
+ {
+ InitializeComponent();
+ }
+ }
+}
diff --git a/Software/Visual_Studio/Tango.SharedUI/Tango.SharedUI.csproj b/Software/Visual_Studio/Tango.SharedUI/Tango.SharedUI.csproj
index a6980e978..0d76126ab 100644
--- a/Software/Visual_Studio/Tango.SharedUI/Tango.SharedUI.csproj
+++ b/Software/Visual_Studio/Tango.SharedUI/Tango.SharedUI.csproj
@@ -264,7 +264,7 @@
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<ProjectExtensions>
<VisualStudio>
- <UserProperties BuildVersion_AssemblyInfoFilename="Properties\AssemblyInfo.cs" BuildVersion_UpdateAssemblyVersion="True" BuildVersion_BuildVersioningStyle="None.None.Increment.TimeStamp" BuildVersion_UseGlobalSettings="False" BuildVersion_StartDate="2000/1/1" />
+ <UserProperties BuildVersion_StartDate="2000/1/1" BuildVersion_UseGlobalSettings="False" BuildVersion_BuildVersioningStyle="None.None.Increment.TimeStamp" BuildVersion_UpdateAssemblyVersion="True" BuildVersion_AssemblyInfoFilename="Properties\AssemblyInfo.cs" />
</VisualStudio>
</ProjectExtensions>
</Project> \ No newline at end of file