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


C# XmlHelper.GetElements方法代码示例

本文整理汇总了C#中XmlHelper.GetElements方法的典型用法代码示例。如果您正苦于以下问题:C# XmlHelper.GetElements方法的具体用法?C# XmlHelper.GetElements怎么用?C# XmlHelper.GetElements使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在XmlHelper的用法示例。


在下文中一共展示了XmlHelper.GetElements方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: SetDefinition

        public void SetDefinition(System.Xml.XmlElement definition)
        {
            XmlHelper h = new XmlHelper(definition);
            _initialized = false;

            //Check Basic Tab
            chkBasic.Checked = CheckEnable(h.GetElement("Authentication/Basic"), true);
            cbHashProvider.Text = h.GetText("Authentication/Basic/PasswordHashProvider/@DriverClass");
            txtGetUserDataQuery.Text = h.GetText("Authentication/Basic/UserInfoStorage/DBSchema/GetUserDataQuery");
            txtGetUserRoleQuery.Text = h.GetText("Authentication/Basic/UserInfoStorage/DBSchema/GetUserRolesQuery");

            //Check Session Tab
            chkSession.Checked = h.TryGetBoolean("Authentication/Session/@Enabled", true);
            txtTimeout.Text = h.TryGetInteger("Authentication/Session/@Timeout", 20).ToString();

            //Check Passport Tab
            chkPassport.Checked = CheckEnable(h.GetElement("Authentication/Passport"), false);
            txtIssuer.Text = h.GetText("Authentication/Passport/Issuer/@Name");
            txtCertProvider.Text = h.GetText("Authentication/Passport/Issuer/CertificateProvider");
            cbALTable.Text = h.GetText("Authentication/Passport/AccountLinking/TableName");
            cboMappingField.Text = h.GetText("Authentication/Passport/AccountLinking/MappingField");
            cbUserNameField.Text = h.GetText("Authentication/Passport/AccountLinking/UserNameField");

            dgExtProp.Rows.Clear();
            foreach (XmlElement pe in h.GetElements("Authentication/Passport/AccountLinking/Properties/Property"))
            {
                int index = dgExtProp.Rows.Add();
                DataGridViewRow row = dgExtProp.Rows[index];
                row.Cells[colAlias.Name].Value = pe.GetAttribute("Alias");
                row.Cells[colDBField.Name].Value = pe.GetAttribute("Field");
            }

            CheckTabs();
            _initialized = true;
        }
开发者ID:lidonghao1116,项目名称:ProjectManager,代码行数:35,代码来源:AdvAuthEditor.cs

示例2: UDSHandler

        public UDSHandler(ProjectHandler project, XmlElement source)
        {
            Parent = project;
            Contracts = new List<ContractHandler>();
            AllContracts = new List<ContractHandler>();

            XmlHelper ph = new XmlHelper(project.Preference);
            List<string> list = new List<string>();
            foreach (XmlElement e in ph.GetElements("Property/Contract"))
            {
                string name = e.GetAttribute("Name");
                list.Add(name);
            }

            XmlHelper h = new XmlHelper(source);
            foreach (XmlElement contractElement in h.GetElements("Contract"))
            {
                ContractHandler ch = new ContractHandler(contractElement);

                if (list.Contains(ch.Name))
                    Contracts.Add(ch);

                AllContracts.Add(ch);
            }
        }
开发者ID:lidonghao1116,项目名称:ProjectManager,代码行数:25,代码来源:UDSHandler.cs

示例3: UDTHandler

        internal UDTHandler(ProjectHandler project, XmlElement source)
        {
            Parent = project;
            Tables = new List<UDTTable>();
            AllUDTTables = new List<UDTTable>();

            _allUDTs = new List<string>();

            XmlHelper h = new XmlHelper(source);

            XmlHelper ph = new XmlHelper(project.Preference);
            List<string> list = new List<string>();
            foreach (XmlElement e in ph.GetElements("Property/UDT"))
            {
                string name = e.GetAttribute("Name");
                list.Add(name.ToLower());
                _allUDTs.Add(name);
            }

            foreach (XmlElement tableElement in h.GetElements("TableName"))
            {
                UDTTable table = new UDTTable(tableElement.InnerText);
                if (list.Contains(table.Name.ToLower()))
                    Tables.Add(table);
                _allUDTs.Add(table.Name.ToLower());
                AllUDTTables.Add(table);
            }
        }
