@@ -84,7 +84,7 @@ public ICommand? ChangeHotkey
8484 nameof ( Type ) ,
8585 typeof ( HotkeyType ) ,
8686 typeof ( HotkeyControl ) ,
87- new FrameworkPropertyMetadata ( HotkeyType . Hotkey , FrameworkPropertyMetadataOptions . BindsTwoWayByDefault , OnHotkeyChanged )
87+ new FrameworkPropertyMetadata ( HotkeyType . None , FrameworkPropertyMetadataOptions . BindsTwoWayByDefault , OnHotkeyChanged )
8888 ) ;
8989
9090 public HotkeyType Type
@@ -95,6 +95,9 @@ public HotkeyType Type
9595
9696 public enum HotkeyType
9797 {
98+ // Custom hotkeys
99+ None , // Used for getting hotkey from dialog result
100+ // Settings hotkeys
98101 Hotkey ,
99102 PreviewHotkey ,
100103 OpenContextMenuHotkey ,
@@ -115,12 +118,16 @@ public enum HotkeyType
115118 // and it will not construct settings instances twice
116119 private static readonly Settings _settings = Ioc . Default . GetRequiredService < Settings > ( ) ;
117120
121+ private string hotkey = string . Empty ;
118122 public string Hotkey
119123 {
120124 get
121125 {
122126 return Type switch
123127 {
128+ // Custom hotkeys
129+ HotkeyType . None => hotkey ,
130+ // Settings hotkeys
124131 HotkeyType . Hotkey => _settings . Hotkey ,
125132 HotkeyType . PreviewHotkey => _settings . PreviewHotkey ,
126133 HotkeyType . OpenContextMenuHotkey => _settings . OpenContextMenuHotkey ,
@@ -135,13 +142,18 @@ public string Hotkey
135142 HotkeyType . SelectPrevItemHotkey2 => _settings . SelectPrevItemHotkey2 ,
136143 HotkeyType . SelectNextItemHotkey => _settings . SelectNextItemHotkey ,
137144 HotkeyType . SelectNextItemHotkey2 => _settings . SelectNextItemHotkey2 ,
138- _ => string . Empty
145+ _ => throw new System . NotImplementedException ( "Hotkey type not setted" )
139146 } ;
140147 }
141148 set
142149 {
143150 switch ( Type )
144151 {
152+ // Custom hotkeys
153+ case HotkeyType . None :
154+ hotkey = value ;
155+ break ;
156+ // Settings hotkeys
145157 case HotkeyType . Hotkey :
146158 _settings . Hotkey = value ;
147159 break ;
@@ -185,7 +197,7 @@ public string Hotkey
185197 _settings . SelectNextItemHotkey2 = value ;
186198 break ;
187199 default :
188- return ;
200+ throw new System . NotImplementedException ( "Hotkey type not setted" ) ;
189201 }
190202
191203 // After setting the hotkey, we need to refresh the interface
0 commit comments