12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152 |
- <UserControl x:Class="Aitex.Core.UI.DeviceControl.AITGasValve"
- 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:sys="clr-namespace:System;assembly=mscorlib"
- xmlns:converters="clr-namespace:Aitex.Core.UI.Converters"
- mc:Ignorable="d"
- Height="32" Width="32" Loaded="AITGasValve_OnLoaded"
- Name="GasValve">
- <UserControl.Resources>
- <Storyboard x:Key="OpenValveStoryBoard">
- <DoubleAnimation
- Storyboard.TargetName="rotateTransform"
- Storyboard.TargetProperty="Angle"
- To="90" Duration="0:0:0.3" FillBehavior="HoldEnd"></DoubleAnimation>
- <DoubleAnimation
- Storyboard.TargetName="imgValveClose"
- Storyboard.TargetProperty="Opacity"
- To="0" Duration="0:0:0.3" FillBehavior="HoldEnd"></DoubleAnimation>
- </Storyboard>
- <Storyboard x:Key="CloseValveStoryBoard">
- <DoubleAnimation
- Storyboard.TargetName="rotateTransform"
- Storyboard.TargetProperty="Angle"
- To="0" Duration="0:0:0.3" FillBehavior="HoldEnd"></DoubleAnimation>
- <DoubleAnimation
- Storyboard.TargetName="imgValveClose"
- Storyboard.TargetProperty="Opacity"
- To="100" Duration="0:0:0.3" FillBehavior="HoldEnd"></DoubleAnimation>
- </Storyboard>
- <converters:RotateTransformConverter x:Key="transformConvert"/>
- </UserControl.Resources>
- <UserControl.RenderTransform>
- <RotateTransform x:Name="rotateTransform" CenterX="{Binding ElementName=GasValve,Path=Width,Converter={StaticResource transformConvert}}"
- CenterY="{Binding ElementName=GasValve,Path=Height,Converter={StaticResource transformConvert}}"/>
- </UserControl.RenderTransform>
- <Canvas>
- <Image Name="imgValveOpen" Width="{Binding ElementName=GasValve,Path=Width}" Height="{Binding ElementName=GasValve,Path=Height}">
- </Image>
- <Image Name="imgValveClose" Width="{Binding ElementName=GasValve,Path=Width}" Height="{Binding ElementName=GasValve,Path=Height}">
- <Image.ContextMenu>
- <ContextMenu Visibility="{Binding MenuVisibility}">
- <MenuItem Header="Open Valve" Click="OpenValve" />
- <MenuItem Header="Close Valve" Click="CloseValve" />
- </ContextMenu>
- </Image.ContextMenu>
- </Image>
- </Canvas>
- </UserControl>
|