@@ -19,7 +19,7 @@ public class NumberTransferAction : NumberFunctionAction
19
19
{
20
20
protected override async Task OnWillAppear ( ActionEventArgs < AppearancePayload > args )
21
21
{
22
- if ( DeckLogic . NumpadParams . Type == "XPDR" )
22
+ if ( DeckLogic . NumpadParams ? . Type == "XPDR" )
23
23
{
24
24
await SetTitleAsync ( "VFR" ) ;
25
25
}
@@ -36,49 +36,51 @@ public class NumberFunctionAction : StreamDeckAction
36
36
{
37
37
protected override async Task OnKeyDown ( ActionEventArgs < KeyPayload > args )
38
38
{
39
- var param = new RegistrationParameters ( Environment . GetCommandLineArgs ( ) [ 1 ..] ) ;
40
- switch ( args . Action )
39
+ if ( DeckLogic . NumpadParams != null )
41
40
{
42
- case "tech.flighttracker.streamdeck.number.enter" :
43
- if ( DeckLogic . NumpadTcs != null )
44
- {
45
- DeckLogic . NumpadTcs . SetResult ( ( DeckLogic . NumpadParams . Value , false ) ) ;
46
- }
47
- await StreamDeck . SwitchToProfileAsync ( param . PluginUUID , args . Device , null ) ;
48
- break ;
49
- case "tech.flighttracker.streamdeck.number.cancel" :
50
- if ( DeckLogic . NumpadTcs != null )
51
- {
52
- DeckLogic . NumpadTcs . SetResult ( ( null , false ) ) ;
53
- }
54
- await StreamDeck . SwitchToProfileAsync ( param . PluginUUID , args . Device , null ) ;
55
- break ;
56
- case "tech.flighttracker.streamdeck.number.transfer" :
57
- if ( DeckLogic . NumpadParams . Type == "XPDR" )
58
- {
59
- DeckLogic . NumpadParams . Value = "1200" ;
41
+ var param = new RegistrationParameters ( Environment . GetCommandLineArgs ( ) [ 1 ..] ) ;
42
+ switch ( args . Action )
43
+ {
44
+ case "tech.flighttracker.streamdeck.number.enter" :
60
45
if ( DeckLogic . NumpadTcs != null )
61
46
{
62
47
DeckLogic . NumpadTcs . SetResult ( ( DeckLogic . NumpadParams . Value , false ) ) ;
63
48
}
64
- }
65
- else
66
- {
49
+ await StreamDeck . SwitchToProfileAsync ( param . PluginUUID , args . Device , null ) ;
50
+ break ;
51
+ case "tech.flighttracker.streamdeck.number.cancel" :
67
52
if ( DeckLogic . NumpadTcs != null )
68
53
{
69
- DeckLogic . NumpadTcs . SetResult ( ( DeckLogic . NumpadParams . Value , true ) ) ;
54
+ DeckLogic . NumpadTcs . SetResult ( ( null , false ) ) ;
70
55
}
71
- }
72
- await StreamDeck . SwitchToProfileAsync ( param . PluginUUID , args . Device , null ) ;
73
- break ;
74
- case "tech.flighttracker.streamdeck.number.backspace" :
75
- if ( DeckLogic . NumpadParams . Value . Length > 0 )
76
- {
77
- DeckLogic . NumpadParams . Value = DeckLogic . NumpadParams . Value [ ..^ 1 ] ;
78
- }
79
- break ;
56
+ await StreamDeck . SwitchToProfileAsync ( param . PluginUUID , args . Device , null ) ;
57
+ break ;
58
+ case "tech.flighttracker.streamdeck.number.transfer" :
59
+ if ( DeckLogic . NumpadParams . Type == "XPDR" )
60
+ {
61
+ DeckLogic . NumpadParams . Value = "1200" ;
62
+ if ( DeckLogic . NumpadTcs != null )
63
+ {
64
+ DeckLogic . NumpadTcs . SetResult ( ( DeckLogic . NumpadParams . Value , false ) ) ;
65
+ }
66
+ }
67
+ else
68
+ {
69
+ if ( DeckLogic . NumpadTcs != null )
70
+ {
71
+ DeckLogic . NumpadTcs . SetResult ( ( DeckLogic . NumpadParams . Value , true ) ) ;
72
+ }
73
+ }
74
+ await StreamDeck . SwitchToProfileAsync ( param . PluginUUID , args . Device , null ) ;
75
+ break ;
76
+ case "tech.flighttracker.streamdeck.number.backspace" :
77
+ if ( DeckLogic . NumpadParams . Value . Length > 0 )
78
+ {
79
+ DeckLogic . NumpadParams . Value = DeckLogic . NumpadParams . Value [ ..^ 1 ] ;
80
+ }
81
+ break ;
82
+ }
80
83
}
81
-
82
84
}
83
85
}
84
86
}
0 commit comments