356 lines
18 KiB
XML
356 lines
18 KiB
XML
<UserControl
|
|
x:Class="Plugin.Cowain.Wcs.Views.ProcessEdit6180Dialog"
|
|
xmlns="https://github.com/avaloniaui"
|
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
|
xmlns:conv="using:Cowain.Base.Converters"
|
|
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
|
xmlns:extensions="using:Cowain.Base.Extensions"
|
|
xmlns:helper="using:Cowain.Base.Helpers"
|
|
xmlns:i18n="clr-namespace:Ke.Bee.Localization.Extensions;assembly=Ke.Bee.Localization"
|
|
xmlns:local="using:Plugin.Cowain.Wcs.ViewModels.ProcessGraph"
|
|
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
|
xmlns:nodify="https://miroiu.github.io/nodify"
|
|
xmlns:u="https://irihi.tech/ursa"
|
|
xmlns:vm="using:Plugin.Cowain.Wcs.ViewModels"
|
|
d:DesignHeight="450"
|
|
d:DesignWidth="800"
|
|
mc:Ignorable="d">
|
|
|
|
<UserControl.KeyBindings>
|
|
<KeyBinding Command="{Binding DisconnectConnectorCommand}" Gesture="Delete" />
|
|
</UserControl.KeyBindings>
|
|
|
|
<UserControl.Resources>
|
|
<helper:BindingProxy x:Key="EditorProxy" DataContext="{Binding}" />
|
|
<helper:BindingProxy x:Key="StationsProxy" DataContext="{Binding Stations}" />
|
|
<conv:I18nLocalizeConverter x:Key="i18nConverter" />
|
|
<conv:ListStringConverter x:Key="listStringConverter" />
|
|
</UserControl.Resources>
|
|
|
|
<Grid
|
|
MinWidth="800"
|
|
MinHeight="600"
|
|
Margin="8,40,8,8"
|
|
RowDefinitions="* Auto">
|
|
<nodify:NodifyEditor
|
|
x:Name="Editor"
|
|
Connections="{Binding Connections}"
|
|
ItemsSource="{Binding Nodes}"
|
|
PendingConnection="{Binding PendingConnection}"
|
|
SelectedConnection="{Binding SelectedConnection}"
|
|
SelectedConnections="{Binding SelectedConnections}"
|
|
SelectedItem="{Binding SelectedNode}"
|
|
SelectedItems="{Binding SelectedNodes}">
|
|
|
|
<nodify:NodifyEditor.KeyBindings>
|
|
<KeyBinding Command="{Binding DeleteSelectionCommand}" Gesture="Delete" />
|
|
|
|
</nodify:NodifyEditor.KeyBindings>
|
|
|
|
<nodify:NodifyEditor.DataTemplates>
|
|
<DataTemplate DataType="{x:Type local:StationNode6180ViewModel}">
|
|
<nodify:Node Header="{Binding}">
|
|
<nodify:Node.HeaderTemplate>
|
|
<DataTemplate>
|
|
<StackPanel Spacing="10">
|
|
<TextBlock>
|
|
<Run>1:</Run>
|
|
<Run Text="{Binding Station1Name}" />
|
|
<Run>:</Run>
|
|
<Run Foreground="Red" Text="{Binding Station1Code}" />
|
|
</TextBlock>
|
|
<TextBlock>
|
|
<Run>2:</Run>
|
|
<Run Text="{Binding Station2Name}" />
|
|
<Run>:</Run>
|
|
<Run Foreground="Red" Text="{Binding Station2Code}" />
|
|
</TextBlock>
|
|
</StackPanel>
|
|
|
|
</DataTemplate>
|
|
</nodify:Node.HeaderTemplate>
|
|
|
|
|
|
<nodify:Node.Template>
|
|
<!-- 自定义 Node 控件模板 -->
|
|
<ControlTemplate TargetType="{x:Type nodify:Node}">
|
|
<Border
|
|
Padding="{TemplateBinding Padding}"
|
|
Background="{TemplateBinding Background}"
|
|
BorderBrush="{TemplateBinding BorderBrush}"
|
|
BorderThickness="{TemplateBinding BorderThickness}"
|
|
CornerRadius="3">
|
|
<Grid>
|
|
<Grid.RowDefinitions>
|
|
<RowDefinition Height="Auto" />
|
|
<RowDefinition Height="*" />
|
|
</Grid.RowDefinitions>
|
|
|
|
<!-- Header -->
|
|
<Border
|
|
Name="PART_Header"
|
|
Grid.ColumnSpan="3"
|
|
Background="{TemplateBinding HeaderBrush}"
|
|
Theme="{TemplateBinding HeaderContainerStyle}">
|
|
<ContentPresenter Content="{TemplateBinding Header}" ContentTemplate="{TemplateBinding HeaderTemplate}" />
|
|
</Border>
|
|
|
|
<!-- Body -->
|
|
<Border Grid.Row="1" Theme="{TemplateBinding ContentContainerStyle}">
|
|
<Grid>
|
|
<!-- 左侧输入节点 -->
|
|
<nodify:NodeInput
|
|
HorizontalAlignment="Left"
|
|
VerticalAlignment="Center"
|
|
Anchor="{Binding Anchor, Mode=OneWayToSource}"
|
|
DataContext="{Binding Input}"
|
|
IsConnected="{Binding IsConnected}" />
|
|
<!-- 右侧输出节点 -->
|
|
<nodify:NodeOutput
|
|
HorizontalAlignment="Right"
|
|
VerticalAlignment="Center"
|
|
Anchor="{Binding Anchor, Mode=OneWayToSource}"
|
|
DataContext="{Binding Output}"
|
|
IsConnected="{Binding IsConnected}" />
|
|
</Grid>
|
|
</Border>
|
|
|
|
</Grid>
|
|
</Border>
|
|
</ControlTemplate>
|
|
</nodify:Node.Template>
|
|
</nodify:Node>
|
|
</DataTemplate>
|
|
</nodify:NodifyEditor.DataTemplates>
|
|
|
|
<nodify:NodifyEditor.ConnectionTemplate>
|
|
<DataTemplate DataType="{x:Type local:Connection6180ViewModel}">
|
|
<nodify:LineConnection
|
|
nodify:BaseConnection.IsSelectable="True"
|
|
Fill="Transparent"
|
|
Source="{Binding Source.Anchor}"
|
|
Spacing="30"
|
|
StrokeThickness="3"
|
|
Target="{Binding Target.Anchor}">
|
|
<nodify:LineConnection.Stroke>
|
|
<SolidColorBrush Opacity="0.7" Color="Blue" />
|
|
</nodify:LineConnection.Stroke>
|
|
<nodify:LineConnection.Theme>
|
|
<ControlTheme TargetType="{x:Type nodify:LineConnection}">
|
|
<Setter Property="OutlineBrush" Value="Transparent" />
|
|
<Style Selector="^:pointerover">
|
|
<Setter Property="OutlineBrush">
|
|
<Setter.Value>
|
|
<SolidColorBrush Opacity="0.15" Color="White" />
|
|
</Setter.Value>
|
|
</Setter>
|
|
</Style>
|
|
<Style Selector="^[(nodify|BaseConnection.IsSelected)=True]">
|
|
<Setter Property="OutlineBrush">
|
|
<Setter.Value>
|
|
<SolidColorBrush Opacity="0.25" Color="DodgerBlue" />
|
|
</Setter.Value>
|
|
</Setter>
|
|
</Style>
|
|
</ControlTheme>
|
|
</nodify:LineConnection.Theme>
|
|
|
|
</nodify:LineConnection>
|
|
</DataTemplate>
|
|
</nodify:NodifyEditor.ConnectionTemplate>
|
|
|
|
<nodify:NodifyEditor.PendingConnectionTemplate>
|
|
<DataTemplate DataType="{x:Type local:PendingConnection6180ViewModel}">
|
|
<nodify:PendingConnection
|
|
AllowOnlyConnectors="True"
|
|
CompletedCommand="{Binding FinishCommand}"
|
|
StartedCommand="{Binding StartCommand}" />
|
|
</DataTemplate>
|
|
</nodify:NodifyEditor.PendingConnectionTemplate>
|
|
|
|
<nodify:NodifyEditor.ItemContainerTheme>
|
|
<ControlTheme BasedOn="{StaticResource {x:Type nodify:ItemContainer}}" TargetType="{x:Type nodify:ItemContainer}">
|
|
<Setter Property="BorderThickness" Value="2" />
|
|
<Setter Property="SelectedBorderThickness" Value="4" />
|
|
|
|
<Setter Property="Location" Value="{Binding Location}" />
|
|
|
|
</ControlTheme>
|
|
</nodify:NodifyEditor.ItemContainerTheme>
|
|
|
|
|
|
<nodify:NodifyEditor.ContextMenu>
|
|
<ContextMenu DataContext="{Binding DataContext, Source={StaticResource EditorProxy}}">
|
|
<MenuItem
|
|
Command="{Binding AddStationCommand}"
|
|
CommandParameter="{Binding #Editor.MouseLocation}"
|
|
Header="{i18n:Localize ProcessEditDialog.AddStation}"
|
|
Tag="{StaticResource AddStateIcon}" />
|
|
</ContextMenu>
|
|
</nodify:NodifyEditor.ContextMenu>
|
|
|
|
|
|
</nodify:NodifyEditor>
|
|
<ScrollViewer
|
|
Width="300"
|
|
Margin="10"
|
|
HorizontalAlignment="Right"
|
|
VerticalAlignment="Top"
|
|
HorizontalScrollBarVisibility="Auto">
|
|
<StackPanel>
|
|
<Border
|
|
Classes="Hover"
|
|
IsVisible="{Binding SelectedNode, Converter={conv:BooleanToVisibilityConverter}}"
|
|
Theme="{StaticResource CardBorder}">
|
|
<StackPanel Margin="10" Spacing="10">
|
|
<StackPanel Margin="0,0,0,14">
|
|
<TextBlock FontWeight="Bold" Text="{i18n:Localize ProcessEditDialog.SelectedStation}" />
|
|
</StackPanel>
|
|
|
|
<ComboBox
|
|
Classes="Large"
|
|
ItemsSource="{Binding Stations}"
|
|
SelectedValue="{Binding SelectedNode.Station1Id, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
|
|
SelectedValueBinding="{Binding Id}">
|
|
<ComboBox.ItemTemplate>
|
|
<DataTemplate x:DataType="vm:StationViewModel">
|
|
<StackPanel
|
|
Margin="10,8"
|
|
Orientation="Horizontal"
|
|
Spacing="10">
|
|
<TextBlock>
|
|
<Run Text="{Binding StationName}" />
|
|
<Run>:</Run>
|
|
<Run Foreground="Red" Text="{Binding StationCode}" />
|
|
</TextBlock>
|
|
</StackPanel>
|
|
</DataTemplate>
|
|
</ComboBox.ItemTemplate>
|
|
</ComboBox>
|
|
|
|
<ComboBox
|
|
Classes="ClearButton"
|
|
ItemsSource="{Binding Stations}"
|
|
SelectedValue="{Binding SelectedNode.Station2Id, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
|
|
SelectedValueBinding="{Binding Id}">
|
|
<ComboBox.ItemTemplate>
|
|
<DataTemplate x:DataType="vm:StationViewModel">
|
|
<StackPanel
|
|
Margin="10,8"
|
|
Orientation="Horizontal"
|
|
Spacing="10">
|
|
<TextBlock>
|
|
<Run Text="{Binding StationName}" />
|
|
<Run>:</Run>
|
|
<Run Foreground="Red" Text="{Binding StationCode}" />
|
|
</TextBlock>
|
|
</StackPanel>
|
|
</DataTemplate>
|
|
</ComboBox.ItemTemplate>
|
|
</ComboBox>
|
|
|
|
|
|
|
|
</StackPanel>
|
|
|
|
|
|
</Border>
|
|
<Border
|
|
Classes="Hover"
|
|
IsVisible="{Binding SelectedConnection, Converter={conv:BooleanToVisibilityConverter}}"
|
|
Theme="{StaticResource CardBorder}">
|
|
<StackPanel Margin="10" Spacing="8">
|
|
<StackPanel Margin="0,0,0,14">
|
|
<TextBlock FontWeight="Bold" Text="{i18n:Localize ProcessEditDialog.ProcessEdit}" />
|
|
</StackPanel>
|
|
<u:FormItem Label="{i18n:Localize ProcessEditDialog.Priority}">
|
|
<NumericUpDown
|
|
Increment="10"
|
|
Maximum="100"
|
|
Minimum="0"
|
|
Value="{Binding SelectedConnection.ProcessFlow.Priority}" />
|
|
</u:FormItem>
|
|
<u:FormItem Label="{i18n:Localize FlowManagement.DataGrid.FromStationStatus1}">
|
|
<ComboBox
|
|
Classes="Large"
|
|
ItemsSource="{x:Static vm:ProcessEdit6180DialogViewModel.StationStateList}"
|
|
SelectedValue="{Binding SelectedConnection.ProcessFlow.FromStatus1, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
|
|
SelectedValueBinding="{Binding .}">
|
|
<ComboBox.ItemTemplate>
|
|
<DataTemplate>
|
|
<TextBlock Text="{Binding, Converter={StaticResource i18nConverter}, ConverterParameter='StationState'}" />
|
|
</DataTemplate>
|
|
</ComboBox.ItemTemplate>
|
|
</ComboBox>
|
|
|
|
</u:FormItem>
|
|
|
|
<u:FormItem Label="{i18n:Localize FlowManagement.DataGrid.ToStationStatus1}">
|
|
<ComboBox
|
|
Classes="Large"
|
|
ItemsSource="{x:Static vm:ProcessEditDialogViewModel.StationStateList}"
|
|
SelectedValue="{Binding SelectedConnection.ProcessFlow.ToStatus1, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
|
|
SelectedValueBinding="{Binding .}">
|
|
<ComboBox.ItemTemplate>
|
|
<DataTemplate>
|
|
<TextBlock Text="{Binding, Converter={StaticResource i18nConverter}, ConverterParameter='StationState'}" />
|
|
</DataTemplate>
|
|
</ComboBox.ItemTemplate>
|
|
</ComboBox>
|
|
</u:FormItem>
|
|
|
|
<u:FormItem Label="{i18n:Localize FlowManagement.DataGrid.FromStationStatus2}">
|
|
<ComboBox
|
|
Classes="Large"
|
|
ItemsSource="{x:Static vm:ProcessEdit6180DialogViewModel.StationStateList}"
|
|
SelectedValue="{Binding SelectedConnection.ProcessFlow.FromStatus2, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
|
|
SelectedValueBinding="{Binding .}">
|
|
<ComboBox.ItemTemplate>
|
|
<DataTemplate>
|
|
<TextBlock Text="{Binding, Converter={StaticResource i18nConverter}, ConverterParameter='StationState'}" />
|
|
</DataTemplate>
|
|
</ComboBox.ItemTemplate>
|
|
</ComboBox>
|
|
|
|
</u:FormItem>
|
|
|
|
<u:FormItem Label="{i18n:Localize FlowManagement.DataGrid.ToStationStatus2}">
|
|
<ComboBox
|
|
Classes="Large"
|
|
ItemsSource="{x:Static vm:ProcessEditDialogViewModel.StationStateList}"
|
|
SelectedValue="{Binding SelectedConnection.ProcessFlow.ToStatus2, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
|
|
SelectedValueBinding="{Binding .}">
|
|
<ComboBox.ItemTemplate>
|
|
<DataTemplate>
|
|
<TextBlock Text="{Binding, Converter={StaticResource i18nConverter}, ConverterParameter='StationState'}" />
|
|
</DataTemplate>
|
|
</ComboBox.ItemTemplate>
|
|
</ComboBox>
|
|
</u:FormItem>
|
|
|
|
</StackPanel>
|
|
|
|
|
|
</Border>
|
|
|
|
</StackPanel>
|
|
</ScrollViewer>
|
|
<StackPanel
|
|
Grid.Row="1"
|
|
Margin="8"
|
|
HorizontalAlignment="Right"
|
|
Orientation="Horizontal"
|
|
Spacing="12">
|
|
<Button
|
|
Command="{Binding OkCommand}"
|
|
Content="{i18n:Localize OK}"
|
|
Theme="{DynamicResource SolidButton}" />
|
|
<Button
|
|
Command="{Binding CancelCommand}"
|
|
Content="{i18n:Localize Cancel}"
|
|
Theme="{DynamicResource SolidButton}" />
|
|
</StackPanel>
|
|
</Grid>
|
|
|
|
</UserControl>
|