diff options
| author | Victoria Plitt <Victoria.Plitt@twine-s.com> | 2023-06-06 14:56:59 +0300 |
|---|---|---|
| committer | Victoria Plitt <Victoria.Plitt@twine-s.com> | 2023-06-06 14:56:59 +0300 |
| commit | 54624e4a90a240ad702995e1ed551901768e131f (patch) | |
| tree | 48ebd2cdf3024622dfa8717dfb6cf866a01b9de6 /Software/Visual_Studio | |
| parent | 6ebf2ef8590a3f58b77c2b05e8c49c409b75a040 (diff) | |
| download | Tango-54624e4a90a240ad702995e1ed551901768e131f.tar.gz Tango-54624e4a90a240ad702995e1ed551901768e131f.zip | |
Open Notifications bar when an error happens
Related Work Items: #8534
Diffstat (limited to 'Software/Visual_Studio')
3 files changed, 39 insertions, 7 deletions
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 52199fcca..2563cb331 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/MachineStatusViewVM.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/MachineStatusViewVM.cs @@ -217,6 +217,17 @@ namespace Tango.PPC.UI.ViewModels public MachineOverviewErrorStates MachineErrorStates { get; set; } + private bool _isExpandedNotificatios; + + public bool IsExpandedNotifications + { + get { return _isExpandedNotificatios; } + set { + _isExpandedNotificatios = value; + RaisePropertyChangedAuto();} + } + + #endregion #region Commands @@ -265,11 +276,14 @@ namespace Tango.PPC.UI.ViewModels OverviewModel = new MachineOverviewModel(); MachineErrorStates = new MachineOverviewErrorStates(); + + IsExpandedNotifications = false; } public override void OnApplicationReady() { base.OnApplicationReady(); + EventLogger.EventReceived += EventLogger_EventReceived; MidTankLevels = MachineProvider.Machine.Configuration.NoneEmptyIdsPacks.Where(x => x.MidTankType.HasLevelMeasure ).OrderBy(x => x.PackIndex).Select(x => new JerricanLevelModel() { @@ -291,7 +305,18 @@ namespace Tango.PPC.UI.ViewModels #region Events - private void MachineOperator_MachineStatusChanged(object sender, MachineStatus status) + private void EventLogger_EventReceived(object sender, MachinesEvent ev) + { + InvokeUI(() => + { + if (ev.Category == EventTypeCategories.Error || ev.Category == EventTypeCategories.Critical) + { + IsExpandedNotifications = true; + } + }); + } + + private void MachineOperator_MachineStatusChanged(object sender, MachineStatus status) { UpdateMidTankLevels(status); UpdateMachineStatusErrors(status); 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 1cdc39973..536682bf9 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.UI/Views/MachineStatusView.xaml +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/Views/MachineStatusView.xaml @@ -1201,7 +1201,7 @@ </Grid> </Grid> <Grid VerticalAlignment="Bottom" Grid.ColumnSpan="2" Margin="10 0 2 0"> - <touch:TouchExpander x:Name="Notifications" Style="{StaticResource TouchRoundedExpander}" IsTabStop="False" KeyboardNavigation.TabNavigation ="None" BorderThickness="0 0 0 0" IsExpanded="false" CornerRadius="20 20 0 0" Margin="0 0 0 -1"> + <touch:TouchExpander x:Name="Notifications" Style="{StaticResource TouchRoundedExpander}" IsTabStop="False" KeyboardNavigation.TabNavigation ="None" BorderThickness="0 0 0 0" CornerRadius="20 20 0 0" Margin="0 0 0 -1" IsExpanded="{Binding IsExpandedNotifications, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"> <touch:TouchExpander.Header> <DockPanel > <touch:TouchButton Margin="0 0 20 0" Content="Clear All" DockPanel.Dock="Right" Width="120" Height="38" HorizontalAlignment="Right" VerticalAlignment="Center" EnableDropShadow="False" Background="Transparent" BorderThickness="1" CornerRadius="19" BorderBrush="{StaticResource TangoPrimaryAccentBrush}" Foreground="{StaticResource TangoPrimaryAccentBrush}" Command="{Binding ClearAllNotificationsCommand}" Visibility="{Binding NotificationProvider.HasNotificationItems, Converter={StaticResource BooleanToVisibilityConverter}}" > @@ -1244,13 +1244,13 @@ </ItemsControl.ItemsPanel> <ItemsControl.ItemTemplate> <DataTemplate> - <Grid HorizontalAlignment="Stretch" Width="1220" Height="62"> + <Grid HorizontalAlignment="Stretch" Height="90"> <Border BorderThickness="1" Margin="-1 0 0 0" BorderBrush="{StaticResource TangoDividerBrush}"> <Grid HorizontalAlignment="Stretch" > <Grid.ColumnDefinitions> <ColumnDefinition Width="56"/> <ColumnDefinition Width="1*"/> - <ColumnDefinition Width="56"/> + <ColumnDefinition Width="Auto"/> </Grid.ColumnDefinitions> <touch:TouchIcon Margin="24 0 0 0" DockPanel.Dock="Left" Height="32" Grid.Column="0"> <touch:TouchIcon.Style> @@ -1281,10 +1281,12 @@ </Style> </touch:TouchIcon.Style> </touch:TouchIcon> - <StackPanel Margin="15 3 20 3" VerticalAlignment="Center" Grid.Column="1"> + + <StackPanel Margin="15 3 10 5" VerticalAlignment="Center" Grid.Column="1"> <TextBlock Text="{Binding Message}" TextTrimming="CharacterEllipsis" TextWrapping="Wrap" Foreground="Black" VerticalAlignment="Center" ></TextBlock> - <TextBlock Margin="0 5 0 0" Foreground="{StaticResource TangoDarkForegroundBrush}" Text="{Binding ExpandedMessage}" FontSize="{StaticResource TangoSmallFontSize}" TextWrapping="Wrap" VerticalAlignment="Center" /> + <TextBlock Margin="0 5 0 0" Foreground="{StaticResource TangoDarkForegroundBrush}" Text="{Binding ExpandedMessage}" FontSize="{StaticResource TangoSmallFontSize}" TextWrapping="Wrap" VerticalAlignment="Center" HorizontalAlignment="Left"/> </StackPanel> + <Grid Grid.Column="2" Width="40" HorizontalAlignment="Right" VerticalAlignment="Stretch" Visibility="{Binding CanClose,Converter={StaticResource BooleanToVisibilityConverter}}"> <Grid Margin="0 0 20 0" HorizontalAlignment="Right" VerticalAlignment="Center" Width="14" Height="14"> <touch:TouchIcon Icon="Close" Foreground="Black" /> diff --git a/Software/Visual_Studio/Tango.Touch/Controls/TouchExpander.cs b/Software/Visual_Studio/Tango.Touch/Controls/TouchExpander.cs index b85be6c49..80974bd4a 100644 --- a/Software/Visual_Studio/Tango.Touch/Controls/TouchExpander.cs +++ b/Software/Visual_Studio/Tango.Touch/Controls/TouchExpander.cs @@ -39,7 +39,12 @@ namespace Tango.Touch.Controls set { SetValue(IsExpandedProperty, value); } } public static readonly DependencyProperty IsExpandedProperty = - DependencyProperty.Register("IsExpanded", typeof(bool), typeof(TouchExpander), new PropertyMetadata(false)); + DependencyProperty.Register("IsExpanded", typeof(bool), typeof(TouchExpander), new FrameworkPropertyMetadata + { + DefaultValue = false, + BindsTwoWayByDefault = true, + DefaultUpdateSourceTrigger = UpdateSourceTrigger.PropertyChanged + }); static TouchExpander() { |
