aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio/PPC
diff options
context:
space:
mode:
authorRoy Ben-Shabat <Roy@Twine-s.com>2018-07-16 13:47:20 +0300
committerRoy Ben-Shabat <Roy@Twine-s.com>2018-07-16 13:47:20 +0300
commitfdfa740288568dba27877a5ef5c817be323cfbb0 (patch)
tree933ee1cb2769d43c982596f50ff8b7ec791f3be7 /Software/Visual_Studio/PPC
parentd376387fa28a2091a21e2fc7193812d1f8a40ef2 (diff)
downloadTango-fdfa740288568dba27877a5ef5c817be323cfbb0.tar.gz
Tango-fdfa740288568dba27877a5ef5c817be323cfbb0.zip
Working on PPC.
Diffstat (limited to 'Software/Visual_Studio/PPC')
-rw-r--r--Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/ViewModels/JobViewVM.cs18
-rw-r--r--Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/ViewModels/MainViewVM.cs15
-rw-r--r--Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Views/JobProgressView.xaml71
-rw-r--r--Software/Visual_Studio/PPC/Tango.PPC.Common/Navigation/INavigationManager.cs18
-rw-r--r--Software/Visual_Studio/PPC/Tango.PPC.Common/Notifications/NotificationItem.cs13
-rw-r--r--Software/Visual_Studio/PPC/Tango.PPC.Common/Notifications/NotificationItems/MessageNotificationItemView.xaml13
-rw-r--r--Software/Visual_Studio/PPC/Tango.PPC.UI/Navigation/DefaultNavigationManager.cs31
-rw-r--r--Software/Visual_Studio/PPC/Tango.PPC.UI/Views/MainView.xaml9
8 files changed, 169 insertions, 19 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>
diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Common/Navigation/INavigationManager.cs b/Software/Visual_Studio/PPC/Tango.PPC.Common/Navigation/INavigationManager.cs
index 249a917de..94a2e8d35 100644
--- a/Software/Visual_Studio/PPC/Tango.PPC.Common/Navigation/INavigationManager.cs
+++ b/Software/Visual_Studio/PPC/Tango.PPC.Common/Navigation/INavigationManager.cs
@@ -12,9 +12,17 @@ namespace Tango.PPC.Common.Navigation
/// </summary>
public interface INavigationManager
{
+ /// <summary>
+ /// Gets the current module.
+ /// </summary>
IPPCModule CurrentModule { get; }
/// <summary>
+ /// Gets the current view model.
+ /// </summary>
+ PPCViewModel CurrentVM { get; }
+
+ /// <summary>
/// Gets a value indicating whether the navigation system is able to navigate to the previous view.
/// </summary>
bool CanNavigateBack { get; }
@@ -86,5 +94,15 @@ namespace Tango.PPC.Common.Navigation
/// <returns></returns>
Task<bool> NavigateWithObject<TModule, TView, TPass>(TPass obj, bool pushToHistory = true)
where TModule : IPPCModule;
+
+ /// <summary>
+ /// Clears the navigation back history.
+ /// </summary>
+ void ClearHistory();
+
+ /// <summary>
+ /// Clears the navigation back history except the specified view type.
+ /// </summary>
+ void ClearHistoryExcept<T>();
}
}
diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Common/Notifications/NotificationItem.cs b/Software/Visual_Studio/PPC/Tango.PPC.Common/Notifications/NotificationItem.cs
index 2f74024f3..1fdf0c729 100644
--- a/Software/Visual_Studio/PPC/Tango.PPC.Common/Notifications/NotificationItem.cs
+++ b/Software/Visual_Studio/PPC/Tango.PPC.Common/Notifications/NotificationItem.cs
@@ -14,6 +14,19 @@ namespace Tango.PPC.Common.Notifications
/// </summary>
public abstract class NotificationItem : ItemBase
{
+ private bool _isExpanded;
+ /// <summary>
+ /// Gets or sets a value indicating whether the notification panel is expanded.
+ /// </summary>
+ public bool IsExpanded
+ {
+ get { return _isExpanded; }
+ set { _isExpanded = value; RaisePropertyChangedAuto(); }
+ }
+
+ /// <summary>
+ /// Called when the item has been pressed.
+ /// </summary>
protected override void OnPreesed()
{
base.OnPreesed();
diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Common/Notifications/NotificationItems/MessageNotificationItemView.xaml b/Software/Visual_Studio/PPC/Tango.PPC.Common/Notifications/NotificationItems/MessageNotificationItemView.xaml
index b049dc108..fa26bce83 100644
--- a/Software/Visual_Studio/PPC/Tango.PPC.Common/Notifications/NotificationItems/MessageNotificationItemView.xaml
+++ b/Software/Visual_Studio/PPC/Tango.PPC.Common/Notifications/NotificationItems/MessageNotificationItemView.xaml
@@ -49,7 +49,18 @@
</Style>
</touch:TouchIcon.Style>
</touch:TouchIcon>
- <TextBlock VerticalAlignment="Center" Margin="10 0 0 0" Text="{Binding Message}"></TextBlock>
+ <TextBlock VerticalAlignment="Center" Margin="10 0 0 0" Text="{Binding Message}" TextTrimming="CharacterEllipsis">
+ <TextBlock.Style>
+ <Style TargetType="TextBlock">
+ <Setter Property="TextWrapping" Value="NoWrap"></Setter>
+ <Style.Triggers>
+ <DataTrigger Binding="{Binding IsExpanded}" Value="True">
+ <Setter Property="TextWrapping" Value="Wrap"></Setter>
+ </DataTrigger>
+ </Style.Triggers>
+ </Style>
+ </TextBlock.Style>
+ </TextBlock>
</DockPanel>
</ContentControl>
</UserControl>
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 47450a68e..f06bd88de 100644
--- a/Software/Visual_Studio/PPC/Tango.PPC.UI/Navigation/DefaultNavigationManager.cs
+++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/Navigation/DefaultNavigationManager.cs
@@ -34,6 +34,14 @@ namespace Tango.PPC.UI.Navigation
private Stack<String> _navigationHistory;
+ /// <summary>
+ /// Gets the current view model.
+ /// </summary>
+ public PPCViewModel CurrentVM
+ {
+ get { return _currentVM as PPCViewModel; }
+ }
+
private IPPCModule _currentModule;
/// <summary>
/// Gets or sets the current module.
@@ -339,5 +347,28 @@ namespace Tango.PPC.UI.Navigation
return false;
}
}
+
+ /// <summary>
+ /// Clears the navigation back history.
+ /// </summary>
+ public void ClearHistory()
+ {
+ _navigationHistory.Clear();
+ RaisePropertyChanged(nameof(CanNavigateBack));
+ }
+
+ public void ClearHistoryExcept<T>()
+ {
+ var history_list = _navigationHistory.ToList();
+ history_list = history_list.Where(x => x.Contains(typeof(T).Name)).Distinct().ToList();
+ _navigationHistory.Clear();
+
+ foreach (var item in history_list)
+ {
+ _navigationHistory.Push(item);
+ }
+
+ RaisePropertyChanged(nameof(CanNavigateBack));
+ }
}
}
diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/Views/MainView.xaml b/Software/Visual_Studio/PPC/Tango.PPC.UI/Views/MainView.xaml
index f333ea2e8..1ce18bff1 100644
--- a/Software/Visual_Studio/PPC/Tango.PPC.UI/Views/MainView.xaml
+++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/Views/MainView.xaml
@@ -23,15 +23,16 @@
CurrentMessageBox="{Binding NotificationProvider.CurrentMessageBox}"
HasNotifications="{Binding NotificationProvider.HasNotificationItems}"
Notifications="{Binding NotificationProvider.NotificationItems}"
+ ItemExpandedPropertyPath="IsExpanded"
HasDialog="{Binding NotificationProvider.HasDialog}"
CurrentDialog="{Binding NotificationProvider.CurrentDialog}">
<touch:TouchPanel.NotificationTemplate>
<DataTemplate>
<touch:TouchButton Style="{StaticResource TangoFlatButton}" Padding="0" Command="{Binding PressedCommand}">
- <Grid>
- <ContentControl Content="{Binding Converter={StaticResource NotificationItemConverter}}" />
- <touch:TouchIconButton Background="Transparent" Padding="20" Style="{StaticResource TangoRoundTouchIconButton}" Command="{Binding CloseCommand}" CommandParameter="{Binding}" HorizontalAlignment="Right" MaxHeight="60" Width="{Binding RelativeSource={RelativeSource Self},Path=ActualHeight}" Icon="Close" Foreground="White" />
- </Grid>
+ <DockPanel>
+ <touch:TouchIconButton DockPanel.Dock="Right" Background="Transparent" Padding="20" Style="{StaticResource TangoRoundTouchIconButton}" Command="{Binding CloseCommand}" CommandParameter="{Binding}" HorizontalAlignment="Right" MaxHeight="60" Width="{Binding RelativeSource={RelativeSource Self},Path=ActualHeight}" Icon="Close" Foreground="White" />
+ <ContentControl Content="{Binding Converter={StaticResource NotificationItemConverter}}"/>
+ </DockPanel>
</touch:TouchButton>
</DataTemplate>
</touch:TouchPanel.NotificationTemplate>