diff options
| author | Roy Ben-Shabat <Roy@Twine-s.com> | 2019-11-19 16:18:56 +0200 |
|---|---|---|
| committer | Roy Ben-Shabat <Roy@Twine-s.com> | 2019-11-19 16:18:56 +0200 |
| commit | 0ac921db3d7d296bd216282f1fbffa6dd1ba5eba (patch) | |
| tree | dd1c8e39a1891cb831b128072313d2439d70105b /Software/Visual_Studio/PPC/Modules | |
| parent | 0a197fa4d8447271aa7decd28e3afcea611d53cd (diff) | |
| download | Tango-0ac921db3d7d296bd216282f1fbffa6dd1ba5eba.tar.gz Tango-0ac921db3d7d296bd216282f1fbffa6dd1ba5eba.zip | |
Added OverallTemperature to DB Monitors.
Added OverallTemperature support to Machine Emulator.
Implemented OverallTemperature in maintenance screen PPC.
Diffstat (limited to 'Software/Visual_Studio/PPC/Modules')
7 files changed, 64 insertions, 2 deletions
diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Maintenance/Images/temperature-green.png b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Maintenance/Images/temperature-green.png Binary files differindex cdea8ff8b..f67323dde 100644 --- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Maintenance/Images/temperature-green.png +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Maintenance/Images/temperature-green.png diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Maintenance/Images/temperature-red.png b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Maintenance/Images/temperature-red.png Binary files differnew file mode 100644 index 000000000..5e6b505a3 --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Maintenance/Images/temperature-red.png diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Maintenance/Images/temperature-yellow.png b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Maintenance/Images/temperature-yellow.png Binary files differnew file mode 100644 index 000000000..359e93d6d --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Maintenance/Images/temperature-yellow.png diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Maintenance/Models/OverallTemperatureModel.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Maintenance/Models/OverallTemperatureModel.cs new file mode 100644 index 000000000..694071d0d --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Maintenance/Models/OverallTemperatureModel.cs @@ -0,0 +1,30 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Tango.Core; +using Tango.Integration.Operation; + +namespace Tango.PPC.Maintenance.Models +{ + public class OverallTemperatureModel : ExtendedObject + { + private double _temperature; + public double Temperature + { + get { return _temperature; } + set { _temperature = value; RaisePropertyChangedAuto(); RaisePropertyChanged(nameof(IsWarning)); RaisePropertyChanged(nameof(IsError)); } + } + + public bool IsWarning + { + get { return Temperature > MachineOperator.OVERALL_TEMPERATURE_WARNING; } + } + + public bool IsError + { + get { return Temperature >= MachineOperator.OVERALL_TEMPERATURE_ERROR; } + } + } +} diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Maintenance/Tango.PPC.Maintenance.csproj b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Maintenance/Tango.PPC.Maintenance.csproj index d774649ea..4a6957722 100644 --- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Maintenance/Tango.PPC.Maintenance.csproj +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Maintenance/Tango.PPC.Maintenance.csproj @@ -102,6 +102,7 @@ <Compile Include="Helpers\GuideHelper.cs" /> <Compile Include="MaintenanceModule.cs" /> <Compile Include="Models\MidTankLevelModel.cs" /> + <Compile Include="Models\OverallTemperatureModel.cs" /> <Compile Include="Properties\AssemblyInfo.cs"> <SubType>Code</SubType> </Compile> @@ -228,6 +229,10 @@ <Resource Include="Images\Guides\Loading-New-Thread.gif" /> <Resource Include="Images\Guides\Replacing-the-Thread.gif" /> </ItemGroup> + <ItemGroup> + <Resource Include="Images\temperature-red.png" /> + <Resource Include="Images\temperature-yellow.png" /> + </ItemGroup> <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> <ProjectExtensions> <VisualStudio> diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Maintenance/ViewModels/MaintenanceViewVM.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Maintenance/ViewModels/MaintenanceViewVM.cs index 39932888e..014443eeb 100644 --- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Maintenance/ViewModels/MaintenanceViewVM.cs +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Maintenance/ViewModels/MaintenanceViewVM.cs @@ -27,9 +27,18 @@ namespace Tango.PPC.Maintenance.ViewModels set { _midTankLevels = value; RaisePropertyChangedAuto(); } } + private OverallTemperatureModel _overallTemperature; + public OverallTemperatureModel OverallTemperature + { + get { return _overallTemperature; } + set { _overallTemperature = value; RaisePropertyChangedAuto(); } + } + + public MaintenanceViewVM() { Guides = new ObservableCollection<GuideBase>(GuideHelper.CreateAllGuides()); + OverallTemperature = new OverallTemperatureModel(); OpenGuideCommand = new RelayCommand<GuideBase>(OpenGuide); } @@ -55,6 +64,7 @@ namespace Tango.PPC.Maintenance.ViewModels private void MachineOperator_MachineStatusChanged(object sender, MachineStatus status) { UpdateMidTankLevels(status); + OverallTemperature.Temperature = status.OverallTemperature; } public async void OpenGuide(GuideBase guide) diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Maintenance/Views/MaintenanceView.xaml b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Maintenance/Views/MaintenanceView.xaml index 658d0502c..43a74a1a7 100644 --- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Maintenance/Views/MaintenanceView.xaml +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Maintenance/Views/MaintenanceView.xaml @@ -66,8 +66,25 @@ </Grid.RowDefinitions> <StackPanel Orientation="Horizontal" HorizontalAlignment="Center" VerticalAlignment="Center"> - <Image Source="../Images/temperature-green.png" Stretch="None"></Image> - <TextBlock Margin="5 0 0 0" VerticalAlignment="Center" FontSize="{StaticResource TangoTitleFontSize}" Text="86 º"></TextBlock> + <Image Stretch="None"> + <Image.Style> + <Style TargetType="Image"> + <Setter Property="Source" Value="../Images/temperature-green.png"></Setter> + <Style.Triggers> + <DataTrigger Binding="{Binding OverallTemperature.IsWarning}" Value="True"> + <Setter Property="Source" Value="../Images/temperature-yellow.png"></Setter> + </DataTrigger> + <DataTrigger Binding="{Binding OverallTemperature.IsError}" Value="True"> + <Setter Property="Source" Value="../Images/temperature-red.png"></Setter> + </DataTrigger> + </Style.Triggers> + </Style> + </Image.Style> + </Image> + <TextBlock Margin="5 0 0 0" VerticalAlignment="Center" FontSize="{StaticResource TangoTitleFontSize}"> + <Run Text="{Binding OverallTemperature.Temperature,StringFormat='0',Mode=OneWay}"></Run> + <Run>º</Run> + </TextBlock> </StackPanel> <Grid Grid.Column="1" Margin="0 0 0 10"> |
