Datei: NDOPackage/ConfigurationDialog.cs

Last Commit (946ad0e)
1 //
2 // Copyright (c) 2002-2019 Mirko Matytschak
3 // (www.netdataobjects.de)
4 //
5 // Author: Mirko Matytschak
6 //
7 // Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
8 // documentation files (the "Software"), to deal in the Software without restriction, including without limitation
9 // the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the
10 // Software, and to permit persons to whom the Software is furnished to do so, subject to the following
11 // conditions:
12
13 // The above copyright notice and this permission notice shall be included in all copies or substantial portions
14 // of the Software.
15 //
16 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED
17 // TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
18 // THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
19 // CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
20 // DEALINGS IN THE SOFTWARE.
21
22
23 using System;
24 using System.Linq;
25 using System.IO;
26 using System.Windows.Forms;
27 using EnvDTE;
 
28 using System.Diagnostics;
29 using Microsoft.VisualStudio.Shell;
30 using Microsoft.VisualStudio.ComponentModelHost;
31 using NuGet.VisualStudio;
32 using NDO.UISupport;
 
 
33
34 namespace NETDataObjects. NDOVSPackage
35 {
36 ····/// <summary>
37 ····/// Summary description for ConfigurationDialog.
38 ····/// </summary>
39 ····internal class ConfigurationDialog : System.Windows.Forms.Form
40 ····{
41 ········private System.ComponentModel.IContainer components;
42
43 ········private Project project;
44 ········private System.Windows.Forms.ToolTip toolTip1;
45 ········private TabControl tabControl;
46 ········private TabPage tabPageGeneral;
47 ········private TextBox txtTargetMappingFileName;
48 ········private Label label1;
49 ········private CheckBox chkVerboseMode;
50 ········private TextBox txtSchemaVersion;
51 ········private Label label5;
52 ········private Button btnNewDatabase;
53 ········private Button btnSaveAs;
54 ········private Button btnPresetApp;
55 ········private TextBox txtDbOwner;
56 ········private TextBox txtConnectionString;
57 ········private Label label3;
58 ········private GroupBox groupBox1;
59 ········private CheckBox chkDropExistingElements;
60 ········private CheckBox chkGenerateFkConstraints;
61 ········private CheckBox chkIncludeTypecodes;
62 ········private RadioButton radioDefaultEncoding;
63 ········private RadioButton radioUtf8Encoding;
64 ········private Label label4;
65 ········private ComboBox cbSqlDialect;
66 ········private CheckBox chkGenerateSQLScript;
67 ········private CheckBox chkUseTimeStamps;
68 ········private CheckBox chkChangeEvents;
69 ········private Label label2;
70 ········private Button btnConnString;
71 ········private Button btnOK;
72 ········private Button btnPresetLibrary;
73 ········private Button btnCancel;
74 ········private CheckBox chkMappingNew;
75 ········private CheckBox chkActivateEnhancer;
76 ········private CheckBox chkActivateAddIn;
77 ········private TabPage tabPageAssemblies;
78 ········private Label label6;
79 ········private CheckedListBox chlbAssemblies;
80 ········private ProjectDescription projectDescription;
81 ········private Button btnInstallProvider;
82 ········private NDOReference[] references;
83
84 ········public ConfigurationDialog(Project project, ProjectDescription projectDescription)
85 ········{
86 ············try
87 ············{
88 ················this.project = project;
89 ················this.projectDescription = projectDescription;
90 ················this.projectDescription.BuildReferences();
91 ················this.projectDescription.FixDllState();
92 ················InitializeComponent();
93 ················var lbAssemblies = (ListBox)this.chlbAssemblies;
94 ················this.references = projectDescription.References.Values.ToArray();
95 ················lbAssemblies.DataSource = this.references;
96 ················lbAssemblies.DisplayMember = nameof( NDOReference.Name );
97 ················lbAssemblies.ValueMember = nameof( NDOReference.CheckState );
98 ················int i = 0;
99 ················foreach (var item in this.references)
100 ················{
101 ····················this.chlbAssemblies.SetItemCheckState( i++, item.CheckState );
102 ················}
103 ············}
104 ············catch (Exception ex)
105 ············{
106 ················Debug.WriteLine( ex.ToString() );
107 ············}
108 ········}
109
110 ········void CheckEnabledStateForLoadProviderButton()
111 ········{
112 ············string providerName = this.cbSqlDialect.Text;
113
114 ············if (string.IsNullOrEmpty( providerName ))
115 ············{
116 ················this.btnInstallProvider.Enabled = false;
117 ················return;
118 ············}
119
120 ············if (IsProviderInstalled(providerName))
121 ············{
122 ················this.btnInstallProvider.Enabled = false;
123 ················return;
124 ············}
125
126 ············this.btnInstallProvider.Enabled = true;
127 ········}
128
129 ········bool IsProviderInstalled(string providerName)
130 ········{
131 ············IComponentModel componentModel;
132 ············var installerService = GetInstallerService( out componentModel );
133
134 ············string packageName = $"ndo.{providerName.ToLower()}";
135 ············return installerService.IsPackageInstalled( this.project, packageName );
136 ········}
137
138 ········/// <summary>
139 ········/// Clean up any resources being used.
140 ········/// </summary>
141 ········protected override void Dispose( bool disposing )
142 ········{
143 ············if( disposing )
144 ············{
145 ················if(components != null)
146 ················{
147 ····················components.Dispose();
148 ················}
149 ············}
150 ············base.Dispose( disposing );
151 ········}
152
153 ········#region Windows Form Designer generated code
154 ········/// <summary>
155 ········/// Required method for Designer support - do not modify
156 ········/// the contents of this method with the code editor.
157 ········/// </summary>
158 ········private void InitializeComponent()
159 ········{
160 ············this.components = new System.ComponentModel.Container();
161 ············System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(ConfigurationDialog));
162 ············this.toolTip1 = new System.Windows.Forms.ToolTip(this.components);
163 ············this.chkVerboseMode = new System.Windows.Forms.CheckBox();
164 ············this.btnNewDatabase = new System.Windows.Forms.Button();
165 ············this.btnSaveAs = new System.Windows.Forms.Button();
166 ············this.btnPresetApp = new System.Windows.Forms.Button();
167 ············this.txtDbOwner = new System.Windows.Forms.TextBox();
168 ············this.txtConnectionString = new System.Windows.Forms.TextBox();
169 ············this.chkDropExistingElements = new System.Windows.Forms.CheckBox();
170 ············this.chkGenerateFkConstraints = new System.Windows.Forms.CheckBox();
171 ············this.chkIncludeTypecodes = new System.Windows.Forms.CheckBox();
172 ············this.radioDefaultEncoding = new System.Windows.Forms.RadioButton();
173 ············this.radioUtf8Encoding = new System.Windows.Forms.RadioButton();
174 ············this.cbSqlDialect = new System.Windows.Forms.ComboBox();
175 ············this.chkGenerateSQLScript = new System.Windows.Forms.CheckBox();
176 ············this.chkUseTimeStamps = new System.Windows.Forms.CheckBox();
177 ············this.chkChangeEvents = new System.Windows.Forms.CheckBox();
178 ············this.btnConnString = new System.Windows.Forms.Button();
179 ············this.btnPresetLibrary = new System.Windows.Forms.Button();
180 ············this.chkMappingNew = new System.Windows.Forms.CheckBox();
181 ············this.chkActivateEnhancer = new System.Windows.Forms.CheckBox();
182 ············this.chkActivateAddIn = new System.Windows.Forms.CheckBox();
183 ············this.tabControl = new System.Windows.Forms.TabControl();
184 ············this.tabPageGeneral = new System.Windows.Forms.TabPage();
185 ············this.txtTargetMappingFileName = new System.Windows.Forms.TextBox();
186 ············this.label1 = new System.Windows.Forms.Label();
187 ············this.txtSchemaVersion = new System.Windows.Forms.TextBox();
188 ············this.label5 = new System.Windows.Forms.Label();
189 ············this.label3 = new System.Windows.Forms.Label();
190 ············this.groupBox1 = new System.Windows.Forms.GroupBox();
191 ············this.btnInstallProvider = new System.Windows.Forms.Button();
192 ············this.label4 = new System.Windows.Forms.Label();
193 ············this.label2 = new System.Windows.Forms.Label();
194 ············this.tabPageAssemblies = new System.Windows.Forms.TabPage();
195 ············this.label6 = new System.Windows.Forms.Label();
196 ············this.chlbAssemblies = new System.Windows.Forms.CheckedListBox();
197 ············this.btnOK = new System.Windows.Forms.Button();
198 ············this.btnCancel = new System.Windows.Forms.Button();
199 ············this.tabControl.SuspendLayout();
200 ············this.tabPageGeneral.SuspendLayout();
201 ············this.groupBox1.SuspendLayout();
202 ············this.tabPageAssemblies.SuspendLayout();
203 ············this.SuspendLayout();
204 ············//
205 ············// chkVerboseMode
206 ············//
207 ············this.chkVerboseMode.Location = new System.Drawing.Point(21, 72);
208 ············this.chkVerboseMode.Name = "chkVerboseMode";
209 ············this.chkVerboseMode.Size = new System.Drawing.Size(238, 21);
210 ············this.chkVerboseMode.TabIndex = 51;
211 ············this.chkVerboseMode.Text = "Add-in Verbose Mode";
212 ············this.toolTip1.SetToolTip(this.chkVerboseMode, "Causes the Add-in and the Enhancer to show more information for debugging purpose" +
213 ········"s.");
214 ············//
215 ············// btnNewDatabase
216 ············//
217 ············this.btnNewDatabase.Location = new System.Drawing.Point(583, 313);
218 ············this.btnNewDatabase.Name = "btnNewDatabase";
219 ············this.btnNewDatabase.Size = new System.Drawing.Size(42, 21);
220 ············this.btnNewDatabase.TabIndex = 48;
221 ············this.btnNewDatabase.Text = "New";
222 ············this.toolTip1.SetToolTip(this.btnNewDatabase, "Create new database");
223 ············this.btnNewDatabase.Click += new System.EventHandler(this.btnNewDatabase_Click);
224 ············//
225 ············// btnSaveAs
226 ············//
227 ············this.btnSaveAs.DialogResult = System.Windows.Forms.DialogResult.OK;
228 ············this.btnSaveAs.Location = new System.Drawing.Point(249, 385);
229 ············this.btnSaveAs.Name = "btnSaveAs";
230 ············this.btnSaveAs.Size = new System.Drawing.Size(100, 39);
231 ············this.btnSaveAs.TabIndex = 47;
232 ············this.btnSaveAs.Text = "Save as...";
233 ············this.toolTip1.SetToolTip(this.btnSaveAs, "Save the options to be used in unattended builds with the stand-alone enhancer.");
234 ············this.btnSaveAs.Click += new System.EventHandler(this.btnSaveAs_Click);
235 ············//
236 ············// btnPresetApp
237 ············//
238 ············this.btnPresetApp.Location = new System.Drawing.Point(135, 385);
239 ············this.btnPresetApp.Name = "btnPresetApp";
240 ············this.btnPresetApp.Size = new System.Drawing.Size(100, 39);
241 ············this.btnPresetApp.TabIndex = 46;
242 ············this.btnPresetApp.Text = "Preset for Application";
243 ············this.toolTip1.SetToolTip(this.btnPresetApp, "Selects all settings used for applications which don\'t contain but reference pers" +
244 ········"istent types.");
245 ············this.btnPresetApp.Click += new System.EventHandler(this.btnPresetApp_Click);
246 ············//
247 ············// txtDbOwner
248 ············//
249 ············this.txtDbOwner.Location = new System.Drawing.Point(145, 126);
250 ············this.txtDbOwner.Name = "txtDbOwner";
251 ············this.txtDbOwner.Size = new System.Drawing.Size(160, 20);
252 ············this.txtDbOwner.TabIndex = 45;
253 ············this.toolTip1.SetToolTip(this.txtDbOwner, "Enter an owner name, if you like your tables to be written like owner.tablename.");
254 ············//
255 ············// txtConnectionString
256 ············//
257 ············this.txtConnectionString.Location = new System.Drawing.Point(18, 313);
258 ············this.txtConnectionString.Name = "txtConnectionString";
259 ············this.txtConnectionString.Size = new System.Drawing.Size(514, 20);
260 ············this.txtConnectionString.TabIndex = 39;
261 ············this.toolTip1.SetToolTip(this.txtConnectionString, "This string will be copied into the mapping file, if there doesn\'t exist a valid " +
262 ········"connection string. Otherwise it will be ignored.");
263 ············//
264 ············// chkDropExistingElements
265 ············//
266 ············this.chkDropExistingElements.Location = new System.Drawing.Point(13, 202);
267 ············this.chkDropExistingElements.Name = "chkDropExistingElements";
268 ············this.chkDropExistingElements.Size = new System.Drawing.Size(235, 21);
269 ············this.chkDropExistingElements.TabIndex = 24;
270 ············this.chkDropExistingElements.Text = "Insert Drop Statements in the Script";
271 ············this.toolTip1.SetToolTip(this.chkDropExistingElements, "If checked, NDO generates instructions to remove existing tables and constraints." +
272 ········"");
273 ············//
274 ············// chkGenerateFkConstraints
275 ············//
276 ············this.chkGenerateFkConstraints.Location = new System.Drawing.Point(13, 152);
277 ············this.chkGenerateFkConstraints.Name = "chkGenerateFkConstraints";
278 ············this.chkGenerateFkConstraints.Size = new System.Drawing.Size(235, 21);
279 ············this.chkGenerateFkConstraints.TabIndex = 23;
280 ············this.chkGenerateFkConstraints.Text = "Generate Foreign Key Constraints";
281 ············this.toolTip1.SetToolTip(this.chkGenerateFkConstraints, "If checked, NDO generates foreign key constraints for the relations in the databa" +
282 ········"se.");
283 ············//
284 ············// chkIncludeTypecodes
285 ············//
286 ············this.chkIncludeTypecodes.Location = new System.Drawing.Point(13, 177);
287 ············this.chkIncludeTypecodes.Name = "chkIncludeTypecodes";
288 ············this.chkIncludeTypecodes.Size = new System.Drawing.Size(235, 21);
289 ············this.chkIncludeTypecodes.TabIndex = 22;
290 ············this.chkIncludeTypecodes.Text = "Include Typecodes in the Script";
291 ············this.toolTip1.SetToolTip(this.chkIncludeTypecodes, "If checked, NDO generates instructions to build an additional table with the type" +
292 ········" code information.");
293 ············//
294 ············// radioDefaultEncoding
295 ············//
296 ············this.radioDefaultEncoding.Location = new System.Drawing.Point(13, 121);
297 ············this.radioDefaultEncoding.Name = "radioDefaultEncoding";
298 ············this.radioDefaultEncoding.Size = new System.Drawing.Size(140, 20);
299 ············this.radioDefaultEncoding.TabIndex = 21;
300 ············this.radioDefaultEncoding.Text = "Default Encoding";
301 ············this.toolTip1.SetToolTip(this.radioDefaultEncoding, "Check this option, if the script files should use windows encoding.");
302 ············//
303 ············// radioUtf8Encoding
304 ············//
305 ············this.radioUtf8Encoding.Checked = true;
306 ············this.radioUtf8Encoding.Location = new System.Drawing.Point(13, 99);
307 ············this.radioUtf8Encoding.Name = "radioUtf8Encoding";
308 ············this.radioUtf8Encoding.Size = new System.Drawing.Size(140, 21);
309 ············this.radioUtf8Encoding.TabIndex = 20;
310 ············this.radioUtf8Encoding.TabStop = true;
311 ············this.radioUtf8Encoding.Text = "UTF-8 Encoding";
312 ············this.toolTip1.SetToolTip(this.radioUtf8Encoding, "Check this option, if the script files should be UTF-8 encoded.");
313 ············//
314 ············// cbSqlDialect
315 ············//
316 ············this.cbSqlDialect.Location = new System.Drawing.Point(13, 70);
317 ············this.cbSqlDialect.Name = "cbSqlDialect";
318 ············this.cbSqlDialect.Size = new System.Drawing.Size(220, 21);
319 ············this.cbSqlDialect.TabIndex = 18;
320 ············this.toolTip1.SetToolTip(this.cbSqlDialect, "Choose an available NDO provider.");
321 ············this.cbSqlDialect.SelectedIndexChanged += new System.EventHandler(this.cbSqlDialect_SelectedIndexChanged);
322 ············//
323 ············// chkGenerateSQLScript
324 ············//
325 ············this.chkGenerateSQLScript.Location = new System.Drawing.Point(13, 21);
326 ············this.chkGenerateSQLScript.Name = "chkGenerateSQLScript";
327 ············this.chkGenerateSQLScript.Size = new System.Drawing.Size(187, 21);
328 ············this.chkGenerateSQLScript.TabIndex = 13;
329 ············this.chkGenerateSQLScript.Text = "Generate SQL Script";
330 ············this.toolTip1.SetToolTip(this.chkGenerateSQLScript, "If checked, NDO will create a script with DDL code, which can be used to construc" +
331 ········"t a database structure.");
332 ············this.chkGenerateSQLScript.CheckedChanged += new System.EventHandler(this.chkGenerateSQLScript_CheckedChanged);
333 ············//
334 ············// chkUseTimeStamps
335 ············//
336 ············this.chkUseTimeStamps.Location = new System.Drawing.Point(21, 153);
337 ············this.chkUseTimeStamps.Name = "chkUseTimeStamps";
338 ············this.chkUseTimeStamps.Size = new System.Drawing.Size(302, 20);
339 ············this.chkUseTimeStamps.TabIndex = 42;
340 ············this.chkUseTimeStamps.Text = "Generate Time Stamp Columns for each class";
341 ············this.toolTip1.SetToolTip(this.chkUseTimeStamps, "Check this option, if all tables should be protected by collistion detection.");
342 ············//
343 ············// chkChangeEvents
344 ············//
345 ············this.chkChangeEvents.Location = new System.Drawing.Point(21, 179);
346 ············this.chkChangeEvents.Name = "chkChangeEvents";
347 ············this.chkChangeEvents.Size = new System.Drawing.Size(302, 21);
348 ············this.chkChangeEvents.TabIndex = 41;
349 ············this.chkChangeEvents.Text = "Generate change events with Add Accessor";
350 ············this.toolTip1.SetToolTip(this.chkChangeEvents, "Check this option, if you intend to bind the UI directly to the accessor properti" +
351 ········"es of your persistent classes.");
352 ············//
353 ············// btnConnString
354 ············//
355 ············this.btnConnString.Location = new System.Drawing.Point(538, 313);
356 ············this.btnConnString.Name = "btnConnString";
357 ············this.btnConnString.Size = new System.Drawing.Size(42, 21);
358 ············this.btnConnString.TabIndex = 38;
359 ············this.btnConnString.Text = "...";
360 ············this.toolTip1.SetToolTip(this.btnConnString, "Enter existing database connection");
361 ············this.btnConnString.Click += new System.EventHandler(this.btnConnString_Click);
362 ············//
363 ············// btnPresetLibrary
364 ············//
365 ············this.btnPresetLibrary.Location = new System.Drawing.Point(21, 385);
366 ············this.btnPresetLibrary.Name = "btnPresetLibrary";
367 ············this.btnPresetLibrary.Size = new System.Drawing.Size(100, 39);
368 ············this.btnPresetLibrary.TabIndex = 36;
369 ············this.btnPresetLibrary.Text = "Preset for Library";
370 ············this.toolTip1.SetToolTip(this.btnPresetLibrary, "Selects all settings necessary for projects containing persistent types.");
371 ············this.btnPresetLibrary.Click += new System.EventHandler(this.btnPresetLibrary_Click);
372 ············//
373 ············// chkMappingNew
374 ············//
375 ············this.chkMappingNew.Location = new System.Drawing.Point(21, 99);
376 ············this.chkMappingNew.Name = "chkMappingNew";
377 ············this.chkMappingNew.Size = new System.Drawing.Size(272, 21);
378 ············this.chkMappingNew.TabIndex = 34;
379 ············this.chkMappingNew.Text = "Always Generate a new mapping File";
380 ············this.toolTip1.SetToolTip(this.chkMappingNew, "Choose this options, if NDO should discard and rebuild all mapping information.");
381 ············//
382 ············// chkActivateEnhancer
383 ············//
384 ············this.chkActivateEnhancer.Location = new System.Drawing.Point(21, 46);
385 ············this.chkActivateEnhancer.Name = "chkActivateEnhancer";
386 ············this.chkActivateEnhancer.Size = new System.Drawing.Size(188, 20);
387 ············this.chkActivateEnhancer.TabIndex = 33;
388 ············this.chkActivateEnhancer.Text = "Activate enhancer";
389 ············this.toolTip1.SetToolTip(this.chkActivateEnhancer, "Choose this option, if your project contains persistent types.");
390 ············//
391 ············// chkActivateAddIn
392 ············//
393 ············this.chkActivateAddIn.Location = new System.Drawing.Point(21, 19);
394 ············this.chkActivateAddIn.Name = "chkActivateAddIn";
395 ············this.chkActivateAddIn.Size = new System.Drawing.Size(188, 21);
396 ············this.chkActivateAddIn.TabIndex = 32;
397 ············this.chkActivateAddIn.Text = "Activate NDO AddIn";
398 ············this.toolTip1.SetToolTip(this.chkActivateAddIn, "Choose this options, if your project contains or references persistent types.");
399 ············this.chkActivateAddIn.Click += new System.EventHandler(this.chkActivateAddIn_CheckedChanged);
400 ············//
401 ············// tabControl
402 ············//
403 ············this.tabControl.Controls.Add(this.tabPageGeneral);
404 ············this.tabControl.Controls.Add(this.tabPageAssemblies);
405 ············this.tabControl.Dock = System.Windows.Forms.DockStyle.Top;
406 ············this.tabControl.Location = new System.Drawing.Point(0, 0);
407 ············this.tabControl.Name = "tabControl";
408 ············this.tabControl.SelectedIndex = 0;
409 ············this.tabControl.Size = new System.Drawing.Size(661, 374);
410 ············this.tabControl.TabIndex = 0;
411 ············//
412 ············// tabPageGeneral
413 ············//
414 ············this.tabPageGeneral.Controls.Add(this.txtTargetMappingFileName);
415 ············this.tabPageGeneral.Controls.Add(this.label1);
416 ············this.tabPageGeneral.Controls.Add(this.chkVerboseMode);
417 ············this.tabPageGeneral.Controls.Add(this.txtSchemaVersion);
418 ············this.tabPageGeneral.Controls.Add(this.label5);
419 ············this.tabPageGeneral.Controls.Add(this.btnNewDatabase);
420 ············this.tabPageGeneral.Controls.Add(this.txtDbOwner);
421 ············this.tabPageGeneral.Controls.Add(this.txtConnectionString);
422 ············this.tabPageGeneral.Controls.Add(this.label3);
423 ············this.tabPageGeneral.Controls.Add(this.groupBox1);
424 ············this.tabPageGeneral.Controls.Add(this.chkUseTimeStamps);
425 ············this.tabPageGeneral.Controls.Add(this.chkChangeEvents);
426 ············this.tabPageGeneral.Controls.Add(this.label2);
427 ············this.tabPageGeneral.Controls.Add(this.btnConnString);
428 ············this.tabPageGeneral.Controls.Add(this.chkMappingNew);
429 ············this.tabPageGeneral.Controls.Add(this.chkActivateEnhancer);
430 ············this.tabPageGeneral.Controls.Add(this.chkActivateAddIn);
431 ············this.tabPageGeneral.Location = new System.Drawing.Point(4, 22);
432 ············this.tabPageGeneral.Name = "tabPageGeneral";
433 ············this.tabPageGeneral.Padding = new System.Windows.Forms.Padding(3);
434 ············this.tabPageGeneral.Size = new System.Drawing.Size(653, 348);
435 ············this.tabPageGeneral.TabIndex = 0;
436 ············this.tabPageGeneral.Text = "General";
437 ············this.tabPageGeneral.UseVisualStyleBackColor = true;
438 ············//
439 ············// txtTargetMappingFileName
440 ············//
441 ············this.txtTargetMappingFileName.Location = new System.Drawing.Point(145, 245);
442 ············this.txtTargetMappingFileName.Name = "txtTargetMappingFileName";
443 ············this.txtTargetMappingFileName.Size = new System.Drawing.Size(160, 20);
444 ············this.txtTargetMappingFileName.TabIndex = 53;
445 ············//
446 ············// label1
447 ············//
448 ············this.label1.Location = new System.Drawing.Point(18, 246);
449 ············this.label1.Name = "label1";
450 ············this.label1.Size = new System.Drawing.Size(121, 21);
451 ············this.label1.TabIndex = 52;
452 ············this.label1.Text = "Mapping File Name";
453 ············//
454 ············// txtSchemaVersion
455 ············//
456 ············this.txtSchemaVersion.Location = new System.Drawing.Point(145, 219);
457 ············this.txtSchemaVersion.Name = "txtSchemaVersion";
458 ············this.txtSchemaVersion.Size = new System.Drawing.Size(160, 20);
459 ············this.txtSchemaVersion.TabIndex = 50;
460 ············//
461 ············// label5
462 ············//
463 ············this.label5.Location = new System.Drawing.Point(18, 220);
464 ············this.label5.Name = "label5";
465 ············this.label5.Size = new System.Drawing.Size(121, 21);
466 ············this.label5.TabIndex = 49;
467 ············this.label5.Text = "Schema Version";
468 ············//
469 ············// label3
470 ············//
471 ············this.label3.Location = new System.Drawing.Point(18, 128);
472 ············this.label3.Name = "label3";
473 ············this.label3.Size = new System.Drawing.Size(127, 21);
474 ············this.label3.TabIndex = 44;
475 ············this.label3.Text = "Owner / Schema Name";
476 ············//
477 ············// groupBox1
478 ············//
479 ············this.groupBox1.Controls.Add(this.btnInstallProvider);
480 ············this.groupBox1.Controls.Add(this.chkDropExistingElements);
481 ············this.groupBox1.Controls.Add(this.chkGenerateFkConstraints);
482 ············this.groupBox1.Controls.Add(this.chkIncludeTypecodes);
483 ············this.groupBox1.Controls.Add(this.radioDefaultEncoding);
484 ············this.groupBox1.Controls.Add(this.radioUtf8Encoding);
485 ············this.groupBox1.Controls.Add(this.label4);
486 ············this.groupBox1.Controls.Add(this.cbSqlDialect);
487 ············this.groupBox1.Controls.Add(this.chkGenerateSQLScript);
488 ············this.groupBox1.Location = new System.Drawing.Point(343, 21);
489 ············this.groupBox1.Name = "groupBox1";
490 ············this.groupBox1.Size = new System.Drawing.Size(265, 244);
491 ············this.groupBox1.TabIndex = 43;
492 ············this.groupBox1.TabStop = false;
493 ············this.groupBox1.Text = " SQL ";
494 ············//
495 ············// btnInstallProvider
496 ············//
497 ············this.btnInstallProvider.Location = new System.Drawing.Point(142, 102);
498 ············this.btnInstallProvider.Name = "btnInstallProvider";
499 ············this.btnInstallProvider.Size = new System.Drawing.Size(91, 22);
500 ············this.btnInstallProvider.TabIndex = 25;
501 ············this.btnInstallProvider.Text = "Install Provider";
502 ············this.btnInstallProvider.UseVisualStyleBackColor = true;
503 ············this.btnInstallProvider.Click += new System.EventHandler(this.btnInstallProvider_Click);
504 ············//
505 ············// label4
506 ············//
507 ············this.label4.Location = new System.Drawing.Point(13, 50);
508 ············this.label4.Name = "label4";
509 ············this.label4.Size = new System.Drawing.Size(200, 17);
510 ············this.label4.TabIndex = 19;
511 ············this.label4.Text = "SQL Dialect";
512 ············//
513 ············// label2
514 ············//
515 ············this.label2.Location = new System.Drawing.Point(18, 292);
516 ············this.label2.Name = "label2";
517 ············this.label2.Size = new System.Drawing.Size(360, 21);
518 ············this.label2.TabIndex = 40;
519 ············this.label2.Text = "Default Connection String";
520 ············//
521 ············// tabPageAssemblies
522 ············//
523 ············this.tabPageAssemblies.Controls.Add(this.label6);
524 ············this.tabPageAssemblies.Controls.Add(this.chlbAssemblies);
525 ············this.tabPageAssemblies.Location = new System.Drawing.Point(4, 22);
526 ············this.tabPageAssemblies.Name = "tabPageAssemblies";
527 ············this.tabPageAssemblies.Padding = new System.Windows.Forms.Padding(3);
528 ············this.tabPageAssemblies.Size = new System.Drawing.Size(653, 348);
529 ············this.tabPageAssemblies.TabIndex = 1;
530 ············this.tabPageAssemblies.Text = "Assemblies";
531 ············this.tabPageAssemblies.UseVisualStyleBackColor = true;
532 ············//
533 ············// label6
534 ············//
535 ············this.label6.AutoSize = true;
536 ············this.label6.Location = new System.Drawing.Point(10, 12);
537 ············this.label6.Name = "label6";
538 ············this.label6.Size = new System.Drawing.Size(328, 13);
539 ············this.label6.TabIndex = 1;
540 ············this.label6.Text = "Choose Assemblies which should be analyzed by the NDOEnhancer";
541 ············//
542 ············// chlbAssemblies
543 ············//
544 ············this.chlbAssemblies.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
545 ············| System.Windows.Forms.AnchorStyles.Left)
546 ············| System.Windows.Forms.AnchorStyles.Right)));
547 ············this.chlbAssemblies.FormattingEnabled = true;
548 ············this.chlbAssemblies.Location = new System.Drawing.Point(10, 39);
549 ············this.chlbAssemblies.Name = "chlbAssemblies";
550 ············this.chlbAssemblies.Size = new System.Drawing.Size(631, 289);
551 ············this.chlbAssemblies.TabIndex = 0;
552 ············this.chlbAssemblies.ItemCheck += new System.Windows.Forms.ItemCheckEventHandler(this.chlbAssemblies_ItemCheck);
553 ············//
554 ············// btnOK
555 ············//
556 ············this.btnOK.DialogResult = System.Windows.Forms.DialogResult.OK;
557 ············this.btnOK.Location = new System.Drawing.Point(363, 385);
558 ············this.btnOK.Name = "btnOK";
559 ············this.btnOK.Size = new System.Drawing.Size(100, 39);
560 ············this.btnOK.TabIndex = 37;
561 ············this.btnOK.Text = "OK";
562 ············this.btnOK.Click += new System.EventHandler(this.btnOK_Click);
563 ············//
564 ············// btnCancel
565 ············//
566 ············this.btnCancel.DialogResult = System.Windows.Forms.DialogResult.Cancel;
567 ············this.btnCancel.Location = new System.Drawing.Point(477, 385);
568 ············this.btnCancel.Name = "btnCancel";
569 ············this.btnCancel.Size = new System.Drawing.Size(100, 39);
570 ············this.btnCancel.TabIndex = 35;
571 ············this.btnCancel.Text = "Cancel";
572 ············//
573 ············// ConfigurationDialog
574 ············//
575 ············this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
576 ············this.ClientSize = new System.Drawing.Size(661, 439);
577 ············this.Controls.Add(this.btnSaveAs);
578 ············this.Controls.Add(this.btnPresetApp);
579 ············this.Controls.Add(this.btnOK);
580 ············this.Controls.Add(this.btnPresetLibrary);
581 ············this.Controls.Add(this.btnCancel);
582 ············this.Controls.Add(this.tabControl);
583 ············this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
584 ············this.Name = "ConfigurationDialog";
585 ············this.Text = "NDO Configuration";
586 ············this.Load += new System.EventHandler(this.ConfigurationDialog_Load);
587 ············this.tabControl.ResumeLayout(false);
588 ············this.tabPageGeneral.ResumeLayout(false);
589 ············this.tabPageGeneral.PerformLayout();
590 ············this.groupBox1.ResumeLayout(false);
591 ············this.tabPageAssemblies.ResumeLayout(false);
592 ············this.tabPageAssemblies.PerformLayout();
593 ············this.ResumeLayout(false);
594
595 ········}
596 ········#endregion
597
598 ········private void chkActivateAddIn_CheckedChanged(object sender, System.EventArgs e)
599 ········{
600 ············EnableAddin(this.chkActivateAddIn.Checked);
601 ········}
602
603
604 ········void EnableAddin(bool enabled)
605 ········{
606 ············if (project.Kind == "{E24C65DC-7377-472b-9ABA-BC803B73C61A}")
607 ················chkActivateEnhancer.Enabled = false;
608 ············else
609 ················chkActivateEnhancer.Enabled = enabled;
610 ········}
611
612 ········private void ConfigurationDialog_Load(object sender, System.EventArgs e)
613 ········{
614 ············try
615 ············{
616 ················ConfigurationOptions options = new ConfigurationOptions(project);
617 ················this.Text = "NDO Configuration - " + project.Name;
618 ················chkIncludeTypecodes.Checked = options.IncludeTypecodes;
619 ················chkDropExistingElements.Checked = options.DropExistingElements;
620 ················chkGenerateFkConstraints.Checked = options.GenerateConstraints;
621 ················chkVerboseMode.Checked = options.VerboseMode;
622 ················chkChangeEvents.Checked = options.GenerateChangeEvents;
623 ················chkActivateAddIn.Checked = options.EnableAddIn;
624 ················chkActivateEnhancer.Checked = options.EnableEnhancer;
625 ················chkMappingNew.Checked = options.NewMapping;
626 ················if (chkActivateAddIn.Checked == false)
627 ····················EnableAddin(false);
628 ················chkGenerateSQLScript.Checked = options.GenerateSQL;
629 ················txtSchemaVersion.Text = options.SchemaVersion;
630 ················if (string.IsNullOrEmpty(txtSchemaVersion.Text))
631 ····················txtSchemaVersion.Text = "1.0";
632 ················this.chkUseTimeStamps.Checked = options.UseTimeStamps;
633 ················int i = 0;
634 ················this.cbSqlDialect.Items.Clear();
635 ················int currentDialectIndex = -1;
636
637 ················foreach (string s in NdoUIProviderFactory.Instance.Keys)
638 ················{
639 ····················this.cbSqlDialect.Items.Add(s);
640 ····················if (options.SQLScriptLanguage == s)
641 ························currentDialectIndex = i;
642 ····················i++;
643 ················}
644 ················if (currentDialectIndex > -1)
645 ····················cbSqlDialect.SelectedIndex = currentDialectIndex;
646
647 ················// Must be initialized after changing the cbSqlDialect index
648 ················txtConnectionString.Text = options.DefaultConnection;
649 ················txtTargetMappingFileName.Text = options.TargetMappingFileName;
650 ················txtDbOwner.Text = options.DatabaseOwner;
651 ················chkActivateAddIn_CheckedChanged(null, EventArgs.Empty);
652 ················chkGenerateSQLScript_CheckedChanged(null, EventArgs.Empty);
653 ················if (options.Utf8Encoding)
654 ····················radioUtf8Encoding.Checked = true;
655 ················else
656 ····················radioDefaultEncoding.Checked = true;
657 ················if (project.Kind == "{E24C65DC-7377-472b-9ABA-BC803B73C61A}")
658 ····················this.chkActivateEnhancer.Enabled = false;
659
660 ················CheckEnabledStateForLoadProviderButton();
661 ············}
662 ············catch (Exception ex)
663 ············{
664 #if !DEBUG
665 ················MessageBox.Show(ex.Message, "NDO Configuration");
666 #else
667 ················MessageBox.Show(ex.ToString(), "NDO Configuration");
668 #endif
669 ············}
670 ········}
671
672 ········private void btnPresetLibrary_Click(object sender, System.EventArgs e)
673 ········{
674 //············ConfigurationOptions options = new ConfigurationOptions( project );
675 ············try
676 ············{
677 ················EnableCheckBoxes();
678
679 ················this.chkVerboseMode.Checked = false;
680 ················this.chkActivateAddIn.Checked = true;
681 ················this.chkActivateEnhancer.Checked = true;
682 ················this.chkMappingNew.Checked = false;
683 ················this.chkChangeEvents.Checked = false;
684 ················this.chkIncludeTypecodes.Checked = false;
685 ················this.chkGenerateFkConstraints.Checked = false;
686 ················this.chkDropExistingElements.Checked = false;
687 ················this.chkUseTimeStamps.Checked = false;····
688 ················this.txtDbOwner.Text = "";
689 ················this.chkGenerateSQLScript.Checked = false;
690 ················this.txtSchemaVersion.Text = "";
691 ············}
692 ············catch (Exception ex)
693 ············{
694 ················ShowError(ex);
695 ············}
696 ········}
697
698
699 ········private void btnOK_Click(object sender, System.EventArgs e)
700 ········{
701 ············try
702 ············{
703 ················ConfigurationOptions options = new ConfigurationOptions( project );
704
705 ················string connType = options.SQLScriptLanguage;
706 ················string connName = options.DefaultConnection;
707 ················WriteBack(options);
708 ················if (options.SQLScriptLanguage != connType || options.DefaultConnection != connName)
709 ················{
710 string mappingFileName = this. projectDescription. CheckedMappingFileName;
711 ····················if (mappingFileName != null)
712 ····················{
713 ························NDOMapping mapping = new NDOMapping(mappingFileName);
714 ························bool connectionExists = false;
715 ························foreach (Connection conn in mapping.Connections)
716 ························{
717 ····························if (conn.Type == options.SQLScriptLanguage && conn.Name == options.DefaultConnection)
718 ····························{
719 ································connectionExists = true;
720 ································break;
721 ····························}
722 ························}
723 ························if (!connectionExists)
724 ························{
725 ····························if (MessageBox.Show("The database connection settings have been changed. Should NDO change the connection settings in the mapping file " + Path.GetFileName(mappingFileName) + " too?", "NDO Configuration", MessageBoxButtons.YesNo) == DialogResult.Yes)
726 ····························{
727 ································Connection conn = null;
728 ································if (mapping.Connections.Count() == 1)
729 ································{
730 ····································conn = (Connection)mapping.Connections.FirstOrDefault();
731 ································}
732 ································else
733 ································{
734 ····································conn = mapping.NewConnection(String.Empty, String.Empty);
735 ····································MessageBox.Show("Added a connection with the ID " + conn.ID, "NDO Configuration");
736 ································}
737 ································conn.Type = options.SQLScriptLanguage;
738 ································conn.Name = options.DefaultConnection;
739 ································mapping.Save();
740 ····························}
741 ························}
742 ····················}
743 ················}
744
745 ················if ( options.EnableAddIn )
746 ················{
747 ····················if ( !options.UseMsBuild )
748 ····················{
749 ························options.UseMsBuild = true;
750 ····················}
751 ····················GeneratePackageReference();
752 ················}
753
754 ················options.Save( this.projectDescription );
755 ············}
756 ············catch (Exception ex)
757 ············{
758 #if DEBUG
759 ················MessageBox.Show( "The following error occured while saving your options: " + ex.ToString(), "NDO Add-in" );
760 #else
761 ················MessageBox.Show("The following error occured while saving your options: " + ex.Message, "NDO Add-in");
762 #endif
763 ············}
764 ········}
765
766
767 ········void GeneratePackageReference()
768 ········{
769 ············try
770 ············{
771 ················IComponentModel componentModel;
772 ················var installerService = GetInstallerService( out componentModel );
773
774 ················if (!installerService.IsPackageInstalled( this.project, "ndo.dll" ))
775 ················{
776 ····················var installer = componentModel.GetService<IVsPackageInstaller>();
777 ····················installer.InstallPackage( null, this.project, "ndo.dll", (string)null, false );
778 ················}
779 ············}
780 ············catch (Exception ex)
781 ············{
782 ················MessageBox.Show( "Error while installing the ndo.dll package: " + ex.ToString() );
783 ············}
784 ········}
785
786 ········private static IVsPackageInstallerServices GetInstallerService( out IComponentModel componentModel )
787 ········{
788 ············componentModel = (IComponentModel)Package.GetGlobalService( typeof( SComponentModel ) );
789 ············var installerService = componentModel.GetService<IVsPackageInstallerServices>();
790 ············return installerService;
791 ········}
792
793 ········void ShowError(Exception ex)
794 ········{
795 ············MessageBox.Show("The following error occured: " + ex.Message, "NDO Add-in");
796 ········}
797
798 ········private void btnConnString_Click(object sender, System.EventArgs e)
799 ········{
800 ············try
801 ············{
802 ················string connType = cbSqlDialect.Text;
803 ················if (connType == string.Empty)
804 ····················connType = "SqlServer";
805 ················var provider = NdoUIProviderFactory.Instance[connType];
806 ················if (provider == null)
807 ················{
808 ····················MessageBox.Show("Can't find a NDO UI provider for the sql dialect " + connType);
809 ····················return;
810 ················}
811
812 ················string temp = this.txtConnectionString.Text;
813 ················NdoDialogResult r = provider.ShowConnectionDialog(ref temp);
814 ················if (r == NdoDialogResult.Cancel)
815 ····················return;
816 ················this.txtConnectionString.Text = temp;
817 ············}
818 ············catch (Exception ex)
819 ············{
820 ················ShowError(ex);
821 ············}
822 ········}
823
824
825 ········private void chkGenerateSQLScript_CheckedChanged(object sender, System.EventArgs e)
826 ········{
827 ············bool genSql = this.chkGenerateSQLScript.Checked;
828
829 ············this.cbSqlDialect.Enabled = genSql;
830 ············this.chkIncludeTypecodes.Enabled = genSql;
831 ············this.chkDropExistingElements.Enabled = genSql;
832 ············this.chkGenerateFkConstraints.Enabled = genSql;
833 ············this.radioUtf8Encoding.Enabled = genSql;
834 ············this.radioDefaultEncoding.Enabled = genSql;
835 ········}
836
837 ········private void EnableCheckBoxes()
838 ········{
839 ············foreach(Control c in this.Controls)
840 ············{
841 ················CheckBox cb = c as CheckBox;
842 ················if (c == null)
843 ····················continue;
844 ················c.Enabled = true;
845 ············}
846 ············if (this.project.Kind == "{E24C65DC-7377-472b-9ABA-BC803B73C61A}")
847 ················this.chkActivateEnhancer.Enabled = false;
848 ········}
849
850 ········private void btnPresetApp_Click(object sender, System.EventArgs e)
851 ········{
852 ············try
853 ············{
854 ················EnableCheckBoxes();
855 ················this.chkVerboseMode.Checked = false;
856 ················this.chkActivateAddIn.Checked = true;
857 ················this.chkActivateEnhancer.Checked = false;
858 ················this.chkMappingNew.Checked = false;
859 ················this.chkGenerateSQLScript.Checked = true;
860 ················this.chkChangeEvents.Checked = false;
861 ················this.chkIncludeTypecodes.Checked = false;
862 ················this.chkDropExistingElements.Checked = false;
863 ················this.chkGenerateFkConstraints.Checked = false;
864 ················this.txtConnectionString.Text = "";
865 ················this.chkUseTimeStamps.Checked = false;
866 ················this.txtDbOwner.Text = "";
867 ················this.txtSchemaVersion.Text = "1.0";
868 ················if (this.txtConnectionString.Text == string.Empty)
869 ····················this.btnConnString_Click(null, null);
870 ············}
871 ············catch (Exception ex)
872 ············{
873 ················ShowError(ex);
874 ············}
875 ········}
876
877 //········private void MakeNode(string name, object value, XmlNode parentNode, XmlDocument doc)
878 //········{
879 //············XmlElement el = doc.CreateElement(name);
880 //············parentNode.AppendChild(el);
881 //············if (value != null)
882 //················el.InnerText = value.ToString();
883 //········}
884
885 ········void WriteBack(ConfigurationOptions options)
886 ········{
887 ············options.EnableAddIn = chkActivateAddIn.Checked;
888 ············options.EnableEnhancer = chkActivateEnhancer.Checked;
889 ············options.IncludeTypecodes = chkIncludeTypecodes.Checked;
890 ············options.GenerateConstraints = chkGenerateFkConstraints.Checked;
891 ············options.DropExistingElements = chkDropExistingElements.Checked;
892 ············options.VerboseMode = chkVerboseMode.Checked;
893 ············options.NewMapping = chkMappingNew.Checked;
894 ············options.GenerateSQL = chkGenerateSQLScript.Checked;
895 ············options.DefaultConnection = txtConnectionString.Text;
896 ············options.TargetMappingFileName = txtTargetMappingFileName.Text;
897 ············options.GenerateChangeEvents = chkChangeEvents.Checked;
898 ············options.UseTimeStamps = chkUseTimeStamps.Checked;
899 ············options.SQLScriptLanguage = this.cbSqlDialect.Text;
900 ············options.DatabaseOwner = this.txtDbOwner.Text;
901 ············options.Utf8Encoding = this.radioUtf8Encoding.Checked;
902 ············options.SchemaVersion = this.txtSchemaVersion.Text;
903 ········}
904
905 ········private void btnSaveAs_Click(object sender, System.EventArgs e)
906 ········{
907 ············try
908 ············{
909 ················string projDir = Path.GetDirectoryName(project.FullName);
910 ················SaveFileDialog sfd = new SaveFileDialog();
911 ················sfd.CheckFileExists = false;
912 ················sfd.DefaultExt = "xml";
913 ················sfd.Filter = "NDO Configuration Files (*.ndoproj)|*.ndoproj";
914 ················sfd.FileName = "EnhancerParameters.ndoproj";
915 ················sfd.InitialDirectory = projDir;
916 ················if (sfd.ShowDialog(this) != DialogResult.OK)
917 ····················return;
918
919 ················ConfigurationOptions options = new ConfigurationOptions(project);················
920 ················WriteBack(options);
921 ················options.SaveAs(sfd.FileName, this.projectDescription);
922 ············}
923 ············catch (Exception ex)
924 ············{
925 ················ShowError(ex);
926 ············}········
927 ········}
928
929 ········private void cbSqlDialect_SelectedIndexChanged(object sender, System.EventArgs e)
930 ········{
931 ············this.txtConnectionString.Text = string.Empty;
932 ············CheckEnabledStateForLoadProviderButton();
933 ········}
934
935 ········private void btnNewDatabase_Click(object sender, System.EventArgs e)
936 ········{
937 ············string connType = cbSqlDialect.Text;
938 ············if (connType == string.Empty)
939 ················connType = "SqlServer";
940 ············IDbUISupport provider = NdoUIProviderFactory.Instance[connType];
941 ············if (provider == null)
942 ············{
943 ················MessageBox.Show("Can't find a NDO UI provider for the sql dialect " + connType);
944 ················return;
945 ············}
946 ············object necessaryData = null;
947 ············try
948 ············{
949 ················if (provider.ShowCreateDbDialog(ref necessaryData) == NdoDialogResult.Cancel)
950 ····················return;
951 ················this.txtConnectionString.Text = provider.CreateDatabase(necessaryData);
952 ············}
953 ············catch (Exception ex)
954 ············{
955 #if !DEBUG
956 ················MessageBox.Show("Can't construct the database: " + ex.Message);
957 #else
958 ················MessageBox.Show("Can't construct the database: " + ex.ToString());
959 #endif
960 ············}
961 ········}
962
963 ········private void chlbAssemblies_ItemCheck( object sender, ItemCheckEventArgs e )
964 ········{
965 ············this.references[e.Index].CheckState = e.NewValue;
966 ········}
967
968 ········private void btnInstallProvider_Click( object sender, EventArgs e )
969 ········{
970 ············try
971 ············{
972 ················string providerName = this.cbSqlDialect.Text;
973
974 ················if (string.IsNullOrEmpty( providerName ))
975 ················{
976 ····················MessageBox.Show( "Please choose a provider" );
977 ····················return;
978 ················}
979
980 ················IComponentModel componentModel;
981 ················var installerService = GetInstallerService( out componentModel );
982
983 ················string packageName = $"ndo.{providerName.ToLower()}";
984 ················if (!installerService.IsPackageInstalled( this.project, packageName ))
985 ················{
986 ····················var installer = componentModel.GetService<IVsPackageInstaller>();
987 ····················installer.InstallPackage( null, this.project, packageName, (string)null, false );
988 ················}
989
990 ················this.btnInstallProvider.Enabled = false;
991 ············}
992 ············catch (Exception ex)
993 ············{
994 ················MessageBox.Show( "Error while installing the ndo.dll package: " + ex.ToString() );
995 ············}
996 ········}
997 ····}
998 }
 
 
999
New Commit (33e9857)
1 //
2 // Copyright (c) 2002-2019 Mirko Matytschak
3 // (www.netdataobjects.de)
4 //
5 // Author: Mirko Matytschak
6 //
7 // Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
8 // documentation files (the "Software"), to deal in the Software without restriction, including without limitation
9 // the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the
10 // Software, and to permit persons to whom the Software is furnished to do so, subject to the following
11 // conditions:
12
13 // The above copyright notice and this permission notice shall be included in all copies or substantial portions
14 // of the Software.
15 //
16 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED
17 // TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
18 // THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
19 // CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
20 // DEALINGS IN THE SOFTWARE.
21
22
23 using System;
24 using System.Linq;
25 using System.IO;
26 using System.Windows.Forms;
27 using MessageBox = System. Windows. Forms. MessageBox;
28 using Project = EnvDTE.Project;
29 using System.Diagnostics;
 
