|
|
@ -12,6 +12,7 @@ using System.Net.Sockets;
|
|
|
|
using System.Threading;
|
|
|
|
using System.Threading;
|
|
|
|
using System.IO;
|
|
|
|
using System.IO;
|
|
|
|
using System.Runtime.InteropServices;
|
|
|
|
using System.Runtime.InteropServices;
|
|
|
|
|
|
|
|
using System.Net.NetworkInformation;
|
|
|
|
|
|
|
|
|
|
|
|
namespace WindowsFormsApp2
|
|
|
|
namespace WindowsFormsApp2
|
|
|
|
{
|
|
|
|
{
|
|
|
@ -20,13 +21,20 @@ namespace WindowsFormsApp2
|
|
|
|
[DllImport("USER32.DLL")]
|
|
|
|
[DllImport("USER32.DLL")]
|
|
|
|
public static extern bool SetForegroundWindow(IntPtr hWnd);
|
|
|
|
public static extern bool SetForegroundWindow(IntPtr hWnd);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
[DllImport("user32.dll", SetLastError = true)]
|
|
|
|
|
|
|
|
static extern IntPtr FindWindow(string lpClassName, string lpWindowName);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
[DllImport("user32.dll")]
|
|
|
|
|
|
|
|
static extern bool EndDialog(IntPtr hDlg, out IntPtr nResult);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const int NumberOfSupportedCameras = 8;
|
|
|
|
const int NumberOfSupportedCameras = 8;
|
|
|
|
public Thread recvThread = null;
|
|
|
|
public Thread recvThread = null;
|
|
|
|
public Thread filerecvThread = null;
|
|
|
|
public Thread filerecvThread = null;
|
|
|
|
bool m_Done = false;
|
|
|
|
bool m_Done = false;
|
|
|
|
public static byte[] clientIP = new byte[] { 192, 168, 10, 127 };
|
|
|
|
public static byte[] clientIP = new byte[] { 192, 168, 1, 178 };
|
|
|
|
public static byte[] localIP = new byte[] { 192, 168, 10, 127 };
|
|
|
|
public static byte[] localIP = new byte[] { 192, 168, 10, 127 };
|
|
|
|
public static int ordPort = 3333;
|
|
|
|
public static int ordPort = 3000;
|
|
|
|
public static int feedPort = 2999;
|
|
|
|
public static int feedPort = 2999;
|
|
|
|
public static int filePort = 2999;
|
|
|
|
public static int filePort = 2999;
|
|
|
|
UdpClient u = null;
|
|
|
|
UdpClient u = null;
|
|
|
@ -35,6 +43,52 @@ namespace WindowsFormsApp2
|
|
|
|
DialogSetup setup = new DialogSetup();
|
|
|
|
DialogSetup setup = new DialogSetup();
|
|
|
|
public static bool Stop = true;//停止
|
|
|
|
public static bool Stop = true;//停止
|
|
|
|
public static bool Debug;//调试状态
|
|
|
|
public static bool Debug;//调试状态
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public void ShowMessageBoxTimeout(string text, string caption,
|
|
|
|
|
|
|
|
MessageBoxButtons buttons, int timeout)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
ThreadPool.QueueUserWorkItem(new WaitCallback(CloseMessageBox),
|
|
|
|
|
|
|
|
new CloseState(caption, timeout));
|
|
|
|
|
|
|
|
MessageBox.Show(text, caption, buttons);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
private class CloseState
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
private int _Timeout;
|
|
|
|
|
|
|
|
public int Timeout
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
get
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
return _Timeout;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
private string _Caption;
|
|
|
|
|
|
|
|
public string Caption
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
get
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
return _Caption;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
public CloseState(string caption, int timeout)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
_Timeout = timeout;
|
|
|
|
|
|
|
|
_Caption = caption;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
private void CloseMessageBox(object state)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
CloseState closeState = state as CloseState;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Thread.Sleep(closeState.Timeout);
|
|
|
|
|
|
|
|
IntPtr dlg = FindWindow(null, closeState.Caption);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (dlg != IntPtr.Zero)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
IntPtr result;
|
|
|
|
|
|
|
|
EndDialog(dlg, out result);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
protected virtual void OnClosing(System.ComponentModel.CancelEventArgs e)
|
|
|
|
protected virtual void OnClosing(System.ComponentModel.CancelEventArgs e)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
m_Done = true;
|
|
|
|
m_Done = true;
|
|
|
@ -373,8 +427,7 @@ namespace WindowsFormsApp2
|
|
|
|
label6.Text = " 运行中 ";
|
|
|
|
label6.Text = " 运行中 ";
|
|
|
|
label8.BackColor = Color.Lime;
|
|
|
|
label8.BackColor = Color.Lime;
|
|
|
|
label6.BackColor = Color.Lime;
|
|
|
|
label6.BackColor = Color.Lime;
|
|
|
|
|
|
|
|
ShowMessageBoxTimeout("客户端启动成功", "请耐心等待……", MessageBoxButtons.OK, 2000);
|
|
|
|
DialogResult dr = MessageBox.Show("启动成功", "状态", MessageBoxButtons.OK, MessageBoxIcon.Information, MessageBoxDefaultButton.Button1, MessageBoxOptions.DefaultDesktopOnly);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
else
|
|
|
@ -689,6 +742,8 @@ namespace WindowsFormsApp2
|
|
|
|
private void timer1_Tick(object sender, EventArgs e)
|
|
|
|
private void timer1_Tick(object sender, EventArgs e)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
this.toolStripStatusLabel1.Text = DateTime.Now.ToString("yyyy-MM-dd hh:mm:ss");
|
|
|
|
this.toolStripStatusLabel1.Text = DateTime.Now.ToString("yyyy-MM-dd hh:mm:ss");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|