@@ -19,38 +19,60 @@ public BIDSHelperPreferencesDialogPage OptionsPage
1919
2020 public void Initialize ( )
2121 {
22- this . Width = 395 ; //392
23- this . Height = 290 ;
22+ try
23+ {
24+ this . Width = 395 ; //392
25+ this . Height = 290 ;
2426
25- // Smart Diff
26- lblTFS . Text = "Visual Studio Built-in" ;
27- lblVSS . Text = string . Empty ;
27+ // Smart Diff
28+ lblTFS . Text = "Visual Studio Built-in" ;
29+ lblVSS . Text = string . Empty ;
2830
29- if ( string . IsNullOrEmpty ( SmartDiffPlugin . CustomDiffViewer ) )
30- {
31- radSmartDiffDefault . Checked = true ;
32- txtSmartDiffCustom . Text = "\" C:\\ Program Files (x86)\\ Microsoft Visual Studio 9.0\\ Common7\\ IDE\\ diffmerge.exe\" ? ? /ignoreeol /ignorespace" ;
33- }
34- else
35- {
36- radSmartDiffCustom . Checked = true ;
37- txtSmartDiffCustom . Text = SmartDiffPlugin . CustomDiffViewer ;
38- }
31+ if ( string . IsNullOrEmpty ( SmartDiffPlugin . CustomDiffViewer ) )
32+ {
33+ radSmartDiffDefault . Checked = true ;
34+ txtSmartDiffCustom . Text = "\" C:\\ Program Files (x86)\\ Microsoft Visual Studio 9.0\\ Common7\\ IDE\\ diffmerge.exe\" ? ? /ignoreeol /ignorespace" ;
35+ }
36+ else
37+ {
38+ radSmartDiffCustom . Checked = true ;
39+ txtSmartDiffCustom . Text = SmartDiffPlugin . CustomDiffViewer ;
40+ }
3941
40- FixSmartDiffCustomEnabled ( ) ;
42+ FixSmartDiffCustomEnabled ( ) ;
4143
42- // Expression & Configuration highlighter
43- btnExpressionColor . BackColor = ExpressionHighlighterPlugin . ExpressionColor ;
44- btnConfigurationColor . BackColor = ExpressionHighlighterPlugin . ConfigurationColor ;
44+ if ( BIDSHelperPackage . SSISExtensionVersion != null )
45+ {
46+ // Expression & Configuration highlighter
47+ btnExpressionColor . BackColor = ExpressionHighlighterPlugin . ExpressionColor ;
48+ btnConfigurationColor . BackColor = ExpressionHighlighterPlugin . ConfigurationColor ;
49+
50+ // Expression editor, font and colours
51+ buttonExpressionFontSample . Font = ExpressionListPlugin . ExpressionFont ;
52+ buttonExpressionFontSample . ForeColor = ExpressionListPlugin . ExpressionColor ;
53+ buttonResultFontSample . Font = ExpressionListPlugin . ResultFont ;
54+ buttonResultFontSample . ForeColor = ExpressionListPlugin . ResultColor ;
55+ }
56+ else
57+ {
58+ btnExpressionColor . Enabled = false ;
59+ btnConfigurationColor . Enabled = false ;
60+ buttonExpressionFontSample . Enabled = false ;
61+ buttonResultFontSample . Enabled = false ;
62+ linkResetExpressionColors . Enabled = false ;
63+ }
4564
46- // Measure group free space
47- txtFreeSpaceFactor . Text = MeasureGroupHealthCheckPlugin . FreeSpaceFactor . ToString ( ) ;
65+ // Measure group free space
66+ if ( BIDSHelperPackage . SSASExtensionVersion != null )
67+ txtFreeSpaceFactor . Text = MeasureGroupHealthCheckPlugin . FreeSpaceFactor . ToString ( ) ;
68+ else
69+ txtFreeSpaceFactor . Enabled = false ;
4870
49- // Expression editor, font and colours
50- buttonExpressionFontSample . Font = ExpressionListPlugin . ExpressionFont ;
51- buttonExpressionFontSample . ForeColor = ExpressionListPlugin . ExpressionColor ;
52- buttonResultFontSample . Font = ExpressionListPlugin . ResultFont ;
53- buttonResultFontSample . ForeColor = ExpressionListPlugin . ResultColor ;
71+ }
72+ catch ( Exception ex )
73+ {
74+ MessageBox . Show ( ex . Message + " \r \n " + ex . StackTrace ) ;
75+ }
5476 }
5577
5678 public void Apply ( )
@@ -68,21 +90,25 @@ public void Apply()
6890 }
6991
7092 // Expression & Configuration highlighter
71- ExpressionHighlighterPlugin . ExpressionColor = btnExpressionColor . BackColor ;
72- ExpressionHighlighterPlugin . ConfigurationColor = btnConfigurationColor . BackColor ;
93+ if ( BIDSHelperPackage . SSISExtensionVersion != null )
94+ {
95+ ExpressionHighlighterPlugin . ExpressionColor = btnExpressionColor . BackColor ;
96+ ExpressionHighlighterPlugin . ConfigurationColor = btnConfigurationColor . BackColor ;
97+
98+ // Expression editor, font and colours
99+ ExpressionListPlugin . ExpressionFont = buttonExpressionFontSample . Font ;
100+ ExpressionListPlugin . ExpressionColor = buttonExpressionFontSample . ForeColor ;
101+ ExpressionListPlugin . ResultFont = buttonResultFontSample . Font ;
102+ ExpressionListPlugin . ResultColor = buttonResultFontSample . ForeColor ;
103+ }
73104
74105 // Measure group free space
75106 int iFreeSpaceFactor ;
76- if ( int . TryParse ( txtFreeSpaceFactor . Text , out iFreeSpaceFactor ) )
107+ if ( txtFreeSpaceFactor . Enabled && int . TryParse ( txtFreeSpaceFactor . Text , out iFreeSpaceFactor ) )
77108 {
78109 MeasureGroupHealthCheckPlugin . FreeSpaceFactor = iFreeSpaceFactor ;
79110 }
80111
81- // Expression editor, font and colours
82- ExpressionListPlugin . ExpressionFont = buttonExpressionFontSample . Font ;
83- ExpressionListPlugin . ExpressionColor = buttonExpressionFontSample . ForeColor ;
84- ExpressionListPlugin . ResultFont = buttonResultFontSample . Font ;
85- ExpressionListPlugin . ResultColor = buttonResultFontSample . ForeColor ;
86112 }
87113 catch ( Exception ex )
88114 {
@@ -92,7 +118,14 @@ public void Apply()
92118
93119 private void radSmartDiffDefault_CheckedChanged ( object sender , EventArgs e )
94120 {
95- FixSmartDiffCustomEnabled ( ) ;
121+ try
122+ {
123+ FixSmartDiffCustomEnabled ( ) ;
124+ }
125+ catch ( Exception ex )
126+ {
127+ MessageBox . Show ( ex . Message + "\r \n " + ex . StackTrace ) ;
128+ }
96129 }
97130
98131 private void FixSmartDiffCustomEnabled ( )
@@ -102,64 +135,112 @@ private void FixSmartDiffCustomEnabled()
102135
103136 private void radSmartDiffCustom_CheckedChanged ( object sender , EventArgs e )
104137 {
105- FixSmartDiffCustomEnabled ( ) ;
138+ try
139+ {
140+ FixSmartDiffCustomEnabled ( ) ;
141+ }
142+ catch ( Exception ex )
143+ {
144+ MessageBox . Show ( ex . Message + "\r \n " + ex . StackTrace ) ;
145+ }
106146 }
107147
108148 private void btnExpressionColor_Click ( object sender , EventArgs e )
109149 {
110- colorDialog . Color = btnExpressionColor . BackColor ;
111- if ( colorDialog . ShowDialog ( ) == DialogResult . OK )
150+ try
112151 {
113- btnExpressionColor . BackColor = colorDialog . Color ;
152+ colorDialog . Color = btnExpressionColor . BackColor ;
153+ if ( colorDialog . ShowDialog ( ) == DialogResult . OK )
154+ {
155+ btnExpressionColor . BackColor = colorDialog . Color ;
156+ }
157+ }
158+ catch ( Exception ex )
159+ {
160+ MessageBox . Show ( ex . Message + "\r \n " + ex . StackTrace ) ;
114161 }
115162 }
116163
117164 private void btnConfigurationColor_Click ( object sender , EventArgs e )
118165 {
119- colorDialog . Color = btnConfigurationColor . BackColor ;
120- if ( colorDialog . ShowDialog ( ) == DialogResult . OK )
166+ try
121167 {
122- btnConfigurationColor . BackColor = colorDialog . Color ;
168+ colorDialog . Color = btnConfigurationColor . BackColor ;
169+ if ( colorDialog . ShowDialog ( ) == DialogResult . OK )
170+ {
171+ btnConfigurationColor . BackColor = colorDialog . Color ;
172+ }
173+ }
174+ catch ( Exception ex )
175+ {
176+ MessageBox . Show ( ex . Message + "\r \n " + ex . StackTrace ) ;
123177 }
124178 }
125179
126180 private void linkResetExpressionColors_LinkClicked ( object sender , LinkLabelLinkClickedEventArgs e )
127181 {
128- ExpressionHighlighterPlugin . ExpressionColor = ExpressionHighlighterPlugin . ExpressionColorDefault ;
129- btnExpressionColor . BackColor = ExpressionHighlighterPlugin . ExpressionColorDefault ;
182+ try
183+ {
184+ ExpressionHighlighterPlugin . ExpressionColor = ExpressionHighlighterPlugin . ExpressionColorDefault ;
185+ btnExpressionColor . BackColor = ExpressionHighlighterPlugin . ExpressionColorDefault ;
130186
131- ExpressionHighlighterPlugin . ConfigurationColor = ExpressionHighlighterPlugin . ConfigurationColorDefault ;
132- btnConfigurationColor . BackColor = ExpressionHighlighterPlugin . ConfigurationColorDefault ;
187+ ExpressionHighlighterPlugin . ConfigurationColor = ExpressionHighlighterPlugin . ConfigurationColorDefault ;
188+ btnConfigurationColor . BackColor = ExpressionHighlighterPlugin . ConfigurationColorDefault ;
189+ }
190+ catch ( Exception ex )
191+ {
192+ MessageBox . Show ( ex . Message + "\r \n " + ex . StackTrace ) ;
193+ }
133194 }
134195
135196 private void txtFreeSpaceFactor_Leave ( object sender , EventArgs e )
136197 {
137- int i ;
138- if ( ! int . TryParse ( txtFreeSpaceFactor . Text , out i ) )
139- txtFreeSpaceFactor . Text = MeasureGroupHealthCheckPlugin . FreeSpaceFactor . ToString ( ) ;
198+ try
199+ {
200+ int i ;
201+ if ( ! int . TryParse ( txtFreeSpaceFactor . Text , out i ) )
202+ txtFreeSpaceFactor . Text = MeasureGroupHealthCheckPlugin . FreeSpaceFactor . ToString ( ) ;
203+ }
204+ catch ( Exception ex )
205+ {
206+ MessageBox . Show ( ex . Message + "\r \n " + ex . StackTrace ) ;
207+ }
140208 }
141209
142210 private void buttonExpressionFont_Click ( object sender , EventArgs e )
143211 {
144- fontDialog . Font = buttonExpressionFontSample . Font ;
145- fontDialog . Color = buttonExpressionFontSample . ForeColor ;
146- if ( fontDialog . ShowDialog ( ) == DialogResult . OK )
212+ try
213+ {
214+ fontDialog . Font = buttonExpressionFontSample . Font ;
215+ fontDialog . Color = buttonExpressionFontSample . ForeColor ;
216+ if ( fontDialog . ShowDialog ( ) == DialogResult . OK )
217+ {
218+ buttonExpressionFontSample . Font = fontDialog . Font ;
219+ buttonExpressionFontSample . ForeColor = fontDialog . Color ;
220+ }
221+ }
222+ catch ( Exception ex )
147223 {
148- buttonExpressionFontSample . Font = fontDialog . Font ;
149- buttonExpressionFontSample . ForeColor = fontDialog . Color ;
224+ MessageBox . Show ( ex . Message + "\r \n " + ex . StackTrace ) ;
150225 }
151226 }
152227
153228 private void buttonResultFont_Click ( object sender , EventArgs e )
154229 {
155- fontDialog . Font = buttonResultFontSample . Font ;
156- fontDialog . Color = buttonResultFontSample . ForeColor ;
157- if ( fontDialog . ShowDialog ( ) == DialogResult . OK )
230+ try
231+ {
232+ fontDialog . Font = buttonResultFontSample . Font ;
233+ fontDialog . Color = buttonResultFontSample . ForeColor ;
234+ if ( fontDialog . ShowDialog ( ) == DialogResult . OK )
235+ {
236+ buttonResultFontSample . Font = fontDialog . Font ;
237+ buttonResultFontSample . ForeColor = fontDialog . Color ;
238+ }
239+ }
240+ catch ( Exception ex )
158241 {
159- buttonResultFontSample . Font = fontDialog . Font ;
160- buttonResultFontSample . ForeColor = fontDialog . Color ;
242+ MessageBox . Show ( ex . Message + "\r \n " + ex . StackTrace ) ;
161243 }
162-
163244 }
164245 }
165246
0 commit comments