예제 #1
0
        public static TargetItemBinding <View, object> FocusChangeBinding(
            [NotNull] this IItemReference <View> viewReference,
            FocusDirection focusDirection,
            bool trackCanExecuteCommandChanged = false)
        {
            return(new TargetItemOneWayToSourceCustomBinding <View, object, View.FocusChangeEventArgs>(
                       viewReference,
                       (view, eventHandler) => view.NotNull().FocusChange += eventHandler,
                       (view, eventHandler) => view.NotNull().FocusChange -= eventHandler,
                       (view, canExecuteCommand) =>
            {
                if (trackCanExecuteCommandChanged)
                {
                    view.NotNull().Enabled = canExecuteCommand;
                }
            },
                       (view, eventArgs) =>
            {
                switch (focusDirection)
                {
                case FocusDirection.InOut:
                    return true;

                case FocusDirection.In:
                    return eventArgs.NotNull().HasFocus;

                case FocusDirection.Out:
                    return !eventArgs.NotNull().HasFocus;

                default:
                    return false;
                }
            },
                       () => "FocusChange"));
        }
        static void SetCustomFocus(EvasObject view, VisualElement next, FocusDirection direction)
        {
            var renderer = Platform.GetRenderer(next);

            if (renderer != null)
            {
                (view as Widget)?.SetNextFocusObject(renderer.NativeView, direction);
            }
        }
        public override void FocusMove(string VideoSource, FocusDirection Direction, [System.Xml.Serialization.XmlElementAttribute(DataType = "duration")] string Timeout)
        {
            ParametersValidation validation = new ParametersValidation();

            validation.Add(ParameterType.String, "VideoSource", VideoSource);
            validation.Add(ParameterType.OptionalString, "Timeout", Timeout);
            validation.Add(ParameterType.String, "Direction", Direction.ToString());
            ExecuteVoidCommand(validation, ProvisioningServiceTest.FocusMoveTest);
        }
예제 #4
0
        //////////////////////////////////////////////////////////////////////////////

        #region Focus

        private bool TryMoveFocus(KeyCode key)
        {
            FocusDirection direction = FindFocusDirection(key);

            if (direction != FocusDirection.None)
            {
                return(TryMoveFocus(direction));
            }
            return(false);
        }
 public void Focus(FocusDirection direction, FocusAmount amount)
 {
     try
     {
         SelectedCameraDevice.Focus(direction, amount);
         CaptureWithNoAf = true;
     }
     catch (Exception e)
     {
         Log.Error("Focus error", e);
     }
 }
예제 #6
0
    private void ReadInput()
    {
        focusDirection = FocusDirection.CENTER;

        if (Input.GetAxis("CameraLeftJoystick" + joystickIndex) > 0.25f)
        {
            focusDirection = FocusDirection.LEFT;
        }

        if (Input.GetAxis("CameraRightJoystick" + joystickIndex) > 0.25f)
        {
            focusDirection = FocusDirection.RIGHT;
        }
    }
        public static TargetItemBinding <View, object> FocusChangeBinding(
            this IItemReference <View> viewReference,
            FocusDirection focusDirection      = FocusDirection.InOut,
            bool trackCanExecuteCommandChanged = false)
        {
            if (viewReference == null)
            {
                throw new ArgumentNullException(nameof(viewReference));
            }

            return(new TargetItemOneWayToSourceCustomBinding <View, object, View.FocusChangeEventArgs>(
                       viewReference,
                       (view, handler) => view.FocusChange += handler,
                       (view, handler) => view.FocusChange -= handler,
                       (view, canExecuteCommand) =>
            {
                if (trackCanExecuteCommandChanged)
                {
                    view.Enabled = canExecuteCommand;
                }
            },
                       (view, args) => null,
                       (view, args) =>
            {
                switch (focusDirection)
                {
                case FocusDirection.InOut:
                    return true;

                case FocusDirection.In:
                    return args.HasFocus;

                case FocusDirection.Out:
                    return !args.HasFocus;

                default:
                    return false;
                }
            },
                       () => $"{nameof(View.FocusChange)}"));
        }
예제 #8
0
        public static TargetItemBinding <SearchView, object> QueryTextFocusChangeBinding(
            [NotNull] this IItemReference <SearchView> searchViewReference,
            FocusDirection focusDirection      = FocusDirection.InOut,
            bool trackCanExecuteCommandChanged = false)
        {
            if (searchViewReference == null)
            {
                throw new ArgumentNullException(nameof(searchViewReference));
            }

            return(new TargetItemOneWayToSourceCustomBinding <SearchView, object, View.FocusChangeEventArgs>(
                       searchViewReference,
                       (searchView, eventHandler) => searchView.NotNull().QueryTextFocusChange += eventHandler,
                       (searchView, eventHandler) => searchView.NotNull().QueryTextFocusChange -= eventHandler,
                       (searchView, canExecuteCommand) =>
            {
                if (trackCanExecuteCommandChanged)
                {
                    searchView.NotNull().Enabled = canExecuteCommand;
                }
            },
                       (searchView, eventArgs) => null,
                       (searchView, eventArgs) =>
            {
                switch (focusDirection)
                {
                case FocusDirection.InOut:
                    return true;

                case FocusDirection.In:
                    return eventArgs.NotNull().HasFocus;

                case FocusDirection.Out:
                    return !eventArgs.NotNull().HasFocus;

                default:
                    return false;
                }
            },
                       () => $"{nameof(SearchView.QueryTextFocusChange)}"));
        }
