コード例 #1
0
        public void Import(string line, StateMachine machine)
        {
            var data = line.Split(' ');
            int i    = 0;
            var id   = int.Parse(data[i++]);

            Name = data[i++];
            Id   = int.Parse(data[i++]);

            var typeName   = data[i++];
            var configFile = data[i++];


            ConfigFile = configFile;

            //load motion card
            var motioncard = Activator.CreateInstance(FrameworkManager.MotionCardTypes[typeName]) as IMotionCard;

            if (motioncard == null)
            {
                throw new Exception($"LOAD MOTION ERROR: {line}");
            }

            Motion = motioncard;

            if (machine.MotionExs.ContainsKey(id))
            {
                return;
            }
            machine.MotionExs.Add(id, this);
        }
コード例 #2
0
        public MotionCardWrapper(IMotionCard motion)
        {
            if (motion == null)
            {
                return;
            }

            Name   = (motion)?.Name;
            Id     = motion.DeviceID;
            Motion = motion;
        }
コード例 #3
0
ファイル: EleVioControl.cs プロジェクト: xusongfei/LeadChina
 public void UpdateEleStatus(IMotionCard _motion)
 {
     if (CurEle.Enable && _motion != null)
     {
         var val = -1;
         _motion.ReadSingleDOutput(_motion.DevIndex, 0, CurEle.Port, out val);
         if (val != -1)
         {
             tBoxName.BackColor = (val == 0) ? Color.LightGray : System.Drawing.Color.Lime;
         }
     }
 }
コード例 #4
0
        public MotionCardWrapper(IMotionCard motion)
        {
            if (motion == null)
            {
                return;
            }

            Name    = (motion as IPrim)?.Name;
            Index   = motion.DevIndex;
            Motion  = motion;
            Trigger = motion;
            Interp  = motion;
        }
コード例 #5
0
        public void UpdateEleStatus(IMotionCard motion)
        {
            if (motion != null)
            {
                motion.ReadStatus(CurEle.AxisChannel);

                if (motion.AxisIsAlarm(0, CurEle.AxisChannel))
                {
                    tBoxName.BackColor = Color.Red;
                }
                else
                {
                    tBoxName.BackColor = motion.AxisIsStop(0, CurEle.AxisChannel) ? Color.Lime : Color.LightGray;
                }
            }
        }
コード例 #6
0
        public void UpdateEleStatus(IMotionCard _motion)
        {
            if (CurEle.Enable)
            {
                var val = -1;
                if (_motion != null)
                {
                    _motion.ReadSingleDInput(_motion.DevIndex, 0, CurEle.Port, out val);
                }

                if (val != -1)
                {
                    tBoxName.BackColor = (val == 0) ? Color.LightGray : Color.Lime;
                }
            }
        }
コード例 #7
0
        private void btnRun_Click(object sender, EventArgs e)
        {
            var prim = DevPrimsManager.Instance.GetPrimByName(_axis.Driver);

            if (prim == null)
            {
                MessageBox.Show("没有找到名称为: " + _axis.Driver + " 的设备!");
                return;
            }

            if (_motion != prim)
            {
                _motion = (IMotionCard)prim;
            }

            tmrUpdateAxis.Start();
        }
コード例 #8
0
        private void btnRun_Click(object sender, EventArgs e)
        {
            IPrim prim = DevPrimsManager.Instance.GetPrimByName(_di.Driver);

            if (prim == null)
            {
                MessageBox.Show("没有找到名称为: " + _di.Driver + " 的设备!");
                return;
            }

            if (_motion != prim)
            {
                _motion = (IMotionCard)prim;
            }

            btnRun.BackColor = Color.Green;
            tmrUpdateCylinder.Start();
        }
コード例 #9
0
 public void UpdateEleStatus(IMotionCard motion)
 {
     if (motion != null)
     {
         var org  = 0;
         var work = 0;
         motion.ReadSingleDInput(motion.DevIndex, 0, CurEle.DiOrg, out org);
         motion.ReadSingleDInput(motion.DevIndex, 0, CurEle.DiWork, out work);
         if (org == 1 && work == 0)
         {
             tBoxName.BackColor = Color.LightGray;
         }
         else if (org == 0 && work == 1)
         {
             tBoxName.BackColor = Color.Lime;
         }
         else
         {
             tBoxName.BackColor = Color.Red;
         }
     }
 }
コード例 #10
0
ファイル: IOCardWrapper.cs プロジェクト: xusongfei/LeadChina
 public IOCardWrapper(IMotionCard motion)
 {
     Index   = _motion.DevIndex;
     _motion = motion;
 }