Esempio n. 1
0
        private void Timer_Tick(object sender, EventArgs e)
        {
            pictureBox.SizeMode = PictureBoxSizeMode.StretchImage;
            try
            {
                uplimit   = Convert.ToDouble(UpLimit);
                downlimit = Convert.ToDouble(DownLimit);
            }
            catch { }
            string stringName = this.Name;

            if (rtdm != null)
            {
                string data = rtdm.GetDataByBoardPort(BoardNumber, RelatedPort);

                if (data != "")
                {
                    currentData = Convert.ToDouble(data);
                }
                if (currentData < downlimit || currentData > uplimit)
                {
                    pictureBox.Image = global::Library.Properties.Resources.alarmOn;
                }
                else
                {
                    pictureBox.Image = null;
                }
            }
        }
Esempio n. 2
0
        private void Timer_Tick(object sender, EventArgs e)
        {
            string stringName = this.Name;

            if (rtdm != null)
            {
                this.Text = rtdm.GetDataByBoardPort(BoardNumber, RelatedPort);
            }
        }
        public void CheckCurrentState()
        {
            string stringName = this.Name;

            if (rtdm != null)
            {
                string data = rtdm.GetDataByBoardPort(BoardNumber, RelatedPort);
                if (data == "1")
                {
                    currentState = "1";
                }
                else if (data == "0")
                {
                    currentState = "0";
                }
            }
            this.Invalidate();
        }
Esempio n. 4
0
        private void Timer_Tick(object sender, EventArgs e)
        {
            string RelatedPort = "";
            string type        = "";

            float midvalue = 0;

            dataPT.GetBoardPortByNameBdnum(stringName, BoardNumber, ref RelatedPort, ref type);
            if (rtdm != null)
            {
                midvalue = float.Parse(rtdm.GetDataByBoardPort(this.BoardNumber, RelatedPort));
            }
            this.Value = (int)midvalue;
            SetProcessValue(Value);
            if (Value > 40)
            {
                this.ForeColor = Color.Yellow;
            }
            else
            {
                this.ForeColor = Color.Blue;
            }
        }
Esempio n. 5
0
        private void Timer_Tick(object sender, EventArgs e)
        {
            pictureBox.SizeMode = PictureBoxSizeMode.StretchImage;
            try
            {
            }
            catch { }
            string stringName = this.Name;

            if (rtdm != null)
            {
                string data = rtdm.GetDataByBoardPort(BoardNumber, RelatedPort);

                if (data == "1")
                {
                    pictureBox.Image = global::Library.Properties.Resources.NormalState;
                }
                else if (data == "0")
                {
                    pictureBox.Image = global::Library.Properties.Resources.FailState;
                }
            }
        }
Esempio n. 6
0
        private void Startblock_Click(object sender, EventArgs e)
        {
            string BoardNumber = this.BoardNumber;
            string RelatedPort = "";
            string DeviceType  = "";
            string stringName  = "";
            string PortData    = "";
            string PortBind    = "";


            if (this.Startblock.currentState == "1")
            {
                //      dataPT.GetBoardPortByNameBdnum(stringName, BoardNumber, ref RelatedPort, ref DeviceType);

                int k = 0, a = 0;
                a = this.Controls.Count;
                object[] comps = new object[a];
                foreach (object o in this.Controls)
                {
                    comps[k] = o;
                    Type t = comps[k].GetType();
                    if (t.Name.Equals("TextBox"))
                    {
                        TextBox currentcomp = (TextBox)comps[k];
                        stringName = "Dechp_" + currentcomp.Name;
                        dataPT.GetBoardPortByNameBdnum(stringName, BoardNumber, ref RelatedPort, ref DeviceType);
                        currentcomp.BoardNumber = BoardNumber;
                        currentcomp.RelatedPort = RelatedPort;
                        currentcomp.rtdm        = rtdm;
                        // currentcomp.Name = stringName;
                        if (currentcomp.rtdm == null)
                        {
                            return;
                        }
                    }
                    if (t.Name.Equals("ButtonCheck"))
                    {
                        ButtonCheck currentcomp = (ButtonCheck)comps[k];
                        stringName = "Dechp_" + currentcomp.Name;
                        dataPT.GetBoardPortByNameBdnum(stringName, BoardNumber, ref RelatedPort, ref DeviceType);
                        currentcomp.BoardNumber = BoardNumber;
                        currentcomp.RelatedPort = RelatedPort;
                        currentcomp.CDrtdm      = rtdm;
                        // currentcomp.Name = stringName;
                        if (currentcomp.rtdm == null)
                        {
                            return;
                        }
                    }
                    else if (t.Name.Equals("statusIndicator"))
                    {
                        statusIndicator currentcomp = (statusIndicator)comps[k];
                        stringName = "Dechp_" + currentcomp.Name;
                        dataPT.GetBoardPortByNameBdnum(stringName, BoardNumber, ref RelatedPort, ref DeviceType);
                        currentcomp.BoardNumber  = BoardNumber;
                        currentcomp.RelatedPort  = RelatedPort;
                        currentcomp.currentState = rtdm.GetDataByBoardPort(BoardNumber, RelatedPort);
                        currentcomp.rtdm         = rtdm;
                        if (currentcomp.rtdm == null)
                        {
                            return;
                        }
                    }
                    else if (t.Name.Equals("levelmeter"))
                    {
                        levelmeter currentcomp = (levelmeter)comps[k];
                        stringName = "Dechp_" + currentcomp.Name;
                        dataPT.GetBoardPortByNameBdnum(stringName, BoardNumber, ref RelatedPort, ref DeviceType);
                        currentcomp.BoardNumber = BoardNumber;
                        currentcomp.RelatedPort = RelatedPort;
                        currentcomp.Value       = (int)(float.Parse(rtdm.GetDataByBoardPort(this.BoardNumber, RelatedPort)));
                        currentcomp.rtdm        = rtdm;
                        if (currentcomp.rtdm == null)
                        {
                            return;
                        }
                    }
                    else if (t.Name.Equals("SendButton"))
                    {
                        SendButton currentcomp = (SendButton)comps[k];
                        stringName = "Dechp_" + currentcomp.Name;
                        dataPT.GetBoardPortByNameBdnum(stringName, BoardNumber, ref RelatedPort, ref DeviceType);
                        currentcomp.BoardNumber = BoardNumber;
                        currentcomp.RelatedPort = RelatedPort;
                        dataPT.GetBoardSendPortByNameBdnum(stringName, BoardNumber, ref RelatedPort, ref PortData, ref PortBind);
                        currentcomp.PortBind      = PortBind;
                        currentcomp.sendData.Text = rtdm.GetDataByBoardPort(this.BoardNumber, RelatedPort);
                        currentcomp.rtdm          = rtdm;
                        if (currentcomp.rtdm == null)
                        {
                            return;
                        }
                    }

                    k++;
                }
            }
        }
