mirror of
https://gitee.com/langsisi_admin/serein-flow
synced 2026-03-03 00:00:49 +08:00
修改环境接口(增加画布ID)
This commit is contained in:
@@ -4,7 +4,8 @@
|
||||
<Version>1.1.0</Version>
|
||||
<!--<TargetFrameworks>net8.0</TargetFrameworks>-->
|
||||
<TargetFrameworks>net8.0;net462</TargetFrameworks>
|
||||
<BaseOutputPath>D:\Project\C#\DynamicControl\SereinFlow\.Output</BaseOutputPath>
|
||||
<BaseOutputPath>..\.\.Output</BaseOutputPath>
|
||||
<!--<BaseOutputPath>D:\Project\C#\DynamicControl\SereinFlow\.Output</BaseOutputPath>-->
|
||||
<GeneratePackageOnBuild>True</GeneratePackageOnBuild>
|
||||
<Title>SereinFow</Title>
|
||||
<Description>基础依赖</Description>
|
||||
|
||||
@@ -767,6 +767,8 @@ namespace Serein.NodeFlow.Env
|
||||
//}
|
||||
}
|
||||
|
||||
private int _addCanvasCount = 0;
|
||||
|
||||
/// <summary>
|
||||
/// 增加画布
|
||||
/// </summary>
|
||||
@@ -780,11 +782,14 @@ namespace Serein.NodeFlow.Env
|
||||
{
|
||||
Guid = Guid.NewGuid().ToString(),
|
||||
Height = height,
|
||||
Name = canvasName,
|
||||
Name = !string.IsNullOrWhiteSpace(canvasName) ? canvasName : $"流程图 {_addCanvasCount++}",
|
||||
Width = height,
|
||||
};
|
||||
FlowCanvass.Add(model.Guid, model);
|
||||
OnCanvasCreate.Invoke(new CanvasCreateEventArgs(model));
|
||||
UIContextOperation.Invoke(() =>
|
||||
{
|
||||
OnCanvasCreate.Invoke(new CanvasCreateEventArgs(model));
|
||||
});
|
||||
var info = model.ToInfo();
|
||||
return Task.FromResult(info);
|
||||
}
|
||||
|
||||
@@ -445,7 +445,7 @@ namespace Serein.NodeFlow.Env
|
||||
Width = info.Width,
|
||||
};
|
||||
UIContextOperation?.Invoke(() =>
|
||||
OnCanvasCreate?.Invoke(new CanvasCreateEventArgs(info)));
|
||||
OnCanvasCreate?.Invoke(new CanvasCreateEventArgs(model)));
|
||||
|
||||
return info;
|
||||
}
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
<TargetFramework>net8.0</TargetFramework>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
<BaseOutputPath>D:\Project\C#\DynamicControl\SereinFlow\.Output</BaseOutputPath>
|
||||
<BaseOutputPath>..\.\.Output</BaseOutputPath>
|
||||
<GeneratePackageOnBuild>True</GeneratePackageOnBuild>
|
||||
<Title>SereinFow</Title>
|
||||
<Description>管理节点的运行环境,非二次开发无须添加</Description>
|
||||
|
||||
@@ -4,8 +4,7 @@
|
||||
<TargetFramework>netstandard2.0</TargetFramework>
|
||||
<Version>1.1.0</Version>
|
||||
<IsRoslynComponent>true</IsRoslynComponent>
|
||||
|
||||
<BaseOutputPath>D:\Project\C#\DynamicControl\SereinFlow\.Output</BaseOutputPath>
|
||||
<BaseOutputPath>..\.\.Output</BaseOutputPath>
|
||||
<GeneratePackageOnBuild>True</GeneratePackageOnBuild>
|
||||
<Title>SereinFow</Title>
|
||||
<Description>基础依赖必须添加项,用于生成NodeModel部分的依赖实体代码</Description>
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
<TargetFramework>net8.0</TargetFramework>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
<BaseOutputPath>..\.\.Output</BaseOutputPath>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
<Nullable>enable</Nullable>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<UseWPF>True</UseWPF>
|
||||
<BaseOutputPath>D:\Project\C#\DynamicControl\SereinFlow\.Output</BaseOutputPath>
|
||||
<BaseOutputPath>..\.\.Output</BaseOutputPath>
|
||||
<PackageLicenseExpression>MIT</PackageLicenseExpression>
|
||||
<GenerateDocumentationFile>true</GenerateDocumentationFile>
|
||||
<!--<IsRoslynComponent>true</IsRoslynComponent>-->
|
||||
|
||||
@@ -117,7 +117,7 @@ namespace Serein.Workbench.Services
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#region 向运行环境发出请求
|
||||
@@ -128,10 +128,13 @@ namespace Serein.Workbench.Services
|
||||
/// <returns></returns>
|
||||
public void CreateFlowCanvas()
|
||||
{
|
||||
string canvasName = "";
|
||||
int height = 1000;
|
||||
int width = 600;
|
||||
_ = flowEnvironment.CreateCanvasAsync(canvasName, width, height);
|
||||
_ = Task.Run(async () =>
|
||||
{
|
||||
var result = await flowEnvironment.CreateCanvasAsync("", width, height);
|
||||
Console.WriteLine(result.Guid);
|
||||
});
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -28,7 +28,6 @@ namespace Serein.Workbench.ViewModels
|
||||
[ObservableProperty]
|
||||
private FlowCanvasModel _selectedTab;
|
||||
|
||||
private int _addCount = 0;
|
||||
private readonly FlowNodeService flowNodeService;
|
||||
|
||||
public FlowEditViewModel(FlowNodeService flowNodeService)
|
||||
@@ -37,8 +36,8 @@ namespace Serein.Workbench.ViewModels
|
||||
AddTabCommand = new RelayCommand(AddTab);
|
||||
RemoveTabCommand = new RelayCommand(RemoveTab, CanRemoveTab);
|
||||
|
||||
flowNodeService.OnCreateFlowCanvasView += OnCreateFlowCanvasView; // 环境创建了节点
|
||||
flowNodeService.OnRemoveFlowCanvasView += OnRemoveFlowCanvasView;
|
||||
flowNodeService.OnCreateFlowCanvasView += OnCreateFlowCanvasView; // 运行环境创建了画布
|
||||
flowNodeService.OnRemoveFlowCanvasView += OnRemoveFlowCanvasView; // 运行环境移除了画布
|
||||
this.PropertyChanged += OnPropertyChanged;
|
||||
}
|
||||
|
||||
|
||||
@@ -19,8 +19,6 @@ namespace Serein.Workbench.ViewModels
|
||||
[ObservableProperty]
|
||||
private ObservableCollection<FlowLibraryInfo> flowLibraryInfos;
|
||||
|
||||
|
||||
|
||||
public FlowLibrarysViewModel(IFlowEEForwardingService flowEEForwardingService)
|
||||
{
|
||||
this.flowEEForwardingService = flowEEForwardingService;
|
||||
|
||||
@@ -14,8 +14,6 @@ namespace Serein.Workbench.ViewModels
|
||||
{
|
||||
private readonly IFlowEEForwardingService flowEEForwardingService;
|
||||
|
||||
|
||||
|
||||
public FlowWorkbenchViewModel(IFlowEEForwardingService flowEEForwardingService)
|
||||
{
|
||||
this.flowEEForwardingService = flowEEForwardingService;
|
||||
|
||||
@@ -26,7 +26,7 @@ namespace Serein.Workbench.Views
|
||||
/// </summary>
|
||||
public partial class FlowCanvasView : UserControl
|
||||
{
|
||||
public FlowCanvasViewModel ViewModel => ViewModel as FlowCanvasViewModel;
|
||||
public FlowCanvasViewModel ViewModel => this.DataContext as FlowCanvasViewModel;
|
||||
/// <summary>
|
||||
/// 存储所有的连接。考虑集成在运行环境中。
|
||||
/// </summary>
|
||||
@@ -89,8 +89,8 @@ namespace Serein.Workbench.Views
|
||||
private IFlowEnvironment EnvDecorator;
|
||||
public FlowCanvasView()
|
||||
{
|
||||
ViewModel = App.GetService<Locator>().FlowCanvasViewModel;
|
||||
this.DataContext = ViewModel;
|
||||
var vm = App.GetService<Locator>().FlowCanvasViewModel;
|
||||
this.DataContext = vm;
|
||||
EnvDecorator = App.GetService<IFlowEnvironment>();
|
||||
InitializeComponent();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user