diff options
| author | Roy Ben-Shabat <Roy@Twine-s.com> | 2019-08-22 11:58:11 +0300 |
|---|---|---|
| committer | Roy Ben-Shabat <Roy@Twine-s.com> | 2019-08-22 11:58:11 +0300 |
| commit | 0c97dba8c1443ee39029136c52bc3861702888e2 (patch) | |
| tree | 0eba2c6e9a170bb316045f67add60060734d4f0d /Software/Visual_Studio/PPC | |
| parent | 884fce5075ca6a53cb5687feb0b01c6db0802f06 (diff) | |
| download | Tango-0c97dba8c1443ee39029136c52bc3861702888e2.tar.gz Tango-0c97dba8c1443ee39029136c52bc3861702888e2.zip | |
Added cartridge insertion validation handling.
Implemented a better keep alive mechanism.
Diffstat (limited to 'Software/Visual_Studio/PPC')
9 files changed, 174 insertions, 3 deletions
diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Tango.PPC.Jobs.csproj b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Tango.PPC.Jobs.csproj index 8ed2ff80e..26fd06d2d 100644 --- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Tango.PPC.Jobs.csproj +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Tango.PPC.Jobs.csproj @@ -472,7 +472,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/Tango.PPC.Common/Resources/Merged.xaml b/Software/Visual_Studio/PPC/Tango.PPC.Common/Resources/Merged.xaml index b5b9f9b23..04021d6b6 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.Common/Resources/Merged.xaml +++ b/Software/Visual_Studio/PPC/Tango.PPC.Common/Resources/Merged.xaml @@ -49,6 +49,7 @@ <converters:NullObjectToBooleanConverter x:Key="NullObjectToBooleanConverter" /> <converters:IsNullToVisibilityConverter x:Key="IsNullToVisibilityConverter" /> <converters:StringToLinesConverter x:Key="StringToLinesConverter" /> + <converters:ColorToIntegerConverter x:Key="ColorToIntegerConverter" /> <Style TargetType="FrameworkElement"> <Setter Property="TextElement.FontFamily" Value="{StaticResource TangoFlexoFontFamily}"></Setter> diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/Dialogs/CartridgeValidationView.xaml b/Software/Visual_Studio/PPC/Tango.PPC.UI/Dialogs/CartridgeValidationView.xaml new file mode 100644 index 000000000..e0c7ccbb6 --- /dev/null +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/Dialogs/CartridgeValidationView.xaml @@ -0,0 +1,67 @@ +<UserControl x:Class="Tango.PPC.UI.Dialogs.CartridgeValidationView" + 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:local="clr-namespace:Tango.PPC.UI.Dialogs" + xmlns:entities="clr-namespace:Tango.BL.Entities;assembly=Tango.BL" + xmlns:touch="clr-namespace:Tango.Touch.Controls;assembly=Tango.Touch" + xmlns:d="http://schemas.microsoft.com/expression/blend/2008" + mc:Ignorable="d" + Background="{StaticResource TangoPrimaryBackgroundBrush}" d:DesignHeight="555" d:DesignWidth="560" Width="570" Height="700" d:DataContext="{d:DesignInstance Type=local:CartridgeValidationViewVM, IsDesignTimeCreatable=False}"> + + <Grid Margin="20"> + <DockPanel> + <Grid DockPanel.Dock="Bottom"> + <touch:TouchButton HorizontalAlignment="Left" CornerRadius="25" Command="{Binding CloseCommand}" Style="{StaticResource TangoHollowButton}" Width="150" Height="50" VerticalAlignment="Bottom">CANCEL</touch:TouchButton> + <touch:TouchButton HorizontalAlignment="Right" CornerRadius="25" Command="{Binding OKCommand}" Style="{StaticResource TangoHollowButton}" Width="150" Height="50" VerticalAlignment="Bottom">CONFIRM</touch:TouchButton> + </Grid> + <StackPanel DockPanel.Dock="Top"> + <Image Source="/Images/cartridge_validation.png" RenderOptions.BitmapScalingMode="Fant" Stretch="Uniform" Height="120"></Image> + <TextBlock HorizontalAlignment="Center" Margin="0 20 0 0" FontSize="{StaticResource TangoHeaderFontSize}">Validate Cartridge Type</TextBlock> + <TextBlock Margin="20 10" HorizontalAlignment="Center" TextWrapping="Wrap" TextAlignment="Center"> + Ink cartridge has been inserted to the system. Please validate the cartridge ink by selecting the correct color. + </TextBlock> + </StackPanel> + <Grid> + <touch:TouchStaticListBox HorizontalAlignment="Center" VerticalAlignment="Center" ItemsSource="{Binding IDSPacks}" SelectedItem="{Binding SelectedIDSPack}"> + <touch:TouchStaticListBox.ItemsPanel> + <ItemsPanelTemplate> + <WrapPanel /> + </ItemsPanelTemplate> + </touch:TouchStaticListBox.ItemsPanel> + <touch:TouchStaticListBox.ItemContainerStyle> + <Style TargetType="touch:TouchStaticListBoxItem"> + <Setter Property="RenderTransformOrigin" Value="0.5,0.5"></Setter> + <Setter Property="RenderTransform"> + <Setter.Value> + <ScaleTransform ScaleX="1" ScaleY="1"></ScaleTransform> + </Setter.Value> + </Setter> + <Style.Triggers> + <Trigger Property="IsSelected" Value="True"> + <Setter Property="RenderTransform"> + <Setter.Value> + <ScaleTransform ScaleX="1.2" ScaleY="1.2"></ScaleTransform> + </Setter.Value> + </Setter> + </Trigger> + </Style.Triggers> + </Style> + </touch:TouchStaticListBox.ItemContainerStyle> + <touch:TouchStaticListBox.ItemTemplate> + <DataTemplate DataType="{x:Type entities:IdsPack}"> + <StackPanel Margin="15" Width="70"> + <Ellipse Width="70" Height="70"> + <Ellipse.Fill> + <SolidColorBrush Color="{Binding LiquidType.Color,Converter={StaticResource ColorToIntegerConverter}}"></SolidColorBrush> + </Ellipse.Fill> + </Ellipse> + <TextBlock Text="{Binding LiquidType.Name}" TextWrapping="Wrap" HorizontalAlignment="Center" Margin="0 10 0 0"></TextBlock> + </StackPanel> + </DataTemplate> + </touch:TouchStaticListBox.ItemTemplate> + </touch:TouchStaticListBox> + </Grid> + </DockPanel> + </Grid> +</UserControl> diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/Dialogs/CartridgeValidationView.xaml.cs b/Software/Visual_Studio/PPC/Tango.PPC.UI/Dialogs/CartridgeValidationView.xaml.cs new file mode 100644 index 000000000..dbfb990b6 --- /dev/null +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/Dialogs/CartridgeValidationView.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.UI.Dialogs +{ + /// <summary> + /// Interaction logic for TechnicianModeLoginView.xaml + /// </summary> + public partial class CartridgeValidationView : UserControl + { + public CartridgeValidationView() + { + InitializeComponent(); + } + } +} diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/Dialogs/CartridgeValidationViewVM.cs b/Software/Visual_Studio/PPC/Tango.PPC.UI/Dialogs/CartridgeValidationViewVM.cs new file mode 100644 index 000000000..f901723a4 --- /dev/null +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/Dialogs/CartridgeValidationViewVM.cs @@ -0,0 +1,37 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Tango.BL.Entities; +using Tango.SharedUI; + +namespace Tango.PPC.UI.Dialogs +{ + public class CartridgeValidationViewVM : DialogViewVM + { + private List<IdsPack> _idsPacks; + public List<IdsPack> IDSPacks + { + get { return _idsPacks; } + set { _idsPacks = value; RaisePropertyChangedAuto(); } + } + + private IdsPack _selectedIDSPack; + public IdsPack SelectedIDSPack + { + get { return _selectedIDSPack; } + set { _selectedIDSPack = value; RaisePropertyChangedAuto(); InvalidateRelayCommands(); } + } + + public CartridgeValidationViewVM() + { + IDSPacks = new List<IdsPack>(); + } + + protected override bool CanOK() + { + return base.CanOK() && SelectedIDSPack != null; + } + } +} diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/Images/cartridge_validation.png b/Software/Visual_Studio/PPC/Tango.PPC.UI/Images/cartridge_validation.png Binary files differnew file mode 100644 index 000000000..373cb78c1 --- /dev/null +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/Images/cartridge_validation.png diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/Notifications/DefaultNotificationProvider.cs b/Software/Visual_Studio/PPC/Tango.PPC.UI/Notifications/DefaultNotificationProvider.cs index 5062df1d6..1c71b080d 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.UI/Notifications/DefaultNotificationProvider.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/Notifications/DefaultNotificationProvider.cs @@ -388,7 +388,7 @@ namespace Tango.PPC.UI.Notifications throw new NullReferenceException("The view " + viewType.ToString() + " is not of type framework element."); } - return ShowDialog<T>(datacontext, Activator.CreateInstance(viewType) as FrameworkElement); + return ShowDialog<T>(datacontext, view); } /// <summary> diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/Tango.PPC.UI.csproj b/Software/Visual_Studio/PPC/Tango.PPC.UI/Tango.PPC.UI.csproj index 389f5d59b..c2025b733 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.UI/Tango.PPC.UI.csproj +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/Tango.PPC.UI.csproj @@ -122,9 +122,13 @@ <Compile Include="Connectivity\WiFiAuthenticationViewVM.cs" /> <Compile Include="Converters\AppBarItemConverter.cs" /> <Compile Include="Converters\ItemBaseConverter.cs" /> + <Compile Include="Dialogs\CartridgeValidationView.xaml.cs"> + <DependentUpon>CartridgeValidationView.xaml</DependentUpon> + </Compile> <Compile Include="Dialogs\ScreenLockView.xaml.cs"> <DependentUpon>ScreenLockView.xaml</DependentUpon> </Compile> + <Compile Include="Dialogs\CartridgeValidationViewVM.cs" /> <Compile Include="Dialogs\TechnicianModeLoginView.xaml.cs"> <DependentUpon>TechnicianModeLoginView.xaml</DependentUpon> </Compile> @@ -194,6 +198,10 @@ <SubType>Designer</SubType> <Generator>MSBuild:Compile</Generator> </Page> + <Page Include="Dialogs\CartridgeValidationView.xaml"> + <Generator>MSBuild:Compile</Generator> + <SubType>Designer</SubType> + </Page> <Page Include="Dialogs\ScreenLockView.xaml"> <Generator>MSBuild:Compile</Generator> <SubType>Designer</SubType> @@ -311,6 +319,7 @@ <Resource Include="Images\GlobalStatus\service_Anim.gif" /> <Resource Include="Images\GlobalStatus\shutdown_icon_Anim.gif" /> <Resource Include="Images\GlobalStatus\standby_Anim.gif" /> + <Resource Include="Images\cartridge_validation.png" /> <Content Include="Manifests\release.xml" /> <Content Include="Manifests\debug.xml" /> <None Include="packages.config" /> @@ -546,7 +555,7 @@ del "$(TargetDir)firmware_package.tfp"</PostBuildEvent> </PropertyGroup> <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/Tango.PPC.UI/ViewModels/MainViewVM.cs b/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/MainViewVM.cs index a4f550a39..01a47539e 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/MainViewVM.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/MainViewVM.cs @@ -6,6 +6,7 @@ using System.Threading.Tasks; using System.Windows.Threading; using Tango.Core.DI; using Tango.Integration.ExternalBridge; +using Tango.Integration.Operation; using Tango.PPC.Common; using Tango.PPC.Common.Application; using Tango.PPC.Common.Authentication; @@ -14,6 +15,7 @@ using Tango.PPC.Common.Modules; using Tango.PPC.Common.Navigation; using Tango.PPC.Common.Notifications; using Tango.PPC.Common.WatchDog; +using Tango.PPC.UI.Dialogs; using Tango.SharedUI; namespace Tango.PPC.UI.ViewModels @@ -49,6 +51,13 @@ namespace Tango.PPC.UI.ViewModels /// </summary> public override void OnApplicationStarted() { + + } + + public override void OnApplicationReady() + { + base.OnApplicationReady(); + MachineProvider.MachineOperator.CartridgeValidationRequestReceived += MachineOperator_CartridgeValidationRequestReceived; } #region Event Handlers @@ -63,6 +72,26 @@ namespace Tango.PPC.UI.ViewModels CurrentDateTime = DateTime.Now; } + private void MachineOperator_CartridgeValidationRequestReceived(object sender, CartridgeValidationEventArgs e) + { + InvokeUI(async () => + { + var vm = await NotificationProvider.ShowDialog<CartridgeValidationViewVM>(new CartridgeValidationViewVM() + { + IDSPacks = MachineProvider.Machine.Configuration.NoneEmptyIdsPacks.ToList(), + }); + + if (vm.DialogResult) + { + e.Approve(vm.SelectedIDSPack.PackIndex); + } + else + { + e.Decline(); + } + }); + } + #endregion } } |