开发者ID:lidonghao1116,项目名称:ProjectManager,代码行数:28,代码来源:UDTHandler.cs

示例4: ListProjects

        internal List<string> ListProjects()
        {
            if (_projects != null)
                return _projects;

            XmlHelper req = new XmlHelper("<Request/>");
            req.AddElement(".", "Condition");
            req.AddElement("Condition", "Name", PROJECT_LIST_PS_NAME);
            Envelope evn = MainForm.LoginArgs.GreeningConnection.SendRequest("GetMySpace", new Envelope(req));
            XmlHelper rsp = new XmlHelper(evn.Body);

            _projects = new List<string>();

            if (rsp.GetElement("Space") == null)
            {
                req = new XmlHelper("<Request/>");
                req.AddElement(".", "Space");
                req.AddElement("Space", "Name", PROJECT_LIST_PS_NAME);
                XmlElement content = req.AddElement("Space", "Content");
                XmlCDataSection section = content.OwnerDocument.CreateCDataSection("<ProjectList/>");
                content.AppendChild(section);
                MainForm.LoginArgs.GreeningConnection.SendRequest("CreateSpace", new Envelope(req));
            }
            else
            {
                string content = rsp.GetText("Space/Content");
                XmlHelper h = new XmlHelper(content);

                foreach (XmlElement projectElement in h.GetElements("Project"))
                    _projects.Add(projectElement.GetAttribute("Name"));
            }
            return _projects;
        }
开发者ID:lidonghao1116,项目名称:ProjectManager,代码行数:33,代码来源:ProjectCollection.cs

示例5: TableEditor_Load

        private void TableEditor_Load(object sender, EventArgs e)
        {
            txtName.Text = TableNodeHandler.Table.Name;
            _tableContent = new XmlHelper(TableNodeHandler.Table.GetContent());

            dgFields.Rows.Clear();
            foreach (XmlElement field in _tableContent.GetElements("Field"))
            {
                int index = dgFields.Rows.Add();
                DataGridViewRow row = dgFields.Rows[index];
                row.Cells[colName.Name].Value = field.GetAttribute("Name");
                row.Cells[colDataType.Name].Value = field.GetAttribute("DataType");
                row.Cells[colIndexed.Name].Value = field.GetAttribute("Indexed");
                row.Cells[colAllowNull.Name].Value = field.GetAttribute("AllowNull");
                row.Cells[colDefault.Name].Value = field.GetAttribute("Default");

                row.Tag = field;

                if (UDTTable.IsDefaultField(field))
                    row.ReadOnly = true;
            }

            foreach (XmlElement uniq in _tableContent.GetElements("Unique"))
            {
                XmlHelper uniqHelper = new XmlHelper(uniq);
                string uniqFields = "";
                foreach (XmlElement field in uniqHelper.GetElements("FieldName"))
                    uniqFields += "+" + field.InnerText;

                if (!string.IsNullOrWhiteSpace(uniqFields))
                    uniqFields = uniqFields.Substring(1);

                int index = dgUniq.Rows.Add(uniq.Name);
                DataGridViewRow row = dgUniq.Rows[index];
                row.Cells[colUniqName.Name].Value = uniq.GetAttribute("Name");
                row.Cells[colFields.Name].Value = uniqFields;
            }

            foreach (XmlElement fk in _tableContent.GetElements("ForeignKey"))
            {
                this.AddForeignKey(fk);
            }

            this.TableNodeHandler.Table.Renamed += new EventHandler(Table_Renamed);
            _initialized = true;
        }
开发者ID:lidonghao1116,项目名称:ProjectManager,代码行数:46,代码来源:TableEditor.cs

示例6: FilterConditionForm_Load

 private void FilterConditionForm_Load(object sender, EventArgs e)
 {
     cboFields.Items.Clear();
     cboFields.Items.Add(string.Empty);
     XmlHelper h = new XmlHelper(_editForm.Table.GetContent());
     foreach (XmlElement field in h.GetElements("Field"))
         cboFields.Items.Add(field.GetAttribute("Name"));
     txtCondition.Document.LoadLanguageFromXml(Assembly.GetExecutingAssembly().GetManifestResourceStream("ProjectManager.ActiproSoftware.SQL.xml"), 0);
 }
开发者ID:lidonghao1116,项目名称:ProjectManager,代码行数:9,代码来源:FilterConditionForm.cs

