-
Notifications
You must be signed in to change notification settings - Fork 71
Expand file tree
/
Copy pathInstance9Details.xaml.cs
More file actions
766 lines (639 loc) · 23.6 KB
/
Instance9Details.xaml.cs
File metadata and controls
766 lines (639 loc) · 23.6 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
using SIM.IO;
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.IO;
using System.IO.Compression;
using System.Linq;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Controls.Primitives;
using System.Xml;
using SIM.Adapters.SqlServer;
using SIM.Adapters.WebServer;
using SIM.Products;
using SIM.Tool.Base;
using SIM.Tool.Base.Pipelines;
using SIM.Tool.Base.Profiles;
using SIM.Tool.Base.Wizards;
using Sitecore.Diagnostics.Base;
using JetBrains.Annotations;
using Sitecore.Diagnostics.Logging;
using SIM.Extensions;
using SIM.IO.Real;
using SIM.Sitecore9Installer;
using SIM.Tool.Windows.Dialogs;
using SIM.Tool.Windows.UserControls.Helpers;
namespace SIM.Tool.Windows.UserControls.Install
{
[UsedImplicitly]
public partial class Instance9Details : IWizardStep, IFlowControl
{
#region Fields
[NotNull]
private readonly ICollection<string> _AllFrameworkVersions = Environment.Is64BitOperatingSystem ? new[]
{
"v2.0", "v2.0 32bit", "v4.0", "v4.0 32bit"
} : new[]
{
"v2.0", "v4.0"
};
private Window owner;
private InstallWizardArgs _InstallParameters = null;
private IEnumerable<Product> _StandaloneProducts;
// According to the following document the maximum length for a path in Windows systems is defined as 260 characters:
// https://docs.microsoft.com/en-us/windows/win32/fileio/naming-a-file
// To prevent possibility of additional characters in the full path while combining, the value is set to 250 characters.
private const int MaxFileSystemPathLength = 250;
#endregion
#region Constructors
public Instance9Details()
{
InitializeComponent();
}
#endregion
#region Public properties
public static bool InstallEverywhere
{
get
{
return WindowsSettings.AppInstallEverywhere.Value;
}
}
#endregion
#region Public Methods
public bool OnMovingBack(WizardArgs wizardArg)
{
return true;
}
public bool OnMovingNext(WizardArgs wizardArgs)
{
var productRevision = ProductRevision;
Assert.IsNotNull(productRevision, nameof(productRevision));
Product product = productRevision.SelectedValue as Product;
Assert.IsNotNull(product, nameof(product));
var name = GetValidWebsiteName();
if (name == null)
return false;
var connectionString = ProfileManager.GetConnectionString();
SqlServerManager.Instance.ValidateConnectionString(connectionString);
var licensePath = ProfileManager.Profile.License;
Assert.IsNotNull(licensePath, @"The license file isn't set in the Settings window");
FileSystem.FileSystem.Local.File.AssertExists(licensePath, "The {0} file is missing".FormatWith(licensePath));
var args = (Install9WizardArgs)wizardArgs;
args.Validate = this.runValidation.IsChecked.Value;
args.InstanceName = name;
args.InstanceProduct = product;
args.InstanceConnectionString = connectionString;
args.LicenseFileInfo = new FileInfo(licensePath);
args.Product = product;
SolrDefinition solr = this.Solrs.SelectedItem as SolrDefinition;
if (solr == null)
{
WindowHelper.ShowMessage("Please provide solr.");
return false;
}
args.SolrUrl = solr.Url; //this.solrUrl.Text;
args.SorlRoot = solr.Root; //this.solrRoot.Text;
args.ScriptRoot = System.IO.Path.Combine(Directory.GetParent(args.Product.PackagePath).FullName, System.IO.Path.GetFileNameWithoutExtension(args.Product.PackagePath));
if (!this.IsFilePathLengthValidInPackage(args.Product.PackagePath, args.ScriptRoot))
{
return false;
}
if (File.Exists(args.Product.PackagePath) && !IsWdpPackageValid(args))
{
WindowHelper.ShowMessage("The selected installation package is not supported. " +
"Please choose a package for 'On Premises' deployment.",
messageBoxImage: MessageBoxImage.Warning,
messageBoxButton: MessageBoxButton.OK
);
return false;
}
if (!Directory.Exists(args.ScriptRoot))
{
Directory.CreateDirectory(args.ScriptRoot);
WindowHelper.LongRunningTask(() => this.UnpackInstallationFiles(args), "Unpacking installation files.", wizardArgs.WizardWindow);
WindowHelper.LongRunningTask(() => InstallTasksHelper.CopyCustomSifConfig(args), "Copying custom SIF configuration files to the install folder.", wizardArgs.WizardWindow);
WindowHelper.LongRunningTask(() => InstallTasksHelper.AddUninstallTasks(args), "Add Uninstall tasks to the OOB config files.", wizardArgs.WizardWindow);
}
else
{
if (MessageBox.Show(string.Format("Path '{0}' already exists. Do you want to overwrite it?", args.ScriptRoot), "Overwrite?", MessageBoxButton.YesNo) == MessageBoxResult.Yes)
{
Directory.Delete(args.ScriptRoot, true);
Directory.CreateDirectory(args.ScriptRoot);
WindowHelper.LongRunningTask(() => this.UnpackInstallationFiles(args), "Unpacking installation files.", wizardArgs.WizardWindow);
WindowHelper.LongRunningTask(() => InstallTasksHelper.CopyCustomSifConfig(args), "Copying custom SIF configuration files to the install folder.", wizardArgs.WizardWindow);
WindowHelper.LongRunningTask(() => InstallTasksHelper.AddUninstallTasks(args), "Add Uninstall tasks to the OOB config files.", wizardArgs.WizardWindow);
}
}
string rootPath = this.LocationText.Text;
if (!args.ScriptsOnly)
{
if (string.IsNullOrWhiteSpace(rootPath))
{
WindowHelper.ShowMessage("Please specify location.");
return false;
}
if (!args.ScriptsOnly)
{
if (SIM.FileSystem.FileSystem.Local.Directory.Exists(rootPath))
{
if (Directory.EnumerateFileSystemEntries(rootPath).Any())
{
if (WindowHelper.ShowMessage("The folder with the same name already exists and is not empty. Would you like to delete it?", MessageBoxButton.OKCancel, MessageBoxImage.Question, MessageBoxResult.OK) == MessageBoxResult.OK)
{
SIM.FileSystem.FileSystem.Local.Directory.DeleteIfExists(rootPath, null);
SIM.FileSystem.FileSystem.Local.Directory.CreateDirectory(rootPath);
}
}
}
else
{
SIM.FileSystem.FileSystem.Local.Directory.CreateDirectory(rootPath);
}
}
}
Tasker tasker = new Tasker(args.ScriptRoot, Path.GetFileNameWithoutExtension(args.Product.PackagePath), rootPath);
InstallParam sqlServer = tasker.GlobalParams.FirstOrDefault(p => p.Name == "SqlServer");
if (sqlServer != null)
{
sqlServer.Value = args.InstanceConnectionString.DataSource;
}
InstallParam sqlAdminUser = tasker.GlobalParams.FirstOrDefault(p => p.Name == "SqlAdminUser");
if (sqlAdminUser != null)
{
sqlAdminUser.Value = args.InstanceConnectionString.UserID;
}
InstallParam sqlAdminPass = tasker.GlobalParams.FirstOrDefault(p => p.Name == "SqlAdminPassword");
if (sqlAdminPass != null)
{
sqlAdminPass.Value = args.InstanceConnectionString.Password;
}
InstallParam sqlDbPrefix = tasker.GlobalParams.FirstOrDefault(p => p.Name == "SqlDbPrefix");
if (sqlDbPrefix != null)
{
sqlDbPrefix.Value = args.InstanceName;
}
InstallParam licenseFile = tasker.GlobalParams.FirstOrDefault(p => p.Name == "LicenseFile");
if (licenseFile != null)
{
licenseFile.Value = args.LicenseFileInfo.FullName;
}
InstallParam solrRoot = tasker.GlobalParams.FirstOrDefault(p => p.Name == "SolrRoot");
if (solrRoot != null)
{
solrRoot.Value = args.SorlRoot;
}
InstallParam solrService = tasker.GlobalParams.FirstOrDefault(p => p.Name == "SolrService");
if (solrService != null && !string.IsNullOrEmpty(solr.Service))
{
solrService.Value = solr.Service; // this.SolrService.Text;
}
InstallParam solrUrl = tasker.GlobalParams.FirstOrDefault(p => p.Name == "SolrUrl");
if (solrUrl != null)
{
solrUrl.Value = args.SolrUrl;
}
args.ScriptsOnly = this.scriptsOnly.IsChecked ?? false;
args.Tasker = tasker;
VersionToSolr vts = ProfileManager.Profile.VersionToSolrMap.FirstOrDefault(s => s.Vesrion == product.ShortVersion);
if (vts == null)
{
vts = new VersionToSolr();
vts.Vesrion = product.ShortVersion;
ProfileManager.Profile.VersionToSolrMap.Add(vts);
}
vts.Solr = solr.Name;
ProfileManager.SaveChanges(ProfileManager.Profile);
return true;
}
private bool IsWdpPackageValid([NotNull] Install9WizardArgs args)
{
Assert.ArgumentNotNull(args, nameof(args));
Product product = args.Product;
Assert.IsNotNull(product, nameof(product));
RealZipFile zip = new RealZipFile(new RealFile(new RealFileSystem(), product.PackagePath));
IZipFileEntry[] entries = zip.Entries.GetEntries().ToArray();
string[] configFiles = entries.Where(e => e.Name.ToLowerInvariant().EndsWith(".zip") &&
e.Name.ToLowerInvariant().Contains("configuration files"))
.Select(e => e.Name)
.ToArray();
string[] scwdps = entries.Where(e => e.Name.ToLowerInvariant().EndsWith(".zip") &&
e.Name.ToLowerInvariant().Contains("(onprem)"))
.Select(e => e.Name)
.ToArray();
if (configFiles.Length > 0 && scwdps.Length > 0)
{
return true;
}
Log.Warn($"Unsupported WDP package was used. Name: '{args.ScriptRoot}', " +
$"config files: '{configFiles.Length}', " +
$"scwdps: '{scwdps.Length}'");
return false;
}
public void UnpackInstallationFiles(Install9WizardArgs args)
{
RealZipFile zip = new RealZipFile(new RealFile(new RealFileSystem(), args.Product.PackagePath));
zip.ExtractTo(new RealFolder(new RealFileSystem(), args.ScriptRoot));
if (args.InstanceProduct.DisplayName.Contains("Developer Workstation")) return; //don't execute further since all required files are already unzipped for SXA
string configFilesZipPath = Directory.GetFiles(args.ScriptRoot, "*Configuration files*.zip").First();
RealZipFile configFilesZip = new RealZipFile(new RealFile(new RealFileSystem(), configFilesZipPath));
configFilesZip.ExtractTo(new RealFolder(new RealFileSystem(), args.ScriptRoot));
}
private static string GetWebRootPath(string rootPath)
{
var webRootPath = Path.Combine(rootPath, "Website");
return webRootPath;
}
[CanBeNull]
private string GetValidWebsiteName()
{
var instanceName = InstanceName;
Assert.IsNotNull(instanceName, nameof(instanceName));
var name = instanceName.Text.EmptyToNull();
Assert.IsNotNull(name, @"Instance name isn't set");
if (!Uri.IsWellFormedUriString("https://" + name, UriKind.Absolute))
{
Alert($"The '{name}' site name contains special characters that are not allowed to generate URI.");
return null;
}
var websiteExists = WebServerManager.WebsiteExists(name);
if (websiteExists)
{
using (var context = WebServerManager.CreateContext())
{
var site = context.Sites.Single(s => s != null && s.Name.EqualsIgnoreCase(name));
var path = WebServerManager.GetWebRootPath(site);
if (FileSystem.FileSystem.Local.Directory.Exists(path))
{
Alert("The website with the same name already exists, please choose another instance name.");
return null;
}
if (
WindowHelper.ShowMessage(
$"A website with the name {name} already exists. Would you like to remove it?",
MessageBoxButton.OKCancel, MessageBoxImage.Asterisk) != MessageBoxResult.OK)
{
return null;
}
site.Delete();
context.CommitChanges();
}
}
websiteExists = WebServerManager.WebsiteExists(name);
Assert.IsTrue(!websiteExists, "The website with the same name already exists, please choose another instance name.");
return name;
}
#endregion
#region Methods
#region Protected methods
protected void Alert([NotNull] string message, [NotNull] params object[] args)
{
Assert.ArgumentNotNull(message, nameof(message));
Assert.ArgumentNotNull(args, nameof(args));
WindowHelper.ShowMessage(message.FormatWith(args), "Conflict is found", MessageBoxButton.OK, MessageBoxImage.Warning);
}
#endregion
#region Private methods
private void Init()
{
using (new ProfileSection("Initializing InstanceDetails", this))
{
DataContext = new Model();
_StandaloneProducts = ProductManager.StandaloneProducts.Where(p => int.Parse(p.ShortVersion) >= 90 && !p.IsSitecoreWdpPackage);
this.Solrs.DataContext = ProfileManager.Profile.Solrs;
}
}
private void ProductNameChanged([CanBeNull] object sender, [CanBeNull] SelectionChangedEventArgs e)
{
var productName = ProductName;
Assert.IsNotNull(productName, nameof(productName));
var grouping = productName.SelectedValue as IGrouping<string, Product>;
if (grouping == null)
{
return;
}
var productVersion = ProductVersion;
Assert.IsNotNull(productVersion, nameof(productVersion));
productVersion.DataContext = grouping.Where(x => x != null).GroupBy(p => p.ShortVersion).Where(x => x != null).OrderBy(p => Int32.Parse(p.Key));
SelectFirst(productVersion);
}
private void ProductRevisionChanged([CanBeNull] object sender, [CanBeNull] SelectionChangedEventArgs e)
{
using (new ProfileSection("Product revision changed", this))
{
var product = ProductRevision.SelectedValue as Product;
if (product == null)
{
return;
}
var name = product.DefaultInstanceName;
// Truncate the (WDP XP1 packages) string in case package name has similar format to Sitecore 10.2.0 rev. 006766 (WDP XP1 packages)
InstanceName.Text = name.Split()[0];
var frameworkVersions = new ObservableCollection<string>(_AllFrameworkVersions);
var m = product.Manifest;
if (m != null)
{
var node = (XmlElement)m.SelectSingleNode("/manifest/*/limitations");
if (node != null)
{
foreach (XmlElement limitation in node.ChildNodes)
{
var lname = limitation.Name;
switch (lname.ToLower())
{
case "framework":
{
var supportedVersions = limitation.SelectElements("supportedVersion");
if (supportedVersions != null)
{
ICollection<string> supportedVersionNames = supportedVersions.Select(supportedVersion => supportedVersion.InnerText).ToArray();
for (int i = frameworkVersions.Count - 1; i >= 0; i--)
{
if (!supportedVersionNames.Contains(frameworkVersions[i]))
{
frameworkVersions.RemoveAt(i);
}
}
}
break;
}
}
}
}
}
}
}
private void ProductVersionChanged([CanBeNull] object sender, [CanBeNull] SelectionChangedEventArgs e)
{
var productVersion = ProductVersion;
Assert.IsNotNull(productVersion, nameof(productVersion));
var grouping = productVersion.SelectedValue as IGrouping<string, Product>;
if (grouping == null)
{
return;
}
ProductRevision.DataContext = grouping.OrderBy(p => p.Revision);
SelectLast(ProductRevision);
var solrName = ProfileManager.Profile.VersionToSolrMap.FirstOrDefault(s => s.Vesrion == grouping.Key)?.Solr;
this.Solrs.SelectedItem = ((List<SolrDefinition>)Solrs.DataContext).FirstOrDefault(s => s.Name == solrName);
}
private void Select([NotNull] Selector element, [NotNull] string value)
{
Assert.ArgumentNotNull(element, nameof(element));
Assert.ArgumentNotNull(value, nameof(value));
if (element.Items.Count <= 0)
{
return;
}
for (int i = 0; i < element.Items.Count; ++i)
{
object item0 = element.Items[i];
IGrouping<string, Product> item1 = item0 as IGrouping<string, Product>;
if (item1 != null)
{
var key = item1.Key;
if (key.EqualsIgnoreCase(value))
{
element.SelectedIndex = i;
break;
}
}
else
{
Product item2 = item0 as Product;
if (item2 != null)
{
var key = item2.Revision;
if (key.EqualsIgnoreCase(value))
{
element.SelectedIndex = i;
break;
}
}
}
}
}
private void SelectByValue([NotNull] Selector element, string value)
{
Assert.ArgumentNotNull(element, nameof(element));
if (string.IsNullOrEmpty(value))
{
SelectLast(element);
return;
}
if (element.Items.Count > 0)
{
if (element.Items[0].GetType() == typeof(Product))
{
foreach (Product item in element.Items)
{
if (item.Name.EqualsIgnoreCase(value, true))
{
element.SelectedItem = item;
break;
}
if (item.Revision.EqualsIgnoreCase(value, true))
{
element.SelectedItem = item;
break;
}
}
}
else
{
foreach (var item in element.Items)
{
if (item is ContentControl)
{
if ((item as ContentControl).Content.ToString().EqualsIgnoreCase(value, true))
{
element.SelectedItem = item;
break;
}
}
if (item is string)
{
if ((item as string).EqualsIgnoreCase(value, true))
{
element.SelectedItem = item;
break;
}
}
}
}
}
}
private void SelectFirst([NotNull] Selector element)
{
Assert.ArgumentNotNull(element, nameof(element));
if (element.Items.Count > 0)
{
element.SelectedIndex = 0;
}
}
private void SelectLast([NotNull] Selector element)
{
Assert.ArgumentNotNull(element, nameof(element));
if (element.Items.Count > 0)
{
element.SelectedIndex = element.Items.Count - 1;
}
}
private void SelectProductByValue([CanBeNull] Selector element, [NotNull] string value)
{
Assert.ArgumentNotNull(value, nameof(value));
if (element == null)
{
return;
}
if (string.IsNullOrEmpty(value))
{
SelectLast(element);
return;
}
var items = element.Items;
Assert.IsNotNull(items, nameof(items));
if (items.Count > 0)
{
foreach (IGrouping<string, Product> item in items)
{
if (item.First().Name.EqualsIgnoreCase(value, true))
{
element.SelectedItem = item;
break;
}
if (item.First().TwoVersion.EqualsIgnoreCase(value, true))
{
element.SelectedItem = item;
break;
}
}
}
}
private void WindowLoaded(object sender, RoutedEventArgs e)
{
using (new ProfileSection("Window loaded", this))
{
var args = _InstallParameters;
Assert.IsNotNull(args, nameof(args));
var product = args.Product;
if (product != null)
{
return;
}
SelectProductByValue(ProductName, WindowsSettings.AppInstallationDefaultProduct.Value);
SelectProductByValue(ProductVersion, WindowsSettings.AppInstallationDefaultProductVersion.Value);
SelectByValue(ProductRevision, WindowsSettings.AppInstallationDefaultProductRevision.Value);
}
}
private bool IsFilePathLengthValidInPackage(string packagePath, string scriptRoot)
{
if (File.Exists(packagePath))
{
int maxAllowedFilePathLength = MaxFileSystemPathLength - scriptRoot.Length;
using (ZipArchive zipArchive = ZipFile.OpenRead(packagePath))
{
foreach (ZipArchiveEntry entry in zipArchive.Entries)
{
if (!(maxAllowedFilePathLength > entry.FullName.Length))
{
WindowHelper.ShowMessage("The full path length of some files in the package after unzipping is too long! Please change the path of the Local Repository folder in Settings, so it has less path length.");
return false;
}
}
}
}
else
{
WindowHelper.ShowMessage(string.Format("Please make sure that the \"{0}\" package exists.", packagePath));
return false;
}
return true;
}
#endregion
#endregion
#region Nested type: Model
public class Model
{
#region Fields
[CanBeNull]
[UsedImplicitly]
public readonly Product[] _Products = ProductManager.StandaloneProducts.ToArray();
[NotNull]
private string _Name;
#endregion
#region Properties
[NotNull]
[UsedImplicitly]
public string Name
{
get
{
return _Name;
}
set
{
Assert.IsNotNull(value.EmptyToNull(), "Name must not be empty");
_Name = value;
}
}
[UsedImplicitly]
public IGrouping<string, Product> SelectedProductGroup1 { get; set; }
#endregion
}
#endregion
#region IWizardStep Members
void IWizardStep.InitializeStep(WizardArgs wizardArgs)
{
Init();
this.owner = wizardArgs.WizardWindow;
ProductName.DataContext = _StandaloneProducts.GroupBy(p => p.Name);
var args = (InstallWizardArgs)wizardArgs;
_InstallParameters = args;
Product product = args.Product;
if (product != null)
{
Select(ProductName, product.Name);
Select(ProductVersion, product.ShortVersion);
Select(ProductRevision, product.Revision);
}
else
{
SelectFirst(ProductName);
}
var name = args.InstanceName;
if (!string.IsNullOrEmpty(name))
{
InstanceName.Text = name;
}
//this.LocationText.Text =Path.Combine(ProfileManager.Profile.InstancesFolder,args.InstanceName);
}
bool IWizardStep.SaveChanges(WizardArgs wizardArgs)
{
return true;
}
#endregion
private void LocationBtn_Click(object sender, RoutedEventArgs e)
{
WindowHelper.PickFolder("Choose location folder", this.LocationText, null);
}
private void AddSolr_Click(object sender, RoutedEventArgs e)
{
SolrDefinition solr = WindowHelper.ShowDialog<AddSolrDialog>(ProfileManager.Profile.Solrs, this.owner) as SolrDefinition;
if (solr != null)
{
if (!ProfileManager.Profile.Solrs.Contains(solr))
{
ProfileManager.Profile.Solrs.Add(solr);
ProfileManager.SaveChanges(ProfileManager.Profile);
}
// Refresh items in the Solrs Combobox
this.Solrs.DataContext = null;
this.Solrs.DataContext = ProfileManager.Profile.Solrs;
this.Solrs.SelectedItem = solr;
}
}
}
}