You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
68 lines
2.1 KiB
C#
68 lines
2.1 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.Threading.Tasks;
|
|
using System.Windows.Forms;
|
|
using DrawerInterface;
|
|
|
|
namespace TestDrawerInteract
|
|
{
|
|
public partial class FormMain : Form, IDrawerInteract
|
|
{
|
|
public Form UserForm { get => this; set => throw new NotImplementedException(); }
|
|
|
|
public event EventHandler<RequestDataEventArgs> DataRequestEvent;
|
|
public event EventHandler<ResponseDataEventArgs> DataResponseEvent;
|
|
|
|
//public event EventHandler<ResponseDataEventArgs> DataResponseEvent;
|
|
public FormMain()
|
|
{
|
|
InitializeComponent();
|
|
|
|
//DataRequestEvent?.Invoke(this, new RequestDataEventArgs());
|
|
//DataResponseEvent?.Invoke(this, new ResponseDataEventArgs());
|
|
|
|
//DataResponseEvent += Form1_DataResponseEvent;
|
|
//DataRequestEvent += Form1_DataRequestEvent;
|
|
}
|
|
|
|
private void Form1_DataRequestEvent(object sender, RequestDataEventArgs e)
|
|
{
|
|
//throw new NotImplementedException();
|
|
}
|
|
/// <summary>
|
|
/// 对获取的数据进行处理
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
private void Form1_DataResponseEvent(object sender, ResponseDataEventArgs e)
|
|
{
|
|
this.txtGetData.Text = e.DataContent;
|
|
}
|
|
/// <summary>
|
|
/// 发送获得数据请求
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
private void btnGetData_Click(object sender, EventArgs e)
|
|
{
|
|
DataRequestEvent?.Invoke(this, new RequestDataEventArgs(0,0, this.txtSendData.Text));
|
|
}
|
|
|
|
public void RequestDataProcess(ResponseDataEventArgs e)
|
|
{
|
|
string strInfo = e.DataContent;
|
|
this.txtGetData.Text = strInfo;
|
|
}
|
|
|
|
private void btnSendData_Click(object sender, EventArgs e)
|
|
{
|
|
DataResponseEvent?.Invoke(this, new ResponseDataEventArgs(txtSendData.Text));
|
|
}
|
|
}
|
|
}
|