ソースを参照

更新AGV界面

样式分支
fyf 2年前
コミット
9d36aa722e
3個のファイルの変更123行の追加34行の削除
  1. バイナリ
     
  2. +84
    -34
      FryPot_DosingSystem/View/AgvView.xaml
  3. +39
    -0
      FryPot_DosingSystem/View/AgvView.xaml.cs

バイナリ
ファイルの表示


+ 84
- 34
FryPot_DosingSystem/View/AgvView.xaml ファイルの表示

@@ -39,6 +39,8 @@
<DiscreteObjectKeyFrame KeyTime="00:00:1.2" Value="{x:Static Visibility.Collapsed}"/>
</ObjectAnimationUsingKeyFrames>
</Storyboard>
</ControlTemplate.Resources>
<Grid Width="60" Height="200" HorizontalAlignment="Left" VerticalAlignment="Top" Margin="0,0,0,0">
<GridSplitter Width="5"></GridSplitter>
@@ -151,31 +153,34 @@
<Storyboard RepeatBehavior="Forever" x:Key="csd_dh">
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="path1" Storyboard.TargetProperty="(UIElement.Visibility)">
<DiscreteObjectKeyFrame KeyTime="00:00:00" Value="{x:Static Visibility.Visible}"/>
<DiscreteObjectKeyFrame KeyTime="00:00:0.5" Value="{x:Static Visibility.Collapsed}"/>
<DiscreteObjectKeyFrame KeyTime="00:00:01" Value="{x:Static Visibility.Visible}"/>
<DiscreteObjectKeyFrame KeyTime="00:00:1.2" Value="{x:Static Visibility.Collapsed}"/>
<DiscreteObjectKeyFrame KeyTime="00:00:0.25" Value="{x:Static Visibility.Visible}"/>
<DiscreteObjectKeyFrame KeyTime="00:00:0.5" Value="{x:Static Visibility.Visible}"/>
<DiscreteObjectKeyFrame KeyTime="00:00:0.75" Value="{x:Static Visibility.Visible}"/>
<DiscreteObjectKeyFrame KeyTime="00:00:1" Value="{x:Static Visibility.Collapsed}"/>
</ObjectAnimationUsingKeyFrames>
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="path2" Storyboard.TargetProperty="(UIElement.Visibility)">
<DiscreteObjectKeyFrame KeyTime="00:00:00" Value="{x:Static Visibility.Visible}"/>
<DiscreteObjectKeyFrame KeyTime="00:00:0.5" Value="{x:Static Visibility.Collapsed}"/>
<DiscreteObjectKeyFrame KeyTime="00:00:00" Value="{x:Static Visibility.Collapsed}"/>
<DiscreteObjectKeyFrame KeyTime="00:00:0.25" Value="{x:Static Visibility.Visible}"/>
<DiscreteObjectKeyFrame KeyTime="00:00:01" Value="{x:Static Visibility.Visible}"/>
<DiscreteObjectKeyFrame KeyTime="00:00:1.2" Value="{x:Static Visibility.Collapsed}"/>
<DiscreteObjectKeyFrame KeyTime="00:00:0.75" Value="{x:Static Visibility.Visible}"/>
<DiscreteObjectKeyFrame KeyTime="00:00:1" Value="{x:Static Visibility.Collapsed}"/>
</ObjectAnimationUsingKeyFrames>

<ObjectAnimationUsingKeyFrames Storyboard.TargetName="path3" Storyboard.TargetProperty="(UIElement.Visibility)">
<DiscreteObjectKeyFrame KeyTime="00:00:00" Value="{x:Static Visibility.Visible}"/>
<DiscreteObjectKeyFrame KeyTime="00:00:0.5" Value="{x:Static Visibility.Collapsed}"/>
<DiscreteObjectKeyFrame KeyTime="00:00:01" Value="{x:Static Visibility.Visible}"/>
<DiscreteObjectKeyFrame KeyTime="00:00:1.2" Value="{x:Static Visibility.Collapsed}"/>
<DiscreteObjectKeyFrame KeyTime="00:00:00" Value="{x:Static Visibility.Collapsed}"/>
<DiscreteObjectKeyFrame KeyTime="00:00:0.25" Value="{x:Static Visibility.Collapsed}"/>
<DiscreteObjectKeyFrame KeyTime="00:00:0.5" Value="{x:Static Visibility.Visible}"/>
<DiscreteObjectKeyFrame KeyTime="00:00:0.75" Value="{x:Static Visibility.Visible}"/>
<DiscreteObjectKeyFrame KeyTime="00:00:1" Value="{x:Static Visibility.Collapsed}"/>
</ObjectAnimationUsingKeyFrames>

