aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Logging
diff options
context:
space:
mode:
authorRoy Ben-Shabat <Roy@Twine-s.com>2018-07-12 14:03:47 +0300
committerRoy Ben-Shabat <Roy@Twine-s.com>2018-07-12 14:03:47 +0300
commit856a23723afcc9d48c0f019dc33a259ac6c279ed (patch)
tree6cc82030ee2d9c74bd7f841bfdc6a0c163def97d /Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Logging
parent70fe7f13b519df86420f8c2b97cf8eb3ab67e9a5 (diff)
downloadTango-856a23723afcc9d48c0f019dc33a259ac6c279ed.tar.gz
Tango-856a23723afcc9d48c0f019dc33a259ac6c279ed.zip
Implemented continuous request timeouts.
Implemented continuous request abort exception. Added log object for real time logs. Some work on PPC & Machine Studio.
Diffstat (limited to 'Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Logging')
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Logging/Converters/LogItemToMessageConverter.cs39
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Logging/Tango.MachineStudio.Logging.csproj1
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Logging/ViewModels/ApplicationLogsViewVM.cs4
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Logging/ViewModels/EmbeddedLogsViewVM.cs4
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Logging/Views/ApplicationLogDetailsView.xaml4
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Logging/Views/ApplicationLogsView.xaml7
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Logging/Views/EmbeddedLogsView.xaml7
7 files changed, 65 insertions, 1 deletions
diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Logging/Converters/LogItemToMessageConverter.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Logging/Converters/LogItemToMessageConverter.cs
new file mode 100644
index 000000000..7136b22ea
--- /dev/null
+++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Logging/Converters/LogItemToMessageConverter.cs
@@ -0,0 +1,39 @@
+using System;
+using System.Collections.Generic;
+using System.Globalization;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows.Data;
+using Tango.Logging;
+using Tango.PMR.Common;
+
+namespace Tango.MachineStudio.Logging.Converters
+{
+ public class LogItemToMessageConverter : IValueConverter
+ {
+ public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
+ {
+ LogItemBase log = value as LogItemBase;
+
+ if (log != null)
+ {
+ String str = log.Message;
+
+ if (log.LogObject != null)
+ {
+ str += Environment.NewLine + Environment.NewLine + log.LogObject.ToJsonString("Data");
+ }
+
+ return str;
+ }
+
+ return null;
+ }
+
+ public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
+ {
+ throw new NotImplementedException();
+ }
+ }
+}
diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Logging/Tango.MachineStudio.Logging.csproj b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Logging/Tango.MachineStudio.Logging.csproj
index 706243ee1..2ce0446aa 100644
--- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Logging/Tango.MachineStudio.Logging.csproj
+++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Logging/Tango.MachineStudio.Logging.csproj
@@ -74,6 +74,7 @@
<Compile Include="Controls\TimeRuler.cs" />
<Compile Include="Converters\DateIsInListToBooleanConverter.cs" />
<Compile Include="Converters\EventsToTimeRulerTicksConverter.cs" />
+ <Compile Include="Converters\LogItemToMessageConverter.cs" />
<Compile Include="Converters\MachineEventToXConverter.cs" />
<Compile Include="Converters\SecondsToWidthConverter.cs" />
<Compile Include="Converters\StringToFirstLineConverter.cs" />
diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Logging/ViewModels/ApplicationLogsViewVM.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Logging/ViewModels/ApplicationLogsViewVM.cs
index eb172069e..2bb96c1e5 100644
--- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Logging/ViewModels/ApplicationLogsViewVM.cs
+++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Logging/ViewModels/ApplicationLogsViewVM.cs
@@ -94,6 +94,8 @@ namespace Tango.MachineStudio.Logging.ViewModels
public RelayCommand ToggleRealTimePaused { get; set; }
+ public RelayCommand ClearRealTimeLogsCommand { get; set; }
+
public ApplicationLogsViewVM(LoggingNavigationManager navigation, INotificationProvider notification)
{
_notification = notification;
@@ -122,6 +124,8 @@ namespace Tango.MachineStudio.Logging.ViewModels
LogManager.NewLog += LogManager_NewLog;
ToggleRealTimePaused = new RelayCommand(() => RealTimePaused = !RealTimePaused);
+
+ ClearRealTimeLogsCommand = new RelayCommand(() => { _realTimeLogs.Clear(); });
}
private void LogManager_NewLog(object sender, LogItemBase log)
diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Logging/ViewModels/EmbeddedLogsViewVM.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Logging/ViewModels/EmbeddedLogsViewVM.cs
index 8cf4edcb3..ba18cbdb1 100644
--- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Logging/ViewModels/EmbeddedLogsViewVM.cs
+++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Logging/ViewModels/EmbeddedLogsViewVM.cs
@@ -96,6 +96,8 @@ namespace Tango.MachineStudio.Logging.ViewModels
public RelayCommand ToggleRealTimePaused { get; set; }
+ public RelayCommand ClearRealTimeLogsCommand { get; set; }
+
public EmbeddedLogsViewVM(LoggingNavigationManager navigation, IStudioApplicationManager application, INotificationProvider notification)
{
_notification = notification;
@@ -124,6 +126,8 @@ namespace Tango.MachineStudio.Logging.ViewModels
MachineOperator.EmbeddedLogManager.NewLog += EmbeddedLogManager_NewLog;
ToggleRealTimePaused = new RelayCommand(() => RealTimePaused = !RealTimePaused);
+
+ ClearRealTimeLogsCommand = new RelayCommand(() => { _realTimeLogs.Clear(); });
}
private void EmbeddedLogManager_NewLog(object sender, LogItemBase log)
diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Logging/Views/ApplicationLogDetailsView.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Logging/Views/ApplicationLogDetailsView.xaml
index 8c934545a..c7ebcaf02 100644
--- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Logging/Views/ApplicationLogDetailsView.xaml
+++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Logging/Views/ApplicationLogDetailsView.xaml
@@ -6,6 +6,7 @@
xmlns:converters="clr-namespace:Tango.SharedUI.Converters;assembly=Tango.SharedUI"
xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes"
xmlns:controls="clr-namespace:Tango.SharedUI.Controls;assembly=Tango.SharedUI"
+ xmlns:localConverters="clr-namespace:Tango.MachineStudio.Logging.Converters"
xmlns:vm="clr-namespace:Tango.MachineStudio.Logging.ViewModels"
xmlns:entities="clr-namespace:Tango.BL.Entities;assembly=Tango.BL"
xmlns:local="clr-namespace:Tango.MachineStudio.Logging.Views"
@@ -14,6 +15,7 @@
<UserControl.Resources>
<converters:DateTimeUTCToStringConverter x:Key="DateTimeUTCToStringConverter" />
+ <localConverters:LogItemToMessageConverter x:Key="LogItemToMessageConverter" />
</UserControl.Resources>
<Grid>
@@ -71,7 +73,7 @@
</Grid>
<Border Padding="5" BorderThickness="1" BorderBrush="Gainsboro">
- <TextBox BorderThickness="0" Text="{Binding Log.Message}" Style="{x:Null}" TextWrapping="Wrap" IsReadOnly="True" HorizontalScrollBarVisibility="Disabled" VerticalScrollBarVisibility="Auto" Background="Transparent" />
+ <TextBox BorderThickness="0" Text="{Binding Log,Converter={StaticResource LogItemToMessageConverter}}" Style="{x:Null}" TextWrapping="Wrap" IsReadOnly="True" HorizontalScrollBarVisibility="Disabled" VerticalScrollBarVisibility="Auto" Background="Transparent" />
</Border>
</DockPanel>
</Grid>
diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Logging/Views/ApplicationLogsView.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Logging/Views/ApplicationLogsView.xaml
index 9115b6a7c..3ca10f370 100644
--- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Logging/Views/ApplicationLogsView.xaml
+++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Logging/Views/ApplicationLogsView.xaml
@@ -92,6 +92,13 @@
</materialDesign:PackIcon.Style>
</materialDesign:PackIcon>
</Button>
+
+ <Button Margin="20 0 0 0" Background="#FF7777" BorderBrush="#FF7777" ToolTip="Clear real-time logs" Command="{Binding ClearRealTimeLogsCommand}">
+ <StackPanel Orientation="Horizontal">
+ <materialDesign:PackIcon Width="24" Height="24" Kind="DeleteSweep" />
+ <TextBlock VerticalAlignment="Center" Margin="10 0 0 0">CLEAR</TextBlock>
+ </StackPanel>
+ </Button>
</StackPanel>
</Grid>
</Border>
diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Logging/Views/EmbeddedLogsView.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Logging/Views/EmbeddedLogsView.xaml
index 3b54c1d35..d70149bbb 100644
--- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Logging/Views/EmbeddedLogsView.xaml
+++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Logging/Views/EmbeddedLogsView.xaml
@@ -92,6 +92,13 @@
</materialDesign:PackIcon.Style>
</materialDesign:PackIcon>
</Button>
+
+ <Button Margin="20 0 0 0" Background="#FF7777" BorderBrush="#FF7777" ToolTip="Clear real-time logs" Command="{Binding ClearRealTimeLogsCommand}">
+ <StackPanel Orientation="Horizontal">
+ <materialDesign:PackIcon Width="24" Height="24" Kind="DeleteSweep" />
+ <TextBlock VerticalAlignment="Center" Margin="10 0 0 0">CLEAR</TextBlock>
+ </StackPanel>
+ </Button>
</StackPanel>
</Grid>
</Border>