aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio/PPC
diff options
context:
space:
mode:
authorRoy Ben Shabat <Roy.mail.net@gmail.com>2025-03-26 06:45:03 +0200
committerRoy Ben Shabat <Roy.mail.net@gmail.com>2025-03-26 06:45:03 +0200
commitdb81ac5eb4b912bc23b45e33c7d3d909b5c0636e (patch)
tree8b0394c379ba737db57a462b6d60b9be3c6c6394 /Software/Visual_Studio/PPC
parent8b6bed67b054c79ea35173504efea7060195cd55 (diff)
downloadTango-db81ac5eb4b912bc23b45e33c7d3d909b5c0636e.tar.gz
Tango-db81ac5eb4b912bc23b45e33c7d3d909b5c0636e.zip
Final touches on X1.
Diffstat (limited to 'Software/Visual_Studio/PPC')
-rw-r--r--Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/ViewModelLocator.cs14
-rw-r--r--Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/ViewModels/MainViewVM.cs8
-rw-r--r--Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/MachineStatusViewVM.cs203
-rw-r--r--Software/Visual_Studio/PPC/Tango.PPC.UI/Views/MachineStatusView.xaml12
-rw-r--r--Software/Visual_Studio/PPC/Tango.PPC.UI/app.manifest2
5 files changed, 198 insertions, 41 deletions
diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/ViewModelLocator.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/ViewModelLocator.cs
index 2004d60b7..d3aa7d485 100644
--- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/ViewModelLocator.cs
+++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/ViewModelLocator.cs
@@ -22,10 +22,7 @@ namespace Tango.PPC.Jobs
TangoIOC.Default.Register<JobSummeryViewVM>();
TangoIOC.Default.Register<JobViewVM>();
TangoIOC.Default.Register<TwineCatalogViewVM>();
- if (TangoIOC.Default.GetInstance<IBuildProvider>().BuildType == BuildType.TS1800)
- {
- TangoIOC.Default.Register<JobProgressViewVM>();
- }
+ TangoIOC.Default.Register<JobProgressViewVM>();
TangoIOC.Default.Register<ColorSelectionViewVM>();
}
@@ -91,7 +88,14 @@ namespace Tango.PPC.Jobs
{
get
{
- return TangoIOC.Default.GetInstance<JobProgressViewVM>();
+ if (TangoIOC.Default.GetInstance<IBuildProvider>().BuildType == BuildType.TS1800)
+ {
+ return TangoIOC.Default.GetInstance<JobProgressViewVM>();
+ }
+ else
+ {
+ return null;
+ }
}
}
diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/ViewModels/MainViewVM.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/ViewModels/MainViewVM.cs
index 1ceb47ebd..5e0d36da5 100644
--- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/ViewModels/MainViewVM.cs
+++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/ViewModels/MainViewVM.cs
@@ -151,6 +151,14 @@ namespace Tango.PPC.Jobs.ViewModels
}
else
{
+ if (BuildProvider.MachineType.IsXMachine())
+ {
+ foreach (var item in NotificationProvider.NotificationItems.Where(x => x.CanClose).ToList())
+ {
+ NotificationProvider.PopNotification(item);
+ }
+ }
+
NotificationProvider.PushNotification(new MessageNotificationItem(String.Format("'{0}' completed successfully", e.Job.Name), "Tap to view this job details.", MessageNotificationItem.MessageNotificationItemTypes.Success, () =>
{
NavigationManager.NavigateWithObject<JobsV2Module, JobView, JobNavigationObject>(new JobNavigationObject() { Job = e.Job });
diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/MachineStatusViewVM.cs b/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/MachineStatusViewVM.cs
index 07c5f77ed..2faee12ac 100644
--- a/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/MachineStatusViewVM.cs
+++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/MachineStatusViewVM.cs
@@ -32,6 +32,7 @@ using Tango.Core.ExtensionMethods;
using Tango.PPC.Common.Printing;
using Tango.PPC.Common.RemoteJob;
using Tango.PPC.UI.Dialogs;
+using Tango.ColorConversion;
namespace Tango.PPC.UI.ViewModels
{
@@ -76,6 +77,9 @@ namespace Tango.PPC.UI.ViewModels
private DispatcherTimer _productiondata_timer;
private bool startingJob = false;
private bool _jerricanDialogShowing;
+ private List<ColorSpace> _colorSpaces;
+ private bool _conversion_Busy;
+ private bool _printingEnded;
#region Properties
@@ -180,14 +184,28 @@ namespace Tango.PPC.UI.ViewModels
if (_currentBrushStop != value)
{
_currentBrushStop = value;
-
-
OnUpdateCurrentBrush();
}
}
}
- public JobBrushStop JobBrushStop { get; set; }
+ private JobBrushStop _jobBrushStop;
+ public JobBrushStop JobBrushStop
+ {
+ get { return _jobBrushStop; }
+ set
+ {
+ if (_jobBrushStop != value)
+ {
+ _jobBrushStop = value;
+ if (_jobBrushStop != null)
+ {
+ UpdateOutputLiquids();
+ }
+ }
+ }
+ }
+
//public double TransparentInkOutput
//{
@@ -392,7 +410,7 @@ namespace Tango.PPC.UI.ViewModels
AbortCommand = new RelayCommand(AbortJob, () => CanStopped());
ResumeCommand = new RelayCommand(ResumeJob, () => MachineProvider.MachineOperator.CanPrint);
- CaancelJobCommand = new RelayCommand(CaancelJob);
+ CaancelJobCommand = new RelayCommand(CancelJob);
RestartJobCommand = new RelayCommand(RestartJob, () => MachineProvider.MachineOperator.CanPrint);
ClearJobCommand = new RelayCommand(ClearJob);
@@ -585,7 +603,7 @@ namespace Tango.PPC.UI.ViewModels
#region printing
- public override void OnApplicationStarted()
+ public override async void OnApplicationStarted()
{
MachineProvider.MachineOperator.PrintingStarted += MachineOperator_PrintingStarted;
MachineProvider.MachineOperator.PrintingEnded += MachineOperator_PrintingEnded;
@@ -595,6 +613,18 @@ namespace Tango.PPC.UI.ViewModels
JobResumeManager.JobResumeUpdated += JobResumeManager_JobResumeUpdated;
JobResumeManager.JobResumeDropped += JobResumeManager_JobResumeDropped;
+
+ try
+ {
+ using (var db = ObservablesContext.CreateDefault())
+ {
+ _colorSpaces = await db.ColorSpaces.ToListAsync();
+ }
+ }
+ catch (Exception ex)
+ {
+ LogManager.Log(ex);
+ }
}
@@ -605,8 +635,11 @@ namespace Tango.PPC.UI.ViewModels
private void MachineOperator_PrintingStarted(object sender, PrintingEventArgs e)
{
+ _printingEnded = false;
_handler = e.JobHandler;
Job = e.Job;
+ CurrentBrushStop = null;
+ JobBrushStop = null;
List<LiquidOutputModel> outputs = new List<LiquidOutputModel>();
@@ -647,8 +680,6 @@ namespace Tango.PPC.UI.ViewModels
StopCommand.RaiseCanExecuteChanged();
AbortCommand.RaiseCanExecuteChanged();
});
-
-
}
private void JobHandler_Stopped(object sender, EventArgs e)
@@ -665,6 +696,14 @@ namespace Tango.PPC.UI.ViewModels
private void MachineOperator_PrintingEnded(object sender, PrintingEventArgs e)
{
+ _printingEnded = true;
+
+ try
+ {
+ CurrentBrushStop = RunningJobStatus.CurrentSegment.BrushStops.OrderBy(x => x.StopIndex).Last();
+ }
+ catch { }
+
LogManager.Log("Printing ended");
InvokeUI(() =>
{
@@ -674,7 +713,7 @@ namespace Tango.PPC.UI.ViewModels
});
}
- private void JobHandler_StatusChanged(object sender, RunningJobStatus e)
+ private async void JobHandler_StatusChanged(object sender, RunningJobStatus e)
{
RunningJobStatus = e;
if (RunningJobStatus != null && RunningJobStatus.IsFailed)
@@ -689,41 +728,142 @@ namespace Tango.PPC.UI.ViewModels
IsDyeingProcess = (RunningJobStatus != null && RunningJobStatus.CurrentSegment != null);
if (RunningJobStatus != null && RunningJobStatus.CurrentSegment != null)
{
- if (_runningJobStatus.CurrentSegment.IsInterSegment)
- {
- CurrentBrushStop = _runningJobStatus.CurrentSegment.BrushStops.FirstOrDefault();
- JobBrushStop = null;
- }
- else
+ try
{
- var realsegmIndex = 1;
- if (Job.EnableInterSegment && Job.InterSegmentLength > 0)
+ if (_runningJobStatus.CurrentSegment.IsInterSegment)
+ {
+ var stop = _runningJobStatus.CurrentSegment.BrushStops.FirstOrDefault();
+ stop.ColorSpace = CurrentBrushStop.ColorSpace;
+ CurrentBrushStop = stop;
+ JobBrushStop = null;
+ }
+ else
{
- int segmentIndex = _runningJobStatus.CurrentSegment.SegmentIndex - (Job.EffectiveSegments.Count * RunningJobStatus.CurrentUnit);
- if (RunningJobStatus.CurrentUnit > 0)
+ var realsegmIndex = 1;
+ if (Job.EnableInterSegment && Job.InterSegmentLength > 0)
+ {
+ int segmentIndex = _runningJobStatus.CurrentSegment.SegmentIndex - (Job.EffectiveSegments.Count * RunningJobStatus.CurrentUnit);
+ if (RunningJobStatus.CurrentUnit > 0)
+ {
+ segmentIndex -= RunningJobStatus.CurrentUnit;// inter segment between units
+ }
+ realsegmIndex = (int)(segmentIndex / 2) + 1;
+ }
+ else
{
- segmentIndex -= RunningJobStatus.CurrentUnit;// inter segment between units
+ realsegmIndex = Math.Max(_runningJobStatus.CurrentSegment.SegmentIndex - (Job.Segments.Count * RunningJobStatus.CurrentUnit), 0);
+ }
+
+ var segment = Job.Segments.FirstOrDefault(x => x.SegmentIndex == realsegmIndex);
+ JobSegment jobSegment = null;
+
+ if (segment != null)
+ {
+ if (_handler.JobTicket.Segments.Count > 0)
+ {
+ jobSegment = _handler.JobTicket.Segments[Job.OrderedSegments.IndexOf(segment)];
+ if (jobSegment.BrushStops.Count == 1)
+ {
+ JobBrushStop = jobSegment.BrushStops.First();
+ }
+ else if (jobSegment.BrushStops.Count > 1)
+ {
+ JobBrushStop = jobSegment.BrushStops.Last(x => x.OffsetMeters <= e.CurrentSegment.Progress);
+ }
+ else
+ {
+ JobBrushStop = null;
+ }
+ }
+ }
+
+
+ if (segment != null && jobSegment != null && jobSegment.BrushStops.Count > 1)
+ {
+ if (!_conversion_Busy)
+ {
+ var brushStop = RunningJobStatus.CurrentSegment.FirstBrushStop;
+ await ApplyJobBrushStopToBrushStop(JobBrushStop, brushStop);
+
+ if (!_printingEnded)
+ {
+ _currentBrushStop = brushStop;
+ RaisePropertyChanged(nameof(CurrentBrushStop));
+ }
+ }
+ }
+ else
+ {
+ CurrentBrushStop = RunningJobStatus.CurrentSegment.FirstBrushStop;
}
- realsegmIndex = (int)(segmentIndex / 2) + 1;
}
- else
+ }
+ catch (Exception ex)
+ {
+ LogManager.Log(ex, "Error displaying job progress input output.");
+ }
+ }
+ }
+
+ private async Task ApplyJobBrushStopToBrushStop(JobBrushStop stop, BrushStop s)
+ {
+ _conversion_Busy = true;
+
+ try
+ {
+ foreach (var dispenser in stop.Dispensers)
+ {
+ s.SetVolume(dispenser.Index, dispenser.Volume);
+ }
+
+ s.SetLiquidVolumes(MachineProvider.Machine.Configuration, Job.Rml, MachineProvider.MachineOperator.CurrentProcessParameters);
+
+ foreach (var liquidVolume in s.LiquidVolumes.Where(x => x.IdsPack.LiquidType.IsLightInk && x.Volume > 0).ToList())
+ {
+ var darkInk = s.LiquidVolumes.FirstOrDefault(x => x.IdsPack.LiquidType.Code == liquidVolume.IdsPack.LiquidType.DarkInkCode);
+ if (darkInk != null)
{
- realsegmIndex = Math.Max(_runningJobStatus.CurrentSegment.SegmentIndex - (Job.Segments.Count * RunningJobStatus.CurrentUnit), 0);
+ darkInk.Volume = liquidVolume.Volume / 10d;
+ liquidVolume.Volume = 0;
}
+ }
- var segment = Job.Segments.FirstOrDefault(x => x.SegmentIndex == realsegmIndex);
- if (segment != null)
+ if (_colorSpaces != null)
+ {
+ if ((s.BrushColorSpace == ColorSpaces.RGB || s.BrushColorSpace == ColorSpaces.LAB) && (!s.IsLast && !s.IsFirst))
{
- if (_handler.JobTicket.Segments.Count > 0)
+ var converter = new DefaultColorConverter();
+
+ var previousSpace = s.ColorSpace;
+ s.SetColorSpaceSilent(_colorSpaces.First(x => x.Space == ColorSpaces.Volume));
+
+ try
{
- JobBrushStop = _handler.JobTicket.Segments[Job.OrderedSegments.IndexOf(segment)].BrushStops.First();
+ var output = await converter.ConvertAsync(s, false, false);
+ s.SetColorSpaceSilent(previousSpace);
+ if (!_printingEnded)
+ {
+ output.ApplyOnBrushStop(s, MachineProvider.MachineOperator.CurrentProcessParameters);
+ }
+ }
+ catch (Exception ex)
+ {
+ s.SetColorSpaceSilent(previousSpace);
+ throw ex;
}
}
- CurrentBrushStop = RunningJobStatus.CurrentSegment.FirstBrushStop;
}
+
+ _conversion_Busy = false;
+ }
+ catch (Exception ex)
+ {
+ _conversion_Busy = false;
+ throw ex;
}
}
+
private void JobHandler_CanCancelChanged(object sender, EventArgs e)
{
InvokeUI(() =>
@@ -874,7 +1014,7 @@ namespace Tango.PPC.UI.ViewModels
}
}
- private void CaancelJob()
+ private void CancelJob()
{
ClearJob();
}
@@ -908,10 +1048,15 @@ namespace Tango.PPC.UI.ViewModels
protected void OnUpdateCurrentBrush()
{
- CurrentBrushStop.SetLiquidVolumes(MachineProvider.Machine.Configuration, Job.Rml, MachineProvider.MachineOperator.CurrentProcessParameters);
+ CurrentBrushStop?.SetLiquidVolumes(MachineProvider.Machine.Configuration, Job.Rml, MachineProvider.MachineOperator.CurrentProcessParameters);
RaisePropertyChanged(nameof(CurrentBrushStop));
+ UpdateOutputLiquids();
+ }
+
+ private void UpdateOutputLiquids()
+ {
foreach (var output in LiquidOutputs)
{
output.Volume = GetVolumeLiquidType(output.LiquidType.Type);
diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/Views/MachineStatusView.xaml b/Software/Visual_Studio/PPC/Tango.PPC.UI/Views/MachineStatusView.xaml
index 39adb7bdd..a269c590d 100644
--- a/Software/Visual_Studio/PPC/Tango.PPC.UI/Views/MachineStatusView.xaml
+++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/Views/MachineStatusView.xaml
@@ -68,19 +68,19 @@
<DataTemplate x:Key="RGB_Template" DataType="{x:Type entities:BrushStop}">
<UniformGrid Rows="1" Columns="3" Height="Auto" >
<StackPanel Orientation="Vertical">
- <Border Width="50" Height="50" Background="Red" CornerRadius="16" HorizontalAlignment="Left"></Border>
+ <Border Width="50" Height="50" Background="#E13C3C" CornerRadius="16" HorizontalAlignment="Left"></Border>
<TextBlock Margin="0 10 0 0" Text="R" FontSize="{StaticResource TangoDefaultFontSize}" VerticalAlignment="Center" HorizontalAlignment="Center"/>
<TextBlock Margin="0 10 0 0" Style="{StaticResource SliderGreyTextStyle}" Text="{Binding Red}" ></TextBlock>
</StackPanel>
<StackPanel Orientation="Vertical" Margin="4 0 0 0">
- <Border Width="50" Height="50" Background="Green" CornerRadius="16" HorizontalAlignment="Left"></Border>
+ <Border Width="50" Height="50" Background="#5CBB5C" CornerRadius="16" HorizontalAlignment="Left"></Border>
<TextBlock Margin="0 10 0 0" Text="G" FontSize="{StaticResource TangoDefaultFontSize}" VerticalAlignment="Center" HorizontalAlignment="Center"/>
<TextBlock Margin="0 10 0 0" Style="{StaticResource SliderGreyTextStyle}" Text="{Binding Green}" ></TextBlock>
</StackPanel>
<StackPanel Orientation="Vertical" Margin="4 0 0 0">
- <Border Width="50" Height="50" Background="Blue" CornerRadius="16" HorizontalAlignment="Left"></Border>
+ <Border Width="50" Height="50" Background="#DC0808F1" CornerRadius="16" HorizontalAlignment="Left"></Border>
<TextBlock Margin="0 10 0 0" Text="B" FontSize="{StaticResource TangoDefaultFontSize}" VerticalAlignment="Center" HorizontalAlignment="Center"/>
<TextBlock Margin="0 10 0 0" Style="{StaticResource SliderGreyTextStyle}" Text="{Binding Blue}" ></TextBlock>
</StackPanel>
@@ -90,18 +90,18 @@
<DataTemplate x:Key="LAB_Template" DataType="{x:Type entities:BrushStop}">
<UniformGrid Rows="1" Columns="3" Height="Auto" MinWidth="180" HorizontalAlignment="Left">
<StackPanel Orientation="Vertical">
- <Border Width="50" Height="50" Background="Gray" CornerRadius="16" HorizontalAlignment="Left"></Border>
+ <Border Width="50" Height="50" Background="#CECECE" CornerRadius="16" HorizontalAlignment="Left"></Border>
<TextBlock Margin="0 10 0 0 " Text="L" FontSize="{StaticResource TangoDefaultFontSize}" HorizontalAlignment="Center"/>
<TextBlock Margin="0 10 0 0" Style="{StaticResource SliderGreyTextStyle}" Text="{Binding L, StringFormat=0.##}" ></TextBlock>
</StackPanel>
<StackPanel Orientation="Vertical" Width="50" HorizontalAlignment="Left" Margin="5 0 0 0">
- <Border Width="50" Height="50" Background="red" CornerRadius="16" HorizontalAlignment="Left"></Border>
+ <Border Width="50" Height="50" Background="#E13C3C" CornerRadius="16" HorizontalAlignment="Left"></Border>
<TextBlock Margin="0 10 0 0 " Text="A" FontSize="{StaticResource TangoDefaultFontSize}" HorizontalAlignment="Center"/>
<TextBlock Margin="0 10 0 0" Style="{StaticResource SliderGreyTextStyle}" Text="{Binding A, StringFormat=0.##}" ></TextBlock>
</StackPanel>
<StackPanel Orientation="Vertical" Margin="10 0 0 0" Width="50">
- <Border Width="50" Height="50" Background="Blue" CornerRadius="16" HorizontalAlignment="Left"></Border>
+ <Border Width="50" Height="50" Background="#DC0808F1" CornerRadius="16" HorizontalAlignment="Left"></Border>
<TextBlock Margin="0 10 0 0 " Text="B" FontSize="{StaticResource TangoDefaultFontSize}" HorizontalAlignment="Center"/>
<TextBlock Margin="0 10 0 0" HorizontalAlignment="Center" Style="{StaticResource SliderGreyTextStyle}" Text="{Binding B, StringFormat=0.##}" ></TextBlock>
</StackPanel>
diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/app.manifest b/Software/Visual_Studio/PPC/Tango.PPC.UI/app.manifest
index d72e75011..efc5f8179 100644
--- a/Software/Visual_Studio/PPC/Tango.PPC.UI/app.manifest
+++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/app.manifest
@@ -16,7 +16,7 @@
Remove this element if your application requires this virtualization for backwards
compatibility.
-->
- <requestedExecutionLevel level="requireAdministrator" uiAccess="false" />
+ <!--<requestedExecutionLevel level="requireAdministrator" uiAccess="false" />-->
</requestedPrivileges>
</security>
</trustInfo>