mvvm模式升级从 packages.config 迁移到 PackageReference
This commit is contained in:
commit
83a38deaa6
56 files changed
+612
-1158
No files matched your search
@@ -1,8 +1,5 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace formula_manage.UserClass
|
||||
{
|
||||
|
||||
@@ -2,9 +2,6 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Data;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace formula_manage.UserClass
|
||||
{
|
||||
|
||||
@@ -1,10 +1,6 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
|
||||
namespace formula_manage.UserClass
|
||||
{
|
||||
|
||||
@@ -1,11 +1,7 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Data;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace formula_manage.UserClass
|
||||
{
|
||||
|
||||
@@ -1,9 +1,4 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Management;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Management;
|
||||
|
||||
namespace formula_manage.UserClass
|
||||
{
|
||||
|
||||
@@ -1,9 +1,5 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace formula_manage.UserClass
|
||||
{
|
||||
|
||||
@@ -1,10 +1,6 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Documents;
|
||||
using System.Text;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Documents;
|
||||
using System.Windows.Media;
|
||||
|
||||
namespace formula_manage.UserClass
|
||||
|
||||
@@ -1,9 +1,5 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace formula_manage.UserClass
|
||||
{
|
||||
@@ -12,7 +8,7 @@ namespace formula_manage.UserClass
|
||||
public static void LogGingDATA(string dat)
|
||||
{
|
||||
string logpath = System.Environment.CurrentDirectory + "\\Log";//日志文件目录
|
||||
string logPath = "" + System.Environment.CurrentDirectory + "\\Log\\"+ DateTime.Now.ToString("yyyy-MM-dd") + ".txt";//日志文件
|
||||
string logPath = "" + System.Environment.CurrentDirectory + "\\Log\\" + DateTime.Now.ToString("yyyy-MM-dd") + ".txt";//日志文件
|
||||
string Log_time = "[" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "]:";
|
||||
|
||||
System.IO.DirectoryInfo log = new System.IO.DirectoryInfo(@logpath);//生成日志文件目录
|
||||
|
||||
@@ -1,9 +1,6 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Security.Cryptography;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace formula_manage.UserClass
|
||||
{
|
||||
|
||||
@@ -1,9 +1,5 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace formula_manage.UserClass
|
||||
|
||||
@@ -3,9 +3,6 @@ using FastReport.Data;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Data;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace formula_manage.UserClass
|
||||
{
|
||||
@@ -83,9 +80,9 @@ namespace formula_manage.UserClass
|
||||
{
|
||||
string chineseSimpleFrl = AppDomain.CurrentDomain.BaseDirectory + @"FastReport\Localization\language.frl";
|
||||
FastReport.Utils.Res.LoadLocale(chineseSimpleFrl);
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
{
|
||||
}
|
||||
|
||||
try
|
||||
|
||||
@@ -1,8 +1,4 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace formula_manage.UserClass
|
||||
{
|
||||
@@ -30,7 +26,7 @@ namespace formula_manage.UserClass
|
||||
//方法3
|
||||
//int r3 = Convert.ToInt32(str, 16);
|
||||
//Console.WriteLine(r3);
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
res = 0;
|
||||
|
||||
+93
-99
@@ -1,17 +1,11 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Data;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Newtonsoft.Json;
|
||||
using System.IO;
|
||||
using System.Net;
|
||||
using System.Net.Sockets;
|
||||
using System.Windows.Forms;
|
||||
using System.ComponentModel;
|
||||
using System.Data;
|
||||
using System.Drawing;
|
||||
using System.Net.NetworkInformation;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace formula_manage.UserClass
|
||||
{
|
||||
@@ -25,53 +19,53 @@ namespace formula_manage.UserClass
|
||||
public static Dictionary<string, Socket> OnLineList = new Dictionary<string, Socket>();
|
||||
|
||||
DataTable IPdataTable = new DataTable(); //建立缓存
|
||||
//当前时间
|
||||
//当前时间
|
||||
|
||||
private string CurrentTime
|
||||
{
|
||||
{
|
||||
get { return DateTime.Now.ToString("HH:mm:ss") + Environment.NewLine; }
|
||||
}
|
||||
|
||||
//编码格式
|
||||
public static Encoding econding = Encoding.Default;
|
||||
|
||||
public static void Start()
|
||||
|
||||
public static void Start()
|
||||
{
|
||||
//第一步:调用socket()函数创建一个用于通信的套接字
|
||||
//第一步:调用socket()函数创建一个用于通信的套接字
|
||||
listenSocket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
|
||||
//第二步:给已经创建的套接字绑定一个端口号,这一般通过设置网络套接口地址和调用Bind()函数来实现
|
||||
//第二步:给已经创建的套接字绑定一个端口号,这一般通过设置网络套接口地址和调用Bind()函数来实现
|
||||
IPEndPoint endPoint = new IPEndPoint(IPAddress.Parse(UserClass.get_local_ip_address.IP_Address()), int.Parse("11080"));
|
||||
UserClass.LogGing.LogGingDATA("NativeIP = "+ UserClass.get_local_ip_address.IP_Address());
|
||||
UserClass.LogGing.LogGingDATA("NativeIP = " + UserClass.get_local_ip_address.IP_Address());
|
||||
UserClass.LogGing.LogGingDATA("NativePORT = 11080");
|
||||
try
|
||||
{
|
||||
listenSocket.Bind(endPoint);
|
||||
}
|
||||
catch (Exception ex)
|
||||
listenSocket.Bind(endPoint);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
UserClass.LogGing.LogGingDATA("TCP_NotStart");
|
||||
UserClass.LogGing.LogGingDATA(ex.Message);
|
||||
return;
|
||||
return;
|
||||
}
|
||||
//第三步:调用listen()函数使套接字成为一个监听套接字
|
||||
//第三步:调用listen()函数使套接字成为一个监听套接字
|
||||
listenSocket.Listen(10);
|
||||
//ShowMessage("服务器开启成功");
|
||||
|
||||
//开启一个线程监听
|
||||
Task.Run(new Action(() =>{ListenConnection();} ));
|
||||
//开启一个线程监听
|
||||
Task.Run(new Action(() => { ListenConnection(); }));
|
||||
}
|
||||
|
||||
public static void ListenConnection()
|
||||
{
|
||||
{
|
||||
while (true)
|
||||
{
|
||||
Socket clientSocket = listenSocket.Accept();
|
||||
{
|
||||
Socket clientSocket = listenSocket.Accept();
|
||||
string ip = clientSocket.RemoteEndPoint.ToString();
|
||||
//更新在线列表
|
||||
// AddOnLine(ip, true);
|
||||
//更新在线列表集合
|
||||
OnLineList.Add(ip, clientSocket);
|
||||
UserClass.LogGing.LogGingDATA("IP_Online = "+ ip);
|
||||
//更新在线列表
|
||||
// AddOnLine(ip, true);
|
||||
//更新在线列表集合
|
||||
OnLineList.Add(ip, clientSocket);
|
||||
UserClass.LogGing.LogGingDATA("IP_Online = " + ip);
|
||||
// ShowMessage(ip + "上线了");
|
||||
Task.Run(() => ReceiveMsg(clientSocket));
|
||||
}
|
||||
@@ -82,106 +76,106 @@ namespace formula_manage.UserClass
|
||||
/// </summary>
|
||||
/// <param name="clientSocket"></param>
|
||||
public static void ReceiveMsg(Socket clientSocket)
|
||||
{
|
||||
{
|
||||
while (true)
|
||||
{
|
||||
//定义一个2M的缓冲区
|
||||
//定义一个2M的缓冲区
|
||||
byte[] buffer = new byte[1024 * 1024 * 2];
|
||||
|
||||
int length = -1;
|
||||
|
||||
int length = -1;
|
||||
try
|
||||
{
|
||||
length = clientSocket.Receive(buffer);
|
||||
length = clientSocket.Receive(buffer);
|
||||
}
|
||||
catch (Exception)
|
||||
catch (Exception)
|
||||
{
|
||||
//客户端下线了
|
||||
//更新在线列表
|
||||
string ip = clientSocket.RemoteEndPoint.ToString();
|
||||
//客户端下线了
|
||||
//更新在线列表
|
||||
string ip = clientSocket.RemoteEndPoint.ToString();
|
||||
UserClass.LogGing.LogGingDATA("IP_Line = " + ip);
|
||||
// AddOnLine(ip, false);
|
||||
OnLineList.Remove(ip);
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
if (length == 0)
|
||||
{
|
||||
//客户端下线了
|
||||
//更新在线列表
|
||||
string ip = clientSocket.RemoteEndPoint.ToString();
|
||||
UserClass.LogGing.LogGingDATA("IP_Line = " + ip);
|
||||
// AddOnLine(ip, false);
|
||||
OnLineList.Remove(ip);
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
if (length > 0)
|
||||
|
||||
if (length == 0)
|
||||
{
|
||||
infoR = econding.GetString(buffer, 0, length);
|
||||
//客户端下线了
|
||||
//更新在线列表
|
||||
string ip = clientSocket.RemoteEndPoint.ToString();
|
||||
UserClass.LogGing.LogGingDATA("IP_Line = " + ip);
|
||||
// AddOnLine(ip, false);
|
||||
OnLineList.Remove(ip);
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
if (length > 0)
|
||||
{
|
||||
infoR = econding.GetString(buffer, 0, length);
|
||||
//ShowMessage(info);
|
||||
string ip = clientSocket.RemoteEndPoint.ToString();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
/*
|
||||
/// <summary>
|
||||
/// 在线列表更新
|
||||
/// </summary>
|
||||
/// <param name="clientIp"></param>
|
||||
/// <param name="value"></param>
|
||||
private void AddOnLine(string clientIp, bool value)
|
||||
{
|
||||
Invoke(new Action(() =>
|
||||
{
|
||||
if (value)
|
||||
/*
|
||||
/// <summary>
|
||||
/// 在线列表更新
|
||||
/// </summary>
|
||||
/// <param name="clientIp"></param>
|
||||
/// <param name="value"></param>
|
||||
private void AddOnLine(string clientIp, bool value)
|
||||
{
|
||||
this.lst_Online.Items.Add(clientIp);
|
||||
}
|
||||
else
|
||||
{
|
||||
this.lst_Online.Items.Remove(clientIp);
|
||||
Invoke(new Action(() =>
|
||||
{
|
||||
if (value)
|
||||
{
|
||||
this.lst_Online.Items.Add(clientIp);
|
||||
}
|
||||
else
|
||||
{
|
||||
this.lst_Online.Items.Remove(clientIp);
|
||||
}
|
||||
|
||||
}));
|
||||
|
||||
}
|
||||
|
||||
}));
|
||||
|
||||
}
|
||||
/// <summary>
|
||||
/// 更新接收区
|
||||
/// </summary>
|
||||
/// <param name="info"></param>
|
||||
private void ShowMessage(string info)
|
||||
{
|
||||
Invoke(new Action(() =>
|
||||
{
|
||||
this.txt_Rcv.AppendText(CurrentTime + info + Environment.NewLine);
|
||||
}));
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 更新接收区
|
||||
/// </summary>
|
||||
/// <param name="info"></param>
|
||||
private void ShowMessage(string info)
|
||||
*/
|
||||
/// <summary>
|
||||
/// 消息发送
|
||||
/// </summary>
|
||||
public static void Bn_Send(string IP, string DAT)
|
||||
{
|
||||
if (OnLineList.ContainsKey(IP))
|
||||
{
|
||||
Invoke(new Action(() =>
|
||||
{
|
||||
this.txt_Rcv.AppendText(CurrentTime + info + Environment.NewLine);
|
||||
}));
|
||||
|
||||
}
|
||||
|
||||
*/
|
||||
/// <summary>
|
||||
/// 消息发送
|
||||
/// </summary>
|
||||
public static void Bn_Send(string IP ,string DAT)
|
||||
{
|
||||
if (OnLineList.ContainsKey(IP))
|
||||
{
|
||||
OnLineList[IP].Send(econding.GetBytes(DAT));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 群发功能
|
||||
/// </summary>
|
||||
public static void Btn_SendAll(string DAT)
|
||||
{
|
||||
foreach (string item in OnLineList.Keys.ToArray())
|
||||
{
|
||||
foreach (string item in OnLineList.Keys.ToArray())
|
||||
{
|
||||
if (OnLineList.ContainsKey(item))
|
||||
{
|
||||
@@ -189,7 +183,7 @@ namespace formula_manage.UserClass
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,11 +1,7 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Drawing.Printing;
|
||||
using System.Linq;
|
||||
using System.Management;
|
||||
using System.Printing;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace formula_manage.UserClass
|
||||
@@ -192,11 +188,11 @@ namespace formula_manage.UserClass
|
||||
|
||||
|
||||
MessageBox.Show("网络打印机不可用", "警告", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
// WriteLog.SetString(ex.Message);
|
||||
// WriteLog.SetString(ex.Message);
|
||||
}
|
||||
else
|
||||
{
|
||||
// WriteLog.SetException(ex);
|
||||
// WriteLog.SetException(ex);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,11 +1,5 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Net.NetworkInformation;
|
||||
using System.Net.Sockets;
|
||||
using System.Net;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Net.NetworkInformation;
|
||||
|
||||
namespace formula_manage.UserClass
|
||||
{
|
||||
@@ -35,7 +29,7 @@ namespace formula_manage.UserClass
|
||||
string ip;
|
||||
|
||||
ip = getLocalIPAddressWithNetworkInterface(NetworkInterfaceType.Ethernet);
|
||||
if(ip=="")ip = getLocalIPAddressWithNetworkInterface(NetworkInterfaceType.Wireless80211);
|
||||
if (ip == "") ip = getLocalIPAddressWithNetworkInterface(NetworkInterfaceType.Wireless80211);
|
||||
if (ip == "") ip = getLocalIPAddressWithNetworkInterface(NetworkInterfaceType.Ppp);
|
||||
if (ip == "") ip = getLocalIPAddressWithNetworkInterface(NetworkInterfaceType.Wwanpp);
|
||||
if (ip == "") ip = getLocalIPAddressWithNetworkInterface(NetworkInterfaceType.TokenRing);
|
||||
|
||||
Reference in new issue
Block a user