小修小改

This commit is contained in:
fengjiayi
2025-07-27 23:46:26 +08:00
parent d3c3210ccc
commit c3bfb9b734
7 changed files with 28 additions and 15 deletions

View File

@@ -18,7 +18,7 @@ namespace Serein.Library.Utils
/// 使用第三方包进行解析
/// </summary>
/// <param name="jsonPortal"></param>
public static void UseJsonLibrary(IJsonProvider jsonPortal)
public static void UseJsonProvider(IJsonProvider jsonPortal)
{
JsonHelper.provider = jsonPortal;
}

View File

@@ -0,0 +1,18 @@
using Microsoft.CodeAnalysis.CSharp.Syntax;
using Serein.Library.Utils;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Serein.Extend.NewtonsoftJson
{
public static class NewtonsoftJsonExtend
{
public static string ToJsonText(this object data)
{
return JsonHelper.Serialize(data);
}
}
}

View File

@@ -14,8 +14,6 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Serein.Library", "Library\Serein.Library.csproj", "{5E19D0F2-913A-4D1C-A6F8-1E1227BAA0E3}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Net462DllTest", "Net462DllTest\Net462DllTest.csproj", "{E40EE629-1A38-4011-88E3-9AD036869987}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Serein.FlowStartTool", "FlowStartTool\Serein.FlowStartTool.csproj", "{38D0FA92-5139-4616-A41E-8186AA4C1532}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Serein.Library.NodeGenerator", "Serein.Library.MyGenerator\Serein.Library.NodeGenerator.csproj", "{5F7DE0B2-A5D3-492D-AC6C-F0C39EBEF365}"
@@ -52,10 +50,6 @@ Global
{5E19D0F2-913A-4D1C-A6F8-1E1227BAA0E3}.Debug|Any CPU.Build.0 = Debug|Any CPU
{5E19D0F2-913A-4D1C-A6F8-1E1227BAA0E3}.Release|Any CPU.ActiveCfg = Release|Any CPU
{5E19D0F2-913A-4D1C-A6F8-1E1227BAA0E3}.Release|Any CPU.Build.0 = Release|Any CPU
{E40EE629-1A38-4011-88E3-9AD036869987}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{E40EE629-1A38-4011-88E3-9AD036869987}.Debug|Any CPU.Build.0 = Debug|Any CPU
{E40EE629-1A38-4011-88E3-9AD036869987}.Release|Any CPU.ActiveCfg = Release|Any CPU
{E40EE629-1A38-4011-88E3-9AD036869987}.Release|Any CPU.Build.0 = Release|Any CPU
{38D0FA92-5139-4616-A41E-8186AA4C1532}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{38D0FA92-5139-4616-A41E-8186AA4C1532}.Debug|Any CPU.Build.0 = Debug|Any CPU
{38D0FA92-5139-4616-A41E-8186AA4C1532}.Release|Any CPU.ActiveCfg = Release|Any CPU

View File

@@ -63,6 +63,7 @@
<ProjectReference Include="..\Library\Serein.Library.csproj" />
<ProjectReference Include="..\NodeFlow\Serein.NodeFlow.csproj" />
<ProjectReference Include="..\Serein.Extend.NewtonsoftJson\Serein.Extend.NewtonsoftJson.csproj" />
<ProjectReference Include="..\Serein.Script\Serein.Script.csproj" />
</ItemGroup>

View File

@@ -1,4 +1,5 @@
using Microsoft.Extensions.DependencyInjection;
using Serein.Extend.NewtonsoftJson;
using Serein.Library.Api;
using Serein.Library.Utils;
using Serein.NodeFlow.Env;
@@ -54,6 +55,7 @@ namespace Serein.Workbench
public static void AddFlowServices(this IServiceCollection collection)
{
#region
JsonHelper.UseJsonProvider(new NewtonsoftJsonProvider());
Func<SynchronizationContext>? getSyncContext = null;
Dispatcher.CurrentDispatcher.Invoke(() =>
{

View File

@@ -66,7 +66,7 @@ namespace Serein.Workbench.ViewModels
/// <summary>
/// 开启远程服务
/// </summary>
public ICommand OpenRemoteServerCommand { get; private set; }
public ICommand ConvertCodeCommand { get; private set; }
@@ -91,7 +91,7 @@ namespace Serein.Workbench.ViewModels
OpenEnvOutWindowCommand = new RelayCommand(OpenEnvOutWindow); // 打开运行输出窗口
OpenDynamicCompilerCommand = new RelayCommand(OpenDynamicCompiler); // 打开动态编译窗口
OpenRemoteServerCommand = new RelayCommand(OpenRemoteServer); // 打开动态编译窗口
ConvertCodeCommand = new RelayCommand(ConvertCode); // 流程图转c#代码
this.flowProjectService = flowProjectService;
}
@@ -130,15 +130,13 @@ namespace Serein.Workbench.ViewModels
private void OpenDynamicCompiler() { }
private void OpenEnvOutWindow() => LogWindow.Instance?.Show();
private void OpenRemoteServer()
private void ConvertCode()
{
try
{
var env = App.GetService<IFlowEnvironment>();
var service = env.IOC.Get<FlowCoreGenerateService>();
var text = service.ToCsharpCoreFile(); ;
var text = service.ToCsharpCoreFile();
Debug.WriteLine(text);
}
@@ -146,7 +144,6 @@ namespace Serein.Workbench.ViewModels
{
Debug.WriteLine(ex.Message);
}
//flowEnvironment.StartRemoteServerAsync();
}
}

View File

@@ -35,7 +35,8 @@
</MenuItem>
<MenuItem Header="拓展">
<!--<MenuItem Header="动态编译" ></MenuItem>-->
<MenuItem Header="启动远程服务" Command="{Binding OpenRemoteServerCommand}"></MenuItem>
<!--<MenuItem Header="流程图转C#代码" Command="{Binding OpenRemoteServerCommand}"></MenuItem>-->
<MenuItem Header="流程图转C#代码" Command="{Binding ConvertCodeCommand}"></MenuItem>
</MenuItem>
</Menu>