You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
119 lines
4.0 KiB
119 lines
4.0 KiB
using GummingBusiness;
|
|
using GummingCommon;
|
|
using GummingControl;
|
|
using GummingEntity;
|
|
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;
|
|
|
|
namespace GummingTest
|
|
{
|
|
public partial class FormRobot : Form
|
|
{
|
|
public FormRobot()
|
|
{
|
|
InitializeComponent();
|
|
}
|
|
|
|
private void button1_Click(object sender, EventArgs e)
|
|
{
|
|
Global.IsRelease = true;
|
|
Robot.CreateLink();
|
|
var robotCommand = HardRobotCommandDA.Load(new PagerEntity() { PageIndex = 1, Rows = 9999, Conditions = " and 1=1 " });
|
|
Global.RobotCommands = (List<HardRobotCommandEntity>)robotCommand.rows;
|
|
var robotStation = HardRobotStationDA.Load(new PagerEntity() { PageIndex = 1, Rows = 9999, Conditions = " and 1=1 " });
|
|
Global.RobotStations = (List<HardRobotStationEntity>)robotStation.rows;
|
|
}
|
|
|
|
private void button2_Click(object sender, EventArgs e)
|
|
{
|
|
|
|
Thread tr = new Thread(new ThreadStart((Action)(() =>
|
|
{
|
|
try
|
|
{
|
|
var inits = Global.RobotCommands.FindAll(q => (RobotCommandType)q.CommandType == RobotCommandType.Init).OrderBy(o => o.OrderBy).ToList();
|
|
for (int i = 0; i < inits.Count; i++)
|
|
{
|
|
var init = inits[i];
|
|
string callback = Robot.Send(init.CommandCode);
|
|
this.Invoke((Action)(() =>
|
|
{
|
|
listBox2.Items.Add(callback);
|
|
listBox2.SelectedIndex = listBox2.Items.Count - 1;
|
|
}));
|
|
}
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
|
|
Global.WriteErrorLog(ex);
|
|
}
|
|
})));
|
|
tr.IsBackground = true;
|
|
tr.Start();
|
|
}
|
|
|
|
private void button3_Click(object sender, EventArgs e)
|
|
{
|
|
listBox2.Items.Add(Robot.Send(textBox1.Text));
|
|
listBox2.SelectedIndex = listBox2.Items.Count - 1;
|
|
listBox1.Items.Add(textBox1.Text);
|
|
}
|
|
|
|
private void button4_Click(object sender, EventArgs e)
|
|
{
|
|
Thread tr = new Thread(new ThreadStart((Action)(() =>
|
|
{
|
|
try
|
|
{
|
|
var inits = Global.RobotCommands.FindAll(q => (RobotCommandType)q.CommandType == RobotCommandType.Map).OrderBy(o => o.OrderBy).ToList();
|
|
for (int i = 0; i < inits.Count; i++)
|
|
{
|
|
var init = inits[i];
|
|
string callback = Robot.Send(init.CommandCode);
|
|
this.Invoke((Action)(() =>
|
|
{
|
|
listBox2.Items.Add(callback);
|
|
listBox2.SelectedIndex = listBox2.Items.Count - 1;
|
|
}));
|
|
}
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
|
|
Global.WriteErrorLog(ex);
|
|
}
|
|
})));
|
|
tr.IsBackground = true;
|
|
tr.Start();
|
|
}
|
|
|
|
private void listBox1_SelectedIndexChanged(object sender, EventArgs e)
|
|
{
|
|
textBox1.Text = listBox1.SelectedItem.ToString();
|
|
}
|
|
|
|
private void btnMap_Click(object sender, EventArgs e)
|
|
{
|
|
listBox2.Items.Add(Robot.Send("MAP a"));
|
|
listBox2.SelectedIndex = listBox2.Items.Count - 1;
|
|
listBox1.Items.Add("MAP a");
|
|
}
|
|
|
|
private void button5_Click(object sender, EventArgs e)
|
|
{
|
|
listBox2.Items.Add(Robot.Send("RSR"));
|
|
listBox2.SelectedIndex = listBox2.Items.Count - 1;
|
|
listBox1.Items.Add("RSR");
|
|
}
|
|
}
|
|
}
|