Ejemplo n.º 1
0
        /// <summary>
        /// 初始化串口
        /// </summary>
        public void DoInit()
        {
            try {
                if (LightCtrlParaItems == null)
                {
                    return;
                }
                foreach (LightCrlParaItem item in LightCtrlParaItems)
                {
                    LightCtrlBase LightCtrl;
                    switch (item.LightCtrlType)
                    {
                    case LightCtrlTypeEnum.WordP:
                        LightCtrl = new LightCtrlWordp();
                        break;

                    case LightCtrlTypeEnum.MengT:
                        LightCtrl = new LightCtrlMT();
                        break;

                    default:
                        LightCtrl = new LightCtrlBase();
                        break;
                    }
                    LightCtrl.SetPara(item);
                    LightCtrl.DoInit();
                    item.Tag = LightCtrl;
                    LightCtrls.Add(item.LightCtrlName, LightCtrl);
                }
            }
            catch (Exception ex) {
                throw ex;
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// 关闭串口
        /// </summary>
        public void DoStop()
        {
            IDictionaryEnumerator enumerator = this.LightCtrls.GetEnumerator();

            while (enumerator.MoveNext())
            {
                LightCtrlBase lightCtrl = enumerator.Value as LightCtrlBase;
                lightCtrl.DoStop();
            }
        }
Ejemplo n.º 3
0
        /// <summary>
        /// 把光源控制器的
        /// </summary>
        /// <returns></returns>
        public bool SetAllLightTo0()
        {
            IDictionaryEnumerator enumerator = this.LightCtrls.GetEnumerator();

            while (enumerator.MoveNext())
            {
                LightCtrlBase lightCtrl = enumerator.Value as LightCtrlBase;
                if (lightCtrl.lightCtrlParaItem.IsConnect)
                {
                    foreach (LightPanelEnum item in lightCtrl.Panels)
                    {
                        lightCtrl.SetLightValue((int)item, 0);
                    }
                }
            }
            return(true);
        }
Ejemplo n.º 4
0
        public bool SetLightValue(LightPara LightParaIn)
        {
            IDictionaryEnumerator enumerator = this.LightCtrls.GetEnumerator();

            if (LightParaIn == null)
            {
                return(false);
            }
            while (enumerator.MoveNext())
            {
                LightCtrlBase lightCtrl = enumerator.Value as LightCtrlBase;
                if (lightCtrl.lightCtrlParaItem.LightCtrlName == LightParaIn.LightCtrl)
                {
                    lightCtrl.SetLightValue((int)LightParaIn.Panel, LightParaIn.LightValue);
                }
            }
            return(true);
        }