Datei: NDOPackage/ConfigurationDialog.cs

Last Commit (bff399f)
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
New Commit (90ec57c)
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 ThreadHelper. JoinableTaskFactory. Run( async ( ) => await options. SaveAsync( this. projectDescription ) ) ;
757 ················
758 ············}
759 ············catch (Exception ex)
760 ············{
761 #if DEBUG
762 ················MessageBox.Show( "The following error occured while saving your options: " + ex.ToString(), "NDO Add-in" );
763 #else
764 ················MessageBox.Show("The following error occured while saving your options: " + ex.Message, "NDO Add-in");
765 #endif
766 ············}
767 ········}
768
769
770 ········void GeneratePackageReference()
771 ········{
772 ············try
773 ············{
774 ················IComponentModel componentModel;
775 ················var installerService = GetInstallerService( out componentModel );
776
777 ················if (!installerService.IsPackageInstalled( this.project, "ndo.dll" ))
778 ················{
779 ····················var installer = componentModel.GetService<IVsPackageInstaller>();
780 ····················installer.InstallPackage( null, this.project, "ndo.dll", (string)null, false );
781 ················}
782 ············}
783 ············catch (Exception ex)
784 ············{
785 ················MessageBox.Show( "Error while installing the ndo.dll package: " + ex.ToString() );
786 ············}
787 ········}
788
789 ········private static IVsPackageInstallerServices GetInstallerService( out IComponentModel componentModel )
790 ········{
791 ············componentModel = (IComponentModel)Package.GetGlobalService( typeof( SComponentModel ) );
792 ············var installerService = componentModel.GetService<IVsPackageInstallerServices>();
793 ············return installerService;
794 ········}
795
796 ········void ShowError(Exception ex)
797 ········{
798 ············MessageBox.Show("The following error occured: " + ex.Message, "NDO Add-in");
799 ········}
800
801 ········private void btnConnString_Click(object sender, System.EventArgs e)
802 ········{
803 ············try
804 ············{
805 ················string connType = cbSqlDialect.Text;
806 ················if (connType == string.Empty)
807 ····················connType = "SqlServer";
808 ················var provider = NdoUIProviderFactory.Instance[connType];
809 ················if (provider == null)
810 ················{
811 ····················MessageBox.Show("Can't find a NDO UI provider for the sql dialect " + connType);
812 ····················return;
813 ················}
814
815 ················string temp = this.txtConnectionString.Text;
816 ················NdoDialogResult r = provider.ShowConnectionDialog(ref temp);
817 ················if (r == NdoDialogResult.Cancel)
818 ····················return;
819 ················this.txtConnectionString.Text = temp;
820 ············}
821 ············catch (Exception ex)
822 ············{
823 ················ShowError(ex);
824 ············}
825 ········}
826
827
828 ········private void chkGenerateSQLScript_CheckedChanged(object sender, System.EventArgs e)
829 ········{
830 ············bool genSql = this.chkGenerateSQLScript.Checked;
831
832 ············this.cbSqlDialect.Enabled = genSql;
833 ············this.chkIncludeTypecodes.Enabled = genSql;
834 ············this.chkDropExistingElements.Enabled = genSql;
835 ············this.chkGenerateFkConstraints.Enabled = genSql;
836 ············this.radioUtf8Encoding.Enabled = genSql;
837 ············this.radioDefaultEncoding.Enabled = genSql;
838 ········}
839
840 ········private void EnableCheckBoxes()
841 ········{
842 ············foreach(Control c in this.Controls)
843 ············{
844 ················CheckBox cb = c as CheckBox;
845 ················if (c == null)
846 ····················continue;
847 ················c.Enabled = true;
848 ············}
849 ············if (this.project.Kind == "{E24C65DC-7377-472b-9ABA-BC803B73C61A}")
850 ················this.chkActivateEnhancer.Enabled = false;
851 ········}
852
853 ········private void btnPresetApp_Click(object sender, System.EventArgs e)
854 ········{
855 ············try
856 ············{
857 ················EnableCheckBoxes();
858 ················this.chkVerboseMode.Checked = false;
859 ················this.chkActivateAddIn.Checked = true;
860 ················this.chkActivateEnhancer.Checked = false;
861 ················this.chkMappingNew.Checked = false;
862 ················this.chkGenerateSQLScript.Checked = true;
863 ················this.chkChangeEvents.Checked = false;
864 ················this.chkIncludeTypecodes.Checked = false;
865 ················this.chkDropExistingElements.Checked = false;
866 ················this.chkGenerateFkConstraints.Checked = false;
867 ················this.txtConnectionString.Text = "";
868 ················this.chkUseTimeStamps.Checked = false;
869 ················this.txtDbOwner.Text = "";
870 ················this.txtSchemaVersion.Text = "1.0";
871 ················if (this.txtConnectionString.Text == string.Empty)
872 ····················this.btnConnString_Click(null, null);
873 ············}
874 ············catch (Exception ex)
875 ············{
876 ················ShowError(ex);
877 ············}
878 ········}
879
880 //········private void MakeNode(string name, object value, XmlNode parentNode, XmlDocument doc)
881 //········{
882 //············XmlElement el = doc.CreateElement(name);
883 //············parentNode.AppendChild(el);
884 //············if (value != null)
885 //················el.InnerText = value.ToString();
886 //········}
887
888 ········void WriteBack(ConfigurationOptions options)
889 ········{
890 ············options.EnableAddIn = chkActivateAddIn.Checked;
891 ············options.EnableEnhancer = chkActivateEnhancer.Checked;
892 ············options.IncludeTypecodes = chkIncludeTypecodes.Checked;
893 ············options.GenerateConstraints = chkGenerateFkConstraints.Checked;
894 ············options.DropExistingElements = chkDropExistingElements.Checked;
895 ············options.VerboseMode = chkVerboseMode.Checked;
896 ············options.NewMapping = chkMappingNew.Checked;
897 ············options.GenerateSQL = chkGenerateSQLScript.Checked;
898 ············options.DefaultConnection = txtConnectionString.Text;
899 ············options.TargetMappingFileName = txtTargetMappingFileName.Text;
900 ············options.GenerateChangeEvents = chkChangeEvents.Checked;
901 ············options.UseTimeStamps = chkUseTimeStamps.Checked;
902 ············options.SQLScriptLanguage = this.cbSqlDialect.Text;
903 ············options.DatabaseOwner = this.txtDbOwner.Text;
904 ············options.Utf8Encoding = this.radioUtf8Encoding.Checked;
905 ············options.SchemaVersion = this.txtSchemaVersion.Text;
906 ········}
907
908 ········private void btnSaveAs_Click(object sender, System.EventArgs e)
909 ········{
910 ············try
911 ············{
912 ················string projDir = Path.GetDirectoryName(project.FullName);
913 ················SaveFileDialog sfd = new SaveFileDialog();
914 ················sfd.CheckFileExists = false;
915 ················sfd.DefaultExt = "xml";
916 ················sfd.Filter = "NDO Configuration Files (*.ndoproj)|*.ndoproj";
917 ················sfd.FileName = "EnhancerParameters.ndoproj";
918 ················sfd.InitialDirectory = projDir;
919 ················if (sfd.ShowDialog(this) != DialogResult.OK)
920 ····················return;
921
922 ················ConfigurationOptions options = new ConfigurationOptions(project);················
923 ················WriteBack(options);
924 ················options.SaveAs(sfd.FileName, this.projectDescription);
925 ············}
926 ············catch (Exception ex)
927 ············{
928 ················ShowError(ex);
929 ············}········
930 ········}
931
932 ········private void cbSqlDialect_SelectedIndexChanged(object sender, System.EventArgs e)
933 ········{
934 ············this.txtConnectionString.Text = string.Empty;
935 ············CheckEnabledStateForLoadProviderButton();
936 ········}
937
938 ········private void btnNewDatabase_Click(object sender, System.EventArgs e)
939 ········{
940 ············string connType = cbSqlDialect.Text;
941 ············if (connType == string.Empty)
942 ················connType = "SqlServer";
943 ············IDbUISupport provider = NdoUIProviderFactory.Instance[connType];
944 ············if (provider == null)
945 ············{
946 ················MessageBox.Show("Can't find a NDO UI provider for the sql dialect " + connType);
947 ················return;
948 ············}
949 ············object necessaryData = null;
950 ············try
951 ············{
952 ················if (provider.ShowCreateDbDialog(ref necessaryData) == NdoDialogResult.Cancel)
953 ····················return;
954 ················this.txtConnectionString.Text = provider.CreateDatabase(necessaryData);
955 ············}
956 ············catch (Exception ex)
957 ············{
958 #if !DEBUG
959 ················MessageBox.Show("Can't construct the database: " + ex.Message);
960 #else
961 ················MessageBox.Show("Can't construct the database: " + ex.ToString());
962 #endif
963 ············}
964 ········}
965
966 ········private void chlbAssemblies_ItemCheck( object sender, ItemCheckEventArgs e )
967 ········{
968 ············this.references[e.Index].CheckState = e.NewValue;
969 ········}
970
971 ········private void btnInstallProvider_Click( object sender, EventArgs e )
972 ········{
973 ············try
974 ············{
975 ················string providerName = this.cbSqlDialect.Text;
976
977 ················if (string.IsNullOrEmpty( providerName ))
978 ················{
979 ····················MessageBox.Show( "Please choose a provider" );
980 ····················return;
981 ················}
982
983 ················IComponentModel componentModel;
984 ················var installerService = GetInstallerService( out componentModel );
985
986 ················string packageName = $"ndo.{providerName.ToLower()}";
987 ················if (!installerService.IsPackageInstalled( this.project, packageName ))
988 ················{
989 ····················var installer = componentModel.GetService<IVsPackageInstaller>();
990 ····················installer.InstallPackage( null, this.project, packageName, (string)null, false );
991 ················}
992
993 ················this.btnInstallProvider.Enabled = false;
994 ············}
995 ············catch (Exception ex)
996 ············{
997 ················MessageBox.Show( "Error while installing the ndo.dll package: " + ex.ToString() );
998 ············}
999 ········}
1000 ····}
1001 }
1002
1003 #pragma warning restore VSTHRD010 // Invoke single-threaded types on Main thread
1004