Exemple #1
0
        public override int Open()
        {
#if (NoCom)
            mvarIsOpen = true;
            ErrorCode  = 0;
#else
            lock (mvarActEasyIF)
            {
                mvarIsOpen = (ErrorCode = mvarActEasyIF.Open()) == 0 ? true : false;
            }
#endif
            return(ErrorCode);
        }
Exemple #2
0
        private void ComOpen_Click(object sender, EventArgs e)
        {
            plc.ActLogicalStationNumber = 1;

            if (stationNo == 1)
            {
                int open = plc.Open();
                if (open != 0)
                {
                    MessageBox.Show("Communication Error!");
                }
                else
                {
                    MessageBox.Show("Communication Success!");
                    ComOpen.Enabled  = false;
                    ComClose.Enabled = true;

                    timer1.Start();
                    this.WindowState = FormWindowState.Minimized;
                }
            }
        }