예제 #9
0
        private View FindFocusView(View root, View current, FocusDirection direction)
        {
            int index = root.IndexOf(current);

            Debug.Assert(index != -1);

            if (direction == FocusDirection.Down || direction == FocusDirection.Right)
            {
                for (int i = index + 1; i < root.ChildCount(); ++i)
                {
                    View child = root.ViewAt(i);
                    View view  = FindFocusView(child, direction);
                    if (view != null)
                    {
                        return(view);
                    }
                }
            }
            else if (direction == FocusDirection.Up || direction == FocusDirection.Left)
            {
                for (int i = index - 1; i >= 0; --i)
                {
                    View child = root.ViewAt(i);
                    View view  = FindFocusView(child, direction);
                    if (view != null)
                    {
                        return(view);
                    }
                }
            }

            View parent = root.Parent();

            if (parent != null)
            {
                return(FindFocusView(parent, root, direction));
            }

            return(null);
        }
예제 #10
0
        private View FindFocusView(View root, FocusDirection direction)
        {
            if (direction == FocusDirection.Down || direction == FocusDirection.Right)
            {
                for (int i = 0; i < root.ChildCount(); ++i)
                {
                    View child = root.ViewAt(i);
                    View view  = FindFocusView(child, direction);
                    if (view != null)
                    {
                        return(view);
                    }

                    if (child.CanFocus())
                    {
                        return(child);
                    }
                }
            }
            else if (direction == FocusDirection.Up || direction == FocusDirection.Left)
            {
                for (int i = root.ChildCount() - 1; i >= 0; --i)
                {
                    View child = root.ViewAt(i);
                    View view  = FindFocusView(child, direction);
                    if (view != null)
                    {
                        return(view);
                    }

                    if (child.CanFocus())
                    {
                        return(child);
                    }
                }
            }

            return(root.focusable ? root : null);
        }
예제 #11
0
        private bool TryMoveFocus(FocusDirection direction)
        {
            if (mFocusedView != null)
            {
                View parentView = mFocusedView.Parent();
                View view       = FindFocusView(parentView, mFocusedView, direction);
                if (view != null)
                {
                    return(FocusView(view));
                }
            }
            else
            {
                View view = FindFocusView(mRootView, direction);
                if (view != null)
                {
                    return(FocusView(view));
                }
            }

            return(false);
        }
예제 #12
0
 public abstract void FocusMove(string VideoSource, FocusDirection Direction, [System.Xml.Serialization.XmlElementAttribute(DataType = "duration")] string Timeout);
예제 #13
0
        private View FindFocusView(View root, FocusDirection direction)
        {
            if (direction == FocusDirection.Down || direction == FocusDirection.Right)
            {
                for (int i = 0; i < root.ChildCount(); ++i)
                {
                    View child = root.ViewAt(i);
                    View view = FindFocusView(child, direction);
                    if (view != null)
                    {
                        return view;
                    }

                    if (child.CanFocus())
                    {
                        return child;
                    }
                }
            }
            else if (direction == FocusDirection.Up || direction == FocusDirection.Left)
            {
                for (int i = root.ChildCount() - 1; i >= 0; --i)
                {
                    View child = root.ViewAt(i);
                    View view = FindFocusView(child, direction);
                    if (view != null)
                    {
                        return view;
                    }

                    if (child.CanFocus())
                    {
                        return child;
                    }
                }
            }

            return root.focusable ? root : null;
        }
예제 #14
0
        private View FindFocusView(View root, View current, FocusDirection direction)
        {
            int index = root.IndexOf(current);
            Debug.Assert(index != -1);

            if (direction == FocusDirection.Down || direction == FocusDirection.Right)
            {
                for (int i = index + 1; i < root.ChildCount(); ++i)
                {
                    View child = root.ViewAt(i);
                    View view = FindFocusView(child, direction);
                    if (view != null)
                    {
                        return view;
                    }
                }
            }
            else if (direction == FocusDirection.Up || direction == FocusDirection.Left)
            {
                for (int i = index - 1; i >= 0; --i)
                {
                    View child = root.ViewAt(i);
                    View view = FindFocusView(child, direction);
                    if (view != null)
                    {
                        return view;
                    }
                }
            }

            View parent = root.Parent();
            if (parent != null)
            {
                return FindFocusView(parent, root, direction);
            }

            return null;
        }
예제 #15
0
        private bool TryMoveFocus(FocusDirection direction)
        {
            if (mFocusedView != null)
            {
                View parentView = mFocusedView.Parent();
                View view = FindFocusView(parentView, mFocusedView, direction);
                if (view != null)
                {
                    return FocusView(view);
                }
            }
            else
            {
                View view = FindFocusView(mRootView, direction);
                if (view != null)
                {
                    return FocusView(view);
                }
            }

            return false;
        }
예제 #16
0
파일: Widget.cs 프로젝트: wiertel/TizenFX
 /// <summary>
 /// Gives focus to the next widget in the widget tree.
 /// </summary>
 /// <param name="direction">Direction to move the focus.</param>
 /// <since_tizen> preview </since_tizen>
 public void FocusNext(FocusDirection direction)
 {
     Interop.Elementary.elm_object_focus_next(RealHandle, (int)direction);
 }
예제 #17
0
 public virtual void Focus(FocusDirection direction, FocusAmount amount)
 {
     throw new NotImplementedException();
 }
예제 #18
0
파일: Widget.cs 프로젝트: wiertel/TizenFX
 /// <summary>
 /// Sets the next widget with specific focus direction.
 /// </summary>
 /// <param name="next">Focus next widget.</param>
 /// <param name="direction">Focus direction.</param>
 /// <since_tizen> preview </since_tizen>
 public void SetNextFocusObject(EvasObject next, FocusDirection direction)
 {
     Interop.Elementary.elm_object_focus_next_object_set(RealHandle, next?.RealHandle ?? IntPtr.Zero, (int)direction);
 }
 protected PlatformFocusEffect(FocusDirection direction)
 {
     _direction = direction;
 }