本文整理汇总了C#中XElement.GetString方法的典型用法代码示例。如果您正苦于以下问题:C# XElement.GetString方法的具体用法?C# XElement.GetString怎么用?C# XElement.GetString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类XElement
的用法示例。
在下文中一共展示了XElement.GetString方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Reload
public void Reload(XElement element)
{
JavaScriptSerializer serializer = new JavaScriptSerializer();
BrowserSourceSettings = AbstractSettings.DeepClone(BrowserSettings.Instance.SourceSettings);
BrowserInstanceSettings = AbstractSettings.DeepClone(BrowserSettings.Instance.InstanceSettings);
String instanceSettingsString = element.GetString("instanceSettings");
String sourceSettingsString = element.GetString("sourceSettings");
if (sourceSettingsString != null && sourceSettingsString.Count() > 0)
{
try
{
BrowserSourceSettings = serializer.Deserialize<BrowserSourceSettings>(sourceSettingsString);
}
catch (ArgumentException e)
{
API.Instance.Log("Failed to deserialized source settings and forced to recreate; {0}", e.Message);
}
}
if (instanceSettingsString != null && instanceSettingsString.Count() > 0)
{
BrowserInstanceSettings.MergeWith(serializer.Deserialize<BrowserInstanceSettings>(instanceSettingsString));
}
}
示例2: SampleConfigurationDialog
public SampleConfigurationDialog(XElement config)
{
InitializeComponent();
this.config = config;
String file = config.GetString("file");
if (File.Exists(file))
{
LoadImage(new Uri(config.GetString("file")));
}
}
示例3: ShowConfiguration
public override bool ShowConfiguration(XElement config)
{
var dialog = new LiveSplitConfigurationDialog(config);
if (dialog.ShowDialog().GetValueOrDefault(false))
{
if (config.Parent.GetInt("cx") == 0 || config.Parent.GetInt("cy") == 0)
{
try
{
using (var layoutStream = System.IO.File.OpenRead(config.GetString("layoutpath")))
{
var xmlDoc = new System.Xml.XmlDocument();
xmlDoc.Load(layoutStream);
var parent = xmlDoc["Layout"];
var width = parent["VerticalWidth"];
config.Parent.SetInt("cx", int.Parse(width.InnerText));
var height = parent["VerticalHeight"];
config.Parent.SetInt("cy", int.Parse(height.InnerText)); //TODO Will break with horizontal
}
}
catch (Exception ex)
{
Log.Error(ex);
}
}
return true;
}
return false;
}
示例4: LiveSplitConfigurationDialog
public LiveSplitConfigurationDialog(XElement config)
{
this.config = config;
InitializeComponent();
txtSplitsPath.Text = config.GetString("splitspath");
txtLayoutPath.Text = config.GetString("layoutpath");
var anchorRight = config.GetInt("anchorright") == 1;
var anchorBottom = config.GetInt("anchorbottom") == 1;
if (anchorRight)
{
if (anchorBottom)
rdoBottomRight.IsChecked = true;
else
rdoTopRight.IsChecked = true;
}
else
{
if (anchorBottom)
rdoBottomLeft.IsChecked = true;
else
rdoTopLeft.IsChecked = true;
}
}