本文整理汇总了C#中IHost.GetDataObject方法的典型用法代码示例。如果您正苦于以下问题:C# IHost.GetDataObject方法的具体用法?C# IHost.GetDataObject怎么用?C# IHost.GetDataObject使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IHost
的用法示例。
在下文中一共展示了IHost.GetDataObject方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetRawUserData
public static Dictionary<string, UserData> GetRawUserData(string rawData, IHost host)
{
var dic = new Dictionary<string, UserData>();
if (!String.IsNullOrEmpty(rawData))
{
var dataStrings = rawData.Split(';');
foreach (string dataString in dataStrings)
{
if (String.IsNullOrEmpty(dataString))
continue;
var sData = host.GetDataObject(dataString);
//sometimes, some data has been deleted.
if (sData == null)
continue;
var dataSetName = sData.GetAttributeValue(Constants.NAME);
foreach (XAttribute xAttribute in sData.Attributes())
{
var name = xAttribute.Name.ToString();
if (Filter.Contains(name)) continue;
var dataValue = xAttribute.Value;
var data = new UserData
{
DataSet = dataSetName,
Name = name,
Value = dataValue,
DataSetId = dataString
};
//remove the duplicate value
if (dic.ContainsKey(name))
dic[name] = data;
else
{
dic.Add(name, data);
}
}
}
}
return dic;
}
示例2: GetStepsList
public static ArrayList GetStepsList(string textValue, ArrayList possibleAction, IHost host)
{
var ret = new ArrayList();
if (textValue != null)
{
var xSteps = XElement.Parse(textValue);
foreach (XElement element in xSteps.Descendants(Constants.STEP))
{
var uiId = element.GetAttributeValue(Constants.UI_ID);
if (String.IsNullOrEmpty(uiId)) continue;
var sData = host.GetDataObject(uiId);
if (sData == null) continue;
//var xData = sData.GetXElementFromDataObject();
var uiObject = element.GetAttributeValue(Constants.UI_OBJECT);
if (String.IsNullOrEmpty(uiObject)) continue;
var enable = Boolean.Parse(element.GetAttributeValue(Constants.ENABLE));
var defaultDataValue = element.GetAttributeValue(Constants.DEFAULT_DATA);
var dataName = element.GetAttributeValue(Constants.DATA);
var stepId = element.GetAttributeValue(Constants._ID);
var action = element.GetAttributeValue(Constants.ACTION) ?? "";
string xpath;
xpath = getXPath(element);
var step = new Step
{
_id = stepId,
Action = action,
UIId = uiId,
UIObject = uiObject,
Enable = enable,
DefaultData = defaultDataValue,
Data = dataName,
XPath = xpath,
PossibleAction = possibleAction
};
ret.Add(step);
}
}
return ret;
}
示例3: GetActualUserData
public static Dictionary<string, string> GetActualUserData(string rawData, IHost host)
{
var dic = new Dictionary<string, string>();
if (!String.IsNullOrEmpty(rawData))
{
var dataStrings = rawData.Split(';');
foreach (string dataString in dataStrings)
{
if (String.IsNullOrEmpty(dataString))
continue;
var sData = host.GetDataObject(dataString).ToString();
if (String.IsNullOrEmpty(sData)) continue;
var xData = XElement.Parse(sData);
foreach (XAttribute xAttribute in xData.Attributes())
{
var name = xAttribute.Name.ToString();
if (Filter.Contains(name)) continue;
var dataValue = xAttribute.Value;
var data = dataValue;
//remove the duplicate value
if (dic.ContainsKey(name))
dic[name] = data;
else
{
dic.Add(name, data);
}
}
}
}
return dic;
}