123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154 |
- using System;
- using System.Collections.Generic;
- using System.ComponentModel;
- using System.Drawing;
- using System.Data;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- using System.Windows.Forms;
- using MeasureData;
- using FileManager;
- using System.Xml;
- namespace HOZProject
- {
- public partial class UControl_ParaInfo : UserControl
- {
- /// <summary>
- /// 开始时间
- /// </summary>
- private string startTime;
- /// <summary>
- /// 结束时间
- /// </summary>
- private string endTime;
- /// <summary>
- /// 状态
- /// </summary>
- private string state;
- /// <summary>
- /// 位置
- /// </summary>
- private SemPosition position;
- private bool isSwitch;
- private string cutHoleName;
- private FormHOZMain formHOZMain;
- private TimeLineItem[] tlItem = null;
- private UCTimeLine uCTimeLine=null;
- private int flowCode = 1;
- public FormHOZMain FormHOZMainObject { get => formHOZMain; set => formHOZMain = value; }
- public string StartTime { get => startTime; set => startTime = value; }
- public string EndTime { get => endTime; set => endTime = value; }
- public string State { get => state; set => state = value; }
- public SemPosition Position { get => position; set => position = value; }
- public string CutHoleName { get => cutHoleName; set => cutHoleName = value; }
- public bool IsSwitch { get => isSwitch; set => isSwitch = value; }
- public TimeLineItem[] TlItem { get => tlItem; set => tlItem = value; }
- public UControl_ParaInfo(FormHOZMain formHOZ)
- {
- InitializeComponent();
- FormHOZMainObject = formHOZ;
- ShowMeasureFlow("1");
- }
- private void btnClose_Click(object sender, EventArgs e)
- {
- foreach (Control item in FormHOZMainObject.plFill.Controls)
- {
- if (item is Panel)
- {
- foreach (Control itemControl in item.Controls)
- {
- if (itemControl.Name == this.Name)
- {
- item.Controls.Remove(this);
- this.Dispose();
- item.Visible = false;
- break;
- }
- }
- }
- }
- }
- public void ShowUCTimeLine(TimeLineItem[] tlItem)
- {
- if (plTimeLine.Controls.Count == 0)
- {
- uCTimeLine = new UCTimeLine(tlItem);
- uCTimeLine.Dock = DockStyle.Fill;
- plTimeLine.Controls.Add(uCTimeLine);
- }
- }
- public void TimeLineInvalidate()
- {
- plTimeLine.Invalidate();
- uCTimeLine.Invalidate();
- }
- /// <summary>
- /// 显示切孔参数信息
- /// </summary>
- public void ShowParaInfo()
- {
- int multiple = 1000;
- //设置Position参数
- lblX.Text = (Position.X * multiple).ToString("f3");
- lblY.Text = (Position.Y * multiple).ToString("f3");
- lblZ.Text = (Position.Z * multiple).ToString("f3");
- lblR.Text = Position.R.ToString();
- lblT.Text = Position.T.ToString();
- lblM.Text = Position.M.ToString();
- lblShowStartTime.Text = StartTime;
- lblShowEndTime.Text = EndTime;
- lblShowState.Text = State;
- lblCutHoleName.Text = CutHoleName;
- CkIsSwitch.Checked = IsSwitch;
- }
- /// <summary>
- /// 绑定流程信息
- /// </summary>
- /// <param name="flowCode"></param>
- private void ShowMeasureFlow(string flowCode)
- {
- if (TlItem == null)
- {
- TlItem = GetMeasureFlowStructInfo(flowCode);
- }
- if (TlItem != null)
- {
- ShowUCTimeLine(TlItem);
- }
- }
- private TimeLineItem[] GetMeasureFlowStructInfo(string MeasureCode)
- {
- string xmlfullname = Application.StartupPath+ @"\MeasureXML\MeasureStructXml.xml";
- XmlNodeList nodeList = XmlManager.GetXmlMeasureFlowNodeInfo(xmlfullname, MeasureCode);
- if (nodeList != null)
- {
- return XmlConvertTimeListItem(nodeList);
- }
- return null;
- }
- private TimeLineItem[] XmlConvertTimeListItem(XmlNodeList nodeList)
- {
- TimeLineItem[] timeLineItem = new TimeLineItem[nodeList.Count];
- for (int i = 0; i < nodeList.Count; i++)
- {
- TimeLineItem tlItem = new TimeLineItem();
- tlItem.Details = nodeList[i].Attributes["Details"].Value;
- tlItem.Code = nodeList[i].Attributes["Code"].Value;
- tlItem.State = 0;
- tlItem.Title = nodeList[i].Attributes["Title"].Value;
- tlItem.IsData = Convert.ToBoolean(nodeList[i].Attributes["IsData"].Value);
- timeLineItem[i] = tlItem;
- }
- return timeLineItem;
- }
- }
- }
|