Ejemplo n.º 1
0
        private void SetControlSystem()
        {
            if (selectedDevice != null)
            {
                KeyCommand.Enabled   = selectedDevice.HasCapability(KeyControl.KeyCode);
                InputCommand.Enabled = selectedDevice.HasCapability(ExternalInputControl.PickerLaunch);
                CanMute = selectedDevice.HasCapability(VolumeControl.MuteSet);

                PlayInputCommand.Enabled        = selectedDevice.HasCapability(MediaControl.Play);
                PauseInputCommand.Enabled       = selectedDevice.HasCapability(MediaControl.Pause);
                StopInputCommand.Enabled        = selectedDevice.HasCapability(MediaControl.Stop);
                FastForwardInputCommand.Enabled = selectedDevice.HasCapability(MediaControl.FastForward);
                RewindInputCommand.Enabled      = selectedDevice.HasCapability(MediaControl.Rewind);
                VolumeUpCommand.Enabled         = selectedDevice.HasCapability(VolumeControl.VolumeUpDown);
                VolumeDownCommand.Enabled       = selectedDevice.HasCapability(VolumeControl.VolumeUpDown);

                var muteListener = new ResponseListener
                                   (
                    loadEventArg =>
                {
                    var vm = LoadEventArgs.GetValueBool(loadEventArg);
                    App.MainDispatcher.RunAsync(CoreDispatcherPriority.High, () =>
                    {
                        IsMuted = vm;
                    });
                },
                    serviceCommandError =>
                {
                }
                                   );

                var externalInputListener = new ResponseListener
                                            (
                    loadEventArg =>
                {
                    var inputs    = LoadEventArgs.GetValue <JsonArray>(loadEventArg);
                    var inputList = new List <ExternalInputInfo>();

                    foreach (var input in inputs)
                    {
                        var ei = ExternalInputInfo.FromJson(input.Stringify());
                        inputList.Add(ei);
                    }

                    App.MainDispatcher.RunAsync(CoreDispatcherPriority.High, () =>
                    {
                        ExternalInputs = inputList;
                    });
                },
                    serviceCommandError =>
                {
                }
                                            );

                if (selectedDevice.HasCapability(VolumeControl.MuteSubscribe))
                {
                    volumeControl.SubscribeMute(muteListener);
                }

                if (selectedDevice.HasCapability(ExternalInputControl.List))
                {
                    externalInputControl.GetExternalInputList(externalInputListener);
                }
            }
        }
Ejemplo n.º 2
0
 private void SetExternalInput(ExternalInputInfo externalInputInfo)
 {
     externalInputControl.SetExternalInput(externalInputInfo, null);
 }