108 lines
3.4 KiB
C#
108 lines
3.4 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.ComponentModel;
|
|
using System.Data;
|
|
using System.Drawing;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Windows.Forms;
|
|
|
|
namespace CommonLib.test
|
|
{
|
|
public partial class FrmTestClient : Form
|
|
{
|
|
|
|
public FrmTestClient()
|
|
{
|
|
InitializeComponent();
|
|
}
|
|
private void FrmTestClient_Load(object sender, EventArgs e)
|
|
{
|
|
CboType.SelectedIndex = 0;
|
|
}
|
|
|
|
private IntPtr m_ClientTestHandle = IntPtr.Zero;
|
|
|
|
private void btnStartUpdate_Click(object sender, EventArgs e)
|
|
{
|
|
fmUpdateDownloadType type = (fmUpdateDownloadType)CboType.SelectedIndex;
|
|
TParamsData pd = new TParamsData(type, this.Handle);
|
|
pd.setLocation(int.Parse(txtLeft.Text), int.Parse(txtTop.Text));
|
|
pd.setSize(int.Parse(txtWidth.Text), int.Parse(txtHeight.Text));
|
|
pd.setParent(int.Parse(txtDiectoryId.Text));
|
|
string[] strFileIds = txtFileIds.Text.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries);
|
|
foreach (string sId in strFileIds)
|
|
{
|
|
pd.addFileId(int.Parse(sId));
|
|
}
|
|
if (chkFileNum.Checked)
|
|
{
|
|
pd.SetfileNumber(txtFileNum.Text);
|
|
pd.SetspecieNo(txtSpeciesNo.Text);
|
|
}
|
|
if (chkFileNum.Checked)
|
|
{
|
|
pd.CallUpdateUIEx();
|
|
}
|
|
else
|
|
{
|
|
pd.CallUpdateUI();
|
|
}
|
|
}
|
|
|
|
private void btnDownloadBackground_Click(object sender, EventArgs e)
|
|
{
|
|
TParamsData pd = new TParamsData(this.Handle);
|
|
pd.CallDownload(txtDownloadBackground.Text);
|
|
}
|
|
|
|
|
|
|
|
protected override void DefWndProc(ref Message m)
|
|
{
|
|
try
|
|
{
|
|
switch (m.Msg)
|
|
{
|
|
//接收到客户端发来的窗体句柄
|
|
case LSCustomWinMsg.REV_CLIENT_WINDOW_HANDLE:
|
|
{
|
|
m_ClientTestHandle = m.WParam;
|
|
break;
|
|
}
|
|
|
|
//接收到客户端处理错误消息
|
|
case LSCustomWinMsg.REV_CLIENT_DEAL_ERROR:
|
|
{
|
|
MessageBox.Show("通讯客户端处理出错了");
|
|
break;
|
|
}
|
|
|
|
//接收到客户端处理ok消息
|
|
case LSCustomWinMsg.REV_CLIENT_DEAL_OK:
|
|
{
|
|
MessageBox.Show("通讯客户端处理下载ok了");
|
|
break;
|
|
}
|
|
|
|
//批量上传关闭窗体之前的通知消息
|
|
case LSCustomWinMsg.BATCH_UPLOAD_COMPLETED:
|
|
{
|
|
MessageBox.Show("通讯客户端批量上传下载完毕关闭窗体");
|
|
break;
|
|
}
|
|
default:
|
|
{
|
|
base.DefWndProc(ref m);
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
PubUtil.WriteLog(ex.Message);
|
|
}
|
|
}
|
|
}
|
|
}
|