aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio/PPC
diff options
context:
space:
mode:
authorRoy Ben-Shabat <Roy@Twine-s.com>2019-07-01 17:56:49 +0300
committerRoy Ben-Shabat <Roy@Twine-s.com>2019-07-01 17:56:49 +0300
commit8a1e772f025eaf3bfdf17905d9e33c460993e559 (patch)
treeb6d705cca71033cd6c5f814596ceb9abc849bf50 /Software/Visual_Studio/PPC
parentc0fd8dcc53e45aa5aa0095cc2c8c5f39a34f7886 (diff)
downloadTango-8a1e772f025eaf3bfdf17905d9e33c460993e559.tar.gz
Tango-8a1e772f025eaf3bfdf17905d9e33c460993e559.zip
Many bug fixes !!!
Diffstat (limited to 'Software/Visual_Studio/PPC')
-rw-r--r--Software/Visual_Studio/PPC/Modules/Tango.PPC.Events/Converters/MachineEventToViewConverter.cs24
-rw-r--r--Software/Visual_Studio/PPC/Modules/Tango.PPC.Events/EventsViews/JobEventView.xaml27
-rw-r--r--Software/Visual_Studio/PPC/Modules/Tango.PPC.Events/EventsViews/JobEventView.xaml.cs28
-rw-r--r--Software/Visual_Studio/PPC/Modules/Tango.PPC.Events/Tango.PPC.Events.csproj9
-rw-r--r--Software/Visual_Studio/PPC/Modules/Tango.PPC.Events/ViewModels/MainViewVM.cs6
-rw-r--r--Software/Visual_Studio/PPC/Modules/Tango.PPC.Events/Views/MainView.xaml2
-rw-r--r--Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Dialogs/BasicColorCorrectionView.xaml25
-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.cs47
-rw-r--r--Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Views/JobsView.xaml.cs30
-rw-r--r--Software/Visual_Studio/PPC/Tango.PPC.Common/EventLogging/DefaultEventLogger.cs45
-rw-r--r--Software/Visual_Studio/PPC/Tango.PPC.UI/Connectivity/DefaultConnectivityProvider.cs35
-rw-r--r--Software/Visual_Studio/PPC/Tango.PPC.UI/Printing/DefaultPrintingManager.cs22
-rw-r--r--Software/Visual_Studio/PPC/Tango.PPC.UI/app.manifest2
14 files changed, 268 insertions, 36 deletions
diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Events/Converters/MachineEventToViewConverter.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Events/Converters/MachineEventToViewConverter.cs
index b0d00bf9f..47c9e0ddf 100644
--- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Events/Converters/MachineEventToViewConverter.cs
+++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Events/Converters/MachineEventToViewConverter.cs
@@ -7,30 +7,40 @@ using System.Threading.Tasks;
using System.Windows;
using System.Windows.Data;
using Tango.BL.Entities;
+using Tango.BL.Enumerations;
+using Tango.PPC.Events.EventsViews;
namespace Tango.PPC.Events.Converters
{
public class MachineEventToViewConverter : IValueConverter
{
- private static List<FrameworkElement> _views = new List<FrameworkElement>();
+ private static Dictionary<EventTypes, Type> _eventViews = new Dictionary<EventTypes, Type>();
+
+ static MachineEventToViewConverter()
+ {
+ _eventViews.Add(EventTypes.JOB_STARTED, typeof(JobEventView));
+ _eventViews.Add(EventTypes.JOB_ABORTED, typeof(JobEventView));
+ _eventViews.Add(EventTypes.JOB_COMPLETED, typeof(JobEventView));
+ _eventViews.Add(EventTypes.JOB_FAILED, typeof(JobEventView));
+ }
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
MachinesEvent ev = value as MachinesEvent;
+ FrameworkElement view = null;
if (ev != null)
{
- FrameworkElement view = _views.SingleOrDefault(x => x.GetType() == typeof(EventsViews.GeneralView));
-
- if (view != null)
+ if (_eventViews.ContainsKey(ev.Type))
{
- return view;
+ view = Activator.CreateInstance(_eventViews[ev.Type]) as FrameworkElement;
}
else
{
- view = Activator.CreateInstance<EventsViews.GeneralView>();
- return view;
+ view = Activator.CreateInstance<GeneralView>();
}
+
+ return view;
}
else
{
diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Events/EventsViews/JobEventView.xaml b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Events/EventsViews/JobEventView.xaml
new file mode 100644
index 000000000..d283b08d3
--- /dev/null
+++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Events/EventsViews/JobEventView.xaml
@@ -0,0 +1,27 @@
+<UserControl x:Class="Tango.PPC.Events.EventsViews.JobEventView"
+ 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:entities="clr-namespace:Tango.BL.Entities;assembly=Tango.BL"
+ xmlns:local="clr-namespace:Tango.PPC.Events.EventsViews"
+ mc:Ignorable="d"
+ d:DesignHeight="220" d:DesignWidth="750" d:DataContext="{d:DesignInstance Type=entities:MachinesEvent, IsDesignTimeCreatable=False}">
+ <Grid Background="{StaticResource TangoPrimaryBackgroundBrush}">
+ <DockPanel>
+ <Image Stretch="None" Margin="20" DockPanel.Dock="Right" Source="../Images/machine_small.png" RenderOptions.BitmapScalingMode="Fant" />
+ <DockPanel Margin="35 20 20 20">
+ <TextBlock FontSize="{StaticResource TangoTitleFontSize}" FontWeight="SemiBold" DockPanel.Dock="Top" Text="{Binding EventType.Title,FallbackValue='Unknown Event'}"></TextBlock>
+
+ <StackPanel Margin="0 30 0 0">
+ <TextBlock TextWrapping="Wrap" FontWeight="SemiBold" Text="{Binding EventType.Description,FallbackValue='No Description'}"></TextBlock>
+ <Rectangle Margin="0 5 0 10" StrokeThickness="2" Stroke="{StaticResource TangoDividerBrush}" />
+
+ <TextBlock Text="{Binding Description}" TextWrapping="Wrap">
+
+ </TextBlock>
+ </StackPanel>
+ </DockPanel>
+ </DockPanel>
+ </Grid>
+</UserControl>
diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Events/EventsViews/JobEventView.xaml.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Events/EventsViews/JobEventView.xaml.cs
new file mode 100644
index 000000000..89faa3a85
--- /dev/null
+++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Events/EventsViews/JobEventView.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.PPC.Events.EventsViews
+{
+ /// <summary>
+ /// Interaction logic for JobEventView.xaml
+ /// </summary>
+ public partial class JobEventView : UserControl
+ {
+ public JobEventView()
+ {
+ InitializeComponent();
+ }
+ }
+}
diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Events/Tango.PPC.Events.csproj b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Events/Tango.PPC.Events.csproj
index e446e3812..e2133e585 100644
--- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Events/Tango.PPC.Events.csproj
+++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Events/Tango.PPC.Events.csproj
@@ -72,6 +72,10 @@
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
+ <Page Include="EventsViews\JobEventView.xaml">
+ <SubType>Designer</SubType>
+ <Generator>MSBuild:Compile</Generator>
+ </Page>
<Page Include="Resources\Styles.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
@@ -91,6 +95,9 @@
<Compile Include="EventsViews\GeneralView.xaml.cs">
<DependentUpon>GeneralView.xaml</DependentUpon>
</Compile>
+ <Compile Include="EventsViews\JobEventView.xaml.cs">
+ <DependentUpon>JobEventView.xaml</DependentUpon>
+ </Compile>
<Compile Include="Properties\AssemblyInfo.cs">
<SubType>Code</SubType>
</Compile>
@@ -173,7 +180,7 @@
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<ProjectExtensions>
<VisualStudio>
- <UserProperties BuildVersion_StartDate="2000/1/1" BuildVersion_UseGlobalSettings="False" BuildVersion_BuildVersioningStyle="None.None.Increment.TimeStamp" BuildVersion_UpdateAssemblyVersion="True" BuildVersion_AssemblyInfoFilename="Properties\AssemblyInfo.cs" />
+ <UserProperties BuildVersion_AssemblyInfoFilename="Properties\AssemblyInfo.cs" BuildVersion_UpdateAssemblyVersion="True" BuildVersion_BuildVersioningStyle="None.None.Increment.TimeStamp" BuildVersion_UseGlobalSettings="False" BuildVersion_StartDate="2000/1/1" />
</VisualStudio>
</ProjectExtensions>
</Project> \ No newline at end of file
diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Events/ViewModels/MainViewVM.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Events/ViewModels/MainViewVM.cs
index 997ea70d5..d2a730cd7 100644
--- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Events/ViewModels/MainViewVM.cs
+++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Events/ViewModels/MainViewVM.cs
@@ -97,7 +97,7 @@ namespace Tango.PPC.Events.ViewModels
using (var db = ObservablesContext.CreateDefault())
{
var last_week = DateTime.UtcNow.AddDays(-7);
- HistoryEvents = (await db.MachinesEvents.Where(x => x.MachineGuid == MachineProvider.Machine.Guid && x.DateTime > last_week).Take(100).Include(x => x.EventType).Where(x => (EventTypeNotificationTimes)x.EventType.EventNotificationTime != EventTypeNotificationTimes.None).ToListAsync()).OrderByDescending(x => x.DateTime).ToObservableCollection();
+ HistoryEvents = (await db.MachinesEvents.Where(x => x.MachineGuid == MachineProvider.Machine.Guid && x.DateTime > last_week).Take(100).Include(x => x.EventType).Where(x => (EventTypeNotificationTimes)x.EventType.EventNotificationTime != EventTypeNotificationTimes.None || x.EventType.Code == (int)EventTypes.JOB_FAILED || x.EventType.Code == (int)EventTypes.JOB_STARTED || x.EventType.Code == (int)EventTypes.JOB_COMPLETED || x.EventType.Code == (int)EventTypes.JOB_ABORTED).ToListAsync()).OrderByDescending(x => x.DateTime).ToObservableCollection();
}
MachineProvider.MachineOperator.StatusChanged += MachineOperator_StatusChanged;
@@ -160,6 +160,10 @@ namespace Tango.PPC.Events.ViewModels
_notifications.Add(new KeyValuePair<EventTypes, NotificationItem>(ev.EventType.Type, notificationItem));
}
+ else if (ev.IsJobProgressEvent())
+ {
+ HistoryEvents.Insert(0, ev);
+ }
});
}
diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Events/Views/MainView.xaml b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Events/Views/MainView.xaml
index f263e4b7b..af42a5576 100644
--- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Events/Views/MainView.xaml
+++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Events/Views/MainView.xaml
@@ -135,7 +135,7 @@
</Style.Triggers>
</Style>
</Grid.Style>
- <touch:LightTouchDataGrid x:Name="gridEventsHistory" SelectionChanged="gridEventsHistory_SelectionChanged" RenderOptions.EdgeMode="Unspecified" SelectionMode="Single" EnableDragAndDrop="False" Style="{StaticResource TangoEventsGridHistory}" ItemsSource="{Binding HistoryEvents}" SelectedItem="{Binding SelectedHistoryEvent,Mode=TwoWay}" Margin="10">
+ <touch:LightTouchDataGrid x:Name="gridEventsHistory" SelectionChanged="gridEventsHistory_SelectionChanged" RenderOptions.EdgeMode="Unspecified" SelectionMode="Single" EnableDragAndDrop="False" Style="{StaticResource TangoEventsGrid}" ItemsSource="{Binding HistoryEvents}" SelectedItem="{Binding SelectedHistoryEvent,Mode=TwoWay}" Margin="10">
<touch:LightTouchDataGrid.Columns>
<touch:LightTouchDataGridColumn Width="120" Header="Severity" HorizontalContentAlignment="Center" SortMember="Category">
<touch:LightTouchDataGridColumn.CellTemplate>
diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Dialogs/BasicColorCorrectionView.xaml b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Dialogs/BasicColorCorrectionView.xaml
index 9583d0738..4fcccc9e5 100644
--- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Dialogs/BasicColorCorrectionView.xaml
+++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Dialogs/BasicColorCorrectionView.xaml
@@ -27,10 +27,35 @@
<Image Source="../Images/JobView/error.png" Stretch="None" />
<Ellipse Width="60" Height="60" Margin="20 0 0 0" Fill="{Binding InvalidBrushStop.Brush}" />
<TextBlock VerticalAlignment="Center" Foreground="{StaticResource TangoGrayTextBrush}" Margin="20 0 0 0">
+ <TextBlock.Style>
+ <Style TargetType="TextBlock">
+ <Setter Property="Visibility" Value="Collapsed"></Setter>
+ <Style.Triggers>
+ <DataTrigger Binding="{Binding InvalidBrushStop.BrushColorSpace}" Value="RGB">
+ <Setter Property="Visibility" Value="Visible"></Setter>
+ </DataTrigger>
+ </Style.Triggers>
+ </Style>
+ </TextBlock.Style>
<Run Text="{Binding InvalidBrushStop.Red}"></Run><Run>,</Run>
<Run Text="{Binding InvalidBrushStop.Green}"></Run><Run>,</Run>
<Run Text="{Binding InvalidBrushStop.Blue}"></Run>
</TextBlock>
+ <TextBlock VerticalAlignment="Center" Foreground="{StaticResource TangoGrayTextBrush}" Margin="20 0 0 0">
+ <TextBlock.Style>
+ <Style TargetType="TextBlock">
+ <Setter Property="Visibility" Value="Collapsed"></Setter>
+ <Style.Triggers>
+ <DataTrigger Binding="{Binding InvalidBrushStop.BrushColorSpace}" Value="LAB">
+ <Setter Property="Visibility" Value="Visible"></Setter>
+ </DataTrigger>
+ </Style.Triggers>
+ </Style>
+ </TextBlock.Style>
+ <Run Text="{Binding InvalidBrushStop.L}"></Run><Run>,</Run>
+ <Run Text="{Binding InvalidBrushStop.A}"></Run><Run>,</Run>
+ <Run Text="{Binding InvalidBrushStop.B}"></Run>
+ </TextBlock>
</StackPanel>
<DockPanel Grid.Row="2" Margin="0 0 0 0">
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 1a980fc4a..b413758c8 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
@@ -89,7 +89,7 @@ namespace Tango.PPC.Jobs.ViewModels
catch (Exception ex)
{
LogManager.Log(ex, "Could not start the current job.");
- await NotificationProvider.ShowError($"Cannot start job.\n{ex.Message}.");
+ await NotificationProvider.ShowError($"{ex.Message}");
}
}
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 3a777e142..0d1d2f3cb 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
@@ -407,7 +407,7 @@ namespace Tango.PPC.Jobs.ViewModels
_check_gamut_thread = new Thread(CheckGamutThreadMethod);
_check_gamut_thread.IsBackground = true;
- StartSampleDyeCommand = new RelayCommand(StartSampleDye);
+ StartSampleDyeCommand = new RelayCommand(StartSampleDye, CanStartJob);
DyeCommand = new RelayCommand(StartJob, CanStartJob);
ApproveSampleCommand = new RelayCommand(ApproveSampleDye);
@@ -415,7 +415,7 @@ namespace Tango.PPC.Jobs.ViewModels
AnotherSampleCommand = new RelayCommand(DyeAnotherSample);
InvokeFineTuningPaletteCommand = new RelayCommand<FineTuneItem>(InvokeFineTuningPalette);
ResetFineTuningCommand = new RelayCommand(ResetFineTuning);
- StartFineTuningCommand = new RelayCommand(StartFineTuning, () => FineTuneItems.Any(x => x.IsSelected));
+ StartFineTuningCommand = new RelayCommand(StartFineTuning, () => FineTuneItems.Any(x => x.IsSelected) && CanStartJob());
RepeatFineTuningCommand = new RelayCommand(RepeatFineTuning);
ApproveFineTuningCommand = new RelayCommand(ApproveFineTuning);
OpenTwineCatalogCommand = new RelayCommand<BrushStop>(OpenTwineCatalog);
@@ -463,6 +463,8 @@ namespace Tango.PPC.Jobs.ViewModels
Job.RmlChanged -= OnRmlChanged;
Job.RmlChanged += OnRmlChanged;
+ Job.NameChanged -= Job_NameChanged;
+ Job.NameChanged += Job_NameChanged;
Job.ValidateOnPropertyChanged = true;
@@ -490,6 +492,7 @@ namespace Tango.PPC.Jobs.ViewModels
SegmentsCollectionView = CollectionViewSource.GetDefaultView(Job.Segments);
SegmentsCollectionView.SortDescriptions.Add(new SortDescription(nameof(Segment.SegmentIndex), ListSortDirection.Ascending));
+ ResetFineTuning();
_job_to_load = null;
}
@@ -517,7 +520,11 @@ namespace Tango.PPC.Jobs.ViewModels
View.DisplayFineTuning();
}
+ ValidateBrushStops();
+
DyeCommand.RaiseCanExecuteChanged();
+ StartSampleDyeCommand.RaiseCanExecuteChanged();
+ StartFineTuningCommand.RaiseCanExecuteChanged();
}
catch (Exception ex)
{
@@ -534,6 +541,11 @@ namespace Tango.PPC.Jobs.ViewModels
}
}
+ private void Job_NameChanged(object sender, string e)
+ {
+ DyeCommand.RaiseCanExecuteChanged();
+ }
+
/// <summary>
/// Saves the job.
/// </summary>
@@ -564,12 +576,17 @@ namespace Tango.PPC.Jobs.ViewModels
Job.LastUpdated = DateTime.UtcNow;
Job.JobStatus = BL.Enumerations.JobStatuses.Draft;
await _db.SaveChangesAsync();
- RaiseMessage(new JobSavedMessage() { Job = Job });
if (displayNotification)
{
await NotificationProvider.ShowInfo(String.Format("Job '{0}' saved successfully.", Job.Name));
}
+
+ RaiseMessage(new JobSavedMessage() { Job = Job });
+ }
+ else
+ {
+ await NotificationProvider.ShowError($"Error saving job. {Job.ValidationErrors.FirstOrDefault()}");
}
}
catch (Exception ex)
@@ -617,7 +634,7 @@ namespace Tango.PPC.Jobs.ViewModels
catch (Exception ex)
{
LogManager.Log(ex, "Could not start the current job.");
- await NotificationProvider.ShowError($"Cannot start job.\n{ex.Message}.");
+ await NotificationProvider.ShowError($"{ex.Message}.");
}
}
@@ -627,7 +644,7 @@ namespace Tango.PPC.Jobs.ViewModels
private bool CanStartJob()
{
return
- Job != null &&
+ Job != null && Job.Validate(_db) &&
!Job.Segments.SelectMany(x => x.BrushStops).ToList().Exists(x => x.IsOutOfGamut);
}
@@ -653,6 +670,8 @@ namespace Tango.PPC.Jobs.ViewModels
var replacement = CoatsCatalogItems.SingleOrDefault(x => x.Name == stop.ColorCatalog.Name);
stop.ColorCatalog = replacement;
}
+
+ ResetFineTuning();
}
#endregion
@@ -748,6 +767,8 @@ namespace Tango.PPC.Jobs.ViewModels
_db.Segments.Remove(segment);
ArrangeSegmentsIndices();
+
+ DyeCommand.RaiseCanExecuteChanged();
}
}
catch (Exception ex)
@@ -815,8 +836,9 @@ namespace Tango.PPC.Jobs.ViewModels
if (brushStop.Segment.BrushStops.Count > 2)
{
LogManager.Log($"removing brush stop {brushStop.StopIndex} from segment {brushStop.Segment.SegmentIndex}.");
+ var segment = brushStop.Segment;
_db.BrushStops.Remove(brushStop);
- ArrangeBrushStopsIndices(brushStop.Segment);
+ ArrangeBrushStopsIndices(segment);
}
else
{
@@ -946,6 +968,11 @@ namespace Tango.PPC.Jobs.ViewModels
}
}
+ private bool ValidateBrushStops()
+ {
+ return Job.Segments.SelectMany(x => x.BrushStops).ToList().All(x => x.Validate(_db));
+ }
+
#endregion
#region Job Selection Message
@@ -979,7 +1006,7 @@ namespace Tango.PPC.Jobs.ViewModels
catch (Exception ex)
{
LogManager.Log(ex, $"Error executing sample dye for job {Job.Name}.");
- await NotificationProvider.ShowError("An error occurred while trying to execute the sample dye.");
+ await NotificationProvider.ShowError(ex.Message);
}
}
@@ -1119,7 +1146,7 @@ namespace Tango.PPC.Jobs.ViewModels
catch (Exception ex)
{
LogManager.Log(ex, "Error executing fine tuning job.");
- await NotificationProvider.ShowError("An error occurred while trying to start the fine tuning job.");
+ await NotificationProvider.ShowError(ex.Message);
}
}
@@ -1177,7 +1204,7 @@ namespace Tango.PPC.Jobs.ViewModels
{
Thread.Sleep(500);
- if (Job != null && IsVisible && (Job.ColorSpace != null && (Job.ColorSpace.Code == BL.Enumerations.ColorSpaces.RGB.ToInt32() || Job.ColorSpace.Code == BL.Enumerations.ColorSpaces.LAB.ToInt32())))
+ if (Job != null && Job.Rml.Ccts.Count > 0 && IsVisible && (Job.ColorSpace != null && (Job.ColorSpace.Code == BL.Enumerations.ColorSpaces.RGB.ToInt32() || Job.ColorSpace.Code == BL.Enumerations.ColorSpaces.LAB.ToInt32())))
{
var brushStops = Job.Segments.SelectMany(x => x.BrushStops).Where(x => !x.Corrected && !x.OutOfGamutChecked).ToList();
@@ -1199,6 +1226,8 @@ namespace Tango.PPC.Jobs.ViewModels
InvokeUI(() =>
{
DyeCommand.RaiseCanExecuteChanged();
+ StartSampleDyeCommand.RaiseCanExecuteChanged();
+ StartFineTuningCommand.RaiseCanExecuteChanged();
});
}
}
diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Views/JobsView.xaml.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Views/JobsView.xaml.cs
index 2653179e1..23785881d 100644
--- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Views/JobsView.xaml.cs
+++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Views/JobsView.xaml.cs
@@ -28,23 +28,23 @@ namespace Tango.PPC.Jobs.Views
TangoIOC.Default.Register<IJobsView>(this);
}
- private void TouchNavigationLinks_SelectionChanged(object sender, SelectionChangedEventArgs e)
+ private async void TouchNavigationLinks_SelectionChanged(object sender, SelectionChangedEventArgs e)
{
- //if (dataGridJobs != null)
- //{
- // await Task.Delay(200);
+ if (dataGridJobs != null)
+ {
+ await Task.Delay(200);
- // if (navigationLinks.SelectedIndex == 0)
- // {
- // dataGridJobs.LayoutRows(false);
- // dataGridJobs.ScrollViewer.ScrollToTop();
- // }
- // else
- // {
- // dataGridJobsHistory.LayoutRows(false);
- // dataGridJobsHistory.ScrollViewer.ScrollToTop();
- // }
- //}
+ if (navigationLinks.SelectedIndex == 0)
+ {
+ dataGridJobs.LayoutRows(false);
+ dataGridJobs.ScrollViewer.ScrollToTop();
+ }
+ else
+ {
+ dataGridJobsHistory.LayoutRows(false);
+ dataGridJobsHistory.ScrollViewer.ScrollToTop();
+ }
+ }
}
public void ScrollToTop()
diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Common/EventLogging/DefaultEventLogger.cs b/Software/Visual_Studio/PPC/Tango.PPC.Common/EventLogging/DefaultEventLogger.cs
index 7ccb76858..f9674e409 100644
--- a/Software/Visual_Studio/PPC/Tango.PPC.Common/EventLogging/DefaultEventLogger.cs
+++ b/Software/Visual_Studio/PPC/Tango.PPC.Common/EventLogging/DefaultEventLogger.cs
@@ -80,6 +80,11 @@ namespace Tango.PPC.Common.EventLogging
_machineProvider.MachineOperator.RequestFailed += Machine_RequestFailed;
_machineProvider.MachineOperator.ResponseReceived += Machine_ResponseReceived;
_machineProvider.MachineOperator.StateChanged += MachineOperator_StateChanged;
+ _machineProvider.MachineOperator.PrintingStarted += MachineOperator_PrintingStarted;
+ _machineProvider.MachineOperator.PrintingAborted += MachineOperator_PrintingAborted;
+ _machineProvider.MachineOperator.PrintingCompleted += MachineOperator_PrintingCompleted;
+ _machineProvider.MachineOperator.PrintingFailed += MachineOperator_PrintingFailed;
+
}
#endregion
@@ -115,6 +120,46 @@ namespace Tango.PPC.Common.EventLogging
#region Event Handlers
/// <summary>
+ /// Handles the PrintingFailed event of the MachineOperator.
+ /// </summary>
+ /// <param name="sender">The source of the event.</param>
+ /// <param name="e">The <see cref="PrintingFailedEventArgs"/> instance containing the event data.</param>
+ private void MachineOperator_PrintingFailed(object sender, PrintingFailedEventArgs e)
+ {
+ Log(EventTypes.JOB_FAILED, e.Exception.Message);
+ }
+
+ /// <summary>
+ /// Handles the PrintingCompleted event of the MachineOperator.
+ /// </summary>
+ /// <param name="sender">The source of the event.</param>
+ /// <param name="e">The <see cref="PrintingEventArgs"/> instance containing the event data.</param>
+ private void MachineOperator_PrintingCompleted(object sender, PrintingEventArgs e)
+ {
+ Log(EventTypes.JOB_COMPLETED, $"Job '{e.Job.Name}' completed successfully.");
+ }
+
+ /// <summary>
+ /// Handles the PrintingAborted event of the MachineOperator.
+ /// </summary>
+ /// <param name="sender">The source of the event.</param>
+ /// <param name="e">The <see cref="PrintingEventArgs"/> instance containing the event data.</param>
+ private void MachineOperator_PrintingAborted(object sender, PrintingEventArgs e)
+ {
+ Log(EventTypes.JOB_ABORTED, $"Job '{e.Job.Name}' has been aborted.");
+ }
+
+ /// <summary>
+ /// Handles the PrintingStarted event of the MachineOperator.
+ /// </summary>
+ /// <param name="sender">The source of the event.</param>
+ /// <param name="e">The <see cref="PrintingEventArgs"/> instance containing the event data.</param>
+ private void MachineOperator_PrintingStarted(object sender, PrintingEventArgs e)
+ {
+ Log(EventTypes.JOB_STARTED, $"Job '{e.Job.Name}' started.");
+ }
+
+ /// <summary>
/// Handles the machine operator state changed event.
/// </summary>
/// <param name="sender">The sender.</param>
diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/Connectivity/DefaultConnectivityProvider.cs b/Software/Visual_Studio/PPC/Tango.PPC.UI/Connectivity/DefaultConnectivityProvider.cs
index dabfc5893..53e143def 100644
--- a/Software/Visual_Studio/PPC/Tango.PPC.UI/Connectivity/DefaultConnectivityProvider.cs
+++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/Connectivity/DefaultConnectivityProvider.cs
@@ -28,6 +28,8 @@ namespace Tango.PPC.UI.Connectivity
private INotificationProvider _notification;
private IMachineProvider _machineProvider;
private Rfc2898Cryptographer _cryptographer;
+ private System.Timers.Timer _updateTimer;
+ private WiFiNetwork _connectedNetwork;
/// <summary>
/// Occurs when the connectivity provider state has changed (e.g network connected/disconnected).
@@ -136,12 +138,40 @@ namespace Tango.PPC.UI.Connectivity
IsConnected = networks.Exists(x => x.IsConnected);
+ if (IsConnected)
+ {
+ _connectedNetwork = auto_connect_network;
+ }
+
if (auto_connect_network != null && !auto_connect_network.IsConnected)
{
auto_connect_network.AutoConnect = true;
await Connect(auto_connect_network, _cryptographer.Decrypt(settings.AutoConnectWiFiPassword));
}
});
+
+ _updateTimer = new System.Timers.Timer(TimeSpan.FromSeconds(30).TotalMilliseconds);
+ _updateTimer.Elapsed += _updateTimer_Elapsed;
+ _updateTimer.Start();
+ }
+
+ /// <summary>
+ /// Periodically checks if WiFI network is gone/disconnected.
+ /// </summary>
+ /// <param name="sender">The source of the event.</param>
+ /// <param name="e">The <see cref="System.Timers.ElapsedEventArgs"/> instance containing the event data.</param>
+ private void _updateTimer_Elapsed(object sender, System.Timers.ElapsedEventArgs e)
+ {
+ if (IsConnected && _connectedNetwork != null)
+ {
+ var networks = GetAvailableWiFiNetworks().Result;
+ var matching_network = networks.FirstOrDefault(x => x.Name == _connectedNetwork.Name);
+
+ if (matching_network == null || !matching_network.AccessPoint.IsConnected)
+ {
+ OnConnectionStateChanged(false);
+ }
+ }
}
/// <summary>
@@ -264,6 +294,7 @@ namespace Tango.PPC.UI.Connectivity
settings.AutoConnectWiFiName = network.AutoConnect ? network.Name : null;
settings.AutoConnectWiFiPassword = _cryptographer.Encrypt(auth.Password);
settings.Save();
+ _connectedNetwork = network;
}
return result;
@@ -295,6 +326,10 @@ namespace Tango.PPC.UI.Connectivity
/// <param name="connected">if set to <c>true</c> [connected].</param>
protected virtual void OnConnectionStateChanged(bool connected)
{
+ if (!connected)
+ {
+ _connectedNetwork = null;
+ }
IsConnected = connected;
ConnectionStateChanged?.Invoke(this, new ConnectionStateEventArgs() { IsConnected = connected });
}
diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/Printing/DefaultPrintingManager.cs b/Software/Visual_Studio/PPC/Tango.PPC.UI/Printing/DefaultPrintingManager.cs
index 1f09023cb..456c69625 100644
--- a/Software/Visual_Studio/PPC/Tango.PPC.UI/Printing/DefaultPrintingManager.cs
+++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/Printing/DefaultPrintingManager.cs
@@ -45,6 +45,8 @@ namespace Tango.PPC.UI.Printing
/// <returns></returns>
public async Task<JobHandler> Print(Job job, ObservablesContext context)
{
+ ThrowIfJobInvalid(job);
+
JobHandler handler = null;
#if STUBPRINT
@@ -149,6 +151,8 @@ namespace Tango.PPC.UI.Printing
/// <returns></returns>
public async Task<JobHandler> PrintSample(Job job, ObservablesContext context)
{
+ ThrowIfJobInvalid(job);
+
LogManager.Log("Cloning job...");
Job sampleDyeJob = job.Clone();
sampleDyeJob.Guid = job.Guid;
@@ -202,6 +206,8 @@ namespace Tango.PPC.UI.Printing
/// <returns></returns>
public async Task<JobHandler> PrintFineTuning(Job job, ObservablesContext context, IEnumerable<FineTuneItem> fineTuneItems)
{
+ ThrowIfJobInvalid(job);
+
LogManager.Log("Cloning job...");
Job fineTuneJob = job.Clone();
fineTuneJob.NumberOfUnits = 1;
@@ -241,5 +247,21 @@ namespace Tango.PPC.UI.Printing
{
TangoMessenger.Default.Send(new JobSavedMessage() { Job = job });
}
+
+ private void ThrowIfJobInvalid(Job job)
+ {
+ if (job.Segments.SelectMany(x => x.BrushStops).Any(x => x.IsOutOfGamut))
+ {
+ throw new InvalidOperationException("Error starting job. Color is out of range.");
+ }
+ if (job.Segments.SelectMany(x => x.BrushStops).Any(x => x.ColorSpace.IsCatalog && x.ColorCatalog == null))
+ {
+ throw new InvalidOperationException("Error starting job. Please select a catalog color.");
+ }
+ if (job.Rml.Ccts.Count == 0)
+ {
+ throw new InvalidOperationException($"Error starting job. No color table found for thread '{job.Rml.Name}'.");
+ }
+ }
}
}
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>