diff options
| author | Roy Ben-Shabat <Roy@Twine-s.com> | 2018-07-25 13:15:26 +0300 |
|---|---|---|
| committer | Roy Ben-Shabat <Roy@Twine-s.com> | 2018-07-25 13:15:26 +0300 |
| commit | 8f83b5cedf2a0af57836e2db227d88b50e612cb1 (patch) | |
| tree | 56b510aefd11116bf705e5226654430e2094fc5f /Software/Visual_Studio | |
| parent | a299149cf7ce3d0fa363fd53840dcf41bf794125 (diff) | |
| download | Tango-8f83b5cedf2a0af57836e2db227d88b50e612cb1.tar.gz Tango-8f83b5cedf2a0af57836e2db227d88b50e612cb1.zip | |
Working on PPC.
Diffstat (limited to 'Software/Visual_Studio')
7 files changed, 110 insertions, 29 deletions
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 28ff1793b..389349f54 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 @@ -21,26 +21,28 @@ namespace Tango.PPC.Jobs.ViewModels private void MachineOperator_PrintingFailed(object sender, Integration.Operation.PrintingFailedEventArgs e) { - 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>(); - })); + NotificationProvider.PushNotification(new MessageNotificationItem( + String.Format("'{0}' failed.", e.Job.Name), + String.Format("The job '{1}' has failed due to unexpected error.{0}{2}{0}{0}Tap to view this job details.", Environment.NewLine, e.Job.Name, e.Exception), MessageNotificationItem.MessageNotificationItemTypes.Error, () => + { + NavigationManager.NavigateWithObject<JobsModule, JobView, Job>(e.Job); + NavigationManager.ClearHistoryExcept<JobsView>(); + })); } private void MachineOperator_PrintingCompleted(object sender, Integration.Operation.PrintingEventArgs e) { if (e.Job.Designation == BL.Enumerations.JobDesignations.SampleDye) { - NotificationProvider.PushNotification(new MessageNotificationItem("Sample completed successfully.", MessageNotificationItem.MessageNotificationItemTypes.Success, () => - { - NavigationManager.NavigateWithObject<JobsModule, JobView, JobNavigationObject>(new JobNavigationObject() { Job = e.Job, Intent = JobNavigationIntent.SampleDye }); - NavigationManager.ClearHistoryExcept<JobsView>(); - })); + NotificationProvider.PushNotification(new MessageNotificationItem(String.Format("'{0}' sample dye completed successfully", e.Job.Name), "Tap to approve or repeat.", MessageNotificationItem.MessageNotificationItemTypes.Success, () => + { + NavigationManager.NavigateWithObject<JobsModule, JobView, JobNavigationObject>(new JobNavigationObject() { Job = e.Job, Intent = JobNavigationIntent.SampleDye }); + NavigationManager.ClearHistoryExcept<JobsView>(); + })); } else if (e.Job.Designation == BL.Enumerations.JobDesignations.FineTuning) { - NotificationProvider.PushNotification(new MessageNotificationItem("Fine tuning completed successfully.", MessageNotificationItem.MessageNotificationItemTypes.Success, () => + NotificationProvider.PushNotification(new MessageNotificationItem(String.Format("'{0}' fine tuning completed successfully", e.Job.Name), "Tap to approve or repeat.", MessageNotificationItem.MessageNotificationItemTypes.Success, () => { NavigationManager.NavigateWithObject<JobsModule, JobView, JobNavigationObject>(new JobNavigationObject() { Job = e.Job, Intent = JobNavigationIntent.FineTuning }); NavigationManager.ClearHistoryExcept<JobsView>(); @@ -48,7 +50,7 @@ namespace Tango.PPC.Jobs.ViewModels } else { - NotificationProvider.PushNotification(new MessageNotificationItem("Job completed successfully.", MessageNotificationItem.MessageNotificationItemTypes.Success, () => + NotificationProvider.PushNotification(new MessageNotificationItem(String.Format("'{0}' completed successfully", e.Job.Name), "Tap to view this job details.", MessageNotificationItem.MessageNotificationItemTypes.Success, () => { NavigationManager.NavigateWithObject<JobsModule, JobView, JobNavigationObject>(new JobNavigationObject() { 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 eb5497bd8..612c850a3 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 @@ -47,8 +47,34 @@ </touch:TouchRingProgress.Style> </touch:TouchRingProgress> - <touch:TouchBusyIndicator Width="360" Height="360" StrokeThickness="10" IsIndeterminate="{Binding RunningJobStatus.IsSettingUp}" Visibility="{Binding RunningJobStatus.IsSettingUp,Converter={StaticResource BooleanToVisibilityConverter}}"> - + <touch:TouchBusyIndicator Width="360" Height="360" StrokeThickness="10" Maximum="100" Visibility="{Binding RunningJobStatus.IsSettingUp,Converter={StaticResource BooleanToVisibilityConverter}}"> + <touch:TouchBusyIndicator.Style> + <Style TargetType="touch:TouchBusyIndicator"> + <Setter Property="Foreground" Value="{StaticResource TangoPrimaryAccentBrush}"></Setter> + <Setter Property="Value" Value="0"></Setter> + <Setter Property="IsIndeterminate" Value="False"></Setter> + <Style.Triggers> + <DataTrigger Binding="{Binding RunningJobStatus.IsSettingUp}" Value="True"> + <Setter Property="Visibility" Value="Visible"></Setter> + <Setter Property="Value" Value="0"></Setter> + <Setter Property="IsIndeterminate" Value="True"></Setter> + </DataTrigger> + <DataTrigger Binding="{Binding RunningJobStatus.IsCompleted}" Value="True"> + <Setter Property="IsIndeterminate" Value="False"></Setter> + </DataTrigger> + <DataTrigger Binding="{Binding RunningJobStatus.IsCanceled}" Value="True"> + <Setter Property="Value" Value="99.9"></Setter> + <Setter Property="IsIndeterminate" Value="False"></Setter> + <Setter Property="Foreground" Value="{StaticResource TangoWarningBrush}"></Setter> + </DataTrigger> + <DataTrigger Binding="{Binding RunningJobStatus.IsFailed}" Value="True"> + <Setter Property="Value" Value="99.9"></Setter> + <Setter Property="IsIndeterminate" Value="False"></Setter> + <Setter Property="Foreground" Value="{StaticResource TangoErrorBrush}"></Setter> + </DataTrigger> + </Style.Triggers> + </Style> + </touch:TouchBusyIndicator.Style> </touch:TouchBusyIndicator> <StackPanel VerticalAlignment="Center" HorizontalAlignment="Center"> diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Common/Notifications/NotificationItems/MessageNotificationItem.cs b/Software/Visual_Studio/PPC/Tango.PPC.Common/Notifications/NotificationItems/MessageNotificationItem.cs index 5e120ab8c..b7f206e7c 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.Common/Notifications/NotificationItems/MessageNotificationItem.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.Common/Notifications/NotificationItems/MessageNotificationItem.cs @@ -23,6 +23,13 @@ namespace Tango.PPC.Common.Notifications.NotificationItems set { _message = value; RaisePropertyChangedAuto(); } } + private String _expandedMessage; + public String ExpandedMessage + { + get { return _expandedMessage; } + set { _expandedMessage = value; RaisePropertyChangedAuto(); } + } + private MessageNotificationItemTypes _messageType; public MessageNotificationItemTypes MessageType @@ -41,14 +48,25 @@ namespace Tango.PPC.Common.Notifications.NotificationItems } - public MessageNotificationItem(String message, MessageNotificationItemTypes type, Action pressed) : this() + public MessageNotificationItem(String message, String expandedMessage, MessageNotificationItemTypes type, Action pressed) : this() { Message = message; + ExpandedMessage = expandedMessage; MessageType = type; Pressed += (_, __) => pressed?.Invoke(); } - public MessageNotificationItem(String message, MessageNotificationItemTypes type) : this(message, type, null) + public MessageNotificationItem(String message, MessageNotificationItemTypes type, Action pressed) : this(message, null, type, pressed) + { + + } + + public MessageNotificationItem(String message, String expandedMessage, MessageNotificationItemTypes type) : this(message, expandedMessage, type, null) + { + + } + + public MessageNotificationItem(String message, MessageNotificationItemTypes type) : this(message, null, type) { } 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 057e86a13..9b583a117 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 @@ -7,7 +7,7 @@ xmlns:local="clr-namespace:Tango.PPC.Common.Notifications.NotificationItems" mc:Ignorable="d" d:DesignHeight="60" d:DesignWidth="800" d:DataContext="{d:DesignInstance Type=local:MessageNotificationItem, IsDesignTimeCreatable=False}" MinHeight="60" Height="60" MaxHeight="150"> - + <ContentControl> <ContentControl.Style> <Style TargetType="ContentControl"> @@ -50,18 +50,12 @@ </Style> </touch:TouchIcon.Style> </touch:TouchIcon> - <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> + + <StackPanel Margin="10 0 0 0" VerticalAlignment="Center"> + <TextBlock Text="{Binding Message}" TextTrimming="CharacterEllipsis" TextWrapping="Wrap"></TextBlock> + + <TextBlock Margin="0 20 0 0" Text="{Binding ExpandedMessage}" TextWrapping="Wrap" Visibility="{Binding IsExpanded,Converter={StaticResource BooleanToVisibilityConverter}}"></TextBlock> + </StackPanel> </DockPanel> </ContentControl> </UserControl> diff --git a/Software/Visual_Studio/Tango.Touch/Controls/TouchBusyIndicator.xaml b/Software/Visual_Studio/Tango.Touch/Controls/TouchBusyIndicator.xaml index fa6a83d50..a3f26aa6e 100644 --- a/Software/Visual_Studio/Tango.Touch/Controls/TouchBusyIndicator.xaml +++ b/Software/Visual_Studio/Tango.Touch/Controls/TouchBusyIndicator.xaml @@ -131,6 +131,15 @@ <RemoveStoryboard BeginStoryboardName="IsFullyIndeterminateStoryboard" /> </MultiTrigger.ExitActions> </MultiTrigger> + <MultiTrigger> + <MultiTrigger.Conditions> + <Condition Property="IsIndeterminate" Value="False" /> + </MultiTrigger.Conditions> + <MultiTrigger.EnterActions> + <RemoveStoryboard BeginStoryboardName="IsIndeterminateStoryboard" /> + <RemoveStoryboard BeginStoryboardName="IsFullyIndeterminateStoryboard" /> + </MultiTrigger.EnterActions> + </MultiTrigger> </ControlTemplate.Triggers> </ControlTemplate> </Setter.Value> diff --git a/Software/Visual_Studio/Tango.Touch/Controls/TouchNotificationBar.cs b/Software/Visual_Studio/Tango.Touch/Controls/TouchNotificationBar.cs index 3cd3c1078..299844c1e 100644 --- a/Software/Visual_Studio/Tango.Touch/Controls/TouchNotificationBar.cs +++ b/Software/Visual_Studio/Tango.Touch/Controls/TouchNotificationBar.cs @@ -39,6 +39,7 @@ namespace Tango.Touch.Controls private Grid _grid_container; private Grid _grid_mask; private ItemsControl _items_control; + private Grid _notification_counter_grid; static TouchNotificationBar() { @@ -117,6 +118,7 @@ namespace Tango.Touch.Controls _grid_container = GetTemplateChild("PART_Grid_Container") as Grid; _grid_mask = GetTemplateChild("PART_GridMask") as Grid; _items_control = GetTemplateChild("PART_ItemsControl") as ItemsControl; + _notification_counter_grid = GetTemplateChild("PART_NotificationCounterGrid") as Grid; //border_notifications.IsManipulationEnabled = true; _border_drag.RegisterForPreviewMouseOrTouchDown(GridNotificationMouseDown); @@ -161,6 +163,15 @@ namespace Tango.Touch.Controls _grid_mask.Opacity = _border_drag.ActualHeight / ActualHeight; ResizeNotifications(); + + if (e.NewSize.Height > CurrentMinHeight) + { + _notification_counter_grid.Visibility = Visibility.Hidden; + } + else + { + _notification_counter_grid.Visibility = Visibility.Visible; + } } private void ResizeNotifications() diff --git a/Software/Visual_Studio/Tango.Touch/Controls/TouchNotificationBar.xaml b/Software/Visual_Studio/Tango.Touch/Controls/TouchNotificationBar.xaml index 6c511363e..15ea569a0 100644 --- a/Software/Visual_Studio/Tango.Touch/Controls/TouchNotificationBar.xaml +++ b/Software/Visual_Studio/Tango.Touch/Controls/TouchNotificationBar.xaml @@ -1,11 +1,14 @@ <ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" + xmlns:converters="clr-namespace:Tango.SharedUI.Converters;assembly=Tango.SharedUI" xmlns:local="clr-namespace:Tango.Touch.Controls"> <ResourceDictionary.MergedDictionaries> <ResourceDictionary Source="../Resources/Colors.xaml" /> </ResourceDictionary.MergedDictionaries> + <converters:GreaterThanToBooleanConverter x:Key="GreaterThanToBooleanConverter" /> + <Style TargetType="{x:Type local:TouchNotificationBar}"> <Setter Property="Template"> <Setter.Value> @@ -41,6 +44,24 @@ </ItemsControl> </Border> </Border> + + <Grid x:Name="PART_NotificationCounterGrid" Canvas.Left="85" Canvas.Top="45" Width="32" Height="32" HorizontalAlignment="Left" VerticalAlignment="Bottom" IsHitTestVisible="False"> + <Grid> + <Grid.Style> + <Style TargetType="Grid"> + <Setter Property="Visibility" Value="Collapsed"></Setter> + <Style.Triggers> + <DataTrigger Binding="{Binding RelativeSource={RelativeSource AncestorType=local:TouchNotificationBar},Path=Notifications.Count,Converter={StaticResource GreaterThanToBooleanConverter},ConverterParameter=1}" Value="True"> + <Setter Property="Visibility" Value="Visible"></Setter> + </DataTrigger> + </Style.Triggers> + </Style> + </Grid.Style> + <Ellipse Fill="White" StrokeThickness="1" Stroke="{StaticResource TangoPrimaryAccentBrush}"> + </Ellipse> + <TextBlock HorizontalAlignment="Center" VerticalAlignment="Center" Text="{Binding RelativeSource={RelativeSource AncestorType=local:TouchNotificationBar},Path=Notifications.Count}"></TextBlock> + </Grid> + </Grid> </Canvas> </Grid> </Grid> |
