public object Clone() { ExecutePrmOPT prm = new ExecutePrmOPT(); foreach (var item in this.ListCls) { ItensityClass itensity = (ItensityClass)item.Clone(); prm.ListCls.Add(itensity); } return(prm); }
public void SetLight(ExecutePrm executePrm) { if (CurPrm == null) { this.lastPrm = (ExecutePrmOPT)executePrm.PrmOPT.Clone(); } else { this.lastPrm = this.CurPrm.Clone() as ExecutePrmOPT; } this.CurPrm = (ExecutePrmOPT)executePrm.PrmOPT.Clone(); this.setLight(this.CurPrm); return; }
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; } }