C# Class PowerArgs.Cli.FocusManager

A class that manages the focus of a CLI application
Inheritance: ObservableObject
Afficher le fichier Open project: adamabdelhamed/PowerArgs Class Usage Examples

Méthodes publiques

Méthode Description
Add ( ConsoleControl c ) : void

Adds the current control to the current focus context

ClearFocus ( ) : void

Clears the focus, but preserves the focus index

FocusManager ( ) : System

Initializes the focus manager

Pop ( ) : void

Pops the current focus context. This should be called if you've implemented a modal dialog like experience and your dialog has just closed. Pop() will automatically restore focus on the previous context.

Push ( ) : void

Pushes a new focus context onto the stack. This is useful, for example, when a dialog appears above all other controls and you want to limit focus to the dialog to acheive a modal affect. You must remember to call pop when your context ends.

Remove ( ConsoleControl c ) : void

Removes the control from all focus contexts

TryMoveFocus ( bool forward = true ) : bool

Tries to move the focus forward or backwards

TryRestoreFocus ( ) : bool

Tries to restore the focus on the given context

TrySetFocus ( ConsoleControl newFocusControl ) : bool

Tries to set focus on the given control.

Private Methods

Méthode Description
CycleFocusIndex ( bool forward ) : bool

Method Details

Add() public méthode

Adds the current control to the current focus context
public Add ( ConsoleControl c ) : void
c ConsoleControl The control to add
Résultat void

ClearFocus() public méthode

Clears the focus, but preserves the focus index
public ClearFocus ( ) : void
Résultat void

FocusManager() public méthode

Initializes the focus manager
public FocusManager ( ) : System
Résultat System

Pop() public méthode

Pops the current focus context. This should be called if you've implemented a modal dialog like experience and your dialog has just closed. Pop() will automatically restore focus on the previous context.
public Pop ( ) : void
Résultat void

Push() public méthode

Pushes a new focus context onto the stack. This is useful, for example, when a dialog appears above all other controls and you want to limit focus to the dialog to acheive a modal affect. You must remember to call pop when your context ends.
public Push ( ) : void
Résultat void

Remove() public méthode

Removes the control from all focus contexts
public Remove ( ConsoleControl c ) : void
c ConsoleControl The control to remove
Résultat void

TryMoveFocus() public méthode

Tries to move the focus forward or backwards
public TryMoveFocus ( bool forward = true ) : bool
forward bool If true then the manager will try to move forwards, otherwise backwards
Résultat bool

TryRestoreFocus() public méthode

Tries to restore the focus on the given context
public TryRestoreFocus ( ) : bool
Résultat bool

TrySetFocus() public méthode

Tries to set focus on the given control.
public TrySetFocus ( ConsoleControl newFocusControl ) : bool
newFocusControl ConsoleControl the control to focus.
Résultat bool