Merge branch 'master' of http://www.scserverddns.top:13000/sc/SunlightAggregationManager
This commit is contained in:
commit
6b16bc838c
10 files changed
+222
-25
No files matched your search
@@ -80,6 +80,7 @@ namespace SunlightAggregationManager
|
||||
{
|
||||
state.Visibility = Visibility.Collapsed;
|
||||
Picture.Visibility = Visibility.Visible;
|
||||
Picture.Content = new View.MachinePage();
|
||||
}
|
||||
private void ListViewItem_MouseLeftButtonUp_extend(object sender, MouseButtonEventArgs e)
|
||||
{
|
||||
@@ -96,6 +97,7 @@ namespace SunlightAggregationManager
|
||||
{
|
||||
state.Visibility = Visibility.Collapsed;
|
||||
Picture.Visibility = Visibility.Visible;
|
||||
Picture.Content = new View.ActionPage();
|
||||
}
|
||||
|
||||
private void ListViewItem_MouseLeftButtonUp_set(object sender, MouseButtonEventArgs e)
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Data;
|
||||
using System.Net.Sockets;
|
||||
using System.Text;
|
||||
using System.Text.Json;
|
||||
using TouchSocket.Core;
|
||||
@@ -16,7 +17,10 @@ namespace SunlightAggregationManager.UserClass
|
||||
public class AsyncHttpServer
|
||||
{
|
||||
public static HttpService httpservice = new HttpService();
|
||||
|
||||
public static async void Configuration(int P1)
|
||||
{
|
||||
await HttpMain(P1);
|
||||
}
|
||||
public static async Task HttpMain(int port1)
|
||||
{
|
||||
NetFwManger.AllowPort(port1, "TCP");//开放端口
|
||||
|
||||
@@ -24,7 +24,14 @@ namespace SunlightAggregationManager.UserClass
|
||||
public required string Terminal { get; set; }
|
||||
public required string Dat { get; set; }
|
||||
}
|
||||
|
||||
public static async void Configuration(int P1, int P2)
|
||||
{
|
||||
await TcpMain(P1, P2);
|
||||
}
|
||||
|
||||
public static TcpService service = new TcpService();
|
||||
|
||||
public static async Task TcpMain(int port1 ,int port2)
|
||||
{
|
||||
NetFwManger.AllowPort(port1, "TCP");//开放7790端口
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
<UserControl x:Class="SunlightAggregationManager.View.ActionPage"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:local="clr-namespace:SunlightAggregationManager.View"
|
||||
mc:Ignorable="d"
|
||||
Loaded="UserControl_Loaded"
|
||||
d:DesignHeight="720" d:DesignWidth="1080">
|
||||
<Grid>
|
||||
|
||||
</Grid>
|
||||
</UserControl>
|
||||
@@ -0,0 +1,31 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
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.Navigation;
|
||||
using System.Windows.Shapes;
|
||||
|
||||
namespace SunlightAggregationManager.View
|
||||
{
|
||||
/// <summary>
|
||||
/// ActionPage.xaml 的交互逻辑
|
||||
/// </summary>
|
||||
public partial class ActionPage : UserControl
|
||||
{
|
||||
public ActionPage()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
private void UserControl_Loaded(object sender, RoutedEventArgs e)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,90 @@
|
||||
<UserControl x:Class="SunlightAggregationManager.View.MachinePage"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:local="clr-namespace:SunlightAggregationManager.View"
|
||||
xmlns:ConvertMoels="clr-namespace:SunlightAggregationManager.ConvertMoels"
|
||||
xmlns:lang="clr-namespace:SunlightAggregationManager"
|
||||
xmlns:viewmodel="clr-namespace:SunlightAggregationManager.ViewModel"
|
||||
d:DataContext="{d:DesignInstance Type=viewmodel:MainWindowViewModel}"
|
||||
mc:Ignorable="d"
|
||||
d:DesignHeight="720" d:DesignWidth="1080">
|
||||
<Grid>
|
||||
<DataGrid x:Name="DataGridmachines"
|
||||
ItemsSource="{Binding Machines.DefaultView}"
|
||||
SelectionChanged="DataGridmachines_SelectionChanged"
|
||||
SelectionMode="Single"
|
||||
AlternationCount="2"
|
||||
IsReadOnly="True"
|
||||
FontSize="26"
|
||||
Margin="5,5,5,5"
|
||||
AutoGenerateColumns="False"
|
||||
MinColumnWidth="30"
|
||||
HorizontalGridLinesBrush="#FFC9C9C9"
|
||||
VerticalGridLinesBrush="#FFC9C9C9"
|
||||
GridLinesVisibility="All"
|
||||
BorderBrush="#CCCCCC"
|
||||
BorderThickness="1,1,1,1"
|
||||
ColumnHeaderHeight="40"
|
||||
HorizontalContentAlignment="Right"
|
||||
CanUserReorderColumns="False"
|
||||
VerticalContentAlignment="Center">
|
||||
<DataGrid.RowStyle >
|
||||
<Style TargetType="{x:Type DataGridRow}">
|
||||
<Style.Triggers>
|
||||
<Trigger Property="ItemsControl.AlternationIndex" Value="0">
|
||||
<Setter Property="Background" Value="#FFFFFFFF" />
|
||||
<Setter Property="Height" Value="40" />
|
||||
</Trigger>
|
||||
<Trigger Property="ItemsControl.AlternationIndex" Value="1">
|
||||
<Setter Property="Background" Value="#FFF0F0F0" />
|
||||
<Setter Property="Height" Value="40" />
|
||||
</Trigger>
|
||||
<Trigger Property="IsMouseOver" Value="False">
|
||||
</Trigger>
|
||||
</Style.Triggers>
|
||||
</Style>
|
||||
</DataGrid.RowStyle>
|
||||
<DataGrid.CellStyle>
|
||||
<Style TargetType="DataGridCell">
|
||||
<Setter Property="BorderThickness" Value="0"/>
|
||||
<Setter Property="MinWidth" Value="20"/>
|
||||
<Style.Triggers>
|
||||
<Trigger Property="IsSelected" Value="True">
|
||||
<Setter Property="Background" Value="#FFC0C0C0"/>
|
||||
<Setter Property="BorderBrush" Value="#FFC0C0C0"/>
|
||||
<Setter Property="Foreground" Value="#000000"/>
|
||||
</Trigger>
|
||||
</Style.Triggers>
|
||||
</Style>
|
||||
</DataGrid.CellStyle>
|
||||
<DataGrid.Columns>
|
||||
<!--列信息绑定-->
|
||||
<DataGridTextColumn Header="{x:Static lang:ResourceLanguage.information}" Width="200" FontSize="26"
|
||||
Binding="{Binding Name}" MaxWidth="200" MinWidth="200" CanUserReorder="False"/>
|
||||
<DataGridTextColumn Header="{x:Static lang:ResourceLanguage.machine}" Width="200" FontSize="26"
|
||||
Binding="{Binding Machine}" MaxWidth="200" MinWidth="200" CanUserReorder="False"/>
|
||||
<DataGridTextColumn Header="{x:Static lang:ResourceLanguage.state}" Width="150" FontSize="26"
|
||||
Binding="{Binding State}" MinWidth="150" CanUserReorder="False"/>
|
||||
<DataGridTextColumn Header="{x:Static lang:ResourceLanguage.Mode}" Width="150" FontSize="26"
|
||||
Binding="{Binding Model}" MinWidth="150" CanUserReorder="False"/>
|
||||
<DataGridTextColumn Header="A" Width="150" FontSize="26"
|
||||
Binding="{Binding ModelA}" MinWidth="150" CanUserReorder="False"/>
|
||||
<DataGridTextColumn Header="B" Width="150" FontSize="26"
|
||||
Binding="{Binding ModelB}" MinWidth="150" CanUserReorder="False"/>
|
||||
<DataGridTextColumn Header="C" Width="150" FontSize="26"
|
||||
Binding="{Binding ModelC}" MinWidth="150" CanUserReorder="False"/>
|
||||
<DataGridTextColumn Header="D" Width="150" FontSize="26"
|
||||
Binding="{Binding ModelD}" MinWidth="150" CanUserReorder="False"/>
|
||||
<DataGridTextColumn Header="E" Width="150" FontSize="26"
|
||||
Binding="{Binding ModelE}" MinWidth="150" CanUserReorder="False"/>
|
||||
<DataGridTextColumn Header="F" Width="150" FontSize="26"
|
||||
Binding="{Binding ModelF}" MinWidth="150" CanUserReorder="False"/>
|
||||
<DataGridTextColumn Header="{x:Static lang:ResourceLanguage.information}" Width="*" FontSize="26"
|
||||
Binding="{Binding Information}" MinWidth="200" CanUserReorder="False"/>
|
||||
|
||||
</DataGrid.Columns>
|
||||
</DataGrid>
|
||||
</Grid>
|
||||
</UserControl>
|
||||
@@ -0,0 +1,41 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
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.Navigation;
|
||||
using System.Windows.Shapes;
|
||||
|
||||
namespace SunlightAggregationManager.View
|
||||
{
|
||||
/// <summary>
|
||||
/// MachinePage.xaml 的交互逻辑
|
||||
/// </summary>
|
||||
public partial class MachinePage : UserControl
|
||||
{
|
||||
public MachinePage()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
private string id = "";
|
||||
private void DataGridmachines_SelectionChanged(object sender, SelectionChangedEventArgs e)
|
||||
{
|
||||
int rownum = DataGridmachines.SelectedIndex;//获取鼠标选中行并定义变量
|
||||
if (rownum != -1)//判断鼠标定位是否有效
|
||||
{
|
||||
var row_ = DataGridmachines.Columns[0].GetCellContent(DataGridmachines.Items[rownum]);
|
||||
if (row_ is TextBlock textBlock)
|
||||
{
|
||||
id = textBlock.Text;//定位第0列,
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -40,12 +40,9 @@ namespace SunlightAggregationManager.View
|
||||
if (row_ is TextBlock textBlock)
|
||||
{
|
||||
user_id = textBlock.Text;//定位第0列,
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
private void MenuItem_Information(object sender, RoutedEventArgs e)//信息
|
||||
|
||||
+7
-3
@@ -1,8 +1,10 @@
|
||||
using Net.Codecrete.QrCodeGenerator;
|
||||
using SunlightAggregationManager.ViewModel;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Drawing;
|
||||
using System.IO;
|
||||
using System.Reflection.PortableExecutable;
|
||||
using System.Text;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
@@ -94,9 +96,11 @@ namespace SunlightAggregationManager.View
|
||||
}
|
||||
|
||||
private void imgQR_Loaded(object sender, RoutedEventArgs e)
|
||||
{
|
||||
string text_APP = "TEST"; // 要生成二维码的内容
|
||||
string text_LINK = Configini.IniReadvalue("SYS", "LINK"); // 要生成二维码的内容
|
||||
{
|
||||
string text_APP = "TEST"; //
|
||||
string text_LINK = MainWindowViewModel.MachineIP + ":"+ MainWindowViewModel.MachineIPP1 +
|
||||
",HTTP//:" + MainWindowViewModel.SERVERIP + "/" + MainWindowViewModel.Enterprise;
|
||||
// 要生成二维码的内容
|
||||
|
||||
imgQR_CREATE(text_APP, imgQR_app);
|
||||
imgQR_CREATE(text_LINK, imgQR_link);
|
||||
|
||||
@@ -28,6 +28,9 @@ namespace SunlightAggregationManager.ViewModel
|
||||
public static string SQLPASWORD = "";
|
||||
public static string MachineName = "SERVER";
|
||||
public static string MachineVer = "1.0.0";
|
||||
public static string MachineIP = "";
|
||||
public static int MachineIPP1 = 7789;
|
||||
public static int MachineIPP2 = 7790;
|
||||
public static string Enterprise = "";
|
||||
public static string TCP_E = "0";
|
||||
public static string HTTP_E = "0";
|
||||
@@ -99,31 +102,26 @@ namespace SunlightAggregationManager.ViewModel
|
||||
//运行数据库
|
||||
Service.Rows.Add(0, "RUN", "SQL_DataBase_Link");
|
||||
dataBase.Config(SQLIP, SQLNAME, SQMOD, SQLUSER, SQLPASWORD);
|
||||
Service.Rows.Add(1, "RUN", "Sunlight_Server_Link");
|
||||
AsyncTcpClient.Configuration(SERVERIP, SERVERNAME, SERVERUSER, SERRVERPASWORD);//连接sunlight服务器
|
||||
|
||||
Console.WriteLine(GetLocalIP.GetLocalIPv4Address().ToString());
|
||||
|
||||
|
||||
if (TCP_E == "1")//启动tcp(内网直连)
|
||||
{
|
||||
int P1, P2;
|
||||
try
|
||||
{
|
||||
P1 = int.Parse(Configini.IniReadvalue("NETWORK", "TCP_PORT1"));
|
||||
MachineIPP1 = int.Parse(Configini.IniReadvalue("NETWORK", "TCP_PORT1"));
|
||||
}
|
||||
catch (Exception) { P1 = 7789; }
|
||||
catch (Exception) { MachineIPP1 = 7789; }
|
||||
try
|
||||
{
|
||||
P2 = int.Parse(Configini.IniReadvalue("NETWORK", "TCP_PORT2"));
|
||||
MachineIPP2 = int.Parse(Configini.IniReadvalue("NETWORK", "TCP_PORT2"));
|
||||
}
|
||||
catch (Exception) { P2 = 7790; }
|
||||
catch (Exception) { MachineIPP2 = 7790; }
|
||||
|
||||
Service.Rows.Add(2, "RUN", "TCP");
|
||||
_ = AsyncTcpServer.TcpMain(P1, P2);
|
||||
Service.Rows.Add(1, "RUN", "TCP");
|
||||
AsyncTcpServer.Configuration(MachineIPP1, MachineIPP2);
|
||||
}
|
||||
else
|
||||
{
|
||||
Service.Rows.Add(2, "STOP", "TCP");
|
||||
Service.Rows.Add(1, "STOP", "TCP");
|
||||
}
|
||||
if (HTTP_E == "1")//启动tcp(内网直连)
|
||||
{
|
||||
@@ -134,13 +132,23 @@ namespace SunlightAggregationManager.ViewModel
|
||||
}
|
||||
catch (Exception) { P1 = 7791; }
|
||||
|
||||
Service.Rows.Add(3, "RUN", "HTTP");
|
||||
_ = AsyncHttpServer.HttpMain(P1);
|
||||
Service.Rows.Add(2, "RUN", "HTTP");
|
||||
AsyncHttpServer.Configuration(P1);
|
||||
}
|
||||
else
|
||||
{
|
||||
Service.Rows.Add(3, "STOP", "HTTP");
|
||||
Service.Rows.Add(2, "STOP", "HTTP");
|
||||
}
|
||||
|
||||
//获取当前IP
|
||||
MachineIP = GetLocalIP.GetLocalIPv4Address().ToString();
|
||||
Console.WriteLine(MachineIP);
|
||||
//连接sunlight服务器
|
||||
Service.Rows.Add(3, "RUN", "Sunlight_Server_Link");
|
||||
AsyncTcpClient.Configuration(SERVERIP, SERVERNAME, SERVERUSER, SERRVERPASWORD);
|
||||
|
||||
|
||||
|
||||
Service.EndInit();
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user