本文整理汇总了C#中System.Xml.Linq.XDocument.GetChromeState方法的典型用法代码示例。如果您正苦于以下问题:C# XDocument.GetChromeState方法的具体用法?C# XDocument.GetChromeState怎么用?C# XDocument.GetChromeState使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Xml.Linq.XDocument
的用法示例。
在下文中一共展示了XDocument.GetChromeState方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: DeployModel
public override void DeployModel(object modelHost, DefinitionBase model)
{
var listItemModelHost = modelHost.WithAssertAndCast<ListItemModelHost>("modelHost", value => value.RequireNotNull());
var definition = model.WithAssertAndCast<WebPartDefinition>("model", value => value.RequireNotNull());
var pageItem = listItemModelHost.HostListItem;
var context = pageItem.Context;
var siteServerUrl = listItemModelHost.HostSite.ServerRelativeUrl;
var webUrl = listItemModelHost.HostWeb.Url;
var serverUrl = context.Url;
if (siteServerUrl != "/")
serverUrl = context.Url.Split(new string[] { siteServerUrl }, StringSplitOptions.RemoveEmptyEntries)[0];
var absItemUrl = UrlUtility.CombineUrl(serverUrl, pageItem["FileRef"].ToString());
WithWithExistingWebPart(pageItem, definition, (spObject, spObjectDefintion) =>
{
var webpartExportUrl = UrlUtility.CombineUrl(new[]{
webUrl,
"_vti_bin/exportwp.aspx?pageurl=" + absItemUrl + "&" + "guidstring=" + spObjectDefintion.Id.ToString()
});
var assert = ServiceFactory.AssertService
.NewAssert(model, definition, spObject)
.ShouldNotBeNull(spObject);
var webClient = new WebClient();
if (context.Credentials != null)
webClient.Credentials = context.Credentials;
else
webClient.UseDefaultCredentials = true;
var webPartXmlString = webClient.DownloadString(webpartExportUrl);
CurrentWebPartXml = WebpartXmlExtensions.LoadWebpartXmlDocument(webPartXmlString);
assert.ShouldBeEqual(m => m.Title, o => o.Title);
if (!string.IsNullOrEmpty(definition.ExportMode))
{
var value = CurrentWebPartXml.GetExportMode();
assert.ShouldBeEqual((p, s, d) =>
{
var srcProp = s.GetExpressionValue(m => m.ExportMode);
var isValid = definition.ExportMode == value;
return new PropertyValidationResult
{
Tag = p.Tag,
Src = srcProp,
Dst = null,
IsValid = isValid
};
});
}
else
assert.SkipProperty(m => m.ExportMode, "ExportMode is null or empty. Skipping.");
if (!string.IsNullOrEmpty(definition.ChromeState))
{
var value = CurrentWebPartXml.GetChromeState();
assert.ShouldBeEqual((p, s, d) =>
{
var srcProp = s.GetExpressionValue(m => m.ChromeState);
var isValid = definition.ChromeState == value;
return new PropertyValidationResult
{
Tag = p.Tag,
Src = srcProp,
Dst = null,
IsValid = isValid
};
});
}
else
assert.SkipProperty(m => m.ChromeState, "ChromeState is null or empty. Skipping.");
if (!string.IsNullOrEmpty(definition.ChromeType))
{
// returns correct one depending on the V2/V3
var value = CurrentWebPartXml.GetChromeType();
var chromeType = string.Empty;
if (CurrentWebPartXml.IsV3version())
chromeType = WebPartChromeTypesConvertService.NormilizeValueToPartChromeTypes(definition.ChromeType);
else if (CurrentWebPartXml.IsV2version())
chromeType = WebPartChromeTypesConvertService.NormilizeValueToFrameTypes(definition.ChromeType);
assert.ShouldBeEqual((p, s, d) =>
{
var srcProp = s.GetExpressionValue(m => m.ChromeType);
//.........这里部分代码省略.........
示例2: DeployModel
//.........这里部分代码省略.........
Src = srcProp,
Dst = null,
IsValid = isValid
};
});
}
else
assert.SkipProperty(m => m.Properties, "Properties are empty. Skipping.");
if (!string.IsNullOrEmpty(definition.ExportMode))
{
var value = CurrentWebPartXml.GetExportMode();
assert.ShouldBeEqual((p, s, d) =>
{
var srcProp = s.GetExpressionValue(m => m.ExportMode);
var isValid = definition.ExportMode == value;
return new PropertyValidationResult
{
Tag = p.Tag,
Src = srcProp,
Dst = null,
IsValid = isValid
};
});
}
else
assert.SkipProperty(m => m.ExportMode, "ExportMode is null or empty. Skipping.");
if (!string.IsNullOrEmpty(definition.ChromeState))
{
var value = CurrentWebPartXml.GetChromeState();
assert.ShouldBeEqual((p, s, d) =>
{
var srcProp = s.GetExpressionValue(m => m.ChromeState);
var isValid = definition.ChromeState == value;
return new PropertyValidationResult
{
Tag = p.Tag,
Src = srcProp,
Dst = null,
IsValid = isValid
};
});
}
else
assert.SkipProperty(m => m.ChromeState, "ChromeState is null or empty. Skipping.");
if (!string.IsNullOrEmpty(definition.ChromeType))
{
// returns correct one depending on the V2/V3
var value = CurrentWebPartXml.GetChromeType();
var chromeType = string.Empty;
if (CurrentWebPartXml.IsV3version())
chromeType = WebPartChromeTypesConvertService.NormilizeValueToPartChromeTypes(definition.ChromeType);
else if (CurrentWebPartXml.IsV2version())
chromeType = WebPartChromeTypesConvertService.NormilizeValueToFrameTypes(definition.ChromeType);
assert.ShouldBeEqual((p, s, d) =>
{