mirror of
https://gitee.com/langsisi_admin/serein-flow
synced 2026-03-03 00:00:49 +08:00
重构中day1,写了很多,不知道怎么说清楚
This commit is contained in:
13
Workbench/ViewModels/BaseNodesViewModel.cs
Normal file
13
Workbench/ViewModels/BaseNodesViewModel.cs
Normal file
@@ -0,0 +1,13 @@
|
||||
using CommunityToolkit.Mvvm.ComponentModel;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Serein.Workbench.ViewModels
|
||||
{
|
||||
internal class BaseNodesViewModel : ObservableObject
|
||||
{
|
||||
}
|
||||
}
|
||||
19
Workbench/ViewModels/FlowCanvasViewModel.cs
Normal file
19
Workbench/ViewModels/FlowCanvasViewModel.cs
Normal file
@@ -0,0 +1,19 @@
|
||||
using CommunityToolkit.Mvvm.ComponentModel;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Serein.Workbench.ViewModels
|
||||
{
|
||||
public partial class FlowCanvasViewModel : ObservableObject
|
||||
{
|
||||
|
||||
[ObservableProperty]
|
||||
private bool _isConnectionInvokeNode;
|
||||
|
||||
[ObservableProperty]
|
||||
private bool _isConnectionArgSourceNode;
|
||||
}
|
||||
}
|
||||
16
Workbench/ViewModels/FlowEditViewModel.cs
Normal file
16
Workbench/ViewModels/FlowEditViewModel.cs
Normal file
@@ -0,0 +1,16 @@
|
||||
using CommunityToolkit.Mvvm.ComponentModel;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Serein.Workbench.ViewModels
|
||||
{
|
||||
/// <summary>
|
||||
/// 流程编辑数据视图
|
||||
/// </summary>
|
||||
public partial class FlowEditViewModel : ObservableObject
|
||||
{
|
||||
}
|
||||
}
|
||||
54
Workbench/ViewModels/FlowLibrarysViewModel.cs
Normal file
54
Workbench/ViewModels/FlowLibrarysViewModel.cs
Normal file
@@ -0,0 +1,54 @@
|
||||
using CommunityToolkit.Mvvm.ComponentModel;
|
||||
using Serein.Library;
|
||||
using Serein.Workbench.Api;
|
||||
using Serein.Workbench.Models;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Serein.Workbench.ViewModels
|
||||
{
|
||||
internal partial class FlowLibrarysViewModel : ObservableObject
|
||||
{
|
||||
private readonly IFlowEEForwardingService flowEEForwardingService;
|
||||
|
||||
[ObservableProperty]
|
||||
private ObservableCollection<FlowLibraryInfo> flowLibraryInfos;
|
||||
|
||||
|
||||
|
||||
public FlowLibrarysViewModel(IFlowEEForwardingService flowEEForwardingService)
|
||||
{
|
||||
this.flowEEForwardingService = flowEEForwardingService;
|
||||
FlowLibraryInfos = new ObservableCollection<FlowLibraryInfo>();
|
||||
flowEEForwardingService.OnDllLoad += FlowEEForwardingService_OnDllLoad;
|
||||
}
|
||||
|
||||
private void FlowEEForwardingService_OnDllLoad(Library.Api.LoadDllEventArgs eventArgs)
|
||||
{
|
||||
if (!eventArgs.IsSucceed) return;
|
||||
List<MethodDetailsInfo> mds = eventArgs.MethodDetailss;
|
||||
NodeLibraryInfo libraryInfo = eventArgs.NodeLibraryInfo;
|
||||
|
||||
var methodInfo = new ObservableCollection<FlowLibraryMethodDetailsInfo>();
|
||||
foreach (var md in mds)
|
||||
{
|
||||
methodInfo.Add(new FlowLibraryMethodDetailsInfo(md));
|
||||
}
|
||||
var flInfo = new FlowLibraryInfo
|
||||
{
|
||||
LibraryName = libraryInfo.AssemblyName,
|
||||
FilePath = libraryInfo.FilePath,
|
||||
MethodInfo = methodInfo
|
||||
};
|
||||
|
||||
FlowLibraryInfos.Add(flInfo);
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
25
Workbench/ViewModels/FlowWorkbenchViewModel.cs
Normal file
25
Workbench/ViewModels/FlowWorkbenchViewModel.cs
Normal file
@@ -0,0 +1,25 @@
|
||||
using CommunityToolkit.Mvvm.ComponentModel;
|
||||
using Serein.Workbench.Api;
|
||||
using Serein.Workbench.Models;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Serein.Workbench.ViewModels
|
||||
{
|
||||
internal partial class FlowWorkbenchViewModel : ObservableObject
|
||||
{
|
||||
private readonly IFlowEEForwardingService flowEEForwardingService;
|
||||
|
||||
|
||||
|
||||
public FlowWorkbenchViewModel(IFlowEEForwardingService flowEEForwardingService)
|
||||
{
|
||||
this.flowEEForwardingService = flowEEForwardingService;
|
||||
//flowEEForwardingService.OnDllLoad += FlowEEForwardingService_OnDllLoad;
|
||||
}
|
||||
}
|
||||
}
|
||||
40
Workbench/ViewModels/Locator.cs
Normal file
40
Workbench/ViewModels/Locator.cs
Normal file
@@ -0,0 +1,40 @@
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Serein.Workbench.ViewModels
|
||||
{
|
||||
internal class Locator
|
||||
{
|
||||
private static IServiceProvider ServiceProvide { get; set; }
|
||||
public Locator(IServiceProvider serviceProvider)
|
||||
{
|
||||
ServiceProvider = serviceProvider;
|
||||
}
|
||||
|
||||
//private IServiceProvider GetService()
|
||||
//{
|
||||
// var service = new ServiceCollection();
|
||||
// service.AddSingleton<MainViewModel>();
|
||||
// service.AddSingleton<MainMenuBarViewModel>();
|
||||
// service.AddSingleton<FlowWorkbenchViewModel>();
|
||||
// service.AddSingleton<BaseNodesViewModel>();
|
||||
// service.AddSingleton<FlowLibrarysViewModel>();
|
||||
// service.AddTransient<FlowLibraryMethodDetailssViewModel>();
|
||||
// return service.BuildServiceProvider();
|
||||
//}
|
||||
|
||||
public MainViewModel MainViewModel => App.GetService<MainViewModel>() ?? throw new NotImplementedException();
|
||||
public MainMenuBarViewModel MainMenuBarViewModel => App.GetService<MainMenuBarViewModel>() ?? throw new NotImplementedException();
|
||||
public FlowWorkbenchViewModel FlowWorkbenchViewModel => App.GetService<FlowWorkbenchViewModel>() ?? throw new NotImplementedException();
|
||||
public BaseNodesViewModel BaseNodesViewModel => App.GetService<BaseNodesViewModel>() ?? throw new NotImplementedException();
|
||||
public FlowLibrarysViewModel FlowLibrarysViewModel => App.GetService<FlowLibrarysViewModel>() ?? throw new NotImplementedException();
|
||||
public FlowEditViewModel FlowEditViewModel => App.GetService<FlowEditViewModel>() ?? throw new NotImplementedException();
|
||||
public FlowCanvasViewModel FlowCanvasViewModel => App.GetService<FlowCanvasViewModel>() ?? throw new NotImplementedException();
|
||||
|
||||
public IServiceProvider ServiceProvider { get; }
|
||||
}
|
||||
}
|
||||
12
Workbench/ViewModels/MainMenuBarViewModel.cs
Normal file
12
Workbench/ViewModels/MainMenuBarViewModel.cs
Normal file
@@ -0,0 +1,12 @@
|
||||
using CommunityToolkit.Mvvm.ComponentModel;
|
||||
|
||||
namespace Serein.Workbench.ViewModels
|
||||
{
|
||||
public class MainMenuBarViewModel : ObservableObject
|
||||
{
|
||||
public MainMenuBarViewModel()
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
17
Workbench/ViewModels/MainViewModel.cs
Normal file
17
Workbench/ViewModels/MainViewModel.cs
Normal file
@@ -0,0 +1,17 @@
|
||||
using CommunityToolkit.Mvvm.ComponentModel;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Serein.Workbench.ViewModels
|
||||
{
|
||||
public class MainViewModel : ObservableObject
|
||||
{
|
||||
public MainViewModel()
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user