コード例 #1
0
        private ExecutePrmOPT AddChanel(LightChn chn, int value)
        {
            ItensityClass itensity;

            itensity = FindChn(chn);
            //存在就修改
            if (itensity != null)
            {
                itensity.On    = true;
                itensity.Value = value;
            }
            //不存在
            else
            {
                int chnInt = LightingOPT.SwitchChannel(chn);
                itensity = new ItensityClass()
                {
                    Chanel = (Chanels)chnInt,
                    On     = true,
                    Value  = value
                };
                this.ListCls.Add(itensity);
            }
            return(this);
        }
コード例 #2
0
        public object Clone()
        {
            ExecutePrmOPT prm = new ExecutePrmOPT();

            foreach (var item in this.ListCls)
            {
                ItensityClass itensity = (ItensityClass)item.Clone();
                prm.ListCls.Add(itensity);
            }
            return(prm);
        }
コード例 #3
0
        private void setLight(ExecutePrmOPT prmOPT)
        {
            if (prmOPT == null)
            {
                return;
            }
            int len = prmOPT.ListCls.Count;

            int[]       chaneelArray   = new int[len];
            Intensity[] intensityArray = new Intensity[len];
            for (int i = 0; i < len; i++)
            {
                ItensityClass itenstityCls = prmOPT.ListCls[i];
                if (itenstityCls.On)
                {
                    chaneelArray[i]   = (int)itenstityCls.Chanel;
                    intensityArray[i] = new Intensity {
                        channel = (int)itenstityCls.Chanel, intensity = itenstityCls.Value
                    };
                }
            }
            try
            {
                //打开多通道
                this.TurnOnMultiChannel(chaneelArray, len);
                //设置亮度
                foreach (Intensity item in intensityArray)
                {
                    ItensityClass lastItensity;
                    if (item.channel == (int)Chanels.Chanel1)
                    {
                        lastItensity = this.lastPrm.FindChn((int)Chanels.Chanel1);
                        if (lastItensity != null)
                        {
                            if (item.intensity != lastItensity.Value)
                            {
                                this.SetIntensity((int)Chanels.Chanel1, item.intensity);
                            }
                        }
                    }
                    else if (item.channel == (int)Chanels.Chanel2)
                    {
                        lastItensity = this.lastPrm.FindChn((int)Chanels.Chanel2);
                        if (lastItensity != null)
                        {
                            if (item.intensity != lastItensity.Value)
                            {
                                this.SetIntensity((int)Chanels.Chanel2, item.intensity);
                            }
                        }
                    }
                    else if (item.channel == (int)Chanels.Chanel3)
                    {
                        lastItensity = this.lastPrm.FindChn((int)Chanels.Chanel3);
                        if (lastItensity != null)
                        {
                            if (item.intensity != lastItensity.Value)
                            {
                                this.SetIntensity((int)Chanels.Chanel3, item.intensity);
                            }
                        }
                    }
                }
                //SetMultiIntensity(intensityArray, len);
                return;
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
                return;
            }
        }