<ObjectAnimationUsingKeyFrames Storyboard.TargetName="path4" Storyboard.TargetProperty="(UIElement.Visibility)">
<DiscreteObjectKeyFrame KeyTime="00:00:00" Value="{x:Static Visibility.Visible}"/>
<DiscreteObjectKeyFrame KeyTime="00:00:00" Value="{x:Static Visibility.Collapsed}"/>
<DiscreteObjectKeyFrame KeyTime="00:00:0.25" Value="{x:Static Visibility.Collapsed}"/>
<DiscreteObjectKeyFrame KeyTime="00:00:0.5" Value="{x:Static Visibility.Collapsed}"/>
<DiscreteObjectKeyFrame KeyTime="00:00:01" Value="{x:Static Visibility.Visible}"/>
<DiscreteObjectKeyFrame KeyTime="00:00:1.2" Value="{x:Static Visibility.Collapsed}"/>
<DiscreteObjectKeyFrame KeyTime="00:00:0.75" Value="{x:Static Visibility.Visible}"/>
<DiscreteObjectKeyFrame KeyTime="00:00:1" Value="{x:Static Visibility.Collapsed}"/>
</ObjectAnimationUsingKeyFrames>
</Storyboard>
</ControlTemplate.Resources>
<Grid Width="200" Height="80">
@@ -217,6 +222,18 @@
<Setter TargetName="path3" Property="Visibility" Value="Visible" />
<Setter TargetName="path4" Property="Visibility" Value="Visible" />
</Trigger>

<!--<Trigger Property="Tag" Value="Start">
<Trigger.EnterActions>
<BeginStoryboard x:Name="begin_yundong" Storyboard="{StaticResource yundonglujing}"/>
</Trigger.EnterActions>
</Trigger>

<Trigger Property="Tag" Value="Stop">
<Trigger.EnterActions>
<StopStoryboard BeginStoryboardName="begin_yundong"/>
</Trigger.EnterActions>
</Trigger>-->
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
@@ -227,6 +244,15 @@
</UserControl.Resources>
<Grid>

<!--#region 测试按钮-->
<StackPanel HorizontalAlignment="Right" VerticalAlignment="Top" Margin="0,20,100,0" Orientation="Horizontal">
<Button Width="100" Margin="10,0,0,0" Click="Button_Click" Cursor="Hand">开始</Button>
<Button Width="100" Margin="10,0,0,0" Click="Button_Click">暂停</Button>
<Button Width="100" Margin="10,0,0,0" Click="Button_Click">结束</Button>

</StackPanel>
<!--#endregion-->
<!--#region 墙体-->
<Border Width="20" Margin="0,0,0,18" Style="{DynamicResource border垂直墙}" HorizontalAlignment="Left"/>
<Border Height="20" Margin="-1,0,0,0" Style="{DynamicResource border水平墙}" VerticalAlignment="Bottom"/>
@@ -287,30 +313,42 @@
<!--#endregion-->

<!--#region 运动轨迹路线-->
<TextBox Style="{StaticResource 运输车}" IsEnabled="True" Text="No" Margin="0,288,180,0" VerticalAlignment="Top" HorizontalAlignment="Right" ></TextBox>
<Grid>
<TextBox x:Name="yunshuche" Style="{StaticResource 运输车}" IsEnabled="True" Text="No" Tag="Start" Margin="0,295,180,0" VerticalAlignment="Top" HorizontalAlignment="Right" >
<TextBox.RenderTransform>
<TranslateTransform x:Name="tt" X="0" Y="0"/>
</TextBox.RenderTransform>
</TextBox>
<Path x:Name="qc_1" Data="M1016.5,258.5 L978,258.5 978,340 337.32051,340 337.32051,218.75617" Fill="Transparent" HorizontalAlignment="Left" Height="122" Margin="329,218,150,0" Stroke="Red" Stretch="Fill" VerticalAlignment="Top"/>
</Grid>


<!--#endregion-->
<!--#endregion-->

