private void airflowConsumer_RangeChanged(airflowConsumer consumer, object value) { if (value is string) { this.AirflowRange = (string)value; } }
private void airflowConsumer_SpeedChanged(airflowConsumer consumer, object value) { if (value is Int64) { this.AirflowSpeed = (Int64)value; } }
private void airflowConsumer_DirectionChanged(airflowConsumer consumer, object value) { if (value is string) { this.AirflowDirection = (string)value; } }
private async void airflowWatcher_Added(airflowWatcher watcher, AllJoynServiceInfo args) { if (_airflowConsumer == null && args.ObjectPath.Contains(_expectedBusObjectPath)) { var joinSessionResult = await airflowConsumer.JoinSessionAsync(args, watcher); if (joinSessionResult.Status == AllJoynStatus.Ok) { _airflowConsumer = joinSessionResult.Consumer; _airflowConsumer.SessionLost += Consumer_SessionLost; // subscribe to value changes _airflowConsumer.DirectionChanged += this.airflowConsumer_DirectionChanged; _airflowConsumer.RangeChanged += this.airflowConsumer_RangeChanged; _airflowConsumer.SpeedChanged += this.airflowConsumer_SpeedChanged; // populate initial values var directionResult = await _airflowConsumer.GetDirectionAsync(); if (directionResult.Status != AllJoynStatus.Ok) { return; } this.AirflowDirection = directionResult.Direction; var rangeResult = await _airflowConsumer.GetRangeAsync(); if (rangeResult.Status != AllJoynStatus.Ok) { return; } this.AirflowDirection = rangeResult.Range; var speedResult = await _airflowConsumer.GetSpeedAsync(); if (speedResult.Status != AllJoynStatus.Ok) { return; } this.AirflowSpeed = speedResult.Speed; this.IsConnected = true; } } }