2025-07-16 12:19

This commit is contained in:
wang-yin1
2025-07-16 12:20:02 +08:00
parent ca823a9294
commit 25d7fc3330
13 changed files with 801 additions and 305 deletions

View File

@@ -1,65 +1,85 @@
<Window x:Class="VisionFrame.Views.MainView"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:VisionFrame.Views"
mc:Ignorable="d" Name="win"
WindowStartupLocation="CenterScreen"
FontWeight="ExtraLight"
FontSize="12"
Title="运动视觉框架" Height="750" Width="1300">
<Window
x:Class="VisionFrame.Views.MainView"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:VisionFrame.Views"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
Name="win"
Title="运动视觉框架"
Width="1300"
Height="750"
FontSize="12"
FontWeight="ExtraLight"
WindowStartupLocation="CenterScreen"
mc:Ignorable="d">
<WindowChrome.WindowChrome>
<WindowChrome NonClientFrameEdges="None" UseAeroCaptionButtons="False"/>
<WindowChrome NonClientFrameEdges="None" UseAeroCaptionButtons="False" />
</WindowChrome.WindowChrome>
<Window.Background>
<LinearGradientBrush StartPoint="0,0" EndPoint="1,0">
<GradientStop Color="#DCEAFC" Offset="0"/>
<GradientStop Color="#FFFFFF" Offset="0.5"/>
<GradientStop Color="#DCEAFC" Offset="1"/>
<GradientStop Offset="0" Color="#DCEAFC" />
<GradientStop Offset="0.5" Color="#FFFFFF" />
<GradientStop Offset="1" Color="#DCEAFC" />
</LinearGradientBrush>
</Window.Background>
<Window.Resources>
<ControlTemplate TargetType="RadioButton" x:Key="CatalogButtonTemp">
<ControlTemplate x:Key="CatalogButtonTemp" TargetType="RadioButton">
<Grid>
<Border Background="Transparent"
Height="40" Margin="0,2"
Name="border">
<TextBlock Text="{Binding Icon}"
FontFamily="{StaticResource Iconfont}"
FontSize="22" Foreground="White"
VerticalAlignment="Center"
HorizontalAlignment="Center"/>
<Border
Name="border"
Height="40"
Margin="0,2"
Background="Transparent">
<TextBlock
HorizontalAlignment="Center"
VerticalAlignment="Center"
FontFamily="{StaticResource Iconfont}"
FontSize="22"
Foreground="White"
Text="{Binding Icon}" />
</Border>
<Canvas Name="canvas" Visibility="Collapsed" Background="Transparent"
Width="60">
<Polygon Points="5 0 0 4 5 8"
Fill="#DD1f71e5"
Canvas.Left="50"
Canvas.Top="10"/>
<Border MaxWidth="200" Height="60" Canvas.Left="55"
Background="#DD1f71e5" CornerRadius="5"
TextBlock.Foreground="White">
<Canvas
Name="canvas"
Width="60"
Background="Transparent"
Visibility="Collapsed">
<Polygon
Canvas.Left="50"
Canvas.Top="10"
Fill="#DD1f71e5"
Points="5 0 0 4 5 8" />
<Border
Canvas.Left="55"
Height="60"
MaxWidth="200"
Background="#DD1f71e5"
CornerRadius="5"
TextBlock.Foreground="White">
<StackPanel Margin="10,0" VerticalAlignment="Center">
<TextBlock Text="{Binding Name}" FontWeight="Bold" Margin="0,0,0,5"/>
<Border Height="1" Background="#3FFF"/>
<TextBlock Text="{Binding Description}"
Foreground="#9FFF"
TextTrimming="CharacterEllipsis" Margin="0,5,0,0"/>
<TextBlock
Margin="0,0,0,5"
FontWeight="Bold"
Text="{Binding Name}" />
<Border Height="1" Background="#3FFF" />
<TextBlock
Margin="0,5,0,0"
Foreground="#9FFF"
Text="{Binding Description}"
TextTrimming="CharacterEllipsis" />
</StackPanel>
</Border>
</Canvas>
</Grid>
<ControlTemplate.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter TargetName="border" Property="Background" Value="#2FFF"/>
<Setter TargetName="border" Property="Background" Value="#2FFF" />
<!--<Setter TargetName="canvas" Property="Visibility" Value="Visible"/>-->
<Trigger.EnterActions>
<BeginStoryboard>
<Storyboard>
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="canvas"
Storyboard.TargetProperty="Visibility">
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="canvas" Storyboard.TargetProperty="Visibility">
<DiscreteObjectKeyFrame KeyTime="0:0:0">
<DiscreteObjectKeyFrame.Value>
<Visibility>Collapsed</Visibility>
@@ -78,8 +98,7 @@
<Trigger.ExitActions>
<BeginStoryboard>
<Storyboard>
<ObjectAnimationUsingKeyFrames
Storyboard.TargetName="canvas" Storyboard.TargetProperty="Visibility">
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="canvas" Storyboard.TargetProperty="Visibility">
<DiscreteObjectKeyFrame KeyTime="0:0:0">
<DiscreteObjectKeyFrame.Value>
<Visibility>Collapsed</Visibility>
@@ -91,149 +110,253 @@
</Trigger.ExitActions>
</Trigger>
<Trigger Property="IsChecked" Value="True">
<Setter TargetName="border" Property="Background" Value="#6FFF"/>
<Setter TargetName="border" Property="Background" Value="#6FFF" />
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
<Style x:Key="ExpandedButtonStyle" TargetType="ToggleButton">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="ToggleButton">
<Border Name="border" Background="Transparent">
<ContentPresenter HorizontalAlignment="Center" VerticalAlignment="Center" />
</Border>
<ControlTemplate.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter TargetName="border" Property="Background" Value="#1000" />
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<Storyboard x:Key="sb_menu_retract">
<DoubleAnimation
Storyboard.TargetName="grid_sub_menu"
Storyboard.TargetProperty="Width"
To="0"
Duration="0:0:0.3" />
</Storyboard>
<Storyboard x:Key="sb_menu_expand">
<DoubleAnimation
Storyboard.TargetName="grid_sub_menu"
Storyboard.TargetProperty="Width"
Duration="0:0:0.3" />
</Storyboard>
</Window.Resources>
<Grid ClipToBounds="True">
<Ellipse Width="500" Height="500" Fill="{StaticResource lgb}"
VerticalAlignment="Top" HorizontalAlignment="Left"
Margin="200,-80,0,0" Opacity="0.6">
</Ellipse>
<Ellipse Width="400" Height="400" Fill="{StaticResource lgb}"
VerticalAlignment="Top" HorizontalAlignment="Left"
Margin="-80,-250,0,0">
</Ellipse>
<Ellipse
Width="500"
Height="500"
Margin="200,-80,0,0"
HorizontalAlignment="Left"
VerticalAlignment="Top"
Fill="{StaticResource lgb}"
Opacity="0.6" />
<Ellipse
Width="400"
Height="400"
Margin="-80,-250,0,0"
HorizontalAlignment="Left"
VerticalAlignment="Top"
Fill="{StaticResource lgb}" />
<!--窗口内容部分-->
<!-- 窗口内容部分 -->
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="50"/>
<RowDefinition/>
<RowDefinition Height="50" />
<RowDefinition />
</Grid.RowDefinitions>
<!--Logo+Title-->
<StackPanel Orientation="Horizontal" HorizontalAlignment="Left"
VerticalAlignment="Center">
<!-- Logo+Title -->
<StackPanel
HorizontalAlignment="Left"
VerticalAlignment="Center"
Orientation="Horizontal">
<!--<Image Source="../Assets/Images/Logo_64.png" Width="30"
Effect="{StaticResource dse}"
Margin="10,0"/>-->
<TextBlock FontSize="14" FontFamily="YouYuan"
Foreground="#555" Effect="{StaticResource dse}"
VerticalAlignment="Center">
<Run Text=" "/>
<Run Text=" "/>
<Run Text="运动视觉流程控制系统"/>
<Run Text="v1.0" FontFamily="Microsoft YaHei" FontSize="9"/>
<TextBlock
VerticalAlignment="Center"
Effect="{StaticResource dse}"
FontFamily="YouYuan"
FontSize="14"
Foreground="#555">
<Run Text=" " />
<Run Text=" " />
<Run Text="运动视觉流程控制系统" />
<Run
FontFamily="Microsoft YaHei"
FontSize="9"
Text="v1.0" />
</TextBlock>
</StackPanel>
<!--Title部分控制按钮-->
<StackPanel Orientation="Horizontal" VerticalAlignment="Top" HorizontalAlignment="Right">
<Button Content="&#xe617;" Style="{StaticResource TitleButtonStyle}"
Command="{Binding NewFlowCommand}"/>
<Button Content="&#xeabe;" Style="{StaticResource TitleButtonStyle}"
Command="{Binding OpenFlowCommand}"/>
<Button Content="&#xe60f;" Style="{StaticResource TitleButtonStyle}"
Command="{Binding SaveFlowCommand}"/>
<Button Content="&#xe9d4;" Style="{StaticResource TitleButtonStyle}"/>
<Border Height="16" Width="1" Background="#CCC" Margin="5,0" VerticalAlignment="Center"/>
<Button Content="&#xea6e;" Style="{StaticResource TitleButtonStyle}"/>
<Button Content="&#xea76;" Style="{StaticResource TitleButtonStyle}"/>
<Border Height="16" Width="1" Background="#CCC" Margin="5,0"/>
<Button Content="&#xe669;" Style="{StaticResource TitleButtonStyle}"/>
<Button Content="&#xe618;" Style="{StaticResource TitleButtonStyle}"/>
<Border Height="16" Width="1" Background="#CCC" Margin="5,0"/>
<TextBlock Text="&#xe80a;" FontFamily="{StaticResource Iconfont}" VerticalAlignment="Center"
FontSize="18" Margin="3,0" Foreground=" #1f71e5"/>
<TextBlock Text="&lt;未登录&gt;" VerticalAlignment="Center" Margin="3,0"/>
<Border Height="16" Width="1" Background="#CCC" Margin="5,0"/>
<Button Content="&#xe65a;" Style="{StaticResource TitleButtonStyle}"
FontSize="14" Margin="0"
Command="{Binding MinimizeCommand}"/>
<Button Content="&#xe692;" Style="{StaticResource TitleButtonStyle}"
FontSize="14" Margin="0"
Command="{Binding MaximizeCommand}"/>
<Button Content="&#xe660;" Style="{StaticResource TitleButtonStyle}"
FontSize="14" Margin="0,0,5,0"
Click="Button_Click"/>
<!-- Title部分控制按钮 -->
<StackPanel
HorizontalAlignment="Right"
VerticalAlignment="Top"
Orientation="Horizontal">
<Button
Command="{Binding NewFlowCommand}"
Content="&#xe617;"
Style="{StaticResource TitleButtonStyle}" />
<Button
Command="{Binding OpenFlowCommand}"
Content="&#xeabe;"
Style="{StaticResource TitleButtonStyle}" />
<Button
Command="{Binding SaveFlowCommand}"
Content="&#xe60f;"
Style="{StaticResource TitleButtonStyle}" />
<Button Content="&#xe9d4;" Style="{StaticResource TitleButtonStyle}" />
<Border
Width="1"
Height="16"
Margin="5,0"
VerticalAlignment="Center"
Background="#CCC" />
<Button Content="&#xea6e;" Style="{StaticResource TitleButtonStyle}" />
<Button Content="&#xea76;" Style="{StaticResource TitleButtonStyle}" />
<Border
Width="1"
Height="16"
Margin="5,0"
Background="#CCC" />
<Button Content="&#xe669;" Style="{StaticResource TitleButtonStyle}" />
<Button Content="&#xe618;" Style="{StaticResource TitleButtonStyle}" />
<Border
Width="1"
Height="16"
Margin="5,0"
Background="#CCC" />
<TextBlock
Margin="3,0"
VerticalAlignment="Center"
FontFamily="{StaticResource Iconfont}"
FontSize="18"
Foreground=" #1f71e5"
Text="&#xe80a;" />
<TextBlock
Margin="3,0"
VerticalAlignment="Center"
Text="&lt;未登录&gt;" />
<Border
Width="1"
Height="16"
Margin="5,0"
Background="#CCC" />
<Button
Margin="0"
Command="{Binding MinimizeCommand}"
Content="&#xe65a;"
FontSize="14"
Style="{StaticResource TitleButtonStyle}" />
<Button
Margin="0"
Command="{Binding MaximizeCommand}"
Content="&#xe692;"
FontSize="14"
Style="{StaticResource TitleButtonStyle}" />
<Button
Margin="0,0,5,0"
Click="Button_Click"
Content="&#xe660;"
FontSize="14"
Style="{StaticResource TitleButtonStyle}" />
</StackPanel>
<!--流程相关交互-->
<!-- 流程相关交互 -->
<Grid Grid.Row="1" Margin="10,0,10,10">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="45"/>
<ColumnDefinition Width="150"/>
<ColumnDefinition/>
<ColumnDefinition Width="55" />
<ColumnDefinition Width="auto" />
<ColumnDefinition />
</Grid.ColumnDefinitions>
<Border Background="#1f71e5" CornerRadius="10,0,0,10"/>
<Border Background="#8FFF" Grid.Column="1"/>
<Border Background="#1f71e5" CornerRadius="10,0,0,10" />
<Border Grid.Column="1" Background="#8FFF" />
<!--组件类别-->
<ItemsControl ItemsSource="{Binding CatalogList}"
Margin="0,8"
Panel.ZIndex="10">
<!-- 组件类别 -->
<ItemsControl
Margin="0,8"
Panel.ZIndex="10"
ItemsSource="{Binding CatalogList}">
<ItemsControl.ItemTemplate>
<DataTemplate>
<RadioButton GroupName="A"
IsChecked="{Binding IsSelected}"
Template="{StaticResource CatalogButtonTemp}"
Command="{Binding DataContext.CatalogItemCommand,RelativeSource={RelativeSource AncestorType=Window}}"
CommandParameter="{Binding}">
</RadioButton>
<RadioButton
Command="{Binding DataContext.CatalogItemCommand, RelativeSource={RelativeSource AncestorType=Window}}"
CommandParameter="{Binding}"
GroupName="A"
IsChecked="{Binding IsSelected}"
Template="{StaticResource CatalogButtonTemp}" />
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>
<!--组件列表-->
<Grid Grid.Column="1">
<!-- 组件列表 -->
<Grid
Name="grid_sub_menu"
Grid.Column="1"
Width="150">
<Grid.RowDefinitions>
<RowDefinition Height="30"/>
<RowDefinition/>
<RowDefinition Height="30" />
<RowDefinition />
</Grid.RowDefinitions>
<Border Height="1" Background="#1000" VerticalAlignment="Bottom"/>
<Border
Height="1"
VerticalAlignment="Bottom"
Background="#1000" />
<TextBlock Text="{Binding CurrentCatalog.Name}"
VerticalAlignment="Center" Margin="5,0"
FontWeight="Bold" Foreground="#666"/>
<TextBlock
Margin="5,0"
VerticalAlignment="Center"
FontWeight="Bold"
Foreground="#666"
Text="{Binding CurrentCatalog.Name}" />
<ItemsControl ItemsSource="{Binding CurrentCatalog.Components}"
Grid.Row="1" VerticalAlignment="Top">
<ItemsControl
Grid.Row="1"
VerticalAlignment="Top"
ItemsSource="{Binding CurrentCatalog.Components}">
<ItemsControl.ItemsPanel>
<ItemsPanelTemplate>
<UniformGrid Columns="2"/>
<UniformGrid Columns="2" />
</ItemsPanelTemplate>
</ItemsControl.ItemsPanel>
<ItemsControl.ItemTemplate>
<DataTemplate>
<Border Background="Transparent"
Width="55" VerticalAlignment="Center"
HorizontalAlignment="Center"
CornerRadius="5"
Margin="0,5"
Name="border">
<Border
Name="border"
Width="55"
Margin="0,5"
HorizontalAlignment="Center"
VerticalAlignment="Center"
Background="Transparent"
CornerRadius="5">
<Border.InputBindings>
<MouseBinding MouseAction="LeftClick"
Command="{Binding DataContext.ComponentItemCommand,ElementName=win}"
CommandParameter="{Binding ElementName=border}"/>
<MouseBinding
Command="{Binding DataContext.ComponentItemCommand, ElementName=win}"
CommandParameter="{Binding ElementName=border}"
MouseAction="LeftClick" />
</Border.InputBindings>
<StackPanel Margin="0,5">
<TextBlock Text="{Binding Icon}"
FontFamily="{StaticResource Iconfont}"
FontSize="30"
Foreground="#771f71e5"
HorizontalAlignment="Center"/>
<TextBlock Text="{Binding Name}"
FontSize="10"
HorizontalAlignment="Center"
Foreground="#C000"/>
<TextBlock
HorizontalAlignment="Center"
FontFamily="{StaticResource Iconfont}"
FontSize="30"
Foreground="#771f71e5"
Text="{Binding Icon}" />
<TextBlock
HorizontalAlignment="Center"
FontSize="10"
Foreground="#C000"
Text="{Binding Name}" />
</StackPanel>
</Border>
<DataTemplate.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter TargetName="border" Property="Background" Value="#1000"/>
<Setter TargetName="border" Property="Background" Value="#1000" />
</Trigger>
</DataTemplate.Triggers>
</DataTemplate>
@@ -241,25 +364,69 @@
</ItemsControl>
</Grid>
<!--流程页-->
<TabControl Style="{DynamicResource TabControlStyle}" Grid.Column="2"
Margin="3,0,0,0" BorderThickness="0,1,0,0"
BorderBrush="#1f71e5"
Background="Transparent"
ItemsSource="{Binding FlowTabList}"
SelectedIndex="0">
<!-- 流程页 -->
<TabControl
Grid.Column="2"
Margin="3,0,0,0"
Background="Transparent"
BorderBrush="#1f71e5"
BorderThickness="0,1,0,0"
ItemsSource="{Binding FlowTabList}"
SelectedIndex="0"
Style="{DynamicResource TabControlStyle}">
<TabControl.ItemContainerStyle>
<Style TargetType="TabItem" BasedOn="{StaticResource FlowTabStyle}">
<Setter Property="Header" Value="{Binding Title}"/>
<Setter Property="IsSelected" Value="{Binding IsCurrent}"/>
<Style BasedOn="{StaticResource FlowTabStyle}" TargetType="TabItem">
<Setter Property="Header" Value="{Binding Title}" />
<Setter Property="IsSelected" Value="{Binding IsCurrent}" />
</Style>
</TabControl.ItemContainerStyle>
<TabControl.ContentTemplate>
<DataTemplate>
<local:FlowTabView/>
<local:FlowTabView />
</DataTemplate>
</TabControl.ContentTemplate>
</TabControl>
<ToggleButton
Name="tb_menu_switch"
Grid.Column="2"
Width="35"
Height="35"
Margin="5,0,0,0"
HorizontalAlignment="Left"
VerticalAlignment="Top"
Background="Transparent"
BorderThickness="0"
IsChecked="False"
IsThreeState="False"
Style="{StaticResource ExpandedButtonStyle}"
ToolTip="展开/收缩菜单"
WindowChrome.IsHitTestVisibleInChrome="True">
<ToggleButton.Triggers>
<EventTrigger RoutedEvent="ToggleButton.Checked">
<BeginStoryboard Storyboard="{StaticResource sb_menu_retract}" />
</EventTrigger>
<EventTrigger RoutedEvent="ToggleButton.Unchecked">
<BeginStoryboard Storyboard="{StaticResource sb_menu_expand}" />
</EventTrigger>
</ToggleButton.Triggers>
<TextBlock
HorizontalAlignment="Center"
VerticalAlignment="Center"
FontFamily="{StaticResource Iconfonts}"
FontSize="16"
Foreground="Orange"
RenderTransformOrigin="0.5,0.5"
Text="&#xe67d;">
<TextBlock.RenderTransform>
<RotateTransform Angle="90" />
</TextBlock.RenderTransform>
</TextBlock>
</ToggleButton>
</Grid>
</Grid>
</Grid>