<!--#region 炒锅区域-->
<StackPanel Orientation="Horizontal">
<Border Style="{DynamicResource border炒锅}"></Border>
<Border Style="{DynamicResource border炒锅}"></Border>
<Border Style="{DynamicResource border炒锅}"></Border>
<Border Style="{DynamicResource border炒锅}"></Border>
<Border Style="{DynamicResource border炒锅}"></Border>
<Border Style="{DynamicResource border炒锅}">
<TextBlock Style="{DynamicResource 80号字体样式}" Width="14" Margin="-10,0,0,0" HorizontalAlignment="Left" VerticalAlignment="Bottom">炒锅(1)号</TextBlock>
</Border>
<Border Style="{DynamicResource border炒锅}">
<TextBlock Style="{DynamicResource 80号字体样式}" Width="14" Margin="-10,0,0,0" HorizontalAlignment="Left" VerticalAlignment="Bottom">炒锅(2)号</TextBlock>
</Border>
<Border Style="{DynamicResource border炒锅}">
<TextBlock Style="{DynamicResource 80号字体样式}" Width="14" Margin="-10,0,0,0" HorizontalAlignment="Left" VerticalAlignment="Bottom">炒锅(3)号</TextBlock>
</Border>
<Border Style="{DynamicResource border炒锅}">
<TextBlock Style="{DynamicResource 80号字体样式}" Width="14" Margin="-10,0,0,0" HorizontalAlignment="Left" VerticalAlignment="Bottom">炒锅(4)号</TextBlock>
</Border>
<Border Style="{DynamicResource border炒锅}">
<TextBlock Style="{DynamicResource 80号字体样式}" Width="14" Margin="-10,0,0,0" HorizontalAlignment="Left" VerticalAlignment="Bottom">炒锅(5)号</TextBlock>
</Border>
</StackPanel>
<TextBlock Style="{DynamicResource 80号字体样式}" Margin="140,0,0,25" HorizontalAlignment="Left" VerticalAlignment="Bottom">炒锅滚筒线</TextBlock>
<TextBlock Style="{DynamicResource 80号字体样式}" Margin="560,0,0,25" HorizontalAlignment="Left" VerticalAlignment="Bottom">炒锅滚筒线</TextBlock>
<TextBlock Style="{DynamicResource 80号字体样式}" Margin="280,0,0,25" HorizontalAlignment="Left" VerticalAlignment="Bottom">炒锅滚筒线</TextBlock>
<TextBlock Style="{DynamicResource 80号字体样式}" Margin="420,0,0,25" HorizontalAlignment="Left" VerticalAlignment="Bottom">炒锅滚筒线</TextBlock>
<!--#endregion-->

<!--#region 滚筒线,IsEnabled True代表有菜 false 空碗.Text:Start 执行动画-->
<StackPanel Orientation="Horizontal" Height="200" Width="325" HorizontalAlignment="Left" VerticalAlignment="Top" Margin="290,0,0,0">
<TextBlock Style="{DynamicResource 80号字体样式}" Width="12" HorizontalAlignment="Right">满料桶滚筒线</TextBlock>
<TextBox Style="{StaticResource 传送带}" IsEnabled="True" Text="Start" Margin="0,0,0,0"></TextBox>
<TextBox Style="{StaticResource 传送带}" IsEnabled="True" Text="Stop" Margin="20,0,0,0"></TextBox>
<TextBox Style="{StaticResource 传送带}" IsEnabled="True" Text="Start" Margin="20,0,0,0"></TextBox>
<TextBox Style="{StaticResource 传送带}" IsEnabled="True" Text="Stop" Margin="20,0,0,0"></TextBox>
<TextBox Style="{StaticResource 传送带}" IsEnabled="False" Margin="20,0,0,0"></TextBox>
<TextBlock Style="{DynamicResource 80号字体样式}" Width="12" HorizontalAlignment="Right">空桶滚筒线</TextBlock>
@@ -319,12 +357,24 @@

