How to override "Prompt" method in MshHostUserInterface?



I need help on overriding "Prompt" method in MshHostUserInterface.

public override Dictionary<string, MshObject> Prompt(string caption,
string message, Collection<FieldDescription> descriptions)
{
string Input = string.Empty;
Dictionary<string, MshObject> Output = new
Dictionary<string,MshObject>();
Type FieldType;
MshObject[] Field;
ArrayList InputArrayList = new ArrayList();
int i;

WriteLine(caption);
WriteLine(message);
foreach (FieldDescription FieldDesc in descriptions)
{
FieldType = Type.GetType(FieldDesc.TypeFullName);
if (FieldType.IsArray)
{
i = 0;
while (true)
{
Write(FieldDesc.Name + "[" + i.ToString() +
"]: ");
Input = ReadLine();
if (Input == string.Empty) break;
InputArrayList.Add(Input);
i++;
}
Field = new MshObject[i];

// Do I have to create a instance of System.Array based on
"FieldDesc.TypeFullName";
// Or just a MshObject[]

for (int j = 0; j < i ; j++)
{
Field[j] = new
MshObject((string)InputArrayList[j]);
}
Output.Add(FieldDesc.Name, new MshObject
(Field));
continue;
}
else
{
do
{
Write(FieldDesc.Name + ": ");
Input = ReadLine();
}
while (Input != string.Empty);
Output.Add(FieldDesc.Name, new
MshObject(Input));

// Do I have to create a instanse of object based on
"FieldDesc.TypeFullName"?
// for example, Type.GetConstructor() or something else?
// Or just a MshObject?


continue;
}
}
return Output;

}

.


Loading