diff options
16 files changed, 375 insertions, 54 deletions
diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Models/JobModel.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Models/JobModel.cs index 42817daaa..f0705ac6e 100644 --- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Models/JobModel.cs +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Models/JobModel.cs @@ -360,30 +360,34 @@ namespace Tango.PPC.Jobs.Models { _numberSpools = value; RaisePropertyChangedAuto(); - RaisePropertyChanged(nameof(NumberOfUnitsMultipliedBySpools)); + OnNumberOfSpoolsChanged(); + RaisePropertyChanged(nameof(Copies)); + RaisePropertyChanged(nameof(LengthIncludingNumberOfUnits)); + RaisePropertyChanged(nameof(LengthIncludingNumberOfUnitsAndSpools)); } } } - protected Int32 _numberOfUnitsMultipliedBySpools; + protected Int32 _copies; [JsonIgnore] - public Int32 NumberOfUnitsMultipliedBySpools + public Int32 Copies //_numberOfUnitsMultipliedBySpools { get { - return _numberOfUnitsMultipliedBySpools; + return _copies; } set { - if (_numberOfUnitsMultipliedBySpools != value) + if (_copies != value) { - _numberOfUnitsMultipliedBySpools = value; + _copies = value; RaisePropertyChangedAuto(); if (NumberSpools>=4) { - NumberOfUnits = _numberOfUnitsMultipliedBySpools/ NumberSpools; - RaisePropertyChanged(nameof(LengthIncludingNumberOfUnitsAndSpools)); + NumberOfUnits = _copies / NumberSpools; + RaisePropertyChanged(nameof(LengthIncludingNumberOfUnits)); + RaisePropertyChanged(nameof(LengthIncludingNumberOfUnitsAndSpools)); } } } @@ -1077,6 +1081,15 @@ namespace Tango.PPC.Jobs.Models _preventChange = false; OnLengthChanged(); } + + private void OnNumberOfSpoolsChanged() + { + if(NumberSpools > 0) + { + int coeff = (int)(Copies + NumberSpools -1) / NumberSpools; + Copies = coeff * NumberSpools; + } + } #endregion diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Views/JobEurekaView.xaml b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Views/JobEurekaView.xaml index ab34b33f3..987314d3f 100644 --- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Views/JobEurekaView.xaml +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Views/JobEurekaView.xaml @@ -883,7 +883,7 @@ <StackPanel Orientation="Horizontal"> <TextBlock HorizontalAlignment="Left" Margin="0 10 0 0" Text="Copies" FontSize="{StaticResource TangoButtonFontSize}" Width="145"/> <Border Margin="20 0 0 0" BorderThickness="1" Height="44" CornerRadius="12" BorderBrush="{StaticResource TangoMidAccentBrush}" Width="120"> - <touch:TouchNumericTextBox BorderBrush="Transparent" HasDecimalPoint="False" Minimum="4" Step="4" Margin="0 0 0 0" FontSize="{StaticResource TangoComboBoxItemFontSize}" VerticalContentAlignment="Center" VerticalAlignment="Center" HorizontalAlignment="Center" Value="{Binding JobModel.NumberOfUnitsMultipliedBySpools}" HideUnderline="True" RippleBrush="Transparent"></touch:TouchNumericTextBox> + <touch:TouchNumericTextBox BorderBrush="Transparent" HasDecimalPoint="False" Minimum="4" Step="4" Margin="0 0 0 0" FontSize="{StaticResource TangoComboBoxItemFontSize}" VerticalContentAlignment="Center" VerticalAlignment="Center" HorizontalAlignment="Center" Value="{Binding JobModel.Copies}" HideUnderline="True" RippleBrush="Transparent"></touch:TouchNumericTextBox> </Border> </StackPanel> @@ -1242,7 +1242,7 @@ </TextBlock> <TextBlock FontSize="{StaticResource TangoDefaultFontSize}"> <Run Text="Copies:" FontWeight="Normal"></Run> - <Run Text="{Binding JobModel.NumberOfUnitsMultipliedBySpools,Mode=OneWay}" FontWeight="DemiBold"/> + <Run Text="{Binding JobModel.Copies}" FontWeight="DemiBold"/> </TextBlock> <TextBlock FontSize="{StaticResource TangoDefaultFontSize}"> <Run Text="Total:" FontWeight="Normal"></Run> @@ -1254,11 +1254,11 @@ <TextBlock Text="Per Spool:" FontWeight="DemiBold" FontSize="{StaticResource TangoDefaultFontSize}"></TextBlock> <TextBlock FontSize="{StaticResource TangoDefaultFontSize}"> <Run Text="Spools:" FontWeight="Normal"></Run> - <Run Text="{Binding JobModel.NumberSpools,Mode=OneWay}" FontWeight="DemiBold"/> + <Run Text="{Binding JobModel.NumberSpools}" FontWeight="DemiBold"/> </TextBlock> <TextBlock FontSize="{StaticResource TangoDefaultFontSize}"> <Run Text="Copies:" FontWeight="Normal"></Run> - <Run Text="{Binding JobModel.NumberOfUnits,Mode=OneWay}" FontWeight="DemiBold"/> + <Run Text="{Binding JobModel.NumberOfUnits}" FontWeight="DemiBold"/> </TextBlock> <TextBlock FontSize="{StaticResource TangoDefaultFontSize}"> <Run Text="Total:" FontWeight="Normal"></Run> diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/Converters/LengthWithSpoolsConverter.cs b/Software/Visual_Studio/PPC/Tango.PPC.UI/Converters/LengthWithSpoolsConverter.cs index 3b42885bd..48e9bce7b 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.UI/Converters/LengthWithSpoolsConverter.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/Converters/LengthWithSpoolsConverter.cs @@ -21,7 +21,7 @@ namespace Tango.PPC.UI.Converters } catch { - return "-"; + return 0d; } } diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/Converters/ProgressLengthSpoolConverter.cs b/Software/Visual_Studio/PPC/Tango.PPC.UI/Converters/ProgressLengthSpoolConverter.cs new file mode 100644 index 000000000..00473955b --- /dev/null +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/Converters/ProgressLengthSpoolConverter.cs @@ -0,0 +1,66 @@ +using System; +using System.Collections.Generic; +using System.Globalization; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows; +using System.Windows.Data; + +namespace Tango.PPC.UI.Converters +{ + public class ProgressLengthSpoolConverter : IMultiValueConverter + { + public object Convert(object[] values, Type targetType, object parameter, CultureInfo culture) + { + try + { + if (values.Count() == 4) + { + double length = System.Convert.ToDouble(values[0]); + int spools = System.Convert.ToInt32(values[1]); + int NumberOfUnits = System.Convert.ToInt32(values[2]); + bool forOneSpool = System.Convert.ToBoolean(values[3]); + var totalBy4Spools = (double)length* spools * NumberOfUnits/ 4; + if (forOneSpool) + { + return (double)totalBy4Spools / 4; + } + return totalBy4Spools; + + } + if (values.Count() == 5) + { + double length = System.Convert.ToDouble(values[0]); + int spools = System.Convert.ToInt32(values[1]); + int NumberOfUnits = System.Convert.ToInt32(values[2]); + bool forOneSpool = System.Convert.ToBoolean(values[3]); + double currentProgresslength = System.Convert.ToDouble(values[4]) ; + + var totalBy4Spools = (double)length * spools * NumberOfUnits / 4; + var currentProgressBy4Spools = (double)currentProgresslength * spools ; + + int coeff = (int)currentProgressBy4Spools / (int)totalBy4Spools; + var progressCurrent = coeff == 0 ? currentProgressBy4Spools : currentProgressBy4Spools % (coeff * totalBy4Spools);//show for progress + + if (forOneSpool) + { + return (double)progressCurrent / 4; + + } + return progressCurrent; + } + return "-"; + } + catch + { + return "-"; + } + } + + public object[] ConvertBack(object value, Type[] targetTypes, object parameter, CultureInfo culture) + { + throw new NotImplementedException(); + } + } +} diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/Dialogs/PowerEurekaView.xaml b/Software/Visual_Studio/PPC/Tango.PPC.UI/Dialogs/PowerEurekaView.xaml new file mode 100644 index 000000000..f5b1116c0 --- /dev/null +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/Dialogs/PowerEurekaView.xaml @@ -0,0 +1,56 @@ +<UserControl x:Class="Tango.PPC.UI.Dialogs.PowerEurekaView" + 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" + Width="500" Height="462" + Background="{StaticResource TangoPrimaryBackgroundBrush}" d:DesignHeight="555" d:DesignWidth="500" d:DataContext="{d:DesignInstance Type=local:PowerEurekaViewVM, IsDesignTimeCreatable=False}"> + <UserControl.Resources> + + <Style TargetType="touch:TouchButton" > + <Setter Property="Foreground" Value="{StaticResource TangoLightForegroundBrush}"></Setter> + <Setter Property="Background" Value="{StaticResource TangoPrimaryAccentBrush}"/> + <Setter Property="Height" Value="50"/> + <Setter Property="Width" Value="165"/> + <Setter Property="CornerRadius" Value="30"/> + <Setter Property="EnableDropShadow" Value="False"/> + <Setter Property="BorderThickness" Value="0"/> + <Setter Property="FontSize" Value="18"/> + <Style.Triggers> + <Trigger Property="IsEnabled" Value="False"> + <Setter Property="Foreground" Value="{StaticResource TangoDisabledForegroundBrush}"></Setter> + <Setter Property="Background" Value="{StaticResource TangoDisabledBackgroundBrush}"></Setter> + </Trigger> + </Style.Triggers> + </Style> + + </UserControl.Resources> + <Grid> + + <Border BorderBrush="{StaticResource TangoMidAccentBrush}" Margin="-24" CornerRadius="40" BorderThickness="1" Background="{StaticResource TangoPrimaryBackgroundBrush}"> + <StackPanel Orientation="Vertical" HorizontalAlignment="Center" Margin="10"> + <DockPanel VerticalAlignment="Top" Margin="0 20 0 18" Width="470"> + <touch:TouchIconButton DockPanel.Dock="Right" VerticalAlignment="Center" Height="25" Width="25" Command="{Binding CloseCommand}" Foreground="{StaticResource TangoDarkForegroundBrush}" RippleBrush="{StaticResource TangoRippleDarkBrush}" Icon="Close" HorizontalAlignment="Right" /> + <TextBlock FontSize="{StaticResource TangoButtonFontSize}" FontWeight="SemiBold" HorizontalAlignment="Center"> Power</TextBlock> + </DockPanel> + <Grid HorizontalAlignment="Center" Width="470" VerticalAlignment="Top" Margin="0 20 0 0"> + <Image Source="../Images/Menu/Power_image.png" Stretch="UniformToFill" VerticalAlignment="Center" HorizontalAlignment="Left" Height="50" Width="120"/> + <touch:TouchButton Margin="0" Command="{Binding TurnOffCommand}" HorizontalAlignment="Center"> Turn off</touch:TouchButton> + </Grid> + <touch:TouchButton Margin="0 35 0 0" Content="Stand By" Command="{Binding StandByCommand}" ></touch:TouchButton> + <touch:TouchButton Margin="0 35 0 0" Command="{Binding RestartCommand}">Restart</touch:TouchButton> + <Border Height="2" Width="380" Background="{StaticResource TangoLightBorderBrush}" VerticalAlignment="Bottom" Margin="0 36 0 0" CornerRadius="2"></Border> + <Grid Margin="0 43 0 43" VerticalAlignment="Bottom"> + <Image Source="../Images/Menu/restart_t.png" Stretch="UniformToFill" HorizontalAlignment="Left" Width="30" VerticalAlignment="Center" Margin="46 0 0 0"/> + <touch:TouchButton Margin="0" Command="{Binding RestartTabletCommand}">Restart</touch:TouchButton> + </Grid> + </StackPanel> + + + </Border> + + </Grid> +</UserControl> diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/Dialogs/PowerEurekaView.xaml.cs b/Software/Visual_Studio/PPC/Tango.PPC.UI/Dialogs/PowerEurekaView.xaml.cs new file mode 100644 index 000000000..3279207bd --- /dev/null +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/Dialogs/PowerEurekaView.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 PowerEurekaView.xaml + /// </summary> + public partial class PowerEurekaView : UserControl + { + public PowerEurekaView() + { + InitializeComponent(); + } + } +} diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/Dialogs/PowerEurekaViewVM.cs b/Software/Visual_Studio/PPC/Tango.PPC.UI/Dialogs/PowerEurekaViewVM.cs new file mode 100644 index 000000000..2dc8f7b6e --- /dev/null +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/Dialogs/PowerEurekaViewVM.cs @@ -0,0 +1,69 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Tango.Core.Commands; +using Tango.SharedUI; + +namespace Tango.PPC.UI.Dialogs +{ + public class PowerEurekaViewVM : DialogViewVM + { + public enum PowerActionEnum { TurnOff, StandBy, Restart, RestartT }; + + private PowerActionEnum _powerAction; + + public PowerActionEnum PowerAction + { + get { return _powerAction; } + set { + _powerAction = value; + RaisePropertyChangedAuto();} + } + + public RelayCommand TurnOffCommand { get; set;} + public RelayCommand StandByCommand { get; set;} + public RelayCommand RestartCommand { get; set; } + public RelayCommand RestartTabletCommand { get; set; } + + + public PowerEurekaViewVM() + { + PowerAction = PowerActionEnum.StandBy; + TurnOffCommand = new RelayCommand( OnTurnOff); + StandByCommand = new RelayCommand(OnStandBy); + RestartCommand = new RelayCommand(OnRestart); + RestartTabletCommand = new RelayCommand(OnRestartTablet); + } + + private void OnRestartTablet(object obj) + { + PowerAction = PowerActionEnum.RestartT; + base.Accept(); + } + + private void OnRestart(object obj) + { + PowerAction = PowerActionEnum.Restart; + base.Accept(); + } + + private void OnStandBy(object obj) + { + PowerAction = PowerActionEnum.StandBy; + base.Accept(); + } + + private void OnTurnOff(object obj) + { + PowerAction = PowerActionEnum.TurnOff; + base.Accept(); + } + + protected override void Cancel() + { + base.Cancel(); + } + } +} diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/Images/Menu/Power_image.png b/Software/Visual_Studio/PPC/Tango.PPC.UI/Images/Menu/Power_image.png Binary files differnew file mode 100644 index 000000000..dcabd96b5 --- /dev/null +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/Images/Menu/Power_image.png diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/Images/Menu/restart_t.png b/Software/Visual_Studio/PPC/Tango.PPC.UI/Images/Menu/restart_t.png Binary files differnew file mode 100644 index 000000000..92a8ed5e6 --- /dev/null +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/Images/Menu/restart_t.png diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/MainWindow.xaml b/Software/Visual_Studio/PPC/Tango.PPC.UI/MainWindow.xaml index be53c67fc..7a1d042a3 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.UI/MainWindow.xaml +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/MainWindow.xaml @@ -11,7 +11,7 @@ FontSize="{StaticResource TangoDefaultFontSize}" Foreground="{StaticResource TangoDarkForegroundBrush}" FontWeight="Medium" RenderOptions.BitmapScalingMode="LowQuality" SnapsToDevicePixels="True" UseLayoutRounding="True"> - <Grid x:Name="gridMain"> + <Border x:Name="mainBorder"> - </Grid> + </Border> </Window> diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/MainWindow.xaml.cs b/Software/Visual_Studio/PPC/Tango.PPC.UI/MainWindow.xaml.cs index 966ece356..b7f6c40ae 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.UI/MainWindow.xaml.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/MainWindow.xaml.cs @@ -85,7 +85,7 @@ namespace Tango.PPC.UI private void InitTS1800() { - this.Content = new Views.MainView(); + mainBorder.Child = new Views.MainView(); bool has_touch = false; @@ -123,9 +123,9 @@ namespace Tango.PPC.UI Viewbox viewBox = new Viewbox(); viewBox.Stretch = Stretch.Uniform; this.Content = viewBox; - gridMain.Width = 800; - gridMain.Height = 1280; - viewBox.Child = gridMain; + mainBorder.Width = 800; + mainBorder.Height = 1280; + viewBox.Child = mainBorder; LockAspectRatio(); this.SizeChanged += (x, y) => { 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 ec2e6b1a0..d32900728 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 @@ -144,6 +144,7 @@ <Compile Include="Converters\ItemBaseConverter.cs" /> <Compile Include="Converters\LengthToWeightConverter.cs" /> <Compile Include="Converters\LengthWithSpoolsConverter.cs" /> + <Compile Include="Converters\ProgressLengthSpoolConverter.cs" /> <Compile Include="Dialogs\BitResultsView.xaml.cs"> <DependentUpon>BitResultsView.xaml</DependentUpon> </Compile> @@ -155,6 +156,10 @@ <DependentUpon>InsufficientLiquidQuantityView.xaml</DependentUpon> </Compile> <Compile Include="Dialogs\InsufficientLiquidQuantityViewVM.cs" /> + <Compile Include="Dialogs\PowerEurekaView.xaml.cs"> + <DependentUpon>PowerEurekaView.xaml</DependentUpon> + </Compile> + <Compile Include="Dialogs\PowerEurekaViewVM.cs" /> <Compile Include="Dialogs\SafetyLevelOperationsConfirmationView.xaml.cs"> <DependentUpon>SafetyLevelOperationsConfirmationView.xaml</DependentUpon> </Compile> @@ -314,6 +319,10 @@ <Generator>MSBuild:Compile</Generator> <SubType>Designer</SubType> </Page> + <Page Include="Dialogs\PowerEurekaView.xaml"> + <SubType>Designer</SubType> + <Generator>MSBuild:Compile</Generator> + </Page> <Page Include="Dialogs\SafetyLevelOperationsConfirmationView.xaml"> <SubType>Designer</SubType> <Generator>MSBuild:Compile</Generator> @@ -555,6 +564,8 @@ <Resource Include="Images\Job Issues\thread_type.png" /> <Resource Include="Images\Job Issues\Events.png" /> <Resource Include="Images\Job Issues\Machine outline.png" /> + <Resource Include="Images\Menu\restart_t.png" /> + <Resource Include="Images\Menu\Power_image.png" /> <Content Include="Manifests\release.xml" /> <Content Include="Manifests\debug.xml" /> <None Include="firmware_package.tfp"> @@ -879,7 +890,7 @@ if $(ConfigurationName) == Debug "rc.exe" "$(TargetPath)" --set-version-string " </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> </Project>
\ No newline at end of file diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/LayoutViewVM.cs b/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/LayoutViewVM.cs index 42d947326..d16792ead 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/LayoutViewVM.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/LayoutViewVM.cs @@ -16,6 +16,7 @@ using Tango.PPC.Common; using Tango.PPC.Common.Connection; using Tango.PPC.Common.Modules; using Tango.PPC.Common.Navigation; +using Tango.PPC.UI.Dialogs; using Tango.PPC.UI.Views; using Tango.PPC.UI.ViewsContracts; using Tango.SharedUI; @@ -300,7 +301,7 @@ namespace Tango.PPC.UI.ViewModels SignOutCommand = new RelayCommand(SignOut); UpdateCommand = new RelayCommand(UpdateMachine); - PowerCommand = new RelayCommand(() => IsPowerOpened = true); + PowerCommand = new RelayCommand(OpenPowerOptions); RestartApplicationCommand = new RelayCommand(RestartApplication); PowerOffCommand = new RelayCommand(PowerOffMachine, () => MachineProvider.MachineOperator.Status != MachineStatuses.Disconnected); ResetCommand = new RelayCommand(ResetMachine, () => MachineProvider.MachineOperator.Status != MachineStatuses.Disconnected); @@ -311,6 +312,41 @@ namespace Tango.PPC.UI.ViewModels #region Private Methods + private async void OpenPowerOptions() + { + IsPowerOpened = true; + + if (BuildProvider.IsEureka) + { + PowerEurekaViewVM vm = new PowerEurekaViewVM(); + vm = await NotificationProvider.ShowDialog<PowerEurekaViewVM>(vm); + + if (!vm.DialogResult) return; + + switch(vm.PowerAction) + { + case PowerEurekaViewVM.PowerActionEnum.TurnOff: + if(MachineProvider.MachineOperator.Status != MachineStatuses.Disconnected) + PowerOffMachine(); + return; + case PowerEurekaViewVM.PowerActionEnum.StandBy: + if (MachineProvider.MachineOperator.CanPrint) + StandBy(); + return; + case PowerEurekaViewVM.PowerActionEnum.RestartT: + RestartApplication(); + return; + case PowerEurekaViewVM.PowerActionEnum.Restart: + if (MachineProvider.MachineOperator.Status != MachineStatuses.Disconnected) + ResetMachine(); + return; + default: + return; + } + + } + } + /// <summary> /// Stops the printing. /// </summary> diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/Views/LayoutEurekaView.xaml b/Software/Visual_Studio/PPC/Tango.PPC.UI/Views/LayoutEurekaView.xaml index 10750bba3..092088ca6 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.UI/Views/LayoutEurekaView.xaml +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/Views/LayoutEurekaView.xaml @@ -48,6 +48,13 @@ </Border> <StackPanel> <DockPanel> + <touch:TouchIconButton Icon="ChevronLeft" IsHitTestVisible="{Binding NavigationManager.IsNavigating,Converter={StaticResource BooleanInverseConverter}}" IsEnabled="{Binding NavigationManager.CanNavigateBack}" Width="40" Height="40" Padding="10" Margin="10 0 0 0" Command="{Binding MenuOrBackCommand}" EnableDropShadow="False"> + <touch:TouchIconButton.Style> + <Style TargetType="touch:TouchIconButton" BasedOn="{StaticResource {x:Type touch:TouchIconButton}}"> + <Setter Property="Foreground" Value="{StaticResource TangoPrimaryAccentBrush}"></Setter> + </Style> + </touch:TouchIconButton.Style> + </touch:TouchIconButton> <Image Source="/Images/logo.png" Stretch="Uniform" HorizontalAlignment="Center" Margin="0 10 10 10" Width="157"></Image> </DockPanel> </StackPanel> @@ -81,11 +88,21 @@ </touch:TouchButton> </Border> </StackPanel> + <StackPanel Margin="0 5 0 0"> + <Border BorderBrush="{StaticResource TangoDividerBrush}" BorderThickness="0 0 0 1"> + <touch:TouchButton Style="{StaticResource TangoFlatButton}" Padding="10 15" Foreground="{StaticResource TangoDarkForegroundBrush}" Command="{Binding PowerCommand}"> + <StackPanel Orientation="Horizontal" HorizontalAlignment="Left"> + <Image Source="/Images/menu/power.png" VerticalAlignment="Center" Width="20" Height="20"></Image> + <TextBlock VerticalAlignment="Center" Margin="20 0 0 0" Foreground="{StaticResource TangoLightForegroundBrush}" FontSize="{StaticResource TangoComboBoxItemFontSize}" FontWeight="Light">Power</TextBlock> + </StackPanel> + </touch:TouchButton> + </Border> + </StackPanel> </StackPanel> <Grid VerticalAlignment="Bottom"> <Border Background="{StaticResource TangoPrimaryBackgroundBrush}" Height="350" Padding="20" RenderTransformOrigin="0.5,1" VerticalAlignment="Bottom"> - <Border.Resources> + <!--<Border.Resources> <Style x:Key="PowerButton" TargetType="touch:TouchButton" BasedOn="{StaticResource TangoLinkButton}"> <Setter Property="Foreground" Value="{StaticResource TangoPrimaryBackgroundBrush}"></Setter> <Setter Property="FontSize" Value="{StaticResource TangoTitleFontSize}"></Setter> @@ -99,7 +116,7 @@ </Trigger> </Style.Triggers> </Style> - </Border.Resources> + </Border.Resources>--> <Border.Style> <Style TargetType="Border"> <Setter Property="RenderTransform"> @@ -107,7 +124,7 @@ <ScaleTransform ScaleX="1" ScaleY="0" /> </Setter.Value> </Setter> - <Style.Triggers> + <!--<Style.Triggers> <DataTrigger Binding="{Binding IsPowerOpened}" Value="True"> <DataTrigger.EnterActions> <BeginStoryboard> @@ -124,7 +141,7 @@ </BeginStoryboard> </DataTrigger.ExitActions> </DataTrigger> - </Style.Triggers> + </Style.Triggers>--> </Style> </Border.Style> <Grid> @@ -133,7 +150,7 @@ <RowDefinition Height="1*"/> </Grid.RowDefinitions> - <Grid> + <!--<Grid> <Grid.ColumnDefinitions> <ColumnDefinition Width="188*"/> <ColumnDefinition Width="261*"/> @@ -146,9 +163,9 @@ <touch:TouchButton Style="{StaticResource PowerButton}" Command="{Binding StandByCommand}">Stand By</touch:TouchButton> <touch:TouchButton Style="{StaticResource PowerButton}" Command="{Binding ResetCommand}">Reset</touch:TouchButton> </UniformGrid> - </Grid> + </Grid>--> - <Rectangle HorizontalAlignment="Stretch" VerticalAlignment="Bottom" Margin="25 0" Opacity="0.3" StrokeThickness="1" Stroke="{StaticResource TangoDividerBrush}" /> + <!--<Rectangle HorizontalAlignment="Stretch" VerticalAlignment="Bottom" Margin="25 0" Opacity="0.3" StrokeThickness="1" Stroke="{StaticResource TangoDividerBrush}" /> <Grid Grid.Row="1"> <Grid.ColumnDefinitions> @@ -158,11 +175,11 @@ <Image Source="/Images/power-tablet.png" Margin="30" /> <touch:TouchButton Command="{Binding RestartApplicationCommand}" Grid.Column="1" Style="{StaticResource PowerButton}">Restart</touch:TouchButton> - </Grid> + </Grid>--> </Grid> </Border> - <Border Background="{StaticResource TangoMidBackgroundBrush}" RenderTransformOrigin="0.5,1" VerticalAlignment="Bottom"> + <!--<Border Background="{StaticResource TangoMidBackgroundBrush}" RenderTransformOrigin="0.5,1" VerticalAlignment="Bottom"> <Border.Style> <Style TargetType="Border"> <Setter Property="RenderTransform"> @@ -196,7 +213,7 @@ <TextBlock VerticalAlignment="Center" Margin="20 0 0 0" Foreground="{StaticResource TangoLightForegroundBrush}" FontSize="{StaticResource TangoComboBoxItemFontSize}" FontWeight="Light">Power</TextBlock> </StackPanel> </touch:TouchButton> - </Border> + </Border>--> </Grid> </Grid> </Border> 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 370ac1de7..e69f33514 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.UI/Views/MachineStatusView.xaml +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/Views/MachineStatusView.xaml @@ -17,6 +17,7 @@ <localConverters:LengthToWeightConverter x:Key="LengthToWeightConverter" /> <localConverters:LengthWithSpoolsConverter x:Key="LengthWithSpoolsConverter"/> <localConverters:CollectionToCountConverter x:Key="CollectionToCountConverter"/> + <localConverters:ProgressLengthSpoolConverter x:Key="ProgressLengthSpoolConverter"/> <Style x:Key="LinkRoundButtonStyle" TargetType="{x:Type touch:TouchButton}"> <Setter Property="Background" Value="{StaticResource TangoMidAccentBrush}"></Setter> @@ -249,7 +250,18 @@ <Image Source="../Images/Job Issues/job_copies.png" Stretch="None" VerticalAlignment="Top"/> <StackPanel Orientation="Vertical" Margin="15 0 0 0"> <TextBlock VerticalAlignment="Center" FontSize="{StaticResource TangoDefaultFontSize}">Copies</TextBlock> - <TextBlock Text="{Binding Job.NumberOfUnitsMultipliedBySpools, TargetNullValue='-', FallbackValue='-'}" FontWeight="DemiBold" FontSize="{StaticResource TangoComboBoxItemFontSize}"></TextBlock> + <TextBlock FontWeight="DemiBold" FontSize="{StaticResource TangoComboBoxItemFontSize}"> + <TextBlock.Style> + <Style TargetType="{x:Type TextBlock}"> + <Setter Property="Text" Value="{Binding Job.NumberOfUnitsMultipliedBySpools, TargetNullValue='-', FallbackValue='-', StringFormat=0.##}" /> + <Style.Triggers> + <DataTrigger Binding="{Binding IsSpoolView}" Value="True"> + <Setter Property="Text" Value="{Binding Job.NumberOfUnits, TargetNullValue='-', FallbackValue='-', StringFormat=0.##}" /> + </DataTrigger> + </Style.Triggers> + </Style> + </TextBlock.Style> + </TextBlock> </StackPanel> </StackPanel> <StackPanel Orientation="Horizontal" HorizontalAlignment="Left"> @@ -305,7 +317,7 @@ <Setter.Value> <LinearGradientBrush StartPoint="0, 0" EndPoint="1, 1"> <GradientStop Offset="0.2" Color="Red"/> - <GradientStop Offset="0.6" Color="Yellow"/> + <GradientStop Offset="0.5" Color="Yellow"/> <GradientStop Offset="0.8" Color="Blue"/> </LinearGradientBrush> </Setter.Value> @@ -340,48 +352,56 @@ <TextBlock Margin="5 0 0 0" VerticalAlignment="Center" FontSize="{StaticResource TangoComboBoxItemFontSize}" Visibility="{Binding IsWeghtView, Converter={StaticResource BooleanToVisibilityConverter}}"> Weight</TextBlock> </StackPanel> </StackPanel> - <StackPanel Orientation="Horizontal" Margin="0 15 0 0" HorizontalAlignment="Center" Visibility="{Binding IsWeghtView, Converter={StaticResource BooleanToVisibilityInverseConverter}}"> + + <StackPanel Orientation="Horizontal" Margin="0 15 0 0" HorizontalAlignment="Center" > <TextBlock FontSize="{StaticResource TangoLargeInfoFontSize}" VerticalAlignment="Center"> <TextBlock.Text> - <MultiBinding Converter="{StaticResource LengthWithSpoolsConverter}" StringFormat="0" TargetNullValue='-' FallbackValue='0' Mode="OneWay"> - <Binding Path="RunningJobStatus.ProgressMinusSettingUp" Mode="OneWay"/> + <MultiBinding Converter="{StaticResource ProgressLengthSpoolConverter}" StringFormat="0.#" TargetNullValue='-' FallbackValue='0' Mode="OneWay"> + <Binding Path="RunningJobStatus.TotalProgressMinusSettingUp" /> <Binding Path="Job.Spools" Mode="OneWay"/> + <Binding Path="Job.NumberOfUnits" Mode="OneWay"/> + <Binding Path="IsSpoolView"/> + <Binding Path="RunningJobStatus.ProgressMinusSettingUp" /> </MultiBinding> </TextBlock.Text> </TextBlock> <TextBlock FontSize="{StaticResource TangoLargeInfoFontSize}" VerticalAlignment="Center" Text="/"></TextBlock> <TextBlock FontSize="{StaticResource TangoTitleFontSize}" VerticalAlignment="Center"> <TextBlock.Text> - <MultiBinding Converter="{StaticResource LengthWithSpoolsConverter}" StringFormat="0" TargetNullValue='-' FallbackValue='0' Mode="OneWay"> - <Binding Path="RunningJobStatus.TotalProgressMinusSettingUp" Mode="OneWay"/> + <MultiBinding Converter="{StaticResource ProgressLengthSpoolConverter}" StringFormat="0" TargetNullValue='-' FallbackValue='0' Mode="OneWay"> + <Binding Path="RunningJobStatus.TotalProgressMinusSettingUp"/> <Binding Path="Job.Spools" Mode="OneWay"/> + <Binding Path="Job.NumberOfUnits" Mode="OneWay"/> + <Binding Path="IsSpoolView"/> </MultiBinding> </TextBlock.Text> </TextBlock> <TextBlock FontSize="{StaticResource TangoTitleFontSize}" VerticalAlignment="Center" Text=" m"></TextBlock> </StackPanel> - <StackPanel Orientation="Horizontal" Margin="0 10 0 0" HorizontalAlignment="Center" Visibility="{Binding IsWeghtView, Converter={StaticResource BooleanToVisibilityConverter}}"> + + <!--<StackPanel Orientation="Horizontal" Margin="0 10 0 0" HorizontalAlignment="Center" Visibility="{Binding IsWeghtView, Converter={StaticResource BooleanToVisibilityConverter}}"> <TextBlock FontSize="{StaticResource TangoLargeInfoFontSize}" VerticalAlignment="Center"> <TextBlock.Text> - <MultiBinding Converter="{StaticResource LengthToWeightConverter}" StringFormat="0.##" TargetNullValue='-' FallbackValue='0' Mode="OneWay"> - <Binding Path="RunningJobStatus.ProgressMinusSettingUp" Mode="OneWay"/> - <Binding Path="Job.GramPerLength" Mode="OneWay"/> - <Binding Path="Job.Spools" Mode="OneWay"/> + <MultiBinding Converter="{StaticResource ProgressLengthSpoolConverter}" StringFormat="0" TargetNullValue='-' FallbackValue='0'> + <Binding Path="RunningJobStatus.TotalProgressMinusSettingUp" /> + <Binding Path="Job.NumberOfUnits" Mode="OneWay"/> + <Binding Path="IsSpoolView"/> + <Binding Path="RunningJobStatus.ProgressMinusSettingUp" /> </MultiBinding> </TextBlock.Text> </TextBlock> <TextBlock FontSize="{StaticResource TangoLargeInfoFontSize}" VerticalAlignment="Center" Text="/"></TextBlock> <TextBlock FontSize="{StaticResource TangoTitleFontSize}" VerticalAlignment="Center"> <TextBlock.Text> - <MultiBinding Converter="{StaticResource LengthToWeightConverter}" StringFormat="0.##" TargetNullValue='-' FallbackValue='0' Mode="OneWay"> - <Binding Path="RunningJobStatus.TotalProgressMinusSettingUp" Mode="OneWay"/> - <Binding Path="Job.GramPerLength" Mode="OneWay"/> - <Binding Path="Job.Spools" Mode="OneWay"/> + <MultiBinding Converter="{StaticResource ProgressLengthSpoolConverter}" StringFormat="0" TargetNullValue='-' FallbackValue='0' > + <Binding Path="RunningJobStatus.TotalProgressMinusSettingUp"/> + <Binding Path="Job.NumberOfUnits" Mode="OneWay"/> + <Binding Path="IsSpoolView"/> </MultiBinding> </TextBlock.Text> </TextBlock> <TextBlock FontSize="{StaticResource TangoTitleFontSize}" VerticalAlignment="Center" Text=" g"></TextBlock> - </StackPanel> + </StackPanel>--> </StackPanel> <StackPanel Height="90" Visibility="{Binding RunningJobStatus.IsSettingUp, FallbackValue=collapsed, Converter={StaticResource BooleanToVisibilityConverter}}"> @@ -452,8 +472,10 @@ <Run Text="x"></Run><Run Text="{Binding RunningJobStatus.RemainingUnits}"></Run> </TextBlock>--> </Grid> - <touch:MultiRangeSlider x:Name="PART_LowerSlider" Height="30" Margin="0 0 0 0" Minimum="0" Maximum="{Binding RunningJobStatus.CurrentUnitTotalProgress}" Value="{Binding RunningJobStatus.CurrentUnitProgress}" Foreground="{StaticResource TangoDarkForegroundBrush}" - IsSnapToTickEnabled="True" TickFrequency="1" VerticalAlignment="Center" IsEnabled="False" /> + <touch:MultiRangeSlider x:Name="PART_LowerSlider" Height="30" Margin="0 0 0 0" Minimum="0" Foreground="{StaticResource TangoDarkForegroundBrush}" + IsSnapToTickEnabled="True" TickFrequency="1" VerticalAlignment="Center" IsEnabled="False" Maximum="{Binding RunningJobStatus.TotalProgressMinusSettingUp}" + Value ="{Binding RunningJobStatus.ProgressMinusSettingUp}"/> + <UniformGrid DockPanel.Dock="Bottom" Columns="4" Rows="1" HorizontalAlignment="Left" Margin="0 35 0 0" Height="Auto" VerticalAlignment="Top" Width="1200"> <StackPanel Orientation="Horizontal" HorizontalAlignment="Left"> <Image Source="../Images/Job Issues/job_length.png" Stretch="None" VerticalAlignment="Top" HorizontalAlignment="Left"/> @@ -696,8 +718,10 @@ </StackPanel> <StackPanel Orientation="Vertical" Margin="30 8 30 0" > <locaControls:RunningJobViewerEureka Height="16" DisplayMarkers="False" IsActive="True" Job="{Binding Job}" RunningJobStatus="{Binding RunningJobStatus}" /> - <touch:MultiRangeSlider x:Name="PART_LowerSlider1" Height="26" Margin="0 0 0 0" Minimum="0" Maximum="{Binding RunningJobStatus.CurrentUnitTotalProgress}" Value="{Binding RunningJobStatus.CurrentUnitProgress}" Foreground="{StaticResource TangoDarkForegroundBrush}" - IsSnapToTickEnabled="True" TickFrequency="1" VerticalAlignment="Center" IsEnabled="False" /> + + <touch:MultiRangeSlider x:Name="PART_LowerSlider1" Height="26" Margin="0 0 0 0" Minimum="0" Foreground="{StaticResource TangoDarkForegroundBrush}" + IsSnapToTickEnabled="True" TickFrequency="1" VerticalAlignment="Center" IsEnabled="False" Maximum="{Binding RunningJobStatus.TotalProgressMinusSettingUp}" Value ="{Binding RunningJobStatus.ProgressMinusSettingUp}"/> + </StackPanel> </DockPanel> <Border Height="2" Background="{StaticResource TangoLightBorderBrush}" VerticalAlignment="Bottom" Margin="0 2 0 0" CornerRadius="2"></Border> @@ -737,7 +761,7 @@ <touch:TouchExpander x:Name="Notifications" Style="{StaticResource TouchRoundedExpander}" IsTabStop="False" KeyboardNavigation.TabNavigation ="None" BorderThickness="0" IsExpanded="false" CornerRadius="20 20 0 0" > <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}" > + <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}}" > </touch:TouchButton> <StackPanel DockPanel.Dock="Left" Orientation="Horizontal" VerticalAlignment="Center" > diff --git a/Software/Visual_Studio/Tango.Touch/Controls/TouchNumericTextBox.cs b/Software/Visual_Studio/Tango.Touch/Controls/TouchNumericTextBox.cs index 47b3670a7..6c09cdc59 100644 --- a/Software/Visual_Studio/Tango.Touch/Controls/TouchNumericTextBox.cs +++ b/Software/Visual_Studio/Tango.Touch/Controls/TouchNumericTextBox.cs @@ -211,7 +211,8 @@ namespace Tango.Touch.Controls } if (Step > 0) { - value = Math.Round(value / Step, MidpointRounding.AwayFromZero) * Step; + int coef = (int)((value + Step - 1) / Step); + value = coef * Step; } if(Minimum > 0 && value < Minimum) { |
