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.
124 lines
4.7 KiB
C#
124 lines
4.7 KiB
C#
using Rs.Controls;
|
|
using Rs.DataAccess;
|
|
using Rs.Motion.Base;
|
|
using Rs.Motion.Base.Config;
|
|
using Rs.Motion.GugaoEcat;
|
|
using Rs.Motion.GugaoPulse;
|
|
using Rs.MotionPlat.Flow;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.ComponentModel;
|
|
using System.Data;
|
|
using System.Drawing;
|
|
using System.Linq;
|
|
using System.Reflection;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
using System.Windows.Forms;
|
|
|
|
namespace Rs.MotionPlat
|
|
{
|
|
public partial class MonitorConfig : BaseForm
|
|
{
|
|
List<ButtonEx> axisButtons = new List<ButtonEx>();
|
|
private List<string> axisNames = new List<string>();
|
|
public MonitorConfig()
|
|
{
|
|
InitializeComponent();
|
|
LoadLeftMenu();
|
|
}
|
|
|
|
void LoadLeftMenu()
|
|
{
|
|
TabControlEx tabControl = new TabControlEx();
|
|
tabControl.Dock = DockStyle.Fill;
|
|
tabControl.Alignment = TabAlignment.Top;
|
|
tabControl.DrawMode = TabDrawMode.OwnerDrawFixed;
|
|
|
|
SqliteHelper db = new SqliteHelper();
|
|
Type type = typeof(AxisControl);
|
|
PropertyInfo[] pis = type.GetProperties(BindingFlags.Public | BindingFlags.Static);
|
|
foreach (var item in pis)
|
|
{
|
|
axisNames.Add(item.Name);
|
|
}
|
|
|
|
string querySql = "select * from motioncard where CardType='Motion' and enable=1";
|
|
DataTable dt=db.GetDataTable(querySql);
|
|
if(dt!=null&& dt.Rows.Count>0)
|
|
{
|
|
foreach (DataRow row in dt.Rows)
|
|
{
|
|
ICard card = new ICard();
|
|
switch (row["vender"].ToString().ToLower())
|
|
{
|
|
case "ztm":
|
|
card = ZtmCardManager.Instance.GetCard(short.Parse(row["cardid"].ToString()));
|
|
break;
|
|
case "gugaoecat":
|
|
card = GugaoCardManager.Instance.GetCard(0);
|
|
break;
|
|
case "gugao":
|
|
card = GugaoPulseCardManager.Instance.GetCard(ushort.Parse(row["cardid"].ToString()));
|
|
break;
|
|
default:
|
|
break;
|
|
}
|
|
TabPage tp = new TabPage();
|
|
tp.BackColor = Color.Black;
|
|
tp.ForeColor = Color.White;
|
|
tp.Height = 50;
|
|
tp.Text = row["aliasname"].ToString();
|
|
//tp.Text = "" + row["vender"] + row["cardid"];
|
|
tabControl.TabPages.Add(tp);
|
|
|
|
TableLayoutPanel tableLayoutPanel = new TableLayoutPanel();
|
|
tableLayoutPanel.RowCount = 12;
|
|
tableLayoutPanel.Padding = new Padding(3);
|
|
tableLayoutPanel.ResumeLayout();
|
|
int i = 1;
|
|
foreach (AxisConfig ac in card.Config.AxisConfigs)
|
|
{
|
|
tableLayoutPanel.RowStyles.Add(new RowStyle(SizeType.Absolute, 60));
|
|
ButtonEx button = new ButtonEx();
|
|
button.UnSelectedColor = Color.Black;
|
|
button.Selected = false;
|
|
axisButtons.Add(button);
|
|
button.Click += (s, e) =>
|
|
{
|
|
ButtonEx btn = (ButtonEx)s;
|
|
axisButtons.ForEach((b) =>
|
|
{
|
|
b.Selected = false;
|
|
});
|
|
btn.Selected = true;
|
|
axisMove1.BindAxis(ac.Axis);
|
|
axisProperty1.BindAxis(ac.Axis);
|
|
};
|
|
button.Cursor = Cursors.Hand;
|
|
button.ShowText = ac.AxisName;
|
|
button.FlatStyle = FlatStyle.Flat;
|
|
button.Dock = DockStyle.Fill;
|
|
button.FlatAppearance.MouseOverBackColor = Color.Green;
|
|
button.ForeColor = Color.White;
|
|
button.Padding = new Padding(0);
|
|
button.Margin = new Padding(0);
|
|
button.Font = new Font("微软雅黑", 16);
|
|
tableLayoutPanel.Controls.Add(button, 0, i - 1);
|
|
tableLayoutPanel.Dock = DockStyle.Fill;
|
|
i++;
|
|
}
|
|
tp.Controls.Add(tableLayoutPanel);
|
|
}
|
|
|
|
}
|
|
panelLeft.Controls.Add(tabControl);
|
|
}
|
|
|
|
private void MonitorConfig_Load(object sender, EventArgs e)
|
|
{
|
|
|
|
}
|
|
}
|
|
}
|