ReelDataControl.cs 3.4 KB
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using OnlineStore.DeviceLibrary;
using OnlineStore.LoadCSVLibrary;

namespace OnlineStore.XLRStore
{
    public partial class ReelDataControl : UserControl
    { 
        public string ReelText
        {
            get { return lblText.Text; }
            set { lblText.Text = value; }
        } 
        public Color ColorStatus
        {
            get { return this.BackColor; } 
            set
            {
                this.BackColor = value;
            }
        } 
        public void SelectStyle()
        { 
            panName.BackColor = Color.DeepSkyBlue;
        }
        public void UnSelectStyle()
        { 
            panName.BackColor = Color.Transparent;
        }
        public void ShowData(string text, InOutPosInfo posInfo,IO_VALUE value)
        { 
            lblText.Text = text;
            if (posInfo == null)
            {
                lblReelInfo.Text = "";
                this.BackColor = Color.White;
                linkClear.Visible = false;
            }
            else
            {

                lblReelInfo.Text = posInfo.ToStr();
                this.BackColor = Color.LimeGreen;
                linkClear.Visible = true ;
            }
            if (value.Equals(IO_VALUE.LOW))
            {
                lblSingle.Visible = false;
                lblSingle.Text = "";
            }
            else
            {
                lblSingle.Visible = true;
                lblSingle.Text = "检测有料";
                lblSingle.BackColor = Color.LimeGreen;
            }
        }
        public void ShowData(string text, List<InOutPosInfo> posInfos, IO_VALUE value)
        {
            lblText.Text = text;
            if (posInfos == null || posInfos.Count<1)
            {
                lblReelInfo.Text = "";
                this.BackColor = Color.White;
                linkClear.Visible = false;
            }
            else
            {
                StringBuilder sb = new StringBuilder();
                foreach (InOutPosInfo item in posInfos)
                {
                    sb.Append($"{item.CreateTime};\r\n");
                }
                lblReelInfo.Text = sb.ToString();
                this.BackColor = Color.LimeGreen;
                linkClear.Visible = true;
            }
            if (value.Equals(IO_VALUE.LOW))
            {
                lblSingle.Visible = false;
                lblSingle.Text = "";
            }
            else
            {
                lblSingle.Visible = true;
                lblSingle.Text = "检测有料";
                lblSingle.BackColor = Color.LimeGreen;
            }
        }
        public ReelDataControl()
        {
            InitializeComponent();
        } 
        private void EquipControl_Load(object sender, EventArgs e)
        { 
        }
         

        private void ReelDataControl_MouseEnter(object sender, EventArgs e)
        {
            SelectStyle();
        }

        private void ReelDataControl_MouseLeave(object sender, EventArgs e)
        {
            UnSelectStyle();
        }

        private void lblText_MouseEnter(object sender, EventArgs e)
        {
            SelectStyle();
        }

        private void lblText_MouseLeave(object sender, EventArgs e)
        {
            UnSelectStyle();

        }
    }
}