|
|
|
|
using NDSD_TouchSocket;
|
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.ComponentModel;
|
|
|
|
|
using System.Data;
|
|
|
|
|
using System.Drawing;
|
|
|
|
|
using System.Linq;
|
|
|
|
|
using System.Text;
|
|
|
|
|
using System.Threading;
|
|
|
|
|
using System.Threading.Tasks;
|
|
|
|
|
using System.Windows.Forms;
|
|
|
|
|
using DNSD_DB;
|
|
|
|
|
using NewLife.Caching;
|
|
|
|
|
using static System.Windows.Forms.VisualStyles.VisualStyleElement.TaskbarClock;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
namespace NDSD_Screwdriver
|
|
|
|
|
{
|
|
|
|
|
public partial class ScrewdriverTest : Form
|
|
|
|
|
{
|
|
|
|
|
DOperate DOperate;
|
|
|
|
|
|
|
|
|
|
TcpServer server;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public ScrewdriverTest(TcpServer s, DOperate d) : this()
|
|
|
|
|
{
|
|
|
|
|
server = s;
|
|
|
|
|
DOperate = d;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private ICache cache = Cache.Default;
|
|
|
|
|
public ScrewdriverTest()
|
|
|
|
|
{
|
|
|
|
|
DOperate = new DOperate();
|
|
|
|
|
InitializeComponent();
|
|
|
|
|
cache.Set("Test", DateTime.Now);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void DOpenButton_Click(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
int no;
|
|
|
|
|
int.TryParse(DNoTextBox.Text, out no);
|
|
|
|
|
if(no >= 1 && no <= 16)
|
|
|
|
|
{
|
|
|
|
|
DOperate.DOpen(no);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
MessageBox.Show("请输入1-16的数字!");
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void DCloseButton_Click(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
int no;
|
|
|
|
|
int.TryParse(DNoTextBox.Text, out no);
|
|
|
|
|
if (no >= 1 && no <= 16)
|
|
|
|
|
{
|
|
|
|
|
DOperate.DClose(no);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
MessageBox.Show("请输入1-16的数字!");
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void DCloseAll_Click(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
int span;
|
|
|
|
|
int.TryParse(DelaySpanTextBox.Text, out span);
|
|
|
|
|
if(span <= 0)
|
|
|
|
|
{
|
|
|
|
|
MessageBox.Show("属性值无效!");
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
Thread thread = new Thread(() =>
|
|
|
|
|
{
|
|
|
|
|
for (int i = 0; i <= 16; i++)
|
|
|
|
|
{
|
|
|
|
|
DOperate.DClose(i);
|
|
|
|
|
Thread.Sleep(span);
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
thread.Start();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void DOpenAll_Click(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
int span;
|
|
|
|
|
int.TryParse(DelaySpanTextBox.Text, out span);
|
|
|
|
|
if (span <= 0)
|
|
|
|
|
{
|
|
|
|
|
MessageBox.Show("属性值无效!");
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
for (int i = 0; i <= 16; i++)
|
|
|
|
|
{
|
|
|
|
|
DOperate.DOpen(i);
|
|
|
|
|
Thread.Sleep(200);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void ScrewdriverTest_FormClosed(object sender, FormClosedEventArgs e)
|
|
|
|
|
{
|
|
|
|
|
cache.Remove("Test");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void DelayButton_Click(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
int no;
|
|
|
|
|
int time;
|
|
|
|
|
int.TryParse(DNoTextBox.Text, out no);
|
|
|
|
|
int.TryParse(DelayTimeTextBox.Text, out time);
|
|
|
|
|
DOperate.DTimeOpen(no, time);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void AllTimeButton_Click(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
int.TryParse(DelaySpanTextBox.Text, out var span);
|
|
|
|
|
int.TryParse(DelayTimeTextBox.Text, out var time);
|
|
|
|
|
if (span <= 0 || time <= 0)
|
|
|
|
|
{
|
|
|
|
|
MessageBox.Show("属性值无效!");
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
Thread thread = new Thread(() =>
|
|
|
|
|
{
|
|
|
|
|
for (int i = 0; i <= 16; i++)
|
|
|
|
|
{
|
|
|
|
|
DOperate.DTimeOpen(i, time);
|
|
|
|
|
Thread.Sleep(span);
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
thread.Start();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|