<!--#region 停车桩与充电桩-->
<StackPanel HorizontalAlignment="Right" VerticalAlignment="Top" Margin="0,200,30,0">
<Border Style="{DynamicResource border停车位}"></Border>
<Border Style="{DynamicResource border停车位}"></Border>
<Border Style="{DynamicResource border停车位}"></Border>
<Border Style="{DynamicResource border停车位}"></Border>
<Border Style="{DynamicResource border充电桩}"></Border>
<Border Style="{DynamicResource border充电桩}"></Border>
<Border Style="{DynamicResource border停车位}">
<TextBlock Style="{DynamicResource 80号字体样式}" Margin="10,0,0,0" HorizontalAlignment="Left" VerticalAlignment="Bottom">停车桩(1号)</TextBlock>
</Border>
<Border Style="{DynamicResource border停车位}">
<TextBlock Style="{DynamicResource 80号字体样式}" Margin="10,0,0,0" HorizontalAlignment="Left" VerticalAlignment="Bottom">停车桩(2号)</TextBlock>
</Border>
<Border Style="{DynamicResource border停车位}">
<TextBlock Style="{DynamicResource 80号字体样式}" Margin="10,0,0,0" HorizontalAlignment="Left" VerticalAlignment="Bottom">停车桩(3号)</TextBlock>
</Border>
<Border Style="{DynamicResource border停车位}">
<TextBlock Style="{DynamicResource 80号字体样式}" Margin="10,0,0,0" HorizontalAlignment="Left" VerticalAlignment="Bottom">停车桩(4号)</TextBlock>
</Border>
<Border Style="{DynamicResource border充电桩}">
<TextBlock Style="{DynamicResource 80号字体样式}" Margin="0,10,0,-13" HorizontalAlignment="Left" VerticalAlignment="Bottom">充电桩(1号)</TextBlock>
</Border>
<Border Style="{DynamicResource border充电桩}">
<TextBlock Style="{DynamicResource 80号字体样式}" Margin="-2,0,0,-13" HorizontalAlignment="Left" VerticalAlignment="Bottom">充电桩(2号)</TextBlock>
</Border>
</StackPanel>
<StackPanel HorizontalAlignment="Right" VerticalAlignment="Top" Margin="0,200,100,0">
<TextBox Style="{StaticResource 停车位}" Margin="0,50,0,0"/>
@@ -337,7 +387,7 @@
<!--#endregion-->

<!--#region 车子-->
<StackPanel HorizontalAlignment="Right" VerticalAlignment="Top" Margin="0,200,100,0">
<StackPanel HorizontalAlignment="Right" VerticalAlignment="Top" Margin="0,200,90,0">
<TextBox Style="{StaticResource 运输车}" IsEnabled="False" Text="No"></TextBox>
<TextBox Style="{StaticResource 运输车}" IsEnabled="False" Text="No"></TextBox>
<TextBox Style="{StaticResource 运输车}" IsEnabled="False" Text="No"></TextBox>


+ 39
- 0
FryPot_DosingSystem/View/AgvView.xaml.cs ファイルの表示

@@ -10,6 +10,7 @@ using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
@@ -26,5 +27,43 @@ namespace FryPot_DosingSystem.View
InitializeComponent();
this.DataContext = AgvViewModel.GetInstance();
}

private void Button_Click(object sender, RoutedEventArgs e)
{
AnimationByPath(qc_1);
}

/// <summary>
/// 路径动画
/// </summary>
/// <param name="cvs">画板</param>
/// <param name="path">路径</param>
/// <param name="target">动画对象</param>
/// <param name="duration">时间</param>
private void AnimationByPath(Path path, int duration = 5)
{
//从XAML代码中获取移动路径数据
PathGeometry pg = PathGeometry.CreateFromGeometry(Geometry.Parse(path.Data.ToString()));
//创建动画
DoubleAnimationUsingPath dapX = new DoubleAnimationUsingPath();
dapX.PathGeometry = pg;
dapX.Source = PathAnimationSource.X;
dapX.Duration = new Duration(TimeSpan.FromSeconds(duration));

DoubleAnimationUsingPath dapY = new DoubleAnimationUsingPath();
dapY.PathGeometry = pg;
dapY.Source = PathAnimationSource.Y;
dapY.Duration = new Duration(TimeSpan.FromSeconds(duration));

//执行动画
this.tt.BeginAnimation(TranslateTransform.XProperty, dapX);
this.tt.BeginAnimation(TranslateTransform.XProperty, dapY);

//自动返回、永远循序
dapX.AutoReverse = true;
dapX.RepeatBehavior = RepeatBehavior.Forever;
dapY.AutoReverse = true;
dapY.RepeatBehavior = RepeatBehavior.Forever;
}
}
}

読み込み中…
キャンセル
保存