Defines extension methods for various types of Key/ModifierKey enumerations.
More...
|
static Key | ToKey (this ModifierKeys modifierKey, bool useLeftSideKey=true) |
| Gets the Key associated with this ModifierKeys value. More...
|
|
static IEnumerable< Key > | ToKeys (this ModifierKeys modifierKeys, bool useLeftSideKey=true) |
| Gets the Key values associated with this ModifierKeys value. More...
|
|
static EModifierKey | SetFlagState (this EModifierKey m, EModifierKey flag, bool state) |
| Sets or unsets the bit specified by flag in ref m . More...
|
|
static string | GetStringRepresentation (this EModifierKey m, bool insertSpaces=false, char separator='+', bool includeNone=false) |
| Gets the string representation of the EModifierKey specified by m . More...
|
|
Defines extension methods for various types of Key/ModifierKey enumerations.
◆ GetStringRepresentation()
static string VolumeControl.Core.Extensions.KeyExtensions.GetStringRepresentation |
( |
this EModifierKey |
m, |
|
|
bool |
insertSpaces = false , |
|
|
char |
separator = '+' , |
|
|
bool |
includeNone = false |
|
) |
| |
|
static |
Gets the string representation of the EModifierKey specified by m .
- Parameters
-
m | EModifierKey |
insertSpaces | When true , inserts spaces between the enum names & the separator characters. |
separator | The separator character to use between enum names. |
includeNone | When the modifier key is EModifierKey.None and this is true , the returned string is "None"; otherwise, returns a blank string. |
- Returns
- The string representation of m in the form "Shift+Ctrl+Alt".
◆ SetFlagState()
Sets or unsets the bit specified by flag in ref
m .
- Parameters
-
m | EModifierKey |
flag | The modifier to add/remove. |
state | When true , flag is set to 1; when false , flag is set to 0. |
- Returns
- The resulting EModifierKey.
◆ ToKey()
static Key VolumeControl.Core.Extensions.KeyExtensions.ToKey |
( |
this ModifierKeys |
modifierKey, |
|
|
bool |
useLeftSideKey = true |
|
) |
| |
|
static |
Gets the Key associated with this ModifierKeys value.
The modifier key value must contain exactly one flag value or an InvalidOperationException will be thrown.
- Parameters
-
modifierKey | (implicit) The enum value to operate on. |
useLeftSideKey | When true , the left-side variants of the key are returned; otherwise, the right-side variants are returned. |
- Returns
- The Key value representing the ModifierKeys value.
- Exceptions
-
InvalidEnumArgumentException | The specified modifierKey was not a valid value for the ModifierKeys enumeration. |
InvalidOperationException | The specified modifierKey was not a single flag value from the ModifierKeys enumeration. |
◆ ToKeys()
static IEnumerable<Key> VolumeControl.Core.Extensions.KeyExtensions.ToKeys |
( |
this ModifierKeys |
modifierKeys, |
|
|
bool |
useLeftSideKey = true |
|
) |
| |
|
static |
Gets the Key values associated with this ModifierKeys value.
Unlike the ToKey method, this can accept ModifierKeys values that have more than one flag set.
- Parameters
-
modifierKeys | (implicit) The enum value to operate on. |
useLeftSideKey | When true , the left-side variants of the key are returned; otherwise, the right-side variants are returned. |
- Returns
- The Key values representing all of the flags that were set in the ModifierKeys value.
The documentation for this class was generated from the following file:
- /home/runner/work/volume-control/volume-control/VolumeControl.Core/Extensions/KeyExtensions.cs