@@ -84,7 +84,7 @@ public ICommand? ChangeHotkey
84
84
nameof ( Type ) ,
85
85
typeof ( HotkeyType ) ,
86
86
typeof ( HotkeyControl ) ,
87
- new FrameworkPropertyMetadata ( HotkeyType . Hotkey , FrameworkPropertyMetadataOptions . BindsTwoWayByDefault , OnHotkeyChanged )
87
+ new FrameworkPropertyMetadata ( HotkeyType . None , FrameworkPropertyMetadataOptions . BindsTwoWayByDefault , OnHotkeyChanged )
88
88
) ;
89
89
90
90
public HotkeyType Type
@@ -95,6 +95,9 @@ public HotkeyType Type
95
95
96
96
public enum HotkeyType
97
97
{
98
+ // Custom hotkeys
99
+ None , // Used for getting hotkey from dialog result
100
+ // Settings hotkeys
98
101
Hotkey ,
99
102
PreviewHotkey ,
100
103
OpenContextMenuHotkey ,
@@ -115,12 +118,16 @@ public enum HotkeyType
115
118
// and it will not construct settings instances twice
116
119
private static readonly Settings _settings = Ioc . Default . GetRequiredService < Settings > ( ) ;
117
120
121
+ private string hotkey = string . Empty ;
118
122
public string Hotkey
119
123
{
120
124
get
121
125
{
122
126
return Type switch
123
127
{
128
+ // Custom hotkeys
129
+ HotkeyType . None => hotkey ,
130
+ // Settings hotkeys
124
131
HotkeyType . Hotkey => _settings . Hotkey ,
125
132
HotkeyType . PreviewHotkey => _settings . PreviewHotkey ,
126
133
HotkeyType . OpenContextMenuHotkey => _settings . OpenContextMenuHotkey ,
@@ -135,13 +142,18 @@ public string Hotkey
135
142
HotkeyType . SelectPrevItemHotkey2 => _settings . SelectPrevItemHotkey2 ,
136
143
HotkeyType . SelectNextItemHotkey => _settings . SelectNextItemHotkey ,
137
144
HotkeyType . SelectNextItemHotkey2 => _settings . SelectNextItemHotkey2 ,
138
- _ => string . Empty
145
+ _ => throw new System . NotImplementedException ( "Hotkey type not setted" )
139
146
} ;
140
147
}
141
148
set
142
149
{
143
150
switch ( Type )
144
151
{
152
+ // Custom hotkeys
153
+ case HotkeyType . None :
154
+ hotkey = value ;
155
+ break ;
156
+ // Settings hotkeys
145
157
case HotkeyType . Hotkey :
146
158
_settings . Hotkey = value ;
147
159
break ;
@@ -185,7 +197,7 @@ public string Hotkey
185
197
_settings . SelectNextItemHotkey2 = value ;
186
198
break ;
187
199
default :
188
- return ;
200
+ throw new System . NotImplementedException ( "Hotkey type not setted" ) ;
189
201
}
190
202
191
203
// After setting the hotkey, we need to refresh the interface
0 commit comments