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


C# XmlHelper.GetElement方法代码示例

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


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

示例1: button1_Click

        private void button1_Click(object sender, EventArgs e)
        {
            try
            {
                MainForm.DefaultDevSite.User = txtUser.Text;
                MainForm.DefaultDevSite.Password = txtPassword.Text;
                MainForm.DefaultDevSite.AccessPoint = txtAP.Text;
                MainForm.DefaultDevSite.ContractName = cboContract.Text;

                XmlHelper apXml = new XmlHelper("<AppContent/>");
                apXml.AddElement(".", "AccessPoint", txtAP.Text);
                apXml.AddElement(".", "ContractName", cboContract.Text);
                apXml.AddElement(".", "User", txtUser.Text);
                apXml.AddElement(".", "Password", txtPassword.Text);

                MainForm.Storage.SetPropertyXml("DevLoginAP", txtAP.Text, apXml.GetElement("."));
                MainForm.Storage.SetProperty("DevLastLoginAP", txtAP.Text);
                MainForm.Storage.SetProperty("DevLastLoginContract", cboContract.Text);
                MainForm.Storage.SetProperty("DevLastLoginName", txtUser.Text);
                MainForm.Storage.SetProperty("DevLastLoginPassword", txtPassword.Text);
                MainForm.Storage.SetProperty("DevAutoLogin", chkAutoLogin.Checked.ToString().ToLower());
                
                MainForm.LoginArgs.StaticPreference = apXml.GetElement("."); ;

                this.Close();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
开发者ID:lidonghao1116,项目名称:ProjectManager,代码行数:31,代码来源:DevSiteForm.cs

示例2: 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

示例3: Generate

        public System.Xml.XmlElement Generate(XmlElement serviceDefinition)
        {
            ServiceEntity service = ServiceEntity.Parse(serviceDefinition);

            XmlHelper h2 = new XmlHelper("<Request/>");
            XmlElement e = h2.AddElement(".", service.RequestRecordElement);
            XmlHelper h = new XmlHelper(e);

            XmlElement reqElement = h.GetElement(".");
            
            XmlElement conditionElement = h.GetElement(".");
            if (!string.IsNullOrWhiteSpace(service.ConditionList.Source))
                conditionElement = h.AddElement(".", service.ConditionList.Source);

            XmlHelper conditionHelper = new XmlHelper(conditionElement);
            List<Condition> _requires = new List<Condition>();
            List<Condition> _notRequires = new List<Condition>();

            foreach (Condition condition in service.ConditionList.Conditions)
            {
                if (condition.SourceType != SourceType.Request) continue;
                if (condition.Required)
                    _requires.Add(condition);
                else
                    _notRequires.Add(condition);
            }

            if (_requires.Count > 0)
            {
                XmlNode comment = conditionElement.OwnerDocument.CreateComment("以下為必要條件");
                conditionElement.AppendChild(comment);

                foreach (Condition con in _requires)
                {
                    conditionHelper.AddElement(".", con.Source);
                }
            }

            if (_notRequires.Count > 0)
            {
                XmlNode comment = conditionElement.OwnerDocument.CreateComment("以下為非必要條件");
                conditionElement.AppendChild(comment);

                foreach (Condition con in _notRequires)
                {
                    conditionHelper.AddElement(".", con.Source);
                }
            }          
            return h2.GetElement(".");
        }
开发者ID:lidonghao1116,项目名称:ProjectManager,代码行数:50,代码来源:DeleteTempGenerator.cs

示例4: btnSave_Click

        private void btnSave_Click(object sender, EventArgs e)
        {
            if (txtModule.Text == _moduleURL && txtGreening.Text == _greeningURL)
            {
                this.Close();
                return;
            }
            DialogResult dr = MessageBox.Show("設定已變更, 儲存後必須重新啟動程式以套用新設定。\n是否儲存?", "問題", MessageBoxButtons.YesNo, MessageBoxIcon.Warning);
            if (dr == System.Windows.Forms.DialogResult.Yes)
            {
                string path = Path.Combine(Environment.CurrentDirectory, "Setup.config");
                //if (File.Exists(path))
                //    File.Delete(path);

                XmlHelper h = new XmlHelper("<Setup/>");
                h.AddElement(".", "GreeningAccessPoint", txtGreening.Text);
                h.AddElement(".", "ModuleAccessPoint", txtModule.Text);
                h.GetElement(".").OwnerDocument.Save(path);

                if (SetupChanged != null)
                    SetupChanged.Invoke(this, e);
                else
                    MessageBox.Show("儲存完畢", "完成", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }

            this.Close();
        }
开发者ID:lidonghao1116,项目名称:ProjectManager,代码行数:27,代码来源:SetupConfigForm.cs

示例5: GetAuthElement

 public System.Xml.XmlElement GetAuthElement()
 {
     XmlHelper h = new XmlHelper("<Authentication />");
     h.AddElement(".", "Public");
     h.SetAttribute("Public", "Enabled", "true");
     return h.GetElement(".");
 }
开发者ID:lidonghao1116,项目名称:ProjectManager,代码行数:7,代码来源:PublicAuthEditor.cs

示例6: 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

示例7: GetXml

 internal XmlElement GetXml()
 {
     XmlHelper h = new XmlHelper("<Order/>");
     h.SetAttribute(".", "Target", Target);
     h.SetAttribute(".", "Source", Source);
     return h.GetElement(".");
 }
开发者ID:lidonghao1116,项目名称:ProjectManager,代码行数:7,代码来源:Order.cs

示例8: Generate

        public XmlElement Generate(XmlElement serviceDefinition)
        {
            ServiceEntity service = ServiceEntity.Parse(serviceDefinition);

            XmlHelper h = new XmlHelper("<Request/>");
            XmlElement reqElement = h.GetElement(".");
                        
            XmlElement recElement = h.AddElement(".", service.RequestRecordElement);
            XmlHelper recHelper = new XmlHelper(recElement);
            XmlElement fieldElement = recHelper.GetElement(".");
            if (!string.IsNullOrWhiteSpace(service.FieldList.Source))
                fieldElement = recHelper.AddElement(".", service.FieldList.Source);

            XmlHelper fieldHelper = new XmlHelper(fieldElement);
            List<Field> _requires = new List<Field>();
            List<Field> _notRequries = new List<Field>();

            foreach (Field field in service.FieldList.Fields)
            {
                if (field.SourceType != SourceType.Request) continue;
                if (field.AutoNumber) continue;

                if (field.InputType == IOType.Attribute)
                    fieldElement.SetAttribute(field.Source, string.Empty);
                else if (field.Required)
                    _requires.Add(field);
                else
                    _notRequries.Add(field);
            }

            if (_requires.Count > 0)
            {
                XmlNode node = reqElement.OwnerDocument.CreateComment("以下為必要欄位");
                fieldElement.AppendChild(node);

                foreach (Field field in _requires)
                {
                    string value = string.Empty;
                    if (field.InputType == IOType.Xml)
                        value = "xml";
                    fieldHelper.AddElement(".", field.Source, value);
                }
            }

            if (_notRequries.Count > 0)
            {
                XmlNode node = reqElement.OwnerDocument.CreateComment("以下為非必要欄位");
                fieldElement.AppendChild(node);

                foreach (Field field in _notRequries)
                {
                    string value = string.Empty;
                    if (field.InputType == IOType.Xml)
                        value = "xml";
                    fieldHelper.AddElement(".", field.Source, value);
                }
            }
           
            return reqElement;
        }
开发者ID:lidonghao1116,项目名称:ProjectManager,代码行数:60,代码来源:InsertTempGenerator.cs

示例9: SendRequest

        private static Dictionary<string, ConfigurationRecord> SendRequest(DSXmlHelper request)
        {
            string srvname = "SmartSchool.Configuration.GetDetailList";
            Dictionary<string, ConfigurationRecord> records = new Dictionary<string, ConfigurationRecord>();

            DSXmlHelper response = DSAServices.CallService(srvname, new DSRequest(request)).GetContent();

            foreach (XmlElement each in response.GetElements("Configuration"))
            {
                XmlHelper helper = new XmlHelper(each);
                string name = helper.GetString("Name");

                XmlElement configdata = null;
                foreach (XmlNode content in helper.GetElement("Content").ChildNodes)
                {
                    if (content.NodeType == XmlNodeType.Element) //內容可能是以「Configurations」為 Root,也可能是舊的格式。
                        configdata = content as XmlElement;
                }

                if (configdata == null)
                    configdata = XmlHelper.LoadXml("<" + ConfigurationRecord.RootName + "/>");

                records.Add(name, new ConfigurationRecord(name, configdata as XmlElement));
            }

            return records;
        }
开发者ID:ChunTaiChen,项目名称:K12.Data,代码行数:27,代码来源:ConfigProvider_App.cs

示例10: Output

 public XmlElement Output()
 {
     XmlHelper h = new XmlHelper("<Converter />");
     h.SetAttribute(".", "Name", this.Name);
     h.SetAttribute(".", "Type", this.Type);
     h.AddElement(".", "Key", this.Key);
     return h.GetElement(".");
 }
开发者ID:lidonghao1116,项目名称:ProjectManager,代码行数:8,代码来源:DecodeConverter.cs

示例11: GetXml

 public System.Xml.XmlElement GetXml()
 {
     UUIDVariableEditor editor = this.Editor as UUIDVariableEditor;
     XmlHelper h = new XmlHelper("<Variable/>");
     h.SetAttribute(".", "Name", editor.VariableName);
     h.SetAttribute(".", "Source", this.Source);
     //h.SetAttribute(".", "Key", editor.VariableKey);
     return h.GetElement(".");
 }
开发者ID:lidonghao1116,项目名称:ProjectManager,代码行数:9,代码来源:UUIDVariable.cs

示例12: Rename

        internal void Rename(string newName)
        {
            newName = newName.ToLower();
            XmlHelper req = new XmlHelper("<Request/>");
            req.AddElement(".", "TableName", this.Name);
            req.AddElement(".", "NewName", newName);
            MainForm.CurrentProject.SendRequest("UDTService.DDL.RenameTable", new Envelope(req));

            XmlHelper pref = new XmlHelper(MainForm.CurrentProject.Preference);
            XmlElement e = pref.GetElement("Property[@Name='UDT']/UDT[@Name='" + this.Name + "']");
            e.SetAttribute("Name", newName);
            MainForm.CurrentProject.UpdateProjectPreference(pref.GetElement("."));

            this.Name = newName;

            if (Renamed != null)
                Renamed.Invoke(this, EventArgs.Empty);
        }
开发者ID:lidonghao1116,项目名称:ProjectManager,代码行数:18,代码来源:UDTTable.cs

示例13: btnOK_Click

 private void btnOK_Click(object sender, EventArgs e)
 {
     XmlHelper h = new XmlHelper();
     h.AddElement(".", "UsePassport", rbPassport.Checked.ToString());
     h.AddElement(".", "User", txtUser.Text);
     h.AddElement(".", "Password", txtPwd.Text);
     h.AddElement(".", "Auth", txtProvider.Text);
     MainForm.Storage.SetPropertyXml("ServiceTestTemp", _contractUniqName, h.GetElement("."));
     this.Hide();
 }
开发者ID:lidonghao1116,项目名称:ProjectManager,代码行数:10,代码来源:SecurityTokenForm.cs

示例14: GetSample

        public XmlElement GetSample()
        {
            XmlHelper h = new XmlHelper("<Converter />");
            h.SetAttribute(".", "Name", this.Name);
            h.SetAttribute(".", "Type", this.Type);

            h.AddElement(".", "Key", "decode_key");

            return h.GetElement(".");
        }
开发者ID:lidonghao1116,项目名称:ProjectManager,代码行数:10,代码来源:DecodeConverter.cs

示例15: ContractHandler

        internal ContractHandler(XmlElement contractElement)
        {
            Name = contractElement.GetAttribute("Name");

            XmlHelper h = new XmlHelper(contractElement);
            Enabled = h.TryGetBoolean("@Enabled", true);
            this.InitDefinition(h.GetElement("Definition"));

            init();
        }
开发者ID:lidonghao1116,项目名称:ProjectManager,代码行数:10,代码来源:ContractHandler.cs


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