protected virtual void OnSineThreadFired(object sender, DoWorkEventArgs e) { double time = 0; while (mContinueSine) { double sineVal = AmpSinePresenter.PowerSine(time, 0); int red = (int)((mView.Color2.R - mView.Color1.R) * sineVal + mView.Color1.R); int green = (int)((mView.Color2.G - mView.Color1.G) * sineVal + mView.Color1.G); int blue = (int)((mView.Color2.B - mView.Color1.B) * sineVal + mView.Color1.B); foreach (Light light in mLightState.Lights) { light.Red = red; light.Green = green; light.Blue = blue; } mLightState.Update(); System.Threading.Thread.Sleep(100 - mSpeed); time++; } }
protected void OnSineFired(List<int> value) { LightGroup group = new LightGroup( GetLightViewPresentersFromIndices(value), mLightState); SineControl sineCtrl = new SineControl(); AmpSinePresenter pres = new AmpSinePresenter(sineCtrl, mLightState, group); mSineControls.Add(sineCtrl); sineCtrl.Start(); }