internal StaticUpdateHandler(ApplicationState state) { _state = state; _commander = new ArduinoCommand(); _commander.UpdateColorValue(ArduinoCommand.Colors.Red, _state.Red); _commander.UpdateColorValue(ArduinoCommand.Colors.Green, _state.Green); _commander.UpdateColorValue(ArduinoCommand.Colors.Blue, _state.Blue); _state.PropertyChanged += new System.ComponentModel.PropertyChangedEventHandler(state_PropertyChanged); }
internal RandomUpdateHandler(ApplicationState state) { _state = state; _commander = new ArduinoCommand(); _commander.UpdateColorValue(ArduinoCommand.Colors.Red, _state.Red); _commander.UpdateColorValue(ArduinoCommand.Colors.Green, _state.Green); _commander.UpdateColorValue(ArduinoCommand.Colors.Blue, _state.Blue); _dispatcherTimer = new System.Windows.Threading.DispatcherTimer(); _dispatcherTimer.Tick += new EventHandler(dispatcherTimer_Tick); _dispatcherTimer.Interval = new TimeSpan(0, 0, 0, 0, 50); _dispatcherTimer.Start(); _targetRed = _rand.Next(0, 256); _targetBlue = _rand.Next(0, 256); _targetGreen = _rand.Next(0, 256); }