Skip to content
This repository was archived by the owner on Jul 28, 2024. It is now read-only.

Commit 9d65522

Browse files
committed
Update EditFunctionWIndow.xaml.cs
1 parent 62c7040 commit 9d65522

1 file changed

Lines changed: 8 additions & 6 deletions

File tree

src/LXLDevHelper/Views/EditFunctionWIndow.xaml.cs

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
using System.Windows;
1+
using Newtonsoft.Json;
2+
using System.Windows;
23
using System.Windows.Controls;
34
using static LXLDevHelper.Tools.Message;
45

@@ -20,12 +21,14 @@ public static string ShowEditFunctionDialog(string target)
2021
public EditFunctionWindow(string text)
2122
{
2223
input = text;
23-
const string prefix = "Function@";
24-
if (text.StartsWith(prefix))
24+
const string prefix = "Function@";//匿名函数前缀
25+
//匿名函数样式:
26+
// Function@{json信息}
27+
if (text.StartsWith(prefix))//判断方式,以Function@开头
2528
{
2629
try
27-
{
28-
Data = Newtonsoft.Json.JsonConvert.DeserializeObject<ViewModels.EditFunctionWindowViewModel>(text.Substring(prefix.Length));
30+
{//反序列化到结构体
31+
Data = JsonConvert.DeserializeObject<ViewModels.EditFunctionWindowViewModel>(text.Substring(prefix.Length));
2932
}
3033
catch (System.Exception ex) { ShowWarn($"加载数据失败!\n{text}\n{ex}"); }
3134
}
@@ -83,7 +86,6 @@ private void SelectTypeMenuItem_Click(object sender, RoutedEventArgs e)
8386
var text = ((ViewModels.LXLFuncParamsBase)me.Tag).ParamType;
8487
var result = EditFunction(text);
8588
((ViewModels.LXLFuncParamsBase)me.Tag).ParamType = result;
86-
8789
}
8890
private void SelectTypeComboBox_SelectionChanged(object sender, SelectionChangedEventArgs e)
8991
{

0 commit comments

Comments
 (0)