aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRoy Ben-Shabat <Roy@Twine-s.com>2018-07-11 20:05:13 +0300
committerRoy Ben-Shabat <Roy@Twine-s.com>2018-07-11 20:05:13 +0300
commit14cd4ba2174c3e0bd74f58f2cc72769fd326a6e6 (patch)
tree78901a0b5053610ce2f86b436a037f17715d6368
parent009a02d57e244e9a8ed5d70fc0743f10f68f5a33 (diff)
downloadTango-14cd4ba2174c3e0bd74f58f2cc72769fd326a6e6.tar.gz
Tango-14cd4ba2174c3e0bd74f58f2cc72769fd326a6e6.zip
Working on PPC.
-rw-r--r--Software/DB/Tango.mdfbin75497472 -> 75497472 bytes
-rw-r--r--Software/DB/Tango_log.ldfbin1572864 -> 1572864 bytes
-rw-r--r--Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Controls/JobSummeryViewer.xaml9
-rw-r--r--Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Controls/JobSummeryViewer.xaml.cs8
-rw-r--r--Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/ViewModels/JobSummeryViewVM.cs2
-rw-r--r--Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/ViewModels/JobViewVM.cs41
-rw-r--r--Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/ViewModels/JobsViewVM.cs3
-rw-r--r--Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Views/JobProgressView.xaml17
-rw-r--r--Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Views/JobSummeryView.xaml2
-rw-r--r--Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Views/JobView.xaml68
-rw-r--r--Software/Visual_Studio/PPC/Tango.PPC.Common/Navigation/INavigationBlocker.cs7
-rw-r--r--Software/Visual_Studio/PPC/Tango.PPC.Common/PPCViewModel.cs10
-rw-r--r--Software/Visual_Studio/PPC/Tango.PPC.UI/Navigation/DefaultNavigationManager.cs19
-rw-r--r--Software/Visual_Studio/PPC/Tango.PPC.UI/PPCApplication/DefaultPPCApplicationManager.cs10
-rw-r--r--Software/Visual_Studio/Tango.BL/ColorConversion/TangoColorConverter.cs5
-rw-r--r--Software/Visual_Studio/Tango.BL/EntitiesExtensions/Job.cs16
-rw-r--r--Software/Visual_Studio/Tango.Integration/Operation/IMachineOperator.cs9
-rw-r--r--Software/Visual_Studio/Tango.Integration/Operation/JobHandler.cs6
-rw-r--r--Software/Visual_Studio/Tango.Integration/Operation/MachineOperator.cs86
-rw-r--r--Software/Visual_Studio/Tango.Integration/Operation/RunningJobStatus.cs15
20 files changed, 294 insertions, 39 deletions
diff --git a/Software/DB/Tango.mdf b/Software/DB/Tango.mdf
index a94e39894..44805a30c 100644
--- a/Software/DB/Tango.mdf
+++ b/Software/DB/Tango.mdf
Binary files differ
diff --git a/Software/DB/Tango_log.ldf b/Software/DB/Tango_log.ldf
index e74145160..6bd51c604 100644
--- a/Software/DB/Tango_log.ldf
+++ b/Software/DB/Tango_log.ldf
Binary files differ
diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Controls/JobSummeryViewer.xaml b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Controls/JobSummeryViewer.xaml
index 550accac3..c7f42f14d 100644
--- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Controls/JobSummeryViewer.xaml
+++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Controls/JobSummeryViewer.xaml
@@ -101,9 +101,13 @@
<Style TargetType="Grid">
<Setter Property="Visibility" Value="Collapsed"></Setter>
<Style.Triggers>
- <DataTrigger Binding="{Binding JobType}" Value="{x:Static enumerations:JobTypes.Embroidery}">
+ <MultiDataTrigger>
+ <MultiDataTrigger.Conditions>
+ <Condition Binding="{Binding JobType}" Value="{x:Static enumerations:JobTypes.Embroidery}" />
+ <Condition Binding="{Binding RelativeSource={RelativeSource AncestorType=UserControl},Path=IsActive}" Value="False" />
+ </MultiDataTrigger.Conditions>
<Setter Property="Visibility" Value="Visible"></Setter>
- </DataTrigger>
+ </MultiDataTrigger>
</Style.Triggers>
</Style>
</Grid.Style>
@@ -112,6 +116,5 @@
<Run Text="x"></Run><Run Text="{Binding NumberOfUnits}"></Run>
</TextBlock>
</Grid>
- <TextBlock></TextBlock>
</Grid>
</UserControl>
diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Controls/JobSummeryViewer.xaml.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Controls/JobSummeryViewer.xaml.cs
index 2b9d9c7a9..2c03ad452 100644
--- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Controls/JobSummeryViewer.xaml.cs
+++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Controls/JobSummeryViewer.xaml.cs
@@ -20,7 +20,13 @@ namespace Tango.PPC.Jobs.Controls
/// </summary>
public partial class JobSummeryViewer : UserControl
{
-
+ public bool IsActive
+ {
+ get { return (bool)GetValue(IsActiveProperty); }
+ set { SetValue(IsActiveProperty, value); }
+ }
+ public static readonly DependencyProperty IsActiveProperty =
+ DependencyProperty.Register("IsActive", typeof(bool), typeof(JobSummeryViewer), new PropertyMetadata(false));
public bool DisplayMarkers
{
diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/ViewModels/JobSummeryViewVM.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/ViewModels/JobSummeryViewVM.cs
index 12f2c9642..19e28f6a9 100644
--- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/ViewModels/JobSummeryViewVM.cs
+++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/ViewModels/JobSummeryViewVM.cs
@@ -47,7 +47,7 @@ namespace Tango.PPC.Jobs.ViewModels
private void StartJob()
{
- ApplicationManager.ConnectedMachine.Print(Job, Adapter.ProcessParametersTables.First());
+ ApplicationManager.ConnectedMachine.Print(Job);
NavigationManager.NavigateTo<JobsModule>(nameof(JobProgressView));
}
diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/ViewModels/JobViewVM.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/ViewModels/JobViewVM.cs
index 82cfc3456..b23e8b8ed 100644
--- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/ViewModels/JobViewVM.cs
+++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/ViewModels/JobViewVM.cs
@@ -181,6 +181,11 @@ namespace Tango.PPC.Jobs.ViewModels
/// </summary>
public RelayCommand StartSampleDyeCommand { get; set; }
+ /// <summary>
+ /// Gets or sets the dye command.
+ /// </summary>
+ public RelayCommand DyeCommand { get; set; }
+
#endregion
#region Constructors
@@ -230,6 +235,7 @@ namespace Tango.PPC.Jobs.ViewModels
_check_gamut_thread.IsBackground = true;
StartSampleDyeCommand = new RelayCommand(StartSampleDye);
+ DyeCommand = new RelayCommand(StartJob, CanStartJob);
}
#endregion
@@ -260,6 +266,19 @@ namespace Tango.PPC.Jobs.ViewModels
}
}
+ private void StartJob()
+ {
+ ApplicationManager.ConnectedMachine.Print(Job);
+ NavigationManager.NavigateTo<JobsModule>(nameof(JobProgressView));
+ }
+
+ private bool CanStartJob()
+ {
+ return
+ Job != null &&
+ !Job.Segments.SelectMany(x => x.BrushStops).ToList().Exists(x => x.IsOutOfGamut);
+ }
+
#endregion
#region Segments Management
@@ -417,10 +436,10 @@ namespace Tango.PPC.Jobs.ViewModels
/// <summary>
/// Starts a sample dye.
/// </summary>
- private async void StartSampleDye()
+ private void StartSampleDye()
{
Job sampleDyeJob = Job.Clone();
- sampleDyeJob.Name += " sample";
+ sampleDyeJob.Name = Job.Name + " (sample)";
if (Job.JobType == BL.Enumerations.JobTypes.Embroidery)
{
@@ -436,7 +455,9 @@ namespace Tango.PPC.Jobs.ViewModels
}
}
- await NavigationManager.NavigateForResult<JobsModule, JobProgressView, Object, Job>(sampleDyeJob);
+ ApplicationManager.ConnectedMachine.Print(sampleDyeJob);
+
+ NavigationManager.NavigateTo<JobsModule>(nameof(JobProgressView));
}
#endregion
@@ -458,6 +479,11 @@ namespace Tango.PPC.Jobs.ViewModels
stop.IsOutOfGamut = TangoColorConverter.IsOutOfGamut(stop);
stop.OutOfGamutChecked = true;
}
+
+ InvokeUI(() =>
+ {
+ DyeCommand.RaiseCanExecuteChanged();
+ });
}
}
}
@@ -479,6 +505,8 @@ namespace Tango.PPC.Jobs.ViewModels
/// </summary>
public async override void OnNavigatedTo()
{
+ if (_job_to_load == null) return;
+
NotificationProvider.SetGlobalBusyMessage("Loading job details...");
_can_navigate_back = false;
@@ -518,14 +546,17 @@ namespace Tango.PPC.Jobs.ViewModels
{
NotificationProvider.ReleaseGlobalBusyMessage();
});
+
+ _job_to_load = null;
}
+
/// <summary>
- /// Called before the navigation system navigates from this object.
+ /// Called before the navigation system navigates back from this object.
/// Return false to abort the navigation.
/// </summary>
/// <returns></returns>
- public async override Task<bool> OnNavigateOutRequest()
+ public async override Task<bool> OnNavigateBackRequest()
{
bool result = true;
diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/ViewModels/JobsViewVM.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/ViewModels/JobsViewVM.cs
index 39963201e..8f2ea355f 100644
--- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/ViewModels/JobsViewVM.cs
+++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/ViewModels/JobsViewVM.cs
@@ -270,6 +270,9 @@ namespace Tango.PPC.Jobs.ViewModels
Job job = new Job();
job.Name = "untitled";
+ job.NumberOfHeads = 1;
+ job.NumberOfUnits = 1;
+ job.SampleUnitsOrMeters = 1;
job.CreationDate = DateTime.UtcNow;
job.JobStatus = JobStatuses.Draft;
job.JobType = vm.SelectedJobType.Value;
diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Views/JobProgressView.xaml b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Views/JobProgressView.xaml
index 3a4a895dc..28672a920 100644
--- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Views/JobProgressView.xaml
+++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Views/JobProgressView.xaml
@@ -15,7 +15,7 @@
<UserControl.Resources>
<converters:JobProgressToPositionConverter x:Key="JobProgressToPositionConverter" />
</UserControl.Resources>
-
+
<Grid>
<StackPanel HorizontalAlignment="Center" VerticalAlignment="Top" Margin="0 100 0 0">
<TextBlock FontSize="{StaticResource TangoHeaderFontSize}" HorizontalAlignment="Center" Text="{Binding Job.Name,FallbackValue='Job Name'}"></TextBlock>
@@ -54,18 +54,25 @@
<StackPanel>
<Canvas.Left>
<MultiBinding Converter="{StaticResource JobProgressToPositionConverter}">
- <Binding Path="RunningJobStatus.Progress" />
- <Binding Path="RunningJobStatus.TotalProgress" />
+ <Binding Path="RunningJobStatus.CurrentUnitProgress" />
+ <Binding Path="RunningJobStatus.CurrentUnitTotalProgress" />
<Binding RelativeSource="{RelativeSource AncestorType=Canvas}" Path="ActualWidth" />
</MultiBinding>
</Canvas.Left>
- <StackPanel Margin="-30 0 0 0">
+ <StackPanel Margin="-50 0 0 0">
<TextBlock HorizontalAlignment="Center" FontSize="{StaticResource TangoTitleFontSize}">now dying</TextBlock>
<touch:TouchIcon Margin="0 8 0 0" HorizontalAlignment="Center" Icon="Water" Angle="180" Foreground="{StaticResource TangoPrimaryAccentBrush}" Width="40" Height="40" />
</StackPanel>
</StackPanel>
</Canvas>
- <controls:JobSummeryViewer Height="30" Width="600" DisplayMarkers="False" DataContext="{Binding Job}" />
+
+ <Grid>
+ <controls:JobSummeryViewer Height="30" Width="600" DisplayMarkers="False" IsActive="True" DataContext="{Binding Job}" />
+
+ <TextBlock Margin="0 0 -40 0" VerticalAlignment="Center" FontSize="{StaticResource TangoTitleFontSize}" HorizontalAlignment="Right">
+ <Run Text="x"></Run><Run Text="{Binding RunningJobStatus.RemainingUnits}"></Run>
+ </TextBlock>
+ </Grid>
</StackPanel>
</Grid>
</StackPanel>
diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Views/JobSummeryView.xaml b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Views/JobSummeryView.xaml
index b956d7b6c..377348581 100644
--- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Views/JobSummeryView.xaml
+++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Views/JobSummeryView.xaml
@@ -56,7 +56,7 @@
<TextBlock Margin="40 10 0 0" FontSize="{StaticResource TangoTitleFontSize}">Tap 'DYE' to start the dying process...</TextBlock>
</StackPanel>
- <controls:JobSummeryViewer Height="50" Margin="-6 0 -6 0" DataContext="{Binding Job}" VerticalAlignment="Bottom" />
+ <controls:JobSummeryViewer Height="50" DataContext="{Binding Job}" VerticalAlignment="Bottom" />
</Grid>
</DockPanel>
</Grid>
diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Views/JobView.xaml b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Views/JobView.xaml
index 43917fe55..cf1c3fa37 100644
--- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Views/JobView.xaml
+++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Views/JobView.xaml
@@ -573,21 +573,63 @@
</touch:TouchExpander.Header>
<StackPanel Margin="60 20 0 0">
- <TextBlock>
- <Run>Dye 1 or more units in order to get approval.</Run>
- <LineBreak/>
- <Run>Once approved, you can dye the entire job.</Run>
- </TextBlock>
- <DockPanel Margin="0 50 0 0" LastChildFill="True" Width="450" HorizontalAlignment="Left">
- <TextBlock DockPanel.Dock="Left" VerticalAlignment="Center">How many sample units?</TextBlock>
+ <ContentControl Content="{Binding RelativeSource={RelativeSource AncestorType=UserControl},Path=DataContext}">
+ <ContentControl.Style>
+ <Style TargetType="ContentControl">
+ <Setter Property="ContentTemplate">
+ <Setter.Value>
+ <DataTemplate>
+ <StackPanel>
+ <TextBlock>
+ <Run>Dye 1 or more units in order to get approval.</Run>
+ <LineBreak/>
+ <Run>Once approved, you can dye the entire job.</Run>
+ </TextBlock>
- <DockPanel Margin="50 0 0 0">
- <touch:TouchIconButton Command="{Binding IncreaseDecreaseSamplesToDyeCommand}" CommandParameter="-" DockPanel.Dock="Left" Icon="Minus" Padding="15" Style="{StaticResource TangoHollowButton}" BorderThickness="2" Width="51" Height="51" />
- <touch:TouchIconButton Command="{Binding IncreaseDecreaseSamplesToDyeCommand}" CommandParameter="+" DockPanel.Dock="Right" Icon="Plus" Padding="15" Style="{StaticResource TangoHollowButton}" BorderThickness="2" Width="51" Height="51" />
- <touch:TouchNumericTextBox Value="{Binding Job.SampleUnitsOrMeters}" Minimum="1" Maximum="100" HorizontalContentAlignment="Center" VerticalAlignment="Center" Margin="10 0" Foreground="{StaticResource TangoPrimaryAccentBrush}" FontSize="{StaticResource TangoTitleFontSize}" DockPanel.Dock="Right" KeyboardContainer="{Binding ElementName=Container}" />
- </DockPanel>
- </DockPanel>
+ <DockPanel Margin="0 50 0 0" LastChildFill="True" Width="450" HorizontalAlignment="Left">
+ <TextBlock DockPanel.Dock="Left" VerticalAlignment="Center">How many sample units?</TextBlock>
+
+ <DockPanel Margin="50 0 0 0">
+ <touch:TouchIconButton Command="{Binding IncreaseDecreaseSamplesToDyeCommand}" CommandParameter="-" DockPanel.Dock="Left" Icon="Minus" Padding="15" Style="{StaticResource TangoHollowButton}" BorderThickness="2" Width="51" Height="51" />
+ <touch:TouchIconButton Command="{Binding IncreaseDecreaseSamplesToDyeCommand}" CommandParameter="+" DockPanel.Dock="Right" Icon="Plus" Padding="15" Style="{StaticResource TangoHollowButton}" BorderThickness="2" Width="51" Height="51" />
+ <touch:TouchNumericTextBox Value="{Binding Job.SampleUnitsOrMeters}" Minimum="1" Maximum="100" HorizontalContentAlignment="Center" VerticalAlignment="Center" Margin="10 0" Foreground="{StaticResource TangoPrimaryAccentBrush}" FontSize="{StaticResource TangoTitleFontSize}" DockPanel.Dock="Right" KeyboardContainer="{Binding ElementName=Container}" />
+ </DockPanel>
+ </DockPanel>
+ </StackPanel>
+ </DataTemplate>
+ </Setter.Value>
+ </Setter>
+ <Style.Triggers>
+ <DataTrigger Binding="{Binding Job.JobType}" Value="{x:Static enumerations:JobTypes.Sewing}">
+ <Setter Property="ContentTemplate">
+ <Setter.Value>
+ <DataTemplate>
+ <StackPanel>
+ <TextBlock>
+ <Run>Dye several meters per segment in order to get approval.</Run>
+ <LineBreak/>
+ <Run>Once approved, you can dye the entire job.</Run>
+ </TextBlock>
+
+ <DockPanel Margin="0 50 0 0" LastChildFill="True" Width="450" HorizontalAlignment="Left">
+ <TextBlock DockPanel.Dock="Left" VerticalAlignment="Center">Meters per segment</TextBlock>
+
+ <DockPanel Margin="50 0 0 0">
+ <touch:TouchIconButton Command="{Binding IncreaseDecreaseSamplesToDyeCommand}" CommandParameter="-" DockPanel.Dock="Left" Icon="Minus" Padding="15" Style="{StaticResource TangoHollowButton}" BorderThickness="2" Width="51" Height="51" />
+ <touch:TouchIconButton Command="{Binding IncreaseDecreaseSamplesToDyeCommand}" CommandParameter="+" DockPanel.Dock="Right" Icon="Plus" Padding="15" Style="{StaticResource TangoHollowButton}" BorderThickness="2" Width="51" Height="51" />
+ <touch:TouchNumericTextBox Value="{Binding Job.SampleUnitsOrMeters}" Minimum="1" Maximum="100" HorizontalContentAlignment="Center" VerticalAlignment="Center" Margin="10 0" Foreground="{StaticResource TangoPrimaryAccentBrush}" FontSize="{StaticResource TangoTitleFontSize}" DockPanel.Dock="Right" KeyboardContainer="{Binding ElementName=Container}" />
+ </DockPanel>
+ </DockPanel>
+ </StackPanel>
+ </DataTemplate>
+ </Setter.Value>
+ </Setter>
+ </DataTrigger>
+ </Style.Triggers>
+ </Style>
+ </ContentControl.Style>
+ </ContentControl>
<touch:TouchButton Margin="0 50 0 15" DockPanel.Dock="Right" Height="54" Padding="0" Width="184" CornerRadius="30" BlurRadius="20" HorizontalAlignment="Right" Command="{Binding StartSampleDyeCommand}">
START
diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Common/Navigation/INavigationBlocker.cs b/Software/Visual_Studio/PPC/Tango.PPC.Common/Navigation/INavigationBlocker.cs
index ea5173b95..622c9e2d4 100644
--- a/Software/Visual_Studio/PPC/Tango.PPC.Common/Navigation/INavigationBlocker.cs
+++ b/Software/Visual_Studio/PPC/Tango.PPC.Common/Navigation/INavigationBlocker.cs
@@ -17,5 +17,12 @@ namespace Tango.PPC.Common.Navigation
/// </summary>
/// <returns></returns>
Task<bool> OnNavigateOutRequest();
+
+ /// <summary>
+ /// Called before the navigation system navigates back from this object.
+ /// Return false to abort the navigation.
+ /// </summary>
+ /// <returns></returns>
+ Task<bool> OnNavigateBackRequest();
}
}
diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Common/PPCViewModel.cs b/Software/Visual_Studio/PPC/Tango.PPC.Common/PPCViewModel.cs
index fae905b13..12534959e 100644
--- a/Software/Visual_Studio/PPC/Tango.PPC.Common/PPCViewModel.cs
+++ b/Software/Visual_Studio/PPC/Tango.PPC.Common/PPCViewModel.cs
@@ -139,6 +139,16 @@ namespace Tango.PPC.Common
{
return Task.FromResult(true);
}
+
+ /// <summary>
+ /// Called before the navigation system navigates back from this object.
+ /// Return false to abort the navigation.
+ /// </summary>
+ /// <returns></returns>
+ public virtual Task<bool> OnNavigateBackRequest()
+ {
+ return Task.FromResult(true);
+ }
}
/// <summary>
diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/Navigation/DefaultNavigationManager.cs b/Software/Visual_Studio/PPC/Tango.PPC.UI/Navigation/DefaultNavigationManager.cs
index 448fc0edc..0ede1306f 100644
--- a/Software/Visual_Studio/PPC/Tango.PPC.UI/Navigation/DefaultNavigationManager.cs
+++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/Navigation/DefaultNavigationManager.cs
@@ -28,6 +28,7 @@ namespace Tango.PPC.UI.Navigation
private Object _currentVM;
private String _lastFullPath;
private bool _preventHistory;
+ private bool _navigating_back;
private Stack<String> _navigationHistory;
@@ -139,9 +140,19 @@ namespace Tango.PPC.UI.Navigation
if (_currentVM != null && _currentVM is INavigationBlocker)
{
- if (!await (_currentVM as INavigationBlocker).OnNavigateOutRequest())
+ if (_navigating_back)
{
- return false;
+ if (!await (_currentVM as INavigationBlocker).OnNavigateBackRequest())
+ {
+ return false;
+ }
+ }
+ else
+ {
+ if (!await (_currentVM as INavigationBlocker).OnNavigateOutRequest())
+ {
+ return false;
+ }
}
}
@@ -260,6 +271,8 @@ namespace Tango.PPC.UI.Navigation
/// </summary>
public async Task<bool> NavigateBack()
{
+ _navigating_back = true;
+
String first = _navigationHistory.Pop();
_preventHistory = true;
@@ -268,12 +281,14 @@ namespace Tango.PPC.UI.Navigation
{
RaisePropertyChanged(nameof(CanNavigateBack));
_preventHistory = false;
+ _navigating_back = false;
return true;
}
else
{
_navigationHistory.Push(first);
_preventHistory = false;
+ _navigating_back = false;
RaisePropertyChanged(nameof(CanNavigateBack));
return false;
}
diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/PPCApplication/DefaultPPCApplicationManager.cs b/Software/Visual_Studio/PPC/Tango.PPC.UI/PPCApplication/DefaultPPCApplicationManager.cs
index 8c112ff7a..c67e83fc6 100644
--- a/Software/Visual_Studio/PPC/Tango.PPC.UI/PPCApplication/DefaultPPCApplicationManager.cs
+++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/PPCApplication/DefaultPPCApplicationManager.cs
@@ -193,12 +193,12 @@ namespace Tango.PPC.UI.PPCApplication
private async void ConnectToMachine()
{
- //Transport.Discovery.UsbCommunicationScanner<ConnectRequest, ConnectResponse> scanner = new Transport.Discovery.UsbCommunicationScanner<ConnectRequest, ConnectResponse>(UsbSerialBaudRates.BR_9600);
- //var response = await scanner.Scan(new ConnectRequest() { Password = "1234" }, TimeSpan.FromSeconds(10));
+ Transport.Discovery.UsbCommunicationScanner<ConnectRequest, ConnectResponse> scanner = new Transport.Discovery.UsbCommunicationScanner<ConnectRequest, ConnectResponse>(UsbSerialBaudRates.BR_9600);
+ var response = await scanner.Scan(new ConnectRequest() { Password = "1234" }, TimeSpan.FromSeconds(10));
- //var machine = new MachineOperator(response.Adapter);
- //await machine.Connect();
- //ConnectedMachine = machine;
+ var machine = new MachineOperator(response.Adapter);
+ await machine.Connect();
+ ConnectedMachine = machine;
}
}
}
diff --git a/Software/Visual_Studio/Tango.BL/ColorConversion/TangoColorConverter.cs b/Software/Visual_Studio/Tango.BL/ColorConversion/TangoColorConverter.cs
index 210d4d3e8..147309f54 100644
--- a/Software/Visual_Studio/Tango.BL/ColorConversion/TangoColorConverter.cs
+++ b/Software/Visual_Studio/Tango.BL/ColorConversion/TangoColorConverter.cs
@@ -82,6 +82,11 @@ namespace Tango.BL.ColorConversion
return GetSuggestions(brushStop).OutOfGamut;
}
+ public static int GetLeastCommonProcessParametersTableIndex(IEnumerable<BrushStop> stops)
+ {
+ return stops.Select(x => GetSuggestions(x)).Select(x => x.SingleCoordinates).Min(x => x.ProcessParametersTableIndex);
+ }
+
private static ConversionInput CreateConversionInput(BrushStop brushStop)
{
ConversionInput conversionInput = new ConversionInput();
diff --git a/Software/Visual_Studio/Tango.BL/EntitiesExtensions/Job.cs b/Software/Visual_Studio/Tango.BL/EntitiesExtensions/Job.cs
index 4c68f3c72..292fe000d 100644
--- a/Software/Visual_Studio/Tango.BL/EntitiesExtensions/Job.cs
+++ b/Software/Visual_Studio/Tango.BL/EntitiesExtensions/Job.cs
@@ -56,6 +56,19 @@ namespace Tango.BL.Entities
}
/// <summary>
+ /// Gets the total job segments length multiplied by number of units if it is an embroidery job.
+ /// </summary>
+ [NotMapped]
+ [JsonIgnore]
+ public double LengthIncludingNumberOfUnits
+ {
+ get
+ {
+ return _lastLength * NumberOfUnits;
+ }
+ }
+
+ /// <summary>
/// Gets or sets the job <see cref="Status"/> property as <see cref="JobStatus"/> enum instead of int.
/// </summary>
[NotMapped]
@@ -193,6 +206,7 @@ namespace Tango.BL.Entities
if (_lastLength != GetLength())
{
RaisePropertyChanged(nameof(Length));
+ RaisePropertyChanged(nameof(LengthIncludingNumberOfUnits));
LengthChanged?.Invoke(this, new EventArgs());
}
}
@@ -349,7 +363,7 @@ namespace Tango.BL.Entities
/// <returns></returns>
public TimeSpan GetEstimatedDuration(ProcessParametersTable processParameters)
{
- return TimeSpan.FromSeconds(Length / (processParameters.DyeingSpeed / 100d));
+ return TimeSpan.FromSeconds(LengthIncludingNumberOfUnits / (processParameters.DyeingSpeed / 100d));
}
/// <summary>
diff --git a/Software/Visual_Studio/Tango.Integration/Operation/IMachineOperator.cs b/Software/Visual_Studio/Tango.Integration/Operation/IMachineOperator.cs
index c0bf390c0..24ec40fc3 100644
--- a/Software/Visual_Studio/Tango.Integration/Operation/IMachineOperator.cs
+++ b/Software/Visual_Studio/Tango.Integration/Operation/IMachineOperator.cs
@@ -94,6 +94,15 @@ namespace Tango.Integration.Operation
IMachineEventsStateProvider MachineEventsStateProvider { get; set; }
/// <summary>
+ /// Prints the specified job.
+ /// The process parameters table will be calculated using color conversion gamut region.
+ /// This method cannot accept brush stops with 'Volume' as color space.
+ /// </summary>
+ /// <param name="job">The job.</param>
+ /// <returns></returns>
+ JobHandler Print(Job job);
+
+ /// <summary>
/// Prints the specified job using the specified job parameters.
/// </summary>
/// <param name="job">The job.</param>
diff --git a/Software/Visual_Studio/Tango.Integration/Operation/JobHandler.cs b/Software/Visual_Studio/Tango.Integration/Operation/JobHandler.cs
index 02c663e1b..02579b20a 100644
--- a/Software/Visual_Studio/Tango.Integration/Operation/JobHandler.cs
+++ b/Software/Visual_Studio/Tango.Integration/Operation/JobHandler.cs
@@ -116,7 +116,9 @@ namespace Tango.Integration.Operation
Status = new RunningJobStatus();
Status.TotalTime = job.GetEstimatedDuration(processParameters);
- Status.TotalProgress = Job.Length;
+ Status.RemainingUnits = job.NumberOfUnits;
+ Status.TotalProgress = Job.LengthIncludingNumberOfUnits;
+ Status.CurrentUnitTotalProgress = Job.Length;
Status.Progress = 0;
Status.RemainingTime = Status.TotalTime;
Status.RemainingProgress = Status.TotalProgress;
@@ -177,6 +179,8 @@ namespace Tango.Integration.Operation
Status.Progress = s.Progress;
Status.RemainingTime = Status.TotalTime - Job.TranslateProgressToTime(Status.Progress, ProcessParameters);
Status.RemainingProgress = Status.TotalProgress - Status.Progress;
+ Status.RemainingUnits = Job.NumberOfUnits - (int)((Job.LengthIncludingNumberOfUnits / Status.CurrentUnitTotalProgress) * Status.Progress / Status.TotalProgress);
+ Status.CurrentUnitProgress = s.Progress - (Status.CurrentUnitTotalProgress * (Job.NumberOfUnits - Status.RemainingUnits));
if (s.Message != _lastStatusMessage && s.Message != String.Empty)
{
diff --git a/Software/Visual_Studio/Tango.Integration/Operation/MachineOperator.cs b/Software/Visual_Studio/Tango.Integration/Operation/MachineOperator.cs
index 8cc2465b9..d75e2fc49 100644
--- a/Software/Visual_Studio/Tango.Integration/Operation/MachineOperator.cs
+++ b/Software/Visual_Studio/Tango.Integration/Operation/MachineOperator.cs
@@ -21,6 +21,8 @@ using Tango.BL.Entities;
using Tango.PMR.Hardware;
using Google.Protobuf;
using Tango.PMR.Connection;
+using Tango.BL.Enumerations;
+using Tango.BL.ColorConversion;
namespace Tango.Integration.Operation
{
@@ -471,6 +473,74 @@ namespace Tango.Integration.Operation
#region Public Methods
/// <summary>
+ /// Prints the specified job.
+ /// The process parameters table will be calculated using color conversion gamut region.
+ /// This method cannot accept brush stops with 'Volume' as color space.
+ /// </summary>
+ /// <param name="job">The job.</param>
+ /// <returns></returns>
+ public JobHandler Print(Job job)
+ {
+ //Check not brush stop has color space 'Volume'.
+ if (job.Segments.SelectMany(x => x.BrushStops).ToList().Exists(x => x.ColorSpace.Code == ColorSpaces.Volume.ToInt32()))
+ {
+ throw new InvalidOperationException("Cannot print a brush stop with volume color space when process parameters table has not been specified.");
+ }
+
+ //Get least common process parameters table index.
+ int processParametersTableIndex = TangoColorConverter.GetLeastCommonProcessParametersTableIndex(job.Segments.SelectMany(x => x.BrushStops));
+
+ if (job.Rml == null)
+ {
+ throw new NullReferenceException("Job RML is null");
+ }
+
+ var processGroup = job.Rml.ProcessParametersTablesGroups.FirstOrDefault(x => x.Active);
+
+ if (processGroup == null)
+ {
+ throw new NullReferenceException("Could not locate an active process parameters tables group for RML " + job.Rml.Name);
+ }
+
+ var processParameters = processGroup.ProcessParametersTables.FirstOrDefault(x => x.TableIndex == processParametersTableIndex);
+
+ if (processParameters == null)
+ {
+ throw new NullReferenceException("Could not locate process parameters table index " + processParametersTableIndex + " in group " + processGroup.Name + " for RML " + job.Rml.Name);
+ }
+
+ //Perform color correction
+ foreach (var stop in job.Segments.SelectMany(x => x.BrushStops))
+ {
+ if (stop.LiquidVolumes == null)
+ {
+ var suggestions = TangoColorConverter.GetSuggestions(stop);
+
+ if (suggestions.OutOfGamut)
+ {
+ throw new InvalidOperationException("Cannot print a brush stop which is out of gamut.");
+ }
+
+ stop.SetLiquidVolumes(job.Machine.Configuration, job.Rml, processParameters);
+
+ foreach (var outputLiquid in suggestions.SingleCoordinates.OutputLiquids)
+ {
+ var liquidVolume = stop.LiquidVolumes.SingleOrDefault(x => x.IdsPack.LiquidType.Code == outputLiquid.LiquidType.ToInt32());
+
+ if (liquidVolume == null)
+ {
+ throw new NullReferenceException("Liquid volume not found for color conversion output liquid '" + outputLiquid.LiquidType + "'.");
+ }
+
+ liquidVolume.Volume = outputLiquid.Volume;
+ }
+ }
+ }
+
+ return Print(job, processParameters);
+ }
+
+ /// <summary>
/// Prints the specified job using the specified job parameters.
/// </summary>
/// <param name="job">The job.</param>
@@ -478,10 +548,24 @@ namespace Tango.Integration.Operation
/// <returns></returns>
public JobHandler Print(Job job, ProcessParametersTable processParameters)
{
+ var originalJob = job;
+
CurrentProcessParameters = processParameters;
JobRequest request = new JobRequest();
+ job = job.Clone();
+
+ var segments = job.Segments.ToList();
+
+ for (int i = 0; i < job.NumberOfUnits - 1; i++)
+ {
+ foreach (var s in segments)
+ {
+ job.Segments.Add(s);
+ }
+ }
+
JobTicket ticket = new JobTicket();
ticket.EnableInterSegment = job.EnableInterSegment;
ticket.InterSegmentLength = job.InterSegmentLength;
@@ -553,7 +637,7 @@ namespace Tango.Integration.Operation
{
LogManager.Log(ex, "Failed to cancel job.");
}
- }, job, processParameters);
+ }, originalJob, processParameters);
LogRequestSent(request);
bool responseLogged = false;
diff --git a/Software/Visual_Studio/Tango.Integration/Operation/RunningJobStatus.cs b/Software/Visual_Studio/Tango.Integration/Operation/RunningJobStatus.cs
index 335930277..17e5f3a40 100644
--- a/Software/Visual_Studio/Tango.Integration/Operation/RunningJobStatus.cs
+++ b/Software/Visual_Studio/Tango.Integration/Operation/RunningJobStatus.cs
@@ -37,6 +37,21 @@ namespace Tango.Integration.Operation
public double RemainingProgress { get; set; }
/// <summary>
+ /// Gets or sets the remaining units if it is an embroidery job.
+ /// </summary>
+ public int RemainingUnits { get; set; }
+
+ /// <summary>
+ /// Gets or sets the current unit progress.
+ /// </summary>
+ public double CurrentUnitProgress { get; set; }
+
+ /// <summary>
+ /// Gets or sets the current unit total progress.
+ /// </summary>
+ public double CurrentUnitTotalProgress { get; set; }
+
+ /// <summary>
/// Gets or sets a value indicating whether this instance is canceled.
/// </summary>
public bool IsCanceled { get; set; }