コード例 #1
0
        private async void openlevelWatcher_Added(openlevelWatcher sender, AllJoynServiceInfo args)
        {
            var joinResult = await openlevelConsumer.JoinSessionAsync(args, sender);

            if (joinResult.Status == AllJoynStatus.Ok)
            {
                _openlevelConsumer              = joinResult.Consumer;
                _openlevelConsumer.SessionLost += this.Consumer_SessionLost;

                // subscribe to value changes
                _openlevelConsumer.OpenLevelChanged += this.openlevelConsumer_OpenLevelChanged;

                // populate initial values
                var valueResult = await _openlevelConsumer.GetOpenLevelAsync();

                if (valueResult.Status != AllJoynStatus.Ok)
                {
                    return;
                }
                this.OpenLevel = valueResult.OpenLevel;

                this.IsConnected = true;
            }
        }
コード例 #2
0
 protected override void OnStart()
 {
     _openlevelWatcher        = new openlevelWatcher(this.CreateBusAttachment(ref _openlevelBusAttachment));
     _openlevelWatcher.Added += this.openlevelWatcher_Added;
     _openlevelWatcher.Start();
 }