-
Notifications
You must be signed in to change notification settings - Fork 2
/
MDTLTIPSSampleControl.cs
104 lines (80 loc) · 2.75 KB
/
MDTLTIPSSampleControl.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
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace MDTLTIPSSampleAction
{
using Microsoft.BDD.Workbench;
using System.Reflection;
using System.IO;
public partial class MDTLTIPSSampleControl: TaskSequenceActionControl
{
#region Constructors
/// <summary>
/// This constructor is never used
/// </summary>
public MDTLTIPSSampleControl()
: base()
{
InitializeComponent();
}
/// <summary>
/// Initalize the Task Sequence Step within the MDT Console.
/// Load values into Form.
/// </summary>
public MDTLTIPSSampleControl( SmsPageData pageData )
: base(pageData)
{
InitializeComponent();
txtParentActionType.Text = "PowerShellGet action";
this.PackageName.Text = this.PropertyManager["Package"].StringValue;
// Set up the validators
this.ControlsValidator.AddControl(PackageName, new ControlDataStateEvaluator(ValidatePackageName), "* Required");
this.ControlsValidator.ValidateAll();
Initialized = true;
}
#endregion
#region Validators
protected ControlDataState ValidatePackageName()
{
if (String.IsNullOrEmpty(PackageName.Text.Trim()))
return ControlDataState.Invalid;
else
return ControlDataState.Valid;
}
#endregion
#region ApplyChanges
static public string GetResourceAsString(string ResourceName)
{
using (Stream stream = Assembly.GetExecutingAssembly().GetManifestResourceStream(ResourceName))
using (StreamReader reader = new StreamReader(stream))
return reader.ReadToEnd();
}
/// <summary>
/// User has pressed the "Apply" button.
/// Save data from the on screen forms to the PropertyManager
/// </summary>
protected override bool ApplyChanges(out Control errorControl, out bool showError)
{
// Check if there are any errors
if (HasError(out errorControl))
{
FixErrors();
errorControl = null;
showError = false;
return false;
}
// Save property changes
this.PropertyManager["Package"].StringValue = this.PackageName.Text;
return base.ApplyChanges(out errorControl, out showError);
}
#endregion ApplyChanges
#region Event handlers
#endregion
}
}