1
1
using SQLScriptsExplorer . Addin . Infrastructure ;
2
2
using SQLScriptsExplorer . Addin . Models ;
3
+ using SQLScriptsExplorer . Addin . Models . Enums ;
3
4
using SQLScriptsExplorer . Addin . Repository . Interfaces ;
4
5
using System ;
5
6
using System . Collections . Generic ;
@@ -15,6 +16,7 @@ public class SettingsRepository : ISettingsRepository
15
16
private const string ALLOWED_FILE_TYPES = "AllowedFileTypes" ;
16
17
private const string SHOW_EXECUTEFILE_BUTTON = "ShowExecuteFileButton" ;
17
18
private const string CONFIRM_SCRIPT_EXECUTION = "ConfirmScriptExecution" ;
19
+ private const string SCRIPT_FILE_DOUBLE_CLICK_BEHAVIOUR = "ScriptFileDoubleClickBehaviour" ;
18
20
19
21
public List < FolderMapping > FolderMapping { get ; set ; }
20
22
@@ -28,6 +30,8 @@ public class SettingsRepository : ISettingsRepository
28
30
29
31
public bool ConfirmScriptExecution { get ; set ; }
30
32
33
+ public ScriptFileDoubleClickBehaviour ScriptFileDoubleClickBehaviour { get ; set ; }
34
+
31
35
public SettingsRepository ( )
32
36
{
33
37
Refresh ( ) ;
@@ -36,7 +40,7 @@ public SettingsRepository()
36
40
public void Refresh ( )
37
41
{
38
42
LoadFolderMapping ( ) ;
39
- LoadUserInterfaceSettings ( ) ;
43
+ LoadFileExplorerSettings ( ) ;
40
44
LoadGenericSettings ( ) ;
41
45
}
42
46
@@ -50,6 +54,7 @@ public void Save()
50
54
RegistryManager . SaveRegisterValue ( ALLOWED_FILE_TYPES , AllowedFileTypes ) ;
51
55
RegistryManager . SaveRegisterValue ( SHOW_EXECUTEFILE_BUTTON , ShowExecuteFileButton . ToString ( ) ) ;
52
56
RegistryManager . SaveRegisterValue ( CONFIRM_SCRIPT_EXECUTION , ConfirmScriptExecution . ToString ( ) ) ;
57
+ RegistryManager . SaveRegisterValue ( SCRIPT_FILE_DOUBLE_CLICK_BEHAVIOUR , $ "{ ( int ) ScriptFileDoubleClickBehaviour } ") ;
53
58
}
54
59
55
60
private void LoadFolderMapping ( )
@@ -81,7 +86,7 @@ private void LoadFolderMapping()
81
86
}
82
87
}
83
88
84
- private void LoadUserInterfaceSettings ( )
89
+ private void LoadFileExplorerSettings ( )
85
90
{
86
91
// Show Execute File Button and
87
92
var showExecuteFileButton = RegistryManager . GetRegisterValue ( SHOW_EXECUTEFILE_BUTTON ) ;
@@ -96,6 +101,13 @@ private void LoadUserInterfaceSettings()
96
101
ConfirmScriptExecution = true ;
97
102
else
98
103
ConfirmScriptExecution = bool . Parse ( confirmScriptExecution ) ;
104
+
105
+ // Script File Double Click Behaviour
106
+ var scriptFileDoubleClickBehaviour = RegistryManager . GetRegisterValue ( SCRIPT_FILE_DOUBLE_CLICK_BEHAVIOUR ) ;
107
+ if ( string . IsNullOrEmpty ( scriptFileDoubleClickBehaviour ) )
108
+ ScriptFileDoubleClickBehaviour = ScriptFileDoubleClickBehaviour . OpenNewInstance ;
109
+ else
110
+ ScriptFileDoubleClickBehaviour = ( ScriptFileDoubleClickBehaviour ) int . Parse ( scriptFileDoubleClickBehaviour ) ;
99
111
}
100
112
101
113
private void LoadGenericSettings ( )
0 commit comments