Пример #1
0
        protected override void RunContinuously(object sender, System.ComponentModel.DoWorkEventArgs e)
        {
            //play rain here
            RainPlayer.PlayLooping();
            while (mContinueThread)
            {
                Color weather = GetWeather(ColorUtils.RandomSeededGenerator.Next(0, mLightState.Lights.Count - 1));
                foreach (Light light in mLightState.Lights)
                {
                    light.Color = weather;
                }
                mLightState.Update();
                System.Threading.Thread.Sleep(RAIN_TIME);

                if (weather == Color.White) //Lightning has struck
                {
                    ThunderPlayer.Play();
                    Thread.Sleep(LIGHTNING_TIME);
                }
            }
        }
Пример #2
0
 protected override void OnMainThreadStopped(object sender, System.ComponentModel.RunWorkerCompletedEventArgs e)
 {
     RainPlayer.Stop();
     base.OnMainThreadStopped(sender, e);
 }