Esempio n. 7
0
        private void Startblock_Click(object sender, EventArgs e)
        {
            string BoardNumber = this.BoardNumber;
            string RelatedPort = "";
            string DeviceType  = "";
            string stringName  = "";

            // dataSend.SendControlData(this.Startblock.currentState, Startblock.RelatedPort, Startblock.PortBind, this.BoardNumber);

            if (this.Startblock.currentState == "1")
            {
                //   dataPT.GetBoardPortByNameBdnum(stringName, BoardNumber, ref RelatedPort, ref DeviceType);

                int i = 0, j = 0, k = 0, l = 0, a = 0;
                a = this.Controls.Count;
                object[] comps = new object[a];
                foreach (object o in this.Controls)
                {
                    comps[k] = o;
                    Type t = comps[k].GetType();
                    if (t.Name.Equals("TextBox"))
                    {
                        TextBox currentcomp = (TextBox)comps[k];
                        stringName = "Readjhw_" + currentcomp.Name;
                        dataPT.GetBoardPortByNameBdnum(stringName, BoardNumber, ref RelatedPort, ref DeviceType);
                        currentcomp.BoardNumber = BoardNumber;
                        currentcomp.RelatedPort = RelatedPort;
                        currentcomp.rtdm        = rtdm;
                        currentcomp.Name        = stringName;
                        if (currentcomp.rtdm == null)
                        {
                            return;
                        }

                        i++;
                    }
                    else if (t.Name.Equals("statusIndicator"))
                    {
                        statusIndicator currentcomp = (statusIndicator)comps[k];
                        stringName = "Readjhw_" + currentcomp.Name;
                        dataPT.GetBoardPortByNameBdnum(stringName, BoardNumber, ref RelatedPort, ref DeviceType);
                        currentcomp.BoardNumber  = BoardNumber;
                        currentcomp.RelatedPort  = RelatedPort;
                        currentcomp.currentState = rtdm.GetDataByBoardPort(BoardNumber, RelatedPort);
                        currentcomp.rtdm         = rtdm;
                        if (currentcomp.rtdm == null)
                        {
                            return;
                        }
                        //    this.Start();
                        j++;
                    }
                    else if (t.Name.Equals("levelmeter"))
                    {
                        levelmeter currentcomp = (levelmeter)comps[k];
                        stringName = "Readjhw_" + currentcomp.Name;
                        dataPT.GetBoardPortByNameBdnum(stringName, BoardNumber, ref RelatedPort, ref DeviceType);
                        currentcomp.BoardNumber = BoardNumber;
                        currentcomp.RelatedPort = RelatedPort;
                        //string decVal = rtdm.GetDataByBoardPort(BoardNumber, RelatedPort);
                        //string[] decValMatix = decVal.Split('.');
                        //int value = int.Parse(decValMatix[0]);
                        currentcomp.stringName = stringName;
                        currentcomp.rtdm       = rtdm;
                        currentcomp.Value      = (int)(float.Parse(rtdm.GetDataByBoardPort(this.BoardNumber, RelatedPort)));
                        //  currentcomp.Value = int.Parse(rtdm.GetDataByBoardPort(BoardNumber, RelatedPort));
                        currentcomp.rtdm = rtdm;
                        if (currentcomp.rtdm == null)
                        {
                            return;
                        }
                        //    this.Start();
                        l++;
                    }
                    k++;
                }
            }
        }