@@ -30,6 +30,26 @@ public static class QuickSwitch
3030
3131 public static QuickSwitchWindowPositions QuickSwitchWindowPosition { get ; private set ; }
3232
33+ public static QuickSwitchExplorerPair WindowsQuickSwitchExplorer { get ; } = new ( )
34+ {
35+ Metadata = new ( )
36+ {
37+ ID = "298b197c08a24e90ab66ac060ee2b6b8" , // ID is for calculating the hash id of the quick switch pairs
38+ Disabled = false // Disabled is for enabling the Windows QuickSwitch explorers & dialogs
39+ } ,
40+ Plugin = new WindowsExplorer ( )
41+ } ;
42+
43+ public static QuickSwitchDialogPair WindowsQuickSwitchDialog { get ; } = new ( )
44+ {
45+ Metadata = new ( )
46+ {
47+ ID = "a4a113dc51094077ab4abb391e866c7b" , // ID is for calculating the hash id of the quick switch pairs
48+ Disabled = false // Disabled is for enabling the Windows QuickSwitch explorers & dialogs
49+ } ,
50+ Plugin = new WindowsDialog ( )
51+ } ;
52+
3353 #endregion
3454
3555 #region Private Fields
@@ -40,18 +60,12 @@ public static class QuickSwitch
4060
4161 private static HWND _mainWindowHandle = HWND . Null ;
4262
43- private static readonly Dictionary < IQuickSwitchExplorer , IQuickSwitchExplorerWindow > _quickSwitchExplorers = new ( )
44- {
45- { new WindowsExplorer ( ) , null }
46- } ;
63+ private static readonly Dictionary < QuickSwitchExplorerPair , IQuickSwitchExplorerWindow > _quickSwitchExplorers = new ( ) ;
4764
48- private static IQuickSwitchExplorer _lastExplorer = null ;
65+ private static QuickSwitchExplorerPair _lastExplorer = null ;
4966 private static readonly object _lastExplorerLock = new ( ) ;
5067
51- private static readonly Dictionary < IQuickSwitchDialog , IQuickSwitchDialogWindow > _quickSwitchDialogs = new ( )
52- {
53- { new WindowsDialog ( ) , null }
54- } ;
68+ private static readonly Dictionary < QuickSwitchDialogPair , IQuickSwitchDialogWindow > _quickSwitchDialogs = new ( ) ;
5569
5670 private static IQuickSwitchDialogWindow _dialogWindow = null ;
5771 private static readonly object _dialogWindowLock = new ( ) ;
@@ -83,10 +97,23 @@ public static class QuickSwitch
8397
8498 #region Initialize & Setup
8599
86- public static void InitializeQuickSwitch ( )
100+ public static void InitializeQuickSwitch ( IList < QuickSwitchExplorerPair > quickSwitchExplorers ,
101+ IList < QuickSwitchDialogPair > quickSwitchDialogs )
87102 {
88103 if ( _initialized ) return ;
89104
105+ // Initialize quick switch explorers & dialogs
106+ _quickSwitchExplorers . Add ( WindowsQuickSwitchExplorer , null ) ;
107+ foreach ( var explorer in quickSwitchExplorers )
108+ {
109+ _quickSwitchExplorers . Add ( explorer , null ) ;
110+ }
111+ _quickSwitchDialogs . Add ( WindowsQuickSwitchDialog , null ) ;
112+ foreach ( var dialog in quickSwitchDialogs )
113+ {
114+ _quickSwitchDialogs . Add ( dialog , null ) ;
115+ }
116+
90117 // Initialize main window handle
91118 _mainWindowHandle = Win32Helper . GetMainWindowHandle ( ) ;
92119
@@ -242,7 +269,9 @@ private static bool RefreshLastExplorer()
242269 {
243270 foreach ( var explorer in _quickSwitchExplorers . Keys )
244271 {
245- var explorerWindow = explorer . CheckExplorerWindow ( hWnd ) ;
272+ if ( explorer . Metadata . Disabled ) continue ;
273+
274+ var explorerWindow = explorer . Plugin . CheckExplorerWindow ( hWnd ) ;
246275 if ( explorerWindow != null )
247276 {
248277 _quickSwitchExplorers [ explorer ] = explorerWindow ;
@@ -407,6 +436,8 @@ uint dwmsEventTime
407436 var dialogWindowChanged = false ;
408437 foreach ( var dialog in _quickSwitchDialogs . Keys )
409438 {
439+ if ( dialog . Metadata . Disabled ) continue ;
440+
410441 IQuickSwitchDialogWindow dialogWindow ;
411442 var existingDialogWindow = _quickSwitchDialogs [ dialog ] ;
412443 if ( existingDialogWindow != null && existingDialogWindow . Handle == hwnd )
@@ -416,7 +447,7 @@ uint dwmsEventTime
416447 }
417448 else
418449 {
419- dialogWindow = dialog . CheckDialogWindow ( hwnd ) ;
450+ dialogWindow = dialog . Plugin . CheckDialogWindow ( hwnd ) ;
420451 }
421452
422453 // If the dialog window is found, set it
@@ -496,7 +527,9 @@ uint dwmsEventTime
496527 {
497528 foreach ( var explorer in _quickSwitchExplorers . Keys )
498529 {
499- var explorerWindow = explorer . CheckExplorerWindow ( hwnd ) ;
530+ if ( explorer . Metadata . Disabled ) continue ;
531+
532+ var explorerWindow = explorer . Plugin . CheckExplorerWindow ( hwnd ) ;
500533 if ( explorerWindow != null )
501534 {
502535 Log . Debug ( ClassName , $ "Explorer window: { hwnd } ") ;
@@ -693,6 +726,8 @@ private static IQuickSwitchDialogWindow GetDialogWindow(HWND hwnd)
693726 // Finally search for the dialog window again
694727 foreach ( var dialog in _quickSwitchDialogs . Keys )
695728 {
729+ if ( dialog . Metadata . Disabled ) continue ;
730+
696731 IQuickSwitchDialogWindow dialogWindow ;
697732 var existingDialogWindow = _quickSwitchDialogs [ dialog ] ;
698733 if ( existingDialogWindow != null && existingDialogWindow . Handle == hwnd )
@@ -702,7 +737,7 @@ private static IQuickSwitchDialogWindow GetDialogWindow(HWND hwnd)
702737 }
703738 else
704739 {
705- dialogWindow = dialog . CheckDialogWindow ( hwnd ) ;
740+ dialogWindow = dialog . Plugin . CheckDialogWindow ( hwnd ) ;
706741 }
707742
708743 return dialogWindow ;
@@ -835,7 +870,6 @@ public static void Dispose()
835870 foreach ( var explorer in _quickSwitchExplorers . Keys )
836871 {
837872 _quickSwitchExplorers [ explorer ] ? . Dispose ( ) ;
838- explorer . Dispose ( ) ;
839873 }
840874 _quickSwitchExplorers . Clear ( ) ;
841875 lock ( _lastExplorerLock )
@@ -847,7 +881,6 @@ public static void Dispose()
847881 foreach ( var dialog in _quickSwitchDialogs . Keys )
848882 {
849883 _quickSwitchDialogs [ dialog ] ? . Dispose ( ) ;
850- dialog . Dispose ( ) ;
851884 }
852885 _quickSwitchDialogs . Clear ( ) ;
853886 lock ( _dialogWindowLock )
0 commit comments