30 using Microsoft.VisualStudio.ComponentModelHost;
31 using NuGet.VisualStudio;
32 using NDO.UISupport;
33
34 #pragma warning disable VSTHRD010 // Invoke single-threaded types on Main thread
35
36 namespace NDOVsPackage
37 {
38 ····/// <summary>
39 ····/// Summary description for ConfigurationDialog.
40 ····/// </summary>
41 ····internal class ConfigurationDialog : System.Windows.Forms.Form
42 ····{
43 ········private System.ComponentModel.IContainer components;
44
45 ········private Project project;
46 ········private System.Windows.Forms.ToolTip toolTip1;
47 ········private TabControl tabControl;
48 ········private TabPage tabPageGeneral;
49 ········private TextBox txtTargetMappingFileName;
50 ········private Label label1;
51 ········private CheckBox chkVerboseMode;
52 ········private TextBox txtSchemaVersion;
53 ········private Label label5;
54 ········private Button btnNewDatabase;
55 ········private Button btnSaveAs;
56 ········private Button btnPresetApp;
57 ········private TextBox txtDbOwner;
58 ········private TextBox txtConnectionString;
59 ········private Label label3;
60 ········private GroupBox groupBox1;
61 ········private CheckBox chkDropExistingElements;
62 ········private CheckBox chkGenerateFkConstraints;
63 ········private CheckBox chkIncludeTypecodes;
64 ········private RadioButton radioDefaultEncoding;
65 ········private RadioButton radioUtf8Encoding;
66 ········private Label label4;
67 ········private ComboBox cbSqlDialect;
68 ········private CheckBox chkGenerateSQLScript;
69 ········private CheckBox chkUseTimeStamps;
70 ········private CheckBox chkChangeEvents;
71 ········private Label label2;
72 ········private Button btnConnString;
73 ········private Button btnOK;
74 ········private Button btnPresetLibrary;
75 ········private Button btnCancel;
76 ········private CheckBox chkMappingNew;
77 ········private CheckBox chkActivateEnhancer;
78 ········private CheckBox chkActivateAddIn;
79 ········private TabPage tabPageAssemblies;
80 ········private Label label6;
81 ········private CheckedListBox chlbAssemblies;
82 ········private ProjectDescription projectDescription;
83 ········private Button btnInstallProvider;
84 ········private NDOReference[] references;
85
86 ········public ConfigurationDialog(Project project, ProjectDescription projectDescription)
87 ········{
88 ············try
89 ············{
90 ················this.project = project;
91 ················this.projectDescription = projectDescription;
92 ················this.projectDescription.BuildReferences();
93 ················this.projectDescription.FixDllState();
94 ················InitializeComponent();
95 ················var lbAssemblies = (ListBox)this.chlbAssemblies;
96 ················this.references = projectDescription.References.Values.ToArray();
97 ················lbAssemblies.DataSource = this.references;
98 ················lbAssemblies.DisplayMember = nameof( NDOReference.Name );
99 ················lbAssemblies.ValueMember = nameof( NDOReference.CheckState );
100 ················int i = 0;
101 ················foreach (var item in this.references)
102 ················{
103 ····················this.chlbAssemblies.SetItemCheckState( i++, item.CheckState );
104 ················}
105 ············}
106 ············catch (Exception ex)
107 ············{
108 ················Debug.WriteLine( ex.ToString() );
109 ············}
110 ········}
111
112 ········void CheckEnabledStateForLoadProviderButton()
113 ········{
114 ············string providerName = this.cbSqlDialect.Text;
115
116 ············if (string.IsNullOrEmpty( providerName ))
117 ············{
118 ················this.btnInstallProvider.Enabled = false;
119 ················return;
120 ············}
121
122 ············if (IsProviderInstalled(providerName))
123 ············{
124 ················this.btnInstallProvider.Enabled = false;
125 ················return;
126 ············}
127
128 ············this.btnInstallProvider.Enabled = true;
129 ········}
130
131 ········bool IsProviderInstalled(string providerName)
132 ········{
133 ············IComponentModel componentModel;
134 ············var installerService = GetInstallerService( out componentModel );
135
136 ············string packageName = $"ndo.{providerName.ToLower()}";
137 ············return installerService.IsPackageInstalled( this.project, packageName );
138 ········}
139
140 ········/// <summary>
141 ········/// Clean up any resources being used.
142 ········/// </summary>
143 ········protected override void Dispose( bool disposing )
144 ········{
145 ············if( disposing )
146 ············{
147 ················if(components != null)
148 ················{
149 ····················components.Dispose();
150 ················}
151 ············}
152 ············base.Dispose( disposing );
153 ········}
154
155 ········#region Windows Form Designer generated code
156 ········/// <summary>
157 ········/// Required method for Designer support - do not modify
158 ········/// the contents of this method with the code editor.
159 ········/// </summary>
160 ········private void InitializeComponent()
161 ········{
162 ············this.components = new System.ComponentModel.Container();
163 ············System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(ConfigurationDialog));
164 ············this.toolTip1 = new System.Windows.Forms.ToolTip(this.components);
165 ············this.chkVerboseMode = new System.Windows.Forms.CheckBox();
166 ············this.btnNewDatabase = new System.Windows.Forms.Button();
167 ············this.btnSaveAs = new System.Windows.Forms.Button();
168 ············this.btnPresetApp = new System.Windows.Forms.Button();
169 ············this.txtDbOwner = new System.Windows.Forms.TextBox();
170 ············this.txtConnectionString = new System.Windows.Forms.TextBox();
171 ············this.chkDropExistingElements = new System.Windows.Forms.CheckBox();
172 ············this.chkGenerateFkConstraints = new System.Windows.Forms.CheckBox();
173 ············this.chkIncludeTypecodes = new System.Windows.Forms.CheckBox();
174 ············this.radioDefaultEncoding = new System.Windows.Forms.RadioButton();
175 ············this.radioUtf8Encoding = new System.Windows.Forms.RadioButton();
176 ············this.cbSqlDialect = new System.Windows.Forms.ComboBox();
177 ············this.chkGenerateSQLScript = new System.Windows.Forms.CheckBox();
178 ············this.chkUseTimeStamps = new System.Windows.Forms.CheckBox();
179 ············this.chkChangeEvents = new System.Windows.Forms.CheckBox();
180 ············this.btnConnString = new System.Windows.Forms.Button();
181 ············this.btnPresetLibrary = new System.Windows.Forms.Button();
182 ············this.chkMappingNew = new System.Windows.Forms.CheckBox();
183 ············this.chkActivateEnhancer = new System.Windows.Forms.CheckBox();
184 ············this.chkActivateAddIn = new System.Windows.Forms.CheckBox();
185 ············this.tabControl = new System.Windows.Forms.TabControl();
186 ············this.tabPageGeneral = new System.Windows.Forms.TabPage();
187 ············this.txtTargetMappingFileName = new System.Windows.Forms.TextBox();
188 ············this.label1 = new System.Windows.Forms.Label();
189 ············this.txtSchemaVersion = new System.Windows.Forms.TextBox();
190 ············this.label5 = new System.Windows.Forms.Label();
191 ············this.label3 = new System.Windows.Forms.Label();
192 ············this.groupBox1 = new System.Windows.Forms.GroupBox();
193 ············this.btnInstallProvider = new System.Windows.Forms.Button();
194 ············this.label4 = new System.Windows.Forms.Label();
195 ············this.label2 = new System.Windows.Forms.Label();
196 ············this.tabPageAssemblies = new System.Windows.Forms.TabPage();
197 ············this.label6 = new System.Windows.Forms.Label();
198 ············this.chlbAssemblies = new System.Windows.Forms.CheckedListBox();
199 ············this.btnOK = new System.Windows.Forms.Button();
200 ············this.btnCancel = new System.Windows.Forms.Button();
201 ············this.tabControl.SuspendLayout();
202 ············this.tabPageGeneral.SuspendLayout();
203 ············this.groupBox1.SuspendLayout();
204 ············this.tabPageAssemblies.SuspendLayout();
205 ············this.SuspendLayout();
206 ············//
207 ············// chkVerboseMode
208 ············//
209 ············this.chkVerboseMode.Location = new System.Drawing.Point(21, 72);
210 ············this.chkVerboseMode.Name = "chkVerboseMode";
211 ············this.chkVerboseMode.Size = new System.Drawing.Size(238, 21);
212 ············this.chkVerboseMode.TabIndex = 51;
213 ············this.chkVerboseMode.Text = "Add-in Verbose Mode";
214 ············this.toolTip1.SetToolTip(this.chkVerboseMode, "Causes the Add-in and the Enhancer to show more information for debugging purpose" +
215 ········"s.");
216 ············//
217 ············// btnNewDatabase
218 ············//
219 ············this.btnNewDatabase.Location = new System.Drawing.Point(583, 313);
220 ············this.btnNewDatabase.Name = "btnNewDatabase";
221 ············this.btnNewDatabase.Size = new System.Drawing.Size(42, 21);
222 ············this.btnNewDatabase.TabIndex = 48;
223 ············this.btnNewDatabase.Text = "New";
224 ············this.toolTip1.SetToolTip(this.btnNewDatabase, "Create new database");
225 ············this.btnNewDatabase.Click += new System.EventHandler(this.btnNewDatabase_Click);
226 ············//
227 ············// btnSaveAs
228 ············//
229 ············this.btnSaveAs.DialogResult = System.Windows.Forms.DialogResult.OK;
230 ············this.btnSaveAs.Location = new System.Drawing.Point(249, 385);
231 ············this.btnSaveAs.Name = "btnSaveAs";
232 ············this.btnSaveAs.Size = new System.Drawing.Size(100, 39);
233 ············this.btnSaveAs.TabIndex = 47;
234 ············this.btnSaveAs.Text = "Save as...";
235 ············this.toolTip1.SetToolTip(this.btnSaveAs, "Save the options to be used in unattended builds with the stand-alone enhancer.");
236 ············this.btnSaveAs.Click += new System.EventHandler(this.btnSaveAs_Click);
237 ············//
238 ············// btnPresetApp
239 ············//
240 ············this.btnPresetApp.Location = new System.Drawing.Point(135, 385);
241 ············this.btnPresetApp.Name = "btnPresetApp";
242 ············this.btnPresetApp.Size = new System.Drawing.Size(100, 39);
243 ············this.btnPresetApp.TabIndex = 46;
244 ············this.btnPresetApp.Text = "Preset for Application";
245 ············this.toolTip1.SetToolTip(this.btnPresetApp, "Selects all settings used for applications which don\'t contain but reference pers" +
246 ········"istent types.");
247 ············this.btnPresetApp.Click += new System.EventHandler(this.btnPresetApp_Click);
248 ············//
249 ············// txtDbOwner
250 ············//
251 ············this.txtDbOwner.Location = new System.Drawing.Point(145, 126);
252 ············this.txtDbOwner.Name = "txtDbOwner";
253 ············this.txtDbOwner.Size = new System.Drawing.Size(160, 20);
254 ············this.txtDbOwner.TabIndex = 45;
255 ············this.toolTip1.SetToolTip(this.txtDbOwner, "Enter an owner name, if you like your tables to be written like owner.tablename.");
256 ············//
257 ············// txtConnectionString
258 ············//
259 ············this.txtConnectionString.Location = new System.Drawing.Point(18, 313);
260 ············this.txtConnectionString.Name = "txtConnectionString";
261 ············this.txtConnectionString.Size = new System.Drawing.Size(514, 20);
262 ············this.txtConnectionString.TabIndex = 39;
263 ············this.toolTip1.SetToolTip(this.txtConnectionString, "This string will be copied into the mapping file, if there doesn\'t exist a valid " +
264 ········"connection string. Otherwise it will be ignored.");
265 ············//
266 ············// chkDropExistingElements
267 ············//
268 ············this.chkDropExistingElements.Location = new System.Drawing.Point(13, 202);
269 ············this.chkDropExistingElements.Name = "chkDropExistingElements";
270 ············this.chkDropExistingElements.Size = new System.Drawing.Size(235, 21);
271 ············this.chkDropExistingElements.TabIndex = 24;
272 ············this.chkDropExistingElements.Text = "Insert Drop Statements in the Script";
273 ············this.toolTip1.SetToolTip(this.chkDropExistingElements, "If checked, NDO generates instructions to remove existing tables and constraints." +
274 ········"");
275 ············//
276 ············// chkGenerateFkConstraints
277 ············//
278 ············this.chkGenerateFkConstraints.Location = new System.Drawing.Point(13, 152);
279 ············this.chkGenerateFkConstraints.Name = "chkGenerateFkConstraints";
280 ············this.chkGenerateFkConstraints.Size = new System.Drawing.Size(235, 21);
281 ············this.chkGenerateFkConstraints.TabIndex = 23;
282 ············this.chkGenerateFkConstraints.Text = "Generate Foreign Key Constraints";
283 ············this.toolTip1.SetToolTip(this.chkGenerateFkConstraints, "If checked, NDO generates foreign key constraints for the relations in the databa" +
284 ········"se.");
285 ············//
286 ············// chkIncludeTypecodes
287 ············//
288 ············this.chkIncludeTypecodes.Location = new System.Drawing.Point(13, 177);
289 ············this.chkIncludeTypecodes.Name = "chkIncludeTypecodes";
290 ············this.chkIncludeTypecodes.Size = new System.Drawing.Size(235, 21);
291 ············this.chkIncludeTypecodes.TabIndex = 22;
292 ············this.chkIncludeTypecodes.Text = "Include Typecodes in the Script";
293 ············this.toolTip1.SetToolTip(this.chkIncludeTypecodes, "If checked, NDO generates instructions to build an additional table with the type" +
294 ········" code information.");
295 ············//
296 ············// radioDefaultEncoding
297 ············//
298 ············this.radioDefaultEncoding.Location = new System.Drawing.Point(13, 121);
299 ············this.radioDefaultEncoding.Name = "radioDefaultEncoding";
300 ············this.radioDefaultEncoding.Size = new System.Drawing.Size(140, 20);
301 ············this.radioDefaultEncoding.TabIndex = 21;
302 ············this.radioDefaultEncoding.Text = "Default Encoding";
303 ············this.toolTip1.SetToolTip(this.radioDefaultEncoding, "Check this option, if the script files should use windows encoding.");
304 ············//
305 ············// radioUtf8Encoding
306 ············//
307 ············this.radioUtf8Encoding.Checked = true;
308 ············this.radioUtf8Encoding.Location = new System.Drawing.Point(13, 99);
309 ············this.radioUtf8Encoding.Name = "radioUtf8Encoding";
310 ············this.radioUtf8Encoding.Size = new System.Drawing.Size(140, 21);
311 ············this.radioUtf8Encoding.TabIndex = 20;
312 ············this.radioUtf8Encoding.TabStop = true;
313 ············this.radioUtf8Encoding.Text = "UTF-8 Encoding";
314 ············this.toolTip1.SetToolTip(this.radioUtf8Encoding, "Check this option, if the script files should be UTF-8 encoded.");
315 ············//
316 ············// cbSqlDialect
317 ············//
318 ············this.cbSqlDialect.Location = new System.Drawing.Point(13, 70);
319 ············this.cbSqlDialect.Name = "cbSqlDialect";
320 ············this.cbSqlDialect.Size = new System.Drawing.Size(220, 21);
321 ············this.cbSqlDialect.TabIndex = 18;
322 ············this.toolTip1.SetToolTip(this.cbSqlDialect, "Choose an available NDO provider.");
323 ············this.cbSqlDialect.SelectedIndexChanged += new System.EventHandler(this.cbSqlDialect_SelectedIndexChanged);
324 ············//
325 ············// chkGenerateSQLScript
326 ············//
327 ············this.chkGenerateSQLScript.Location = new System.Drawing.Point(13, 21);
328 ············this.chkGenerateSQLScript.Name = "chkGenerateSQLScript";
329 ············this.chkGenerateSQLScript.Size = new System.Drawing.Size(187, 21);
330 ············this.chkGenerateSQLScript.TabIndex = 13;
331 ············this.chkGenerateSQLScript.Text = "Generate SQL Script";
332 ············this.toolTip1.SetToolTip(this.chkGenerateSQLScript, "If checked, NDO will create a script with DDL code, which can be used to construc" +
333 ········"t a database structure.");
334 ············this.chkGenerateSQLScript.CheckedChanged += new System.EventHandler(this.chkGenerateSQLScript_CheckedChanged);
335 ············//
336 ············// chkUseTimeStamps
337 ············//
338 ············this.chkUseTimeStamps.Location = new System.Drawing.Point(21, 153);
339 ············this.chkUseTimeStamps.Name = "chkUseTimeStamps";
340 ············this.chkUseTimeStamps.Size = new System.Drawing.Size(302, 20);
341 ············this.chkUseTimeStamps.TabIndex = 42;
342 ············this.chkUseTimeStamps.Text = "Generate Time Stamp Columns for each class";
343 ············this.toolTip1.SetToolTip(this.chkUseTimeStamps, "Check this option, if all tables should be protected by collistion detection.");
344 ············//
345 ············// chkChangeEvents
346 ············//
347 ············this.chkChangeEvents.Location = new System.Drawing.Point(21, 179);
348 ············this.chkChangeEvents.Name = "chkChangeEvents";
349 ············this.chkChangeEvents.Size = new System.Drawing.Size(302, 21);
350 ············this.chkChangeEvents.TabIndex = 41;
351 ············this.chkChangeEvents.Text = "Generate change events with Add Accessor";
352 ············this.toolTip1.SetToolTip(this.chkChangeEvents, "Check this option, if you intend to bind the UI directly to the accessor properti" +
353 ········"es of your persistent classes.");
354 ············//
355 ············// btnConnString
356 ············//
357 ············this.btnConnString.Location = new System.Drawing.Point(538, 313);
358 ············this.btnConnString.Name = "btnConnString";
359 ············this.btnConnString.Size = new System.Drawing.Size(42, 21);
360 ············this.btnConnString.TabIndex = 38;
361 ············this.btnConnString.Text = "...";
362 ············this.toolTip1.SetToolTip(this.btnConnString, "Enter existing database connection");
363 ············this.btnConnString.Click += new System.EventHandler(this.btnConnString_Click);
364 ············//
365 ············// btnPresetLibrary
366 ············//
367 ············this.btnPresetLibrary.Location = new System.Drawing.Point(21, 385);
368 ············this.btnPresetLibrary.Name = "btnPresetLibrary";
369 ············this.btnPresetLibrary.Size = new System.Drawing.Size(100, 39);
370 ············this.btnPresetLibrary.TabIndex = 36;
371 ············this.btnPresetLibrary.Text = "Preset for Library";
372 ············this.toolTip1.SetToolTip(this.btnPresetLibrary, "Selects all settings necessary for projects containing persistent types.");
373 ············this.btnPresetLibrary.Click += new System.EventHandler(this.btnPresetLibrary_Click);
374 ············//
375 ············// chkMappingNew
376 ············//
377 ············this.chkMappingNew.Location = new System.Drawing.Point(21, 99);
378 ············this.chkMappingNew.Name = "chkMappingNew";
379 ············this.chkMappingNew.Size = new System.Drawing.Size(272, 21);
380 ············this.chkMappingNew.TabIndex = 34;
381 ············this.chkMappingNew.Text = "Always Generate a new mapping File";
382 ············this.toolTip1.SetToolTip(this.chkMappingNew, "Choose this options, if NDO should discard and rebuild all mapping information.");
383 ············//
384 ············// chkActivateEnhancer
385 ············//
386 ············this.chkActivateEnhancer.Location = new System.Drawing.Point(21, 46);
387 ············this.chkActivateEnhancer.Name = "chkActivateEnhancer";
388 ············this.chkActivateEnhancer.Size = new System.Drawing.Size(188, 20);
389 ············this.chkActivateEnhancer.TabIndex = 33;
390 ············this.chkActivateEnhancer.Text = "Activate enhancer";
391 ············this.toolTip1.SetToolTip(this.chkActivateEnhancer, "Choose this option, if your project contains persistent types.");
392 ············//
393 ············// chkActivateAddIn
394 ············//
395 ············this.chkActivateAddIn.Location = new System.Drawing.Point(21, 19);
396 ············this.chkActivateAddIn.Name = "chkActivateAddIn";
397 ············this.chkActivateAddIn.Size = new System.Drawing.Size(188, 21);
398 ············this.chkActivateAddIn.TabIndex = 32;
399 ············this.chkActivateAddIn.Text = "Activate NDO AddIn";
400 ············this.toolTip1.SetToolTip(this.chkActivateAddIn, "Choose this options, if your project contains or references persistent types.");
401 ············this.chkActivateAddIn.Click += new System.EventHandler(this.chkActivateAddIn_CheckedChanged);
402 ············//
403 ············// tabControl
404 ············//
405 ············this.tabControl.Controls.Add(this.tabPageGeneral);
406 ············this.tabControl.Controls.Add(this.tabPageAssemblies);
407 ············this.tabControl.Dock = System.Windows.Forms.DockStyle.Top;
408 ············this.tabControl.Location = new System.Drawing.Point(0, 0);
409 ············this.tabControl.Name = "tabControl";
410 ············this.tabControl.SelectedIndex = 0;
411 ············this.tabControl.Size = new System.Drawing.Size(661, 374);
412 ············this.tabControl.TabIndex = 0;
413 ············//
414 ············// tabPageGeneral
415 ············//
416 ············this.tabPageGeneral.Controls.Add(this.txtTargetMappingFileName);
417 ············this.tabPageGeneral.Controls.Add(this.label1);
418 ············this.tabPageGeneral.Controls.Add(this.chkVerboseMode);
419 ············this.tabPageGeneral.Controls.Add(this.txtSchemaVersion);
420 ············this.tabPageGeneral.Controls.Add(this.label5);
421 ············this.tabPageGeneral.Controls.Add(this.btnNewDatabase);
422 ············this.tabPageGeneral.Controls.Add(this.txtDbOwner);
423 ············this.tabPageGeneral.Controls.Add(this.txtConnectionString);
424 ············this.tabPageGeneral.Controls.Add(this.label3);
425 ············this.tabPageGeneral.Controls.Add(this.groupBox1);
426 ············this.tabPageGeneral.Controls.Add(this.chkUseTimeStamps);
427 ············this.tabPageGeneral.Controls.Add(this.chkChangeEvents);
428 ············this.tabPageGeneral.Controls.Add(this.label2);
429 ············this.tabPageGeneral.Controls.Add(this.btnConnString);
430 ············this.tabPageGeneral.Controls.Add(this.chkMappingNew);
431 ············this.tabPageGeneral.Controls.Add(this.chkActivateEnhancer);
432 ············this.tabPageGeneral.Controls.Add(this.chkActivateAddIn);
433 ············this.tabPageGeneral.Location = new System.Drawing.Point(4, 22);
434 ············this.tabPageGeneral.Name = "tabPageGeneral";
435 ············this.tabPageGeneral.Padding = new System.Windows.Forms.Padding(3);
436 ············this.tabPageGeneral.Size = new System.Drawing.Size(653, 348);
437 ············this.tabPageGeneral.TabIndex = 0;
438 ············this.tabPageGeneral.Text = "General";
439 ············this.tabPageGeneral.UseVisualStyleBackColor = true;
440 ············//
441 ············// txtTargetMappingFileName
442 ············//
443 ············this.txtTargetMappingFileName.Location = new System.Drawing.Point(145, 245);
444 ············this.txtTargetMappingFileName.Name = "txtTargetMappingFileName";
445 ············this.txtTargetMappingFileName.Size = new System.Drawing.Size(160, 20);
446 ············this.txtTargetMappingFileName.TabIndex = 53;
447 ············//
448 ············// label1
449 ············//
450 ············this.label1.Location = new System.Drawing.Point(18, 246);
451 ············this.label1.Name = "label1";
452 ············this.label1.Size = new System.Drawing.Size(121, 21);
453 ············this.label1.TabIndex = 52;
454 ············this.label1.Text = "Mapping File Name";
455 ············//
456 ············// txtSchemaVersion
457 ············//
458 ············this.txtSchemaVersion.Location = new System.Drawing.Point(145, 219);
459 ············this.txtSchemaVersion.Name = "txtSchemaVersion";
460 ············this.txtSchemaVersion.Size = new System.Drawing.Size(160, 20);
461 ············this.txtSchemaVersion.TabIndex = 50;
462 ············//
463 ············// label5
464 ············//
465 ············this.label5.Location = new System.Drawing.Point(18, 220);
466 ············this.label5.Name = "label5";
467 ············this.label5.Size = new System.Drawing.Size(121, 21);
468 ············this.label5.TabIndex = 49;
469 ············this.label5.Text = "Schema Version";
470 ············//
471 ············// label3
472 ············//
473 ············this.label3.Location = new System.Drawing.Point(18, 128);
474 ············this.label3.Name = "label3";
475 ············this.label3.Size = new System.Drawing.Size(127, 21);
476 ············this.label3.TabIndex = 44;
477 ············this.label3.Text = "Owner / Schema Name";
478 ············//
479 ············// groupBox1
480 ············//
481 ············this.groupBox1.Controls.Add(this.btnInstallProvider);
482 ············this.groupBox1.Controls.Add(this.chkDropExistingElements);
483 ············this.groupBox1.Controls.Add(this.chkGenerateFkConstraints);
484 ············this.groupBox1.Controls.Add(this.chkIncludeTypecodes);
485 ············this.groupBox1.Controls.Add(this.radioDefaultEncoding);
486 ············this.groupBox1.Controls.Add(this.radioUtf8Encoding);
487 ············this.groupBox1.Controls.Add(this.label4);
488 ············this.groupBox1.Controls.Add(this.cbSqlDialect);
489 ············this.groupBox1.Controls.Add(this.chkGenerateSQLScript);
490 ············this.groupBox1.Location = new System.Drawing.Point(343, 21);
491 ············this.groupBox1.Name = "groupBox1";
492 ············this.groupBox1.Size = new System.Drawing.Size(265, 244);
493 ············this.groupBox1.TabIndex = 43;
494 ············this.groupBox1.TabStop = false;
495 ············this.groupBox1.Text = " SQL ";
496 ············//
497 ············// btnInstallProvider
498 ············//
499 ············this.btnInstallProvider.Location = new System.Drawing.Point(142, 102);
500 ············this.btnInstallProvider.Name = "btnInstallProvider";
501 ············this.btnInstallProvider.Size = new System.Drawing.Size(91, 22);
502 ············this.btnInstallProvider.TabIndex = 25;
503 ············this.btnInstallProvider.Text = "Install Provider";
504 ············this.btnInstallProvider.UseVisualStyleBackColor = true;
505 ············this.btnInstallProvider.Click += new System.EventHandler(this.btnInstallProvider_Click);
506 ············//
507 ············// label4
508 ············//
509 ············this.label4.Location = new System.Drawing.Point(13, 50);
510 ············this.label4.Name = "label4";
511 ············this.label4.Size = new System.Drawing.Size(200, 17);
512 ············this.label4.TabIndex = 19;
513 ············this.label4.Text = "SQL Dialect";
514 ············//
515 ············// label2
516 ············//
517 ············this.label2.Location = new System.Drawing.Point(18, 292);
518 ············this.label2.Name = "label2";
519 ············this.label2.Size = new System.Drawing.Size(360, 21);
520 ············this.label2.TabIndex = 40;
521 ············this.label2.Text = "Default Connection String";
522 ············//
523 ············// tabPageAssemblies
524 ············//
525 ············this.tabPageAssemblies.Controls.Add(this.label6);
526 ············this.tabPageAssemblies.Controls.Add(this.chlbAssemblies);
527 ············this.tabPageAssemblies.Location = new System.Drawing.Point(4, 22);
528 ············this.tabPageAssemblies.Name = "tabPageAssemblies";
529 ············this.tabPageAssemblies.Padding = new System.Windows.Forms.Padding(3);
530 ············this.tabPageAssemblies.Size = new System.Drawing.Size(653, 348);
531 ············this.tabPageAssemblies.TabIndex = 1;
532 ············this.tabPageAssemblies.Text = "Assemblies";
533 ············this.tabPageAssemblies.UseVisualStyleBackColor = true;
534 ············//
535 ············// label6
536 ············//
537 ············this.label6.AutoSize = true;
538 ············this.label6.Location = new System.Drawing.Point(10, 12);
539 ············this.label6.Name = "label6";
540 ············this.label6.Size = new System.Drawing.Size(328, 13);
541 ············this.label6.TabIndex = 1;
542 ············this.label6.Text = "Choose Assemblies which should be analyzed by the NDOEnhancer";
543 ············//
544 ············// chlbAssemblies
545 ············//
546 ············this.chlbAssemblies.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
547 ············| System.Windows.Forms.AnchorStyles.Left)
548 ············| System.Windows.Forms.AnchorStyles.Right)));
549 ············this.chlbAssemblies.FormattingEnabled = true;
550 ············this.chlbAssemblies.Location = new System.Drawing.Point(10, 39);
551 ············this.chlbAssemblies.Name = "chlbAssemblies";
552 ············this.chlbAssemblies.Size = new System.Drawing.Size(631, 289);
553 ············this.chlbAssemblies.TabIndex = 0;
554 ············this.chlbAssemblies.ItemCheck += new System.Windows.Forms.ItemCheckEventHandler(this.chlbAssemblies_ItemCheck);
555 ············//
556 ············// btnOK
557 ············//
558 ············this.btnOK.DialogResult = System.Windows.Forms.DialogResult.OK;
559 ············this.btnOK.Location = new System.Drawing.Point(363, 385);
560 ············this.btnOK.Name = "btnOK";
561 ············this.btnOK.Size = new System.Drawing.Size(100, 39);
562 ············this.btnOK.TabIndex = 37;
563 ············this.btnOK.Text = "OK";
564 ············this.btnOK.Click += new System.EventHandler(this.btnOK_Click);
565 ············//
566 ············// btnCancel
567 ············//
568 ············this.btnCancel.DialogResult = System.Windows.Forms.DialogResult.Cancel;
569 ············this.btnCancel.Location = new System.Drawing.Point(477, 385);
570 ············this.btnCancel.Name = "btnCancel";
571 ············this.btnCancel.Size = new System.Drawing.Size(100, 39);
572 ············this.btnCancel.TabIndex = 35;
573 ············this.btnCancel.Text = "Cancel";
574 ············//
575 ············// ConfigurationDialog
576 ············//
577 ············this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
578 ············this.ClientSize = new System.Drawing.Size(661, 439);
579 ············this.Controls.Add(this.btnSaveAs);
580 ············this.Controls.Add(this.btnPresetApp);
581 ············this.Controls.Add(this.btnOK);
582 ············this.Controls.Add(this.btnPresetLibrary);
583 ············this.Controls.Add(this.btnCancel);
584 ············this.Controls.Add(this.tabControl);
585 ············this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
586 ············this.Name = "ConfigurationDialog";
587 ············this.Text = "NDO Configuration";
588 ············this.Load += new System.EventHandler(this.ConfigurationDialog_Load);
589 ············this.tabControl.ResumeLayout(false);
590 ············this.tabPageGeneral.ResumeLayout(false);
591 ············this.tabPageGeneral.PerformLayout();
592 ············this.groupBox1.ResumeLayout(false);
593 ············this.tabPageAssemblies.ResumeLayout(false);
594 ············this.tabPageAssemblies.PerformLayout();
595 ············this.ResumeLayout(false);
596
597 ········}
598 ········#endregion
599
600 ········private void chkActivateAddIn_CheckedChanged(object sender, System.EventArgs e)
601 ········{
602 ············EnableAddin(this.chkActivateAddIn.Checked);
603 ········}
604
605
606 ········void EnableAddin(bool enabled)
607 ········{
608 ············if (project.Kind == "{E24C65DC-7377-472b-9ABA-BC803B73C61A}")
609 ················chkActivateEnhancer.Enabled = false;
610 ············else
611 ················chkActivateEnhancer.Enabled = enabled;
612 ········}
613
614 ········private void ConfigurationDialog_Load(object sender, System.EventArgs e)
615 ········{
616 ············try
617 ············{
618 ················ConfigurationOptions options = new ConfigurationOptions(project);
619 ················this.Text = "NDO Configuration - " + project.Name;
620 ················chkIncludeTypecodes.Checked = options.IncludeTypecodes;
621 ················chkDropExistingElements.Checked = options.DropExistingElements;
622 ················chkGenerateFkConstraints.Checked = options.GenerateConstraints;
623 ················chkVerboseMode.Checked = options.VerboseMode;
624 ················chkChangeEvents.Checked = options.GenerateChangeEvents;
625 ················chkActivateAddIn.Checked = options.EnableAddIn;
626 ················chkActivateEnhancer.Checked = options.EnableEnhancer;
627 ················chkMappingNew.Checked = options.NewMapping;
628 ················if (chkActivateAddIn.Checked == false)
629 ····················EnableAddin(false);
630 ················chkGenerateSQLScript.Checked = options.GenerateSQL;
631 ················txtSchemaVersion.Text = options.SchemaVersion;
632 ················if (string.IsNullOrEmpty(txtSchemaVersion.Text))
633 ····················txtSchemaVersion.Text = "1.0";
634 ················this.chkUseTimeStamps.Checked = options.UseTimeStamps;
635 ················int i = 0;
636 ················this.cbSqlDialect.Items.Clear();
637 ················int currentDialectIndex = -1;
638
639 ················foreach (string s in NdoUIProviderFactory.Instance.Keys)
640 ················{
641 ····················this.cbSqlDialect.Items.Add(s);
642 ····················if (options.SQLScriptLanguage == s)
643 ························currentDialectIndex = i;
644 ····················i++;
645 ················}
646 ················if (currentDialectIndex > -1)
647 ····················cbSqlDialect.SelectedIndex = currentDialectIndex;
648
649 ················// Must be initialized after changing the cbSqlDialect index
650 ················txtConnectionString.Text = options.DefaultConnection;
651 ················txtTargetMappingFileName.Text = options.TargetMappingFileName;
652 ················txtDbOwner.Text = options.DatabaseOwner;
653 ················chkActivateAddIn_CheckedChanged(null, EventArgs.Empty);
654 ················chkGenerateSQLScript_CheckedChanged(null, EventArgs.Empty);
655 ················if (options.Utf8Encoding)
656 ····················radioUtf8Encoding.Checked = true;
657 ················else
658 ····················radioDefaultEncoding.Checked = true;
659 ················if (project.Kind == "{E24C65DC-7377-472b-9ABA-BC803B73C61A}")
660 ····················this.chkActivateEnhancer.Enabled = false;
661
662 ················CheckEnabledStateForLoadProviderButton();
663 ············}
664 ············catch (Exception ex)
665 ············{
666 #if !DEBUG
667 ················MessageBox.Show(ex.Message, "NDO Configuration");
668 #else
669 ················MessageBox.Show(ex.ToString(), "NDO Configuration");
670 #endif
671 ············}
672 ········}
673
674 ········private void btnPresetLibrary_Click(object sender, System.EventArgs e)
675 ········{
676 //············ConfigurationOptions options = new ConfigurationOptions( project );
677 ············try
678 ············{
679 ················EnableCheckBoxes();
680
681 ················this.chkVerboseMode.Checked = false;
682 ················this.chkActivateAddIn.Checked = true;
683 ················this.chkActivateEnhancer.Checked = true;
684 ················this.chkMappingNew.Checked = false;
685 ················this.chkChangeEvents.Checked = false;
686 ················this.chkIncludeTypecodes.Checked = false;
687 ················this.chkGenerateFkConstraints.Checked = false;
688 ················this.chkDropExistingElements.Checked = false;
689 ················this.chkUseTimeStamps.Checked = false;····
690 ················this.txtDbOwner.Text = "";
691 ················this.chkGenerateSQLScript.Checked = false;
692 ················this.txtSchemaVersion.Text = "";
693 ············}
694 ············catch (Exception ex)
695 ············{
696 ················ShowError(ex);
697 ············}
698 ········}
699
700
701 ········private void btnOK_Click(object sender, System.EventArgs e)
702 ········{
703 ············try
704 ············{
705 ················ConfigurationOptions options = new ConfigurationOptions( project );
706
707 ················string connType = options.SQLScriptLanguage;
708 ················string connName = options.DefaultConnection;
709 ················WriteBack(options);
710 ················if (options.SQLScriptLanguage != connType || options.DefaultConnection != connName)
711 ················{
712 string mappingFileName = this. project. MappingFilePath( ) ;
713 ····················if (mappingFileName != null)
714 ····················{
715 ························NDOMapping mapping = new NDOMapping(mappingFileName);
716 ························bool connectionExists = false;
717 ························foreach (Connection conn in mapping.Connections)
718 ························{
719 ····························if (conn.Type == options.SQLScriptLanguage && conn.Name == options.DefaultConnection)
720 ····························{
721 ································connectionExists = true;
722 ································break;
723 ····························}
724 ························}
725 ························if (!connectionExists)
726 ························{
727 ····························if (MessageBox.Show("The database connection settings have been changed. Should NDO change the connection settings in the mapping file " + Path.GetFileName(mappingFileName) + " too?", "NDO Configuration", MessageBoxButtons.YesNo) == DialogResult.Yes)
728 ····························{
729 ································Connection conn = null;
730 ································if (mapping.Connections.Count() == 1)
731 ································{
732 ····································conn = (Connection)mapping.Connections.FirstOrDefault();
733 ································}
734 ································else
735 ································{
736 ····································conn = mapping.NewConnection(String.Empty, String.Empty);
737 ····································MessageBox.Show("Added a connection with the ID " + conn.ID, "NDO Configuration");
738 ································}
739 ································conn.Type = options.SQLScriptLanguage;
740 ································conn.Name = options.DefaultConnection;
741 ································mapping.Save();
742 ····························}
743 ························}
744 ····················}
745 ················}
746
747 ················if ( options.EnableAddIn )
748 ················{
749 ····················if ( !options.UseMsBuild )
750 ····················{
751 ························options.UseMsBuild = true;
752 ····················}
753 ····················GeneratePackageReference();
754 ················}
755
756 ················options.Save( this.projectDescription );
757 ············}
758 ············catch (Exception ex)
759 ············{
760 #if DEBUG
761 ················MessageBox.Show( "The following error occured while saving your options: " + ex.ToString(), "NDO Add-in" );
762 #else
763 ················MessageBox.Show("The following error occured while saving your options: " + ex.Message, "NDO Add-in");
764 #endif
765 ············}
766 ········}
767
768
769 ········void GeneratePackageReference()
770 ········{
771 ············try
772 ············{
773 ················IComponentModel componentModel;
774 ················var installerService = GetInstallerService( out componentModel );
775
776 ················if (!installerService.IsPackageInstalled( this.project, "ndo.dll" ))
777 ················{
778 ····················var installer = componentModel.GetService<IVsPackageInstaller>();
779 ····················installer.InstallPackage( null, this.project, "ndo.dll", (string)null, false );
780 ················}
781 ············}
782 ············catch (Exception ex)
783 ············{
784 ················MessageBox.Show( "Error while installing the ndo.dll package: " + ex.ToString() );
785 ············}
786 ········}
787
788 ········private static IVsPackageInstallerServices GetInstallerService( out IComponentModel componentModel )
789 ········{
790 ············componentModel = (IComponentModel)Package.GetGlobalService( typeof( SComponentModel ) );
791 ············var installerService = componentModel.GetService<IVsPackageInstallerServices>();
792 ············return installerService;
793 ········}
794
795 ········void ShowError(Exception ex)
796 ········{
797 ············MessageBox.Show("The following error occured: " + ex.Message, "NDO Add-in");
798 ········}
799
800 ········private void btnConnString_Click(object sender, System.EventArgs e)
801 ········{
802 ············try
803 ············{
804 ················string connType = cbSqlDialect.Text;
805 ················if (connType == string.Empty)
806 ····················connType = "SqlServer";
807 ················var provider = NdoUIProviderFactory.Instance[connType];
808 ················if (provider == null)
809 ················{
810 ····················MessageBox.Show("Can't find a NDO UI provider for the sql dialect " + connType);
811 ····················return;
812 ················}
813
814 ················string temp = this.txtConnectionString.Text;
815 ················NdoDialogResult r = provider.ShowConnectionDialog(ref temp);
816 ················if (r == NdoDialogResult.Cancel)
817 ····················return;
818 ················this.txtConnectionString.Text = temp;
819 ············}
820 ············catch (Exception ex)
821 ············{
822 ················ShowError(ex);
823 ············}
824 ········}
825
826
827 ········private void chkGenerateSQLScript_CheckedChanged(object sender, System.EventArgs e)
828 ········{
829 ············bool genSql = this.chkGenerateSQLScript.Checked;
830
831 ············this.cbSqlDialect.Enabled = genSql;
832 ············this.chkIncludeTypecodes.Enabled = genSql;
833 ············this.chkDropExistingElements.Enabled = genSql;
834 ············this.chkGenerateFkConstraints.Enabled = genSql;
835 ············this.radioUtf8Encoding.Enabled = genSql;
836 ············this.radioDefaultEncoding.Enabled = genSql;
837 ········}
838
839 ········private void EnableCheckBoxes()
840 ········{
841 ············foreach(Control c in this.Controls)
842 ············{
843 ················CheckBox cb = c as CheckBox;
844 ················if (c == null)
845 ····················continue;
846 ················c.Enabled = true;
847 ············}
848 ············if (this.project.Kind == "{E24C65DC-7377-472b-9ABA-BC803B73C61A}")
849 ················this.chkActivateEnhancer.Enabled = false;
850 ········}
851
852 ········private void btnPresetApp_Click(object sender, System.EventArgs e)
853 ········{
854 ············try
855 ············{
856 ················EnableCheckBoxes();
857 ················this.chkVerboseMode.Checked = false;
858 ················this.chkActivateAddIn.Checked = true;
859 ················this.chkActivateEnhancer.Checked = false;
860 ················this.chkMappingNew.Checked = false;
861 ················this.chkGenerateSQLScript.Checked = true;
862 ················this.chkChangeEvents.Checked = false;
863 ················this.chkIncludeTypecodes.Checked = false;
864 ················this.chkDropExistingElements.Checked = false;
865 ················this.chkGenerateFkConstraints.Checked = false;
866 ················this.txtConnectionString.Text = "";
867 ················this.chkUseTimeStamps.Checked = false;
868 ················this.txtDbOwner.Text = "";
869 ················this.txtSchemaVersion.Text = "1.0";
870 ················if (this.txtConnectionString.Text == string.Empty)
871 ····················this.btnConnString_Click(null, null);
872 ············}
873 ············catch (Exception ex)
874 ············{
875 ················ShowError(ex);
876 ············}
877 ········}
878
879 //········private void MakeNode(string name, object value, XmlNode parentNode, XmlDocument doc)
880 //········{
881 //············XmlElement el = doc.CreateElement(name);
882 //············parentNode.AppendChild(el);
883 //············if (value != null)
884 //················el.InnerText = value.ToString();
885 //········}
886
887 ········void WriteBack(ConfigurationOptions options)
888 ········{
889 ············options.EnableAddIn = chkActivateAddIn.Checked;
890 ············options.EnableEnhancer = chkActivateEnhancer.Checked;
891 ············options.IncludeTypecodes = chkIncludeTypecodes.Checked;
892 ············options.GenerateConstraints = chkGenerateFkConstraints.Checked;
893 ············options.DropExistingElements = chkDropExistingElements.Checked;
894 ············options.VerboseMode = chkVerboseMode.Checked;
895 ············options.NewMapping = chkMappingNew.Checked;
896 ············options.GenerateSQL = chkGenerateSQLScript.Checked;
897 ············options.DefaultConnection = txtConnectionString.Text;
898 ············options.TargetMappingFileName = txtTargetMappingFileName.Text;
899 ············options.GenerateChangeEvents = chkChangeEvents.Checked;
900 ············options.UseTimeStamps = chkUseTimeStamps.Checked;
901 ············options.SQLScriptLanguage = this.cbSqlDialect.Text;
902 ············options.DatabaseOwner = this.txtDbOwner.Text;
903 ············options.Utf8Encoding = this.radioUtf8Encoding.Checked;
904 ············options.SchemaVersion = this.txtSchemaVersion.Text;
905 ········}
906
907 ········private void btnSaveAs_Click(object sender, System.EventArgs e)
908 ········{
909 ············try
910 ············{
911 ················string projDir = Path.GetDirectoryName(project.FullName);
912 ················SaveFileDialog sfd = new SaveFileDialog();
913 ················sfd.CheckFileExists = false;
914 ················sfd.DefaultExt = "xml";
915 ················sfd.Filter = "NDO Configuration Files (*.ndoproj)|*.ndoproj";
916 ················sfd.FileName = "EnhancerParameters.ndoproj";
917 ················sfd.InitialDirectory = projDir;
918 ················if (sfd.ShowDialog(this) != DialogResult.OK)
919 ····················return;
920
921 ················ConfigurationOptions options = new ConfigurationOptions(project);················
922 ················WriteBack(options);
923 ················options.SaveAs(sfd.FileName, this.projectDescription);
924 ············}
925 ············catch (Exception ex)
926 ············{
927 ················ShowError(ex);
928 ············}········
929 ········}
930
931 ········private void cbSqlDialect_SelectedIndexChanged(object sender, System.EventArgs e)
932 ········{
933 ············this.txtConnectionString.Text = string.Empty;
934 ············CheckEnabledStateForLoadProviderButton();
935 ········}
936
937 ········private void btnNewDatabase_Click(object sender, System.EventArgs e)
938 ········{
939 ············string connType = cbSqlDialect.Text;
940 ············if (connType == string.Empty)
941 ················connType = "SqlServer";
942 ············IDbUISupport provider = NdoUIProviderFactory.Instance[connType];
943 ············if (provider == null)
944 ············{
945 ················MessageBox.Show("Can't find a NDO UI provider for the sql dialect " + connType);
946 ················return;
947 ············}
948 ············object necessaryData = null;
949 ············try
950 ············{
951 ················if (provider.ShowCreateDbDialog(ref necessaryData) == NdoDialogResult.Cancel)
952 ····················return;
953 ················this.txtConnectionString.Text = provider.CreateDatabase(necessaryData);
954 ············}
955 ············catch (Exception ex)
956 ············{
957 #if !DEBUG
958 ················MessageBox.Show("Can't construct the database: " + ex.Message);
959 #else
960 ················MessageBox.Show("Can't construct the database: " + ex.ToString());
961 #endif
962 ············}
963 ········}
964
965 ········private void chlbAssemblies_ItemCheck( object sender, ItemCheckEventArgs e )
966 ········{
967 ············this.references[e.Index].CheckState = e.NewValue;
968 ········}
969
970 ········private void btnInstallProvider_Click( object sender, EventArgs e )
971 ········{
972 ············try
973 ············{
974 ················string providerName = this.cbSqlDialect.Text;
975
976 ················if (string.IsNullOrEmpty( providerName ))
977 ················{
978 ····················MessageBox.Show( "Please choose a provider" );
979 ····················return;
980 ················}
981
982 ················IComponentModel componentModel;
983 ················var installerService = GetInstallerService( out componentModel );
984
985 ················string packageName = $"ndo.{providerName.ToLower()}";
986 ················if (!installerService.IsPackageInstalled( this.project, packageName ))
987 ················{
988 ····················var installer = componentModel.GetService<IVsPackageInstaller>();
989 ····················installer.InstallPackage( null, this.project, packageName, (string)null, false );
990 ················}
991
992 ················this.btnInstallProvider.Enabled = false;
993 ············}
994 ············catch (Exception ex)
995 ············{
996 ················MessageBox.Show( "Error while installing the ndo.dll package: " + ex.ToString() );
997 ············}
998 ········}
999 ····}
1000 }
1001
1002 #pragma warning restore VSTHRD010 // Invoke single-threaded types on Main thread
1003