mirror of
https://gitee.com/langsisi_admin/serein-flow
synced 2026-04-04 23:36:35 +08:00
恢复WPF项目代码
This commit is contained in:
13
Workbench/Node/ViewModel/ActionNodeControlViewModel.cs
Normal file
13
Workbench/Node/ViewModel/ActionNodeControlViewModel.cs
Normal file
@@ -0,0 +1,13 @@
|
||||
using Serein.NodeFlow.Model;
|
||||
using Serein.Workbench.Node.View;
|
||||
|
||||
namespace Serein.Workbench.Node.ViewModel
|
||||
{
|
||||
public class ActionNodeControlViewModel : NodeControlViewModelBase
|
||||
{
|
||||
public ActionNodeControlViewModel(SingleActionNode node) : base(node)
|
||||
{
|
||||
// this.NodelModel = node;
|
||||
}
|
||||
}
|
||||
}
|
||||
54
Workbench/Node/ViewModel/ConditionNodeControlViewModel.cs
Normal file
54
Workbench/Node/ViewModel/ConditionNodeControlViewModel.cs
Normal file
@@ -0,0 +1,54 @@
|
||||
using Serein.NodeFlow.Model;
|
||||
using Serein.Workbench.Node.View;
|
||||
|
||||
namespace Serein.Workbench.Node.ViewModel
|
||||
{
|
||||
/// <summary>
|
||||
/// 条件节点
|
||||
/// </summary>
|
||||
public class ConditionNodeControlViewModel : NodeControlViewModelBase
|
||||
{
|
||||
public new SingleConditionNode NodeModel { get; }
|
||||
|
||||
/// <summary>
|
||||
/// 是否为自定义参数
|
||||
/// </summary>
|
||||
public bool IsCustomData
|
||||
{
|
||||
get => NodeModel.IsExplicitData;
|
||||
set { NodeModel.IsExplicitData = value; OnPropertyChanged(); }
|
||||
}
|
||||
/// <summary>
|
||||
/// 自定义参数值
|
||||
/// </summary>
|
||||
public string? CustomData
|
||||
{
|
||||
get => NodeModel.ExplicitData;
|
||||
set { NodeModel.ExplicitData = value ; OnPropertyChanged(); }
|
||||
}
|
||||
/// <summary>
|
||||
/// 表达式
|
||||
/// </summary>
|
||||
public string Expression
|
||||
{
|
||||
get => NodeModel.Expression;
|
||||
set { NodeModel.Expression = value; OnPropertyChanged(); }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 条件节点
|
||||
/// </summary>
|
||||
/// <param name="node"></param>
|
||||
public ConditionNodeControlViewModel(SingleConditionNode node) : base(node)
|
||||
{
|
||||
this.NodeModel = node;
|
||||
if(node is null)
|
||||
{
|
||||
IsCustomData = false;
|
||||
CustomData = "";
|
||||
Expression = "PASS";
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
using Serein.NodeFlow.Model;
|
||||
using Serein.Workbench.Node.View;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Serein.Workbench.Node.ViewModel
|
||||
{
|
||||
public class ConditionRegionNodeControlViewModel : NodeControlViewModelBase
|
||||
{
|
||||
public ConditionRegionNodeControlViewModel(CompositeConditionNode node):base(node)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
26
Workbench/Node/ViewModel/ExpOpNodeControlViewModel.cs
Normal file
26
Workbench/Node/ViewModel/ExpOpNodeControlViewModel.cs
Normal file
@@ -0,0 +1,26 @@
|
||||
using Serein.NodeFlow.Model;
|
||||
using Serein.Workbench.Node.View;
|
||||
|
||||
namespace Serein.Workbench.Node.ViewModel
|
||||
{
|
||||
public class ExpOpNodeControlViewModel: NodeControlViewModelBase
|
||||
{
|
||||
public new SingleExpOpNode NodeModel { get; }
|
||||
|
||||
//public string Expression
|
||||
//{
|
||||
// get => node.Expression;
|
||||
// set
|
||||
// {
|
||||
// node.Expression = value;
|
||||
// OnPropertyChanged();
|
||||
// }
|
||||
//}
|
||||
|
||||
|
||||
public ExpOpNodeControlViewModel(SingleExpOpNode nodeModel) : base(nodeModel)
|
||||
{
|
||||
this.NodeModel = nodeModel;
|
||||
}
|
||||
}
|
||||
}
|
||||
14
Workbench/Node/ViewModel/FlipflopNodeControlViewModel.cs
Normal file
14
Workbench/Node/ViewModel/FlipflopNodeControlViewModel.cs
Normal file
@@ -0,0 +1,14 @@
|
||||
using Serein.NodeFlow.Model;
|
||||
using Serein.Workbench.Node.View;
|
||||
|
||||
namespace Serein.Workbench.Node.ViewModel
|
||||
{
|
||||
public class FlipflopNodeControlViewModel : NodeControlViewModelBase
|
||||
{
|
||||
public new SingleFlipflopNode NodelModel { get;}
|
||||
public FlipflopNodeControlViewModel(SingleFlipflopNode node) : base(node)
|
||||
{
|
||||
this.NodelModel = node;
|
||||
}
|
||||
}
|
||||
}
|
||||
51
Workbench/Node/ViewModel/GlobalDataNodeControlViewModel.cs
Normal file
51
Workbench/Node/ViewModel/GlobalDataNodeControlViewModel.cs
Normal file
@@ -0,0 +1,51 @@
|
||||
using Serein.Library;
|
||||
using Serein.NodeFlow.Model;
|
||||
using Serein.Workbench.Node.View;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
using System.Windows.Input;
|
||||
|
||||
namespace Serein.Workbench.Node.ViewModel
|
||||
{
|
||||
public class GlobalDataNodeControlViewModel : NodeControlViewModelBase
|
||||
{
|
||||
private SingleGlobalDataNode NodeModel => (SingleGlobalDataNode)base.NodeModel;
|
||||
|
||||
/// <summary>
|
||||
/// 复制全局数据表达式
|
||||
/// </summary>
|
||||
public ICommand CommandCopyDataExp { get; }
|
||||
|
||||
/// <summary>
|
||||
/// 刷新数据
|
||||
/// </summary>
|
||||
public ICommand CommandRefreshData { get; }
|
||||
|
||||
|
||||
public GlobalDataNodeControlViewModel(SingleGlobalDataNode node) : base(node)
|
||||
{
|
||||
CommandCopyDataExp = new RelayCommand( o =>
|
||||
{
|
||||
string exp = NodeModel.KeyName;
|
||||
string copyValue = $"@Get #{exp}#";
|
||||
Clipboard.SetDataObject(copyValue);
|
||||
});
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 自定义参数值
|
||||
/// </summary>
|
||||
public string? KeyName
|
||||
{
|
||||
get => NodeModel?.KeyName;
|
||||
set { NodeModel.KeyName = value; OnPropertyChanged(); }
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
62
Workbench/Node/ViewModel/ScriptNodeControlViewModel.cs
Normal file
62
Workbench/Node/ViewModel/ScriptNodeControlViewModel.cs
Normal file
@@ -0,0 +1,62 @@
|
||||
using Serein.Library;
|
||||
using Serein.Library.Core;
|
||||
using Serein.Library.Utils;
|
||||
using Serein.NodeFlow.Model;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
using System.Windows.Input;
|
||||
|
||||
namespace Serein.Workbench.Node.ViewModel
|
||||
{
|
||||
public class ScriptNodeControlViewModel : NodeControlViewModelBase
|
||||
{
|
||||
private SingleScriptNode NodeModel => (SingleScriptNode)base.NodeModel;
|
||||
|
||||
public string? Script
|
||||
{
|
||||
get => NodeModel?.Script;
|
||||
set { NodeModel.Script = value; OnPropertyChanged(); }
|
||||
}
|
||||
|
||||
|
||||
|
||||
public ScriptNodeControlViewModel(NodeModelBase nodeModel) : base(nodeModel)
|
||||
{
|
||||
CommandExecuting = new RelayCommand(async o =>
|
||||
{
|
||||
try
|
||||
{
|
||||
var result = await NodeModel.ExecutingAsync(new DynamicContext(nodeModel.Env));
|
||||
SereinEnv.WriteLine(InfoType.INFO, result?.ToString());
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
SereinEnv.WriteLine(InfoType.ERROR, ex.ToString());
|
||||
}
|
||||
});
|
||||
|
||||
CommandLoadScript = new RelayCommand( o =>
|
||||
{
|
||||
NodeModel.ReloadScript();
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 加载脚本代码
|
||||
/// </summary>
|
||||
public ICommand CommandLoadScript{ get; }
|
||||
|
||||
/// <summary>
|
||||
/// 尝试执行
|
||||
/// </summary>
|
||||
public ICommand CommandExecuting { get; }
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
27
Workbench/Node/ViewModel/TypeToStringConverter.cs
Normal file
27
Workbench/Node/ViewModel/TypeToStringConverter.cs
Normal file
@@ -0,0 +1,27 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Data;
|
||||
|
||||
namespace Serein.Workbench.Node.ViewModel
|
||||
{
|
||||
public class TypeToStringConverter : IValueConverter
|
||||
{
|
||||
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
|
||||
{
|
||||
if (value is Type type)
|
||||
{
|
||||
return type.ToString();
|
||||
}
|
||||
return string.Empty;
|
||||
}
|
||||
|
||||
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user