Exemple #1
0
 public TvControlMetadata(ITvControl control, Guid componentId)
 {
     Control   = control;
     IsFocused = false;
     CanFocus  = true;
     ControlId = componentId;
 }
        public static void Add(this IComponentTree componentTree, ITvControl control)
        {
            var metadata = componentTree.Add(control.AsComponent());
            var ctree    = componentTree.RootControls() as ControlsTree;

            ctree.Add(control.Metadata);
        }
        public static void InsertAfter(this IComponentTree componentTree, ITvControl control, int position)
        {
            var metadata = componentTree.Add(control.AsComponent());
            var ctree    = componentTree.RootControls() as ControlsTree;

            ctree.InsertAfter(control.Metadata, position);
        }
        public static bool Remove(this IComponentTree componentTree, ITvControl control)
        {
            var removed = componentTree.Remove(control.AsComponent());

            if (removed)
            {
                var ctree = componentTree.RootControls() as ControlsTree;
                ctree.Remove(control.Metadata);
            }

            return(removed);
        }
        public void SetControls()
        {
            if (selectedDevice == null)
            {
                launcher             = null;
                mediaPlayer          = null;
                mediaControl         = null;
                tvControl            = null;
                volumeControl        = null;
                toastControl         = null;
                textInputControl     = null;
                mouseControl         = null;
                externalInputControl = null;
                powerControl         = null;
                keyControl           = null;
                playListControl      = null;
                webAppLauncher       = null;
            }
            else
            {
                launcher             = selectedDevice.GetCapability <ILauncher>();
                mediaPlayer          = selectedDevice.GetCapability <IMediaPlayer>();
                mediaControl         = selectedDevice.GetCapability <IMediaControl>();
                tvControl            = selectedDevice.GetCapability <ITvControl>();
                volumeControl        = selectedDevice.GetCapability <IVolumeControl>();
                toastControl         = selectedDevice.GetCapability <IToastControl>();
                textInputControl     = selectedDevice.GetCapability <ITextInputControl>();
                mouseControl         = selectedDevice.GetCapability <IMouseControl>();
                externalInputControl = selectedDevice.GetCapability <IExternalInputControl>();
                powerControl         = selectedDevice.GetCapability <IPowerControl>();
                keyControl           = selectedDevice.GetCapability <IKeyControl>();
                playListControl      = selectedDevice.GetCapability <IPlayListControl>();
                webAppLauncher       = selectedDevice.GetCapability <IWebAppLauncher>();
            }

            SetControlsMedia();
            SetWebAppControls();
            SetControlControls();
            SetControlApps();
            SetControlKeys();
            SetControlSystem();
        }
        public void SetControls()
        {
            if (selectedDevice == null)
            {
                launcher = null;
                mediaPlayer = null;
                mediaControl = null;
                tvControl = null;
                volumeControl = null;
                toastControl = null;
                textInputControl = null;
                mouseControl = null;
                externalInputControl = null;
                powerControl = null;
                keyControl = null;
                playListControl = null;
                webAppLauncher = null;
            }
            else
            {
                launcher = selectedDevice.GetCapability<ILauncher>();
                mediaPlayer = selectedDevice.GetCapability<IMediaPlayer>();
                mediaControl = selectedDevice.GetCapability<IMediaControl>();
                tvControl = selectedDevice.GetCapability<ITvControl>();
                volumeControl = selectedDevice.GetCapability<IVolumeControl>();
                toastControl = selectedDevice.GetCapability<IToastControl>();
                textInputControl = selectedDevice.GetCapability<ITextInputControl>();
                mouseControl = selectedDevice.GetCapability<IMouseControl>();
                externalInputControl = selectedDevice.GetCapability<IExternalInputControl>();
                powerControl = selectedDevice.GetCapability<IPowerControl>();
                keyControl = selectedDevice.GetCapability<IKeyControl>();
                playListControl = selectedDevice.GetCapability<IPlayListControl>();
                webAppLauncher = selectedDevice.GetCapability<IWebAppLauncher>();
            }

            SetControlsMedia();
            SetWebAppControls();
            SetControlControls();
            SetControlApps();
            SetControlKeys();
            SetControlSystem();
        }
 public static IStyle GetControlStyle(this ISkin skin, ITvControl control) => skin[control.ControlType];