diff options
| author | Avi Levkovich <avi@twine-s.com> | 2018-07-22 09:22:30 +0300 |
|---|---|---|
| committer | Avi Levkovich <avi@twine-s.com> | 2018-07-22 09:22:30 +0300 |
| commit | 392b017771f32e469269cd12af37b162eef56a5b (patch) | |
| tree | 36cae5ebcbdad7efa9809c63475cbd9e1955dcf1 /Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Logging | |
| parent | 044fb3fe8e56c5f6d1803bf9b97d648abafba44c (diff) | |
| parent | 3fe33a685c3ca7a8730dacffa5357f77d7e76a96 (diff) | |
| download | Tango-392b017771f32e469269cd12af37b162eef56a5b.tar.gz Tango-392b017771f32e469269cd12af37b162eef56a5b.zip | |
merge
Diffstat (limited to 'Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Logging')
7 files changed, 61 insertions, 39 deletions
diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Logging/Navigation/LoggingNavigationView.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Logging/Navigation/LoggingNavigationView.cs index e8a14cc3d..bd8b63773 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Logging/Navigation/LoggingNavigationView.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Logging/Navigation/LoggingNavigationView.cs @@ -10,7 +10,7 @@ namespace Tango.MachineStudio.Logging.Navigation { HomeView, EventsView, - TimelineView, + TimelineWrapperView, ApplicationLogsView, EmbeddedLogsView, } 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 c56ca5541..b0bc613bd 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 @@ -57,6 +57,16 @@ namespace Tango.MachineStudio.Logging.ViewModels } } + private bool _displayDebug; + /// <summary> + /// Gets or sets a value indicating whether display debug logs. + /// </summary> + public bool DisplayDebug + { + get { return _displayDebug; } + set { _displayDebug = value; RaisePropertyChangedAuto(); } + } + private LogItemBase _selectedLog; public LogItemBase SelectedLog { @@ -169,21 +179,12 @@ namespace Tango.MachineStudio.Logging.ViewModels private void LogManager_NewLog(object sender, LogItemBase log) { + if (log.Category == LogCategory.Debug && !DisplayDebug) return; + if (!RealTimePaused) { InvokeUI(() => { - if (_is_debug) - { - if (_realTimeLogs.Count > 1000) - { - for (int i = 998; i < _realTimeLogs.Count; i++) - { - _realTimeLogs.RemoveAt(i); - } - } - } - _realTimeLogs.Insert(0, log); }); } @@ -225,10 +226,10 @@ namespace Tango.MachineStudio.Logging.ViewModels if (SelectedLog != null && !_dialog_shown) { _dialog_shown = true; - _notification.ShowModalDialog<LogDetailsViewVM, ApplicationLogDetailsView>(new LogDetailsViewVM(SelectedLog), (x) => + _notification.ShowModalDialog<LogDetailsViewVM, ApplicationLogDetailsView>(new LogDetailsViewVM(SelectedLog), (x) => { - - }, () => + + }, () => { _dialog_shown = false; }); diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Logging/ViewModels/EventsViewVM.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Logging/ViewModels/EventsViewVM.cs index e2185bbdc..50caced63 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Logging/ViewModels/EventsViewVM.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Logging/ViewModels/EventsViewVM.cs @@ -199,7 +199,7 @@ namespace Tango.MachineStudio.Logging.ViewModels TimelineViewVM.Initialize(events.ToList()); - _navigation.NavigateTo(LoggingNavigationView.TimelineView); + _navigation.NavigateTo(LoggingNavigationView.TimelineWrapperView); } } } diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Logging/ViewModels/TimelineEventGroup.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Logging/ViewModels/TimelineEventGroup.cs index 978348fd2..6a86f38e6 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Logging/ViewModels/TimelineEventGroup.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Logging/ViewModels/TimelineEventGroup.cs @@ -13,6 +13,13 @@ namespace Tango.MachineStudio.Logging.ViewModels { public String Name { get; set; } + private double _height; + public double Height + { + get { return _height; } + set { _height = value; RaisePropertyChangedAuto(); } + } + public ObservableCollection<MachinesEvent> Events { get; set; } public TimelineEventGroup() 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 310f4fd87..eeb7204d1 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 @@ -100,10 +100,12 @@ </StackPanel> </Button> - <StackPanel Orientation="Horizontal" VerticalAlignment="Center" Margin="30 0 0 0"> - <materialDesign:PackIcon Kind="Magnify" Width="24" Height="24" /> - <TextBox VerticalAlignment="Center" Margin="10 0 0 0" Width="200" Text="{Binding Filter,UpdateSourceTrigger=PropertyChanged}" IsEnabled="{Binding RealTimePaused}" materialDesign:HintAssist.Hint="Filter" /> - </StackPanel> + <CheckBox VerticalAlignment="Center" Margin="20 0 0 0" IsChecked="{Binding DisplayDebug}" ToolTip="Hide/Display debug logs (applies only when debug logs are enabled in the settings file)">Process Debug Logs</CheckBox> + </StackPanel> + + <StackPanel Orientation="Horizontal" VerticalAlignment="Center" HorizontalAlignment="Right" Margin="0 0 30 0"> + <materialDesign:PackIcon Kind="Magnify" Width="24" Height="24" /> + <TextBox VerticalAlignment="Center" Margin="10 0 0 0" Width="300" Text="{Binding Filter,UpdateSourceTrigger=PropertyChanged}" IsEnabled="{Binding RealTimePaused}" materialDesign:HintAssist.Hint="Filter" /> </StackPanel> </Grid> </Border> diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Logging/Views/TimelineView.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Logging/Views/TimelineView.xaml index 1046fa4e8..664f2489c 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Logging/Views/TimelineView.xaml +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Logging/Views/TimelineView.xaml @@ -68,23 +68,24 @@ </Grid> - <ItemsControl ItemsSource="{Binding TimelineEventGroups}" Grid.Column="0" Grid.Row="1" Margin="0 0 0 0" Background="#FCFCFC" Height="{Binding ElementName=scrollViewer,Path=ViewportHeight}" VerticalAlignment="Top"> - <ItemsControl.ItemsPanel> - <ItemsPanelTemplate> - <UniformGrid Columns="1" /> - </ItemsPanelTemplate> - </ItemsControl.ItemsPanel> - <ItemsControl.ItemTemplate> - <DataTemplate DataType="{x:Type vm:TimelineEventGroup}"> - <Border BorderThickness="1 0.5 1 0.5" BorderBrush="{StaticResource AccentColorBrush}" Margin="2 0 0 0" Padding="5"> + <ScrollViewer x:Name="scroll_channels" Grid.Column="0" Grid.Row="1" HorizontalScrollBarVisibility="Hidden" VerticalScrollBarVisibility="Hidden"> + <ItemsControl ItemsSource="{Binding TimelineEventGroups}" Margin="0 0 0 0" Background="#FCFCFC" VerticalAlignment="Top"> + <ItemsControl.ItemsPanel> + <ItemsPanelTemplate> + <StackPanel /> + </ItemsPanelTemplate> + </ItemsControl.ItemsPanel> + <ItemsControl.ItemTemplate> + <DataTemplate DataType="{x:Type vm:TimelineEventGroup}"> + <Border BorderThickness="1 0.5 1 0.5" BorderBrush="{StaticResource AccentColorBrush}" Margin="2 0 0 0" Padding="5" Height="{Binding Height,Mode=OneWay}"> + <TextBlock Text="{Binding Name}" HorizontalAlignment="Center" VerticalAlignment="Center" FontSize="22" TextWrapping="Wrap" TextAlignment="Center" FontWeight="SemiBold" Foreground="{StaticResource AccentColorBrush}"></TextBlock> + </Border> + </DataTemplate> + </ItemsControl.ItemTemplate> + </ItemsControl> + </ScrollViewer> - <TextBlock Text="{Binding Name}" HorizontalAlignment="Center" VerticalAlignment="Center" FontSize="22" TextWrapping="Wrap" TextAlignment="Center" FontWeight="SemiBold" Foreground="{StaticResource AccentColorBrush}"></TextBlock> - </Border> - </DataTemplate> - </ItemsControl.ItemTemplate> - </ItemsControl> - - <localControls:TimelineScrollViewer x:Name="scrollViewer" Grid.Column="1" Grid.Row="1" VerticalScrollBarVisibility="Disabled" HorizontalScrollBarVisibility="Auto"> + <localControls:TimelineScrollViewer x:Name="scrollViewer" Grid.Column="1" Grid.Row="1" VerticalScrollBarVisibility="Auto" HorizontalScrollBarVisibility="Auto" ScrollChanged="scrollViewer_ScrollChanged"> <Grid HorizontalAlignment="Left"> <ItemsControl ItemsSource="{Binding TimelineEventGroups}" HorizontalAlignment="Left" MinWidth="{Binding RelativeSource={RelativeSource AncestorType=localControls:TimelineScrollViewer},Path=ActualWidth}"> <ItemsControl.Width> @@ -101,15 +102,15 @@ <ItemsControl.ItemTemplate> <DataTemplate DataType="{x:Type vm:TimelineEventGroup}"> <Border BorderThickness="0 0 0 1" BorderBrush="#98DEFF" Margin="0 0 0 0"> - <ItemsControl ItemsSource="{Binding Events}"> + <ItemsControl ItemsSource="{Binding Events}" SizeChanged="ItemsControl_SizeChanged"> <ItemsControl.ItemsPanel> <ItemsPanelTemplate> - <UniformGrid IsItemsHost="True" Columns="1"></UniformGrid> + <StackPanel IsItemsHost="True"></StackPanel> </ItemsPanelTemplate> </ItemsControl.ItemsPanel> <ItemsControl.ItemTemplate> <DataTemplate DataType="{x:Type entities:MachinesEvent}"> - <Canvas Margin="0 5 0 5" MinHeight="20"> + <Canvas Margin="0 0 0 0" MinHeight="20"> <Grid Height="{Binding RelativeSource={RelativeSource AncestorType=Canvas},Path=ActualHeight}"> <Canvas.Left> <MultiBinding Converter="{StaticResource MachineEventToXConverter}"> diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Logging/Views/TimelineView.xaml.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Logging/Views/TimelineView.xaml.cs index e1c09e49f..8004ef154 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Logging/Views/TimelineView.xaml.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Logging/Views/TimelineView.xaml.cs @@ -40,5 +40,16 @@ namespace Tango.MachineStudio.Logging.Views _vm.TimelineScaleFactor -= 0.5; } } + + private void ItemsControl_SizeChanged(object sender, SizeChangedEventArgs e) + { + TimelineEventGroup group = (sender as FrameworkElement).DataContext as TimelineEventGroup; + group.Height = e.NewSize.Height; + } + + private void scrollViewer_ScrollChanged(object sender, ScrollChangedEventArgs e) + { + scroll_channels.ScrollToVerticalOffset(e.VerticalOffset); + } } } |
