将部分节点基类与表达式工具类从nodeflow迁移到library,重写了环境与工作台的交互,解耦节点的获取,下一部分将尝试远程登录环境编辑流程。

This commit is contained in:
fengjiayi
2024-10-15 10:55:41 +08:00
parent 4338554384
commit dbbde4f03e
48 changed files with 3687 additions and 292 deletions

View File

@@ -91,7 +91,11 @@ namespace Serein.WorkBench.Themes
public void ClearObjItem()
{
DependenciesListBox.Items.Clear();
DependenciesListBox.Dispatcher.Invoke(() =>
{
DependenciesListBox.Items.Clear();
});
}
private static void SortLisbox(ListBox listBox)

View File

@@ -0,0 +1,30 @@
<Window x:Class="Serein.WorkBench.Themes.WindowEnvRemoteLoginView"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:Serein.WorkBench.Themes"
Title="登录远程环境" Height="150" Width="200">
<Grid Margin="0,10,0,0">
<Grid.RowDefinitions>
<RowDefinition Height="auto"/>
<RowDefinition Height="auto"/>
<RowDefinition Height="auto"/>
<RowDefinition Height="auto"/>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="40"/>
<ColumnDefinition Width="auto"/>
</Grid.ColumnDefinitions>
<TextBlock Grid.Row="0" Grid.Column="0" Text="地址" HorizontalAlignment="Center"></TextBlock>
<TextBox x:Name="TextBlockAddres" Grid.Row="0" Grid.Column="1" Text="192.168.1.100"></TextBox>
<TextBlock Grid.Row="1" Grid.Column="0" Text="端口" HorizontalAlignment="Center"></TextBlock>
<TextBox x:Name="TextBlockPort" Grid.Row="1" Grid.Column="1" Text="7525"></TextBox>
<TextBlock Grid.Row="2" Grid.Column="0" Text="密码" HorizontalAlignment="Center"></TextBlock>
<TextBox x:Name="TextBlockToken" Grid.Row="2" Grid.Column="1" Text="123456"></TextBox>
<StackPanel Grid.Row="3" Grid.Column="1" HorizontalAlignment="Center" Orientation="Horizontal" Margin="4">
<Button Content="测试连接" Margin="2" Click="ButtonTestConnect_Client"></Button>
<Button Content="登录环境" Margin="2" Click="ButtonTestLoginEnv_Client"></Button>
</StackPanel>
</Grid>
</Window>

View File

@@ -0,0 +1,68 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net.Sockets;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;
namespace Serein.WorkBench.Themes
{
/// <summary>
/// WindowDialogInput.xaml 的交互逻辑
/// </summary>
public partial class WindowEnvRemoteLoginView : Window
{
private Action<string, int, string> ConnectRemoteFlowEnv;
/// <summary>
/// 弹窗输入
/// </summary>
/// <param name="connectRemoteFlowEnv"></param>
public WindowEnvRemoteLoginView(Action<string, int, string> connectRemoteFlowEnv)
{
WindowStartupLocation = WindowStartupLocation.CenterScreen;
InitializeComponent();
ConnectRemoteFlowEnv = connectRemoteFlowEnv;
}
private void ButtonTestConnect_Client(object sender, RoutedEventArgs e)
{
var addres = this.TextBlockAddres.Text;
_ = int.TryParse(this.TextBlockPort.Text, out var port);
_ = Task.Run(() => {
bool success = false;
try
{
TcpClient tcpClient = new TcpClient();
var result = tcpClient.BeginConnect(addres, port, null, null);
success = result.AsyncWaitHandle.WaitOne(TimeSpan.FromSeconds(3));
}
catch (Exception ex)
{
}
if (!success)
{
Console.WriteLine($"无法连接远程:{addres}:{port}");
}
});
}
private void ButtonTestLoginEnv_Client(object sender, RoutedEventArgs e)
{
var addres = this.TextBlockAddres.Text;
_ = int.TryParse(this.TextBlockPort.Text, out var port);
var token = this.TextBlockToken.Text;
ConnectRemoteFlowEnv?.Invoke(addres, port, token);
}
}
}