Exemplo n.º 1
0
 public static IObservable <bool> IsHovering(this Hittable control)
 {
     return(Observable
            .Merge(
                control.Entered.Select(_ => true),
                control.Exited.Select(_ => false))
            .StartWith(false));
 }
Exemplo n.º 2
0
 public static IObservable <bool> IsPressed(this Hittable control)
 {
     return(Observable
            .Merge(
                control.Pressed.Select(_ => true),
                control.Released.Select(_ => false),
                control.LostFocus.Select(_ => false))
            .StartWith(false));
 }
Exemplo n.º 3
0
        public static Hittable OnMouse(
            this Hittable hittable,
            Optional <Command> pressed       = default(Optional <Command>),
            Optional <Command> released      = default(Optional <Command>),
            Optional <Command> doubleClicked = default(Optional <Command>),
            Optional <Command> entered       = default(Optional <Command>),
            Optional <Command> exited        = default(Optional <Command>))
        {
            ExecCommandWhileRooted(hittable.Pressed, pressed, hittable.Control);
            ExecCommandWhileRooted(hittable.Released, released, hittable.Control);
            ExecCommandWhileRooted(hittable.DoubleClicked, doubleClicked, hittable.Control);
            ExecCommandWhileRooted(hittable.Entered, entered, hittable.Control);
            ExecCommandWhileRooted(hittable.Exited, exited, hittable.Control);

            return(hittable);
        }