示例7: ImportNode

        private void ImportNode(XmlElement element, TreeNode treeNode)
        {
            XmlHelper h = new XmlHelper(element);
            decimal size = h.TryGetDecimal("@Size", 0);
            treeNode.ToolTipText = "Size :" + CalcUtil.GetVisualSize(size);

            foreach (XmlElement dirElement in h.GetElements("Directory"))
            {
                TreeNode tn = treeNode.Nodes.Add(dirElement.GetAttribute("Name"));
                tn.Tag = dirElement;
                ImportNode(dirElement, tn);
                tn.ImageIndex = 0;
                tn.SelectedImageIndex = 1;
            }

            foreach (XmlElement fileElement in h.GetElements("File"))
            {
                string name = fileElement.GetAttribute("Name");
                FileInfo fileInfo = new FileInfo(name);
                string ext = fileInfo.Extension.ToLower();

                if (ext.StartsWith("."))
                    ext = ext.Remove(0, 1);

                TreeNode tn = treeNode.Nodes.Add(fileElement.GetAttribute("Name"));
                tn.Tag = fileElement;

                if (imgs.Images.ContainsKey(ext))
                {
                    tn.ImageKey = ext;
                    tn.SelectedImageKey = ext;
                }
                else
                {
                    tn.ImageIndex = 2;
                    tn.SelectedImageIndex = 2;
                }
                XmlHelper fh = new XmlHelper(fileElement);
                decimal fsize = fh.TryGetDecimal("@Size", 0);
                tn.ToolTipText = "Size :" + CalcUtil.GetVisualSize(fsize);
            }         
        }
开发者ID:lidonghao1116,项目名称:ProjectManager,代码行数:42,代码来源:FileUIEditor.cs

示例8: PackageHandler

        internal PackageHandler(ContractHandler contract, XmlElement packageDefinition)
        {
            this.Contract = contract;
            this.Name = packageDefinition.GetAttribute("Name");

            _service = new List<string>();

            XmlHelper ph = new XmlHelper(packageDefinition);
            foreach (XmlElement each in ph.GetElements("Service"))
            {
                string serviceName = each.GetAttribute("Name");
                _service.Add(serviceName);
            }
        }
开发者ID:lidonghao1116,项目名称:ProjectManager,代码行数:14,代码来源:PackageHandler.cs

示例9: OrderList

        internal OrderList(XmlElement orderElement)
        {
            this.Orders = new List<Order>();
            this.Name = string.Empty;
            this.Source = string.Empty;

            if (orderElement == null) return;

            this.Name = orderElement.GetAttribute("Name");
            this.Source = orderElement.GetAttribute("Source");
         
            XmlHelper h = new XmlHelper(orderElement);
            foreach (XmlElement xml in h.GetElements("Order"))
                Orders.Add(new Order(xml));
        }
开发者ID:lidonghao1116,项目名称:ProjectManager,代码行数:15,代码来源:OrderList.cs

示例10: btnSave_Click

        private void btnSave_Click(object sender, EventArgs e)
        {
            _dgView.Rows.Clear();

            XmlHelper h = new XmlHelper(this.xmlEditor1.Text);
            foreach (XmlElement element in h.GetElements("Command"))
            {
                string type = element.GetAttribute("Type");
                IUDTCommand cmd = UDTCmdProvider.GetCmd(type);
                cmd.Result = element;

                int index = _dgView.Rows.Add();
                DataGridViewRow row = _dgView.Rows[index];
                row.Tag = cmd;
                row.Cells["colType"].Value = cmd.Type;
                row.Cells["colDesc"].Value = cmd.Description;
            }
            this.Close();
        }
开发者ID:lidonghao1116,项目名称:ProjectManager,代码行数:19,代码来源:EditAllCmdForm.cs

示例11: FieldList

        internal FieldList(XmlElement fieldListElement)
        {
            Fields = new List<Field>();
            this.Name = string.Empty;       
            this.Source = string.Empty;

            if (fieldListElement == null)
                return;
            
            this.Name = fieldListElement.GetAttribute("Name");
            this.Source = fieldListElement.GetAttribute("Source");

           
            XmlHelper h = new XmlHelper(fieldListElement);
            foreach (XmlElement fieldElement in h.GetElements("Field"))
            {
                Field field = new Field(fieldElement);
                Fields.Add(field);
            }
        }
开发者ID:lidonghao1116,项目名称:ProjectManager,代码行数:20,代码来源:FieldList.cs

