本文整理汇总了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);
}
}
示例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;
}
示例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(".");
}
示例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();
}
示例5: GetAuthElement
public System.Xml.XmlElement GetAuthElement()
{
XmlHelper h = new XmlHelper("<Authentication />");
h.AddElement(".", "Public");
h.SetAttribute("Public", "Enabled", "true");
return h.GetElement(".");
}
示例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;
}
示例7: GetXml
internal XmlElement GetXml()
{
XmlHelper h = new XmlHelper("<Order/>");
h.SetAttribute(".", "Target", Target);
h.SetAttribute(".", "Source", Source);
return h.GetElement(".");
}
示例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;
}
示例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;
}
示例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(".");
}
示例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(".");
}
示例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);
}
示例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();
}
示例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(".");
}
示例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();
}