diff options
Diffstat (limited to 'Software/Visual_Studio/PPC/Tango.PPC.UI')
7 files changed, 186 insertions, 6 deletions
diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/Dialogs/FirmwareNotificationView.xaml b/Software/Visual_Studio/PPC/Tango.PPC.UI/Dialogs/FirmwareNotificationView.xaml new file mode 100644 index 000000000..6951ce0ad --- /dev/null +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/Dialogs/FirmwareNotificationView.xaml @@ -0,0 +1,55 @@ +<UserControl x:Class="Tango.PPC.UI.Dialogs.FirmwareNotificationView" + 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:d="http://schemas.microsoft.com/expression/blend/2008" + xmlns:touch="clr-namespace:Tango.Touch.Controls;assembly=Tango.Touch" + xmlns:local="clr-namespace:Tango.PPC.UI.Dialogs" + mc:Ignorable="d" + Background="{StaticResource TangoPrimaryBackgroundBrush}" d:DesignHeight="555" d:DesignWidth="560" Width="570" Height="600" d:DataContext="{d:DesignInstance Type=local:FirmwareNotificationViewVM, IsDesignTimeCreatable=False}"> + <Grid Margin="20"> + <DockPanel> + <Grid DockPanel.Dock="Bottom"> + <touch:TouchButton HorizontalAlignment="Right" CornerRadius="25" Command="{Binding CloseCommand}" Style="{StaticResource TangoHollowButton}" Width="150" Height="50" VerticalAlignment="Bottom">CLOSE</touch:TouchButton> + </Grid> + <StackPanel DockPanel.Dock="Top"> + <touch:TouchIcon DockPanel.Dock="Left" MaxHeight="100"> + <touch:TouchIcon.Style> + <Style TargetType="touch:TouchIcon"> + <Setter Property="Icon" Value="Information"></Setter> + <Style.Triggers> + <DataTrigger Binding="{Binding Type}" Value="NotifyInfo"> + <Setter Property="Icon" Value="Information"></Setter> + <Setter Property="Foreground" Value="{StaticResource TangoDarkForegroundBrush}"></Setter> + </DataTrigger> + <DataTrigger Binding="{Binding Type}" Value="NotifySuccess"> + <Setter Property="Icon" Value="Check"></Setter> + <Setter Property="Foreground" Value="{StaticResource TangoSuccessBrush}"></Setter> + </DataTrigger> + <DataTrigger Binding="{Binding Type}" Value="NotifyWarning"> + <Setter Property="Icon" Value="AlertCircleOutline"></Setter> + <Setter Property="Foreground" Value="{StaticResource TangoWarningBrush}"></Setter> + </DataTrigger> + <DataTrigger Binding="{Binding Type}" Value="NotifyError"> + <Setter Property="Icon" Value="AlertCircleOutline"></Setter> + <Setter Property="Foreground" Value="{StaticResource TangoErrorBrush}"></Setter> + </DataTrigger> + <DataTrigger Binding="{Binding Type}" Value="NotifyCritical"> + <Setter Property="Icon" Value="Alert"></Setter> + <Setter Property="Foreground" Value="{StaticResource TangoErrorBrush}"></Setter> + </DataTrigger> + </Style.Triggers> + </Style> + </touch:TouchIcon.Style> + </touch:TouchIcon> + <TextBlock HorizontalAlignment="Center" Margin="0 20 0 0" FontSize="{StaticResource TangoHeaderFontSize}" Text="{Binding Title}"></TextBlock> + <TextBlock Margin="20 10" HorizontalAlignment="Center" TextWrapping="Wrap" TextAlignment="Center" Text="{Binding Message}"> + + </TextBlock> + </StackPanel> + <Grid> + + </Grid> + </DockPanel> + </Grid> +</UserControl> diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/Dialogs/FirmwareNotificationView.xaml.cs b/Software/Visual_Studio/PPC/Tango.PPC.UI/Dialogs/FirmwareNotificationView.xaml.cs new file mode 100644 index 000000000..ba264c8a4 --- /dev/null +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/Dialogs/FirmwareNotificationView.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 SpoolReplaceView.xaml + /// </summary> + public partial class FirmwareNotificationView : UserControl + { + public FirmwareNotificationView() + { + InitializeComponent(); + } + } +} diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/Dialogs/FirmwareNotificationViewVM.cs b/Software/Visual_Studio/PPC/Tango.PPC.UI/Dialogs/FirmwareNotificationViewVM.cs new file mode 100644 index 000000000..dd3989566 --- /dev/null +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/Dialogs/FirmwareNotificationViewVM.cs @@ -0,0 +1,22 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Tango.PMR.MachineStatus; +using Tango.SharedUI; + +namespace Tango.PPC.UI.Dialogs +{ + public class FirmwareNotificationViewVM : DialogViewVM + { + public NotificationType Type { get; set; } + public String Title { get; set; } + public String Message { get; set; } + + public FirmwareNotificationViewVM() + { + + } + } +} diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/Dialogs/GeneralInformationView.xaml b/Software/Visual_Studio/PPC/Tango.PPC.UI/Dialogs/GeneralInformationView.xaml index 85d905841..c7b7e2952 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.UI/Dialogs/GeneralInformationView.xaml +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/Dialogs/GeneralInformationView.xaml @@ -55,6 +55,21 @@ </Paragraph> </TableCell> </TableRow> + + <TableRow> + <TableCell> + <Paragraph> + <TextBlock>Machine Name:</TextBlock> + </Paragraph> + </TableCell> + + <TableCell> + <Paragraph> + <TextBlock Text="{Binding MachineProvider.Machine.Name,Mode=OneWay,IsAsync=True,FallbackValue='N/A'}"/> + </Paragraph> + </TableCell> + </TableRow> + <TableRow> <TableCell> <Paragraph> 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 f0a513cb5..31c46b296 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 @@ -225,6 +225,10 @@ <DependentUpon>JerricanReplaceView.xaml</DependentUpon> </Compile> <Compile Include="Dialogs\JerricanReplaceViewVM.cs" /> + <Compile Include="Dialogs\FirmwareNotificationView.xaml.cs"> + <DependentUpon>FirmwareNotificationView.xaml</DependentUpon> + </Compile> + <Compile Include="Dialogs\FirmwareNotificationViewVM.cs" /> <Compile Include="Dialogs\WasteReplacementViewVM.cs" /> <Compile Include="Dialogs\WasteReplacementView.xaml.cs"> <DependentUpon>WasteReplacementView.xaml</DependentUpon> @@ -405,6 +409,10 @@ <Generator>MSBuild:Compile</Generator> <SubType>Designer</SubType> </Page> + <Page Include="Dialogs\FirmwareNotificationView.xaml"> + <Generator>MSBuild:Compile</Generator> + <SubType>Designer</SubType> + </Page> <Page Include="Dialogs\WasteReplacementView.xaml"> <Generator>MSBuild:Compile</Generator> <SubType>Designer</SubType> @@ -1035,7 +1043,7 @@ if $(ConfigurationName) == X1 copy /Y "$(ProjectDir)Intro.wmv" "$(TargetDir)" </PropertyGroup> <ProjectExtensions> <VisualStudio> - <UserProperties BuildVersion_AssemblyInfoFilename="Properties\AssemblyInfo.cs" BuildVersion_UpdateAssemblyVersion="True" BuildVersion_BuildVersioningStyle="None.None.Increment.TimeStamp" BuildVersion_UseGlobalSettings="False" BuildVersion_StartDate="2000/1/1" /> + <UserProperties BuildVersion_StartDate="2000/1/1" BuildVersion_UseGlobalSettings="False" BuildVersion_BuildVersioningStyle="None.None.Increment.TimeStamp" BuildVersion_UpdateAssemblyVersion="True" BuildVersion_AssemblyInfoFilename="Properties\AssemblyInfo.cs" /> </VisualStudio> </ProjectExtensions> <Import Project="..\..\packages\WPFMediaKit.2.2.0\build\WPFMediaKit.targets" Condition="Exists('..\..\packages\WPFMediaKit.2.2.0\build\WPFMediaKit.targets')" /> 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 67b007371..33e5239b0 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/MainViewVM.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/MainViewVM.cs @@ -25,6 +25,7 @@ using Tango.PPC.UI.AppBarItems; using Tango.PPC.Common.Notifications.NotificationItems; using Tango.Core.Commands; using System.Timers; +using Tango.PMR.MachineStatus; namespace Tango.PPC.UI.ViewModels { @@ -104,16 +105,18 @@ namespace Tango.PPC.UI.ViewModels _screenSaverTimer.Elapsed += _screenSaverTimer_Elapsed; _screenSaverTimer.Start(); + + MachineProvider.MachineOperator.NotificationAvailable += MachineOperator_NotificationAvailable; } #region Waste Replacement private void MachineOperator_WasteReplacementRequired(object sender, EventArgs e) { - InvokeUI(async () => + InvokeUI(async () => { var vm = await NotificationProvider.ShowDialog<WasteReplacementViewVM>(); - + if (MachineProvider.IsConnected) { try @@ -298,7 +301,7 @@ namespace Tango.PPC.UI.ViewModels private void MachineOperator_ThreadLoadingConfirmationRequired(object sender, ThreadLoadingConfirmationRequiredEventArgs e) { -// DisplayThreadLoading(e); + // DisplayThreadLoading(e); } #endregion @@ -340,7 +343,56 @@ namespace Tango.PPC.UI.ViewModels IsScreenSaverOn = true; } } - + + #endregion + + #region Firmware Notifications + + private void MachineOperator_NotificationAvailable(object sender, PMR.MachineStatus.StartNotificationResponse e) + { + InvokeUI(async () => + { + if (!e.IsBlocking) + { + NotificationProvider.PushNotification(new MessageNotificationItem() + { + CanClose = true, + MessageType = ConvertNotificationToMessageType(e.Type), + Message = e.Title, + ExpandedMessage = e.Message + }); + } + else + { + await NotificationProvider.ShowDialog<FirmwareNotificationViewVM>(new FirmwareNotificationViewVM() + { + Type = e.Type, + Title = e.Title, + Message = e.Message + }); + } + }); + } + + private MessageNotificationItem.MessageNotificationItemTypes ConvertNotificationToMessageType(NotificationType type) + { + switch (type) + { + case NotificationType.NotifyInfo: + return MessageNotificationItem.MessageNotificationItemTypes.Info; + case NotificationType.NotifyWarning: + return MessageNotificationItem.MessageNotificationItemTypes.Warning; + case NotificationType.NotifyError: + return MessageNotificationItem.MessageNotificationItemTypes.Error; + case NotificationType.NotifyCritical: + return MessageNotificationItem.MessageNotificationItemTypes.Critical; + case NotificationType.NotifySuccess: + return MessageNotificationItem.MessageNotificationItemTypes.Success; + default: + return MessageNotificationItem.MessageNotificationItemTypes.Info; + } + } + #endregion } } diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/app.manifest b/Software/Visual_Studio/PPC/Tango.PPC.UI/app.manifest index d72e75011..efc5f8179 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.UI/app.manifest +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/app.manifest @@ -16,7 +16,7 @@ Remove this element if your application requires this virtualization for backwards compatibility. --> - <requestedExecutionLevel level="requireAdministrator" uiAccess="false" /> + <!--<requestedExecutionLevel level="requireAdministrator" uiAccess="false" />--> </requestedPrivileges> </security> </trustInfo> |
