private void modeConsumer_SupportedModesChanged(modeConsumer consumer, object value) { if (value is string) { this.SupportedModes = (string)value; } }
private async void modeWatcher_Added(modeWatcher watcher, AllJoynServiceInfo args) { if (_modeConsumer == null && args.ObjectPath.Contains(_expectedBusObjectPath)) { var joinSessionResult = await modeConsumer.JoinSessionAsync(args, watcher); if (joinSessionResult.Status == AllJoynStatus.Ok) { _modeConsumer = joinSessionResult.Consumer; _modeConsumer.SessionLost += this.Consumer_SessionLost; // subscribe to value changes _modeConsumer.ModesChanged += this.modeConsumer_ModesChanged; _modeConsumer.SupportedModesChanged += this.modeConsumer_SupportedModesChanged; // populate initial values var modesResult = await _modeConsumer.GetModesAsync(); if (modesResult.Status != AllJoynStatus.Ok) { return; } this.Modes = modesResult.Modes; var supportedModesResult = await _modeConsumer.GetSupportedModesAsync(); if (supportedModesResult.Status != AllJoynStatus.Ok) { return; } this.SupportedModes = supportedModesResult.SupportedModes; this.IsConnected = true; } } }