diff options
| author | Avi Levkovich <avi@twine-s.com> | 2020-03-25 17:46:56 +0200 |
|---|---|---|
| committer | Avi Levkovich <avi@twine-s.com> | 2020-03-25 17:46:56 +0200 |
| commit | aa732a33f7c63ce4438ec2b79fedb641ffd22b05 (patch) | |
| tree | 86ccf57c1dfb6801de16f15d681539c02b007508 /Software/Visual_Studio/MachineStudio/Modules | |
| parent | d29da53d6f71f45749c0ede5b4cd7281ed3a270e (diff) | |
| parent | 8f57d4962fa84499c8a153ebfff6e7766434ee1c (diff) | |
| download | Tango-aa732a33f7c63ce4438ec2b79fedb641ffd22b05.tar.gz Tango-aa732a33f7c63ce4438ec2b79fedb641ffd22b05.zip | |
merge conflicts -take remote
Diffstat (limited to 'Software/Visual_Studio/MachineStudio/Modules')
25 files changed, 974 insertions, 164 deletions
diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ActionLogs/Tango.MachineStudio.ActionLogs.csproj b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ActionLogs/Tango.MachineStudio.ActionLogs.csproj index 280356aa8..de4783237 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ActionLogs/Tango.MachineStudio.ActionLogs.csproj +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ActionLogs/Tango.MachineStudio.ActionLogs.csproj @@ -156,5 +156,8 @@ <ItemGroup> <Resource Include="Images\action_logs.jpg" /> </ItemGroup> + <ItemGroup> + <Folder Include="Models\" /> + </ItemGroup> <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> </Project>
\ No newline at end of file diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ActionLogs/ViewModels/MainViewVM.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ActionLogs/ViewModels/MainViewVM.cs index 534bb364f..3e5c59fee 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ActionLogs/ViewModels/MainViewVM.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ActionLogs/ViewModels/MainViewVM.cs @@ -16,12 +16,16 @@ using Tango.BL.ValueObjects; using Tango.Core.Commands; using Tango.Core.ExtensionMethods; using Tango.MachineStudio.Common; +using Tango.MachineStudio.Common.Notifications; using Tango.SharedUI.Components; namespace Tango.MachineStudio.ActionLogs.ViewModels { public class MainViewVM : StudioViewModel { + private INotificationProvider _notification; + private List<User> _allUsers; + #region Properties private DateTime _startSelectedDate; @@ -83,30 +87,44 @@ namespace Tango.MachineStudio.ActionLogs.ViewModels set { _differenceObject = value; RaisePropertyChangedAuto(); } } + private bool _isLoading; + + public bool IsLoading + { + get { return _isLoading; } + set { _isLoading = value; RaisePropertyChangedAuto(); } + } + + private bool _isLoadingDifferences; - private bool _isRunning; - public bool IsRunning + public bool IsLoadingDifferences { - get { return _isRunning; } - set { _isRunning = value; } + get { return _isLoadingDifferences; } + set { _isLoadingDifferences = value; RaisePropertyChangedAuto(); } } + + + #endregion public RelayCommand SearchCommand { get; set; } public RelayCommand CopyToClipBoardCommand { get; set; } public RelayCommand CopyRelateObjectIDCommand { get; set; } - public MainViewVM() + public MainViewVM(INotificationProvider notification) { + _notification = notification; + + IsLoading = false; + IsLoadingDifferences = false; ActionLogs = new ObservableCollection<ActionLog>(); - SearchCommand = new RelayCommand(GetActionLogs, () => !IsRunning); + SearchCommand = new RelayCommand(async () => await GetActionLogs(), () => IsFree); CopyRelateObjectIDCommand = new RelayCommand(CopyRelateObjectID); CopyToClipBoardCommand = new RelayCommand(CopyToClipBoard, () => SelectedActionLog != null && SelectedActionLog.DifferenceObject != null); DateTime now = DateTime.Now; StartSelectedDate = now.AddMonths(-1); EndSelectedDate = now; - _isRunning = false; var source = Enum.GetValues(typeof(ActionLogType)).Cast<ActionLogType>().ToObservableCollection(); var syncedSource = Enum.GetValues(typeof(ActionLogType)).Cast<ActionLogType>().ToObservableCollection(); @@ -115,7 +133,28 @@ namespace Tango.MachineStudio.ActionLogs.ViewModels public override void OnApplicationReady() { + InitUsers(); + } + public async void InitUsers() + { + try + { + IsFree = false; + + using (var db = ObservablesContext.CreateDefault()) + { + _allUsers = await db.Users.Include(x => x.Contact).ToListAsync(); + } + } + catch (Exception ex) + { + LogManager.Log(ex, "Error loading users."); + } + finally + { + IsFree = true; + } } private void CopyToClipBoard() @@ -129,45 +168,123 @@ namespace Tango.MachineStudio.ActionLogs.ViewModels DataObject data = new DataObject(SelectedActionLog.RelatedObjectGuid); System.Windows.Clipboard.SetDataObject(data); } - + /// <summary> /// New Database Query with search parameters. Initialization ActionLogs property. /// </summary> - private async void GetActionLogs() + private async Task GetActionLogs() { + IsLoading = true; string filter = SearchFilter?.ToLower(); if (String.IsNullOrWhiteSpace(filter)) filter = null; - using (ObservablesContext db = ObservablesContext.CreateDefault()) + try { - - DateTime startUtc = new DateTime(StartSelectedDate.Date.Ticks, DateTimeKind.Utc); - TimeSpan offsetTime = (EndSelectedDate.Date == DateTime.Now.Date) ? DateTime.Now.TimeOfDay : new TimeSpan(24, 0, 0); - DateTime endUtc = new DateTime(EndSelectedDate.Date.Ticks + offsetTime.Ticks, DateTimeKind.Utc); + IsFree = false; + + using (ObservablesContext db = ObservablesContext.CreateDefault()) + { + DateTime startUtc = new DateTime(StartSelectedDate.Year, StartSelectedDate.Month, StartSelectedDate.Day, 0, 0, 0).ToUniversalTime(); + TimeSpan offsetTime = (EndSelectedDate.Date == DateTime.Now.Date) ? DateTime.Now.TimeOfDay : new TimeSpan(23, 59, 59); + DateTime endUtc = EndSelectedDate.ToUniversalTime() + offsetTime; + + Debug.Write($"TEST TIME {startUtc} to {endUtc} "+ System.Environment.NewLine); - Debug.Write($"TEST TIME {startUtc} from {endUtc} " + System.Environment.NewLine); + var db_ActionLogs = db.ActionLogs.Where(x => x.LastUpdated <= endUtc && x.LastUpdated >= startUtc) + .Select(x => new + { + x.ID, + x.Guid, + x.UserGuid, + x.LastUpdated, + x.Type, + x.RelatedObjectName, + x.RelatedObjectGuid, + x.Message + }); - IsRunning = true; - ActionLogs = await new ActionLogsCollectionBuilder(db).Set(x => x.LastUpdated <= DbFunctions.TruncateTime(endUtc) && x.LastUpdated >= DbFunctions.TruncateTime(startUtc)) - .WithUsers() - .WithActionType(SelectedActionLogTypes.SynchedSource.ToArray()) - .Query(y => y.Where - (x => filter == null || - (x.ID.ToString().ToLower().StartsWith(filter) - || (x.RelatedObjectName != null && x.RelatedObjectName.ToLower().StartsWith(filter)) - || (x.RelatedObjectGuid != null && x.RelatedObjectGuid.ToLower().StartsWith(filter)) - || (x.User != null && x.User.Contact != null && x.User.Contact.FullName.ToLower().StartsWith(filter))))) - .BuildAsync(); - IsRunning = false; + int[] actionTypes = SelectedActionLogTypes.SynchedSource.ToArray().Select(x => (int)x).ToArray(); + if (actionTypes.Length > 0) + { + db_ActionLogs = db_ActionLogs.Where(x => actionTypes.Contains(x.Type)); + } + + var runs_db = await db_ActionLogs.ToListAsync(); + var runs = runs_db.Select(x => new ActionLog() + { + ID = x.ID, + Guid = x.Guid, + UserGuid = x.UserGuid, + LastUpdated = x.LastUpdated, + Type = x.Type, + RelatedObjectName = x.RelatedObjectName, + RelatedObjectGuid = x.RelatedObjectGuid, + Message = x.Message, + User = _allUsers.SingleOrDefault(y => y.Guid == x.UserGuid) + }); + + if (!String.IsNullOrEmpty(filter)) + { + runs = runs.Where(x => x.ID.ToString().ToLower().StartsWith(filter) || (x.RelatedObjectName != null && x.RelatedObjectName.ToLower().StartsWith(filter)) + || (x.RelatedObjectGuid != null && x.RelatedObjectGuid.ToLower().StartsWith(filter)) + || (x.User != null && x.User.Contact != null && x.User.Contact.FullName.ToLower().StartsWith(filter))); + } + ActionLogs = runs.ToObservableCollection(); + } + } + catch (Exception ex) + { + IsFree = true; + LogManager.Log(ex, "Error getting action logs."); + _notification.ShowError($"Error occurred while trying to retrieve the action logs.\n{ex.Message}"); + } + finally + { + IsFree = true; + IsLoading = false; } } - private void SelectedItemChanged() + /// <summary> + /// Update DifferenceObject on Selected item changed + /// </summary> + private async void SelectedItemChanged() { - if (SelectedActionLog == null || SelectedActionLog.DifferenceObject == null) + if (SelectedActionLog == null) return; + if (SelectedActionLog.Difference == null) + { + await InitSelectedActionLogDifference(); + } DifferenceObject = SelectedActionLog.DifferenceObject; } + + /// <summary> + /// Initializes the selected action log difference. + /// </summary> + public async Task InitSelectedActionLogDifference() + { + IsLoadingDifferences = true; + try + { + using (var db = ObservablesContext.CreateDefault()) + { + var difference = await db.ActionLogs.SingleOrDefaultAsync(x => x.Guid.Equals(SelectedActionLog.Guid)); + if (difference != null) + { + SelectedActionLog.DifferenceObject = difference.DifferenceObject; + } + } + } + catch (Exception ex) + { + LogManager.Log(ex, "Error loading difference of the selected action log."); + } + finally + { + IsLoadingDifferences = false; + } + } } } diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ActionLogs/Views/MainView.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ActionLogs/Views/MainView.xaml index 3a7eaa802..e2d65d7a3 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ActionLogs/Views/MainView.xaml +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ActionLogs/Views/MainView.xaml @@ -82,8 +82,9 @@ <ItemsControl.ItemTemplate> <DataTemplate> <DockPanel Margin="2"> - <CheckBox VerticalAlignment="Center" DockPanel.Dock="Left" IsChecked="{Binding IsSelected}" /> - <TextBlock Margin="5 0 0 0" VerticalAlignment="Center" Text="{Binding Data,Converter={StaticResource EnumToDescriptionConverter}}"></TextBlock> + <CheckBox VerticalAlignment="Center" DockPanel.Dock="Left" IsChecked="{Binding IsSelected}" > + <TextBlock Margin="5 0 0 0" VerticalAlignment="Center" Text="{Binding Data,Converter={StaticResource EnumToDescriptionConverter}}"></TextBlock> + </CheckBox> </DockPanel> </DataTemplate> </ItemsControl.ItemTemplate> @@ -149,13 +150,13 @@ <DataGridTextColumn Header="ACTION" Binding="{Binding ActionType, Converter={StaticResource EnumToDescriptionConverter}}" Width="Auto"/> <DataGridTextColumn Header="USER" Binding="{Binding User.Contact.FullName}" Width="Auto"/> <DataGridTextColumn Header="RELATED OBJECT NAME" Binding="{Binding RelatedObjectName}" Width="Auto" /> - <DataGridTextColumn Header="RELATED OBJECT ID" Binding="{Binding RelatedObjectGuid}" Width="Auto" > + <DataGridTextColumn Header="RELATED OBJECT ID" Binding="{Binding RelatedObjectGuid}" Width="Auto" > <DataGridTextColumn.CellStyle> <Style TargetType="DataGridCell" BasedOn="{StaticResource {x:Type DataGridCell}}" > <Setter Property="BorderThickness" Value="0"/> <Setter Property="FocusVisualStyle" Value="{x:Null}"/> <Setter Property="VerticalContentAlignment" Value="Center"></Setter> - <Setter Property="Tag" Value="{Binding RelativeSource={RelativeSource AncestorType={x:Type UserControl}}, Path=DataContext}"/> + <Setter Property="Tag" Value="{Binding RelativeSource={RelativeSource AncestorType=UserControl}, Path=DataContext}"/> <Setter Property="ContextMenu"> <Setter.Value> <ContextMenu DataContext="{Binding PlacementTarget.Tag, RelativeSource={RelativeSource Self}}" Padding="0" Margin="0" > @@ -207,9 +208,9 @@ </DataGrid.Columns> </DataGrid> </Grid> - <Grid Grid.Row="1" Grid.Column="0" Visibility="{Binding IsRunning,Converter={StaticResource BooleanToVisibilityConverter}}"> + <Grid Grid.Row="1" Grid.Column="0" Visibility="{Binding IsLoading,Converter={StaticResource BooleanToVisibilityConverter}}"> <StackPanel Orientation="Vertical" HorizontalAlignment="Center" VerticalAlignment="Center"> - <mahapps:ProgressRing Margin="20 60 20 40" Width="80" Height="80" IsActive="{Binding IsRunning}"></mahapps:ProgressRing> + <mahapps:ProgressRing Margin="20 60 20 40" Width="80" Height="80" IsActive="{Binding IsLoading}"></mahapps:ProgressRing> <TextBlock Text="Loading..." HorizontalAlignment="Center" FontSize="20" FontStyle="Italic" VerticalAlignment="Center" Margin="0 20 0 0"></TextBlock> </StackPanel> </Grid> @@ -314,6 +315,7 @@ </DockPanel> </Border> + <mahapps:ProgressRing Grid.Row="1" Grid.Column="1" Margin="20 0 20 40" Width="80" Height="80" IsActive="{Binding IsLoadingDifferences}"></mahapps:ProgressRing> </Grid> </Grid> diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Controls/JobOutlineControl.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Controls/JobOutlineControl.cs index 5a3f5d337..68dc7e3bf 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Controls/JobOutlineControl.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Controls/JobOutlineControl.cs @@ -150,6 +150,20 @@ namespace Tango.MachineStudio.Developer.Controls _sizeControl.Height += NORMAL_FONT_HEIGHT; } } + //JobTicket.HeadCleaningParameters + if (job.HeadCleaningParameters != null) + { + _sizeControl.Height += 20; + DrawHeaderText(drawingContext, "HEAD CLEANING PARAMETERS", 17, LevelOffset.level_0); + _sizeControl.Height += TITLE_FONT_HEIGHT; + _sizeControl.Height += 5.0; + basicProps = GetNameValueList(job.HeadCleaningParameters); + foreach (var prop in basicProps) + { + DrawNameValueText(drawingContext, prop, LevelOffset.level_1, PackIconKind.Settings); + _sizeControl.Height += NORMAL_FONT_HEIGHT; + } + } //JobTicket.Segments if (job.Segments != null) { diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Views/JobView.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Views/JobView.xaml index ed8fc57fe..ed832f468 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Views/JobView.xaml +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Views/JobView.xaml @@ -1553,7 +1553,7 @@ <Grid Background="Transparent"> <ContentControl> <StackPanel> - <TextBlock IsHitTestVisible="False" Margin="0 5 0 5" Text="{Binding Name}" FontSize="11" Foreground="{StaticResource MainWindow.Foreground}"></TextBlock> + <TextBlock ToolTip="{Binding Name}" IsHitTestVisible="False" Margin="0 5 0 5" Text="{Binding Name}" FontSize="11" Foreground="{StaticResource MainWindow.Foreground}"></TextBlock> <mahapps:NumericUpDown FontSize="20" Minimum="0" Margin="0 0 5 0" HideUpDownButtons="True" HorizontalContentAlignment="Center" Maximum="10000" StringFormat="{Binding StringFormat}" InterceptArrowKeys="True" Background="Transparent" BorderThickness="0" InterceptMouseWheel="True" HasDecimals="True" Value="{Binding Value,Mode=TwoWay}" Foreground="{StaticResource MainWindow.Foreground}"></mahapps:NumericUpDown> </StackPanel> </ContentControl> diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Views/RunningJobView.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Views/RunningJobView.xaml index e7f16146b..0400ee7e6 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Views/RunningJobView.xaml +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Views/RunningJobView.xaml @@ -208,7 +208,7 @@ </Grid> </Grid> - <Grid HorizontalAlignment="Right"> + <Grid HorizontalAlignment="Right" Margin="0 0 0 82"> <ContentControl Content="{Binding}"> <ContentControl.Style> <Style TargetType="ContentControl"> 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 91cc677e0..a384c133d 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 @@ -59,14 +59,14 @@ namespace Tango.MachineStudio.Logging.ViewModels } } - private bool _displayDebug; + private bool _processDebugLogs; /// <summary> /// Gets or sets a value indicating whether display debug logs. /// </summary> - public bool DisplayDebug + public bool ProcessDebugLogs { - get { return _displayDebug; } - set { _displayDebug = value; RaisePropertyChangedAuto(); } + get { return _processDebugLogs; } + set { _processDebugLogs = value; RaisePropertyChangedAuto(); OnProcessDebugLogsChanged(); } } private LogItemBase _selectedLog; @@ -184,6 +184,18 @@ namespace Tango.MachineStudio.Logging.ViewModels _is_debug = LogManager.Categories.Contains(LogCategory.Debug); } + private void OnProcessDebugLogsChanged() + { + if (ProcessDebugLogs) + { + LogManager.Categories.Add(LogCategory.Debug); + } + else + { + LogManager.Categories.RemoveAll(x => x == LogCategory.Debug); + } + } + private void ApplyLogsFilter() { if ((_realTimePaused && _isRealTime) || !_isRealTime) @@ -204,8 +216,6 @@ namespace Tango.MachineStudio.Logging.ViewModels private void LogManager_NewLog(object sender, LogItemBase log) { - if (log.Category == LogCategory.Debug && !DisplayDebug) return; - if (!RealTimePaused) { InvokeUI(() => 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 4c291d0df..486c0751d 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 @@ -114,7 +114,7 @@ </StackPanel> </Border> - <CheckBox VerticalAlignment="Center" Margin="20 0 0 0" IsChecked="{Binding DisplayDebug}" IsEnabled="{Binding IsRealTime}" ToolTip="Hide/Display debug logs (applies only when debug logs are enabled in the settings file)">Process Debug Logs</CheckBox> + <CheckBox VerticalAlignment="Center" Margin="20 0 0 0" IsChecked="{Binding ProcessDebugLogs}" IsEnabled="{Binding IsRealTime}" ToolTip="Allow incoming real-time debug logs">Enable Debug Logs</CheckBox> </StackPanel> <StackPanel Orientation="Horizontal" VerticalAlignment="Center" HorizontalAlignment="Right" Margin="0 0 30 0"> diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/Tango.MachineStudio.RML.csproj b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/Tango.MachineStudio.RML.csproj index f448932a0..a413223c3 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/Tango.MachineStudio.RML.csproj +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/Tango.MachineStudio.RML.csproj @@ -118,6 +118,9 @@ <Compile Include="Views\RmlView.xaml.cs"> <DependentUpon>RmlView.xaml</DependentUpon> </Compile> + <Compile Include="Views\HeadCleaningParametersView.xaml.cs"> + <DependentUpon>HeadCleaningParametersView.xaml</DependentUpon> + </Compile> <Compile Include="Views\ThreadParametersView.xaml.cs"> <DependentUpon>ThreadParametersView.xaml</DependentUpon> </Compile> @@ -229,6 +232,10 @@ <SubType>Designer</SubType> <Generator>MSBuild:Compile</Generator> </Page> + <Page Include="Views\HeadCleaningParametersView.xaml"> + <Generator>MSBuild:Compile</Generator> + <SubType>Designer</SubType> + </Page> <Page Include="Views\ThreadParametersView.xaml"> <Generator>MSBuild:Compile</Generator> <SubType>Designer</SubType> diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/Views/HeadCleaningParametersView.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/Views/HeadCleaningParametersView.xaml new file mode 100644 index 000000000..72e377c34 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/Views/HeadCleaningParametersView.xaml @@ -0,0 +1,56 @@ +<UserControl x:Class="Tango.MachineStudio.RML.Views.HeadCleaningParametersView" + 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:vm="clr-namespace:Tango.MachineStudio.RML.ViewModels" + xmlns:global="clr-namespace:Tango.MachineStudio.RML" + xmlns:mahapps="http://metro.mahapps.com/winfx/xaml/controls" + xmlns:controls="clr-namespace:Tango.SharedUI.Controls;assembly=Tango.SharedUI" + xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes" + xmlns:local="clr-namespace:Tango.MachineStudio.RML.Views" + xmlns:converters="clr-namespace:Tango.SharedUI.Converters;assembly=Tango.SharedUI" + mc:Ignorable="d" + d:DesignHeight="720" d:DesignWidth="1280" Background="Transparent" d:DataContext="{d:DesignInstance Type=vm:MainViewVM, IsDesignTimeCreatable=False}" DataContext="{x:Static global:ViewModelLocator.MainViewVM}"> + + <UserControl.Resources> + <converters:EmptyStringToNullConverter x:Key="EmptyStringToNullConverter" /> + </UserControl.Resources> + + <Grid> + <DockPanel> + <Border DockPanel.Dock="Top" Background="{StaticResource TransparentBackgroundBrush200}" Margin="20 0" Padding="5" CornerRadius="5"> + <Border.Effect> + <DropShadowEffect Opacity="0.4" /> + </Border.Effect> + <Grid> + <TextBlock VerticalAlignment="Center" HorizontalAlignment="Left" Margin="20 0 0 0" FontSize="16" Padding="2">HEAD CLEANING PARAMETERS</TextBlock> + </Grid> + </Border> + + <Grid> + <StackPanel Orientation="Horizontal"> + <DockPanel Grid.Column="1" Margin="25" HorizontalAlignment="Left" Width="400"> + <materialDesign:Card> + <StackPanel> + <DockPanel> + <TextBlock DockPanel.Dock="Top" Margin="20 10 0 10" FontSize="16">CLEANER</TextBlock> + <controls:TableGrid RowHeight="25" Margin="20 0" MakeFirstColumnVerticalAlignmentBottom="False"> + <controls:TableGrid.Resources> + <Style TargetType="TextBlock"> + <Setter Property="VerticalAlignment" Value="Center"></Setter> + <Setter Property="Margin" Value="0 3 0 0"></Setter> + </Style> + </controls:TableGrid.Resources> + <TextBlock Text="Cleaner Flow:" VerticalAlignment="Center"></TextBlock> + <mahapps:NumericUpDown Value="{Binding ActiveRML.CleanerFlow,Mode=TwoWay}" Minimum="0" Maximum="10000" InterceptArrowKeys="True" Background="Transparent" BorderThickness="0" InterceptMouseWheel="True" HasDecimals="False" HorizontalContentAlignment="Left"></mahapps:NumericUpDown> + </controls:TableGrid> + </DockPanel> + </StackPanel> + </materialDesign:Card> + </DockPanel> + </StackPanel> + </Grid> + </DockPanel> + </Grid> +</UserControl> diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/Views/HeadCleaningParametersView.xaml.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/Views/HeadCleaningParametersView.xaml.cs new file mode 100644 index 000000000..8d036efa5 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/Views/HeadCleaningParametersView.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.MachineStudio.RML.Views +{ + /// <summary> + /// Interaction logic for SpoolsView.xaml + /// </summary> + public partial class HeadCleaningParametersView : UserControl + { + public HeadCleaningParametersView() + { + InitializeComponent(); + } + } +} diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/Views/RmlView.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/Views/RmlView.xaml index e967c7d83..f425f2003 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/Views/RmlView.xaml +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/Views/RmlView.xaml @@ -56,7 +56,13 @@ <Grid> <DockPanel> <TextBlock DockPanel.Dock="Top" Margin="20 10 0 10" FontSize="16">PROPERTIES</TextBlock> - <controls:TableGrid RowHeight="35" Margin="20 0"> + <controls:TableGrid RowHeight="35" Margin="20 0" MakeFirstColumnVerticalAlignmentBottom="False"> + <controls:TableGrid.Resources> + <Style TargetType="TextBlock"> + <Setter Property="VerticalAlignment" Value="Center"></Setter> + <Setter Property="Margin" Value="0 3 0 0"></Setter> + </Style> + </controls:TableGrid.Resources> <TextBlock Text="Name:" ></TextBlock> <TextBox Text="{Binding ActiveRML.Name,UpdateSourceTrigger=PropertyChanged}"></TextBox> @@ -149,13 +155,16 @@ <Setter Property="Padding" Value="20,2"></Setter> </Style> </TabControl.Resources> - <TabItem Header="PROCESS PARAMETERS" Margin="-100 0 0 0"> + <TabItem Header="PROCESS PARAMETERS" Margin="-100 0 0 0" mahapps:ControlsHelper.HeaderFontSize="20"> <local:ProcessParametersView x:Name="processParametersView" WidthLilquidFactors="{Binding ElementName=calibrationDataView,Path=ActualWidth}"/> </TabItem> - <TabItem Header="THREAD PARAMETERS" Margin="-100 0 0 0"> + <TabItem Header="THREAD PARAMETERS" Margin="-100 0 0 0" mahapps:ControlsHelper.HeaderFontSize="20"> <local:ThreadParametersView/> </TabItem> - <TabItem Header="COLOR CONVERSION" Margin="-100 0 0 0 "> + <TabItem Header="HEAD CLEANING" Margin="-100 0 0 0" mahapps:ControlsHelper.HeaderFontSize="20"> + <local:HeadCleaningParametersView/> + </TabItem> + <TabItem Header="COLOR CONVERSION" Margin="-100 0 0 0 " mahapps:ControlsHelper.HeaderFontSize="20"> <Grid> <Grid.ColumnDefinitions> <ColumnDefinition Width="*"></ColumnDefinition> @@ -214,7 +223,7 @@ </DockPanel> </Grid> </TabItem> - <TabItem Header="SPOOLS" Margin="-100 0 0 0"> + <TabItem Header="SPOOLS" Margin="-100 0 0 0" mahapps:ControlsHelper.HeaderFontSize="20"> <local:SpoolsView/> </TabItem> </TabControl> diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/Views/ThreadParametersView.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/Views/ThreadParametersView.xaml index 7f1ca2262..c083e9b02 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/Views/ThreadParametersView.xaml +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/Views/ThreadParametersView.xaml @@ -35,7 +35,13 @@ <StackPanel> <DockPanel> <TextBlock DockPanel.Dock="Top" Margin="20 10 0 10" FontSize="16">FEEDER</TextBlock> - <controls:TableGrid RowHeight="25" Margin="20 0"> + <controls:TableGrid RowHeight="25" Margin="20 0" MakeFirstColumnVerticalAlignmentBottom="False"> + <controls:TableGrid.Resources> + <Style TargetType="TextBlock"> + <Setter Property="VerticalAlignment" Value="Center"></Setter> + <Setter Property="Margin" Value="0 3 0 0"></Setter> + </Style> + </controls:TableGrid.Resources> <TextBlock Text="Feeder P:" ></TextBlock> <mahapps:NumericUpDown Value="{Binding ActiveRML.FeederP,Mode=TwoWay}" Minimum="-100000" Maximum="1000000" InterceptArrowKeys="True" Background="Transparent" BorderThickness="0" InterceptMouseWheel="True" HasDecimals="False" HorizontalContentAlignment="Left"></mahapps:NumericUpDown> @@ -49,7 +55,13 @@ <DockPanel> <TextBlock DockPanel.Dock="Top" Margin="20 10 0 10" FontSize="16">PULLER</TextBlock> - <controls:TableGrid RowHeight="25" Margin="20 0"> + <controls:TableGrid RowHeight="25" Margin="20 0" MakeFirstColumnVerticalAlignmentBottom="False"> + <controls:TableGrid.Resources> + <Style TargetType="TextBlock"> + <Setter Property="VerticalAlignment" Value="Center"></Setter> + <Setter Property="Margin" Value="0 3 0 0"></Setter> + </Style> + </controls:TableGrid.Resources> <TextBlock Text="Puller P:" ></TextBlock> <mahapps:NumericUpDown Value="{Binding ActiveRML.PullerP,Mode=TwoWay}" Minimum="-100000" Maximum="1000000" InterceptArrowKeys="True" Background="Transparent" BorderThickness="0" InterceptMouseWheel="True" HasDecimals="False" HorizontalContentAlignment="Left"></mahapps:NumericUpDown> @@ -63,7 +75,13 @@ <DockPanel> <TextBlock DockPanel.Dock="Top" Margin="20 10 0 10" FontSize="16">WINDER</TextBlock> - <controls:TableGrid RowHeight="25" Margin="20 0"> + <controls:TableGrid RowHeight="25" Margin="20 0" MakeFirstColumnVerticalAlignmentBottom="False"> + <controls:TableGrid.Resources> + <Style TargetType="TextBlock"> + <Setter Property="VerticalAlignment" Value="Center"></Setter> + <Setter Property="Margin" Value="0 3 0 0"></Setter> + </Style> + </controls:TableGrid.Resources> <TextBlock Text="Winder P:" ></TextBlock> <mahapps:NumericUpDown Value="{Binding ActiveRML.WinderP,Mode=TwoWay}" Minimum="-100000" Maximum="1000000" InterceptArrowKeys="True" Background="Transparent" BorderThickness="0" InterceptMouseWheel="True" HasDecimals="False" HorizontalContentAlignment="Left"></mahapps:NumericUpDown> @@ -83,7 +101,12 @@ <StackPanel> <DockPanel> <TextBlock DockPanel.Dock="Top" Margin="20 10 0 10" FontSize="16">ROCKERS</TextBlock> - <controls:TableGrid RowHeight="25" Margin="20 0"> + <controls:TableGrid RowHeight="25" Margin="20 0" MakeFirstColumnVerticalAlignmentBottom="False"> + <controls:TableGrid.Resources> + <Style TargetType="TextBlock"> + <Setter Property="VerticalAlignment" Value="Center"></Setter> + </Style> + </controls:TableGrid.Resources> <TextBlock Text="Bypass Rockers:" ></TextBlock> <ToggleButton IsChecked="{Binding ActiveRML.BypassRockers,Mode=TwoWay}" HorizontalAlignment="Right" ></ToggleButton> </controls:TableGrid> diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Statistics/App.config b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Statistics/App.config index ed4582d5b..75b63289d 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Statistics/App.config +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Statistics/App.config @@ -22,7 +22,7 @@ </dependentAssembly> <dependentAssembly> <assemblyIdentity name="System.IO.FileSystem" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" /> - <bindingRedirect oldVersion="0.0.0.0-4.0.3.0" newVersion="4.0.3.0" /> + <bindingRedirect oldVersion="0.0.0.0-4.0.2.0" newVersion="4.0.2.0" /> </dependentAssembly> <dependentAssembly> <assemblyIdentity name="System.ValueTuple" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" /> @@ -30,27 +30,27 @@ </dependentAssembly> <dependentAssembly> <assemblyIdentity name="System.IO.Compression" publicKeyToken="b77a5c561934e089" culture="neutral" /> - <bindingRedirect oldVersion="0.0.0.0-4.2.0.0" newVersion="4.2.0.0" /> + <bindingRedirect oldVersion="0.0.0.0-4.1.2.0" newVersion="4.1.2.0" /> </dependentAssembly> <dependentAssembly> <assemblyIdentity name="System.IO.FileSystem.Primitives" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" /> - <bindingRedirect oldVersion="0.0.0.0-4.0.3.0" newVersion="4.0.3.0" /> + <bindingRedirect oldVersion="0.0.0.0-4.0.2.0" newVersion="4.0.2.0" /> </dependentAssembly> <dependentAssembly> <assemblyIdentity name="System.Security.Cryptography.Primitives" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" /> - <bindingRedirect oldVersion="0.0.0.0-4.0.2.0" newVersion="4.0.2.0" /> + <bindingRedirect oldVersion="0.0.0.0-4.0.1.0" newVersion="4.0.1.0" /> </dependentAssembly> <dependentAssembly> <assemblyIdentity name="System.Xml.XPath.XDocument" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" /> - <bindingRedirect oldVersion="0.0.0.0-4.1.0.0" newVersion="4.1.0.0" /> + <bindingRedirect oldVersion="0.0.0.0-4.0.2.0" newVersion="4.0.2.0" /> </dependentAssembly> <dependentAssembly> <assemblyIdentity name="System.Console" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" /> - <bindingRedirect oldVersion="0.0.0.0-4.0.2.0" newVersion="4.0.2.0" /> + <bindingRedirect oldVersion="0.0.0.0-4.0.1.0" newVersion="4.0.1.0" /> </dependentAssembly> <dependentAssembly> <assemblyIdentity name="System.Diagnostics.StackTrace" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" /> - <bindingRedirect oldVersion="0.0.0.0-4.1.0.0" newVersion="4.1.0.0" /> + <bindingRedirect oldVersion="0.0.0.0-4.0.3.0" newVersion="4.0.3.0" /> </dependentAssembly> <dependentAssembly> <assemblyIdentity name="System.Reactive.Core" publicKeyToken="94bc3704cddfc263" culture="neutral" /> @@ -74,7 +74,7 @@ </dependentAssembly> <dependentAssembly> <assemblyIdentity name="Microsoft.IdentityModel.Clients.ActiveDirectory" publicKeyToken="31bf3856ad364e35" culture="neutral" /> - <bindingRedirect oldVersion="0.0.0.0-3.19.8.16603" newVersion="3.19.8.16603" /> + <bindingRedirect oldVersion="0.0.0.0-5.0.5.0" newVersion="5.0.5.0" /> </dependentAssembly> <dependentAssembly> <assemblyIdentity name="WebGrease" publicKeyToken="31bf3856ad364e35" culture="neutral" /> @@ -92,6 +92,10 @@ <assemblyIdentity name="System.Text.Encoding.CodePages" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" /> <bindingRedirect oldVersion="0.0.0.0-4.1.0.0" newVersion="4.1.0.0" /> </dependentAssembly> + <dependentAssembly> + <assemblyIdentity name="Z.EntityFramework.Extensions" publicKeyToken="59b66d028979105b" culture="neutral" /> + <bindingRedirect oldVersion="0.0.0.0-4.0.50.0" newVersion="4.0.50.0" /> + </dependentAssembly> </assemblyBinding> </runtime> </configuration>
\ No newline at end of file diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Statistics/Converters/MidTankLevelToElementHeightConverter.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Statistics/Converters/MidTankLevelToElementHeightConverter.cs index 4ea46336f..de002046e 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Statistics/Converters/MidTankLevelToElementHeightConverter.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Statistics/Converters/MidTankLevelToElementHeightConverter.cs @@ -22,7 +22,7 @@ namespace Tango.MachineStudio.Statistics.Converters double midTankLevel = (double)Math.Min(quantity, MAX_QUANTITY); double delta = ((midTankLevel / MAX_QUANTITY) * parentActualHeight); - if (midTankLevel < (MAX_QUANTITY/10))// if quantity < 10|% set 2 pixel + if (quantity > 0 && midTankLevel < (MAX_QUANTITY/10))// if quantity < 10|% set 2 pixel delta = 2.0; var test = delta; return parentActualHeight - delta; diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Statistics/Models/JobRunModel.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Statistics/Models/JobRunModel.cs index 28d51ab47..83897ca16 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Statistics/Models/JobRunModel.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Statistics/Models/JobRunModel.cs @@ -32,6 +32,8 @@ namespace Tango.MachineStudio.Statistics.Models { HeatingDuration = JobRun.ActualStartDate - JobRun.HeatingStartDate; } + + } } } diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Statistics/Tango.MachineStudio.Statistics.csproj b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Statistics/Tango.MachineStudio.Statistics.csproj index 1300d7dba..f77dbd482 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Statistics/Tango.MachineStudio.Statistics.csproj +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Statistics/Tango.MachineStudio.Statistics.csproj @@ -38,6 +38,9 @@ <Reference Include="EntityFramework.SqlServer, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089, processorArchitecture=MSIL"> <HintPath>..\..\..\packages\EntityFramework.6.2.0\lib\net45\EntityFramework.SqlServer.dll</HintPath> </Reference> + <Reference Include="Google.Protobuf, Version=3.4.1.0, Culture=neutral, PublicKeyToken=a7d26565bac4d604, processorArchitecture=MSIL"> + <HintPath>..\..\..\packages\Google.Protobuf.3.4.1\lib\net45\Google.Protobuf.dll</HintPath> + </Reference> <Reference Include="LiveCharts, Version=0.9.7.0, Culture=neutral, PublicKeyToken=0bc1f845d1ebb8df, processorArchitecture=MSIL"> <HintPath>..\..\..\packages\LiveCharts.0.9.7\lib\net45\LiveCharts.dll</HintPath> </Reference> @@ -75,14 +78,18 @@ <ItemGroup> <Compile Include="Converters\CollectionConverter .cs" /> <Compile Include="Converters\DateTimeToStringFormatConverter.cs" /> + <Compile Include="Converters\JobLengthConverter.cs" /> <Compile Include="Converters\LiquidTypeToColorConverter.cs" /> <Compile Include="Converters\MidTankLevelToElementHeightConverter.cs" /> + <Compile Include="Converters\NanoLiterToLiterFormatConverter.cs" /> <Compile Include="Converters\StringToBoolYesNoNullConverter.cs" /> <Compile Include="Converters\StringToFirstLetterConverter.cs" /> + <Compile Include="Models\TotalLiquidQuantityModel.cs" /> <Compile Include="Models\JobRunModel.cs" /> <Compile Include="Models\JobRunStatisticsModel.cs" /> <Compile Include="Models\LabeledSeriesCollection.cs" /> <Compile Include="Models\RmlModel.cs" /> + <Compile Include="Models\StatisticsValueCollection.cs" /> <Compile Include="Tooltips\PieChartTooltipControl.xaml.cs"> <DependentUpon>PieChartTooltipControl.xaml</DependentUpon> </Compile> @@ -169,6 +176,10 @@ <Project>{bc932dbd-7cdb-488c-99e4-f02cf441f55e}</Project> <Name>Tango.Logging</Name> </ProjectReference> + <ProjectReference Include="..\..\..\Tango.PMR\Tango.PMR.csproj"> + <Project>{e4927038-348d-4295-aaf4-861c58cb3943}</Project> + <Name>Tango.PMR</Name> + </ProjectReference> <ProjectReference Include="..\..\..\Tango.Serialization\Tango.Serialization.csproj"> <Project>{22f87980-e990-4686-be81-be63d562c4d5}</Project> <Name>Tango.Serialization</Name> diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Statistics/ViewModels/ChartsViewVM.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Statistics/ViewModels/ChartsViewVM.cs index b06261306..38c1cc24a 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Statistics/ViewModels/ChartsViewVM.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Statistics/ViewModels/ChartsViewVM.cs @@ -12,13 +12,14 @@ using Tango.SharedUI; using Tango.BL; using Tango.MachineStudio.Common.Notifications; using System.Threading.Tasks; +using Tango.Core.Commands; namespace Tango.MachineStudio.Statistics.ViewModels { public class ChartsViewVM : ViewModel { private INotificationProvider _notification; - private ObservablesContext _context; + //private ObservablesContext _context; private List<JobRunStatisticsModel> _job_runs; private bool _loaded; @@ -48,14 +49,14 @@ namespace Tango.MachineStudio.Statistics.ViewModels public DateTime StartDate { get { return _startDate; } - set { _startDate = value; RaisePropertyChangedAuto(); OnDateRangeChanged(); } + set { _startDate = value; RaisePropertyChangedAuto();} } private DateTime _endDate; public DateTime EndDate { get { return _endDate; } - set { _endDate = value; RaisePropertyChangedAuto(); OnDateRangeChanged(); } + set { _endDate = value; RaisePropertyChangedAuto();} } private DateTime _minDate; @@ -71,6 +72,8 @@ namespace Tango.MachineStudio.Statistics.ViewModels get { return _maxDate; } set { _maxDate = value; RaisePropertyChangedAuto(); } } + + public RelayCommand LoadJobRunsCommand { get; set; } #endregion public ChartsViewVM(INotificationProvider notificationProvider) @@ -78,45 +81,93 @@ namespace Tango.MachineStudio.Statistics.ViewModels _notification = notificationProvider; StartDate = DateTime.Now.AddMonths(-1); EndDate = DateTime.Now; + LoadJobRunsCommand = new RelayCommand(async () => await LoadJobRuns(), () => IsFree); } #region Generate Charts - public async void Init() + //public async void Init() + //{ + //using (_notification.PushTaskItem("Loading statistics...")) + //{ + // IsFree = false; + + // await Task.Factory.StartNew(() => + // { + // _context = ObservablesContext.CreateDefault(); + // //_job_runs = _context.JobRuns.OrderBy(x => x.StartDate).ToList().Select(x => new JobRunStatisticsModel(x)).ToList(); + // //foreach (var run in _job_runs) + // //{ + // // run.LoadMachine(_context).GetAwaiter().GetResult(); + // //} + // }); + + // if (_job_runs.Count > 0) + // { + // MinDate = _job_runs.Min(x => x.StartDate); + // MaxDate = _job_runs.Max(x => x.StartDate); + // } + + // InvokeUIOnIdle(() => + // { + // if (_loaded) + // { + // OnDateRangeChanged(); + // } + // }); + + // _loaded = true; + // IsFree = true; + //} + //} + private async Task LoadJobRuns() { using (_notification.PushTaskItem("Loading statistics...")) { - IsFree = false; - - await Task.Factory.StartNew(() => + try { - _context = ObservablesContext.CreateDefault(); - _job_runs = _context.JobRuns.OrderBy(x => x.StartDate).ToList().Select(x => new JobRunStatisticsModel(x)).ToList(); - foreach (var run in _job_runs) + IsFree = false; + + await Task.Factory.StartNew(() => + { + using (var db = ObservablesContext.CreateDefault()) + { + _job_runs = db.JobRuns.OrderBy(x => x.StartDate).ToList().Select(x => new JobRunStatisticsModel(x)).ToList(); + foreach (var run in _job_runs) + { + run.LoadMachine(db).GetAwaiter().GetResult(); + } + + } + }); + if (_job_runs.Count > 0) { - run.LoadMachine(_context).GetAwaiter().GetResult(); + MinDate = _job_runs.Min(x => x.StartDate); + MaxDate = _job_runs.Max(x => x.StartDate); } - }); - if (_job_runs.Count > 0) + InvokeUIOnIdle(() => + { + if (_loaded) + { + OnDateRangeChanged(); + } + }); + + _loaded = true; + } + catch (Exception ex) { - MinDate = _job_runs.Min(x => x.StartDate); - MaxDate = _job_runs.Max(x => x.StartDate); + LogManager.Log(ex, "Error loading statistics."); } - - InvokeUIOnIdle(() => + finally { - if (_loaded) - { - OnDateRangeChanged(); - } - }); - - _loaded = true; - IsFree = true; + IsFree = true; + } } } + private List<JobRunStatisticsModel> GetJobRunsByDateRange(DateTime startDate, DateTime endTime, JobRunStatus? status = null) { return _job_runs.Where(x => x.StartDate.ToLocalTime() >= startDate && x.StartDate.ToLocalTime() <= endTime && (status == null || x.JobRunStatus == status)).ToList(); diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Statistics/ViewModels/JobRunsViewVM.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Statistics/ViewModels/JobRunsViewVM.cs index a51d18909..800346ff9 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Statistics/ViewModels/JobRunsViewVM.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Statistics/ViewModels/JobRunsViewVM.cs @@ -16,6 +16,11 @@ using Tango.MachineStudio.Statistics.Models; using Tango.SharedUI; using Tango.SharedUI.Components; using Tango.AutoComplete.Editors; +using System.Windows.Media; +using LiveCharts.Wpf; +using LiveCharts; +using Tango.BL.ValueObjects; +using System.Diagnostics; namespace Tango.MachineStudio.Statistics.ViewModels { @@ -77,7 +82,8 @@ namespace Tango.MachineStudio.Statistics.ViewModels public DateTime StartSelectedDate { get { return _startSelectedDate; } - set { _startSelectedDate = value; RaisePropertyChangedAuto(); } + set { _startSelectedDate = value; + RaisePropertyChangedAuto(); } } private DateTime _endSelectedDate; @@ -173,7 +179,7 @@ namespace Tango.MachineStudio.Statistics.ViewModels private Job _selectedJob; /// <summary> - /// Gets or sets the job. Used as Sele + /// Gets or sets the job. /// </summary> public Job SelectedJob { @@ -185,6 +191,11 @@ namespace Tango.MachineStudio.Statistics.ViewModels } } + /// <summary> + /// Gets or sets the statistics value collection. Class - container included calculated statistic values. + /// </summary> + public StatisticsValueCollection StatisticsValueCollection { get; set; } + #endregion public RelayCommand LoadJobRunsCommand { get; set; } @@ -247,7 +258,7 @@ namespace Tango.MachineStudio.Statistics.ViewModels { using (ObservablesContext db = ObservablesContext.CreateDefault()) { - return db.Jobs.Where(x => x.Name!= null && x.Name.ToLower().Contains(filter.ToLower())).ToList(); + return db.Jobs.Where(x => x.Name != null && x.Name.ToLower().Contains(filter.ToLower())).ToList(); } } else @@ -262,6 +273,7 @@ namespace Tango.MachineStudio.Statistics.ViewModels } }); + StatisticsValueCollection = new StatisticsValueCollection(); } /// <summary> @@ -308,33 +320,118 @@ namespace Tango.MachineStudio.Statistics.ViewModels using (var db = ObservablesContext.CreateDefault()) { - DateTime startUtc = StartSelectedDate.ToUniversalTime(); + DateTime startUtc = new DateTime(StartSelectedDate.Year, StartSelectedDate.Month, StartSelectedDate.Day, 0, 0, 0).ToUniversalTime(); TimeSpan offsetTime = (EndSelectedDate.Date == DateTime.Now.Date) ? DateTime.Now.TimeOfDay : new TimeSpan(23, 59, 59); DateTime endUtc = EndSelectedDate.ToUniversalTime() + offsetTime; - string jobName = SelectedJob == null ? "" : SelectedJob.Name; - var runs = await new JobRunsCollectionBuilder(db).Set(x => x.StartDate <= DbFunctions.TruncateTime(endUtc) && x.StartDate >= DbFunctions.TruncateTime(startUtc.Date)) - .WithMachines(SelectedMachines.SynchedSource.ToList()) - .WithJobSource(JobRunSelectedSources.SynchedSource) - .WithJobStatus(JobRunSelectedStatuses.SynchedSource) - .WithGradient(IsGradientSelection.SynchedSource) - .WithRmls(SelectedThreads.SynchedSource.Select(x => x.Guid).ToList()) - .Query(y => y.Where(x => ( String.IsNullOrEmpty(jobName) || x.JobName.ToLower().StartsWith(jobName.ToLower())) - && (x.JobLength < LengthUpperValue && x.JobLength >= LengthLowerValue))) - .BuildListAsync(); + string jobName = SelectedJob == null ? "" : SelectedJob.Name; + var db_JobRuns = db.JobRuns.Where(x => (x.StartDate <= endUtc && x.StartDate >= startUtc)) + .Select(x => new + { + x.ID, + x.ActualStartDate, + x.EndDate, + x.EndPosition, + x.GradientResolutionCm, + x.Guid, + x.HeatingStartDate, + x.IsGradient, + x.JobGuid, + x.JobLength, + x.JobName, + x.JobSource, + x.MachineGuid, + x.RmlGuid, + x.StartDate, + x.Status, + x.UploadingStartDate, + x.UserGuid, + x.CyanQuantity, + x.MagentaQuantity, + x.YellowQuantity, + x.BlackQuantity, + x.TransparentQuantity, + x.LubricantQuantity, + x.CleanerQuantity + }); + var machineIDs = new HashSet<string>(SelectedMachines.SynchedSource.ToList().Select(p => p.Guid)); + if (machineIDs.Count > 0) + { + db_JobRuns = db_JobRuns.Where(x => machineIDs.Contains(x.MachineGuid)); + } + int[] jobRunSourceArr = JobRunSelectedSources.SynchedSource.Select(x => (int)x).ToArray(); + if (jobRunSourceArr.Length > 0) + { + db_JobRuns = db_JobRuns.Where(x => jobRunSourceArr.Contains(x.JobSource)); + } + int[] jobRunStatusArr = JobRunSelectedStatuses.SynchedSource.Select(x => (int)x).ToArray(); + if (jobRunStatusArr.Length > 0) + { + db_JobRuns = db_JobRuns.Where(x => jobRunStatusArr.Contains(x.Status)); + } + bool[] isGradientArr = IsGradientSelection.SynchedSource.Select(x => (bool)x).ToArray(); + if (isGradientArr.Length > 0) + { + db_JobRuns = db_JobRuns.Where(x => isGradientArr.Contains(x.IsGradient)); + } + List<String> rmlGuids = SelectedThreads.SynchedSource.Select(y => y.Guid).ToList(); + if (rmlGuids != null && rmlGuids.Count > 0) + { + db_JobRuns = db_JobRuns.Where(x => rmlGuids.Contains(x.RmlGuid)); + } + if (!String.IsNullOrEmpty(jobName)) + { + db_JobRuns = db_JobRuns.Where(x => x.JobName.ToLower().StartsWith(jobName.ToLower())); + } + + var runs_db = await db_JobRuns.ToListAsync(); //Execute actual query. + + List<JobRun> runs = runs_db.Where(x => (x.JobLength < LengthUpperValue && x.JobLength >= LengthLowerValue)) + .Select(x => new JobRun() + { + ID = x.ID, + ActualStartDate = x.ActualStartDate, + EndDate = x.EndDate, + EndPosition = x.EndPosition, + GradientResolutionCm = x.GradientResolutionCm, + Guid = x.Guid, + HeatingStartDate = x.HeatingStartDate, + IsGradient = x.IsGradient, + JobGuid = x.JobGuid, + JobLength = x.JobLength, + JobName = x.JobName, + JobSource = x.JobSource, + MachineGuid = x.MachineGuid, + RmlGuid = x.RmlGuid, + StartDate = x.StartDate, + Status = x.Status, + UploadingStartDate = x.UploadingStartDate, + UserGuid = x.UserGuid, + CyanQuantity = x.CyanQuantity, + MagentaQuantity = x.MagentaQuantity, + YellowQuantity = x.YellowQuantity, + BlackQuantity = x.BlackQuantity, + TransparentQuantity = x.TransparentQuantity, + LubricantQuantity = x.LubricantQuantity, + CleanerQuantity = x.CleanerQuantity + }).ToList(); + var modelList = runs.Select(x => new JobRunModel() { JobRun = x, Machine = _allMachines.FirstOrDefault(y => y.Guid == x.MachineGuid), User = _allUsers.SingleOrDefault(y => y.Guid == x.UserGuid), - Rml = _rmlsModels.SingleOrDefault(y => y.Guid == x.RmlGuid) + Rml = _rmlsModels.SingleOrDefault(y => y.Guid == x.RmlGuid), }).OrderByDescending(x => x.JobRun.StartDate).ToList(); modelList.ForEach(x => x.Init()); JobRuns = modelList.ToObservableCollection(); + GenerateStatistics(); } + + } catch (Exception ex) { @@ -347,5 +444,161 @@ namespace Tango.MachineStudio.Statistics.ViewModels } } + #region GenerateS_StatisticsValueCollection + + /// <summary> + /// Generates the statistics. + /// </summary> + protected void GenerateStatistics() + { + StatisticsValueCollection.Clean(); + if (JobRuns.Count() == 0) + return; + GenerateTotalRunsCount(); + GenerateTotalRunsLength(); + GenerateTotalThreadConsumption(); + GenerateRunsDuration(); + GenerateAverageUploadDuration(); + GenerateAverageHeatingDuration(); + + GeneratePieCharts(); + CreateThreadConsumptionPerThread(); + GenerateAllLiquidQuantities(); + } + + protected void GenerateTotalRunsCount() + {//Total Runs: + int val = JobRuns.Count(); + StatisticsValueCollection.AddStatisticsValue("Total Runs ", val, " "); + } + + /// <summary> + /// Generates the total length of the job runs. + /// </summary> + protected void GenerateTotalRunsLength() + { + double val = JobRuns.Where(z => z.JobRun.EndPosition > 0).Sum(x => x.JobRun.JobLength); + StatisticsValueCollection.AddStatisticsValue("Total Runs Length", val, " m"); + } + + /// <summary> + /// Generates the duration and average of the job runs. + /// </summary> + protected void GenerateRunsDuration() + { + var selection = JobRuns.Where(z => z.JobRun.EndPosition > 0 && z.JobRun.EndDate != null && z.JobRun.ActualStartDate != null); + double val = 0d; + double average = 0d; + if (selection != null && selection.Count<JobRunModel>() > 0) + { + val = selection.Sum(x => (x.JobRun.EndDate - x.JobRun.ActualStartDate).Value.TotalHours); + average = selection.Average(x => (x.JobRun.EndDate - x.JobRun.ActualStartDate).Value.TotalMilliseconds); + } + StatisticsValueCollection.AddStatisticsValue("Total Dyeing Time", val, " hours"); + StatisticsValueCollection.AddStatisticsValue("Total Dyeing Time", Math.Max(TimeSpan.FromMilliseconds(average).TotalHours, 0), " hours"); + } + + /// <summary> + /// Generates the average upload duration of the job runs. + /// </summary> + protected void GenerateAverageUploadDuration() + { + var average = (long)JobRuns.Where(z => z.JobRun.EndPosition > 0 && z.UploadDuration != null).Average(x => x.UploadDuration.Value.TotalMilliseconds); + StatisticsValueCollection.AddStatisticsValue("Average Upload Duration", Math.Max(TimeSpan.FromMilliseconds(average).TotalMinutes, 0), " minutes"); + } + + /// <summary> + /// Generates the average duration heating of the job runs. + /// </summary> + protected void GenerateAverageHeatingDuration() + { + var average = JobRuns.Where(z => z.JobRun.EndPosition > 0 && z.HeatingDuration != null && z.HeatingDuration.Value.Ticks > 0).Average(x => x.HeatingDuration.Value.TotalMilliseconds); + StatisticsValueCollection.AddStatisticsValue("Average Heating Duration", Math.Max(TimeSpan.FromMilliseconds(average).TotalMinutes, 0), " minutes"); + } + + /// <summary> + /// Generates the total thread consumption by EndPosition. + /// </summary> + protected void GenerateTotalThreadConsumption() + { + double val = JobRuns.Where(z => z.JobRun.EndPosition > 0).Sum(x => x.JobRun.EndPosition); + StatisticsValueCollection.AddStatisticsValue("Total Dyeing Length", val, " m"); + } + + /// <summary> + /// Generates the pie charts in percentage: JobSource, JobRunStatus, Gradient. + /// </summary> + protected void GeneratePieCharts() + { + int PPCCount = JobRuns.Count(x => x.JobRun.Source == JobSource.Local); + int MSCount = JobRuns.Count(x => x.JobRun.Source == JobSource.Remote); + StatisticsValueCollection.GeneratePieJobSource(PPCCount, MSCount); + + int failedCount = JobRuns.Count(x => x.JobRun.JobRunStatus == JobRunStatus.Failed); + int abortedCount = JobRuns.Count(x => x.JobRun.JobRunStatus == JobRunStatus.Aborted); + int completedCount = JobRuns.Count(x => x.JobRun.JobRunStatus == JobRunStatus.Completed); + StatisticsValueCollection.GeneratePieJobRunStatus(failedCount, abortedCount, completedCount); + + int gradientCount = JobRuns.Count(x => x.JobRun.IsGradient == true); + int solidCount = JobRuns.Count(x => x.JobRun.IsGradient == false); + StatisticsValueCollection.GeneratePieGradientSolid(gradientCount, solidCount); + + } + + /// <summary> + /// Creates the thread consumption per thread. + /// </summary> + protected void CreateThreadConsumptionPerThread() + { + var temp = JobRuns.Where(z => z.JobRun.EndPosition > 0 && z.Rml != null).GroupBy(x => x.Rml.Name); + List<StatisticsValue> result = JobRuns.Where(z => z.JobRun.EndPosition > 0 && z.Rml != null && !String.IsNullOrEmpty(z.Rml.Name)).GroupBy(x => x.Rml.Name).Select(y => new StatisticsValue { Name = y.Key, Value = y.Sum(x => x.JobRun.EndPosition), Unit = "m" }).ToList(); + StatisticsValueCollection.CreateThreadConsumptionPerThread(result); + } + + /// <summary> + /// Generates all liquid quantities. + /// </summary> + protected void GenerateAllLiquidQuantities() + { + var runs = JobRuns.Where(z => z.JobRun.EndPosition > 0 && z.JobRun.LiquidQuantitiesFast.Count > 0).ToList(); + + Dictionary<LiquidTypes, ulong> total_quantities = new Dictionary<LiquidTypes, ulong>(); + + foreach (LiquidTypes ltype in (LiquidTypes[])Enum.GetValues(typeof(LiquidTypes))) + { + total_quantities[ltype] = 0; + } + + foreach (var run in runs) + { + foreach (var lq in run.JobRun.LiquidQuantitiesFast) + { + if (lq.Quantity < 0) + { + Debug.WriteLine($"Warning: JobRun '{run.JobRun.ID}' contains an invalid value '{lq.Quantity}' for {lq.LiquidType} quantity."); + } + + total_quantities[lq.LiquidType] += Convert.ToUInt64(Math.Max(lq.Quantity, 0)); + } + } + + List<TotalLiquidQuantityModel> allLiquidQuantities = total_quantities.Select(x => new TotalLiquidQuantityModel() + { + LiquidType = x.Key, + Quantity = x.Value + }).ToList(); + + + //foreach (LiquidTypes ltype in (LiquidTypes[])Enum.GetValues(typeof(LiquidTypes))) + //{ + // var liquidQuantityByTypeList = db_liquidQuantities.Select(x => x.FirstOrDefault(y => y.LiquidType == ltype)).Where(x => x != null); + // var count = liquidQuantityByTypeList != null ? liquidQuantityByTypeList.Sum(x => x.Quantity) : 0; + // JobRunLiquidQuantity lq = new JobRunLiquidQuantity() { LiquidType = ltype, Quantity = count }; + // allLiquidQuantities.Add(lq); + //} + StatisticsValueCollection.GenerateStatisticsLiquidQuantity(allLiquidQuantities); + } + #endregion + } } diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Statistics/ViewModels/MainViewVM.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Statistics/ViewModels/MainViewVM.cs index 4a75a41c8..e7e2013c5 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Statistics/ViewModels/MainViewVM.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Statistics/ViewModels/MainViewVM.cs @@ -50,7 +50,6 @@ namespace Tango.MachineStudio.Statistics.ViewModels public override void OnNavigatedTo() { base.OnNavigatedTo(); - ChartsViewVM.Init(); } } } diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Statistics/Views/ChartsView.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Statistics/Views/ChartsView.xaml index ecd7e01ed..ae4bf1d46 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Statistics/Views/ChartsView.xaml +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Statistics/Views/ChartsView.xaml @@ -17,23 +17,26 @@ <RowDefinition Height="337*"/> </Grid.RowDefinitions> - <StackPanel Margin="60 20 0 0" VerticalAlignment="Center" HorizontalAlignment="Left" Orientation="Horizontal"> - <StackPanel> - <TextBlock FontSize="10">Start Date:</TextBlock> - <DatePicker DisplayDateStart="{Binding MinDate}" DisplayDateEnd="{Binding MaxDate}" SelectedDate="{Binding StartDate}" materialDesign:HintAssist.Hint="Pick start date" Width="200" VerticalAlignment="Bottom" FontSize="16"></DatePicker> - </StackPanel> + + <StackPanel Margin="60 20 0 0" VerticalAlignment="Center" HorizontalAlignment="Left" Orientation="Horizontal" DockPanel.Dock="Left"> + <StackPanel> + <TextBlock FontSize="10">Start Date:</TextBlock> + <DatePicker DisplayDateStart="{Binding MinDate}" DisplayDateEnd="{Binding MaxDate}" SelectedDate="{Binding StartDate}" materialDesign:HintAssist.Hint="Pick start date" Width="200" VerticalAlignment="Bottom" FontSize="16"></DatePicker> + </StackPanel> - <StackPanel Margin="40 0 0 0"> - <TextBlock FontSize="10">End Date:</TextBlock> - <DatePicker DisplayDateStart="{Binding MinDate}" DisplayDateEnd="{Binding MaxDate}" SelectedDate="{Binding EndDate}" materialDesign:HintAssist.Hint="Pick end date" Width="200" VerticalAlignment="Bottom" FontSize="16"></DatePicker> - </StackPanel> + <StackPanel Margin="40 0 0 0"> + <TextBlock FontSize="10">End Date:</TextBlock> + <DatePicker DisplayDateStart="{Binding MinDate}" DisplayDateEnd="{Binding MaxDate}" SelectedDate="{Binding EndDate}" materialDesign:HintAssist.Hint="Pick end date" Width="200" VerticalAlignment="Bottom" FontSize="16"></DatePicker> + </StackPanel> + <Button Width="100" Margin="60 0 0 0" Command="{Binding LoadJobRunsCommand}" VerticalAlignment="Bottom" HorizontalAlignment="Right">LOAD</Button> </StackPanel> + <UniformGrid Columns="3" Margin="50 20 50 50" Rows="2" Grid.Row="1"> <Border BorderBrush="{StaticResource Statistics.BorderBrush}" Padding="5" BorderThickness="1" CornerRadius="5" Margin="10"> <DockPanel> <TextBlock DockPanel.Dock="Top" FontSize="16" FontWeight="Bold" HorizontalAlignment="Center" Padding="10" Text="{Binding TimelineJobStatusSeries.Title}"></TextBlock> - <lvc:CartesianChart Series="{Binding TimelineJobStatusSeries.SeriesCollection}" LegendLocation="Bottom" SeriesColors="{Binding TimelineJobStatusSeries.SeriesColors}"> + <lvc:CartesianChart Series="{Binding TimelineJobStatusSeries.SeriesCollection}" LegendLocation="Bottom"> <lvc:CartesianChart.DataTooltip> <lvc:DefaultTooltip BulletSize="20" Background="{StaticResource TransparentBackgroundBrush450}" Foreground="{StaticResource Dialog.Foreground}"/> </lvc:CartesianChart.DataTooltip> @@ -59,7 +62,7 @@ <DockPanel> <TextBlock DockPanel.Dock="Top" FontSize="16" FontWeight="Bold" HorizontalAlignment="Center" Padding="10" Text="{Binding PieJobFailedReasons.Title}"></TextBlock> <UniformGrid Columns="2"> - <lvc:PieChart DataHover="PieChart_DataHover" Series="{Binding PieJobFailedReasons.SeriesCollection}" LegendLocation="None" SeriesColors="{Binding PieJobFailedReasons.SeriesColors}" Background="Transparent"> + <lvc:PieChart DataHover="PieChart_DataHover" Series="{Binding PieJobFailedReasons.SeriesCollection}" LegendLocation="None" Background="Transparent"> <lvc:PieChart.Resources> <Style TargetType="lvc:PieSeries"> <Setter Property="Stroke" Value="#99F9F9F9"></Setter> @@ -79,7 +82,7 @@ <Border BorderBrush="{StaticResource Statistics.BorderBrush}" Padding="5" BorderThickness="1" CornerRadius="5" Margin="10"> <DockPanel> <TextBlock DockPanel.Dock="Top" FontSize="16" FontWeight="Bold" HorizontalAlignment="Center" Padding="10" Text="{Binding PrintPerWeekSeries.Title}"></TextBlock> - <lvc:CartesianChart Series="{Binding PrintPerWeekSeries.SeriesCollection}" LegendLocation="Bottom" SeriesColors="{Binding PrintPerWeekSeries.SeriesColors}" > + <lvc:CartesianChart Series="{Binding PrintPerWeekSeries.SeriesCollection}" LegendLocation="Bottom" > <lvc:CartesianChart.Resources> <Style TargetType="lvc:ColumnSeries"> <Setter Property="Foreground" Value="{StaticResource DarkGrayBrush200}"></Setter> diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Statistics/Views/JobRunsView.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Statistics/Views/JobRunsView.xaml index 71e44465a..6431d72fb 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Statistics/Views/JobRunsView.xaml +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Statistics/Views/JobRunsView.xaml @@ -8,9 +8,13 @@ xmlns:localConverters="clr-namespace:Tango.MachineStudio.Statistics.Converters" xmlns:mahapps="http://metro.mahapps.com/winfx/xaml/controls" xmlns:autoComplete="clr-namespace:Tango.AutoComplete.Editors;assembly=Tango.AutoComplete" + xmlns:lvc="clr-namespace:LiveCharts.Wpf;assembly=LiveCharts.Wpf" + xmlns:tooltips="clr-namespace:Tango.MachineStudio.Statistics.Tooltips" xmlns:sys="clr-namespace:System;assembly=mscorlib" xmlns:enumerations="clr-namespace:Tango.BL.Enumerations;assembly=Tango.BL" xmlns:local="clr-namespace:Tango.MachineStudio.Statistics.Views" + xmlns:model="clr-namespace:Tango.MachineStudio.Statistics.Models" + xmlns:wellknowntypes="clr-namespace:Google.Protobuf.WellKnownTypes;assembly=Google.Protobuf" mc:Ignorable="d" d:DesignHeight="450" d:DesignWidth="1800" Foreground="{StaticResource JobFieldForeground}"> <UserControl.Resources> @@ -24,6 +28,8 @@ <localConverters:CollectionConverter x:Key="CollectionConverter"/> <localConverters:StringToFirstLetterConverter x:Key="StringToFirstLetterConverter"/> <localConverters:MidTankLevelToElementHeightConverter x:Key="MidTankLevelToElementHeightConverter"/> + <localConverters:JobLengthConverter x:Key="JobLengthConverter"/> + <localConverters:NanoLiterToLiterFormatConverter x:Key="NanoLiterToLiterFormatConverter"/> <ResourceDictionary x:Key="SelectAllTextBoxResource"> <Style TargetType="TextBox"> @@ -36,6 +42,16 @@ <Setter Property="TextWrapping" Value="Wrap"/> </Style> + <Style TargetType="lvc:PieSeries"> + <Setter Property="Stroke" Value="#99F9F9F9"></Setter> + <Setter Property="StrokeThickness" Value="2"/> + <Setter Property="Foreground" Value="#FF1C1C1F" /> + </Style> + <Style TargetType="lvc:PieChart"> + <Setter Property="Background" Value="Transparent"/> + <Setter Property="LegendLocation" Value="None"/> + </Style> + <DataTemplate x:Key="PopUpDataTemplate"> <CheckBox VerticalAlignment="Center" FontSize="11" DockPanel.Dock="Left" IsChecked="{Binding IsSelected}"> <CheckBox.Content> @@ -68,34 +84,6 @@ </CheckBox> </DataTemplate> - <DataTemplate x:Key="LiquidQuantitiesTemplate"> - <DockPanel ToolTip="{Binding Quantity}" ToolTipService.Placement="Center" ToolTipService.VerticalOffset="10"> - <Grid DockPanel.Dock="Top" Height="40" Margin="8 10 0 0" Width="16"> - <Border x:Name="LiquidTypeBorder" BorderThickness="1" BorderBrush="{StaticResource borderBrush}" CornerRadius="2"> - <Canvas x:Name="LiquidCanvas" VerticalAlignment="Stretch" HorizontalAlignment="Stretch" Margin="0" ClipToBounds="True" ToolTip="{Binding Quantity}" ToolTipService.Placement="Left" ToolTipService.VerticalOffset="10"> - <Border Height="{Binding RelativeSource={RelativeSource AncestorType=Canvas}, Path=ActualHeight }" Width="{Binding RelativeSource={RelativeSource AncestorType=Canvas}, Path=ActualWidth }"> - <Border.Background> - <SolidColorBrush Color="{Binding LiquidType,Converter={StaticResource LiquidTypeToColorConverter}}" /> - </Border.Background> - <Border.Style> - <Style> - <Setter Property="Canvas.Top" > - <Setter.Value> - <MultiBinding Converter="{StaticResource MidTankLevelToElementHeightConverter}"> - <Binding RelativeSource="{RelativeSource Self}" Path="ActualHeight" /> - <Binding Path="Quantity" /> - </MultiBinding> - </Setter.Value> - </Setter> - </Style> - </Border.Style> - </Border> - </Canvas> - </Border> - </Grid> - <TextBlock DockPanel.Dock="Bottom" VerticalAlignment="Center" HorizontalAlignment="Center" Margin="0" Text="{Binding LiquidType,Converter={StaticResource StringToFirstLetterConverter}}" Foreground="Gray"/> - </DockPanel> - </DataTemplate> <Style x:Key="{x:Type ToolTip}" TargetType="{x:Type ToolTip}" BasedOn="{StaticResource MaterialDesignToolTip}"> <Setter Property="Background" Value="{StaticResource Logging.Background}" /> @@ -320,12 +308,12 @@ </TextBlock> </DockPanel> </Border> - <Popup AllowsTransparency="True" StaysOpen="False" IsOpen="{Binding RelativeSource={RelativeSource AncestorType=ToggleButton},Path=IsChecked }" > - <Border Padding="3" CornerRadius="0 0 3 3" MinWidth="{Binding RelativeSource={RelativeSource AncestorType=ToggleButton},Path=Width}" Margin="5" Background="#F6F6F6" BorderBrush="{StaticResource AutoCompleteTextBox.Popup.BorderBrush}" > + <Popup AllowsTransparency="True" StaysOpen="False" IsOpen="{Binding RelativeSource={RelativeSource AncestorType=ToggleButton},Path=IsChecked }"> + <Border Padding="3" CornerRadius="0 0 3 3" MinWidth="{Binding RelativeSource={RelativeSource AncestorType=ToggleButton},Path=Width}" Margin="5" BorderBrush="{StaticResource AutoCompleteTextBox.Popup.BorderBrush}" > <Border.Effect> <DropShadowEffect Opacity="0.2" /> </Border.Effect> - <ScrollViewer MaxHeight="600" Background="{DynamicResource ComboBox.Floating.Background}"> + <ScrollViewer MaxHeight="600" Background="#F6F6F6"> <ItemsControl ItemsSource="{Binding SelectedThreads}" Foreground="{StaticResource MainWindow.Foreground}" ItemTemplate="{StaticResource PopupThreadDataTemplate}"/> </ScrollViewer> @@ -338,7 +326,7 @@ </StackPanel> </StackPanel> </Grid> - <Button Grid.Column="1" HorizontalAlignment="Right" Command="{Binding LoadJobRunsCommand}" Margin="0 0 10 0" Padding="70 15" Height="Auto" VerticalAlignment="Center">RUN</Button> + <Button Grid.Column="1" HorizontalAlignment="Right" Command="{Binding LoadJobRunsCommand}" Margin="0 0 10 0" Padding="70 15" Height="Auto" VerticalAlignment="Center">ANALYZE</Button> </Grid> </Border> </Grid> @@ -436,18 +424,49 @@ <DataGridTextColumn Header="Thread" Binding="{Binding Rml.Name}" Width="80" ElementStyle="{StaticResource WrapText}"/> <DataGridTextColumn Header="Length" Binding="{Binding JobRun.JobLength, StringFormat={}{0:0.00}}" Width="60" /> <DataGridTextColumn Header="Source" Binding="{Binding JobRun.Source, Converter={StaticResource EnumToDescriptionConverter}}" Width="60" /> - <DataGridTextColumn Header="Upload Duration" Binding="{Binding UploadDuration, Converter={StaticResource DateTimeToStringFormatConverter}, FallbackValue='N/A',TargetNullValue='N/A'}" Width="90"/> - <DataGridTextColumn Header="Heating Duration" Binding="{Binding HeatingDuration, Converter={StaticResource DateTimeToStringFormatConverter}, FallbackValue='N/A',TargetNullValue='N/A'}" Width="90" /> + <DataGridTextColumn Header="Upload Duration" Binding="{Binding UploadDuration, Converter={StaticResource DateTimeToStringFormatConverter}, FallbackValue='N/A',TargetNullValue='N/A'}" Width="80"/> + <DataGridTextColumn Header="Heating Duration" Binding="{Binding HeatingDuration, Converter={StaticResource DateTimeToStringFormatConverter}, FallbackValue='N/A',TargetNullValue='N/A'}" Width="80" /> <DataGridTextColumn Header="Start Time" Binding="{Binding JobRun.ActualStartDate, Converter={StaticResource DateTimeUTCToShortDateTimeConverter}}" Width="95" /> <DataGridTextColumn Header="IsGradient" Binding="{Binding JobRun.IsGradient}" Width="70" /> <DataGridTextColumn Header="GR" Binding="{Binding JobRun.GradientResolutionCm}" Width="30" /> <DataGridTextColumn Header="Status" Binding="{Binding JobRun.JobRunStatus, Converter={StaticResource EnumToDescriptionConverter}}" Width="70"/> - <DataGridTextColumn Header="End Time" Binding="{Binding JobRun.EndDate, Converter={StaticResource DateTimeUTCToShortDateTimeConverter}}" Width="90" /> - <DataGridTextColumn Header="End Position" Binding="{Binding JobRun.EndPosition, StringFormat={}{0:0.00}}" Width="90" /> - <DataGridTemplateColumn Header="Liquid Quantities" Width="1*" > + <DataGridTextColumn Header="End Time" Binding="{Binding JobRun.EndDate, Converter={StaticResource DateTimeUTCToShortDateTimeConverter}}" Width="95" /> + <DataGridTextColumn Header="End Position" Binding="{Binding JobRun.EndPosition, StringFormat={}{0:0.00}}" Width="70" /> + <DataGridTemplateColumn Header="Liquid Quantities" Width="1*"> + <DataGridTemplateColumn.CellStyle> + <Style TargetType="DataGridCell" BasedOn="{StaticResource {x:Type DataGridCell}}"> + <Setter Property="BorderThickness" Value="0"/> + <Setter Property="FocusVisualStyle" Value="{x:Null}"/> + <Setter Property="VerticalContentAlignment" Value="Center"></Setter> + <Setter Property="VerticalAlignment" Value="Center"/> + <Setter Property="HorizontalAlignment" Value="Stretch"/> + <Setter Property="Margin" Value="0 0 10 0"/> + <Setter Property="Template"> + <Setter.Value> + <ControlTemplate TargetType="{x:Type DataGridCell}"> + <ContentPresenter VerticalAlignment="{TemplateBinding VerticalContentAlignment}"/> + </ControlTemplate> + </Setter.Value> + </Setter> + <Style.Triggers> + <Trigger Property="IsSelected" Value="True"> + <Setter Property="Background" Value="Transparent"></Setter> + <Setter Property="Foreground" Value="{StaticResource AccentColorBrush}" /> + </Trigger> + </Style.Triggers> + </Style> + </DataGridTemplateColumn.CellStyle> <DataGridTemplateColumn.CellTemplate> <DataTemplate> - <ItemsControl ItemsSource="{Binding JobRun.LiquidQuantities,Mode=OneWay}" Margin="0 0 0 0" Height="80" ItemTemplate="{StaticResource LiquidQuantitiesTemplate}"> + <Grid HorizontalAlignment="Stretch" VerticalAlignment="Stretch"> + <Grid.RowDefinitions> + <RowDefinition Height="1*"/> + <RowDefinition Height="20"/> + </Grid.RowDefinitions> + <Grid.ColumnDefinitions> + <ColumnDefinition Width="1*" MaxWidth="200"/> + </Grid.ColumnDefinitions> + <ItemsControl ItemsSource="{Binding JobRun.LiquidQuantitiesFast,Mode=OneWay}" Margin="0 0 0 0" Height="70"> <ItemsControl.ItemContainerStyle> <Style TargetType="ContentPresenter"> <Setter Property="Visibility" Value="Visible"></Setter> @@ -460,10 +479,53 @@ </ItemsControl.ItemContainerStyle> <ItemsControl.ItemsPanel> <ItemsPanelTemplate> - <UniformGrid Rows="1" IsItemsHost="True"></UniformGrid> + <StackPanel Orientation="Horizontal" IsItemsHost="True"></StackPanel> </ItemsPanelTemplate> </ItemsControl.ItemsPanel> - </ItemsControl> + <ItemsControl.ItemTemplate> + <DataTemplate> + <DockPanel ToolTip="{Binding Quantity}" ToolTipService.Placement="Center" ToolTipService.VerticalOffset="10"> + <Grid DockPanel.Dock="Top" Height="40" Margin="0 5 8 0" Width="16"> + <Border x:Name="LiquidTypeBorder" BorderThickness="1" BorderBrush="{StaticResource borderBrush}" CornerRadius="2"> + <Canvas x:Name="LiquidCanvas" VerticalAlignment="Stretch" HorizontalAlignment="Stretch" Margin="0" ClipToBounds="True" ToolTip="{Binding Quantity}" ToolTipService.Placement="Left" ToolTipService.VerticalOffset="10"> + <Border Height="{Binding RelativeSource={RelativeSource AncestorType=Canvas}, Path=ActualHeight }" Width="{Binding RelativeSource={RelativeSource AncestorType=Canvas}, Path=ActualWidth }"> + <Border.Background> + <SolidColorBrush Color="{Binding LiquidType,Converter={StaticResource LiquidTypeToColorConverter}}" /> + </Border.Background> + <Border.Style> + <Style> + <Setter Property="Canvas.Top" > + <Setter.Value> + <MultiBinding Converter="{StaticResource MidTankLevelToElementHeightConverter}"> + <Binding RelativeSource="{RelativeSource Self}" Path="ActualHeight" /> + <Binding Path="Quantity" /> + </MultiBinding> + </Setter.Value> + </Setter> + </Style> + </Border.Style> + </Border> + </Canvas> + </Border> + </Grid> + <TextBlock DockPanel.Dock="Bottom" FontSize="9" VerticalAlignment="Center" HorizontalAlignment="Center" Margin="0 0 10 0" Text="{Binding LiquidType,Converter={StaticResource StringToFirstLetterConverter}}" Foreground="Gray"/> + </DockPanel> + + </DataTemplate> + </ItemsControl.ItemTemplate> + </ItemsControl> + <Border Grid.Row="1" Grid.Column="0" Background="Transparent" HorizontalAlignment="Stretch" Height="8" BorderThickness="1" BorderBrush="{StaticResource borderBrush}"> + <Rectangle Margin="0 0 -1 0" Fill="{StaticResource AccentColorBrush}" HorizontalAlignment="Left" VerticalAlignment="Stretch" ToolTip="{Binding JobRun.EndPosition}"> + <Rectangle.Width> + <MultiBinding Converter="{StaticResource JobLengthConverter}"> + <Binding Path="JobRun.JobLength" /> + <Binding Path="JobRun.EndPosition"/> + <Binding Path="ActualWidth" RelativeSource="{RelativeSource AncestorType=Border}"/> + </MultiBinding> + </Rectangle.Width> + </Rectangle> + </Border> + </Grid> </DataTemplate> </DataGridTemplateColumn.CellTemplate> </DataGridTemplateColumn> @@ -475,11 +537,163 @@ <TextBlock Margin="10" Text="{Binding SelectedJobName}"></TextBlock> </StackPanel> </Border> - <Border Grid.Row="2" Margin="20, 10, 0, 20" BorderBrush="{StaticResource borderBrush}" Background="{StaticResource TransparentBackgroundBrush}" BorderThickness="1"> - <StackPanel Background="{StaticResource TransparentBackgroundBrush}" > - <TextBlock>TOTALS:</TextBlock> - <TextBlock>Cyan:</TextBlock> - </StackPanel> + <Border Grid.Row="2" Margin="20, 0, 0, 20" Height="200" BorderBrush="{StaticResource borderBrush}" Background="{StaticResource TransparentBackgroundBrush}" BorderThickness="1"> + <Grid > + <Grid.ColumnDefinitions> + <ColumnDefinition Width="*"/> + <ColumnDefinition Width="2"/> + <ColumnDefinition Width="*"/> + <ColumnDefinition Width="2"/> + <ColumnDefinition Width="*"/> + </Grid.ColumnDefinitions> + <Border Grid.Column="0" BorderBrush="{StaticResource borderBrush}" Padding="5" BorderThickness="1" CornerRadius="5" Margin="10"> + <StackPanel Orientation="Vertical" Margin="5"> + <ItemsControl ItemsSource="{Binding StatisticsValueCollection.StatisticsCollection}"> + <ItemsControl.ItemTemplate> + <DataTemplate> + <StackPanel Orientation="Horizontal" Margin="0 3"> + <TextBlock Text="{Binding Name}" FontWeight="SemiBold"/> + <TextBlock Text=": "/> + <TextBlock Text="{Binding Value, StringFormat={}{0:#,0.##}}"/> + <TextBlock Text="{Binding Unit}"/> + </StackPanel> + </DataTemplate> + </ItemsControl.ItemTemplate> + </ItemsControl> + <TextBlock Visibility="Collapsed" Margin="0 10 0 0" Text="Total Thread Consumption per thread:" FontWeight="SemiBold"> + <TextBlock.Style> + <Style TargetType="TextBlock"> + <Setter Property="Visibility" Value="Visible" /> + <Style.Triggers> + <DataTrigger Binding="{Binding StatisticsValueCollection.ThreadConsumptionPerThreadCollection.Count}" Value="0"> + <Setter Property="Visibility" Value="Collapsed" /> + </DataTrigger> + </Style.Triggers> + </Style> + </TextBlock.Style> + </TextBlock> + <ItemsControl Visibility="Collapsed" ItemsSource="{Binding StatisticsValueCollection.ThreadConsumptionPerThreadCollection}"> + <ItemsControl.ItemsPanel> + <ItemsPanelTemplate> + <UniformGrid Rows="3" /> + </ItemsPanelTemplate> + </ItemsControl.ItemsPanel> + <ItemsControl.Resources> + <DataTemplate DataType="{x:Type model:StatisticsValue}"> + <StackPanel Orientation="Horizontal"> + <TextBlock Text="{Binding Name}" FontWeight="SemiBold"/> + <TextBlock Text=": "/> + <TextBlock Text="{Binding Value, StringFormat={}{0:0.0}}"/> + <TextBlock Text="{Binding Unit}"/> + </StackPanel> + </DataTemplate> + <DataTemplate DataType="{x:Type model:MoreValue}"> + <Border BorderThickness="0"> + <TextBlock Text="{Binding Text}" Tag="{Binding Path=DataContext.StatisticsValueCollection.ThreadConsumptionPerThread, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type ItemsControl}}}" HorizontalAlignment="Left" VerticalAlignment="Center" > + <TextBlock.ToolTip > + <ToolTip DataContext="{Binding RelativeSource={RelativeSource Self},Path=PlacementTarget.Tag}" Placement="Right" Background="{StaticResource Logging.Background}"> + <Border CornerRadius="5"> + <ItemsControl ItemsSource="{Binding }"> + <ItemsControl.ItemTemplate> + <DataTemplate> + <StackPanel Orientation="Horizontal" Margin="2"> + <TextBlock Margin="5 0 0 0" Text="{Binding Name}" FontWeight="SemiBold"/> + <TextBlock Text=": "/> + <TextBlock Text="{Binding Value, StringFormat={}{0:0.0}}"/> + <TextBlock Text="{Binding Unit}"/> + </StackPanel> + </DataTemplate> + </ItemsControl.ItemTemplate> + </ItemsControl> + </Border> + </ToolTip> + </TextBlock.ToolTip> + </TextBlock> + </Border> + </DataTemplate> + </ItemsControl.Resources> + </ItemsControl> + </StackPanel> + </Border> + <Border Grid.Column="1" HorizontalAlignment="Center" VerticalAlignment="Stretch" Width="2" Background="{StaticResource borderBrush}" Margin="0 4" Visibility="Visible"></Border> + <Border Grid.Column="2" BorderBrush="{StaticResource borderBrush}" Padding="5" BorderThickness="1" CornerRadius="5" Margin="10"> + <DockPanel> + <UniformGrid Columns="3"> + <DockPanel> + <TextBlock DockPanel.Dock="Top" FontSize="12" FontWeight="Bold" HorizontalAlignment="Center" Padding="2" Text="PPC/MS"></TextBlock> + <lvc:PieChart Series="{Binding StatisticsValueCollection.PieJobSource.SeriesCollection}" > + <lvc:PieChart.DataTooltip> + <tooltips:PieChartTooltipControl Visibility="Visible" /> + </lvc:PieChart.DataTooltip> + </lvc:PieChart> + </DockPanel> + <DockPanel> + <TextBlock DockPanel.Dock="Top" FontSize="12" FontWeight="Bold" HorizontalAlignment="Center" Padding="2" Text="Failed/Aborted/Completed"></TextBlock> + <lvc:PieChart Series="{Binding StatisticsValueCollection.PieJobRunStatus.SeriesCollection}"> + <lvc:PieChart.DataTooltip> + <tooltips:PieChartTooltipControl Visibility="Visible" /> + </lvc:PieChart.DataTooltip> + </lvc:PieChart> + </DockPanel> + <DockPanel> + <TextBlock DockPanel.Dock="Top" FontSize="12" FontWeight="Bold" HorizontalAlignment="Center" Padding="2" Text="Gradient/Solid"></TextBlock> + <lvc:PieChart Series="{Binding StatisticsValueCollection.PieGradientSolid.SeriesCollection}" > + <lvc:PieChart.DataTooltip> + <tooltips:PieChartTooltipControl Visibility="Visible" /> + </lvc:PieChart.DataTooltip> + </lvc:PieChart> + </DockPanel> + </UniformGrid> + </DockPanel> + </Border> + + <Border Grid.Column="3" HorizontalAlignment="Center" VerticalAlignment="Stretch" Width="2" Background="{StaticResource borderBrush}" Margin="0 6" CornerRadius="1"/> + + <Border Grid.Column="4" BorderBrush="{StaticResource borderBrush}" Padding="5" BorderThickness="1" CornerRadius="5" Margin="10"> + <DockPanel> + <ItemsControl DockPanel.Dock="Top" ItemsSource="{Binding StatisticsValueCollection.LiquidQuantities}"> + <ItemsControl.ItemsPanel> + <ItemsPanelTemplate> + <UniformGrid Columns="3"/> + </ItemsPanelTemplate> + </ItemsControl.ItemsPanel> + <ItemsControl.ItemTemplate> + <DataTemplate> + <StackPanel Orientation="Horizontal" Margin="4"> + <Ellipse Width="30" Height="30"> + <Ellipse.Fill> + <SolidColorBrush Color="{Binding LiquidType,Converter={StaticResource LiquidTypeToColorConverter}}" /> + </Ellipse.Fill> + </Ellipse> + <StackPanel Orientation="Vertical" Margin="4"> + <TextBlock Text="{Binding LiquidType,Converter={StaticResource EnumToDescriptionConverter}}" FontWeight="SemiBold"></TextBlock> + <TextBlock > + <Run Text="{Binding Quantity, Converter={StaticResource NanoLiterToLiterFormatConverter}}"></Run> + <Run Text=" liters"></Run> + </TextBlock> + </StackPanel> + </StackPanel> + </DataTemplate> + </ItemsControl.ItemTemplate> + </ItemsControl> + <TextBlock DockPanel.Dock="Bottom" Margin="4 10 0 0 "> + <Run Text="Total liquid quantities for all: " FontWeight="SemiBold"/> + <Run Text="{Binding StatisticsValueCollection.TotalLiquidQuantities, Converter={StaticResource NanoLiterToLiterFormatConverter}}"></Run> + <Run Text=" liters"></Run> + <TextBlock.Style> + <Style TargetType="TextBlock"> + <Setter Property="Visibility" Value="Visible" /> + <Style.Triggers> + <DataTrigger Binding="{Binding StatisticsValueCollection.LiquidQuantities.Count}" Value="0"> + <Setter Property="Visibility" Value="Collapsed" /> + </DataTrigger> + </Style.Triggers> + </Style> + </TextBlock.Style> + </TextBlock> + </DockPanel> + </Border> + </Grid> </Border> </Grid> </UserControl> diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Statistics/Views/JobRunsView.xaml.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Statistics/Views/JobRunsView.xaml.cs index c460e2a9b..2b3ed79ca 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Statistics/Views/JobRunsView.xaml.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Statistics/Views/JobRunsView.xaml.cs @@ -1,4 +1,6 @@ -using System; +using LiveCharts; +using LiveCharts.Wpf; +using System; using System.Collections.Generic; using System.Linq; using System.Text; @@ -79,5 +81,6 @@ namespace Tango.MachineStudio.Statistics.Views } } } + } } diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Statistics/Views/MainView.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Statistics/Views/MainView.xaml index 170d3276a..21c099db9 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Statistics/Views/MainView.xaml +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Statistics/Views/MainView.xaml @@ -26,12 +26,12 @@ <Setter Property="Padding" Value="20,2"></Setter> </Style> </TabControl.Resources> - <TabItem Header="STATS" Margin="-100 0 0 0 "> - <local:ChartsView x:Name="processParametersView" DataContext="{Binding ChartsViewVM}"/> - </TabItem> <TabItem Header="JOB RUNS" Margin="-100 0 0 0 "> <local:JobRunsView x:Name="jobRunsView" DataContext="{Binding JobRunsViewVM}"/> </TabItem> + <TabItem Header="STATS" Margin="-100 0 0 0 "> + <local:ChartsView x:Name="processParametersView" DataContext="{Binding ChartsViewVM}"/> + </TabItem> </TabControl> </Grid> </Grid> diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Statistics/packages.config b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Statistics/packages.config index 31c5f029f..6938c8a4b 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Statistics/packages.config +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Statistics/packages.config @@ -1,6 +1,7 @@ <?xml version="1.0" encoding="utf-8"?> <packages> <package id="EntityFramework" version="6.2.0" targetFramework="net461" /> + <package id="Google.Protobuf" version="3.4.1" targetFramework="net461" /> <package id="LiveCharts" version="0.9.7" targetFramework="net461" /> <package id="LiveCharts.Wpf" version="0.9.7" targetFramework="net461" /> <package id="MahApps.Metro" version="1.5.0" targetFramework="net461" /> |
