Blower.xaml 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  1. <UserControl x:Class="CyberX8_Themes.UserControls.Blower"
  2. xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
  3. xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
  4. xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
  5. xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
  6. xmlns:local="clr-namespace:CyberX8_Themes.UserControls"
  7. xmlns:converters="clr-namespace:CyberX8_Themes.Converters"
  8. mc:Ignorable="d"
  9. x:Name="blower"
  10. d:DesignHeight="80" d:DesignWidth="80">
  11. <UserControl.Resources>
  12. <converters:BoolToVisibility x:Key="boolToVisibility"></converters:BoolToVisibility>
  13. <converters:BoolToVisibility2 x:Key="boolToVisibility2"></converters:BoolToVisibility2>
  14. <Style x:Key="StackPanelStyle" TargetType="StackPanel">
  15. <Style.Setters>
  16. <Setter Property="RenderTransform">
  17. <Setter.Value>
  18. <TransformGroup>
  19. <RotateTransform/>
  20. </TransformGroup>
  21. </Setter.Value>
  22. </Setter>
  23. </Style.Setters>
  24. <Style.Triggers>
  25. <DataTrigger Binding="{Binding ElementName=blower, Path=IsPowerOn}" Value="True">
  26. <DataTrigger.EnterActions>
  27. <BeginStoryboard x:Name="StackPanelStoryBoard">
  28. <Storyboard RepeatBehavior="Forever">
  29. <DoubleAnimation Storyboard.TargetProperty=
  30. "RenderTransform.Children[0].Angle"
  31. Duration="0:0:1" BeginTime="0:0:0"
  32. From="0" To="-360" />
  33. </Storyboard>
  34. </BeginStoryboard>
  35. </DataTrigger.EnterActions>
  36. <DataTrigger.ExitActions>
  37. <StopStoryboard BeginStoryboardName="StackPanelStoryBoard" />
  38. </DataTrigger.ExitActions>
  39. </DataTrigger>
  40. </Style.Triggers>
  41. </Style>
  42. <Style x:Key="StackPanelStyle1" TargetType="StackPanel">
  43. <Style.Setters>
  44. <Setter Property="RenderTransform">
  45. <Setter.Value>
  46. <TransformGroup>
  47. <RotateTransform/>
  48. </TransformGroup>
  49. </Setter.Value>
  50. </Setter>
  51. </Style.Setters>
  52. <Style.Triggers>
  53. <DataTrigger Binding="{Binding ElementName=blower, Path=IsHighOn}" Value="True">
  54. <DataTrigger.EnterActions>
  55. <BeginStoryboard x:Name="StackPanelStoryBoard">
  56. <Storyboard RepeatBehavior="Forever">
  57. <DoubleAnimation Storyboard.TargetProperty=
  58. "RenderTransform.Children[0].Angle"
  59. Duration="0:0:0.5" BeginTime="0:0:0"
  60. From="0" To="-360" />
  61. </Storyboard>
  62. </BeginStoryboard>
  63. </DataTrigger.EnterActions>
  64. <DataTrigger.ExitActions>
  65. <StopStoryboard BeginStoryboardName="StackPanelStoryBoard" />
  66. </DataTrigger.ExitActions>
  67. </DataTrigger>
  68. </Style.Triggers>
  69. </Style>
  70. </UserControl.Resources>
  71. <Viewbox Stretch="Fill" Margin="0,0,0,4">
  72. <Canvas Width="70" Height="70" RenderTransformOrigin="0.49 0.49">
  73. <Canvas.RenderTransform>
  74. <TransformGroup>
  75. <RotateTransform Angle="{Binding ElementName=pump1,Path=RotateTransformValue}"></RotateTransform>
  76. </TransformGroup>
  77. </Canvas.RenderTransform>
  78. <StackPanel>
  79. <Image Width="70" Height="70" Source="pack://application:,,,/CyberX8_Themes;component/Themes/Images/parts/blower.png"></Image>
  80. </StackPanel>
  81. <StackPanel Style="{StaticResource StackPanelStyle}" RenderTransformOrigin="0.49,0.49" Margin="13,20,0,0" Visibility="{Binding ElementName=blower,Path=IsHighOn,Converter={StaticResource boolToVisibility}}">
  82. <Image Width="30" Height="30" Source="pack://application:,,,/CyberX8_Themes;component/Themes/Images/parts/Pump2.png"/>
  83. </StackPanel>
  84. <StackPanel Style="{StaticResource StackPanelStyle1}" RenderTransformOrigin="0.49,0.49" Margin="13,20,0,0" Visibility="{Binding ElementName=blower,Path=IsHighOn,Converter={StaticResource boolToVisibility2}}">
  85. <Image Width="30" Height="30" Source="pack://application:,,,/CyberX8_Themes;component/Themes/Images/parts/Pump2.png"/>
  86. </StackPanel>
  87. </Canvas>
  88. </Viewbox>
  89. </UserControl>