forked from Inedo/bmx-windowssdklegacy
-
Notifications
You must be signed in to change notification settings - Fork 0
/
WindowsSdkExtensionConfigurerEditor.cs
81 lines (71 loc) · 3.3 KB
/
WindowsSdkExtensionConfigurerEditor.cs
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
using System;
using Inedo.BuildMaster;
using Inedo.BuildMaster.Extensibility.Configurers.Extension;
using Inedo.BuildMaster.Web.Controls.Extensions;
using Inedo.Web.Controls;
namespace Inedo.BuildMasterExtensions.WindowsSdk
{
internal sealed class WindowsSdkExtensionConfigurerEditor : ExtensionConfigurerEditorBase
{
private ValidatingTextBox txtWindowsSdkPath;
private ValidatingTextBox txtFrameworkRuntimePath;
private ValidatingTextBox txtMSBuildToolsPath;
private ValidatingTextBox txtAzurePassword;
public override void InitializeDefaultValues()
{
bool bm45 = typeof(Util).Assembly.GetName().Version >= new Version(4, 5, 2);
if (!bm45)
this.BindToForm(new WindowsSdkExtensionConfigurer());
}
public override void BindToForm(ExtensionConfigurerBase extension)
{
var configurer = (WindowsSdkExtensionConfigurer)extension;
this.txtWindowsSdkPath.Text = configurer.WindowsSdkPath;
this.txtFrameworkRuntimePath.Text = configurer.FrameworkRuntimePath;
this.txtMSBuildToolsPath.Text = configurer.MSBuildToolsPath;
this.txtAzurePassword.Text = configurer.AzurePassword;
}
public override ExtensionConfigurerBase CreateFromForm()
{
return new WindowsSdkExtensionConfigurer
{
WindowsSdkPath = Util.NullIf(this.txtWindowsSdkPath.Text.Trim(), string.Empty),
FrameworkRuntimePath = Util.NullIf(this.txtFrameworkRuntimePath.Text.Trim(), string.Empty),
MSBuildToolsPath = Util.NullIf(this.txtMSBuildToolsPath.Text.Trim(), string.Empty),
AzurePassword = Util.NullIf(this.txtAzurePassword.Text.Trim(), string.Empty)
};
}
protected override void CreateChildControls()
{
bool bm45 = typeof(Util).Assembly.GetName().Version >= new Version(4, 5, 2);
this.txtWindowsSdkPath = new ValidatingTextBox
{
DefaultText = bm45 ? "latest version in registry" : null
};
this.txtFrameworkRuntimePath = new ValidatingTextBox
{
DefaultText = bm45 ? "latest installed version" : null
};
this.txtMSBuildToolsPath = new ValidatingTextBox
{
DefaultText = bm45 ? "latest installed tools path" : null
};
this.txtAzurePassword = new ValidatingTextBox();
this.Controls.Add(
new SlimFormField("Windows SDK path:", this.txtWindowsSdkPath)
{
HelpText = @"Example: C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A"
},
new SlimFormField(".NET runtime path:", this.txtFrameworkRuntimePath)
{
HelpText = @"Example: C:\Windows\Microsoft.NET\Framework64"
},
new SlimFormField("MSBuild tools path:", this.txtMSBuildToolsPath)
{
HelpText = @"Example: C:\Program Files (x86)\MSBuild\12.0\bin\amd64"
},
new SlimFormField("Azure password:", this.txtAzurePassword)
);
}
}
}