Skip to content

Commit e675066

Browse files
committed
修复 情景中Combox错误的序列化以及鼠标响应
1 parent 6a0f8d6 commit e675066

File tree

3 files changed

+24
-3
lines changed

3 files changed

+24
-3
lines changed

Core/Infrastructure/JsonConverter/CustomScenarioInputValueJsonConverter.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,8 @@ public override void Write(Utf8JsonWriter writer, CustomScenarioValue value, Jso
148148
}
149149
else if (value.RealType.IsEnum)
150150
{
151-
writer.WriteNumberValue((int)value.Value);
151+
var valueValue = (object)value.Value;
152+
writer.WriteNumberValue(Convert.ToInt32(valueValue));
152153
}
153154
else if (value.IsSelf)
154155
{

Core/ViewModel/TaskEditor/TaskEditorViewModel.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -542,6 +542,10 @@ public void SplitConnection(ConnectionItem connection, Point location)
542542
[RelayCommand]
543543
public async Task StartDragging(PointerPressedEventArgs args)
544544
{
545+
if (((Control)args.Source).GetParentOfType<ComboBox>() is not null)
546+
{
547+
return;
548+
}
545549
if (args.Source is Control border)
546550
{
547551
var parentOfType = border.GetParentOfType<Control>("Node");

KitopiaAvalonia/Windows/TaskEditors/NodeInputTemplates.axaml

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@
55
xmlns:u="https://irihi.tech/ursa"
66
xmlns:controls1="clr-namespace:NodifyM.Avalonia.Controls;assembly=NodifyM.Avalonia"
77
xmlns:pluginCore="clr-namespace:PluginCore;assembly=PluginCore"
8-
xmlns:taskEditor="clr-namespace:KitopiaAvalonia.Converter.TaskEditor">
8+
xmlns:taskEditor="clr-namespace:KitopiaAvalonia.Converter.TaskEditor"
9+
xmlns:system="clr-namespace:System;assembly=System.Runtime">
910
<!-- Add Resources Here -->
1011
<pluginCore:ToolTipConverter x:Key="ToolTipConverter" />
1112
<taskEditor:NodeTypeNameI18NCtr x:Key="NodeTypeNameI18NCtr" />
@@ -141,7 +142,22 @@
141142
<ComboBox Margin="10,5,10,5"
142143
x:Name="ComboBox"
143144
MinWidth="40"
144-
SelectedValue="{Binding InputObject.Value,Mode=TwoWay}" />
145+
SelectedValue="{Binding InputObject.Value,Mode=TwoWay}">
146+
<ComboBox.ItemTemplate>
147+
<DataTemplate DataType="system:Enum">
148+
<TextBlock
149+
Foreground="{DynamicResource SemiColorText0}"
150+
Text="{Binding }" />
151+
</DataTemplate>
152+
</ComboBox.ItemTemplate>
153+
<ComboBox.SelectionBoxItemTemplate>
154+
<DataTemplate DataType="system:Enum">
155+
<TextBlock
156+
Foreground="{DynamicResource SemiColorText0}"
157+
Text="{Binding }" />
158+
</DataTemplate>
159+
</ComboBox.SelectionBoxItemTemplate>
160+
</ComboBox>
145161
</StackPanel>
146162

147163
</DataTemplate>

0 commit comments

Comments
 (0)