当前位置: 首页>>代码示例>>C#>>正文


C# IHost.GetDataObject方法代码示例

本文整理汇总了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;
        }
开发者ID:bperreault,项目名称:autox,代码行数:42,代码来源:Utilities.cs

示例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;
        }
开发者ID:bperreault,项目名称:autox,代码行数:41,代码来源:Utilities.cs

示例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;
        }
开发者ID:bperreault,项目名称:autox,代码行数:33,代码来源:Utilities.cs


注:本文中的IHost.GetDataObject方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。