diff options
| author | Roy Ben-Shabat <Roy@Twine-s.com> | 2018-07-16 13:47:20 +0300 |
|---|---|---|
| committer | Roy Ben-Shabat <Roy@Twine-s.com> | 2018-07-16 13:47:20 +0300 |
| commit | fdfa740288568dba27877a5ef5c817be323cfbb0 (patch) | |
| tree | 933ee1cb2769d43c982596f50ff8b7ec791f3be7 /Software/Visual_Studio/PPC/Modules | |
| parent | d376387fa28a2091a21e2fc7193812d1f8a40ef2 (diff) | |
| download | Tango-fdfa740288568dba27877a5ef5c817be323cfbb0.tar.gz Tango-fdfa740288568dba27877a5ef5c817be323cfbb0.zip | |
Working on PPC.
Diffstat (limited to 'Software/Visual_Studio/PPC/Modules')
3 files changed, 90 insertions, 14 deletions
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 c9e48c03f..92c9b4b94 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 @@ -506,7 +506,7 @@ namespace Tango.PPC.Jobs.ViewModels /// </summary> public async override void OnNavigatedTo() { - if (_job_to_load == null) return; + if (_job_to_load == null || (_job_to_load != null && Job != null && _job_to_load.Guid == Job.Guid)) return; NotificationProvider.SetGlobalBusyMessage("Loading job details..."); @@ -552,13 +552,15 @@ namespace Tango.PPC.Jobs.ViewModels if (!_can_navigate_back) { - result = await NotificationProvider.ShowQuestion("Are you sure you want to exit this job?"); - } - - if (result) - { - Job = null; - SegmentsCollectionView = null; + if (await NotificationProvider.ShowQuestion("Are you sure you want to exit this job?")) + { + Job = null; + SegmentsCollectionView = null; + } + else + { + result = false; + } } return result; diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/ViewModels/MainViewVM.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/ViewModels/MainViewVM.cs index 53fe73bd5..5b49aedf1 100644 --- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/ViewModels/MainViewVM.cs +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/ViewModels/MainViewVM.cs @@ -15,15 +15,24 @@ namespace Tango.PPC.Jobs.ViewModels public override void OnApplicationStarted() { MachineProvider.MachineOperator.PrintingCompleted += MachineOperator_PrintingCompleted; + MachineProvider.MachineOperator.PrintingFailed += MachineOperator_PrintingFailed; } - private void MachineOperator_PrintingCompleted(object sender, Integration.Operation.PrintingEventArgs e) + private void MachineOperator_PrintingFailed(object sender, Integration.Operation.PrintingFailedEventArgs e) { - NotificationProvider.PushNotification(new MessageNotificationItem("Job completed successfully.", MessageNotificationItem.MessageNotificationItemTypes.Success, () => + NotificationProvider.PushNotification(new MessageNotificationItem(String.Format("Job failed. ({0})", e.Exception.Message), MessageNotificationItem.MessageNotificationItemTypes.Error, () => { - NavigationManager.NavigateWithObject<JobsModule, JobView, Job>(e.Job); + NavigationManager.ClearHistoryExcept<JobsView>(); + })); + } + private void MachineOperator_PrintingCompleted(object sender, Integration.Operation.PrintingEventArgs e) + { + NotificationProvider.PushNotification(new MessageNotificationItem("Job completed successfully.", MessageNotificationItem.MessageNotificationItemTypes.Success, () => + { + NavigationManager.NavigateWithObject<JobsModule, JobView, Job>(e.Job); + NavigationManager.ClearHistoryExcept<JobsView>(); })); } } 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 e707b3550..56fbcd9a7 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 @@ -21,7 +21,24 @@ <TextBlock FontSize="{StaticResource TangoHeaderFontSize}" HorizontalAlignment="Center" Text="{Binding Job.Name,FallbackValue='Job Name'}"></TextBlock> <Grid Margin="0 80 0 0"> - <touch:TouchRingProgress Width="364" Height="364" Maximum="{Binding RunningJobStatus.TotalProgress}" Value="{Binding RunningJobStatus.Progress}" RingThickness="10" /> + <touch:TouchRingProgress Width="364" Height="364" Maximum="{Binding RunningJobStatus.TotalProgress}" Value="{Binding RunningJobStatus.Progress}" RingThickness="10"> + <touch:TouchRingProgress.Style> + <Style TargetType="touch:TouchRingProgress"> + <Setter Property="Foreground" Value="{StaticResource TangoPrimaryAccentBrush}"></Setter> + <Style.Triggers> + <DataTrigger Binding="{Binding RunningJobStatus.IsCompleted}" Value="True"> + <Setter Property="Foreground" Value="{StaticResource TangoSuccessBrush}"></Setter> + </DataTrigger> + <DataTrigger Binding="{Binding RunningJobStatus.IsCanceled}" Value="True"> + <Setter Property="Foreground" Value="{StaticResource TangoWarningBrush}"></Setter> + </DataTrigger> + <DataTrigger Binding="{Binding RunningJobStatus.IsFailed}" Value="True"> + <Setter Property="Foreground" Value="{StaticResource TangoErrorBrush}"></Setter> + </DataTrigger> + </Style.Triggers> + </Style> + </touch:TouchRingProgress.Style> + </touch:TouchRingProgress> <StackPanel VerticalAlignment="Center" HorizontalAlignment="Center"> <StackPanel Orientation="Horizontal" HorizontalAlignment="Center"> @@ -60,8 +77,52 @@ </MultiBinding> </Canvas.Left> <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" /> + <ContentControl> + <ContentControl.Style> + <Style TargetType="ContentControl"> + <Setter Property="Content"> + <Setter.Value> + <StackPanel> + <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> + </Setter.Value> + </Setter> + <Style.Triggers> + <DataTrigger Binding="{Binding RunningJobStatus.IsCanceled}" Value="True"> + <Setter Property="Content"> + <Setter.Value> + <StackPanel> + <TextBlock HorizontalAlignment="Center" FontSize="{StaticResource TangoTitleFontSize}">job canceled</TextBlock> + <touch:TouchIcon Margin="0 8 0 0" HorizontalAlignment="Center" Icon="Alert" Foreground="{StaticResource TangoWarningBrush}" Width="40" Height="40" /> + </StackPanel> + </Setter.Value> + </Setter> + </DataTrigger> + <DataTrigger Binding="{Binding RunningJobStatus.IsFailed}" Value="True"> + <Setter Property="Content"> + <Setter.Value> + <StackPanel> + <TextBlock HorizontalAlignment="Center" FontSize="{StaticResource TangoTitleFontSize}">job failed</TextBlock> + <touch:TouchIcon Margin="0 8 0 0" HorizontalAlignment="Center" Icon="AlertOctagon" Foreground="{StaticResource TangoErrorBrush}" Width="40" Height="40" /> + </StackPanel> + </Setter.Value> + </Setter> + </DataTrigger> + <DataTrigger Binding="{Binding RunningJobStatus.IsCompleted}" Value="True"> + <Setter Property="Content"> + <Setter.Value> + <StackPanel> + <TextBlock HorizontalAlignment="Center" FontSize="{StaticResource TangoTitleFontSize}">job completed</TextBlock> + <touch:TouchIcon Margin="0 8 0 0" HorizontalAlignment="Center" Icon="Check" Foreground="{StaticResource TangoSuccessBrush}" Width="40" Height="40" /> + </StackPanel> + </Setter.Value> + </Setter> + </DataTrigger> + </Style.Triggers> + </Style> + </ContentControl.Style> + </ContentControl> </StackPanel> </StackPanel> </Canvas> @@ -75,6 +136,10 @@ </Grid> </StackPanel> </Grid> + + <touch:TouchButton Margin="0 100 0 0" Style="{StaticResource TangoLinkButton}" Height="60" FontSize="{StaticResource TangoTitleFontSize}" Visibility="{Binding RunningJobStatus.IsCompleted,Converter={StaticResource BooleanToVisibilityConverter}}"> + Go to job + </touch:TouchButton> </StackPanel> </Grid> </UserControl> |