示例12: Load

        public void Load(XmlElement source)
        {
            Name = source.GetAttribute("Name");
            XmlHelper h = new XmlHelper(source);

            if (h.GetElement("Default") != null)
                DefaultValue = h.GetText("Default");
            else
                DefaultValue = null;

            Map = new Dictionary<string, string>();

            foreach (XmlElement e in h.GetElements("Item"))
            {
                string key = e.GetAttribute("If");
                string value = e.InnerText;

                Map.Add(key, value);
            }
        }
开发者ID:lidonghao1116,项目名称:ProjectManager,代码行数:20,代码来源:MappingConverter.cs

示例13: ListFields

        internal List<string> ListFields(string tableName)
        {
            if (PhysicalTables == null)
                PhysicalTables = MainForm.CurrentProject.ListPhysicalTables();

            List<string> fields = new List<string>();
            if (PhysicalTables.Contains(tableName))
            {
                XmlElement result = MainForm.CurrentProject.Query("select * from \"" + tableName + "\" where 1=0");
                XmlHelper h = new XmlHelper(result);
                foreach (XmlElement column in h.GetElements("Metadata/Column"))
                    fields.Add(column.GetAttribute("Field"));
            }
            else
            {
                tableName = tableName.Substring(1);

                foreach (UDTTable table in AllUDTTables)
                {
                    if (table.Name != tableName) continue;

                    XmlElement content = table.GetContent();
                    XmlHelper h = new XmlHelper(content);
                    foreach (XmlElement field in h.GetElements("Field"))
                        fields.Add(field.GetAttribute("Name"));
                }
            }
            return fields;
        }
开发者ID:lidonghao1116,项目名称:ProjectManager,代码行数:29,代码来源:UDTHandler.cs

示例14: dif_Completed

        void dif_Completed(object sender, ExportEventArgs e)
        {
            XmlDocument doc = new XmlDocument();
            doc.LoadXml(e.Result);

            XmlHelper h = new XmlHelper(doc.DocumentElement);
            List<XmlElement> list = new List<XmlElement>(h.GetElements("Command"));

            BatchImportForm bf = new BatchImportForm(list);
            bf.Completed += new EventHandler(bf_Completed);
            bf.ShowDialog();
        }
开发者ID:lidonghao1116,项目名称:ProjectManager,代码行数:12,代码来源:EditDataForm.cs

示例15: worker_RunWorkerCompleted

        void worker_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e)
        {
            dgData.Rows.Clear();
            dgData.Columns.Clear();

            XmlHelper rsp = e.Result as XmlHelper;

            string uidColumnName = string.Empty;
            string lastUpdateColName = string.Empty;

            foreach (XmlElement col in rsp.GetElements("Metadata/Column"))
            {
                string fieldName = col.GetAttribute("Field");
                string type = col.GetAttribute("Type");

                if (fieldName == "uid" && !string.IsNullOrWhiteSpace(uidColumnName))
                    continue;

                if (fieldName == "last_update" && !string.IsNullOrWhiteSpace(lastUpdateColName))
                    continue;

                string fieldName2 = fieldName + "\n" + type;
                string columnName = "col" + col.GetAttribute("Index");
                int index = dgData.Columns.Add(columnName, fieldName2);
                DataGridViewColumn column = dgData.Columns[index];
                column.Tag = col;

                if (fieldName == "uid")
                    uidColumnName = columnName;

                if (fieldName == "last_update")
                    lastUpdateColName = columnName;

                if (UDTTable.IsDefaultField(fieldName))
                    column.ReadOnly = true;
            }

            foreach (XmlElement record in rsp.GetElements("Record"))
            {
                int rowIndex = dgData.Rows.Add();
                DataGridViewRow row = dgData.Rows[rowIndex];
                row.HeaderCell.Value = rowIndex;

                XmlHelper h = new XmlHelper(record);
                foreach (XmlElement col in h.GetElements("Column"))
                {
                    string columnName = "col" + col.GetAttribute("Index");
                    string value = col.InnerText;

                    if (!dgData.Columns.Contains(columnName)) continue;

                    DataGridViewCell cell = row.Cells[columnName];
                    cell.Value = value;
                    cell.Tag = value;

                    if (columnName == uidColumnName)
                        row.Tag = value;
                }
            }
        }
开发者ID:lidonghao1116,项目名称:ProjectManager,代码行数:60,代码来源:EditDataForm.cs


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